@mnemom/mnemom 0.17.9-next.0 → 0.17.10
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/commands/agent-setup.d.ts +68 -49
- package/dist/commands/agent-setup.js +242 -160
- package/dist/commands/agent.d.ts +9 -12
- package/dist/commands/agent.js +26 -56
- package/dist/commands/card.js +2 -2
- package/dist/commands/onboard.js +4 -3
- package/dist/commands/protection.js +1 -1
- package/dist/commands/try-me.d.ts +13 -0
- package/dist/commands/try-me.js +44 -13
- package/dist/commands/wrap.js +3 -3
- package/dist/index.js +2 -2
- package/dist/lib/agent-identity-route.d.ts +28 -0
- package/dist/lib/agent-identity-route.js +57 -0
- package/dist/lib/login-detect.d.ts +2 -2
- package/dist/lib/login-detect.js +4 -4
- package/dist/lib/served-agent-cache.d.ts +8 -0
- package/dist/lib/served-agent-cache.js +26 -9
- package/dist/lib/try-me.d.ts +18 -0
- package/dist/lib/try-me.js +70 -3
- package/package.json +1 -1
|
@@ -6,22 +6,24 @@
|
|
|
6
6
|
* governed identity `agent-<handle>`. This module makes that identity REAL in
|
|
7
7
|
* their Mnemom org: it births the agent through the gateway, claims it (so the
|
|
8
8
|
* customer owns it), and publishes a sane default coding posture. The CARDS are
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* OFF by default (operator 2026-10-02: alignment and protection analysis are
|
|
10
|
+
* billed, so nobody pays for them until they turn them on); the goal contract is
|
|
11
|
+
* what nudges (re-anchor on drift). Specifically:
|
|
12
|
+
* - alignment card: autonomy_mode + integrity_mode = off,
|
|
12
13
|
* principal.relationship = delegated_authority, coding bounded/forbidden
|
|
13
14
|
* actions, escalate-on-irreversible;
|
|
14
|
-
* - protection card: mode =
|
|
15
|
-
* screen_surfaces
|
|
15
|
+
* - protection card: mode = off, thresholds 0.60/0.80/0.95 and all four
|
|
16
|
+
* screen_surfaces declared, ready for when it is turned on.
|
|
16
17
|
* - goal-alignment: nudge — sealed per-conversation via the goal contract
|
|
17
18
|
* (--goal …), graded and re-anchored by the gateway.
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* launch
|
|
22
|
-
*
|
|
23
|
-
* birthThroughGateway (wrap.ts), deriveHashProof
|
|
24
|
-
* putAlignmentCard/putProtectionCard (lib/api.ts) — rather than
|
|
20
|
+
* A launch never runs on an unclaimed agent (operator 2026-10-03): an unclaimed agent lands in
|
|
21
|
+
* the sandbox org and bills nobody. ensureClaimedServedAgent asks the gateway which agent it
|
|
22
|
+
* serves for this launch's credential + name, claims it into the org the launch bills when it
|
|
23
|
+
* is not claimed yet, and refuses otherwise — interactive or not, there is no unclaimed
|
|
24
|
+
* fallback. Reuses the existing machinery — birthThroughGateway (wrap.ts), deriveHashProof
|
|
25
|
+
* (agents.ts), claimAgent + putAlignmentCard/putProtectionCard (lib/api.ts) — rather than
|
|
26
|
+
* reinventing it.
|
|
25
27
|
*/
|
|
26
28
|
import { type CodeEntitlement } from "../lib/api.js";
|
|
27
29
|
/**
|
|
@@ -47,58 +49,75 @@ export declare function resolveDefaultSlug(opts?: {
|
|
|
47
49
|
strict?: boolean;
|
|
48
50
|
}): Promise<string>;
|
|
49
51
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
52
|
+
* `mnemom agent` refuses to launch: the agent the gateway would serve is not claimed and could
|
|
53
|
+
* not be claimed here (or could not be identified at all). An unclaimed agent lands in the
|
|
54
|
+
* sandbox org and bills nobody, so there is no fallback — the message says what to do.
|
|
53
55
|
*/
|
|
54
|
-
export declare class
|
|
55
|
-
|
|
56
|
-
/** The agent the org lookup found by name. */
|
|
57
|
-
readonly namedId: string;
|
|
58
|
-
/** The agent the gateway answered with on x-mnemom-agent. */
|
|
59
|
-
readonly servedId: string;
|
|
60
|
-
constructor(slug: string,
|
|
61
|
-
/** The agent the org lookup found by name. */
|
|
62
|
-
namedId: string,
|
|
63
|
-
/** The agent the gateway answered with on x-mnemom-agent. */
|
|
64
|
-
servedId: string);
|
|
56
|
+
export declare class UnclaimedAgentError extends Error {
|
|
57
|
+
constructor(message: string);
|
|
65
58
|
}
|
|
66
|
-
export interface
|
|
59
|
+
export interface ClaimedAgentOptions {
|
|
67
60
|
/** The already-resolved final agent slug (what rides as x-mnemom-agent). */
|
|
68
61
|
slug: string;
|
|
69
|
-
/**
|
|
70
|
-
anthropicKey
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
/** Gateway host the launch targets (
|
|
62
|
+
/** Anthropic-key launch: the key that anchors the gateway identity. Never logged. */
|
|
63
|
+
anthropicKey?: string;
|
|
64
|
+
/** Subscription launch: the Mnemom API key that anchors the gateway identity. Never logged. */
|
|
65
|
+
mnemomKey?: string;
|
|
66
|
+
/** Gateway host the launch targets (the probe goes to the same cell). */
|
|
74
67
|
gatewayHost: string;
|
|
75
|
-
/**
|
|
76
|
-
|
|
68
|
+
/**
|
|
69
|
+
* The org this launch bills — the one ensureSessionAndBalance resolved and checked the µ of.
|
|
70
|
+
* A claim lands here. The active/default org is never changed.
|
|
71
|
+
*/
|
|
72
|
+
orgId: string;
|
|
73
|
+
orgLabel: string;
|
|
74
|
+
/** true = --setup (re-ask the gateway, refresh the cards); false = --no-setup (no card writes). */
|
|
75
|
+
setup?: boolean;
|
|
77
76
|
/** Where the served-agent cache lives (defaults to ~/.mnemom). */
|
|
78
77
|
cacheDir?: string;
|
|
79
78
|
}
|
|
80
79
|
/** A bare launch never waits on the served-agent probe longer than this. */
|
|
81
80
|
export declare const SERVED_PROBE_TIMEOUT_MS = 10000;
|
|
82
|
-
|
|
81
|
+
/**
|
|
82
|
+
* The waits between the tries of a call that failed transiently (network, timeout, 429, 5xx):
|
|
83
|
+
* three tries, about four seconds of backoff. Exported so tests can zero it.
|
|
84
|
+
*/
|
|
85
|
+
export declare const CONFIRM_RETRY_DELAYS_MS: number[];
|
|
86
|
+
export interface ClaimedAgentResult {
|
|
83
87
|
slug: string;
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
* match, a mismatch, or a fresh birth). Absent when it never asked the gateway.
|
|
89
|
-
*/
|
|
90
|
-
agentId?: string;
|
|
88
|
+
/** The mnm- id the gateway serves for (credential, slug) — claimed when this returns. */
|
|
89
|
+
agentId: string;
|
|
90
|
+
/** true only when this call claimed it. */
|
|
91
|
+
claimedNow: boolean;
|
|
91
92
|
}
|
|
92
93
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*
|
|
94
|
+
* A failure worth retrying, and that an outage fallback may cover: no answer at all (network,
|
|
95
|
+
* timeout, an unparseable reply) or a 408/429/5xx. A 4xx, a missing route, or a refusal is a
|
|
96
|
+
* definite answer.
|
|
97
|
+
*/
|
|
98
|
+
export declare function isTransient(err: unknown): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The one invariant behind every `mnemom agent` launch: the coding CLI never starts unless the
|
|
101
|
+
* agent the gateway serves for THIS launch's credential + name is claimed.
|
|
102
|
+
*
|
|
103
|
+
* 1. Ask which agent the gateway serves (an Anthropic-key launch: the birth probe, cached per
|
|
104
|
+
* key + name + gateway; a subscription launch: the gateway's identity route).
|
|
105
|
+
* 2. Read its claim state. Claimed ⇒ launch, and never claim it again: a re-claim by its owner
|
|
106
|
+
* MOVES it to the requested org.
|
|
107
|
+
* 3. Unclaimed ⇒ claim it into `orgId` with the hash proof of the key that anchors it. Another
|
|
108
|
+
* account owns it ⇒ refuse; any other claim failure ⇒ refuse.
|
|
109
|
+
*
|
|
110
|
+
* A definite answer (unclaimed and can't be claimed, owned by another account, the identity
|
|
111
|
+
* route missing, a rejected key) always refuses. A transient failure is retried; if Mnemom still
|
|
112
|
+
* can't be reached, the launch uses the agent this machine last confirmed claimed for the same
|
|
113
|
+
* credential + name — and only when the gateway hasn't since named a different one — or
|
|
114
|
+
* refuses. There is deliberately no switch that launches unclaimed (operator ruling 2026-10-03).
|
|
115
|
+
*
|
|
116
|
+
* Interactive and non-interactive runs behave the same: there is no prompt to decline.
|
|
117
|
+
* MNE-7650: the name is client-controlled, so a same-named org agent proves nothing — only the
|
|
118
|
+
* served id counts.
|
|
100
119
|
*/
|
|
101
|
-
export declare function
|
|
120
|
+
export declare function ensureClaimedServedAgent(opts: ClaimedAgentOptions): Promise<ClaimedAgentResult>;
|
|
102
121
|
/**
|
|
103
122
|
* One line for an api failure that keeps the parts an operator can act on: the
|
|
104
123
|
* message, the error code, and the scope the endpoint said it needed
|