@sema-agent/core 7.71.1 → 7.72.0
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/CHANGELOG.md +181 -0
- package/dist/agents/cross-session-ref.d.ts +2 -2
- package/dist/agents/cross-session-ref.js +7 -2
- package/dist/agents/inherited-tool-pool.d.ts +4 -1
- package/dist/agents/inherited-tool-pool.js +7 -5
- package/dist/agents/send-message-tool.js +6 -2
- package/dist/agents/subagent.js +5 -1
- package/dist/agents/verify.js +1 -0
- package/dist/core/a2a.d.ts +24 -3
- package/dist/core/a2a.js +27 -8
- package/dist/core/agent-state.d.ts +28 -7
- package/dist/core/agent-state.js +19 -6
- package/dist/core/approval-object.d.ts +7 -3
- package/dist/core/approval-object.js +30 -9
- package/dist/core/checkpoint-features.d.ts +13 -3
- package/dist/core/checkpoint-features.js +34 -5
- package/dist/core/checkpoint-row-verdict.d.ts +1 -1
- package/dist/core/checkpoint-row-verdict.js +3 -3
- package/dist/core/effective-path-target.d.ts +19 -0
- package/dist/core/effective-path-target.js +95 -38
- package/dist/core/engine-notice.d.ts +4 -1
- package/dist/core/engine-version.js +1 -1
- package/dist/core/file-history-store.d.ts +15 -4
- package/dist/core/file-history-store.js +53 -23
- package/dist/core/gate-fold.js +3 -1
- package/dist/core/governance-codes.d.ts +4 -1
- package/dist/core/governance-codes.js +4 -0
- package/dist/core/judged-read.d.ts +57 -0
- package/dist/core/judged-read.js +1 -0
- package/dist/core/mcp-host-seat.d.ts +5 -0
- package/dist/core/mcp-host-seat.js +7 -1
- package/dist/core/mcp.js +3 -1
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layout.js +6 -4
- package/dist/core/memory-engine/scope-contract.d.ts +59 -6
- package/dist/core/memory-engine/scope-contract.js +90 -25
- package/dist/core/mounted-mcp.d.ts +7 -2
- package/dist/core/mounted-mcp.js +10 -1
- package/dist/core/param-rule-reach.d.ts +8 -3
- package/dist/core/param-rule-reach.js +9 -1
- package/dist/core/parent-spec-seat.d.ts +11 -1
- package/dist/core/parent-spec-seat.js +14 -0
- package/dist/core/peer-registration.d.ts +52 -0
- package/dist/core/peer-registration.js +37 -0
- package/dist/core/peer-seat.d.ts +3 -1
- package/dist/core/permission-rule-model.js +1 -1
- package/dist/core/runner/chain-mismatch.d.ts +32 -0
- package/dist/core/runner/chain-mismatch.js +29 -0
- package/dist/core/runner/changes-history.d.ts +1 -0
- package/dist/core/runner/changes-history.js +2 -2
- package/dist/core/runner/contracts.d.ts +3 -0
- package/dist/core/runner/file-history-restore.d.ts +3 -1
- package/dist/core/runner/file-history-restore.js +9 -6
- package/dist/core/runner/loaded-skills.d.ts +2 -0
- package/dist/core/runner/loaded-skills.js +10 -0
- package/dist/core/runner/person-path-rows.d.ts +2 -4
- package/dist/core/runner/person-path-rows.js +2 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +7 -2
- package/dist/core/runner/prepare-file-history.js +1 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -0
- package/dist/core/runner/prepare-hands-readface.js +24 -21
- package/dist/core/runner/prepare-inherited-gate.d.ts +2 -2
- package/dist/core/runner/prepare-inherited-gate.js +1 -1
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -2
- package/dist/core/runner/prepare-memory-engine-session.js +2 -2
- package/dist/core/runner/prepare-memory.js +3 -15
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +3 -7
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -0
- package/dist/core/runner/prepare-protocol-tools.js +2 -2
- package/dist/core/runner/prepare-task.js +20 -16
- package/dist/core/runner/prepare-wiring-manifest.d.ts +2 -0
- package/dist/core/runner/prepare-wiring-manifest.js +4 -3
- package/dist/core/runner/read-session-changes.js +1 -1
- package/dist/core/runner/resume-checkpoint-screen.d.ts +8 -7
- package/dist/core/runner/resume-checkpoint-screen.js +7 -6
- package/dist/core/runner/rewind-files.js +3 -2
- package/dist/core/runner/run-leg.js +6 -2
- package/dist/core/runner/terminal-account.d.ts +4 -0
- package/dist/core/runner/terminal-account.js +7 -2
- package/dist/core/runner/tool-face-overlay.d.ts +2 -11
- package/dist/core/runner/tool-face-overlay.js +39 -0
- package/dist/core/runner/trim-stretch.js +7 -2
- package/dist/core/scheduler.d.ts +47 -7
- package/dist/core/scheduler.js +19 -7
- package/dist/core/secret-env.d.ts +7 -0
- package/dist/core/secret-env.js +1 -1
- package/dist/core/sensitive-path-policy.js +14 -7
- package/dist/core/shell-read-silence.js +1 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +7 -0
- package/dist/core/task-event.d.ts +4 -3
- package/dist/core/task-notification.d.ts +2 -1
- package/dist/core/task-spec.d.ts +13 -5
- package/dist/core/tool-catalog-entries.js +2 -0
- package/dist/core/tool-face-reader.js +1 -1
- package/dist/core/tool-face.d.ts +7 -0
- package/dist/core/tool-face.js +1 -0
- package/dist/core/tool-mount-facts.d.ts +4 -2
- package/dist/core/tool-mount-facts.js +3 -3
- package/dist/core/tool-mount-plan.d.ts +4 -2
- package/dist/core/tool-mount-plan.js +5 -5
- package/dist/core/tool-mount-static.d.ts +1 -1
- package/dist/core/tool-mount-static.js +25 -13
- package/dist/core/tool-registry.d.ts +33 -1
- package/dist/core/tool-registry.js +33 -0
- package/dist/core/tool-roster.d.ts +16 -0
- package/dist/core/tool-roster.js +6 -0
- package/dist/core/tool-spec.d.ts +4 -2
- package/dist/core/tools.d.ts +6 -0
- package/dist/core/tools.js +1 -1
- package/dist/core/wiring-manifest.d.ts +66 -12
- package/dist/core/wiring-manifest.js +37 -1
- package/dist/engine/harness/messages.d.ts +1 -1
- package/dist/engine/harness/messages.js +2 -1
- package/dist/engine/loop/types.d.ts +2 -0
- package/dist/engine/session/session.js +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.js +7 -4
- package/dist/orchestration/workflow.js +2 -1
- package/dist/stores/file/adoption/marker.d.ts +2 -27
- package/dist/stores/file/adoption/marker.js +12 -0
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +1 -1
- package/dist/tools/artifact/artifact-tool.js +11 -6
- package/dist/tools/fs/file-read-check.d.ts +45 -11
- package/dist/tools/fs/file-read-check.js +200 -57
- package/dist/tools/fs/judged-reads.d.ts +51 -0
- package/dist/tools/fs/judged-reads.js +68 -0
- package/dist/tools/fs/safety.d.ts +8 -0
- package/dist/tools/fs/safety.js +12 -1
- package/dist/tools/fs/shell-read-check.d.ts +16 -3
- package/dist/tools/fs/shell-read-check.js +4 -1
- package/dist/tools/fs/shell-read-establish.js +13 -3
- package/dist/tools/scheduler-store-move.d.ts +74 -0
- package/dist/tools/scheduler-store-move.js +103 -0
- package/dist/tools/scheduler-tools.d.ts +43 -29
- package/dist/tools/scheduler-tools.js +161 -118
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +43 -3
- package/wire-changes/answers/core-stores-sql@7.72.0.json +12 -0
- package/wire-changes/answers/core@7.72.0.json +84 -0
- package/wire-changes/answers/mods-kernel@7.72.0.json +7 -0
- package/wire-changes/answers/primitives@7.72.0.json +6 -0
- package/wire-changes/answers/wiki-gate@7.72.0.json +7 -0
- package/wire-changes/core-stores-sql@7.72.0.json +215 -0
- package/wire-changes/core@7.72.0.json +2426 -0
- package/wire-changes/mods-kernel@7.72.0.json +147 -0
- package/wire-changes/primitives@7.72.0.json +143 -0
- package/wire-changes/wiki-gate@7.72.0.json +145 -0
|
@@ -24,6 +24,8 @@ import { seatsReachEnv } from "./mods/kernel/registration.js";
|
|
|
24
24
|
import { legWriteProtectionTable } from "./runner/write-protection-station.js";
|
|
25
25
|
import { readSkillsSeat } from "./runner/skills-seat.js";
|
|
26
26
|
import { skillsThatLoad } from "./runner/synthetic-tools.js";
|
|
27
|
+
import { loadedSkills } from "./runner/loaded-skills.js";
|
|
28
|
+
import { readCallerSpec } from "./task-spec-members.js";
|
|
27
29
|
import { screenUserAttachments, userAttachmentsNeedWorkspace } from "./user-attachment.js";
|
|
28
30
|
import { workspaceDeclared } from "./session-checkout.js";
|
|
29
31
|
import { writesProtectedPath } from "./tool-registry.js";
|
|
@@ -117,7 +119,8 @@ function protocolReading(preflight, leavesPeer) {
|
|
|
117
119
|
if (!leavesPeer(prefix))
|
|
118
120
|
continue;
|
|
119
121
|
const writesPath = Object.entries(s.toolFaces ?? {}).some(([tool, face]) => writesProtectedPath([`${prefix}${tool}`], face.pathTarget));
|
|
120
|
-
|
|
122
|
+
const readsPath = Object.values(s.toolFaces ?? {}).some((face) => face.pathTarget?.access === "read");
|
|
123
|
+
families.push({ family: { source: "mcp", peer: s.name, state: "conditional", when: ["listing.mcp"] }, writesPath, ...(readsPath ? { readsPath } : {}) });
|
|
121
124
|
}
|
|
122
125
|
for (const p of preflight?.a2a ?? [])
|
|
123
126
|
if (leavesPeer(mintNamespacePrefix(A2A_NAMESPACE, p.name)))
|
|
@@ -166,7 +169,11 @@ export function readLegExecutionEnv(input) {
|
|
|
166
169
|
mods: word.mods,
|
|
167
170
|
});
|
|
168
171
|
}
|
|
169
|
-
export function planStaticToolMounts(deps,
|
|
172
|
+
export function planStaticToolMounts(deps, handed, statement = {}) {
|
|
173
|
+
const read = readCallerSpec(handed);
|
|
174
|
+
if (read.refusal !== undefined)
|
|
175
|
+
throw read.refusal;
|
|
176
|
+
const spec = read.spec;
|
|
170
177
|
const mode = refusePermissionModeDoors(spec) ?? "default";
|
|
171
178
|
const moded = withModeSeats(spec, mode);
|
|
172
179
|
checkedPlanFileShape(spec.planFile);
|
|
@@ -195,18 +202,12 @@ export function planStaticToolMounts(deps, spec, statement = {}) {
|
|
|
195
202
|
state(envFacts(deps));
|
|
196
203
|
state(legFacts(deps, spec));
|
|
197
204
|
state(seatFacts(deps, spec, leaves({ name: OFFLOAD_TOOL_NAME })));
|
|
198
|
-
state({ "spec.planFile": spec.planFile !== undefined
|
|
205
|
+
state({ "spec.planFile": spec.planFile !== undefined });
|
|
199
206
|
const declared = (name, viaAlias) => anyOf(entries.filter((e) => e.face.name === name || (viaAlias && e.face.aliases?.includes(name) === true)).map((e) => e.kept));
|
|
200
207
|
const backgroundAgents = anyOf(entries.filter((e) => delegationHasBackgroundLane(e.face) && leaves(entryIdentity(e.face))).map((e) => e.kept));
|
|
201
208
|
if (backgroundAgents !== undefined)
|
|
202
209
|
facts.set("leg.backgroundAgents", backgroundAgents);
|
|
203
|
-
const
|
|
204
|
-
const sharedOccupied = occupied(mountGroupNames("sharedMemory"));
|
|
205
|
-
const engineOccupied = occupied(mountGroupNames("memoryEngine"));
|
|
206
|
-
if (sharedOccupied !== undefined)
|
|
207
|
-
facts.set("names.occupied.sharedMemory", sharedOccupied);
|
|
208
|
-
if (engineOccupied !== undefined)
|
|
209
|
-
facts.set("names.occupied.memoryEngine", engineOccupied);
|
|
210
|
+
const skillsSeat = readSkillsSeat(spec.skills);
|
|
210
211
|
const src = {
|
|
211
212
|
fact: (f) => facts.get(f),
|
|
212
213
|
valve: (identity) => leaves(identity),
|
|
@@ -219,13 +220,24 @@ export function planStaticToolMounts(deps, spec, statement = {}) {
|
|
|
219
220
|
retracted: () => undefined,
|
|
220
221
|
};
|
|
221
222
|
const sessionNew = statement.session === "new" ? false : undefined;
|
|
222
|
-
const word = wordReading(deps, spec, screenUserAttachments(spec.userAttachments, { resumeLeg: false }), listLegModSeats({ spec, deps, skills: skillsThatLoad(
|
|
223
|
-
|
|
223
|
+
const word = wordReading(deps, spec, screenUserAttachments(spec.userAttachments, { resumeLeg: false }), listLegModSeats({ spec, deps, skills: skillsThatLoad(skillsSeat) }));
|
|
224
|
+
const reading = {
|
|
224
225
|
src,
|
|
225
226
|
members: [...callerMembers(entries, leaves), ...protocol.members],
|
|
226
227
|
families: protocol.families,
|
|
227
228
|
writeProtected: legWriteProtectionTable(deps, spec).length > 0,
|
|
228
229
|
asks: { ...word.asks, checkout: sessionNew, restore: sessionNew, compaction_restore: sessionNew, caller_placement: sessionNew },
|
|
229
230
|
mods: word.mods,
|
|
230
|
-
}
|
|
231
|
+
};
|
|
232
|
+
const executionEnv = readExecutionEnv(reading);
|
|
233
|
+
state({ "spec.mcp": (preflight?.mcp?.length ?? 0) > 0 });
|
|
234
|
+
state({ "listing.skills": loadedSkills(skillsSeat).length > 0 });
|
|
235
|
+
const occupied = (names) => anyOf(names.map((n) => declared(n, true)));
|
|
236
|
+
const sharedOccupied = occupied(mountGroupNames("sharedMemory"));
|
|
237
|
+
const engineOccupied = occupied(mountGroupNames("memoryEngine"));
|
|
238
|
+
if (sharedOccupied !== undefined)
|
|
239
|
+
facts.set("names.occupied.sharedMemory", sharedOccupied);
|
|
240
|
+
if (engineOccupied !== undefined)
|
|
241
|
+
facts.set("names.occupied.memoryEngine", engineOccupied);
|
|
242
|
+
return planToolMounts(reading, executionEnv);
|
|
231
243
|
}
|
|
@@ -92,11 +92,42 @@ export declare function writeTargetToolNames(): ReadonlySet<string>;
|
|
|
92
92
|
export declare function compactableToolNames(): ReadonlySet<string>;
|
|
93
93
|
/** A-5 — the aggregate-budget exemptions (`budgetExempt: true`). */
|
|
94
94
|
export declare function budgetExemptToolNames(): ReadonlySet<string>;
|
|
95
|
-
/** The value a call's args carry under a path target: `param` first, then each alias, first non-empty string wins
|
|
95
|
+
/** The value a call's args carry under a path target: `param` first, then each alias, first non-empty string wins — the spelling
|
|
96
|
+
* an engine tool's body opens, so every judge of an engine tool's target and of every write reads this one. */
|
|
96
97
|
export declare function pathTargetValue(args: unknown, pt: {
|
|
97
98
|
param: string;
|
|
98
99
|
aliases?: readonly string[];
|
|
99
100
|
}): string | undefined;
|
|
101
|
+
/** The most targets one call's slot may name: a judge resolves each of them in the call's environment before the gate's deadline. */
|
|
102
|
+
export declare const PATH_TARGET_ELEMENTS_MAX = 100;
|
|
103
|
+
/**
|
|
104
|
+
* The read slot a call's OWN face declares, when the tool is not one the engine mounted (a caller's `TaskSpec.tools` entry, an MCP
|
|
105
|
+
* tool under its server's `toolFaces`) — whatever names it answers to. Such a slot is read by {@link declaredSlotValues}; every other
|
|
106
|
+
* slot (an engine tool's, a write's, the catalog floor of a name) by {@link pathTargetValue}.
|
|
107
|
+
*/
|
|
108
|
+
export declare function declaredReadSlotOf(call: Pick<ToolCallLike, "face">): ToolCallPathTarget | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* The values a DECLARED read slot ({@link declaredReadSlotOf}) carries: decided without reading a value, the slot's
|
|
111
|
+
* spellings that are the call's OWN keys (`Object.hasOwn`) if any, otherwise every spelling (ordinary lookup, inherited
|
|
112
|
+
* keys included); each chosen spelling is read once. `undefined` is absent; with `each: true` a list expands to its
|
|
113
|
+
* elements; every other value is handed on as read (a non-string or empty string is kept for the reader to refuse).
|
|
114
|
+
*/
|
|
115
|
+
export declare function declaredSlotValues(args: unknown, pt: {
|
|
116
|
+
param: string;
|
|
117
|
+
aliases?: readonly string[];
|
|
118
|
+
each?: true | boolean;
|
|
119
|
+
}): readonly unknown[];
|
|
120
|
+
/**
|
|
121
|
+
* THE reading of a declared read slot every reader of a call's targets takes (the read station's selection, the sensitive-path list):
|
|
122
|
+
* the call's declared read slot ({@link declaredReadSlotOf}) with the values its chosen spellings carry ({@link declaredSlotValues}) —
|
|
123
|
+
* an empty list where nothing was carried, never falling back to {@link pathTargetValue}; `undefined` only when the call has no
|
|
124
|
+
* declared read slot.
|
|
125
|
+
*/
|
|
126
|
+
export declare function declaredReadValuesOf(call: Pick<ToolCallLike, "face" | "args">): {
|
|
127
|
+
readonly slot: ToolCallPathTarget;
|
|
128
|
+
readonly values: readonly unknown[];
|
|
129
|
+
readonly present: boolean;
|
|
130
|
+
} | undefined;
|
|
100
131
|
/**
|
|
101
132
|
* CC parity: Read/Edit/Write take the file path as `file_path`. Read the target the same way
|
|
102
133
|
* EVERYWHERE the path is consumed from a tool-call's args — not just the tool body but ALSO every gate that
|
|
@@ -128,6 +159,7 @@ export interface ToolCallLike {
|
|
|
128
159
|
pathTarget?: ToolCallPathTarget;
|
|
129
160
|
hostTarget?: ToolHostTarget;
|
|
130
161
|
names?: readonly string[];
|
|
162
|
+
engineMounted?: boolean;
|
|
131
163
|
} | undefined;
|
|
132
164
|
}
|
|
133
165
|
type CallPathTarget = ToolCallPathTarget;
|
|
@@ -96,6 +96,39 @@ export function pathTargetValue(args, pt) {
|
|
|
96
96
|
}
|
|
97
97
|
return undefined;
|
|
98
98
|
}
|
|
99
|
+
export const PATH_TARGET_ELEMENTS_MAX = 100;
|
|
100
|
+
export function declaredReadSlotOf(call) {
|
|
101
|
+
const f = call.face;
|
|
102
|
+
return f !== undefined && f.engineMounted !== true && f.pathTarget?.access === "read" ? f.pathTarget : undefined;
|
|
103
|
+
}
|
|
104
|
+
function readDeclaredSlot(args, pt) {
|
|
105
|
+
if (args === null || typeof args !== "object")
|
|
106
|
+
return { values: [], present: false };
|
|
107
|
+
const a = args;
|
|
108
|
+
const spellings = [...new Set([pt.param, ...(pt.aliases ?? [])])];
|
|
109
|
+
const own = spellings.filter((k) => Object.hasOwn(a, k));
|
|
110
|
+
const chosen = own.length > 0 ? own : spellings;
|
|
111
|
+
let present = false;
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const k of chosen) {
|
|
114
|
+
const v = a[k];
|
|
115
|
+
if (v === undefined)
|
|
116
|
+
continue;
|
|
117
|
+
present = true;
|
|
118
|
+
if (pt.each === true && Array.isArray(v))
|
|
119
|
+
out.push(...Array.from(v));
|
|
120
|
+
else
|
|
121
|
+
out.push(v);
|
|
122
|
+
}
|
|
123
|
+
return { values: out, present };
|
|
124
|
+
}
|
|
125
|
+
export function declaredSlotValues(args, pt) {
|
|
126
|
+
return readDeclaredSlot(args, pt).values;
|
|
127
|
+
}
|
|
128
|
+
export function declaredReadValuesOf(call) {
|
|
129
|
+
const slot = declaredReadSlotOf(call);
|
|
130
|
+
return slot === undefined ? undefined : { slot, ...readDeclaredSlot(call.args, slot) };
|
|
131
|
+
}
|
|
99
132
|
const FILE_ARG_PATH_TARGET = { param: "file_path", aliases: ["path"] };
|
|
100
133
|
export function fileArgPath(args) {
|
|
101
134
|
return pathTargetValue(args, FILE_ARG_PATH_TARGET);
|
|
@@ -64,6 +64,10 @@ export declare const ToolRosterEntry: Type.TObject<{
|
|
|
64
64
|
reversibilityProbe: Type.TBoolean;
|
|
65
65
|
contentOrigin: Type.TUnion<[Type.TLiteral<"local">, Type.TLiteral<"execution">, Type.TLiteral<"external">]>;
|
|
66
66
|
contentOriginProvenance: Type.TUnion<[Type.TLiteral<"declared">, Type.TLiteral<"server">, Type.TLiteral<"exempted">, Type.TLiteral<"default">]>;
|
|
67
|
+
/** The digest of what the registration of the peer this tool belongs to says about where a call goes, as whom and with which
|
|
68
|
+
* identity (`core/peer-registration.ts`), as its materializer minted it onto the tool. Present iff `source` ∈ {mcp, a2a} and the tool
|
|
69
|
+
* belongs to one peer (a resource helper that serves every server carries none). */
|
|
70
|
+
registration: Type.TOptional<Type.TString>;
|
|
67
71
|
family: Type.TUnion<[Type.TLiteral<"shell">, Type.TLiteral<"file-read">, Type.TLiteral<"file-write">, Type.TLiteral<"search">, Type.TLiteral<"web">, Type.TLiteral<"delegate">, Type.TLiteral<"plan">, Type.TLiteral<"scaffold">, Type.TLiteral<"memory">, Type.TLiteral<"protocol">, Type.TLiteral<"other">]>;
|
|
68
72
|
/** The legs a call of this tool travels (`BOUNDARY_LEGS`), or `"per_call"` when its dispatch gives them per call: the engine's own
|
|
69
73
|
* definitions and the protocol tools state them, every other row follows its `effect` (`rosterBoundaryLegs`). */
|
|
@@ -76,6 +80,7 @@ export declare const ToolRosterEntry: Type.TObject<{
|
|
|
76
80
|
base: Type.TOptional<Type.TUnion<[Type.TLiteral<"cwd">, Type.TLiteral<"root">]>>;
|
|
77
81
|
absent: Type.TOptional<Type.TUnion<[Type.TLiteral<"none">, Type.TLiteral<"base">]>>;
|
|
78
82
|
patternParam: Type.TOptional<Type.TString>;
|
|
83
|
+
each: Type.TOptional<Type.TLiteral<true>>;
|
|
79
84
|
}>>;
|
|
80
85
|
/** The URL slot a host rule of the row's name is read on, as the definition declared it ({@link ToolHostTarget}); absent when
|
|
81
86
|
* it declares none. Exclusive with `pathTarget`. */
|
|
@@ -158,6 +163,10 @@ export declare const ToolRoster: Type.TObject<{
|
|
|
158
163
|
reversibilityProbe: Type.TBoolean;
|
|
159
164
|
contentOrigin: Type.TUnion<[Type.TLiteral<"local">, Type.TLiteral<"execution">, Type.TLiteral<"external">]>;
|
|
160
165
|
contentOriginProvenance: Type.TUnion<[Type.TLiteral<"declared">, Type.TLiteral<"server">, Type.TLiteral<"exempted">, Type.TLiteral<"default">]>;
|
|
166
|
+
/** The digest of what the registration of the peer this tool belongs to says about where a call goes, as whom and with which
|
|
167
|
+
* identity (`core/peer-registration.ts`), as its materializer minted it onto the tool. Present iff `source` ∈ {mcp, a2a} and the tool
|
|
168
|
+
* belongs to one peer (a resource helper that serves every server carries none). */
|
|
169
|
+
registration: Type.TOptional<Type.TString>;
|
|
161
170
|
family: Type.TUnion<[Type.TLiteral<"shell">, Type.TLiteral<"file-read">, Type.TLiteral<"file-write">, Type.TLiteral<"search">, Type.TLiteral<"web">, Type.TLiteral<"delegate">, Type.TLiteral<"plan">, Type.TLiteral<"scaffold">, Type.TLiteral<"memory">, Type.TLiteral<"protocol">, Type.TLiteral<"other">]>;
|
|
162
171
|
/** The legs a call of this tool travels (`BOUNDARY_LEGS`), or `"per_call"` when its dispatch gives them per call: the engine's own
|
|
163
172
|
* definitions and the protocol tools state them, every other row follows its `effect` (`rosterBoundaryLegs`). */
|
|
@@ -170,6 +179,7 @@ export declare const ToolRoster: Type.TObject<{
|
|
|
170
179
|
base: Type.TOptional<Type.TUnion<[Type.TLiteral<"cwd">, Type.TLiteral<"root">]>>;
|
|
171
180
|
absent: Type.TOptional<Type.TUnion<[Type.TLiteral<"none">, Type.TLiteral<"base">]>>;
|
|
172
181
|
patternParam: Type.TOptional<Type.TString>;
|
|
182
|
+
each: Type.TOptional<Type.TLiteral<true>>;
|
|
173
183
|
}>>;
|
|
174
184
|
/** The URL slot a host rule of the row's name is read on, as the definition declared it ({@link ToolHostTarget}); absent when
|
|
175
185
|
* it declares none. Exclusive with `pathTarget`. */
|
|
@@ -261,6 +271,10 @@ export declare const ToolRosterDelta: Type.TObject<{
|
|
|
261
271
|
reversibilityProbe: Type.TBoolean;
|
|
262
272
|
contentOrigin: Type.TUnion<[Type.TLiteral<"local">, Type.TLiteral<"execution">, Type.TLiteral<"external">]>;
|
|
263
273
|
contentOriginProvenance: Type.TUnion<[Type.TLiteral<"declared">, Type.TLiteral<"server">, Type.TLiteral<"exempted">, Type.TLiteral<"default">]>;
|
|
274
|
+
/** The digest of what the registration of the peer this tool belongs to says about where a call goes, as whom and with which
|
|
275
|
+
* identity (`core/peer-registration.ts`), as its materializer minted it onto the tool. Present iff `source` ∈ {mcp, a2a} and the tool
|
|
276
|
+
* belongs to one peer (a resource helper that serves every server carries none). */
|
|
277
|
+
registration: Type.TOptional<Type.TString>;
|
|
264
278
|
family: Type.TUnion<[Type.TLiteral<"shell">, Type.TLiteral<"file-read">, Type.TLiteral<"file-write">, Type.TLiteral<"search">, Type.TLiteral<"web">, Type.TLiteral<"delegate">, Type.TLiteral<"plan">, Type.TLiteral<"scaffold">, Type.TLiteral<"memory">, Type.TLiteral<"protocol">, Type.TLiteral<"other">]>;
|
|
265
279
|
/** The legs a call of this tool travels (`BOUNDARY_LEGS`), or `"per_call"` when its dispatch gives them per call: the engine's own
|
|
266
280
|
* definitions and the protocol tools state them, every other row follows its `effect` (`rosterBoundaryLegs`). */
|
|
@@ -273,6 +287,7 @@ export declare const ToolRosterDelta: Type.TObject<{
|
|
|
273
287
|
base: Type.TOptional<Type.TUnion<[Type.TLiteral<"cwd">, Type.TLiteral<"root">]>>;
|
|
274
288
|
absent: Type.TOptional<Type.TUnion<[Type.TLiteral<"none">, Type.TLiteral<"base">]>>;
|
|
275
289
|
patternParam: Type.TOptional<Type.TString>;
|
|
290
|
+
each: Type.TOptional<Type.TLiteral<true>>;
|
|
276
291
|
}>>;
|
|
277
292
|
/** The URL slot a host rule of the row's name is read on, as the definition declared it ({@link ToolHostTarget}); absent when
|
|
278
293
|
* it declares none. Exclusive with `pathTarget`. */
|
|
@@ -481,6 +496,7 @@ export declare const ROSTER_APPROVAL_BINDING: Readonly<{
|
|
|
481
496
|
readonly contentOriginProvenance: {
|
|
482
497
|
readonly unbound: "where the content-origin value came from; the value is the declaration's, no decision reads its provenance";
|
|
483
498
|
};
|
|
499
|
+
readonly registration: "declaration";
|
|
484
500
|
readonly family: "face";
|
|
485
501
|
readonly boundaryLegs: "declaration";
|
|
486
502
|
readonly pathTarget: "face";
|
package/dist/core/tool-roster.js
CHANGED
|
@@ -65,6 +65,7 @@ export const ToolRosterEntry = Type.Object({
|
|
|
65
65
|
reversibilityProbe: Type.Boolean(),
|
|
66
66
|
contentOrigin: lit(["local", "execution", "external"]),
|
|
67
67
|
contentOriginProvenance: lit(["declared", "server", "exempted", "default"]),
|
|
68
|
+
registration: Type.Optional(Digest16),
|
|
68
69
|
family: lit(TOOL_FAMILIES),
|
|
69
70
|
boundaryLegs: Type.Union([Type.Literal("per_call"), Type.Array(lit(BOUNDARY_LEGS), { uniqueItems: true })]),
|
|
70
71
|
pathTarget: Type.Optional(Type.Object({
|
|
@@ -75,6 +76,7 @@ export const ToolRosterEntry = Type.Object({
|
|
|
75
76
|
base: Type.Optional(lit(TOOL_PATH_BASES)),
|
|
76
77
|
absent: Type.Optional(lit(TOOL_PATH_ABSENCES)),
|
|
77
78
|
patternParam: Type.Optional(Key),
|
|
79
|
+
each: Type.Optional(Type.Literal(true)),
|
|
78
80
|
}, { additionalProperties: false })),
|
|
79
81
|
hostTarget: Type.Optional(Type.Object({ param: Key }, { additionalProperties: false })),
|
|
80
82
|
ruleFace: Type.Object({ primaryParams: Type.Array(Key), params: Type.Array(Key), nameValues: Type.Optional(Type.Array(Type.String())) }, { additionalProperties: false }),
|
|
@@ -210,6 +212,7 @@ export const ROSTER_APPROVAL_BINDING = Object.freeze({
|
|
|
210
212
|
reversibilityProbe: "declaration",
|
|
211
213
|
contentOrigin: "declaration",
|
|
212
214
|
contentOriginProvenance: { unbound: "where the content-origin value came from; the value is the declaration's, no decision reads its provenance" },
|
|
215
|
+
registration: "declaration",
|
|
213
216
|
family: "face",
|
|
214
217
|
boundaryLegs: "declaration",
|
|
215
218
|
pathTarget: "face",
|
|
@@ -700,6 +703,7 @@ export function mintRosterEntry(tool, meta, facts) {
|
|
|
700
703
|
const reversibilityProbe = face.reversibilityProbe !== undefined || facts.reversibilityProbes.has(tool.name);
|
|
701
704
|
const contentOrigin = face.contentOrigin ?? (facts.trustedTools.has(tool.name) ? "local" : "external");
|
|
702
705
|
const contentOriginProvenance = face.contentOrigin !== undefined ? (meta.source === "mcp" || meta.source === "a2a" ? "server" : "declared") : facts.trustedTools.has(tool.name) ? "exempted" : "default";
|
|
706
|
+
const registration = meta.source === "mcp" || meta.source === "a2a" ? tool.peerRegistration : undefined;
|
|
703
707
|
const pathTarget = face.pathTarget;
|
|
704
708
|
const rf = ruleFaceOfInstance(tool.parameters, face.ruleFace, pathTarget);
|
|
705
709
|
const declaredValues = face.ruleFace?.nameValues;
|
|
@@ -744,6 +748,7 @@ export function mintRosterEntry(tool, meta, facts) {
|
|
|
744
748
|
reversibilityProbe,
|
|
745
749
|
contentOrigin,
|
|
746
750
|
contentOriginProvenance,
|
|
751
|
+
...(registration !== undefined ? { registration } : {}),
|
|
747
752
|
family: face.family !== undefined && TOOL_FAMILIES.includes(face.family) ? face.family : "other",
|
|
748
753
|
boundaryLegs: boundaryLegs === "per_call" ? boundaryLegs : [...boundaryLegs],
|
|
749
754
|
...(pathTarget !== undefined
|
|
@@ -756,6 +761,7 @@ export function mintRosterEntry(tool, meta, facts) {
|
|
|
756
761
|
...(pathTarget.base !== undefined ? { base: pathTarget.base } : {}),
|
|
757
762
|
...(pathTarget.absent !== undefined ? { absent: pathTarget.absent } : {}),
|
|
758
763
|
...(pathTarget.patternParam !== undefined ? { patternParam: pathTarget.patternParam } : {}),
|
|
764
|
+
...(pathTarget.each === true ? { each: true } : {}),
|
|
759
765
|
},
|
|
760
766
|
}
|
|
761
767
|
: {}),
|
package/dist/core/tool-spec.d.ts
CHANGED
|
@@ -706,6 +706,8 @@ export interface DelegationSettlementSeat {
|
|
|
706
706
|
export interface ToolExecuteContext {
|
|
707
707
|
toolCallId: string;
|
|
708
708
|
signal?: AbortSignal;
|
|
709
|
+
/** A declared read target (`pathTarget.access: "read"`) as the file read station judged it, per call; the tool's only reader of it (`judged-read.ts`). */
|
|
710
|
+
readonly judgedReads?: import("./judged-read.js").JudgedReads;
|
|
709
711
|
/**
|
|
710
712
|
* design/147 S1 — the SPAWNING run's taskId when THIS run is a delegated child (Runner-filled from
|
|
711
713
|
* the trusted internals chain, absent on a top-level run). Read-only context: the Agent tool's
|
|
@@ -1150,8 +1152,8 @@ export interface ToolExecuteContext {
|
|
|
1150
1152
|
/**
|
|
1151
1153
|
* The MCP surface THIS run mounts (Runner-filled, read-only, answered at call time off the live roster): per declared server,
|
|
1152
1154
|
* the tools of it mounted right now, and the aggregate tools no server owns. A delegation tool reads it AT SPAWN TIME for the
|
|
1153
|
-
* protocol half of the one universe a child's lists govern, and declares the child the servers the lists leave
|
|
1154
|
-
*
|
|
1155
|
+
* protocol half of the one universe a child's lists govern, and declares the child the servers the lists leave; `hostSeats` are the seats of the host servers it declares (a wake
|
|
1156
|
+
* hands them on). It is present on every leg — `servers: []` on one that declares none (read "has MCP" as `servers.length`); absent only when the tool runs outside a Runner task.
|
|
1155
1157
|
*/
|
|
1156
1158
|
mountedMcp?: () => import("./mounted-mcp.js").MountedMcp;
|
|
1157
1159
|
/** The run's compiled tool selector (its `allowTools` / `excludeTools` — the allowlist naming nothing under `excludeAllTools` — under the ceiling it was spawned with): `admits` answers
|
package/dist/core/tools.d.ts
CHANGED
|
@@ -76,6 +76,12 @@ export interface DefineToolOptions {
|
|
|
76
76
|
* `{toolCallId, signal}` ctx, so every mount that does not opt in stays byte-identical. */
|
|
77
77
|
enrichCtx?: ToolCtxEnricher;
|
|
78
78
|
}
|
|
79
|
+
/** The per-call ctx: a FRESH object per call carrying the enriched object's own property DESCRIPTORS (so its
|
|
80
|
+
* getters stay getters — the live seats keep reading at read time) with `toolCallId` / `signal` (re)defined as
|
|
81
|
+
* own data properties on top. Fresh, never the enricher's object mutated: an enricher that hands back one
|
|
82
|
+
* shared object across calls (nothing in its contract forbids it) would otherwise have call A read call B's
|
|
83
|
+
* identity, and a frozen one would throw before the body ran. */
|
|
84
|
+
export declare function stampCallIdentity(enriched: ToolExecuteContext, toolCallId: string, signal: AbortSignal | undefined): ToolExecuteContext;
|
|
79
85
|
/** Adapt a friendly ToolSpec into the vendored AgentTool the agent loop expects. The product is built from the spec as it
|
|
80
86
|
* stands HERE: the factory takes its one frozen copy ({@link frozenToolSpec}) and builds the product, its call-time reads
|
|
81
87
|
* and every later rebind from that copy, so a caller that keeps the object it handed in and changes it afterwards
|
package/dist/core/tools.js
CHANGED
|
@@ -93,7 +93,7 @@ export function rebindDefineToolCtx(product, enrich) {
|
|
|
93
93
|
throw new Error(`rebindDefineToolCtx: ${product.name} is not a defineTool product (no rebind seat)`);
|
|
94
94
|
return rebind(enrich, product);
|
|
95
95
|
}
|
|
96
|
-
function stampCallIdentity(enriched, toolCallId, signal) {
|
|
96
|
+
export function stampCallIdentity(enriched, toolCallId, signal) {
|
|
97
97
|
const own = (value) => ({ value, enumerable: true, configurable: true, writable: true });
|
|
98
98
|
return Object.create(Object.getPrototypeOf(enriched), { ...Object.getOwnPropertyDescriptors(enriched), toolCallId: own(toolCallId), signal: own(signal) });
|
|
99
99
|
}
|
|
@@ -36,6 +36,8 @@ import { type RunOrigin } from "./run-origin.js";
|
|
|
36
36
|
import { engineLaneLegOf } from "./park-resumability.js";
|
|
37
37
|
import { type StaticToolPlanDeps, type StaticToolPlanSpec, type StaticWiringStatement } from "./tool-mount-static.js";
|
|
38
38
|
import { type ToolMountPlan } from "./tool-mount-plan.js";
|
|
39
|
+
import type { WorkspaceSnapshot } from "./workspace-snapshot.js";
|
|
40
|
+
import { type ProjectMarkerUnreadableReason } from "./memory-engine/scope-contract.js";
|
|
39
41
|
export type { StoreDurability };
|
|
40
42
|
/** The manifest-face projection of {@link StoreDurability}: `"declared_durable"` (the name says it —
|
|
41
43
|
* a DECLARATION relayed, not a verification) vs `"process_local"` (declared so, or fail-closed
|
|
@@ -754,6 +756,29 @@ export interface WiringManifest {
|
|
|
754
756
|
* {@link configFingerprint}: a per-task seat.
|
|
755
757
|
*/
|
|
756
758
|
advisor?: WiringAdvisorFact;
|
|
759
|
+
/**
|
|
760
|
+
* EFFECTIVE half only — this leg's project verdict, projected from the same mint as `workspace_changed.project`
|
|
761
|
+
* (same shape: `{ id, source: "marker" | "declared" }`). Present iff the leg has a project verdict, including legs
|
|
762
|
+
* that emit no `workspace_changed` frame (`hands.reason: "not_needed"`). Absent when the leg has no verdict or the
|
|
763
|
+
* marker could not be read. Only prepared legs emit a manifest (a refused leg has no manifest; refusal detail rides
|
|
764
|
+
* `terminal.detail`); a delegated child's manifest rides the child's own stream, never forwarded onto the parent's.
|
|
765
|
+
* Out of {@link configFingerprint}: a per-leg fact.
|
|
766
|
+
*/
|
|
767
|
+
project?: NonNullable<WorkspaceSnapshot["project"]>;
|
|
768
|
+
/**
|
|
769
|
+
* EFFECTIVE half only — present iff this prepared leg ran in a workspace whose `.sema/project` marker could not be
|
|
770
|
+
* read (or whose ancestor `.git` walk failed), projected from the same `resolveSessionProject` read as P-e refusal
|
|
771
|
+
* detail (zero second read; no file content and no error text). `markerPath` passes through the same
|
|
772
|
+
* {@link codedDetailStringOf} screen as P-e `terminal.detail` (redacted when credential-shaped, omitted when over
|
|
773
|
+
* the coded-detail string bound or when `reason === "repo_root_unreadable"`). Mutually exclusive with
|
|
774
|
+
* {@link WiringManifest.project} (never both present on one manifest; a leg declaring `TaskSpec.projectId` beside an
|
|
775
|
+
* unreadable marker is refused and emits no manifest). A host (e.g. the service layer) leaves its stored project row
|
|
776
|
+
* untouched on it. Out of {@link configFingerprint}: a per-leg fact.
|
|
777
|
+
*/
|
|
778
|
+
projectMarkerUnreadable?: {
|
|
779
|
+
readonly reason: ProjectMarkerUnreadableReason;
|
|
780
|
+
readonly markerPath?: string;
|
|
781
|
+
};
|
|
757
782
|
/** EFFECTIVE half only — a short, non-sensitive fingerprint (sha256 prefix over the canonical JSON of the members read off
|
|
758
783
|
* the DEPLOYMENT's own seats, the ones this module's `deploymentPart` names; every one an enum/boolean/count, no secrets) so an
|
|
759
784
|
* operator can correlate legs that ran under the same deployment: a root, its children and its resumes, a leg that starts
|
|
@@ -913,6 +938,10 @@ export interface WiringFacts {
|
|
|
913
938
|
advisor?: WiringAdvisorFact;
|
|
914
939
|
/** Effective half only — the compiled host floor's posture ({@link WiringManifest.hostFloor}); absent ⇒ none declared. */
|
|
915
940
|
hostFloor?: import("./host-floor.js").HostFloorPosture;
|
|
941
|
+
/** Effective half only — this leg's project verdict ({@link WiringManifest.project}), relayed from the leg's one mint; absent ⇒ no verdict. */
|
|
942
|
+
project?: WiringManifest["project"];
|
|
943
|
+
/** Effective half only — unreadable-marker fact ({@link WiringManifest.projectMarkerUnreadable}), relayed from the leg's one mint; mutually exclusive with {@link project}. */
|
|
944
|
+
projectMarkerUnreadable?: WiringManifest["projectMarkerUnreadable"];
|
|
916
945
|
}
|
|
917
946
|
/** {@link WiringManifest.advisor}. */
|
|
918
947
|
export interface WiringAdvisorFact {
|
|
@@ -1088,6 +1117,12 @@ export declare function countElicitOptIns(spec: Pick<TaskSpec, "mcp">): number;
|
|
|
1088
1117
|
* applies here too): absent ⇒ not wired; a function ⇒ wired; a present NON-function (a JS caller
|
|
1089
1118
|
* passing null/junk) is refused loudly rather than reported as a live seam nothing can call. */
|
|
1090
1119
|
export declare function resolveElicitSeam(deps: Pick<RunnerDeps, "onElicit">): boolean;
|
|
1120
|
+
/**
|
|
1121
|
+
* The interaction posture's word, judged against its two words — the ONE judgment of it: the static manifest's, and the config-door
|
|
1122
|
+
* phase's value door (which a resume's screen calls before its claim). A present value outside `"interactive"` / `"headless"` (`""`
|
|
1123
|
+
* included: a present junk value, not absence) is refused loudly, `config.interaction_posture`; absent stays absent.
|
|
1124
|
+
*/
|
|
1125
|
+
export declare function screenInteractionPostureWord(posture: unknown): "interactive" | "headless" | undefined;
|
|
1091
1126
|
/**
|
|
1092
1127
|
* design/173 §2.1 — the STATIC half: a pure synchronous description of what `(deps, spec)` can
|
|
1093
1128
|
* prove about the wiring, for a server's startup self-check. Facts that only prepare can resolve
|
|
@@ -1096,22 +1131,41 @@ export declare function resolveElicitSeam(deps: Pick<RunnerDeps, "onElicit">): b
|
|
|
1096
1131
|
* guarantee boundary above. `spec` may be omitted for a spec-less deployment self-check.
|
|
1097
1132
|
*
|
|
1098
1133
|
* `toolPlan` is the mount table read over the facts this half can read (tool-mount-static.ts): a member it calls
|
|
1099
|
-
* `mounted` mounts on every top-level leg `(deps, spec)`
|
|
1100
|
-
* per-task, per-principal or live fact decides is `conditional` and names that fact. Reading it
|
|
1101
|
-
* runs over
|
|
1102
|
-
* declared peers, a named model), so a spec
|
|
1103
|
-
* before the screens `deriveWiringManifest` runs over the assembled facts
|
|
1134
|
+
* `mounted` mounts on every top-level leg `(deps, spec)` starts (the contract below says which legs), a definition it calls absent
|
|
1135
|
+
* on none, and a member a per-task, per-principal or live fact decides is `conditional` and names that fact. Reading it takes the
|
|
1136
|
+
* spec's one read first and then runs these doors of prepare over those values (the permission-mode doors, the tool lists and
|
|
1137
|
+
* selector, the locked-config preflight of the declared peers, a named model), so a spec those doors refuse is refused here —
|
|
1138
|
+
* after the seat resolutions above it, before the screens `deriveWiringManifest` runs over the assembled facts; prepare's other
|
|
1139
|
+
* refusals are not judged (below). Its `executionEnv` answers whether a leg of
|
|
1104
1140
|
* `(deps, spec)` needs an execution environment; the session's own needs (its checkout record, a resume, a delegating
|
|
1105
1141
|
* caller's placement) stay open — the answer is never `unneeded` — unless `statement` says the submission mints its session
|
|
1106
1142
|
* (`{ session: "new" }`). Over that statement, a static `unneeded` holds on the leg (the leg's own reading only adds facts).
|
|
1143
|
+
*
|
|
1144
|
+
* What the `toolPlan` answers (the table's contract), for a freshly started top-level leg of `(deps, spec)` that gets past prepare,
|
|
1145
|
+
* over the modes and words the spec itself states. A resumed leg is not in these promises: it takes the permission mode its
|
|
1146
|
+
* checkpoint recorded, which this read does not know (with a recorded `plan` mode and none requested, `EnterPlanMode` and
|
|
1147
|
+
* `ExitPlanMode` are absent here and mounted there).
|
|
1148
|
+
* · a member it marks `mounted` is on the roster, and a definition it marks absent is not — with one exception, in both
|
|
1149
|
+
* directions: a caller tool that carries `ToolSpec.withAgents` is rebuilt for the task's agents and the rebuilt tool may answer
|
|
1150
|
+
* to another name, so the name it brings is on the roster and unlisted, and the name it was handed under may be gone;
|
|
1151
|
+
* · a member it marks `conditional`, and a family of a declared peer, may be on the roster — `when` names what decides it;
|
|
1152
|
+
* · a name it does not list as a member is, as a rule, not on the roster. Besides the rebuild above, the tools a declared MCP or
|
|
1153
|
+
* A2A peer lists are on it under that peer's namespace prefix (the family stands for them; a remote tool's own name is never a
|
|
1154
|
+
* member), and a caller tool's aliases are spellings that dispatch to a listed name, not names of their own;
|
|
1155
|
+
* · what prepare refuses the whole roster for is not judged here: a caller tool named `Skill` beside a skill that loads (the name
|
|
1156
|
+
* is reserved), a name another per-turn station takes, the safety scan of the caller's tools, a plan file the leg has no hands
|
|
1157
|
+
* to write (the doors named above are the exception: they run here, over the spec's own values);
|
|
1158
|
+
* · `ToolSearch` is `conditional` on `names.deferred`, an honest "not known": the leg's deferral classification over the tools it
|
|
1159
|
+
* mounts decides it — a tool's own or the task's explicit deferral (`defer`, `TaskSpec.deferTools`), the pins against it
|
|
1160
|
+
* (`alwaysLoad`, `TaskSpec.alwaysLoadTools`), the size threshold (`RunnerDeps.toolSearch`, `RunnerDeps.deferMode`), the tools a
|
|
1161
|
+
* declared peer lists, the valve admitting `ToolSearch` — and this table does not run that classification;
|
|
1162
|
+
* · the `Skill` row states what the leg reads from the spec, by the leg's own function: it holds exactly when a skill loads
|
|
1163
|
+
* (`loadedSkills`; a skill over the load limit does not load). The spec is read once by member name
|
|
1164
|
+
* (`readCallerSpec`), as the Runner reads it, and its refusal (a member that cannot be read, a retired key, a key the engine does
|
|
1165
|
+
* not read) is thrown here as the leg's config door throws it; `executionEnv` is read over the facts the leg holds when it decides
|
|
1166
|
+
* whether to start an environment (`listing.skills` is stated after).
|
|
1107
1167
|
*/
|
|
1108
|
-
|
|
1109
|
-
* The interaction posture's word, judged against its two words — the ONE judgment of it: the static manifest's, and the config-door
|
|
1110
|
-
* phase's value door (which a resume's screen calls before its claim). A present value outside `"interactive"` / `"headless"` (`""`
|
|
1111
|
-
* included: a present junk value, not absence) is refused loudly, `config.interaction_posture`; absent stays absent.
|
|
1112
|
-
*/
|
|
1113
|
-
export declare function screenInteractionPostureWord(posture: unknown): "interactive" | "headless" | undefined;
|
|
1114
|
-
export declare function describeStaticWiring(deps: StaticWiringDeps, spec?: StaticWiringSpec, statement?: StaticWiringStatement): WiringManifest;
|
|
1168
|
+
export declare function describeStaticWiring(deps: StaticWiringDeps, handed?: StaticWiringSpec, statement?: StaticWiringStatement): WiringManifest;
|
|
1115
1169
|
/**
|
|
1116
1170
|
* The wiring manifest's per-server MCP read face for one leg (`WiringManifest.mcp`): every
|
|
1117
1171
|
* server the leg's FROZEN entry snapshot declared, in declaration order, joined by name to this leg's
|
|
@@ -17,6 +17,9 @@ import { engineLaneLegOf } from "./park-resumability.js";
|
|
|
17
17
|
import { planStaticToolMounts } from "./tool-mount-static.js";
|
|
18
18
|
import { EXECUTION_ENV_NEEDS } from "./tool-mount-plan.js";
|
|
19
19
|
import { enterConfigDoor } from "./config-refusal-input.js";
|
|
20
|
+
import { readCallerSpec } from "./task-spec-members.js";
|
|
21
|
+
import { PROJECT_MARKER_UNREADABLE_REASONS } from "./memory-engine/scope-contract.js";
|
|
22
|
+
import { codedDetailStringOf } from "./runner/terminal-account.js";
|
|
20
23
|
export function wiringLegKindOf(resumed, internals) {
|
|
21
24
|
return resumed ? "resume" : engineLaneLegOf(internals) ? "child" : "root";
|
|
22
25
|
}
|
|
@@ -238,6 +241,30 @@ function readSessionRulesFact(fact) {
|
|
|
238
241
|
throw new Error(`the session-rules wiring fact ${JSON.stringify(fact)} is not a boolean`);
|
|
239
242
|
return { childrenReadLive: fact };
|
|
240
243
|
}
|
|
244
|
+
function readProjectFact(fact) {
|
|
245
|
+
const { id, source } = typeof fact === "object" && fact !== null ? fact : { id: undefined, source: undefined };
|
|
246
|
+
if (typeof id !== "string" || id.length === 0 || (source !== "marker" && source !== "declared")) {
|
|
247
|
+
throw new Error(`the project wiring fact is inconsistent (${JSON.stringify(fact)}) — id must be a non-empty string and source "marker"|"declared"`);
|
|
248
|
+
}
|
|
249
|
+
return { id, source };
|
|
250
|
+
}
|
|
251
|
+
function readProjectMarkerUnreadableFact(fact) {
|
|
252
|
+
const { reason, markerPath } = typeof fact === "object" && fact !== null ? fact : { reason: undefined, markerPath: undefined };
|
|
253
|
+
if (typeof reason !== "string" || !PROJECT_MARKER_UNREADABLE_REASONS.includes(reason)) {
|
|
254
|
+
throw new Error(`the projectMarkerUnreadable wiring fact is inconsistent (${JSON.stringify(fact)}) — reason must be one of ${PROJECT_MARKER_UNREADABLE_REASONS.join("|")}`);
|
|
255
|
+
}
|
|
256
|
+
if (reason === "repo_root_unreadable") {
|
|
257
|
+
if (markerPath !== undefined) {
|
|
258
|
+
throw new Error(`the projectMarkerUnreadable wiring fact is inconsistent (${JSON.stringify(fact)}) — markerPath must be omitted for repo_root_unreadable`);
|
|
259
|
+
}
|
|
260
|
+
return { reason };
|
|
261
|
+
}
|
|
262
|
+
if (markerPath !== undefined && (typeof markerPath !== "string" || markerPath.length === 0)) {
|
|
263
|
+
throw new Error(`the projectMarkerUnreadable wiring fact is inconsistent (${JSON.stringify(fact)}) — markerPath must be a non-empty string or omitted`);
|
|
264
|
+
}
|
|
265
|
+
const shown = markerPath !== undefined ? codedDetailStringOf(markerPath) : undefined;
|
|
266
|
+
return shown !== undefined ? { reason: reason, markerPath: shown } : { reason: reason };
|
|
267
|
+
}
|
|
241
268
|
export function deriveWiringManifest(facts) {
|
|
242
269
|
if (facts.half === "static" && (facts.leg !== undefined || facts.runOrigin !== undefined)) {
|
|
243
270
|
throw new Error("a static wiring manifest has no leg — leg identity (its kind and its run origin) is an effective-half fact");
|
|
@@ -252,6 +279,9 @@ export function deriveWiringManifest(facts) {
|
|
|
252
279
|
if (facts.forcedGateNotResumable === true && (facts.half !== "effective" || facts.parkLegNotResumable !== true)) {
|
|
253
280
|
throw new Error("the wiring facts are inconsistent (forcedGateNotResumable) — the forced gate's refusal stands only on an effective half whose leg cannot be resumed (parkLegNotResumable)");
|
|
254
281
|
}
|
|
282
|
+
if (facts.half === "effective" && facts.project !== undefined && facts.projectMarkerUnreadable !== undefined) {
|
|
283
|
+
throw new Error("the wiring facts are inconsistent (project and projectMarkerUnreadable) — a leg cannot carry both a project verdict and an unreadable-marker fact");
|
|
284
|
+
}
|
|
255
285
|
const parkLane = deriveParkLane(facts);
|
|
256
286
|
const questionChannel = facts.questionWired
|
|
257
287
|
? "wired"
|
|
@@ -331,6 +361,8 @@ export function deriveWiringManifest(facts) {
|
|
|
331
361
|
...(facts.half === "effective" && facts.sessionRulesChildrenReadLive !== undefined ? { sessionRules: readSessionRulesFact(facts.sessionRulesChildrenReadLive) } : {}),
|
|
332
362
|
...(facts.half === "effective" && facts.advisor !== undefined ? { advisor: { ...facts.advisor, ...(facts.advisor.hold !== undefined ? { hold: { ...facts.advisor.hold } } : {}) } } : {}),
|
|
333
363
|
...(facts.half === "effective" && facts.hostFloor !== undefined ? { hostFloor: { onlyMode: facts.hostFloor.onlyMode, denyCount: facts.hostFloor.denyCount, onlyCount: facts.hostFloor.onlyCount } } : {}),
|
|
364
|
+
...(facts.half === "effective" && facts.project !== undefined ? { project: readProjectFact(facts.project) } : {}),
|
|
365
|
+
...(facts.half === "effective" && facts.projectMarkerUnreadable !== undefined ? { projectMarkerUnreadable: readProjectMarkerUnreadableFact(facts.projectMarkerUnreadable) } : {}),
|
|
334
366
|
...(facts.half === "effective" && facts.teamRole !== undefined ? { teamRole: facts.teamRole } : {}),
|
|
335
367
|
...(facts.half === "effective" && facts.peerPresence !== undefined && (facts.peerPresence.agent !== undefined || facts.peerPresence.intent !== undefined)
|
|
336
368
|
? { peerPresence: { ...(facts.peerPresence.agent !== undefined ? { agent: facts.peerPresence.agent } : {}), ...(facts.peerPresence.intent !== undefined ? { intent: facts.peerPresence.intent } : {}) } }
|
|
@@ -422,7 +454,11 @@ export function screenInteractionPostureWord(posture) {
|
|
|
422
454
|
e.code = "config.interaction_posture";
|
|
423
455
|
throw e;
|
|
424
456
|
}
|
|
425
|
-
export function describeStaticWiring(deps,
|
|
457
|
+
export function describeStaticWiring(deps, handed = {}, statement = {}) {
|
|
458
|
+
const read = readCallerSpec(handed);
|
|
459
|
+
if (read.refusal !== undefined)
|
|
460
|
+
throw read.refusal;
|
|
461
|
+
const spec = read.spec;
|
|
426
462
|
const ask = resolveAskSeamForm(spec, deps);
|
|
427
463
|
const question = resolveQuestionSeam(spec, deps);
|
|
428
464
|
const checkpointStore = resolveCheckpointStore(spec, deps);
|
|
@@ -13,7 +13,7 @@ export declare function bashExecutionToText(msg: BashExecutionMessage): string;
|
|
|
13
13
|
* drives the wrapper's scale disclosure; omitted ⇒ the wrapper stays byte-identical.
|
|
14
14
|
* `unsummarizedMessages` (PTL-shortfall accounting): how many of those the summary does NOT cover
|
|
15
15
|
* (input shed by a reactive prompt-too-long retry); omitted / 0 ⇒ no uncovered clause. */
|
|
16
|
-
export declare function createCompactionSummaryMessage(summary: string, tokensBefore: number, timestamp: string, elidedMessages?: number, unsummarizedMessages?: number): CompactionSummaryMessage;
|
|
16
|
+
export declare function createCompactionSummaryMessage(summary: string, tokensBefore: number, timestamp: string, elidedMessages?: number, unsummarizedMessages?: number, entryId?: string): CompactionSummaryMessage;
|
|
17
17
|
/** Build a custom transcript message that can be shown and replayed into context. */
|
|
18
18
|
export declare function createCustomMessage(customType: string, content: string | (TextContent | ImageContent)[], display: boolean, details: unknown, timestamp: string): CustomMessage;
|
|
19
19
|
/** Prefix stamped on a salvaged block so readers (model, summaries, humans) see it is a normalization
|
|
@@ -38,7 +38,7 @@ export function bashExecutionToText(msg) {
|
|
|
38
38
|
}
|
|
39
39
|
return text;
|
|
40
40
|
}
|
|
41
|
-
export function createCompactionSummaryMessage(summary, tokensBefore, timestamp, elidedMessages, unsummarizedMessages) {
|
|
41
|
+
export function createCompactionSummaryMessage(summary, tokensBefore, timestamp, elidedMessages, unsummarizedMessages, entryId) {
|
|
42
42
|
return {
|
|
43
43
|
role: "compactionSummary",
|
|
44
44
|
summary,
|
|
@@ -46,6 +46,7 @@ export function createCompactionSummaryMessage(summary, tokensBefore, timestamp,
|
|
|
46
46
|
timestamp: requireSessionTimestampMs(timestamp, "compaction summary timestamp"),
|
|
47
47
|
...(elidedMessages !== undefined ? { elidedMessages } : {}),
|
|
48
48
|
...(unsummarizedMessages !== undefined ? { unsummarizedMessages } : {}),
|
|
49
|
+
...(entryId !== undefined ? { entryId } : {}),
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
export function createCustomMessage(customType, content, display, details, timestamp) {
|
|
@@ -743,6 +743,7 @@ export interface CompactionSummaryMessage {
|
|
|
743
743
|
tokensAfter?: number;
|
|
744
744
|
/** Optional first retained entry id from the compaction range. */
|
|
745
745
|
firstKeptEntryId?: string;
|
|
746
|
+
entryId?: string;
|
|
746
747
|
/** Optional implementation-specific compaction metadata. */
|
|
747
748
|
details?: unknown;
|
|
748
749
|
}
|
|
@@ -854,6 +855,7 @@ export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = unk
|
|
|
854
855
|
* keyed by the folded-away spelling must stay inert rather than land on the other tool. Absent on non-MCP tools.
|
|
855
856
|
*/
|
|
856
857
|
mcpRemoteName?: string;
|
|
858
|
+
peerRegistration?: string;
|
|
857
859
|
/**
|
|
858
860
|
* The MCP server's own read-only declaration (`annotations.readOnlyHint === true` on its tools/list entry), set by
|
|
859
861
|
* the MCP materializer. It answers ONE question: whether the `plan` mode leaves the tool to run (the reference's
|
|
@@ -91,7 +91,7 @@ export function buildSessionContext(pathEntries, opts) {
|
|
|
91
91
|
retainedSkills = budgetInvokedSkillsRetention(retainedSkills, budgetChars);
|
|
92
92
|
}
|
|
93
93
|
const retainedSkillsBlock = renderInvokedSkillsRetention(retainedSkills);
|
|
94
|
-
messages.push(asAgentMessage(createCompactionSummaryMessage(compaction.summary + retainedSkillsBlock, compaction.tokensBefore, compaction.timestamp, readElidedMessages(compaction.details), readUnsummarizedMessages(compaction.details))));
|
|
94
|
+
messages.push(asAgentMessage(createCompactionSummaryMessage(compaction.summary + retainedSkillsBlock, compaction.tokensBefore, compaction.timestamp, readElidedMessages(compaction.details), readUnsummarizedMessages(compaction.details), compaction.id)));
|
|
95
95
|
const compactionIdx = pathEntries.findIndex((e) => e.type === "compaction" && e.id === compaction.id);
|
|
96
96
|
let foundFirstKept = false;
|
|
97
97
|
for (let i = 0; i < compactionIdx; i++) {
|