@mnemom/mnemom 0.17.7-next.1 → 0.17.7
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 +11 -23
- package/dist/commands/agent-doctor.d.ts +4 -21
- package/dist/commands/agent-doctor.js +5 -51
- package/dist/commands/agent-goal.d.ts +1 -1
- package/dist/commands/agent-goal.js +3 -6
- package/dist/commands/agent-setup.d.ts +5 -16
- package/dist/commands/agent-setup.js +12 -29
- package/dist/commands/agent.d.ts +9 -32
- package/dist/commands/agent.js +43 -131
- package/dist/commands/wrap.d.ts +0 -8
- package/dist/commands/wrap.js +3 -36
- package/dist/index.js +1 -1
- package/dist/lib/agent-ledger.d.ts +3 -22
- package/dist/lib/agent-ledger.js +0 -23
- package/dist/lib/agent.d.ts +27 -64
- package/dist/lib/agent.js +26 -58
- package/dist/lib/api.d.ts +2 -27
- package/dist/lib/api.js +2 -64
- package/dist/lib/launcher-config.d.ts +4 -5
- package/dist/lib/launcher-config.js +1 -1
- package/dist/lib/subscription-login.d.ts +20 -152
- package/dist/lib/subscription-login.js +28 -215
- package/dist/mcp/handoff-server.mjs +13 -35
- package/dist/rc-proxy.mjs +3 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -87,27 +87,20 @@ or `launch` in `launcher.toml`) also skips the Remote Control capability probe
|
|
|
87
87
|
#### Context profile: how the gateway folds a session's context
|
|
88
88
|
|
|
89
89
|
`--context-profile <off|balanced|aggressive|adaptive>` picks how the Mnemom gateway folds a
|
|
90
|
-
session's context.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- **`balanced`** keeps more of the earlier work verbatim and folds later — for long sessions
|
|
96
|
-
that revisit earlier files and decisions. It sends `CONTEXT_RUNTIME_SIZE_POLICY=off`, so the
|
|
97
|
-
cell's own fold budgets apply at every size, even on a cell whose default is `adaptive`.
|
|
90
|
+
session's context. Each profile serves a different set of use cases:
|
|
91
|
+
|
|
92
|
+
- **`balanced`** (the default) keeps more of the earlier work verbatim and folds later —
|
|
93
|
+
for long sessions that revisit earlier files and decisions.
|
|
98
94
|
- **`aggressive`** folds earlier and keeps a tighter working set — for cost-sensitive
|
|
99
|
-
sessions and short, focused tasks.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
`aggressive` budgets from 200k to 1M, and `balanced` above 1M. It sends
|
|
95
|
+
sessions and short, focused tasks.
|
|
96
|
+
- **`adaptive`** (opt-in) lets the gateway size the fold to the conversation's original
|
|
97
|
+
context: no fold below 200k tokens (folding a small conversation costs more than it
|
|
98
|
+
saves), the `aggressive` budgets from 200k to 1M, and `balanced` above 1M. It sends
|
|
104
99
|
`CONTEXT_RUNTIME_SIZE_POLICY=banded` in the per-session config; the band thresholds are the
|
|
105
100
|
gateway's defaults.
|
|
106
101
|
- **`off`** leaves compaction to the coding agent.
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
`launcher.toml`). Only `mnemom agent config set` (or editing `launcher.toml`) saves a default;
|
|
110
|
-
a flag applies to that launch alone and is never written anywhere later launches read:
|
|
103
|
+
Set it per launch, as a standing default, or in the environment (flag > env > `launcher.toml`):
|
|
111
104
|
|
|
112
105
|
```bash
|
|
113
106
|
mnemom agent my-task --context-profile aggressive # this launch only
|
|
@@ -116,16 +109,11 @@ export MNEMOM_AGENT_CONTEXT_PROFILE=aggressive # for every launch in this s
|
|
|
116
109
|
mnemom agent my-task --context-profile adaptive # size-banded folding, this launch only
|
|
117
110
|
```
|
|
118
111
|
|
|
119
|
-
A launch that resumes a Claude Code session (`-- --resume <id>`, or the implicit-goal relaunch)
|
|
120
|
-
keeps the profile that session ran under, ahead of the standing default; a `--context-profile`
|
|
121
|
-
flag on the resuming launch still wins.
|
|
122
|
-
|
|
123
112
|
`--no-context` (or `context = false` in `launcher.toml`) is the same as `off`. Pass one or the
|
|
124
113
|
other: `--no-context` together with `--context-profile balanced`, `aggressive` or `adaptive` is refused. A
|
|
125
114
|
`--context-profile` flag overrides a standing `context = false` in `launcher.toml`. `--dry-run`
|
|
126
|
-
prints the resolved profile
|
|
127
|
-
|
|
128
|
-
ledger record a chosen profile.
|
|
115
|
+
prints the resolved profile and, when the launch sends the per-session config header, the
|
|
116
|
+
decoded key/value list; `mnemom agent show` and the session ledger record the profile.
|
|
129
117
|
|
|
130
118
|
#### Context handoff (experimental, off by default)
|
|
131
119
|
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
* `mnemom agent doctor` — a read-only preflight for `mnemom agent`. It checks the
|
|
3
3
|
* things a governed launch needs and prints a checklist with clear, actionable
|
|
4
4
|
* remediation, so a customer can see at a glance why a launch would fail before
|
|
5
|
-
* it does. Writes nothing and
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* it does. Writes nothing and reads no secret VALUE (only whether a key is
|
|
6
|
+
* resolvable). Exits non-zero when the machine is not launch-ready (no coding
|
|
7
|
+
* agent CLI, or no Anthropic key), so it can gate a script.
|
|
8
8
|
*
|
|
9
|
-
* Checks: settings file, coding-agent CLI, Anthropic key source,
|
|
10
|
-
* whether it is still active (every launch sends one; none yet is informational — the launch
|
|
11
|
-
* mints it; a saved key proven dead is a warning — the launch re-mints it), gateway health
|
|
9
|
+
* Checks: settings file, coding-agent CLI, Anthropic key source, gateway health
|
|
12
10
|
* (200 + the x-mnemom-verdict header that proves the governance pipeline is
|
|
13
11
|
* live), Remote-Control capability (node + openssl + the --remote-control flag),
|
|
14
12
|
* claude.ai login (informational — Remote Control needs it), and CLI auto-update status.
|
|
@@ -19,21 +17,6 @@ export interface DoctorOptions {
|
|
|
19
17
|
}
|
|
20
18
|
/** Run the preflight and print the checklist. Sets process.exitCode on failure. */
|
|
21
19
|
export declare function agentDoctorCommand(options?: DoctorOptions): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* The Mnemom API key row: where the key a launch would send comes from, and whether it passes
|
|
24
|
-
* the launch's own one-time check (commands/agent.ts verifyLocalMnemomKey). A key counts as dead
|
|
25
|
-
* only when proven (lib/subscription-login.ts checkMnemomKey), so only a saved key this CLI
|
|
26
|
-
* minted can be:
|
|
27
|
-
* valid → ok
|
|
28
|
-
* saved key, invalid → warn (the next launch mints a new one and revokes the old)
|
|
29
|
-
* anything else → info (not verified: a launch sends it as is)
|
|
30
|
-
* none → info (the next launch mints one for the launch's org)
|
|
31
|
-
*/
|
|
32
|
-
export declare function mnemomKeyRow(): Promise<{
|
|
33
|
-
mark: Mark;
|
|
34
|
-
text: string;
|
|
35
|
-
hint?: string;
|
|
36
|
-
}>;
|
|
37
20
|
export interface CodeAccessProbe {
|
|
38
21
|
mark: Mark;
|
|
39
22
|
text: string;
|
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
* `mnemom agent doctor` — a read-only preflight for `mnemom agent`. It checks the
|
|
3
3
|
* things a governed launch needs and prints a checklist with clear, actionable
|
|
4
4
|
* remediation, so a customer can see at a glance why a launch would fail before
|
|
5
|
-
* it does. Writes nothing and
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* it does. Writes nothing and reads no secret VALUE (only whether a key is
|
|
6
|
+
* resolvable). Exits non-zero when the machine is not launch-ready (no coding
|
|
7
|
+
* agent CLI, or no Anthropic key), so it can gate a script.
|
|
8
8
|
*
|
|
9
|
-
* Checks: settings file, coding-agent CLI, Anthropic key source,
|
|
10
|
-
* whether it is still active (every launch sends one; none yet is informational — the launch
|
|
11
|
-
* mints it; a saved key proven dead is a warning — the launch re-mints it), gateway health
|
|
9
|
+
* Checks: settings file, coding-agent CLI, Anthropic key source, gateway health
|
|
12
10
|
* (200 + the x-mnemom-verdict header that proves the governance pipeline is
|
|
13
11
|
* live), Remote-Control capability (node + openssl + the --remote-control flag),
|
|
14
12
|
* claude.ai login (informational — Remote Control needs it), and CLI auto-update status.
|
|
15
13
|
*/
|
|
16
14
|
import { spawnSync } from "node:child_process";
|
|
17
15
|
import { existsSync } from "node:fs";
|
|
18
|
-
import { anthropicKeySource, checkRcCapability, defaultConsoleKeyDeps,
|
|
16
|
+
import { anthropicKeySource, checkRcCapability, defaultConsoleKeyDeps, resolveCliBin, } from "./agent.js";
|
|
19
17
|
import { readConsoleKey } from "../lib/console-key.js";
|
|
20
18
|
import { resolveAgentAuth } from "../lib/subscription-login.js";
|
|
21
19
|
import { isProdGateway, resolveAnthropicDoor, resolveGatewayHost, singleCellError, } from "../lib/agent.js";
|
|
@@ -75,9 +73,6 @@ export async function agentDoctorCommand(options = {}) {
|
|
|
75
73
|
else
|
|
76
74
|
add("miss", "Anthropic key: none found", "export MNEMOM_AGENT_ANTHROPIC_KEY=sk-ant-… (or ANTHROPIC_API_KEY), or run `mnemom agent` once and accept the save prompt");
|
|
77
75
|
}
|
|
78
|
-
// ── Mnemom API key: every launch sends one, whatever the auth mode ──
|
|
79
|
-
const keyRow = await mnemomKeyRow();
|
|
80
|
-
add(keyRow.mark, keyRow.text, keyRow.hint);
|
|
81
76
|
// ── one cell: the launch door must be the CLI's own cell ──
|
|
82
77
|
const cellError = singleCellError({
|
|
83
78
|
door: resolveAnthropicDoor(env),
|
|
@@ -181,47 +176,6 @@ function claudeLoggedIn(bin) {
|
|
|
181
176
|
return null;
|
|
182
177
|
}
|
|
183
178
|
}
|
|
184
|
-
const MNEMOM_KEY_MINT_HINT = "minting needs a signed-in session (`mnemom login`) and an org role that may mint a gateway key (owner, admin or member); or ask an org owner/admin for an org API key with the `gateway` scope and set MNEMOM_AGENT_MNEMOM_KEY";
|
|
185
|
-
/**
|
|
186
|
-
* The Mnemom API key row: where the key a launch would send comes from, and whether it passes
|
|
187
|
-
* the launch's own one-time check (commands/agent.ts verifyLocalMnemomKey). A key counts as dead
|
|
188
|
-
* only when proven (lib/subscription-login.ts checkMnemomKey), so only a saved key this CLI
|
|
189
|
-
* minted can be:
|
|
190
|
-
* valid → ok
|
|
191
|
-
* saved key, invalid → warn (the next launch mints a new one and revokes the old)
|
|
192
|
-
* anything else → info (not verified: a launch sends it as is)
|
|
193
|
-
* none → info (the next launch mints one for the launch's org)
|
|
194
|
-
*/
|
|
195
|
-
export async function mnemomKeyRow() {
|
|
196
|
-
const local = localLaunchMnemomKey();
|
|
197
|
-
const org = getActiveOrg();
|
|
198
|
-
const orgLabel = org ? `org ${org.slug}` : "no active org";
|
|
199
|
-
if (!local) {
|
|
200
|
-
return {
|
|
201
|
-
mark: "info",
|
|
202
|
-
text: `Mnemom API key: none yet for ${orgLabel} — the next launch mints a gateway-only org key and saves it`,
|
|
203
|
-
hint: MNEMOM_KEY_MINT_HINT,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
const where = local.source === "env"
|
|
207
|
-
? "MNEMOM_AGENT_MNEMOM_KEY (environment)"
|
|
208
|
-
: `~/.mnemom/launcher.json (saved for ${orgLabel})`;
|
|
209
|
-
const verdict = await verifyLocalMnemomKey(local);
|
|
210
|
-
if (verdict === "valid")
|
|
211
|
-
return { mark: "ok", text: `Mnemom API key: ${where} — verified` };
|
|
212
|
-
if (verdict === "invalid" && local.source === "store") {
|
|
213
|
-
return {
|
|
214
|
-
mark: "warn",
|
|
215
|
-
text: `Mnemom API key: the key saved for ${orgLabel} is no longer active (revoked or rotated) — the next launch mints a new one`,
|
|
216
|
-
hint: MNEMOM_KEY_MINT_HINT,
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
return {
|
|
220
|
-
mark: "info",
|
|
221
|
-
text: `Mnemom API key: ${where} — not verified (API unreachable, not signed in, or a gateway-only key the API cannot look up); a launch sends it as is`,
|
|
222
|
-
hint: "sign in (`mnemom login`) so the doctor and each launch can check a saved key; the gateway refuses a dead key with a clear message",
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
179
|
/**
|
|
226
180
|
* The invited-cohort gate, as the doctor reports it. Signed out → info (we can't
|
|
227
181
|
* check without a session); enabled → ok with the reason; a determined
|
|
@@ -31,7 +31,7 @@ export interface GoalCommandDeps {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* The Anthropic key the launch would resolve (env, then ~/.mnemom/launcher.json), never prompted
|
|
34
|
-
* for
|
|
34
|
+
* for. Lazy import: commands/agent.ts is the launcher and carries a heavy import graph.
|
|
35
35
|
*/
|
|
36
36
|
export declare function resolveLaunchCreds(): Promise<GoalControlCreds>;
|
|
37
37
|
export declare const liveGoalDeps: GoalCommandDeps;
|
|
@@ -24,20 +24,17 @@ import { askYesNo, isInteractive } from "../lib/prompt.js";
|
|
|
24
24
|
import { localGoalFlag, resolveSessionRef } from "./agent-sessions.js";
|
|
25
25
|
/**
|
|
26
26
|
* The Anthropic key the launch would resolve (env, then ~/.mnemom/launcher.json), never prompted
|
|
27
|
-
* for
|
|
27
|
+
* for. Lazy import: commands/agent.ts is the launcher and carries a heavy import graph.
|
|
28
28
|
*/
|
|
29
29
|
export async function resolveLaunchCreds() {
|
|
30
|
-
const
|
|
31
|
-
let anthropicKey;
|
|
30
|
+
const { resolveAnthropicKey } = await import("./agent.js");
|
|
32
31
|
try {
|
|
33
|
-
anthropicKey
|
|
32
|
+
return { anthropicKey: await resolveAnthropicKey(process.env, { allowPrompt: false }) };
|
|
34
33
|
}
|
|
35
34
|
catch {
|
|
36
35
|
throw new Error("no Anthropic key in env (MNEMOM_AGENT_ANTHROPIC_KEY / ANTHROPIC_API_KEY) or ~/.mnemom/launcher.json — " +
|
|
37
36
|
"the goal commands authenticate with the same key the session launched with");
|
|
38
37
|
}
|
|
39
|
-
// The Mnemom key the launch sent too (env, then the store — never minted here).
|
|
40
|
-
return { anthropicKey, mnemomKey: agentMod.localLaunchMnemomKey()?.key ?? null };
|
|
41
38
|
}
|
|
42
39
|
export const liveGoalDeps = {
|
|
43
40
|
readRecords: () => readSessionRecords({ dir: MNEMOM_DIR }).reverse(),
|
|
@@ -68,15 +68,6 @@ export interface EnsureAgentOptions {
|
|
|
68
68
|
slug: string;
|
|
69
69
|
/** The customer's Anthropic key (for the birth call + hash-proof). Never logged. */
|
|
70
70
|
anthropicKey: string;
|
|
71
|
-
/**
|
|
72
|
-
* The launch's Mnemom API key, sent on the gateway probe/birth call (x-mnemom-api-key, with a
|
|
73
|
-
* no-op x-mnemom-session-config — see birthThroughGateway). That makes the call Mnemom agent
|
|
74
|
-
* traffic: the gateway verifies the key and births a new agent in the key's org — the active
|
|
75
|
-
* org, else the personal org, i.e. the launch org the key was minted for. The claim below
|
|
76
|
-
* records the claim in that same org, which the gateway's agent-traffic org check requires of
|
|
77
|
-
* every governed turn. Never logged.
|
|
78
|
-
*/
|
|
79
|
-
mnemomKey?: string;
|
|
80
71
|
/** undefined = auto, true = force (--setup), false handled by the caller (skip). */
|
|
81
72
|
setup?: boolean;
|
|
82
73
|
/** Gateway host the launch targets (birth goes to the same cell). */
|
|
@@ -166,13 +157,11 @@ export declare function ensureSessionAndBalance(opts: {
|
|
|
166
157
|
}>;
|
|
167
158
|
/**
|
|
168
159
|
* The account for a launch an orchestrator already preflighted
|
|
169
|
-
* (`MNEMOM_AGENT_PREFLIGHTED=1`, see launchPreflighted): no session prompt
|
|
170
|
-
* µ-balance read. The
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* org
|
|
174
|
-
* the access gate and decides Remote Control fail-closed, which a caller's
|
|
175
|
-
* preflight can't vouch for.
|
|
160
|
+
* (`MNEMOM_AGENT_PREFLIGHTED=1`, see launchPreflighted): no session prompt, no
|
|
161
|
+
* personal-org lookup, no µ-balance read. The entitlement is still fetched — it
|
|
162
|
+
* is the access gate and decides Remote Control fail-closed, which a caller's
|
|
163
|
+
* preflight can't vouch for. With no active org the api resolves the caller's
|
|
164
|
+
* primary org, and the ledger records the org id the entitlement names.
|
|
176
165
|
*/
|
|
177
166
|
export declare function resolvePreflightedAccount(): Promise<{
|
|
178
167
|
orgId: string;
|
|
@@ -34,8 +34,7 @@ import { configKeySpec, loadLauncherConfig, writeLauncherConfig } from "../lib/l
|
|
|
34
34
|
import { readServedAgent, servedFingerprint, writeServedAgent } from "../lib/served-agent-cache.js";
|
|
35
35
|
import { deriveHashProof } from "./agents.js";
|
|
36
36
|
import { birthThroughGateway } from "./wrap.js";
|
|
37
|
-
import {
|
|
38
|
-
import { resolveLaunchMnemomKey } from "../lib/subscription-login.js";
|
|
37
|
+
import { resolveAnthropicKey } from "./agent.js";
|
|
39
38
|
import { assertCodeEnabled, CodeNotEnabledError } from "./agent-invite.js";
|
|
40
39
|
const say = (line = "") => console.error(line);
|
|
41
40
|
/**
|
|
@@ -146,7 +145,6 @@ export async function ensureGovernedAgent(opts) {
|
|
|
146
145
|
cached ??
|
|
147
146
|
(await birthThroughGateway(gatewayUrl, "anthropic", slug, opts.anthropicKey, {
|
|
148
147
|
timeoutMs: opts.setup === true ? undefined : SERVED_PROBE_TIMEOUT_MS,
|
|
149
|
-
mnemomKey: opts.mnemomKey,
|
|
150
148
|
}));
|
|
151
149
|
}
|
|
152
150
|
catch (err) {
|
|
@@ -208,9 +206,7 @@ export async function ensureGovernedAgent(opts) {
|
|
|
208
206
|
}
|
|
209
207
|
// 5. Birth → claim → publish observe-only cards. (Key never logged.)
|
|
210
208
|
const gatewayUrl = opts.gatewayHost.replace(/\/+$/, "");
|
|
211
|
-
const agentId = await birthThroughGateway(gatewayUrl, "anthropic", slug, opts.anthropicKey
|
|
212
|
-
mnemomKey: opts.mnemomKey,
|
|
213
|
-
});
|
|
209
|
+
const agentId = await birthThroughGateway(gatewayUrl, "anthropic", slug, opts.anthropicKey);
|
|
214
210
|
const hashProof = deriveHashProof(opts.anthropicKey, slug);
|
|
215
211
|
await claimAgent(agentId, { hashProof, orgId: org?.org_id });
|
|
216
212
|
say(fmt.success(`mnemom agent: claimed '${slug}' (${agentId}) in ${orgLabel}.`));
|
|
@@ -326,9 +322,8 @@ export async function agentSetupCommand(opts = {}) {
|
|
|
326
322
|
if (cellError)
|
|
327
323
|
throw new Error(cellError.replace("mnemom agent:", "mnemom agent setup:"));
|
|
328
324
|
// Sign in (offer sign-up) and enforce the MU balance before any account write.
|
|
329
|
-
let launchOrgId;
|
|
330
325
|
try {
|
|
331
|
-
|
|
326
|
+
await ensureSessionAndBalance({});
|
|
332
327
|
}
|
|
333
328
|
catch (err) {
|
|
334
329
|
if (isQuietPreambleExit(err))
|
|
@@ -343,16 +338,7 @@ export async function agentSetupCommand(opts = {}) {
|
|
|
343
338
|
: await resolveDefaultSlug({ strict: true });
|
|
344
339
|
if (!slug)
|
|
345
340
|
throw new Error("mnemom agent setup: agent slug sanitised to empty — pass --agent <slug>.");
|
|
346
|
-
|
|
347
|
-
// is claimed into (see EnsureAgentOptions.mnemomKey).
|
|
348
|
-
const mnemomKey = await resolveLaunchMnemomKey(defaultMnemomKeyDeps(undefined, launchOrgId));
|
|
349
|
-
const result = await ensureGovernedAgent({
|
|
350
|
-
slug,
|
|
351
|
-
anthropicKey,
|
|
352
|
-
mnemomKey,
|
|
353
|
-
setup: true,
|
|
354
|
-
gatewayHost,
|
|
355
|
-
});
|
|
341
|
+
const result = await ensureGovernedAgent({ slug, anthropicKey, setup: true, gatewayHost });
|
|
356
342
|
if (!result.provisioned) {
|
|
357
343
|
say(fmt.dim(` '${slug}' is ready (already claimed) or setup was skipped.`));
|
|
358
344
|
}
|
|
@@ -522,20 +508,17 @@ export async function ensureSessionAndBalance(opts) {
|
|
|
522
508
|
}
|
|
523
509
|
/**
|
|
524
510
|
* The account for a launch an orchestrator already preflighted
|
|
525
|
-
* (`MNEMOM_AGENT_PREFLIGHTED=1`, see launchPreflighted): no session prompt
|
|
526
|
-
* µ-balance read. The
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
* org
|
|
530
|
-
* the access gate and decides Remote Control fail-closed, which a caller's
|
|
531
|
-
* preflight can't vouch for.
|
|
511
|
+
* (`MNEMOM_AGENT_PREFLIGHTED=1`, see launchPreflighted): no session prompt, no
|
|
512
|
+
* personal-org lookup, no µ-balance read. The entitlement is still fetched — it
|
|
513
|
+
* is the access gate and decides Remote Control fail-closed, which a caller's
|
|
514
|
+
* preflight can't vouch for. With no active org the api resolves the caller's
|
|
515
|
+
* primary org, and the ledger records the org id the entitlement names.
|
|
532
516
|
*/
|
|
533
517
|
export async function resolvePreflightedAccount() {
|
|
534
518
|
const active = getActiveOrg();
|
|
535
|
-
const
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
return { orgId, orgLabel, entitlement };
|
|
519
|
+
const orgLabel = active ? `${active.name} (${active.slug})` : "your primary org";
|
|
520
|
+
const entitlement = await assertCodeEnabled(active?.org_id ?? "", orgLabel);
|
|
521
|
+
return { orgId: active?.org_id ?? entitlement?.org_id ?? "", orgLabel, entitlement };
|
|
539
522
|
}
|
|
540
523
|
// ── The default coding posture (cards observe-only; goal contracts nudge) ────
|
|
541
524
|
function buildCodeAlignmentCard(agentId) {
|
package/dist/commands/agent.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
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
|
|
28
|
+
import { type MnemomKeyDeps } from "../lib/subscription-login.js";
|
|
29
29
|
import { type SessionRecord } from "../lib/agent-ledger.js";
|
|
30
30
|
import { type ExperimentalId } from "../lib/experimental.js";
|
|
31
31
|
import { type ConsoleKeyDeps } from "../lib/console-key.js";
|
|
@@ -66,9 +66,8 @@ export interface AgentOptions {
|
|
|
66
66
|
context?: boolean;
|
|
67
67
|
/**
|
|
68
68
|
* How the gateway folds this session's context (`--context-profile`): `off`, `balanced`,
|
|
69
|
-
* `aggressive` or `adaptive`. Undefined ⇒ the
|
|
70
|
-
*
|
|
71
|
-
* nothing sent. `--no-context` is `off`; combined with balanced|aggressive|adaptive the launch refuses.
|
|
69
|
+
* `aggressive` or `adaptive`. Undefined ⇒ MNEMOM_AGENT_CONTEXT_PROFILE (the `context_profile` setting), else
|
|
70
|
+
* `balanced`. `--no-context` is `off`; combined with balanced|aggressive|adaptive the launch refuses.
|
|
72
71
|
*/
|
|
73
72
|
contextProfile?: ContextProfile;
|
|
74
73
|
/**
|
|
@@ -196,35 +195,13 @@ export declare function recordSessionLaunch(ctx: {
|
|
|
196
195
|
goalMode: string | null;
|
|
197
196
|
/** The Claude Code session id (pickCcSessionId); null/absent when Claude Code picks it. */
|
|
198
197
|
ccSessionId?: string | null;
|
|
199
|
-
/** The resolved context profile this launch runs under
|
|
200
|
-
contextProfile: ContextProfile
|
|
198
|
+
/** The resolved context profile this launch runs under. */
|
|
199
|
+
contextProfile: ContextProfile;
|
|
201
200
|
/** The resolved compaction target this launch runs under (`resolveCompactAt`). */
|
|
202
201
|
compactAt: number | null;
|
|
203
202
|
}): Promise<void>;
|
|
204
|
-
/**
|
|
205
|
-
export declare
|
|
206
|
-
/**
|
|
207
|
-
* Mint the launch's key: an ORG-owned key for `orgId` (the launch's org) with scopes exactly
|
|
208
|
-
* ["gateway"], which any owner/admin/member may mint — so the gateway's agent-traffic org check
|
|
209
|
-
* (agent org = key org) passes for the agent the launcher claims into that org. Never a personal
|
|
210
|
-
* key: it has no org, and the gateway would refuse every governed turn with it. A refusal (403:
|
|
211
|
-
* an API that predates member org keys, or a viewer/auditor role) is thrown as is; the launch
|
|
212
|
-
* stops with guidance (lib/subscription-login.ts mintAndStore).
|
|
213
|
-
*/
|
|
214
|
-
export declare function mintLaunchMnemomKey(orgId: string): Promise<StoredMnemomKey>;
|
|
215
|
-
/**
|
|
216
|
-
* The real I/O behind every launch's Mnemom key (lib/subscription-login.ts). `launchOrgId` is
|
|
217
|
-
* the org the launch runs in (ensureSessionAndBalance's `orgId`: the active org, else the
|
|
218
|
-
* caller's personal org); omitted or empty, it is the active org.
|
|
219
|
-
*/
|
|
220
|
-
export declare function defaultMnemomKeyDeps(storePath?: string, launchOrgId?: string | null): MnemomKeyDeps;
|
|
221
|
-
/**
|
|
222
|
-
* The Mnemom key already on this machine (MNEMOM_AGENT_MNEMOM_KEY, then ~/.mnemom/launcher.json),
|
|
223
|
-
* never minted: `mnemom agent doctor` reports its source, the goal commands send it.
|
|
224
|
-
*/
|
|
225
|
-
export declare function localLaunchMnemomKey(storePath?: string): LocalMnemomKey | null;
|
|
226
|
-
/** The launch's one-time check of that key (`mnemom agent doctor` reports it). Never throws. */
|
|
227
|
-
export declare function verifyLocalMnemomKey(local: LocalMnemomKey): Promise<MnemomKeyCheck>;
|
|
203
|
+
/** The real I/O behind a subscription launch's Mnemom key (lib/subscription-login.ts). */
|
|
204
|
+
export declare function defaultMnemomKeyDeps(storePath?: string): MnemomKeyDeps;
|
|
228
205
|
/** The real machine behind lib/console-key.ts: the macOS keychain via `security`, no shell. */
|
|
229
206
|
export declare function defaultConsoleKeyDeps(env: NodeJS.ProcessEnv): ConsoleKeyDeps;
|
|
230
207
|
/**
|
|
@@ -375,8 +352,8 @@ export declare function printPlan(ctx: {
|
|
|
375
352
|
goalMode: string | null;
|
|
376
353
|
yolo: boolean;
|
|
377
354
|
cli: ResolvedCli;
|
|
378
|
-
/** The resolved context profile (`resolveContextProfile`)
|
|
379
|
-
contextProfile: ContextProfile
|
|
355
|
+
/** The resolved context profile (`resolveContextProfile`). */
|
|
356
|
+
contextProfile: ContextProfile;
|
|
380
357
|
/** The resolved compaction target (`resolveCompactAt`); `null` = no target (default). */
|
|
381
358
|
compactAt: number | null;
|
|
382
359
|
/** The decoded `x-mnemom-session-config` overlay (`buildSessionConfig`); empty ⇒ no header. */
|