ctxpipe 0.2.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -20
- package/dist/auth.js +1 -2
- package/dist/auth.js.map +1 -1
- package/dist/commands.d.ts +5 -2
- package/dist/commands.js +44 -12
- package/dist/commands.js.map +1 -1
- package/dist/fs-operations.d.ts +1 -1
- package/dist/fs-operations.js +8 -1
- package/dist/fs-operations.js.map +1 -1
- package/dist/mcp/doctor.d.ts +21 -0
- package/dist/mcp/doctor.js +326 -0
- package/dist/mcp/doctor.js.map +1 -0
- package/dist/mcp/mcp-operations.d.ts +12 -17
- package/dist/mcp/mcp-operations.js +116 -263
- package/dist/mcp/mcp-operations.js.map +1 -1
- package/dist/memory/capture.d.ts +79 -0
- package/dist/memory/capture.js +809 -0
- package/dist/memory/capture.js.map +1 -0
- package/dist/memory/hooks.d.ts +16 -0
- package/dist/memory/hooks.js +403 -0
- package/dist/memory/hooks.js.map +1 -0
- package/dist/memory/index.d.ts +1 -2
- package/dist/memory/index.js +1 -2
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/paths.d.ts +2 -10
- package/dist/memory/paths.js +5 -59
- package/dist/memory/paths.js.map +1 -1
- package/dist/memory/run-capture.d.ts +12 -0
- package/dist/memory/run-capture.js +116 -0
- package/dist/memory/run-capture.js.map +1 -0
- package/dist/memory/run-init.d.ts +0 -1
- package/dist/memory/run-init.js +10 -14
- package/dist/memory/run-init.js.map +1 -1
- package/dist/memory/run-meta.js +49 -86
- package/dist/memory/run-meta.js.map +1 -1
- package/dist/memory/seed.d.ts +18 -0
- package/dist/memory/seed.js +258 -0
- package/dist/memory/seed.js.map +1 -0
- package/dist/memory/upgrade.d.ts +16 -0
- package/dist/memory/upgrade.js +283 -0
- package/dist/memory/upgrade.js.map +1 -0
- package/dist/program.js +79 -31
- package/dist/program.js.map +1 -1
- package/dist/prompts.js +15 -14
- package/dist/prompts.js.map +1 -1
- package/dist/ui.js +5 -1
- package/dist/ui.js.map +1 -1
- package/package.json +4 -4
- package/dist/memory/agentmemory-client.d.ts +0 -24
- package/dist/memory/agentmemory-client.js +0 -47
- package/dist/memory/agentmemory-client.js.map +0 -1
- package/dist/memory/hydration.d.ts +0 -141
- package/dist/memory/hydration.js +0 -390
- package/dist/memory/hydration.js.map +0 -1
- package/dist/memory/markdown.d.ts +0 -29
- package/dist/memory/markdown.js +0 -193
- package/dist/memory/markdown.js.map +0 -1
- package/dist/memory/mcp-server.d.ts +0 -48
- package/dist/memory/mcp-server.js +0 -322
- package/dist/memory/mcp-server.js.map +0 -1
- package/dist/memory/policy.d.ts +0 -16
- package/dist/memory/policy.js +0 -81
- package/dist/memory/policy.js.map +0 -1
- package/dist/memory/run-hook.d.ts +0 -13
- package/dist/memory/run-hook.js +0 -44
- package/dist/memory/run-hook.js.map +0 -1
- package/dist/memory/run-mcp.d.ts +0 -3
- package/dist/memory/run-mcp.js +0 -7
- package/dist/memory/run-mcp.js.map +0 -1
- package/dist/memory/supervisor.d.ts +0 -49
- package/dist/memory/supervisor.js +0 -217
- package/dist/memory/supervisor.js.map +0 -1
package/dist/memory/policy.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export const POLICY = {
|
|
2
|
-
memory_save: "write-markdown-then-hydrate",
|
|
3
|
-
memory_recall: "hydrate-then-query-or-markdown-fallback",
|
|
4
|
-
memory_smart_search: "hydrate-then-query-or-markdown-fallback",
|
|
5
|
-
memory_status: "ctxpipe-native",
|
|
6
|
-
memory_summarize_session: "gate-hosted-model",
|
|
7
|
-
memory_consolidate: "gate-hosted-model",
|
|
8
|
-
memory_export: "hide",
|
|
9
|
-
memory_governance_delete: "hide",
|
|
10
|
-
};
|
|
11
|
-
const DESCRIPTIONS = {
|
|
12
|
-
memory_save: {
|
|
13
|
-
name: "memory_save",
|
|
14
|
-
description: "Save a durable memory record into the canonical .ai/memory Markdown tree, then hydrate AgentMemory.",
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: "object",
|
|
17
|
-
required: ["id", "body"],
|
|
18
|
-
properties: {
|
|
19
|
-
id: { type: "string", description: "Stable identifier (slug). Must be unique across the repo." },
|
|
20
|
-
type: { type: "string", description: "Record category: architecture | decision | pattern | lesson | session | fact | note" },
|
|
21
|
-
title: { type: "string", description: "Human-readable title; defaults to the id." },
|
|
22
|
-
body: { type: "string", description: "Markdown body. Must be safe to commit." },
|
|
23
|
-
concepts: { type: "array", items: { type: "string" } },
|
|
24
|
-
files: { type: "array", items: { type: "string" } },
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
memory_recall: {
|
|
29
|
-
name: "memory_recall",
|
|
30
|
-
description: "Recall ctxpipe memories matching the query. Uses hydrated AgentMemory when available, falls back to direct Markdown search.",
|
|
31
|
-
inputSchema: {
|
|
32
|
-
type: "object",
|
|
33
|
-
required: ["query"],
|
|
34
|
-
properties: {
|
|
35
|
-
query: { type: "string" },
|
|
36
|
-
limit: { type: "integer", minimum: 1, maximum: 50 },
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
memory_smart_search: {
|
|
41
|
-
name: "memory_smart_search",
|
|
42
|
-
description: "Smart search over ctxpipe memories. Like memory_recall but allows AgentMemory to use richer ranking when available.",
|
|
43
|
-
inputSchema: {
|
|
44
|
-
type: "object",
|
|
45
|
-
required: ["query"],
|
|
46
|
-
properties: {
|
|
47
|
-
query: { type: "string" },
|
|
48
|
-
limit: { type: "integer", minimum: 1, maximum: 50 },
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
memory_status: {
|
|
53
|
-
name: "memory_status",
|
|
54
|
-
description: "Report current memory mode (signed-in / signed-out), runtime URL if any, and hosted model availability.",
|
|
55
|
-
inputSchema: { type: "object", properties: {} },
|
|
56
|
-
},
|
|
57
|
-
memory_summarize_session: {
|
|
58
|
-
name: "memory_summarize_session",
|
|
59
|
-
description: "Summarize the current session into a durable lesson. Requires ctxpipe hosted model access.",
|
|
60
|
-
inputSchema: {
|
|
61
|
-
type: "object",
|
|
62
|
-
properties: {
|
|
63
|
-
sessionId: { type: "string" },
|
|
64
|
-
prompt: { type: "string" },
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
memory_consolidate: {
|
|
69
|
-
name: "memory_consolidate",
|
|
70
|
-
description: "Consolidate recent memories. Requires ctxpipe hosted model access.",
|
|
71
|
-
inputSchema: { type: "object", properties: {} },
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
export function toolSpec(name) {
|
|
75
|
-
return (DESCRIPTIONS[name] ?? {
|
|
76
|
-
name,
|
|
77
|
-
description: `ctxpipe memory tool ${name}`,
|
|
78
|
-
inputSchema: { type: "object", properties: {} },
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/memory/policy.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,MAAM,GAAiC;IAClD,WAAW,EAAE,6BAA6B;IAC1C,aAAa,EAAE,yCAAyC;IACxD,mBAAmB,EAAE,yCAAyC;IAC9D,aAAa,EAAE,gBAAgB;IAC/B,wBAAwB,EAAE,mBAAmB;IAC7C,kBAAkB,EAAE,mBAAmB;IACvC,aAAa,EAAE,MAAM;IACrB,wBAAwB,EAAE,MAAM;CACjC,CAAA;AAQD,MAAM,YAAY,GAA6B;IAC7C,WAAW,EAAE;QACX,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,qGAAqG;QACvG,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC;YACxB,UAAU,EAAE;gBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2DAA2D,EAAE;gBAChG,IAAI,EAAE,EAAE,IAAI,EA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E;QACxB,IAAI,EAAE,0BAA0B;QAChC,WAAW,EACT,4FAA4F;QAC9F,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC7B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC3B;SACF;KACF;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,oEAAoE;QACtE,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KAChD;CACF,CAAA;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,CACL,YAAY,CAAC,IAAI,CAAC,IAAI;QACpB,IAAI;QACJ,WAAW,EAAE,uBAAuB,IAAI,EAAE;QAC1C,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KAChD,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lifecycle hook entrypoint. Invoked by agent-native hook configs (Claude Code,
|
|
3
|
-
* etc.) — must exit fast and never block the agent.
|
|
4
|
-
*
|
|
5
|
-
* For v1 we drop a JSON marker into the per-repo state dir so other parts of
|
|
6
|
-
* the system can observe that a session started/ended. Heavier work (summaries,
|
|
7
|
-
* consolidation, graph extraction) is deferred to the supervisor and runs when
|
|
8
|
-
* hosted model access is available.
|
|
9
|
-
*/
|
|
10
|
-
export declare function runMemoryHook(opts: {
|
|
11
|
-
name: string;
|
|
12
|
-
baseUrl: string;
|
|
13
|
-
}): Promise<void>;
|
package/dist/memory/run-hook.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { resolveCtxpipeBaseUrl } from "../auth.js";
|
|
4
|
-
import { ensureRepoStateDir, runtimeStateFile } from "./paths.js";
|
|
5
|
-
import { detectRepoFingerprint } from "./paths.js";
|
|
6
|
-
/**
|
|
7
|
-
* Lifecycle hook entrypoint. Invoked by agent-native hook configs (Claude Code,
|
|
8
|
-
* etc.) — must exit fast and never block the agent.
|
|
9
|
-
*
|
|
10
|
-
* For v1 we drop a JSON marker into the per-repo state dir so other parts of
|
|
11
|
-
* the system can observe that a session started/ended. Heavier work (summaries,
|
|
12
|
-
* consolidation, graph extraction) is deferred to the supervisor and runs when
|
|
13
|
-
* hosted model access is available.
|
|
14
|
-
*/
|
|
15
|
-
export async function runMemoryHook(opts) {
|
|
16
|
-
const baseUrl = resolveCtxpipeBaseUrl(process.cwd(), opts.baseUrl);
|
|
17
|
-
const fingerprint = detectRepoFingerprint(process.cwd());
|
|
18
|
-
const stateDir = ensureRepoStateDir(fingerprint);
|
|
19
|
-
const event = {
|
|
20
|
-
name: opts.name,
|
|
21
|
-
baseUrl,
|
|
22
|
-
cwd: process.cwd(),
|
|
23
|
-
at: new Date().toISOString(),
|
|
24
|
-
};
|
|
25
|
-
const eventsFile = join(stateDir, "hook-events.jsonl");
|
|
26
|
-
try {
|
|
27
|
-
writeFileSync(eventsFile, `${JSON.stringify(event)}\n`, { flag: "a" });
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
// hooks must never throw — they would break the agent session
|
|
31
|
-
}
|
|
32
|
-
// Touch the runtime file modification time so the supervisor can pick up the
|
|
33
|
-
// event on the next memory tool call without us having to run a long-lived
|
|
34
|
-
// worker here.
|
|
35
|
-
const runtimeFile = runtimeStateFile(fingerprint);
|
|
36
|
-
try {
|
|
37
|
-
writeFileSync(runtimeFile, "", { flag: "a" });
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
// best effort
|
|
41
|
-
}
|
|
42
|
-
process.stdout.write(JSON.stringify({ status: "ok", event: opts.name }));
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=run-hook.js.map
|
|
@@ -1 +0,0 @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AAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,cAAc;IAChB,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC"}
|
package/dist/memory/run-mcp.d.ts
DELETED
package/dist/memory/run-mcp.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { resolveCtxpipeBaseUrl } from "../auth.js";
|
|
2
|
-
import { startMcpServer } from "./mcp-server.js";
|
|
3
|
-
export async function runMemoryMcp(opts) {
|
|
4
|
-
const baseUrl = resolveCtxpipeBaseUrl(process.cwd(), opts.baseUrl);
|
|
5
|
-
await startMcpServer({ baseUrl });
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=run-mcp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-mcp.js","sourceRoot":"","sources":["../../src/memory/run-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAyB;IAC1D,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAClE,MAAM,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC,CAAA;AACnC,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type RepoFingerprint } from "./paths.js";
|
|
2
|
-
export declare const PINNED_AGENTMEMORY_VERSION = "0.9.21";
|
|
3
|
-
export type AgentMemoryPorts = {
|
|
4
|
-
rest: number;
|
|
5
|
-
streams: number;
|
|
6
|
-
viewer: number;
|
|
7
|
-
engineWs: number;
|
|
8
|
-
};
|
|
9
|
-
export type RuntimeState = {
|
|
10
|
-
provider: "agentmemory";
|
|
11
|
-
agentmemoryVersion: string;
|
|
12
|
-
url: string;
|
|
13
|
-
viewerUrl: string;
|
|
14
|
-
pid: number;
|
|
15
|
-
startedAt: string;
|
|
16
|
-
mode: "local-only" | "signed-in";
|
|
17
|
-
hostedModel: "available" | "signed-out";
|
|
18
|
-
ports: AgentMemoryPorts;
|
|
19
|
-
/** AgentMemory REST bearer; env + in-process only (omitted from runtime.json). */
|
|
20
|
-
secret?: string;
|
|
21
|
-
};
|
|
22
|
-
export type SupervisorOptions = {
|
|
23
|
-
fingerprint: RepoFingerprint;
|
|
24
|
-
/** Override for tests. Defaults to `npx -y @agentmemory/agentmemory@<pin>`. */
|
|
25
|
-
command?: {
|
|
26
|
-
command: string;
|
|
27
|
-
args: string[];
|
|
28
|
-
};
|
|
29
|
-
/** Optional callback that returns the OAuth bearer to forward as OPENAI_API_KEY. */
|
|
30
|
-
getAccessToken?: () => Promise<string | null>;
|
|
31
|
-
/** Override for tests so we can keep tests fully offline. */
|
|
32
|
-
liveZUrl?: (ports: AgentMemoryPorts) => string;
|
|
33
|
-
/** OpenAI base URL to forward chat/embeddings through; usually the backend proxy. */
|
|
34
|
-
openaiBaseUrl?: string;
|
|
35
|
-
chatModel?: string;
|
|
36
|
-
embeddingModel?: string;
|
|
37
|
-
/** Max ms to wait for /agentmemory/livez. Default 30_000. */
|
|
38
|
-
readinessTimeoutMs?: number;
|
|
39
|
-
};
|
|
40
|
-
export type Supervisor = {
|
|
41
|
-
/** Returns existing state if alive, otherwise spawns the runtime and waits for livez. */
|
|
42
|
-
ensureRunning(): Promise<RuntimeState>;
|
|
43
|
-
/** Stop the runtime if we started it; returns true if we killed something. */
|
|
44
|
-
stop(): Promise<boolean>;
|
|
45
|
-
/** Return the current state or null if nothing is running. */
|
|
46
|
-
current(): RuntimeState | null;
|
|
47
|
-
};
|
|
48
|
-
export declare function createSupervisor(opts: SupervisorOptions): Supervisor;
|
|
49
|
-
export declare function allocatePorts(): Promise<AgentMemoryPorts>;
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import { randomBytes } from "node:crypto";
|
|
3
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { createServer } from "node:net";
|
|
5
|
-
import { agentMemoryHomeDir, ensureRepoStateDir, runtimeStateFile, } from "./paths.js";
|
|
6
|
-
export const PINNED_AGENTMEMORY_VERSION = "0.9.21";
|
|
7
|
-
export function createSupervisor(opts) {
|
|
8
|
-
let child = null;
|
|
9
|
-
let runtime = readSavedRuntime(opts.fingerprint);
|
|
10
|
-
if (runtime && !isPidAlive(runtime.pid)) {
|
|
11
|
-
runtime = null;
|
|
12
|
-
clearSavedRuntime(opts.fingerprint);
|
|
13
|
-
}
|
|
14
|
-
async function ensureRunning() {
|
|
15
|
-
if (runtime?.secret && isPidAlive(runtime.pid))
|
|
16
|
-
return runtime;
|
|
17
|
-
if (runtime && isPidAlive(runtime.pid) && !runtime.secret) {
|
|
18
|
-
try {
|
|
19
|
-
process.kill(runtime.pid, "SIGTERM");
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// ignored
|
|
23
|
-
}
|
|
24
|
-
clearSavedRuntime(opts.fingerprint);
|
|
25
|
-
runtime = null;
|
|
26
|
-
}
|
|
27
|
-
const ports = await allocatePorts();
|
|
28
|
-
const secret = generateAgentMemorySecret();
|
|
29
|
-
const home = ensureHome(opts.fingerprint);
|
|
30
|
-
const accessToken = opts.getAccessToken
|
|
31
|
-
? await opts.getAccessToken().catch(() => null)
|
|
32
|
-
: null;
|
|
33
|
-
const cmd = opts.command ?? {
|
|
34
|
-
command: process.platform === "win32" ? "npx.cmd" : "npx",
|
|
35
|
-
args: ["-y", `@agentmemory/agentmemory@${PINNED_AGENTMEMORY_VERSION}`],
|
|
36
|
-
};
|
|
37
|
-
const env = {
|
|
38
|
-
...process.env,
|
|
39
|
-
HOME: home,
|
|
40
|
-
AGENTMEMORY_SECRET: secret,
|
|
41
|
-
AGENTMEMORY_URL: `http://127.0.0.1:${ports.rest}`,
|
|
42
|
-
AGENTMEMORY_AUTO_COMPRESS: "false",
|
|
43
|
-
AGENTMEMORY_INJECT_CONTEXT: "false",
|
|
44
|
-
CONSOLIDATION_ENABLED: "false",
|
|
45
|
-
GRAPH_EXTRACTION_ENABLED: "false",
|
|
46
|
-
III_REST_PORT: String(ports.rest),
|
|
47
|
-
III_STREAMS_PORT: String(ports.streams),
|
|
48
|
-
III_VIEWER_PORT: String(ports.viewer),
|
|
49
|
-
III_ENGINE_PORT: String(ports.engineWs),
|
|
50
|
-
CTXPIPE_AGENTMEMORY_PORTS: JSON.stringify(ports),
|
|
51
|
-
};
|
|
52
|
-
if (accessToken && opts.openaiBaseUrl) {
|
|
53
|
-
env.OPENAI_BASE_URL = opts.openaiBaseUrl;
|
|
54
|
-
env.OPENAI_API_KEY = accessToken;
|
|
55
|
-
if (opts.chatModel)
|
|
56
|
-
env.OPENAI_MODEL = opts.chatModel;
|
|
57
|
-
if (opts.embeddingModel)
|
|
58
|
-
env.OPENAI_EMBEDDING_MODEL = opts.embeddingModel;
|
|
59
|
-
}
|
|
60
|
-
child = spawn(cmd.command, cmd.args, {
|
|
61
|
-
env,
|
|
62
|
-
cwd: home,
|
|
63
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
64
|
-
});
|
|
65
|
-
child.unref();
|
|
66
|
-
const liveZ = (opts.liveZUrl ?? defaultLiveZ)(ports);
|
|
67
|
-
const ok = await waitForLiveZ(liveZ, opts.readinessTimeoutMs ?? 30_000, () => child !== null && child.exitCode === null);
|
|
68
|
-
if (!ok) {
|
|
69
|
-
try {
|
|
70
|
-
child?.kill("SIGTERM");
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
// ignored
|
|
74
|
-
}
|
|
75
|
-
throw new Error(`AgentMemory failed to become ready at ${liveZ} within ${opts.readinessTimeoutMs ?? 30_000}ms`);
|
|
76
|
-
}
|
|
77
|
-
runtime = {
|
|
78
|
-
provider: "agentmemory",
|
|
79
|
-
agentmemoryVersion: PINNED_AGENTMEMORY_VERSION,
|
|
80
|
-
url: `http://127.0.0.1:${ports.rest}`,
|
|
81
|
-
viewerUrl: `http://127.0.0.1:${ports.viewer}`,
|
|
82
|
-
pid: child.pid ?? -1,
|
|
83
|
-
startedAt: new Date().toISOString(),
|
|
84
|
-
mode: accessToken ? "signed-in" : "local-only",
|
|
85
|
-
hostedModel: accessToken ? "available" : "signed-out",
|
|
86
|
-
ports,
|
|
87
|
-
secret,
|
|
88
|
-
};
|
|
89
|
-
// Persist a copy without the secret so it never reaches disk.
|
|
90
|
-
const { secret: _omitSecret, ...persisted } = runtime;
|
|
91
|
-
persistRuntime(opts.fingerprint, persisted);
|
|
92
|
-
return runtime;
|
|
93
|
-
}
|
|
94
|
-
async function stop() {
|
|
95
|
-
if (!runtime)
|
|
96
|
-
return false;
|
|
97
|
-
let killed = false;
|
|
98
|
-
try {
|
|
99
|
-
process.kill(runtime.pid, "SIGTERM");
|
|
100
|
-
killed = true;
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
killed = false;
|
|
104
|
-
}
|
|
105
|
-
clearSavedRuntime(opts.fingerprint);
|
|
106
|
-
runtime = null;
|
|
107
|
-
child = null;
|
|
108
|
-
return killed;
|
|
109
|
-
}
|
|
110
|
-
function current() {
|
|
111
|
-
return runtime;
|
|
112
|
-
}
|
|
113
|
-
return { ensureRunning, stop, current };
|
|
114
|
-
}
|
|
115
|
-
function defaultLiveZ(ports) {
|
|
116
|
-
return `http://127.0.0.1:${ports.rest}/agentmemory/livez`;
|
|
117
|
-
}
|
|
118
|
-
async function waitForLiveZ(url, timeoutMs, childAlive) {
|
|
119
|
-
const deadline = Date.now() + timeoutMs;
|
|
120
|
-
let delay = 100;
|
|
121
|
-
while (Date.now() < deadline) {
|
|
122
|
-
if (!childAlive())
|
|
123
|
-
return false;
|
|
124
|
-
try {
|
|
125
|
-
const res = await fetch(url, { signal: AbortSignal.timeout(2_000) });
|
|
126
|
-
if (res.ok)
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
catch {
|
|
130
|
-
// not ready yet
|
|
131
|
-
}
|
|
132
|
-
await new Promise((r) => setTimeout(r, delay));
|
|
133
|
-
delay = Math.min(delay * 2, 1_500);
|
|
134
|
-
}
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
export async function allocatePorts() {
|
|
138
|
-
const [rest, streams, viewer, engineWs] = await Promise.all([
|
|
139
|
-
allocateOne(),
|
|
140
|
-
allocateOne(),
|
|
141
|
-
allocateOne(),
|
|
142
|
-
allocateOne(),
|
|
143
|
-
]);
|
|
144
|
-
return { rest, streams, viewer, engineWs };
|
|
145
|
-
}
|
|
146
|
-
function allocateOne() {
|
|
147
|
-
return new Promise((res, rej) => {
|
|
148
|
-
const srv = createServer();
|
|
149
|
-
srv.unref();
|
|
150
|
-
srv.on("error", rej);
|
|
151
|
-
srv.listen({ port: 0, host: "127.0.0.1" }, () => {
|
|
152
|
-
const addr = srv.address();
|
|
153
|
-
if (addr && typeof addr === "object") {
|
|
154
|
-
const port = addr.port;
|
|
155
|
-
srv.close(() => res(port));
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
srv.close();
|
|
159
|
-
rej(new Error("Could not allocate port"));
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
function generateAgentMemorySecret() {
|
|
165
|
-
return randomBytes(32).toString("hex");
|
|
166
|
-
}
|
|
167
|
-
function ensureHome(fingerprint) {
|
|
168
|
-
ensureRepoStateDir(fingerprint);
|
|
169
|
-
const home = agentMemoryHomeDir(fingerprint);
|
|
170
|
-
if (!existsSync(home))
|
|
171
|
-
mkdirSync(home, { recursive: true });
|
|
172
|
-
return home;
|
|
173
|
-
}
|
|
174
|
-
function persistRuntime(fingerprint, state) {
|
|
175
|
-
ensureRepoStateDir(fingerprint);
|
|
176
|
-
writeFileSync(runtimeStateFile(fingerprint), `${JSON.stringify(state, null, 2)}\n`, {
|
|
177
|
-
encoding: "utf8",
|
|
178
|
-
mode: 0o600,
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
function readSavedRuntime(fingerprint) {
|
|
182
|
-
const file = runtimeStateFile(fingerprint);
|
|
183
|
-
if (!existsSync(file))
|
|
184
|
-
return null;
|
|
185
|
-
try {
|
|
186
|
-
const raw = readFileSync(file, "utf8").trim();
|
|
187
|
-
if (!raw)
|
|
188
|
-
return null;
|
|
189
|
-
return JSON.parse(raw);
|
|
190
|
-
}
|
|
191
|
-
catch {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
function clearSavedRuntime(fingerprint) {
|
|
196
|
-
const file = runtimeStateFile(fingerprint);
|
|
197
|
-
if (existsSync(file)) {
|
|
198
|
-
try {
|
|
199
|
-
writeFileSync(file, "");
|
|
200
|
-
}
|
|
201
|
-
catch {
|
|
202
|
-
// ignored
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
function isPidAlive(pid) {
|
|
207
|
-
if (!pid || pid <= 0)
|
|
208
|
-
return false;
|
|
209
|
-
try {
|
|
210
|
-
process.kill(pid, 0);
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
catch {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
//# sourceMappingURL=supervisor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../../src/memory/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,SAA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