@mnemom/mnemom 0.17.33 → 0.17.34-next.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/dist/base-url-proxy.mjs +18 -4
- package/dist/commands/agent-config.js +5 -1
- package/dist/commands/agent-doctor.d.ts +9 -0
- package/dist/commands/agent-doctor.js +4 -0
- package/dist/commands/agent-session.d.ts +1 -2
- package/dist/commands/agent-session.js +1 -2
- package/dist/commands/agent-setup.d.ts +6 -0
- package/dist/commands/agent-setup.js +12 -1
- package/dist/commands/agent-share-render.d.ts +1 -1
- package/dist/commands/agent-share-render.js +1 -1
- package/dist/commands/agent.d.ts +26 -0
- package/dist/commands/agent.js +228 -53
- package/dist/commands/durable-doctor.d.ts +50 -0
- package/dist/commands/durable-doctor.js +186 -0
- package/dist/commands/durable-lock.d.ts +254 -0
- package/dist/commands/durable-lock.js +595 -0
- package/dist/commands/durable-sessions.d.ts +87 -0
- package/dist/commands/durable-sessions.js +303 -0
- package/dist/commands/durable-verbs.d.ts +116 -0
- package/dist/commands/durable-verbs.js +393 -0
- package/dist/commands/protection.js +1 -1
- package/dist/commands/scan.d.ts +97 -0
- package/dist/commands/scan.js +238 -0
- package/dist/durable/flock.d.ts +26 -0
- package/dist/durable/flock.js +80 -0
- package/dist/durable/launch-spec.d.ts +7 -1
- package/dist/durable/launch-spec.js +10 -3
- package/dist/durable/seat-proxy-entry.d.ts +11 -0
- package/dist/durable/seat-proxy-entry.js +25 -0
- package/dist/durable/seat-proxy.d.ts +107 -0
- package/dist/durable/seat-proxy.js +599 -0
- package/dist/durable/seat-socket.d.ts +46 -0
- package/dist/durable/seat-socket.js +179 -0
- package/dist/durable/seat-spec-validator.d.ts +28 -0
- package/dist/durable/seat-spec-validator.js +59 -0
- package/dist/durable/test-mode.mjs +81 -0
- package/dist/durable/turn-chain.d.ts +55 -0
- package/dist/durable/turn-chain.js +178 -0
- package/dist/host/auto-continue.d.ts +67 -0
- package/dist/host/auto-continue.js +118 -0
- package/dist/host/bootid.d.ts +13 -0
- package/dist/host/bootid.js +41 -0
- package/dist/host/client.d.ts +123 -0
- package/dist/host/client.js +171 -0
- package/dist/host/commands.d.ts +2 -0
- package/dist/host/commands.js +122 -0
- package/dist/host/control.d.ts +33 -0
- package/dist/host/control.js +144 -0
- package/dist/host/daemon.d.ts +217 -0
- package/dist/host/daemon.js +606 -0
- package/dist/host/gate.d.ts +46 -0
- package/dist/host/gate.js +82 -0
- package/dist/host/grant.d.ts +24 -0
- package/dist/host/grant.js +24 -0
- package/dist/host/instance.d.ts +35 -0
- package/dist/host/instance.js +62 -0
- package/dist/host/integrity.d.ts +35 -0
- package/dist/host/integrity.js +115 -0
- package/dist/host/launchd.d.ts +16 -0
- package/dist/host/launchd.js +45 -0
- package/dist/host/lock.d.ts +20 -0
- package/dist/host/lock.js +63 -0
- package/dist/host/owner.d.ts +55 -0
- package/dist/host/owner.js +121 -0
- package/dist/host/plist.d.ts +16 -0
- package/dist/host/plist.js +85 -0
- package/dist/host/procs.d.ts +27 -0
- package/dist/host/procs.js +105 -0
- package/dist/host/run.d.ts +66 -0
- package/dist/host/run.js +314 -0
- package/dist/host/runtime.d.ts +8 -0
- package/dist/host/runtime.js +22 -0
- package/dist/host/s1-names.d.ts +22 -0
- package/dist/host/s1-names.js +21 -0
- package/dist/host/seat-credential.d.ts +27 -0
- package/dist/host/seat-credential.js +41 -0
- package/dist/host/seat-launch-main.d.ts +1 -0
- package/dist/host/seat-launch-main.js +59 -0
- package/dist/host/seat-launch.d.ts +116 -0
- package/dist/host/seat-launch.js +302 -0
- package/dist/host/seat.d.ts +48 -0
- package/dist/host/seat.js +149 -0
- package/dist/host/state.d.ts +33 -0
- package/dist/host/state.js +117 -0
- package/dist/host/status.d.ts +101 -0
- package/dist/host/status.js +307 -0
- package/dist/host/tmux.d.ts +56 -0
- package/dist/host/tmux.js +182 -0
- package/dist/host/transcript.d.ts +30 -0
- package/dist/host/transcript.js +130 -0
- package/dist/host/verbs.d.ts +50 -0
- package/dist/host/verbs.js +271 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.js +232 -35
- package/dist/lib/agent.d.ts +8 -26
- package/dist/lib/agent.js +11 -26
- package/dist/lib/api.d.ts +13 -0
- package/dist/lib/api.js +8 -0
- package/dist/lib/claude-plugin.d.ts +11 -2
- package/dist/lib/claude-plugin.js +10 -1
- package/dist/lib/durable/api.d.ts +136 -0
- package/dist/lib/durable/api.js +220 -0
- package/dist/lib/durable/codes.d.ts +8 -0
- package/dist/lib/durable/codes.js +2 -0
- package/dist/lib/durable/first-turn.d.ts +50 -0
- package/dist/lib/durable/first-turn.js +102 -0
- package/dist/lib/durable/gate.d.ts +48 -0
- package/dist/lib/durable/gate.js +122 -0
- package/dist/lib/durable/handover.d.ts +101 -0
- package/dist/lib/durable/handover.js +175 -0
- package/dist/lib/durable/launch.d.ts +182 -0
- package/dist/lib/durable/launch.js +443 -0
- package/dist/lib/durable/launching.d.ts +15 -0
- package/dist/lib/durable/launching.js +70 -0
- package/dist/lib/durable/live.d.ts +194 -0
- package/dist/lib/durable/live.js +635 -0
- package/dist/lib/durable/refusal.d.ts +57 -0
- package/dist/lib/durable/refusal.js +78 -0
- package/dist/lib/durable/view.d.ts +83 -0
- package/dist/lib/durable/view.js +244 -0
- package/dist/lib/experimental.d.ts +0 -9
- package/dist/lib/experimental.js +18 -17
- package/dist/lib/launcher-config.d.ts +7 -0
- package/dist/lib/launcher-config.js +21 -0
- package/dist/lib/scan/caps.d.ts +35 -0
- package/dist/lib/scan/caps.js +67 -0
- package/dist/lib/scan/credential.d.ts +37 -0
- package/dist/lib/scan/credential.js +104 -0
- package/dist/lib/scan/failure.d.ts +10 -0
- package/dist/lib/scan/failure.js +43 -0
- package/dist/lib/scan/pr-source.d.ts +57 -0
- package/dist/lib/scan/pr-source.js +130 -0
- package/dist/lib/scan/record.d.ts +49 -0
- package/dist/lib/scan/record.js +85 -0
- package/dist/lib/scan/report-email.d.ts +92 -0
- package/dist/lib/scan/report-email.js +144 -0
- package/dist/lib/scan/report.d.ts +13 -0
- package/dist/lib/scan/report.js +30 -0
- package/dist/lib/scan/scan.d.ts +64 -0
- package/dist/lib/scan/scan.js +182 -0
- package/dist/lib/scan/share.d.ts +38 -0
- package/dist/lib/scan/share.js +47 -0
- package/dist/lib/scan/spend/ai-tool-detect.d.ts +6 -0
- package/dist/lib/scan/spend/ai-tool-detect.js +18 -0
- package/dist/lib/scan/spend/anthropic-usage.d.ts +57 -0
- package/dist/lib/scan/spend/anthropic-usage.js +244 -0
- package/dist/lib/scan/spend/cost-corpus.v1.d.ts +56 -0
- package/dist/lib/scan/spend/cost-corpus.v1.js +64 -0
- package/dist/lib/scan/spend/prices.d.ts +33 -0
- package/dist/lib/scan/spend/prices.js +57 -0
- package/dist/lib/scan/spend/spend-estimate.d.ts +30 -0
- package/dist/lib/scan/spend/spend-estimate.js +70 -0
- package/dist/lib/scan/spend/spend-tiers.d.ts +25 -0
- package/dist/lib/scan/spend/spend-tiers.js +42 -0
- package/dist/lib/scan/spend/token-rate.d.ts +30 -0
- package/dist/lib/scan/spend/token-rate.js +54 -0
- package/dist/lib/session-key.d.ts +41 -0
- package/dist/lib/session-key.js +124 -0
- package/dist/lib/subscription-login.d.ts +15 -0
- package/dist/lib/subscription-login.js +28 -1
- package/dist/rc-key-401.mjs +75 -0
- package/dist/rc-proxy.mjs +221 -25
- package/dist/vendor/durable-contract/index.js +240 -18
- package/dist/vendor/shared/durable-contract/admission.d.ts +240 -0
- package/dist/vendor/shared/durable-contract/admission.js +533 -0
- package/dist/vendor/shared/durable-contract/arm.d.ts +51 -0
- package/dist/vendor/shared/durable-contract/arm.js +133 -0
- package/dist/vendor/shared/durable-contract/canonical.d.ts +29 -0
- package/dist/vendor/shared/durable-contract/canonical.js +98 -0
- package/dist/vendor/shared/durable-contract/cell-id.d.ts +22 -0
- package/dist/vendor/shared/durable-contract/cell-id.js +38 -0
- package/dist/vendor/shared/durable-contract/cli-output.d.ts +342 -0
- package/dist/vendor/shared/durable-contract/cli-output.js +201 -0
- package/dist/vendor/shared/durable-contract/cli-surface.d.ts +119 -0
- package/dist/vendor/shared/durable-contract/cli-surface.js +270 -0
- package/dist/vendor/shared/durable-contract/codes.d.ts +537 -0
- package/dist/vendor/shared/durable-contract/codes.js +475 -0
- package/dist/vendor/shared/durable-contract/constants.d.ts +153 -0
- package/dist/vendor/shared/durable-contract/constants.js +179 -0
- package/dist/vendor/shared/durable-contract/doors.d.ts +119 -0
- package/dist/vendor/shared/durable-contract/doors.js +249 -0
- package/dist/vendor/shared/durable-contract/envelope.d.ts +103 -0
- package/dist/vendor/shared/durable-contract/envelope.js +317 -0
- package/dist/vendor/shared/durable-contract/events.d.ts +147 -0
- package/dist/vendor/shared/durable-contract/events.js +630 -0
- package/dist/vendor/shared/durable-contract/executor-state.d.ts +41 -0
- package/dist/vendor/shared/durable-contract/executor-state.js +32 -0
- package/dist/vendor/shared/durable-contract/fixlines.d.ts +318 -0
- package/dist/vendor/shared/durable-contract/fixlines.js +483 -0
- package/dist/vendor/shared/durable-contract/freeze-record.d.ts +787 -0
- package/dist/vendor/shared/durable-contract/freeze-record.js +361 -0
- package/dist/vendor/shared/durable-contract/index.d.ts +36 -0
- package/dist/vendor/shared/durable-contract/index.js +37 -0
- package/dist/vendor/shared/durable-contract/journal-approvals.d.ts +29 -0
- package/dist/vendor/shared/durable-contract/journal-approvals.js +60 -0
- package/dist/vendor/shared/durable-contract/keys.d.ts +24 -0
- package/dist/vendor/shared/durable-contract/keys.js +66 -0
- package/dist/vendor/shared/durable-contract/lock.d.ts +128 -0
- package/dist/vendor/shared/durable-contract/lock.js +151 -0
- package/dist/vendor/shared/durable-contract/names.d.ts +25 -0
- package/dist/vendor/shared/durable-contract/names.js +78 -0
- package/dist/vendor/shared/durable-contract/owner-verbs.d.ts +175 -0
- package/dist/vendor/shared/durable-contract/owner-verbs.js +403 -0
- package/dist/vendor/shared/durable-contract/paths.d.ts +23 -0
- package/dist/vendor/shared/durable-contract/paths.js +35 -0
- package/dist/vendor/shared/durable-contract/pure-fn.d.ts +48 -0
- package/dist/vendor/shared/durable-contract/pure-fn.js +89 -0
- package/dist/vendor/shared/durable-contract/routes.d.ts +205 -0
- package/dist/vendor/shared/durable-contract/routes.js +315 -0
- package/dist/vendor/shared/durable-contract/schema.d.ts +126 -0
- package/dist/vendor/shared/durable-contract/schema.js +441 -0
- package/dist/vendor/shared/durable-contract/seal.d.ts +54 -0
- package/dist/vendor/shared/durable-contract/seal.js +99 -0
- package/dist/vendor/shared/durable-contract/secret-scope.d.ts +28 -0
- package/dist/vendor/shared/durable-contract/secret-scope.js +76 -0
- package/dist/vendor/shared/durable-contract/session-id.d.ts +21 -0
- package/dist/vendor/shared/durable-contract/session-id.js +58 -0
- package/dist/vendor/shared/durable-contract/spec.d.ts +162 -0
- package/dist/vendor/shared/durable-contract/spec.js +286 -0
- package/dist/vendor/shared/durable-contract/states.d.ts +96 -0
- package/dist/vendor/shared/durable-contract/states.js +218 -0
- package/dist/vendor/shared/durable-contract/telemetry.d.ts +94 -0
- package/dist/vendor/shared/durable-contract/telemetry.js +180 -0
- package/dist/vendor/shared/durable-contract/test-mode.d.ts +62 -0
- package/dist/vendor/shared/durable-contract/test-mode.js +140 -0
- package/dist/vendor/shared/durable-contract/turn.d.ts +57 -0
- package/dist/vendor/shared/durable-contract/turn.js +81 -0
- package/dist/vendor/shared/durable-contract/vectors.d.ts +191 -0
- package/dist/vendor/shared/durable-contract/vectors.js +208 -0
- package/package.json +4 -3
- package/plugins/integrity-manifest.json +35 -0
- package/plugins/mnemom/hooks/hooks.json +15 -1
- package/plugins/mnemom/hooks/register.tsx +60 -2
- package/plugins/mnemom/hooks/seat-hello.mjs +116 -0
- package/dist/commands/agent-implicit-notice.d.ts +0 -31
- package/dist/commands/agent-implicit-notice.js +0 -73
package/dist/base-url-proxy.mjs
CHANGED
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
// (> WAIT_MS) → the request is forwarded without it (the gateway then behaves as before).
|
|
16
16
|
//
|
|
17
17
|
// CONFIG (env, none secret)
|
|
18
|
-
// MNEMOM_AGENT_BU_DOOR gateway door URL (required
|
|
18
|
+
// MNEMOM_AGENT_BU_DOOR gateway door URL (required), e.g. https://gateway.mnemom.ai/anthropic;
|
|
19
|
+
// https; http only with MNEMOM_AGENT_BU_HTTP_DOOR=1 and on a
|
|
20
|
+
// loopback literal (127.0.0.1, [::1], localhost: the C17-R16 seam)
|
|
21
|
+
// MNEMOM_AGENT_BU_HTTP_DOOR "1" allows that http door; set by the launcher (see the gate below)
|
|
19
22
|
// MNEMOM_AGENT_BU_CWD the session cwd (Claude Code's transcript lives under its slug)
|
|
20
23
|
// MNEMOM_AGENT_BU_LOG append log lines here instead of stderr (optional)
|
|
21
24
|
// MNEMOM_AGENT_BU_PARENT_PID exit when this pid is gone
|
|
@@ -43,7 +46,18 @@ try {
|
|
|
43
46
|
} catch {
|
|
44
47
|
die("MNEMOM_AGENT_BU_DOOR is required and must be a URL");
|
|
45
48
|
}
|
|
46
|
-
|
|
49
|
+
/** S1 LOOPBACK_HOSTS: the exact hostnames an http door may name (look-alikes such as 127.0.0.1.nip.io fail). */
|
|
50
|
+
const LOOPBACK_HOSTS = new Set(["127.0.0.1", "[::1]", "localhost"]);
|
|
51
|
+
// The C17-R16 http-door seam (T3). The launcher (commands/agent.ts startBaseUrlProxy) sets
|
|
52
|
+
// MNEMOM_AGENT_BU_HTTP_DOOR=1 only when test-mode.mjs testSeamsHonoured / httpDoorAllowed hold, and
|
|
53
|
+
// strips an inherited value otherwise; this proxy reads no test-mode env itself. A proxy spawned
|
|
54
|
+
// directly trusts its parent's flag: the worst case is still http to a loopback literal only.
|
|
55
|
+
const httpDoorAllowed = env.MNEMOM_AGENT_BU_HTTP_DOOR === "1" && LOOPBACK_HOSTS.has(DOOR.hostname);
|
|
56
|
+
if (DOOR.protocol === "http:") {
|
|
57
|
+
if (!httpDoorAllowed)
|
|
58
|
+
die("MNEMOM_AGENT_BU_DOOR must be https (http only on a loopback literal with the door flag)");
|
|
59
|
+
} else if (DOOR.protocol !== "https:") die("MNEMOM_AGENT_BU_DOOR must be https");
|
|
60
|
+
const transport = DOOR.protocol === "http:" ? http : https;
|
|
47
61
|
const LOGFILE = env.MNEMOM_AGENT_BU_LOG || "";
|
|
48
62
|
const PARENT = Number(env.MNEMOM_AGENT_BU_PARENT_PID || 0);
|
|
49
63
|
const PORT = Number(env.MNEMOM_AGENT_BU_PORT || 0);
|
|
@@ -101,7 +115,7 @@ function recordState(h) {
|
|
|
101
115
|
}
|
|
102
116
|
}
|
|
103
117
|
|
|
104
|
-
const agent = new
|
|
118
|
+
const agent = new transport.Agent({ keepAlive: true, maxSockets: 32 });
|
|
105
119
|
const doorPath = DOOR.pathname.replace(/\/$/, "");
|
|
106
120
|
const isMessages = (u) => u === "/v1/messages" || u.startsWith("/v1/messages?");
|
|
107
121
|
|
|
@@ -123,7 +137,7 @@ function handle(req, res) {
|
|
|
123
137
|
|
|
124
138
|
const forward = (note) => {
|
|
125
139
|
const target = new URL(DOOR.origin + doorPath + req.url);
|
|
126
|
-
const up =
|
|
140
|
+
const up = transport.request(target, { method: req.method, headers, agent }, (ur) => {
|
|
127
141
|
recordState(ur.headers);
|
|
128
142
|
res.writeHead(ur.statusCode, ur.headers);
|
|
129
143
|
ur.pipe(res);
|
|
@@ -56,7 +56,8 @@ function listConfig(enabled) {
|
|
|
56
56
|
out("Set one with: mnemom agent config set <key> <value>");
|
|
57
57
|
out("");
|
|
58
58
|
out("Settable keys:");
|
|
59
|
-
|
|
59
|
+
// The durable key is listed only while `durable` is on (hidden like its verbs; C17).
|
|
60
|
+
for (const spec of CONFIG_KEYS.filter((k) => k.key !== "durable" || enabled.includes("durable")))
|
|
60
61
|
out(` ${spec.key.padEnd(22)} ${spec.describe}${configKeyMark(spec.key, undefined, enabled)}`);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
@@ -199,6 +200,9 @@ function deleteKey(cfg, key) {
|
|
|
199
200
|
case "compaction_intercept":
|
|
200
201
|
delete cfg.compactionIntercept;
|
|
201
202
|
break;
|
|
203
|
+
case "durable":
|
|
204
|
+
delete cfg.durable;
|
|
205
|
+
break;
|
|
202
206
|
case "context_profile":
|
|
203
207
|
delete cfg.contextProfile;
|
|
204
208
|
break;
|
|
@@ -17,6 +17,15 @@ export interface DoctorOptions {
|
|
|
17
17
|
cli?: string;
|
|
18
18
|
/** The agent slug a launch would use (--agent / launcher.toml); default agent-<handle>. */
|
|
19
19
|
agent?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The durable lock lines (commands/durable-doctor.ts), passed only while the experimental
|
|
22
|
+
* `durable` gate is on; absent, the doctor is exactly as before.
|
|
23
|
+
*/
|
|
24
|
+
durable?: () => Promise<Array<{
|
|
25
|
+
mark: "ok" | "warn" | "info";
|
|
26
|
+
text: string;
|
|
27
|
+
hint?: string;
|
|
28
|
+
}>>;
|
|
20
29
|
}
|
|
21
30
|
/** Run the preflight and print the checklist. Sets process.exitCode on failure. */
|
|
22
31
|
export declare function agentDoctorCommand(options?: DoctorOptions): Promise<void>;
|
|
@@ -125,6 +125,10 @@ export async function agentDoctorCommand(options = {}) {
|
|
|
125
125
|
// ── CLI auto-update ──
|
|
126
126
|
const upd = await probeUpdateStatus();
|
|
127
127
|
add(upd.mark, upd.text, upd.hint);
|
|
128
|
+
// ── durable lock preconditions (gate on only): never a MISS ──
|
|
129
|
+
if (options.durable)
|
|
130
|
+
for (const l of await options.durable())
|
|
131
|
+
add(l.mark, l.text, l.hint);
|
|
128
132
|
// ── render ──
|
|
129
133
|
const door = resolveAnthropicDoor(env);
|
|
130
134
|
out("mnemom agent doctor");
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
* (`x-mnemom-contract`). Implicit alignment — the goal inferred from your own
|
|
13
13
|
* messages (`x-mnemom-goal-mode: implicit`, no contract) — is the experimental
|
|
14
14
|
* `implicit` feature: while it is on a bare launch runs implicit, while it is off
|
|
15
|
-
* (the default) a bare launch runs with alignment off.
|
|
16
|
-
* build a bare launch runs implicit unless it is headless `-p` (T16). `--no-implicit` (or
|
|
15
|
+
* (the default) a bare launch runs with alignment off. `--no-implicit` (or
|
|
17
16
|
* launcher.toml `goal_mode = "off"`) turns it off. The mode is resolved upstream
|
|
18
17
|
* (`resolveImplicit`) and announced on the launch line.
|
|
19
18
|
*
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
* (`x-mnemom-contract`). Implicit alignment — the goal inferred from your own
|
|
13
13
|
* messages (`x-mnemom-goal-mode: implicit`, no contract) — is the experimental
|
|
14
14
|
* `implicit` feature: while it is on a bare launch runs implicit, while it is off
|
|
15
|
-
* (the default) a bare launch runs with alignment off.
|
|
16
|
-
* build a bare launch runs implicit unless it is headless `-p` (T16). `--no-implicit` (or
|
|
15
|
+
* (the default) a bare launch runs with alignment off. `--no-implicit` (or
|
|
17
16
|
* launcher.toml `goal_mode = "off"`) turns it off. The mode is resolved upstream
|
|
18
17
|
* (`resolveImplicit`) and announced on the launch line.
|
|
19
18
|
*
|
|
@@ -288,6 +288,12 @@ export declare function resolvePinnedAgent(id: string): Promise<{
|
|
|
288
288
|
id: string;
|
|
289
289
|
slug: string;
|
|
290
290
|
}>;
|
|
291
|
+
/**
|
|
292
|
+
* The x-mnemom-agent value for a pinned agent: its stored name exactly, when that name is a
|
|
293
|
+
* header-safe token (every api-valid name is: AGENT_NAME_REGEX allows only letters, digits and
|
|
294
|
+
* hyphens); "" otherwise, which refuses the launch.
|
|
295
|
+
*/
|
|
296
|
+
export declare function pinnedSlugOf(name: string | null | undefined): string;
|
|
291
297
|
/**
|
|
292
298
|
* One line for an api failure that keeps the parts an operator can act on: the
|
|
293
299
|
* message, the error code, and the scope the endpoint said it needed
|
|
@@ -696,12 +696,23 @@ export async function resolvePinnedAgent(id) {
|
|
|
696
696
|
throw new UnclaimedAgentError(`mnemom agent: agent ${id} is not claimed, and mnemom agent never runs on an unclaimed agent. ` +
|
|
697
697
|
`Claim it first: \`mnemom agent claim ${id} --key <key>\`.`);
|
|
698
698
|
}
|
|
699
|
-
|
|
699
|
+
// The stored name goes out verbatim: the gateway compares the pin's name exactly
|
|
700
|
+
// (agent-identity.ts), and the api allows uppercase and hyphen runs, which sanitizeAgentName
|
|
701
|
+
// would rewrite (mnemom-test #1061). sanitizeAgentName is for new names only.
|
|
702
|
+
const slug = pinnedSlugOf(agent.name);
|
|
700
703
|
if (!slug) {
|
|
701
704
|
throw new UnclaimedAgentError(`mnemom agent: agent ${id} has no usable name to send as x-mnemom-agent; rename it, or launch by name.`);
|
|
702
705
|
}
|
|
703
706
|
return { id, slug };
|
|
704
707
|
}
|
|
708
|
+
/**
|
|
709
|
+
* The x-mnemom-agent value for a pinned agent: its stored name exactly, when that name is a
|
|
710
|
+
* header-safe token (every api-valid name is: AGENT_NAME_REGEX allows only letters, digits and
|
|
711
|
+
* hyphens); "" otherwise, which refuses the launch.
|
|
712
|
+
*/
|
|
713
|
+
export function pinnedSlugOf(name) {
|
|
714
|
+
return typeof name === "string" && /^[A-Za-z0-9-]+$/.test(name) ? name : "";
|
|
715
|
+
}
|
|
705
716
|
/** The refusal for a pinned launch the gateway did not (or could not) honour. */
|
|
706
717
|
function pinRefusal(err, pin, slug) {
|
|
707
718
|
const head = `mnemom agent: the gateway would not run this launch as ${pin}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bridge from `mnemom agent share` to the aip verifier (`@mnemom/aip-verifier`, aip#192/#178):
|
|
3
3
|
* the renderer (`renderLines`) and claim-lint (`lintRendering`) are the ONLY source of what a
|
|
4
|
-
* card may say. No word lists live here. The package is a
|
|
4
|
+
* card may say. No word lists live here. The package is a runtime dependency pinned to the aip
|
|
5
5
|
* release tarball and is loaded lazily, so the default CLI path never touches it; if it is
|
|
6
6
|
* absent at runtime the share command fails closed with a clear message.
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bridge from `mnemom agent share` to the aip verifier (`@mnemom/aip-verifier`, aip#192/#178):
|
|
3
3
|
* the renderer (`renderLines`) and claim-lint (`lintRendering`) are the ONLY source of what a
|
|
4
|
-
* card may say. No word lists live here. The package is a
|
|
4
|
+
* card may say. No word lists live here. The package is a runtime dependency pinned to the aip
|
|
5
5
|
* release tarball and is loaded lazily, so the default CLI path never touches it; if it is
|
|
6
6
|
* absent at runtime the share command fails closed with a clear message.
|
|
7
7
|
*/
|
package/dist/commands/agent.d.ts
CHANGED
|
@@ -25,12 +25,15 @@
|
|
|
25
25
|
* line, or the proxy's stdin under RC). It is never logged, printed, or passed as
|
|
26
26
|
* an argv value.
|
|
27
27
|
*/
|
|
28
|
+
import { type ChildProcess } from "node:child_process";
|
|
29
|
+
import { type SessionKeyDeps, type SessionKeyMintArgs, type SessionKeyRenewal } from "../lib/session-key.js";
|
|
28
30
|
import { type MnemomKeyDeps } from "../lib/subscription-login.js";
|
|
29
31
|
import { type SessionRecord } from "../lib/agent-ledger.js";
|
|
30
32
|
import { type ExperimentalId } from "../lib/experimental.js";
|
|
31
33
|
import { conductReceiptFor, type ReceiptLaunch } from "../lib/conduct-receipt.js";
|
|
32
34
|
import { type GovernanceOptIn } from "./agent-setup.js";
|
|
33
35
|
import { type CcSettingsView, type ContextProfile, type LaunchShape, type SealedContractEnvelope } from "../lib/agent.js";
|
|
36
|
+
import type { LauncherKey } from "../vendor/shared/durable-contract/fixlines.js";
|
|
34
37
|
export interface AgentOptions {
|
|
35
38
|
goal?: string;
|
|
36
39
|
requirement?: string[];
|
|
@@ -58,6 +61,14 @@ export interface AgentOptions {
|
|
|
58
61
|
/** launcher.toml `agent_id`: the pin when no `--agent` is given (selectLaunchAgent). */
|
|
59
62
|
agentId?: string;
|
|
60
63
|
conversationId?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Durable launch (EXPERIMENTAL `durable`, BACKBONE C1): set only while the gate is on. Absent,
|
|
66
|
+
* the launch is exactly today's (C17).
|
|
67
|
+
*/
|
|
68
|
+
durable?: {
|
|
69
|
+
launcherKey: LauncherKey;
|
|
70
|
+
newSession: boolean;
|
|
71
|
+
};
|
|
61
72
|
cli?: string;
|
|
62
73
|
remoteControl?: boolean;
|
|
63
74
|
server?: boolean;
|
|
@@ -395,6 +406,8 @@ export declare function exemptLoopbackFromProxy(env: NodeJS.ProcessEnv): void;
|
|
|
395
406
|
export declare function sayConductReceipt(launch: ReceiptLaunch, trigger?: "exit" | "park", receipt?: typeof conductReceiptFor): Promise<void>;
|
|
396
407
|
/** Whether a terminal implicit launch runs the turn-origin proxy (MNEMOM_AGENT_TURN_HEADER=0 opts out). */
|
|
397
408
|
export declare function turnProxyWanted(env: NodeJS.ProcessEnv): boolean;
|
|
409
|
+
/** The flag that lets base-url-proxy.mjs use an http door on a loopback literal (C17-R16 T3). */
|
|
410
|
+
export declare const BU_HTTP_DOOR_ENV = "MNEMOM_AGENT_BU_HTTP_DOOR";
|
|
398
411
|
/** Test seams for startBaseUrlProxy (every real caller omits them). */
|
|
399
412
|
export interface BaseUrlProxyOptions {
|
|
400
413
|
/** The proxy script (default: the bundled base-url-proxy.mjs beside rc-proxy.mjs). */
|
|
@@ -447,6 +460,19 @@ export declare function rcProxyUrl(port: string, proxyCredential: string): strin
|
|
|
447
460
|
* selectLaunchAgent). A truncated/garbled `mnm-…` throws instead of becoming a name.
|
|
448
461
|
*/
|
|
449
462
|
export declare function resolveLaunchPin(options: Pick<AgentOptions, "agent" | "agentId">): string | undefined;
|
|
463
|
+
/** The longest line the proxy sends the launcher (`remint <key id>`) is far shorter than this. */
|
|
464
|
+
export declare const RC_CONTROL_LINE_MAX = 1024;
|
|
465
|
+
/**
|
|
466
|
+
* Renew the Remote Control proxy's session key over its control pipe (fd 3; rc-proxy.mjs SESSION
|
|
467
|
+
* KEY RENEWAL): a `key <id> <expires> <key>` line before each expiry, a `remint <id>` line from the
|
|
468
|
+
* proxy when the gateway rejects its key, answered with a new key or `key-failed`. Renewal events
|
|
469
|
+
* go to the proxy log (the terminal belongs to Claude Code by then), as key ids and expiry times.
|
|
470
|
+
*/
|
|
471
|
+
export declare function startRcSessionKeyRenewal(proxy: Pick<ChildProcess, "stdio">, proxyLog: string, initial: {
|
|
472
|
+
keyId: string;
|
|
473
|
+
expiresAt: string;
|
|
474
|
+
mintArgs: SessionKeyMintArgs;
|
|
475
|
+
}, makeDeps?: (say: (line: string) => void) => SessionKeyDeps): SessionKeyRenewal | undefined;
|
|
450
476
|
/**
|
|
451
477
|
* Locates the `handoff` MCP server (src/mcp/handoff-server.mjs in dev, dist/mcp/handoff-server.mjs
|
|
452
478
|
* once built — a raw, uncompiled `.mjs` file that `copy-assets.mjs` copies verbatim, exactly like
|