build: add local node bin to restart script PATH

This commit is contained in:
Peter Steinberger
2025-12-07 18:49:55 +01:00
parent 558af7a454
commit d463c82c95
31 changed files with 2089 additions and 1851 deletions

View File

@@ -16,15 +16,15 @@ import { isVerbose, logVerbose } from "../globals.js";
import { triggerWarelayRestart } from "../infra/restart.js";
import { runCommandWithTimeout } from "../process/exec.js";
import { defaultRuntime } from "../runtime.js";
import { resolveHeartbeatSeconds } from "../web/reconnect.js";
import { getWebAuthAgeMs, webAuthExists } from "../web/session.js";
import { runCommandReply } from "./command-reply.js";
import { buildStatusMessage } from "./status.js";
import {
applyTemplate,
type MsgContext,
type TemplateContext,
} from "./templating.js";
import { buildStatusMessage } from "./status.js";
import { resolveHeartbeatSeconds } from "../web/reconnect.js";
import { getWebAuthAgeMs, webAuthExists } from "../web/session.js";
import {
normalizeThinkLevel,
normalizeVerboseLevel,

View File

@@ -1,7 +1,6 @@
import { spawnSync } from "node:child_process";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { spawnSync } from "node:child_process";
import { lookupContextTokens } from "../agents/context.js";
import { DEFAULT_CONTEXT_TOKENS, DEFAULT_MODEL } from "../agents/defaults.js";
@@ -79,9 +78,8 @@ const probeAgentCommand = (command?: string[]): AgentProbe => {
encoding: "utf-8",
timeout: 1500,
});
const found = res.status === 0 && res.stdout
? res.stdout.split("\n")[0]?.trim()
: "";
const found =
res.status === 0 && res.stdout ? res.stdout.split("\n")[0]?.trim() : "";
return {
ok: Boolean(found),
detail: found || "not in PATH",
@@ -115,7 +113,7 @@ export function buildStatusMessage(args: StatusArgs): string {
DEFAULT_CONTEXT_TOKENS;
const totalTokens =
entry?.totalTokens ??
((entry?.inputTokens ?? 0) + (entry?.outputTokens ?? 0));
(entry?.inputTokens ?? 0) + (entry?.outputTokens ?? 0);
const agentProbe = probeAgentCommand(args.reply?.command);
const thinkLevel =
@@ -138,7 +136,9 @@ export function buildStatusMessage(args: StatusArgs): string {
const sessionLine = [
`Session: ${args.sessionKey ?? "unknown"}`,
`scope ${args.sessionScope ?? "per-sender"}`,
entry?.updatedAt ? `updated ${formatAge(now - entry.updatedAt)}` : "no activity",
entry?.updatedAt
? `updated ${formatAge(now - entry.updatedAt)}`
: "no activity",
args.storePath ? `store ${abbreviatePath(args.storePath)}` : undefined,
]
.filter(Boolean)
@@ -155,7 +155,13 @@ export function buildStatusMessage(args: StatusArgs): string {
const helpersLine = "Shortcuts: /new reset | /restart relink";
return [ "⚙️ Status", webLine, agentLine, contextLine, sessionLine, optionsLine, helpersLine ].join(
"\n",
);
return [
"⚙️ Status",
webLine,
agentLine,
contextLine,
sessionLine,
optionsLine,
helpersLine,
].join("\n");
}