@mnemom/mnemom 0.17.2-next.2 → 0.17.2-next.3
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 +13 -0
- package/dist/commands/agent-session.d.ts +10 -22
- package/dist/commands/agent-session.js +17 -54
- package/dist/commands/agent-setup.d.ts +13 -0
- package/dist/commands/agent-setup.js +14 -0
- package/dist/commands/agent.js +16 -8
- package/dist/index.js +2 -2
- package/dist/lib/agent.d.ts +16 -2
- package/dist/lib/agent.js +19 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,6 +71,19 @@ Make one mode the standing default with `mnemom agent config set goal_mode impli
|
|
|
71
71
|
(or `off`); `--goal` still seals for that launch and `--no-implicit` turns it off for one
|
|
72
72
|
launch. A sealed contract needs a per-launch statement, so it cannot be the default.
|
|
73
73
|
|
|
74
|
+
#### Orchestrated launches: `MNEMOM_AGENT_PREFLIGHTED=1`
|
|
75
|
+
|
|
76
|
+
An orchestrator (the ADW fleet) that already checked sign-in and the µ balance before
|
|
77
|
+
spawning many launches can set `MNEMOM_AGENT_PREFLIGHTED=1`. Each launch then skips its
|
|
78
|
+
own session, personal-org and µ-balance requests. The Mnemom Agent entitlement is still
|
|
79
|
+
fetched, because it gates access and Remote Control. Only the exact value `1` counts.
|
|
80
|
+
This is not for interactive use: a launch with no session or no µ will fail at the
|
|
81
|
+
gateway instead of printing the sign-in or top-up guidance.
|
|
82
|
+
|
|
83
|
+
An explicit launch shape (`--remote-control`, `--server`, `MNEMOM_AGENT_REMOTE_CONTROL`
|
|
84
|
+
or `launch` in `launcher.toml`) also skips the Remote Control capability probe
|
|
85
|
+
(`claude --help`), which only feeds the automatic upgrade to Remote Control.
|
|
86
|
+
|
|
74
87
|
## How It Works
|
|
75
88
|
|
|
76
89
|
```
|
|
@@ -6,28 +6,22 @@
|
|
|
6
6
|
* a terminal we ask two things, explaining each in a sentence:
|
|
7
7
|
*
|
|
8
8
|
* 1. a SESSION NAME — labels the session in traces and the claude.ai session
|
|
9
|
-
* list (defaults to the current folder's name)
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - OFF: the session runs governed with goal alignment off — neither header
|
|
18
|
-
* is sent, so the gateway's goal hooks are simply not engaged.
|
|
9
|
+
* list (defaults to the current folder's name).
|
|
10
|
+
*
|
|
11
|
+
* GOAL ALIGNMENT is not prompted for: it defaults to IMPLICIT. A bare launch
|
|
12
|
+
* runs governed with the goal inferred from your own messages
|
|
13
|
+
* (`x-mnemom-goal-mode: implicit`, no contract). `--goal` seals a one-line
|
|
14
|
+
* contract instead (`x-mnemom-contract`); `--no-implicit` (or launcher.toml
|
|
15
|
+
* `goal_mode = "off"`) turns alignment off — neither header is sent. The mode is
|
|
16
|
+
* resolved upstream (`resolveImplicit`) and announced on the launch line.
|
|
19
17
|
*
|
|
20
18
|
* Non-interactive runs (pipes, CI) never prompt — they get a clear error asking
|
|
21
|
-
* for a name.
|
|
22
|
-
*
|
|
23
|
-
* "implicit"` with no `--no-implicit`) skips it too. Pure apart from the
|
|
24
|
-
* injected `ask` functions, so every arm is unit-tested.
|
|
19
|
+
* for a name. Pure apart from the injected `ask` functions, so every arm is
|
|
20
|
+
* unit-tested.
|
|
25
21
|
*/
|
|
26
22
|
export interface SessionAsk {
|
|
27
23
|
askInput(question: string): Promise<string>;
|
|
28
24
|
askYesNo(question: string, defaultYes: boolean): Promise<boolean>;
|
|
29
|
-
/** Numbered single-select; resolves the chosen label, or null on no/invalid choice. */
|
|
30
|
-
askSelect(question: string, options: string[]): Promise<string | null>;
|
|
31
25
|
}
|
|
32
26
|
export interface SessionSetupInput {
|
|
33
27
|
/** The positional `[scenario]` (session name), if given. */
|
|
@@ -51,12 +45,6 @@ export interface SessionSetup {
|
|
|
51
45
|
prompted: boolean;
|
|
52
46
|
}
|
|
53
47
|
export declare const NO_SESSION_NAME_MESSAGE: string;
|
|
54
|
-
/** The three goal-alignment choices offered by the interactive prompt (labels are the select options). */
|
|
55
|
-
export declare const GOAL_CHOICE_IMPLICIT = "Infer my goal from my messages \u2014 nothing to type; revised as I steer (implicit mode)";
|
|
56
|
-
export declare const GOAL_CHOICE_TYPED = "Type a one-line goal \u2014 sealed as a contract for this session";
|
|
57
|
-
export declare const GOAL_CHOICE_OFF = "Off \u2014 run governed with goal alignment off (Enter)";
|
|
58
|
-
export declare const GOAL_CHOICES: readonly string[];
|
|
59
|
-
export declare const GOAL_CHOICE_QUESTION = "Goal alignment for this session?";
|
|
60
48
|
/** Current folder name, sanitised like an agent slug; "session" when that is empty. */
|
|
61
49
|
export declare function defaultSessionName(cwd?: string): string;
|
|
62
50
|
/** The one-line status printed at launch so the customer always knows the mode. */
|
|
@@ -6,37 +6,23 @@
|
|
|
6
6
|
* a terminal we ask two things, explaining each in a sentence:
|
|
7
7
|
*
|
|
8
8
|
* 1. a SESSION NAME — labels the session in traces and the claude.ai session
|
|
9
|
-
* list (defaults to the current folder's name)
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - OFF: the session runs governed with goal alignment off — neither header
|
|
18
|
-
* is sent, so the gateway's goal hooks are simply not engaged.
|
|
9
|
+
* list (defaults to the current folder's name).
|
|
10
|
+
*
|
|
11
|
+
* GOAL ALIGNMENT is not prompted for: it defaults to IMPLICIT. A bare launch
|
|
12
|
+
* runs governed with the goal inferred from your own messages
|
|
13
|
+
* (`x-mnemom-goal-mode: implicit`, no contract). `--goal` seals a one-line
|
|
14
|
+
* contract instead (`x-mnemom-contract`); `--no-implicit` (or launcher.toml
|
|
15
|
+
* `goal_mode = "off"`) turns alignment off — neither header is sent. The mode is
|
|
16
|
+
* resolved upstream (`resolveImplicit`) and announced on the launch line.
|
|
19
17
|
*
|
|
20
18
|
* Non-interactive runs (pipes, CI) never prompt — they get a clear error asking
|
|
21
|
-
* for a name.
|
|
22
|
-
*
|
|
23
|
-
* "implicit"` with no `--no-implicit`) skips it too. Pure apart from the
|
|
24
|
-
* injected `ask` functions, so every arm is unit-tested.
|
|
19
|
+
* for a name. Pure apart from the injected `ask` functions, so every arm is
|
|
20
|
+
* unit-tested.
|
|
25
21
|
*/
|
|
26
22
|
import { basename } from "node:path";
|
|
27
23
|
import { sanitizeAgentName } from "../lib/agent.js";
|
|
28
24
|
export const NO_SESSION_NAME_MESSAGE = "mnemom agent: a session name is required here (e.g. `mnemom agent onboarding`). " +
|
|
29
25
|
"In a terminal, plain `mnemom agent` asks for one.";
|
|
30
|
-
/** The three goal-alignment choices offered by the interactive prompt (labels are the select options). */
|
|
31
|
-
export const GOAL_CHOICE_IMPLICIT = "Infer my goal from my messages — nothing to type; revised as I steer (implicit mode)";
|
|
32
|
-
export const GOAL_CHOICE_TYPED = "Type a one-line goal — sealed as a contract for this session";
|
|
33
|
-
export const GOAL_CHOICE_OFF = "Off — run governed with goal alignment off (Enter)";
|
|
34
|
-
export const GOAL_CHOICES = [
|
|
35
|
-
GOAL_CHOICE_IMPLICIT,
|
|
36
|
-
GOAL_CHOICE_TYPED,
|
|
37
|
-
GOAL_CHOICE_OFF,
|
|
38
|
-
];
|
|
39
|
-
export const GOAL_CHOICE_QUESTION = "Goal alignment for this session?";
|
|
40
26
|
/** Current folder name, sanitised like an agent slug; "session" when that is empty. */
|
|
41
27
|
export function defaultSessionName(cwd = process.cwd()) {
|
|
42
28
|
return sanitizeAgentName(basename(cwd)) || "session";
|
|
@@ -50,7 +36,7 @@ export function goalAlignmentLine(mode) {
|
|
|
50
36
|
}
|
|
51
37
|
return m === "on"
|
|
52
38
|
? "mnemom agent: goal alignment: on (the judge nudges the agent back when it drifts from your goal)"
|
|
53
|
-
: "mnemom agent: goal alignment: off (no
|
|
39
|
+
: "mnemom agent: goal alignment: off (--no-implicit or goal_mode = off — pass --goal or drop --no-implicit to turn it back on)";
|
|
54
40
|
}
|
|
55
41
|
const defaultSay = (line = "") => console.error(line);
|
|
56
42
|
/**
|
|
@@ -79,36 +65,13 @@ export async function resolveSessionSetup(input, ask) {
|
|
|
79
65
|
say(` (Next time you can pass it directly: mnemom agent <name>.)`);
|
|
80
66
|
const typed = await ask.askInput(`Session name [${fallback}]:`);
|
|
81
67
|
const scenario = sanitizeAgentName(typed.trim()) || fallback;
|
|
82
|
-
// ── 2. goal alignment
|
|
68
|
+
// ── 2. goal alignment — resolved upstream, no prompt. Implicit is the DEFAULT
|
|
69
|
+
// (a bare launch runs governed with the goal inferred from your messages), so
|
|
70
|
+
// there is nothing to pick here: `--goal` seals a contract, the default (and
|
|
71
|
+
// `--implicit` / `goal_mode = "implicit"`) is implicit, and `--no-implicit` /
|
|
72
|
+
// `goal_mode = "off"` turns it off. The launch line announces the mode.
|
|
83
73
|
if (flagGoal) {
|
|
84
74
|
return { scenario, goal: flagGoal, goalAlignment: "on", prompted: true };
|
|
85
75
|
}
|
|
86
|
-
|
|
87
|
-
return { scenario, goalAlignment: "implicit", prompted: true };
|
|
88
|
-
}
|
|
89
|
-
say();
|
|
90
|
-
say("Goal alignment — how Mnemom keeps this session on track. Three choices:");
|
|
91
|
-
say(" Infer: nothing to type — the gateway reads your own messages, revises the goal as you");
|
|
92
|
-
say(" steer, and the judge nudges the agent back when it drifts (a little µ per message + turn).");
|
|
93
|
-
say(" Type a goal: one line, sealed as a contract; the judge nudges against it (a little µ per turn).");
|
|
94
|
-
say(" Off: the session runs governed with goal alignment off (the default — just press Enter).");
|
|
95
|
-
say(" (Make one the default: mnemom agent config set goal_mode implicit|off.)");
|
|
96
|
-
const choice = await ask.askSelect(GOAL_CHOICE_QUESTION, [...GOAL_CHOICES]);
|
|
97
|
-
if (choice === GOAL_CHOICE_IMPLICIT) {
|
|
98
|
-
return { scenario, goalAlignment: "implicit", prompted: true };
|
|
99
|
-
}
|
|
100
|
-
if (choice === GOAL_CHOICE_TYPED) {
|
|
101
|
-
const goal = (await ask.askInput("Goal (one line):")).trim();
|
|
102
|
-
if (!goal) {
|
|
103
|
-
say(" No goal entered — continuing with goal alignment off.");
|
|
104
|
-
return { scenario, goalAlignment: "off", prompted: true };
|
|
105
|
-
}
|
|
106
|
-
return { scenario, goal, goalAlignment: "on", prompted: true };
|
|
107
|
-
}
|
|
108
|
-
// Enter (no pick) and any invalid pick both resolve to null → off. Off is the
|
|
109
|
-
// deliberate default for now: a µ-costing mode is never picked by a bare Enter.
|
|
110
|
-
if (choice !== GOAL_CHOICE_OFF) {
|
|
111
|
-
say(" Goal alignment off (press 1 or 2 next time to turn it on).");
|
|
112
|
-
}
|
|
113
|
-
return { scenario, goalAlignment: "off", prompted: true };
|
|
76
|
+
return { scenario, goalAlignment: implicit ? "implicit" : "off", prompted: true };
|
|
114
77
|
}
|
|
@@ -115,3 +115,16 @@ export declare function ensureSessionAndBalance(opts: {
|
|
|
115
115
|
orgLabel: string;
|
|
116
116
|
entitlement: CodeEntitlement | null;
|
|
117
117
|
}>;
|
|
118
|
+
/**
|
|
119
|
+
* The account for a launch an orchestrator already preflighted
|
|
120
|
+
* (`MNEMOM_AGENT_PREFLIGHTED=1`, see launchPreflighted): no session prompt, no
|
|
121
|
+
* personal-org lookup, no µ-balance read. The entitlement is still fetched — it
|
|
122
|
+
* is the access gate and decides Remote Control fail-closed, which a caller's
|
|
123
|
+
* preflight can't vouch for. With no active org the api resolves the caller's
|
|
124
|
+
* primary org, and the ledger records the org id the entitlement names.
|
|
125
|
+
*/
|
|
126
|
+
export declare function resolvePreflightedAccount(): Promise<{
|
|
127
|
+
orgId: string;
|
|
128
|
+
orgLabel: string;
|
|
129
|
+
entitlement: CodeEntitlement | null;
|
|
130
|
+
}>;
|
|
@@ -383,6 +383,20 @@ export async function ensureSessionAndBalance(opts) {
|
|
|
383
383
|
await assertMuBalance(orgId, orgLabel);
|
|
384
384
|
return { orgId, orgLabel, entitlement };
|
|
385
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* The account for a launch an orchestrator already preflighted
|
|
388
|
+
* (`MNEMOM_AGENT_PREFLIGHTED=1`, see launchPreflighted): no session prompt, no
|
|
389
|
+
* personal-org lookup, no µ-balance read. The entitlement is still fetched — it
|
|
390
|
+
* is the access gate and decides Remote Control fail-closed, which a caller's
|
|
391
|
+
* preflight can't vouch for. With no active org the api resolves the caller's
|
|
392
|
+
* primary org, and the ledger records the org id the entitlement names.
|
|
393
|
+
*/
|
|
394
|
+
export async function resolvePreflightedAccount() {
|
|
395
|
+
const active = getActiveOrg();
|
|
396
|
+
const orgLabel = active ? `${active.name} (${active.slug})` : "your primary org";
|
|
397
|
+
const entitlement = await assertCodeEnabled(active?.org_id ?? "", orgLabel);
|
|
398
|
+
return { orgId: active?.org_id ?? entitlement?.org_id ?? "", orgLabel, entitlement };
|
|
399
|
+
}
|
|
386
400
|
// ── The default coding posture (cards observe-only; goal contracts nudge) ────
|
|
387
401
|
function buildCodeAlignmentCard(agentId) {
|
|
388
402
|
return {
|
package/dist/commands/agent.js
CHANGED
|
@@ -35,18 +35,18 @@ import { getAgentByName } from "../lib/api.js";
|
|
|
35
35
|
import { LEDGER_FILE, appendSessionRecord, toLedgerContract } from "../lib/agent-ledger.js";
|
|
36
36
|
import { configKeySpec, loadLauncherConfig, writeLauncherConfig } from "../lib/launcher-config.js";
|
|
37
37
|
import { fmt } from "../lib/format.js";
|
|
38
|
-
import { askInput,
|
|
38
|
+
import { askInput, askYesNo, isInteractive } from "../lib/prompt.js";
|
|
39
39
|
import { goalAlignmentLine, resolveSessionSetup } from "./agent-session.js";
|
|
40
|
-
import { defaultAgentSlug, ensureGovernedAgent, ensureSessionAndBalance, isQuietPreambleExit, resolveDefaultSlug, } from "./agent-setup.js";
|
|
41
|
-
import { assembleContract, buildGoalModeHeader, buildCustomHeaders, buildSessionConfigB64, resolveContextFold, isProdGateway, launchPreferenceExplicit, remoteControlAllowed, resolveAnthropicDoor, resolveConversationId, resolveGatewayHost, resolveLaunchShape, resolveRemoteControlShape, sanitizeAgentName, } from "../lib/agent.js";
|
|
40
|
+
import { defaultAgentSlug, ensureGovernedAgent, ensureSessionAndBalance, isQuietPreambleExit, resolveDefaultSlug, resolvePreflightedAccount, } from "./agent-setup.js";
|
|
41
|
+
import { assembleContract, buildGoalModeHeader, buildCustomHeaders, buildSessionConfigB64, resolveContextFold, isProdGateway, launchPreferenceExplicit, launchPreflighted, remoteControlAllowed, resolveAnthropicDoor, resolveConversationId, resolveGatewayHost, resolveLaunchShape, resolveRemoteControlShape, sanitizeAgentName, } from "../lib/agent.js";
|
|
42
42
|
/** The CLI's own provider-key store (zero 1Password): ~/.mnemom/launcher.json, 0600. */
|
|
43
43
|
const CODE_STORE = join(MNEMOM_DIR, "launcher.json");
|
|
44
44
|
const say = (line = "") => console.error(line);
|
|
45
45
|
/** Entry point for `mnemom agent [scenario]`. Throws on fatal misconfig. */
|
|
46
46
|
export async function agentCommand(scenarioArg, options = {}) {
|
|
47
47
|
// ── session name + goal ── (a bare `mnemom agent` in a terminal asks for both,
|
|
48
|
-
//
|
|
49
|
-
//
|
|
48
|
+
// goal alignment is implicit by default (inferred from your messages); --goal
|
|
49
|
+
// seals a contract and --no-implicit turns it off — all resolved upstream.
|
|
50
50
|
const session = await resolveSessionSetup({
|
|
51
51
|
scenario: scenarioArg,
|
|
52
52
|
goal: options.goal,
|
|
@@ -55,7 +55,6 @@ export async function agentCommand(scenarioArg, options = {}) {
|
|
|
55
55
|
}, {
|
|
56
56
|
askInput: (q) => askInput(q),
|
|
57
57
|
askYesNo: (q, d) => askYesNo(q, d),
|
|
58
|
-
askSelect: (q, o) => askSelect(q, o),
|
|
59
58
|
});
|
|
60
59
|
const scenario = session.scenario;
|
|
61
60
|
const env = process.env;
|
|
@@ -165,9 +164,14 @@ export async function agentCommand(scenarioArg, options = {}) {
|
|
|
165
164
|
// there isn't one — and (2) enforce a positive µ balance on the org the agent
|
|
166
165
|
// lives in (default: the user's personal org). No µ ⇒ blocked with a
|
|
167
166
|
// portal-style top-up message. Skipped only on --dry-run (handled above).
|
|
167
|
+
// MNEMOM_AGENT_PREFLIGHTED=1 (orchestrators such as the ADW fleet that already
|
|
168
|
+
// ran their own session + balance preflight) skips those round trips; the
|
|
169
|
+
// entitlement is still fetched — see resolvePreflightedAccount.
|
|
168
170
|
let account;
|
|
169
171
|
try {
|
|
170
|
-
account =
|
|
172
|
+
account = launchPreflighted(env)
|
|
173
|
+
? await resolvePreflightedAccount()
|
|
174
|
+
: await ensureSessionAndBalance({ interactive: isInteractive() });
|
|
171
175
|
}
|
|
172
176
|
catch (err) {
|
|
173
177
|
if (isQuietPreambleExit(err))
|
|
@@ -182,7 +186,11 @@ export async function agentCommand(scenarioArg, options = {}) {
|
|
|
182
186
|
// terminal-only with a notice. FAIL-CLOSED — a null entitlement (gate failed
|
|
183
187
|
// open) or an api without the field yields no Remote Control.
|
|
184
188
|
const rcAllowed = remoteControlAllowed(account.entitlement);
|
|
185
|
-
|
|
189
|
+
// The capability probe (`claude --help`, up to 10s, plus `command -v` for node
|
|
190
|
+
// and openssl) only feeds the auto-upgrade. An explicit shape never auto-upgrades
|
|
191
|
+
// and a non-allowed account never gets Remote Control, so both skip it; an
|
|
192
|
+
// explicit RC launch still refuses a missing node/openssl in launchRemoteControl.
|
|
193
|
+
const rc = shapeExplicit || !rcAllowed ? { ok: false, missing: [] } : checkRcCapability(cli);
|
|
186
194
|
// Preserve the "how to turn Remote Control on" guidance for an allowed account
|
|
187
195
|
// whose machine can't do it yet and who didn't pin a shape (the old
|
|
188
196
|
// applyAutoShape behaviour). Non-allowed accounts never see it — RC isn't
|
package/dist/index.js
CHANGED
|
@@ -113,8 +113,8 @@ const agentCmd = program
|
|
|
113
113
|
.option("--budget <usd>", "Guardrail: spend ceiling in USD (positive number)")
|
|
114
114
|
.option("--max-turns <n>", "Guardrail: turn ceiling (positive integer)")
|
|
115
115
|
.option("--stall <n>", "Guardrail: consecutive no-write turns (positive integer)")
|
|
116
|
-
.option("--implicit", "
|
|
117
|
-
.option("--no-implicit", "
|
|
116
|
+
.option("--implicit", "Implicit goal alignment (the default): the gateway infers the goal from your messages and revises it as you steer (not combinable with --goal/--requirement/--allow/--forbid/--goal-id; the guardrail ceilings still apply)")
|
|
117
|
+
.option("--no-implicit", "Turn goal alignment OFF for this launch (implicit alignment is on by default; also overrides launcher.toml goal_mode = implicit)")
|
|
118
118
|
.option("--conversation-id <id>", "x-mnemom-conversation-id (default: auto-generated)")
|
|
119
119
|
.option("--cli <name|path>", "Coding-agent CLI to launch: a name or full path (default: claude)")
|
|
120
120
|
.option("--gateway <url>", "Gateway host override (default: https://gateway.mnemom.ai; or MNEMOM_AGENT_GATEWAY)")
|
package/dist/lib/agent.d.ts
CHANGED
|
@@ -165,6 +165,16 @@ export declare function launchPreferenceExplicit(opts: {
|
|
|
165
165
|
remoteControl?: boolean;
|
|
166
166
|
server?: boolean;
|
|
167
167
|
}, env?: NodeJS.ProcessEnv): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Has an orchestrator already run the session + µ-balance preflight for this
|
|
170
|
+
* launch? `MNEMOM_AGENT_PREFLIGHTED=1` is for orchestrators (the ADW fleet) that
|
|
171
|
+
* checked sign-in and balance themselves before spawning many launches; it skips
|
|
172
|
+
* the per-launch session/personal-org/balance round trips. The Mnemom Agent
|
|
173
|
+
* entitlement (which also gates Remote Control, fail-closed) is still fetched.
|
|
174
|
+
* Only the exact value `1` counts — anything else, including `true` or ` 1`, is
|
|
175
|
+
* a normal launch.
|
|
176
|
+
*/
|
|
177
|
+
export declare function launchPreflighted(env?: NodeJS.ProcessEnv): boolean;
|
|
168
178
|
/**
|
|
169
179
|
* Is this account allowed to use Remote Control (a session steerable from
|
|
170
180
|
* claude.ai and the Claude app)? Remote Control is an INTERNAL Mnemom capability
|
|
@@ -244,8 +254,12 @@ export type GoalModeDefault = "implicit" | "off";
|
|
|
244
254
|
* 1. an explicit flag — `--implicit` (true) or `--no-implicit` (false);
|
|
245
255
|
* 2. a `--goal` statement — a sealed contract is a per-launch choice that the
|
|
246
256
|
* standing config default must never silently override;
|
|
247
|
-
* 3. the config default `goal_mode
|
|
248
|
-
*
|
|
257
|
+
* 3. the config default `goal_mode` — `"off"` turns alignment off, `"implicit"`
|
|
258
|
+
* keeps it implicit;
|
|
259
|
+
* 4. IMPLICIT (the default). A bare `mnemom agent` runs with implicit goal
|
|
260
|
+
* alignment on: the gateway infers the goal from the user's own messages.
|
|
261
|
+
* Turn it off for a launch with `--no-implicit`, or standing with
|
|
262
|
+
* `goal_mode = "off"`.
|
|
249
263
|
* Pure so every arm is unit-tested; the caller passes the resolved value on to
|
|
250
264
|
* `assembleContract` / `buildGoalModeHeader` (which still refuse `--implicit`
|
|
251
265
|
* combined with a contract flag — that conflict is EXPLICIT and is reported).
|
package/dist/lib/agent.js
CHANGED
|
@@ -300,6 +300,18 @@ export function launchPreferenceExplicit(opts, env = process.env) {
|
|
|
300
300
|
return true;
|
|
301
301
|
return (env.MNEMOM_AGENT_REMOTE_CONTROL ?? "").trim() !== "";
|
|
302
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Has an orchestrator already run the session + µ-balance preflight for this
|
|
305
|
+
* launch? `MNEMOM_AGENT_PREFLIGHTED=1` is for orchestrators (the ADW fleet) that
|
|
306
|
+
* checked sign-in and balance themselves before spawning many launches; it skips
|
|
307
|
+
* the per-launch session/personal-org/balance round trips. The Mnemom Agent
|
|
308
|
+
* entitlement (which also gates Remote Control, fail-closed) is still fetched.
|
|
309
|
+
* Only the exact value `1` counts — anything else, including `true` or ` 1`, is
|
|
310
|
+
* a normal launch.
|
|
311
|
+
*/
|
|
312
|
+
export function launchPreflighted(env = process.env) {
|
|
313
|
+
return env.MNEMOM_AGENT_PREFLIGHTED === "1";
|
|
314
|
+
}
|
|
303
315
|
/**
|
|
304
316
|
* Is this account allowed to use Remote Control (a session steerable from
|
|
305
317
|
* claude.ai and the Claude app)? Remote Control is an INTERNAL Mnemom capability
|
|
@@ -396,8 +408,12 @@ export function buildSessionConfigB64(fold) {
|
|
|
396
408
|
* 1. an explicit flag — `--implicit` (true) or `--no-implicit` (false);
|
|
397
409
|
* 2. a `--goal` statement — a sealed contract is a per-launch choice that the
|
|
398
410
|
* standing config default must never silently override;
|
|
399
|
-
* 3. the config default `goal_mode
|
|
400
|
-
*
|
|
411
|
+
* 3. the config default `goal_mode` — `"off"` turns alignment off, `"implicit"`
|
|
412
|
+
* keeps it implicit;
|
|
413
|
+
* 4. IMPLICIT (the default). A bare `mnemom agent` runs with implicit goal
|
|
414
|
+
* alignment on: the gateway infers the goal from the user's own messages.
|
|
415
|
+
* Turn it off for a launch with `--no-implicit`, or standing with
|
|
416
|
+
* `goal_mode = "off"`.
|
|
401
417
|
* Pure so every arm is unit-tested; the caller passes the resolved value on to
|
|
402
418
|
* `assembleContract` / `buildGoalModeHeader` (which still refuse `--implicit`
|
|
403
419
|
* combined with a contract flag — that conflict is EXPLICIT and is reported).
|
|
@@ -407,5 +423,5 @@ export function resolveImplicit(opts) {
|
|
|
407
423
|
return opts.implicit;
|
|
408
424
|
if (hasText(opts.goal))
|
|
409
425
|
return false;
|
|
410
|
-
return opts.configGoalMode
|
|
426
|
+
return opts.configGoalMode !== "off";
|
|
411
427
|
}
|