@mnemom/mnemom 0.17.25 → 0.17.27
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-config.js +9 -0
- package/dist/commands/agent-doctor.d.ts +3 -2
- package/dist/commands/agent-doctor.js +25 -9
- package/dist/commands/agent-goal.js +7 -2
- package/dist/commands/agent-sessions.js +2 -1
- package/dist/commands/agent-setup.d.ts +166 -9
- package/dist/commands/agent-setup.js +719 -54
- package/dist/commands/agent-slack.d.ts +4 -0
- package/dist/commands/agent-slack.js +67 -21
- package/dist/commands/agent.d.ts +29 -1
- package/dist/commands/agent.js +133 -17
- package/dist/commands/wrap.d.ts +2 -0
- package/dist/commands/wrap.js +13 -1
- package/dist/index.js +19 -5
- package/dist/lib/agent-identity-route.d.ts +21 -3
- package/dist/lib/agent-identity-route.js +42 -15
- package/dist/lib/agent-ledger.d.ts +5 -0
- package/dist/lib/agent.d.ts +75 -8
- package/dist/lib/agent.js +83 -14
- package/dist/lib/api.d.ts +33 -1
- package/dist/lib/api.js +10 -0
- package/dist/lib/experimental.js +14 -2
- package/dist/lib/goal-api.d.ts +3 -3
- package/dist/lib/goal-api.js +5 -2
- package/dist/lib/launcher-config.d.ts +18 -0
- package/dist/lib/launcher-config.js +47 -1
- package/dist/lib/model-tier.d.ts +75 -0
- package/dist/lib/model-tier.js +166 -0
- package/dist/lib/oauth.d.ts +7 -0
- package/dist/lib/oauth.js +92 -17
- package/dist/lib/served-agent-cache.d.ts +8 -1
- package/dist/lib/served-agent-cache.js +11 -2
- package/dist/lib/slack-channel.d.ts +1 -0
- package/dist/lib/slack-channel.js +30 -12
- package/dist/lib/slack-route.d.ts +72 -9
- package/dist/lib/slack-route.js +113 -24
- package/dist/lib/slack-router.d.ts +37 -2
- package/dist/lib/slack-router.js +98 -13
- package/dist/lib/slack-state.d.ts +105 -4
- package/dist/lib/slack-state.js +230 -11
- package/dist/lib/subscription-login.d.ts +12 -3
- package/dist/lib/subscription-login.js +19 -7
- package/dist/mcp/handoff-server.mjs +31 -3
- package/dist/rc-proxy.mjs +14 -0
- package/package.json +1 -1
|
@@ -175,6 +175,9 @@ function deleteKey(cfg, key) {
|
|
|
175
175
|
case "agent":
|
|
176
176
|
delete cfg.agent;
|
|
177
177
|
break;
|
|
178
|
+
case "agent_id":
|
|
179
|
+
delete cfg.agentId;
|
|
180
|
+
break;
|
|
178
181
|
case "effort":
|
|
179
182
|
delete cfg.effort;
|
|
180
183
|
break;
|
|
@@ -217,6 +220,12 @@ function deleteKey(cfg, key) {
|
|
|
217
220
|
case "slack_allow":
|
|
218
221
|
delete cfg.slackAllow;
|
|
219
222
|
break;
|
|
223
|
+
case "slack_aliases":
|
|
224
|
+
delete cfg.slackAliases;
|
|
225
|
+
break;
|
|
226
|
+
case "slack_sticky_threads":
|
|
227
|
+
delete cfg.slackStickyThreads;
|
|
228
|
+
break;
|
|
220
229
|
default:
|
|
221
230
|
requireSpec(key); // throws the known-keys message for anything unknown
|
|
222
231
|
}
|
|
@@ -43,8 +43,9 @@ export interface GovernanceProbe {
|
|
|
43
43
|
* The governance line: the composed (every layer, strictest wins) integrity and
|
|
44
44
|
* Safe House modes of the agent a launch would use. Signed out, no such agent,
|
|
45
45
|
* or an unreadable card → info with the off-by-default note, never a MISS
|
|
46
|
-
* (governance never blocks a launch). On → info naming the per-turn cost;
|
|
47
|
-
* agent's own card
|
|
46
|
+
* (governance never blocks a launch). On → info naming the per-turn cost; a
|
|
47
|
+
* stricter layer outranks the agent's own card (any rung up the ladder off <
|
|
48
|
+
* observe < nudge < enforce, MNE-8612) → warn naming the layer.
|
|
48
49
|
*/
|
|
49
50
|
export declare function probeGovernance(agent: string | undefined): Promise<GovernanceProbe>;
|
|
50
51
|
export {};
|
|
@@ -24,7 +24,7 @@ import { isLoggedIn } from "../lib/auth.js";
|
|
|
24
24
|
import { getActiveOrg } from "../lib/cli-config.js";
|
|
25
25
|
import { isCodeNotEnabled, REQUEST_ACCESS_URL, sanitizeTerminalText, sourceLabel, withRequestAccess, } from "./agent-invite.js";
|
|
26
26
|
import { probeUpdateStatus } from "../lib/update/doctor.js";
|
|
27
|
-
import { describeModes, GOVERNANCE_OPT_IN_HINT, resolveDefaultSlug } from "./agent-setup.js";
|
|
27
|
+
import { describeModes, GOVERNANCE_OPT_IN_HINT, layersSettingMode, outranksAgentCard, resolveDefaultSlug, } from "./agent-setup.js";
|
|
28
28
|
const MARK = { ok: "[ ok ]", warn: "[warn]", miss: "[MISS]", info: "[info]" };
|
|
29
29
|
const out = (line = "") => console.log(line);
|
|
30
30
|
/** Run the preflight and print the checklist. Sets process.exitCode on failure. */
|
|
@@ -71,16 +71,17 @@ export async function agentDoctorCommand(options = {}) {
|
|
|
71
71
|
else
|
|
72
72
|
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");
|
|
73
73
|
}
|
|
74
|
-
// ── one cell: the launch door must be the CLI's own cell ──
|
|
74
|
+
// ── one cell: the launch door and the gateway host must be the CLI's own cell ──
|
|
75
|
+
const host = resolveGatewayHost(env);
|
|
75
76
|
const cellError = singleCellError({
|
|
76
77
|
door: resolveAnthropicDoor(env),
|
|
78
|
+
gateway: host,
|
|
77
79
|
apiUrl: getApiUrl(),
|
|
78
80
|
cellGateway: getGatewayUrl(),
|
|
79
81
|
});
|
|
80
82
|
if (cellError)
|
|
81
83
|
add("miss", "cell: mixed — a launch would be refused", cellError);
|
|
82
84
|
// ── gateway health ──
|
|
83
|
-
const host = resolveGatewayHost(env);
|
|
84
85
|
const cell = isProdGateway(env) ? "us-2/prod" : "custom";
|
|
85
86
|
const health = await probeGateway(host);
|
|
86
87
|
if (health.ok && health.verdictHeader) {
|
|
@@ -232,8 +233,9 @@ const OPT_IN_HINT = GOVERNANCE_OPT_IN_HINT.trim();
|
|
|
232
233
|
* The governance line: the composed (every layer, strictest wins) integrity and
|
|
233
234
|
* Safe House modes of the agent a launch would use. Signed out, no such agent,
|
|
234
235
|
* or an unreadable card → info with the off-by-default note, never a MISS
|
|
235
|
-
* (governance never blocks a launch). On → info naming the per-turn cost;
|
|
236
|
-
* agent's own card
|
|
236
|
+
* (governance never blocks a launch). On → info naming the per-turn cost; a
|
|
237
|
+
* stricter layer outranks the agent's own card (any rung up the ladder off <
|
|
238
|
+
* observe < nudge < enforce, MNE-8612) → warn naming the layer.
|
|
237
239
|
*/
|
|
238
240
|
export async function probeGovernance(agent) {
|
|
239
241
|
const offByDefault = {
|
|
@@ -268,13 +270,27 @@ export async function probeGovernance(agent) {
|
|
|
268
270
|
protection: read(prot, "agent", "mode"),
|
|
269
271
|
};
|
|
270
272
|
const text = `governance: ${slug} — ${describeModes(composed)}`;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
// A stricter layer outranks the agent's own card on the ladder off < observe <
|
|
274
|
+
// nudge < enforce: name the feature, the mode that runs, and the layer that set it,
|
|
275
|
+
// and point only at the show command for a feature that was outranked.
|
|
276
|
+
const raised = [];
|
|
277
|
+
const shows = [];
|
|
278
|
+
const raise = (feature, mine, eff, sources, field, platformIsFloor, show) => {
|
|
279
|
+
if (!outranksAgentCard(mine, eff))
|
|
280
|
+
return;
|
|
281
|
+
const layers = layersSettingMode(sources, field, eff, { platform: platformIsFloor });
|
|
282
|
+
const from = layers.length > 0 ? ` from ${layers.join(" and ")}` : "";
|
|
283
|
+
raised.push(`${feature} ${eff}${from} (agent card: ${mine})`);
|
|
284
|
+
shows.push(show);
|
|
285
|
+
};
|
|
286
|
+
raise("integrity", own.integrity, composed.integrity, align, "integrity_mode", false, "`mnemom card show` prints the composed alignment card (integrity_mode).");
|
|
287
|
+
raise("Safe House", own.protection, composed.protection, prot, "mode", true, "`mnemom protection show` prints the composed Safe House card.");
|
|
288
|
+
if (raised.length > 0) {
|
|
274
289
|
return {
|
|
275
290
|
mark: "warn",
|
|
276
291
|
text,
|
|
277
|
-
hint:
|
|
292
|
+
hint: `a stricter org, team or platform policy outranks the agent's own card: ${raised.join(", ")}. ` +
|
|
293
|
+
`The stricter mode is the one that runs and is billed. Change it at that layer. ${shows.join(" ")}`,
|
|
278
294
|
};
|
|
279
295
|
}
|
|
280
296
|
if (composed.integrity === "off" && composed.protection === "off") {
|
|
@@ -27,9 +27,14 @@ import { localGoalFlag, resolveSessionRef } from "./agent-sessions.js";
|
|
|
27
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 { resolveAnthropicKey } = await import("./agent.js");
|
|
30
|
+
const { defaultMnemomKeyDeps, resolveAnthropicKey } = await import("./agent.js");
|
|
31
|
+
const { readMnemomKey } = await import("../lib/subscription-login.js");
|
|
31
32
|
try {
|
|
32
|
-
|
|
33
|
+
const anthropicKey = await resolveAnthropicKey(process.env, { allowPrompt: false });
|
|
34
|
+
// The Mnemom key the launch sent beside it (env, else the store; never minted here) — a
|
|
35
|
+
// pinned session's control calls need it, and every call is then asked as the launch was.
|
|
36
|
+
const mnemomKey = readMnemomKey(defaultMnemomKeyDeps());
|
|
37
|
+
return mnemomKey ? { anthropicKey, mnemomKey } : { anthropicKey };
|
|
33
38
|
}
|
|
34
39
|
catch {
|
|
35
40
|
throw new Error("no Anthropic key in env (MNEMOM_AGENT_ANTHROPIC_KEY / ANTHROPIC_API_KEY) or ~/.mnemom/launcher.json — " +
|
|
@@ -329,7 +329,8 @@ export function buildShowView(local, remote, reason) {
|
|
|
329
329
|
if (local.cc_session_id && local.launch_shape !== "server") {
|
|
330
330
|
L.push(fmt.label("resume: ", resumeCommand({
|
|
331
331
|
scenario: local.session,
|
|
332
|
-
|
|
332
|
+
// A pinned launch resumes pinned (its served id), never by a name that could birth.
|
|
333
|
+
agent: local.agent_pinned && local.agent_id ? local.agent_id : local.agent_slug,
|
|
333
334
|
ccSessionId: local.cc_session_id,
|
|
334
335
|
})));
|
|
335
336
|
}
|
|
@@ -11,11 +11,15 @@
|
|
|
11
11
|
* on); governance that costs none stays ON (operator 2026-10-03: autonomy is
|
|
12
12
|
* rules-only verification + policy). The goal contract is what nudges (re-anchor
|
|
13
13
|
* on drift). Specifically:
|
|
14
|
-
* - alignment card: autonomy_mode = observe, integrity_mode = off,
|
|
15
|
-
* principal
|
|
16
|
-
* actions,
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* - alignment card: autonomy_mode = observe, integrity_mode = off, the agent's
|
|
15
|
+
* org as principal (delegated_authority), Claude Code tool names as bounded
|
|
16
|
+
* actions, coding forbidden actions, defined values, grace 0, and no default
|
|
17
|
+
* escalation trigger for irreversible operations (the customer adds their own);
|
|
18
|
+
* - protection card: mode = off, thresholds 0.60/0.80/0.95, all four
|
|
19
|
+
* screen_surfaces and a credential-store protected_surface declared, ready for
|
|
20
|
+
* when it is turned on.
|
|
21
|
+
* Both carry content_version (CODE_CARD_CONTENT_VERSION); a refresh upgrades an
|
|
22
|
+
* older default's content and keeps the agent's modes.
|
|
19
23
|
* - goal-alignment: nudge — sealed per-conversation via the goal contract
|
|
20
24
|
* (--goal …), graded and re-anchored by the gateway.
|
|
21
25
|
* `--governance [integrity,safe-house]` opts a setup in (observe-only, billed at
|
|
@@ -31,7 +35,7 @@
|
|
|
31
35
|
* (agents.ts), claimAgent + putAlignmentCard/putProtectionCard (lib/api.ts) — rather than
|
|
32
36
|
* reinventing it.
|
|
33
37
|
*/
|
|
34
|
-
import { type CodeEntitlement } from "../lib/api.js";
|
|
38
|
+
import { type CardSources, type CodeEntitlement } from "../lib/api.js";
|
|
35
39
|
/** A card's governance mode as the CLI writes it: off, or observe-only. */
|
|
36
40
|
export type GovernanceMode = "off" | "observe";
|
|
37
41
|
/**
|
|
@@ -80,11 +84,62 @@ export interface CardModes {
|
|
|
80
84
|
}
|
|
81
85
|
/** One phrase for the posture line: "integrity off, Safe House off". */
|
|
82
86
|
export declare function describeModes(m: Pick<CardModes, "integrity" | "protection">): string;
|
|
87
|
+
/**
|
|
88
|
+
* The governance mode ladder, weakest first. The same order mnemom-api composes
|
|
89
|
+
* on (compose.ts ALIGNMENT_MODE_ORDER and PROTECTION_MODE_ORDER): strictest wins.
|
|
90
|
+
*/
|
|
91
|
+
export declare const MODE_LADDER: readonly ["off", "observe", "nudge", "enforce"];
|
|
92
|
+
/** A mode's rung on MODE_LADDER, or -1 when it is not on the ladder (absent, "unknown"). */
|
|
93
|
+
export declare function modeRank(mode: string | undefined): number;
|
|
94
|
+
/**
|
|
95
|
+
* True when the composed mode sits on a higher rung than the agent's own card, so a
|
|
96
|
+
* stricter layer decides the mode that runs. An agent card that sets no mode, or a
|
|
97
|
+
* composed mode that is not on the ladder, is never an outrank.
|
|
98
|
+
*/
|
|
99
|
+
export declare function outranksAgentCard(own: string | undefined, effective: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The upstream layers of a sources envelope whose own card sets `field` to `mode`,
|
|
102
|
+
* named for a person (`team "Lane Leads"`, `org "Acme"`, `platform`), in cascade
|
|
103
|
+
* order. Those are the layers that put the composed mode where it is. `platform`
|
|
104
|
+
* is asked for only where the platform card is a floor (protection mode); for
|
|
105
|
+
* integrity_mode it is only a default, so it never outranks an agent card that
|
|
106
|
+
* sets one. Empty when no layer row matches (an older api without the rows, or a
|
|
107
|
+
* composed card older than a template edit).
|
|
108
|
+
*/
|
|
109
|
+
export declare function layersSettingMode(sources: CardSources | null, field: string, mode: string, opts: {
|
|
110
|
+
platform: boolean;
|
|
111
|
+
}): string[];
|
|
112
|
+
/**
|
|
113
|
+
* The composed Safe House (protection) mode for the launch summary, naming the
|
|
114
|
+
* layer that set it when the agent's own card says something else:
|
|
115
|
+
* `enforce (from team "Lane Leads"; agent card: observe)`. Same mode as the
|
|
116
|
+
* agent card prints the mode alone. No composed card reads `unknown`.
|
|
117
|
+
*/
|
|
118
|
+
export declare function describeComposedProtection(sources: CardSources | null): string;
|
|
119
|
+
/**
|
|
120
|
+
* How long the launch waits for the protection card sources before printing the
|
|
121
|
+
* line without them. An object so tests can shorten it, like TWIN_LISTING.
|
|
122
|
+
*/
|
|
123
|
+
export declare const PROTECTION_READ: {
|
|
124
|
+
timeoutMs: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* The launch summary's protection phrase for `agentId`: one `getCardSources`
|
|
128
|
+
* read (`GET /v1/protection/agent/:id?include=sources`, the same read the doctor
|
|
129
|
+
* makes), which carries both the composed card and every layer's own card. Best
|
|
130
|
+
* effort: it never throws, so the caller can start it early and await it later,
|
|
131
|
+
* and a failed or slow read prints `unknown` rather than holding up the launch.
|
|
132
|
+
*/
|
|
133
|
+
export declare function readComposedProtection(agentId: string): Promise<string>;
|
|
83
134
|
/**
|
|
84
135
|
* The modes for a NEW agent: autonomy observe (rules only, no model call) unless
|
|
85
136
|
* --no-governance; integrity and Safe House off unless --governance asks for them.
|
|
86
137
|
*/
|
|
87
138
|
export declare function newAgentModes(governance?: GovernanceOptIn): CardModes;
|
|
139
|
+
interface ExistingCards {
|
|
140
|
+
align: Record<string, unknown> | null;
|
|
141
|
+
prot: Record<string, unknown> | null;
|
|
142
|
+
}
|
|
88
143
|
/** Printed when a setup ran without --governance: how to opt in, and what it costs. */
|
|
89
144
|
export declare const GOVERNANCE_OPT_IN_HINT: string;
|
|
90
145
|
/**
|
|
@@ -122,8 +177,18 @@ export interface ClaimedAgentOptions {
|
|
|
122
177
|
slug: string;
|
|
123
178
|
/** Anthropic-key launch: the key that anchors the gateway identity. Never logged. */
|
|
124
179
|
anthropicKey?: string;
|
|
125
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* The Mnemom API key: on a subscription launch it anchors the gateway identity; on an api-key
|
|
182
|
+
* launch (beside `anthropicKey`) it rides along as the key principal, and the identity stays
|
|
183
|
+
* hash(Anthropic key, name). Required with `pin`. Never logged.
|
|
184
|
+
*/
|
|
126
185
|
mnemomKey?: string;
|
|
186
|
+
/**
|
|
187
|
+
* The agent id this launch pins (`--agent mnm-<uuid>` / launcher.toml `agent_id`). The gateway
|
|
188
|
+
* must serve exactly this agent (identity route `resolved_by: "pin"`) or the launch refuses;
|
|
189
|
+
* a pinned launch never claims and never births.
|
|
190
|
+
*/
|
|
191
|
+
pin?: string;
|
|
127
192
|
/** Gateway host the launch targets (the probe goes to the same cell). */
|
|
128
193
|
gatewayHost: string;
|
|
129
194
|
/**
|
|
@@ -156,6 +221,11 @@ export interface ClaimedAgentResult {
|
|
|
156
221
|
agentId: string;
|
|
157
222
|
/** true only when this call claimed it. */
|
|
158
223
|
claimedNow: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* The gateway rejected the Mnemom key an api-key launch offered alongside its Anthropic key;
|
|
226
|
+
* the agent was confirmed without it, and the launch must not send it either.
|
|
227
|
+
*/
|
|
228
|
+
mnemomKeyRejected?: boolean;
|
|
159
229
|
}
|
|
160
230
|
/**
|
|
161
231
|
* A failure worth retrying, and that an outage fallback may cover: no answer at all (network,
|
|
@@ -183,17 +253,76 @@ export declare function isTransient(err: unknown): boolean;
|
|
|
183
253
|
* Interactive and non-interactive runs behave the same: there is no prompt to decline.
|
|
184
254
|
* MNE-7650: the name is client-controlled, so a same-named org agent proves nothing — only the
|
|
185
255
|
* served id counts.
|
|
256
|
+
*
|
|
257
|
+
* A PINNED launch (`opts.pin`, from `--agent mnm-<uuid>` / launcher.toml `agent_id`) takes a
|
|
258
|
+
* separate path (ensurePinnedAgent): the gateway must serve exactly the pin, and it never claims.
|
|
259
|
+
*
|
|
260
|
+
* An api-key launch that also carries a Mnemom key (`opts.mnemomKey` beside `opts.anthropicKey`)
|
|
261
|
+
* asks the probe with it too, so the answer is the one its requests will get. If the gateway
|
|
262
|
+
* rejects that key, the launch continues without it (result.mnemomKeyRejected) rather than fail.
|
|
186
263
|
*/
|
|
187
264
|
export declare function ensureClaimedServedAgent(opts: ClaimedAgentOptions): Promise<ClaimedAgentResult>;
|
|
265
|
+
/**
|
|
266
|
+
* How long the anti-twin listing may take before it is treated as failed (best effort). An
|
|
267
|
+
* object so tests can shorten it, like CONFIRM_RETRY_DELAYS_MS.
|
|
268
|
+
*/
|
|
269
|
+
export declare const TWIN_LISTING: {
|
|
270
|
+
timeoutMs: number;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* The ids of the caller's OTHER live, claimed agents named `slug` in `orgId` — the same set the
|
|
274
|
+
* gateway's principal resolution picks from (claimed_by = the caller). Reads the caller's own
|
|
275
|
+
* agents (`GET /v1/agents?scope=all`), then each same-named one's full record for its claim and
|
|
276
|
+
* org; a tombstoned one (404) is skipped. Throws when the listing can't be completed in
|
|
277
|
+
* TWIN_LISTING.timeoutMs — every caller treats that as "unknown", never as "none".
|
|
278
|
+
*/
|
|
279
|
+
export declare function claimedSameNamedAgents(slug: string, excludeId: string, orgId: string): Promise<string[]>;
|
|
280
|
+
/** The refusal when an unclaimed served agent would become a same-named twin. */
|
|
281
|
+
export declare function twinRefusal(slug: string, servedId: string, twins: readonly string[], orgLabel: string): string;
|
|
282
|
+
/**
|
|
283
|
+
* Resolve a pin before launch: the agent must be visible to the caller (the org-member view) and
|
|
284
|
+
* claimed; its name becomes the launch's slug (`x-mnemom-agent`, which the gateway checks against
|
|
285
|
+
* the pin). Any failure refuses — a pinned launch never falls back to a name.
|
|
286
|
+
*/
|
|
287
|
+
export declare function resolvePinnedAgent(id: string): Promise<{
|
|
288
|
+
id: string;
|
|
289
|
+
slug: string;
|
|
290
|
+
}>;
|
|
188
291
|
/**
|
|
189
292
|
* One line for an api failure that keeps the parts an operator can act on: the
|
|
190
293
|
* message, the error code, and the scope the endpoint said it needed
|
|
191
294
|
* (`details.required_scope`). Never the token, never the body.
|
|
192
295
|
*/
|
|
193
296
|
export declare function describeApiError(err: unknown): string;
|
|
194
|
-
/**
|
|
297
|
+
/**
|
|
298
|
+
* Options for publishDefaultCards: `orgId` is the principal for a card that gets the
|
|
299
|
+
* default content (the agent's own org, else the launch's); `ownOrg` is the agent's own
|
|
300
|
+
* org when it could be read (agentOrgId), which a kept card's principal follows.
|
|
301
|
+
*/
|
|
302
|
+
interface PublishOpts {
|
|
303
|
+
orgId?: string;
|
|
304
|
+
ownOrg?: string;
|
|
305
|
+
existing?: ExistingCards;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The principal a kept (already-current) card is published with. An organization
|
|
309
|
+
* principal follows the agent's CURRENT org: a re-claim into another org moves it, and
|
|
310
|
+
* a stale one would be carried forward verbatim on every refresh otherwise (the keep
|
|
311
|
+
* branch is the steady state once a card is at this version). Any other declared
|
|
312
|
+
* principal is the customer's and is kept. No principal (a gateway birth whose org the
|
|
313
|
+
* api didn't know) gets the org principal: a published card must declare one. When
|
|
314
|
+
* the agent's org could not be read, the declared principal is kept as it is (never
|
|
315
|
+
* replaced by the launch org, which may not be the agent's).
|
|
316
|
+
*/
|
|
317
|
+
export declare function keptPrincipal(own: unknown, opts: Pick<PublishOpts, "orgId" | "ownOrg">): Record<string, unknown>;
|
|
318
|
+
/**
|
|
319
|
+
* `mnemom agent setup [--agent <slug|mnm-id>] [--governance …]` — the explicit provisioning entry
|
|
320
|
+
* point. An id (`--agent mnm-<uuid>`, or launcher.toml `agent_id`) refreshes that pinned agent's
|
|
321
|
+
* cards and never claims or births; a malformed `mnm-…` refuses.
|
|
322
|
+
*/
|
|
195
323
|
export declare function agentSetupCommand(opts?: {
|
|
196
324
|
agent?: string;
|
|
325
|
+
agentId?: string;
|
|
197
326
|
governance?: GovernanceOptIn;
|
|
198
327
|
}): Promise<void>;
|
|
199
328
|
/** Thrown when the agent's org has no spendable MU balance. The user-facing
|
|
@@ -256,5 +385,33 @@ export declare function resolvePreflightedAccount(): Promise<{
|
|
|
256
385
|
orgLabel: string;
|
|
257
386
|
entitlement: CodeEntitlement | null;
|
|
258
387
|
}>;
|
|
259
|
-
|
|
388
|
+
/**
|
|
389
|
+
* Which default the two cards carry, stamped top-level on both. Semver within the
|
|
390
|
+
* `mnemom-agent-default/` lineage: a refresh upgrades a card whose content_version is
|
|
391
|
+
* absent or older, and leaves one at this version or newer as it is. Bump it whenever
|
|
392
|
+
* the content below changes. (`card_version` is the schema date, not this.)
|
|
393
|
+
*/
|
|
394
|
+
export declare const CODE_CARD_CONTENT_VERSION = "mnemom-agent-default/2.1.0";
|
|
395
|
+
/**
|
|
396
|
+
* Whether a refresh should replace this card's content with the current default: true when
|
|
397
|
+
* it carries no content_version, or an older (or unparseable) `mnemom-agent-default/` one.
|
|
398
|
+
* A card at this version or newer is kept, and so is one stamped by another lineage (its
|
|
399
|
+
* author versions their own content).
|
|
400
|
+
*/
|
|
401
|
+
export declare function needsContentUpgrade(card: Record<string, unknown>): boolean;
|
|
402
|
+
/** The alignment card's principal: who the agent acts for. */
|
|
403
|
+
export interface CardPrincipal {
|
|
404
|
+
type: "organization" | "unspecified";
|
|
405
|
+
identifier?: string;
|
|
406
|
+
relationship: "delegated_authority";
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* The principal for a default card: the org the agent belongs to, else `unspecified`
|
|
410
|
+
* (never a typed principal with an empty identifier: the API rejects that). Never the
|
|
411
|
+
* launching user's id: the public A2A card copies the principal, and the identifier
|
|
412
|
+
* takes a role or org, not personal data. The agent is never its own principal.
|
|
413
|
+
*/
|
|
414
|
+
export declare function orgPrincipal(orgId?: string | null): CardPrincipal;
|
|
415
|
+
export declare function buildCodeAlignmentCard(agentId: string, modes?: Pick<CardModes, "autonomy" | "integrity" | "allowUnmappedTools">, principal?: CardPrincipal): Record<string, unknown>;
|
|
260
416
|
export declare function buildCodeProtectionCard(agentId: string, mode?: string): Record<string, unknown>;
|
|
417
|
+
export {};
|