@sema-agent/core 7.63.0 → 7.65.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 +725 -0
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/cc-peer-wire.d.ts +4 -0
- package/dist/agents/cc-peer-wire.js +1 -0
- package/dist/agents/cc-uds-peer-channel.js +5 -0
- package/dist/agents/cross-session-judge.d.ts +3 -1
- package/dist/agents/cross-session-judge.js +4 -1
- package/dist/agents/peer-directory.d.ts +8 -0
- package/dist/agents/peer-directory.js +4 -0
- package/dist/agents/peer-held-queue.d.ts +9 -3
- package/dist/agents/peer-held-queue.js +12 -9
- package/dist/agents/peer-idle.d.ts +20 -1
- package/dist/agents/peer-idle.js +23 -12
- package/dist/agents/peer-notice-route.d.ts +16 -5
- package/dist/agents/peer-notice-route.js +11 -9
- package/dist/agents/peer-notices.d.ts +25 -8
- package/dist/agents/peer-notices.js +6 -1
- package/dist/agents/peer-session-drain.d.ts +32 -6
- package/dist/agents/peer-session-drain.js +100 -26
- package/dist/agents/send-message-tool.d.ts +7 -0
- package/dist/agents/send-message-tool.js +18 -6
- package/dist/agents/subagent.js +25 -5
- package/dist/core/allow-entry.d.ts +4 -0
- package/dist/core/ask-origin.d.ts +1 -1
- package/dist/core/ask-origin.js +2 -2
- package/dist/core/ask-unresolvable-notice.d.ts +13 -4
- package/dist/core/ask-unresolvable-notice.js +10 -3
- package/dist/core/auto-compaction.d.ts +7 -5
- package/dist/core/auto-promote.d.ts +3 -2
- package/dist/core/background-agent-store.d.ts +14 -0
- package/dist/core/background-agent-store.js +3 -0
- package/dist/core/checkpoint-queries.d.ts +9 -6
- package/dist/core/checkpoint-queries.js +8 -3
- package/dist/core/checkpoint-store.d.ts +7 -4
- package/dist/core/context-settings.d.ts +39 -9
- package/dist/core/context-settings.js +32 -10
- package/dist/core/engine-attestation.d.ts +26 -6
- package/dist/core/engine-attestation.js +5 -1
- package/dist/core/engine-notice.d.ts +37 -2
- package/dist/core/engine-notice.js +3 -1
- package/dist/core/extension-requester.d.ts +9 -0
- package/dist/core/extension-requester.js +7 -0
- package/dist/core/file-history-store.d.ts +30 -2
- package/dist/core/file-history-store.js +48 -9
- package/dist/core/fs-write-gate-policy.js +1 -1
- package/dist/core/gate-fold.js +5 -1
- package/dist/core/gate-lanes.js +2 -0
- package/dist/core/gate-outcome.d.ts +39 -2
- package/dist/core/gate-outcome.js +20 -1
- package/dist/core/governance-codes.d.ts +8 -4
- package/dist/core/governance-codes.js +8 -3
- package/dist/core/leg-identity.d.ts +35 -1
- package/dist/core/leg-identity.js +10 -0
- package/dist/core/mailbox-store.d.ts +39 -4
- package/dist/core/mailbox-store.js +14 -2
- package/dist/core/memory-engine/consolidation.d.ts +13 -6
- package/dist/core/memory-engine/consolidation.js +26 -0
- package/dist/core/memory-engine/control-objects.d.ts +58 -0
- package/dist/core/memory-engine/control-objects.js +273 -0
- package/dist/core/memory-engine/control-plane-adoption.d.ts +51 -0
- package/dist/core/memory-engine/control-plane-adoption.js +161 -0
- package/dist/core/memory-engine/delegation-settlement.d.ts +73 -40
- package/dist/core/memory-engine/delegation-settlement.js +271 -107
- package/dist/core/memory-engine/dual-root.d.ts +3 -2
- package/dist/core/memory-engine/dual-root.js +7 -3
- package/dist/core/memory-engine/engine.d.ts +54 -33
- package/dist/core/memory-engine/engine.js +150 -157
- package/dist/core/memory-engine/file-backend.d.ts +58 -76
- package/dist/core/memory-engine/file-backend.js +111 -268
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +135 -50
- package/dist/core/memory-engine/layout.js +214 -89
- package/dist/core/memory-engine/memory-age.d.ts +12 -0
- package/dist/core/memory-engine/memory-age.js +17 -0
- package/dist/core/memory-engine/memory-backend-contract.d.ts +10 -3
- package/dist/core/memory-engine/memory-backend-contract.js +159 -2
- package/dist/core/memory-engine/memory-deployment.d.ts +12 -4
- package/dist/core/memory-engine/memory-deployment.js +31 -6
- package/dist/core/memory-engine/origin-clearance.d.ts +12 -3
- package/dist/core/memory-engine/origin-clearance.js +64 -9
- package/dist/core/memory-engine/session-write-home.d.ts +34 -1
- package/dist/core/memory-engine/session-write-home.js +37 -10
- package/dist/core/memory-engine/tools.d.ts +2 -2
- package/dist/core/memory-engine/tools.js +7 -7
- package/dist/core/memory-engine/types.d.ts +55 -12
- package/dist/core/memory-engine/types.js +2 -1
- package/dist/core/memory-vector.d.ts +6 -14
- package/dist/core/memory.d.ts +0 -462
- package/dist/core/memory.js +0 -333
- package/dist/core/mode-policy.js +3 -3
- package/dist/core/mods/agent-stations.d.ts +18 -0
- package/dist/core/mods/agent-stations.js +8 -6
- package/dist/core/mods/extension-call.d.ts +4 -0
- package/dist/core/mods/extension-call.js +8 -0
- package/dist/core/mods/tool-call.js +3 -4
- package/dist/core/parent-spec-seat.d.ts +2 -2
- package/dist/core/peer-channel.d.ts +5 -0
- package/dist/core/permission-rule-consent.d.ts +64 -22
- package/dist/core/permission-rule-consent.js +106 -58
- package/dist/core/permission-rule-store.d.ts +56 -21
- package/dist/core/permission-rule-store.js +2 -0
- package/dist/core/refusal-echo.d.ts +20 -0
- package/dist/core/refusal-echo.js +33 -0
- package/dist/core/retention.d.ts +175 -10
- package/dist/core/retention.js +44 -0
- package/dist/core/retired-keys.d.ts +5 -0
- package/dist/core/retired-keys.js +3 -0
- package/dist/core/rule-offer-read.d.ts +0 -4
- package/dist/core/rule-offer-read.js +2 -18
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +4 -2
- package/dist/core/runner/compact-session.js +10 -7
- package/dist/core/runner/compaction-call-options.d.ts +7 -7
- package/dist/core/runner/compaction-call-options.js +3 -2
- package/dist/core/runner/contracts.d.ts +28 -9
- package/dist/core/runner/delegation-owner.d.ts +2 -3
- package/dist/core/runner/delegation-owner.js +2 -1
- package/dist/core/runner/gate-exit.d.ts +6 -0
- package/dist/core/runner/gate-exit.js +11 -2
- package/dist/core/runner/memory-consolidation-driver.d.ts +4 -2
- package/dist/core/runner/memory-consolidation-driver.js +8 -5
- package/dist/core/runner/prepare-ask-lane.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -2
- package/dist/core/runner/prepare-config-doors.js +4 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +2 -2
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -0
- package/dist/core/runner/prepare-gate-stations.js +15 -7
- package/dist/core/runner/prepare-hands-readface.js +1 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +3 -1
- package/dist/core/runner/prepare-inherited-gate.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +22 -28
- package/dist/core/runner/prepare-policy-chain.js +18 -10
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-task.d.ts +5 -1
- package/dist/core/runner/prepare-task.js +16 -11
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/resume-admission.d.ts +2 -2
- package/dist/core/runner/resume-admission.js +2 -23
- package/dist/core/runner/role-resolution-table.d.ts +98 -0
- package/dist/core/runner/role-resolution-table.js +62 -0
- package/dist/core/runner/run-compaction-machinery.js +2 -2
- package/dist/core/runner/run-identity-wiring.js +12 -9
- package/dist/core/runner/run-leg.js +8 -4
- package/dist/core/runner/run-notification-lane.js +23 -23
- package/dist/core/runner/run-recovery-lanes.js +3 -3
- package/dist/core/runner/run-terminal-adoption.js +1 -1
- package/dist/core/runner/run-turn-boundary.js +14 -15
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/runner/sub-agent-deny-lists.d.ts +19 -0
- package/dist/core/runner/sub-agent-deny-lists.js +25 -0
- package/dist/core/runner/tool-occurrence.d.ts +4 -2
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner-deps.d.ts +1 -1
- package/dist/core/secret-env.d.ts +2 -2
- package/dist/core/secret-env.js +6 -20
- package/dist/core/session-checkout.d.ts +63 -3
- package/dist/core/session-checkout.js +152 -58
- package/dist/core/session-store.d.ts +6 -6
- package/dist/core/session-store.js +3 -3
- package/dist/core/shell-read-silence.js +8 -0
- package/dist/core/store-contracts/background-agent-store-contract.js +13 -0
- package/dist/core/store-contracts/peer-directory-contract.js +8 -1
- package/dist/core/task-event.d.ts +9 -5
- package/dist/core/task-notification.d.ts +137 -31
- package/dist/core/task-notification.js +198 -100
- package/dist/core/task-registry-agent.d.ts +11 -0
- package/dist/core/task-registry-agent.js +12 -3
- package/dist/core/task-registry-shared.d.ts +11 -0
- package/dist/core/task-registry.d.ts +18 -0
- package/dist/core/task-registry.js +27 -8
- package/dist/core/task-spec.d.ts +7 -2
- package/dist/core/tool-errors.d.ts +17 -9
- package/dist/core/tool-errors.js +1 -1
- package/dist/core/tool-policy.d.ts +18 -1
- package/dist/core/tool-policy.js +16 -7
- package/dist/core/tool-result-store.d.ts +20 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/trace.d.ts +3 -2
- package/dist/core/workflow-journal-store.d.ts +11 -0
- package/dist/core/workflow-journal-store.js +7 -0
- package/dist/core/workflow-run-store.d.ts +9 -0
- package/dist/core/workflow-run-store.js +6 -0
- package/dist/core/write-protect.d.ts +16 -0
- package/dist/core/write-protect.js +10 -0
- package/dist/engine/compaction/compaction.d.ts +2 -1
- package/dist/engine/harness/types.d.ts +1 -0
- package/dist/engine/session/repo-utils.d.ts +14 -4
- package/dist/engine/session/repo-utils.js +5 -4
- package/dist/engine/session/session.d.ts +7 -1
- package/dist/engine/session/session.js +5 -2
- package/dist/index.d.ts +13 -11
- package/dist/index.js +13 -11
- package/dist/orchestration/run-workflow-tool.d.ts +4 -0
- package/dist/orchestration/run-workflow-tool.js +7 -0
- package/dist/orchestration/workflow-types.d.ts +2 -1
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +2 -1
- package/dist/prompts/default.d.ts +1 -2
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/stores/file/adoption/adopt.d.ts +1 -1
- package/dist/stores/file/checkpoint-store.d.ts +6 -0
- package/dist/stores/file/checkpoint-store.js +4 -1
- package/dist/stores/file/file-history-store.d.ts +13 -0
- package/dist/stores/file/file-history-store.js +75 -13
- package/dist/stores/file/index.d.ts +12 -16
- package/dist/stores/file/index.js +7 -25
- package/dist/stores/file/permission-rule-store.d.ts +34 -0
- package/dist/stores/file/permission-rule-store.js +104 -9
- package/dist/stores/file/session-store.js +1 -1
- package/dist/stores/file/tool-result-store.d.ts +14 -0
- package/dist/stores/file/tool-result-store.js +39 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -0
- package/dist/stores/file/workflow-journal-store.js +17 -0
- package/dist/stores/file/workflow-run-store.d.ts +3 -0
- package/dist/stores/file/workflow-run-store.js +15 -0
- package/dist/tools/fs/read-deny.d.ts +15 -2
- package/dist/tools/fs/read-deny.js +10 -2
- package/dist/tools/fs/shell-read-check.d.ts +8 -2
- package/dist/tools/fs/shell-read-check.js +7 -7
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +71 -73
- package/wire-changes/core-stores-sql@7.64.0.json +30 -0
- package/wire-changes/core-stores-sql@7.65.0.json +30 -0
- package/wire-changes/core@7.64.0.json +2653 -0
- package/wire-changes/core@7.65.0.json +1650 -0
- package/wire-changes/mods-kernel@7.64.0.json +30 -0
- package/wire-changes/mods-kernel@7.65.0.json +30 -0
- package/wire-changes/primitives@7.64.0.json +30 -0
- package/wire-changes/primitives@7.65.0.json +337 -0
- package/dist/core/memory-recall.d.ts +0 -208
- package/dist/core/memory-recall.js +0 -136
- package/dist/stores/file/memory-store.d.ts +0 -124
- package/dist/stores/file/memory-store.js +0 -353
package/dist/core/memory.js
CHANGED
|
@@ -1,44 +1,7 @@
|
|
|
1
|
-
import { uuidv7 } from "../internal/harness.js";
|
|
2
1
|
import { parseScopeKey } from "./memory-engine/scope-contract.js";
|
|
3
|
-
import { termSet } from "./memory-vector.js";
|
|
4
2
|
import { attrEscape } from "./task-notification.js";
|
|
5
3
|
import { sanitizeUntrustedText, ENGINE_AUTHORITY_ENVELOPE_TAGS } from "./untrusted-text.js";
|
|
6
|
-
import { thrownText } from "./thrown-value.js";
|
|
7
4
|
import { CREDENTIAL_VOCABULARY, scanSecrets } from "@sema-agent/primitives";
|
|
8
|
-
export function supportsConsolidation(store) {
|
|
9
|
-
return (typeof store.searchScored === "function" &&
|
|
10
|
-
typeof store.update === "function" &&
|
|
11
|
-
typeof store.delete === "function");
|
|
12
|
-
}
|
|
13
|
-
export function supportsPeriodicConsolidation(store) {
|
|
14
|
-
return (typeof store.getConsolidationCursor === "function" &&
|
|
15
|
-
typeof store.setConsolidationCursor === "function");
|
|
16
|
-
}
|
|
17
|
-
export const CALLER_AUTHORED_TYPES = new Set(["user", "feedback", "project", "reference"]);
|
|
18
|
-
export const DEFAULT_CALLER_AUTHORED_TYPE = "project";
|
|
19
|
-
export class MemoryGateError extends Error {
|
|
20
|
-
code;
|
|
21
|
-
constructor(code, detail) {
|
|
22
|
-
super(detail ? `${code}: ${detail}` : code);
|
|
23
|
-
this.name = "MemoryGateError";
|
|
24
|
-
this.code = code;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export class MemoryProjectionError extends Error {
|
|
28
|
-
code = "memory.projection_failed";
|
|
29
|
-
committed = true;
|
|
30
|
-
path;
|
|
31
|
-
constructor(path, cause) {
|
|
32
|
-
const detail = thrownText(cause);
|
|
33
|
-
super(`memory.projection_failed: the note IS durably committed — only the derived projection ${path} could not be rewritten: ${detail}. ` +
|
|
34
|
-
`Do not retry the write (it would store the note twice); the projection is rebuilt by the next mutation of this scope.`, cause !== undefined ? { cause } : undefined);
|
|
35
|
-
this.name = "MemoryProjectionError";
|
|
36
|
-
this.path = path;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function hasPromotableMarker(note) {
|
|
40
|
-
return note.outcomeStats !== undefined;
|
|
41
|
-
}
|
|
42
5
|
const REFUSE_WRITE_POLICY = Object.freeze({
|
|
43
6
|
grade: "strict",
|
|
44
7
|
readings: Object.freeze([Object.freeze({ kind: "raw" })]),
|
|
@@ -58,308 +21,12 @@ export function detectSecret(text) {
|
|
|
58
21
|
return refuseLabel(row.id);
|
|
59
22
|
return null;
|
|
60
23
|
}
|
|
61
|
-
export function enforceSecretWriteGate(body) {
|
|
62
|
-
const label = detectSecret(body);
|
|
63
|
-
if (label !== null) {
|
|
64
|
-
throw new MemoryGateError("memory.secret_detected", `memory write blocked: detected ${label}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
export function enforceStructuredNoteSecretGate(note) {
|
|
68
|
-
enforceSecretWriteGate(note.body);
|
|
69
|
-
if (note.name !== undefined)
|
|
70
|
-
enforceSecretWriteGate(note.name);
|
|
71
|
-
if (note.description !== undefined)
|
|
72
|
-
enforceSecretWriteGate(note.description);
|
|
73
|
-
if (note.type !== undefined)
|
|
74
|
-
enforceSecretWriteGate(note.type);
|
|
75
|
-
}
|
|
76
|
-
export function classifyPromotable(note) {
|
|
77
|
-
if (hasPromotableMarker(note))
|
|
78
|
-
return "promotable";
|
|
79
|
-
if (note.type !== undefined && !CALLER_AUTHORED_TYPES.has(note.type))
|
|
80
|
-
return "promotable";
|
|
81
|
-
return "caller_authored";
|
|
82
|
-
}
|
|
83
|
-
export function enforcePromotableWriteGate(note, utilityVerdict, utilityGate) {
|
|
84
|
-
if (classifyPromotable(note) === "caller_authored")
|
|
85
|
-
return;
|
|
86
|
-
if (utilityVerdict === undefined) {
|
|
87
|
-
throw new MemoryGateError("memory.promotable_ungated", "promotable memory write requires a utilityVerdict");
|
|
88
|
-
}
|
|
89
|
-
if (utilityGate === undefined) {
|
|
90
|
-
throw new MemoryGateError("memory.promotable_ungated", "promotable memory write but profile utilityGate is unwired");
|
|
91
|
-
}
|
|
92
|
-
if (!utilityGate(note.outcomeStats)) {
|
|
93
|
-
throw new MemoryGateError("memory.promotable_ungated", "promotable memory write failed the profile utilityGate");
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function stripConsolidationGenerated(note) {
|
|
97
|
-
if (note.consolidationGenerated === undefined)
|
|
98
|
-
return note;
|
|
99
|
-
const { consolidationGenerated: _drop, ...rest } = note;
|
|
100
|
-
return rest;
|
|
101
|
-
}
|
|
102
|
-
export function guardedMemoryStore(inner, utilityGate) {
|
|
103
|
-
const guarded = {
|
|
104
|
-
get vectorMode() {
|
|
105
|
-
return inner.vectorMode;
|
|
106
|
-
},
|
|
107
|
-
read: (scope) => inner.read(scope),
|
|
108
|
-
clear: (scope) => inner.clear(scope),
|
|
109
|
-
append: (scope, note) => {
|
|
110
|
-
enforceSecretWriteGate(note);
|
|
111
|
-
return inner.append(scope, note);
|
|
112
|
-
},
|
|
113
|
-
appendStructured: inner.appendStructured
|
|
114
|
-
? (scope, note) => {
|
|
115
|
-
enforceStructuredNoteSecretGate(note);
|
|
116
|
-
enforcePromotableWriteGate(note, undefined, utilityGate);
|
|
117
|
-
return inner.appendStructured(scope, stripConsolidationGenerated(note));
|
|
118
|
-
}
|
|
119
|
-
: undefined,
|
|
120
|
-
appendConsolidationGenerated: inner.appendStructured
|
|
121
|
-
? (scope, note) => {
|
|
122
|
-
enforceStructuredNoteSecretGate(note);
|
|
123
|
-
enforcePromotableWriteGate(note, undefined, utilityGate);
|
|
124
|
-
const withMarker = { ...note, consolidationGenerated: true };
|
|
125
|
-
if (inner.appendConsolidationGenerated)
|
|
126
|
-
return inner.appendConsolidationGenerated(scope, withMarker);
|
|
127
|
-
return inner.appendStructured(scope, withMarker);
|
|
128
|
-
}
|
|
129
|
-
: undefined,
|
|
130
|
-
appendPromotable: (scope, note, utilityVerdict) => {
|
|
131
|
-
enforceStructuredNoteSecretGate(note);
|
|
132
|
-
enforcePromotableWriteGate(note, utilityVerdict, utilityGate);
|
|
133
|
-
if (inner.appendPromotable)
|
|
134
|
-
return inner.appendPromotable(scope, note, utilityVerdict);
|
|
135
|
-
if (inner.appendStructured)
|
|
136
|
-
return inner.appendStructured(scope, note);
|
|
137
|
-
return inner.append(scope, note.body);
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
if (inner.search)
|
|
141
|
-
guarded.search = (scope, query, limit) => inner.search(scope, query, limit);
|
|
142
|
-
if (inner.searchScored)
|
|
143
|
-
guarded.searchScored = (scope, query, limit) => inner.searchScored(scope, query, limit);
|
|
144
|
-
if (inner.update)
|
|
145
|
-
guarded.update = (scope, id, text) => {
|
|
146
|
-
enforceSecretWriteGate(text);
|
|
147
|
-
return inner.update(scope, id, text);
|
|
148
|
-
};
|
|
149
|
-
if (inner.delete)
|
|
150
|
-
guarded.delete = (scope, id) => inner.delete(scope, id);
|
|
151
|
-
if (inner.listStructuredNotes)
|
|
152
|
-
guarded.listStructuredNotes = (scope) => inner.listStructuredNotes(scope);
|
|
153
|
-
if (inner.getByIds)
|
|
154
|
-
guarded.getByIds = (scope, ids) => inner.getByIds(scope, ids);
|
|
155
|
-
if (inner.getConsolidationCursor)
|
|
156
|
-
guarded.getConsolidationCursor = (scope) => inner.getConsolidationCursor(scope);
|
|
157
|
-
if (inner.setConsolidationCursor)
|
|
158
|
-
guarded.setConsolidationCursor = (scope, cursor) => inner.setConsolidationCursor(scope, cursor);
|
|
159
|
-
return guarded;
|
|
160
|
-
}
|
|
161
|
-
function renderBullet(e) {
|
|
162
|
-
return `- (${e.ts} UTC) ${e.text}`;
|
|
163
|
-
}
|
|
164
|
-
export class InMemoryMemoryStore {
|
|
165
|
-
byScope = new Map();
|
|
166
|
-
cursorByScope = new Map();
|
|
167
|
-
vectorMode = "lexical";
|
|
168
|
-
read(scope) {
|
|
169
|
-
const entries = this.byScope.get(scope);
|
|
170
|
-
if (!entries || entries.length === 0) {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
return entries.map(renderBullet).join("\n");
|
|
174
|
-
}
|
|
175
|
-
append(scope, note) {
|
|
176
|
-
const text = note.trim().replace(/^#+\s*/, "");
|
|
177
|
-
if (!text) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const ts = new Date().toISOString().replace("T", " ").slice(0, 16);
|
|
181
|
-
const entry = { id: uuidv7(), text, ts };
|
|
182
|
-
const arr = this.byScope.get(scope) ?? [];
|
|
183
|
-
arr.push(entry);
|
|
184
|
-
this.byScope.set(scope, arr);
|
|
185
|
-
return entry.id;
|
|
186
|
-
}
|
|
187
|
-
appendStructured(scope, note) {
|
|
188
|
-
const body = note.body.trim().replace(/^#+\s*/, "");
|
|
189
|
-
if (!body)
|
|
190
|
-
return "";
|
|
191
|
-
const ts = new Date().toISOString().replace("T", " ").slice(0, 16);
|
|
192
|
-
const entry = {
|
|
193
|
-
id: uuidv7(),
|
|
194
|
-
text: body,
|
|
195
|
-
ts,
|
|
196
|
-
name: note.name,
|
|
197
|
-
type: note.type ?? "project",
|
|
198
|
-
description: note.description?.trim() || firstSentence(body),
|
|
199
|
-
links: note.links,
|
|
200
|
-
...(note.consolidationGenerated ? { consolidationGenerated: true } : {}),
|
|
201
|
-
};
|
|
202
|
-
const arr = this.byScope.get(scope) ?? [];
|
|
203
|
-
arr.push(entry);
|
|
204
|
-
this.byScope.set(scope, arr);
|
|
205
|
-
return entry.id;
|
|
206
|
-
}
|
|
207
|
-
clear(scope) {
|
|
208
|
-
this.byScope.delete(scope);
|
|
209
|
-
this.cursorByScope.delete(scope);
|
|
210
|
-
}
|
|
211
|
-
search(scope, query, limit = 10) {
|
|
212
|
-
const entries = this.byScope.get(scope);
|
|
213
|
-
if (!entries || entries.length === 0) {
|
|
214
|
-
return [];
|
|
215
|
-
}
|
|
216
|
-
return entries
|
|
217
|
-
.map(renderBullet)
|
|
218
|
-
.filter((b) => lexicalSearchMatch(query, b))
|
|
219
|
-
.slice(-limit);
|
|
220
|
-
}
|
|
221
|
-
searchScored(scope, query, limit = 20) {
|
|
222
|
-
const entries = this.byScope.get(scope);
|
|
223
|
-
if (!entries || entries.length === 0) {
|
|
224
|
-
return [];
|
|
225
|
-
}
|
|
226
|
-
const q = termSet(query);
|
|
227
|
-
if (q.size === 0) {
|
|
228
|
-
return [];
|
|
229
|
-
}
|
|
230
|
-
const scored = [];
|
|
231
|
-
for (const e of entries) {
|
|
232
|
-
const t = termSet(e.text);
|
|
233
|
-
let inter = 0;
|
|
234
|
-
for (const term of q) {
|
|
235
|
-
if (t.has(term))
|
|
236
|
-
inter++;
|
|
237
|
-
}
|
|
238
|
-
const union = q.size + t.size - inter;
|
|
239
|
-
const jaccard = union === 0 ? 0 : inter / union;
|
|
240
|
-
if (jaccard === 0)
|
|
241
|
-
continue;
|
|
242
|
-
scored.push({ id: e.id, text: e.text, score: 1 - jaccard, ...(e.consolidationGenerated ? { consolidationGenerated: true } : {}) });
|
|
243
|
-
}
|
|
244
|
-
scored.sort((a, b) => a.score - b.score);
|
|
245
|
-
return scored.slice(0, limit);
|
|
246
|
-
}
|
|
247
|
-
update(scope, id, text) {
|
|
248
|
-
const clean = text.trim();
|
|
249
|
-
if (!clean) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
const entry = this.byScope.get(scope)?.find((e) => e.id === id);
|
|
253
|
-
if (!entry) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
const newBody = clean.replace(/^#+\s*/, "");
|
|
257
|
-
if (entry.description !== undefined && entry.description === firstSentence(entry.text)) {
|
|
258
|
-
entry.description = firstSentence(newBody);
|
|
259
|
-
}
|
|
260
|
-
entry.text = newBody;
|
|
261
|
-
entry.ts = new Date().toISOString().replace("T", " ").slice(0, 16);
|
|
262
|
-
}
|
|
263
|
-
delete(scope, id) {
|
|
264
|
-
const arr = this.byScope.get(scope);
|
|
265
|
-
if (!arr) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
const i = arr.findIndex((e) => e.id === id);
|
|
269
|
-
if (i !== -1) {
|
|
270
|
-
arr.splice(i, 1);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
listStructuredNotes(scope) {
|
|
274
|
-
const entries = this.byScope.get(scope) ?? [];
|
|
275
|
-
return entries.map((e) => ({
|
|
276
|
-
id: e.id,
|
|
277
|
-
description: e.description ?? firstSentence(e.text),
|
|
278
|
-
...parseNoteTimestamp(e.ts),
|
|
279
|
-
...(e.name ? { name: e.name } : {}),
|
|
280
|
-
...(e.type ? { type: e.type } : {}),
|
|
281
|
-
...(e.consolidationGenerated ? { consolidationGenerated: true } : {}),
|
|
282
|
-
}));
|
|
283
|
-
}
|
|
284
|
-
getConsolidationCursor(scope) {
|
|
285
|
-
return this.cursorByScope.get(scope);
|
|
286
|
-
}
|
|
287
|
-
setConsolidationCursor(scope, cursor) {
|
|
288
|
-
this.cursorByScope.set(scope, cursor);
|
|
289
|
-
}
|
|
290
|
-
getByIds(scope, ids) {
|
|
291
|
-
const entries = this.byScope.get(scope);
|
|
292
|
-
if (!entries)
|
|
293
|
-
return [];
|
|
294
|
-
const want = new Set(ids);
|
|
295
|
-
return entries
|
|
296
|
-
.filter((e) => want.has(e.id))
|
|
297
|
-
.map((e) => ({
|
|
298
|
-
id: e.id,
|
|
299
|
-
text: e.text,
|
|
300
|
-
description: e.description ?? firstSentence(e.text),
|
|
301
|
-
...parseNoteTimestamp(e.ts),
|
|
302
|
-
...(e.name ? { name: e.name } : {}),
|
|
303
|
-
...(e.type ? { type: e.type } : {}),
|
|
304
|
-
...(e.consolidationGenerated ? { consolidationGenerated: true } : {}),
|
|
305
|
-
}));
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
export function expandLexicalTerms(term) {
|
|
309
|
-
const t = term.toLowerCase();
|
|
310
|
-
const out = new Set([t]);
|
|
311
|
-
const stem = lightStem(t);
|
|
312
|
-
const stemOk = stem !== t && stem.length >= 3;
|
|
313
|
-
if (stemOk)
|
|
314
|
-
out.add(stem);
|
|
315
|
-
for (const group of LEXICAL_SYNONYM_GROUPS) {
|
|
316
|
-
if (group.has(t) || (stemOk && group.has(stem)))
|
|
317
|
-
for (const w of group)
|
|
318
|
-
out.add(w);
|
|
319
|
-
}
|
|
320
|
-
return [...out];
|
|
321
|
-
}
|
|
322
|
-
export function lexicalSearchMatch(query, text) {
|
|
323
|
-
const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
324
|
-
if (terms.length === 0)
|
|
325
|
-
return false;
|
|
326
|
-
const lower = text.toLowerCase();
|
|
327
|
-
const tokens = termSet(text);
|
|
328
|
-
return terms.every((t) => {
|
|
329
|
-
const variants = expandLexicalTerms(t);
|
|
330
|
-
return variants.some((v) => v === t ? lower.includes(v) : tokens.has(v));
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
const LEXICAL_SYNONYM_GROUPS = [
|
|
334
|
-
new Set(["auth", "authentication", "authorization", "credentials", "credential", "login", "signin"]),
|
|
335
|
-
new Set(["token", "bearer", "apikey", "secret", "key"]),
|
|
336
|
-
new Set(["password", "passwd", "passphrase", "pwd"]),
|
|
337
|
-
new Set(["delete", "remove", "drop", "erase"]),
|
|
338
|
-
new Set(["config", "configuration", "settings", "setting"]),
|
|
339
|
-
new Set(["error", "failure", "exception", "fault"]),
|
|
340
|
-
new Set(["db", "database"]),
|
|
341
|
-
];
|
|
342
|
-
function lightStem(t) {
|
|
343
|
-
if (t.length > 4 && t.endsWith("ies"))
|
|
344
|
-
return `${t.slice(0, -3)}y`;
|
|
345
|
-
if (t.length > 3 && t.endsWith("es"))
|
|
346
|
-
return t.slice(0, -2);
|
|
347
|
-
if (t.length > 3 && t.endsWith("s") && !t.endsWith("ss"))
|
|
348
|
-
return t.slice(0, -1);
|
|
349
|
-
return t;
|
|
350
|
-
}
|
|
351
24
|
export function firstSentence(text) {
|
|
352
25
|
const t = text.trim().replace(/\s+/g, " ");
|
|
353
26
|
const dot = t.search(/[.!?](\s|$)/);
|
|
354
27
|
const cut = dot >= 0 && dot < 160 ? dot + 1 : Math.min(t.length, 120);
|
|
355
28
|
return t.slice(0, cut).trim();
|
|
356
29
|
}
|
|
357
|
-
export function parseNoteTimestamp(ts) {
|
|
358
|
-
if (typeof ts !== "string" || ts.trim() === "")
|
|
359
|
-
return { mtimeMs: 0, timestampMissing: true };
|
|
360
|
-
const ms = Date.parse(`${ts.replace(" ", "T")}:00Z`);
|
|
361
|
-
return Number.isFinite(ms) ? { mtimeMs: ms } : { mtimeMs: 0, timestampMissing: true };
|
|
362
|
-
}
|
|
363
30
|
export const MEMORY_PROJECT_KEY_ABSENT_REASONS = Object.freeze(["not_git", "bare", "unreadable"]);
|
|
364
31
|
export function normalizeMemorySpec(input) {
|
|
365
32
|
if (!input)
|
package/dist/core/mode-policy.js
CHANGED
|
@@ -76,14 +76,14 @@ export function modeQuestionReaches(mode, roster, toolName, seat) {
|
|
|
76
76
|
}
|
|
77
77
|
const planAsk = (message, call, generic) => {
|
|
78
78
|
const asked = { action: "ask", message, decisionReason: "mode" };
|
|
79
|
-
return generic ? attest(asked, call, {
|
|
79
|
+
return generic !== undefined ? attest(asked, call, { sentence: { text: message, generic: true, ...generic } }) : asked;
|
|
80
80
|
};
|
|
81
81
|
export function createModeGatePolicy(modeRef, seats) {
|
|
82
82
|
const askGate = createFsWriteGatePolicy({ env: seats.env, rootPath: seats.rootPath, defaultWrite: "ask" });
|
|
83
83
|
const acceptSeat = seats.acceptDirs;
|
|
84
84
|
const acceptDirs = typeof acceptSeat === "function" ? acceptSeat : acceptSeat !== undefined && acceptSeat.length > 0 ? [...acceptSeat] : [seats.rootPath];
|
|
85
85
|
const acceptRootGate = createFsWriteGatePolicy({ env: seats.env, rootPath: seats.rootPath, acceptDirs, defaultWrite: "ask" });
|
|
86
|
-
const planGate = createFsWriteGatePolicy({ env: seats.env, rootPath: seats.rootPath, defaultWrite: "ask", defaultAsk: (path, note, call) => planAsk(`Cannot write to ${path} while in plan mode.${note ?? ""}`, call, note === undefined) });
|
|
86
|
+
const planGate = createFsWriteGatePolicy({ env: seats.env, rootPath: seats.rootPath, defaultWrite: "ask", defaultAsk: (path, note, call) => planAsk(`Cannot write to ${path} while in plan mode.${note ?? ""}`, call, note === undefined ? { echoed: [Object.freeze({ kind: "path", value: path })] } : undefined) });
|
|
87
87
|
return {
|
|
88
88
|
async check(req, signal) {
|
|
89
89
|
const gate = modePolicyOf(modeRef.current).writeGate;
|
|
@@ -93,7 +93,7 @@ export function createModeGatePolicy(modeRef, seats) {
|
|
|
93
93
|
if (!planRefusesWrite(req, seats.roster?.current, seats.readOnlyDeclared))
|
|
94
94
|
return { action: "allow" };
|
|
95
95
|
if (!isProtectedWrite(req))
|
|
96
|
-
return planAsk(`Cannot call ${req.toolName} while in plan mode.`, req,
|
|
96
|
+
return planAsk(`Cannot call ${req.toolName} while in plan mode.`, req, {});
|
|
97
97
|
return planGate.check(req, signal);
|
|
98
98
|
}
|
|
99
99
|
return (gate === "ask" ? askGate : acceptRootGate).check(req, signal);
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The delegation's two stations over the delegating leg's bus. `agent.offer`: the agent types the model is offered — ONE set
|
|
3
|
+
* ({@link offeredAgents}) read by the listing and by the dispatch; a handler answers `next(e)` or `{ isOffered: false }`.
|
|
4
|
+
* `agent.spawn`: raised before a delegated subagent is let start, every member pinned; a handler answers `next(e)` or
|
|
5
|
+
* `{ deny: <reason> }` in place of `next`; any other answer, a changed member, a throw or a timeout refuses while the
|
|
6
|
+
* subagent has not started, after which the spawn stands. A revival and an observer leg raise no spawn.
|
|
7
|
+
*
|
|
8
|
+
* `$.agent.spawn({ prompt, ... })` is `agent.spawn` called (the table's `call` column): the host entry
|
|
9
|
+
* ({@link createAgentSpawnEntry}) runs the delegation tool's own per-call pipeline, as `$.tool.call` runs any other tool's — the
|
|
10
|
+
* whole gate, `tool.call`, the delegation (whose `agent.spawn` station is raised once, at its own place), the post-execution
|
|
11
|
+
* stations — as the caller's call, with the subagent in the background. The delegation reads ONE fact of the call
|
|
12
|
+
* ({@link AgentStations.extensionSpawn}, the extension call's own record): an extension's spawn is no offer, and it never holds the
|
|
13
|
+
* foreground; where the delegation lets the subagent run it writes `{ agentId, model }` on the record, and the entry answers off
|
|
14
|
+
* that record alone (never off the call's result, which a post-execution station may withhold after the subagent started).
|
|
15
|
+
*/
|
|
1
16
|
import { type ModCallEntry } from "./kernel/index.js";
|
|
2
17
|
import type { HookInvocationIdentity } from "../hooks.js";
|
|
3
18
|
import type { PermissionMode } from "../ask-origin.js";
|
|
4
19
|
import { type LegModBus } from "./stations.js";
|
|
20
|
+
import type { ExtensionRequester } from "../task-event.js";
|
|
5
21
|
import { type ToolCallEntryInput } from "./tool-call.js";
|
|
6
22
|
/** One agent type as the model is offered it. */
|
|
7
23
|
export interface OfferedAgent {
|
|
@@ -58,6 +74,8 @@ export declare function spawnedModel(model: string | undefined): string;
|
|
|
58
74
|
export interface ExtensionSpawn {
|
|
59
75
|
/** The registration that called `$.agent.spawn`. */
|
|
60
76
|
readonly by: string;
|
|
77
|
+
/** Who asked, as the registry row and the durable record carry it ({@link ExtensionRequester}): this extension, by its registration name. */
|
|
78
|
+
readonly requestedBy: ExtensionRequester;
|
|
61
79
|
/** The subagent was let run under `agentId` — its registry task id, which is its leg's task id and so its events' `agentId`;
|
|
62
80
|
* `model` is the one the delegation settled (`undefined` ⇒ the child's prepare decides). Written once. */
|
|
63
81
|
launched(agentId: string, model: string | undefined): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
1
|
import { ENGINE_ORIGIN } from "./kernel/index.js";
|
|
3
2
|
import { isPlainRecord } from "./kernel/receive.js";
|
|
4
3
|
import { NEXT_IN_FLIGHT } from "./kernel/site-rules.js";
|
|
@@ -7,7 +6,7 @@ import { extensionWords } from "../untrusted-egress.js";
|
|
|
7
6
|
import { declaredDelegationNameOf } from "../delegation-name.js";
|
|
8
7
|
import { failedHandlerClause, seatHears } from "./stations.js";
|
|
9
8
|
import { agentIdOf } from "../leg-identity.js";
|
|
10
|
-
import { extensionCallOf, noteExtensionCallLaunched, runExtensionCall } from "./extension-call.js";
|
|
9
|
+
import { extensionCallOf, isExtensionCallId, mintExtensionCallId, noteExtensionCallLaunched, requesterOf, runExtensionCall } from "./extension-call.js";
|
|
11
10
|
import { resultText } from "./tool-call.js";
|
|
12
11
|
const ENGINE_PROVIDER = Object.freeze({ plugin: ENGINE_ORIGIN.plugin, tier: ENGINE_ORIGIN.tier });
|
|
13
12
|
const OFFERED = Object.freeze({ isOffered: true });
|
|
@@ -53,10 +52,13 @@ export function createAgentStations(input) {
|
|
|
53
52
|
listens: (event) => seatHears(input, event),
|
|
54
53
|
offered: (agents, signal) => offeredAgents(input, agents, signal),
|
|
55
54
|
extensionSpawn: (toolCallId) => {
|
|
56
|
-
|
|
57
|
-
if (call === undefined || call.door !== "agent.spawn" || toolCallId === undefined)
|
|
55
|
+
if (!isExtensionCallId(toolCallId))
|
|
58
56
|
return undefined;
|
|
59
|
-
|
|
57
|
+
const call = extensionCallOf(input.bus, toolCallId);
|
|
58
|
+
const requestedBy = requesterOf(input.bus, toolCallId).requestedBy;
|
|
59
|
+
if (call === undefined || call.door !== "agent.spawn" || requestedBy === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
return { by: call.caller.origin.plugin, requestedBy, launched: (agentId, model) => noteExtensionCallLaunched(input.bus, toolCallId, { agentId, model: spawnedModel(model) }) };
|
|
60
62
|
},
|
|
61
63
|
spawn: async (facts, signal) => {
|
|
62
64
|
if (!seatHears(input, "agent.spawn"))
|
|
@@ -141,7 +143,7 @@ export function createAgentSpawnEntry(input) {
|
|
|
141
143
|
throw new TypeError(`${by}: $.agent.spawn: this run mounts no delegation tool`);
|
|
142
144
|
if (tools.length > 1)
|
|
143
145
|
throw new TypeError(`${by}: $.agent.spawn: this run mounts ${tools.length} delegation tools (${tools.map((n) => `"${extensionWords(n, 80)}"`).join(", ")}) and a spawn names none of them`);
|
|
144
|
-
const toolCallId =
|
|
146
|
+
const toolCallId = mintExtensionCallId();
|
|
145
147
|
return runExtensionCall(input.bus, toolCallId, "agent.spawn", ctx, async (call) => {
|
|
146
148
|
const finalized = await input.harness.callTool({ type: "toolCall", id: toolCallId, name: tool, arguments: delegationInput(args, prompt) }, ctx.signal, () => undefined);
|
|
147
149
|
if (call.launched !== undefined)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type ModBottomContext, type ModBus } from "./kernel/index.js";
|
|
2
2
|
import type { ExtensionRequester } from "../task-event.js";
|
|
3
|
+
/** The id an extension's own call (`$.tool.call`, `$.agent.spawn`) runs under: both doors mint it here. */
|
|
4
|
+
export declare function mintExtensionCallId(): string;
|
|
5
|
+
/** Whether `id` is a call id {@link mintExtensionCallId} could have minted — the one reading of "an extension's own call id". */
|
|
6
|
+
export declare function isExtensionCallId(id: unknown): id is string;
|
|
3
7
|
/** Which `$` call made the record: the door the extension came through. */
|
|
4
8
|
export type ExtensionDoor = "tool.call" | "agent.spawn";
|
|
5
9
|
/** One extension's call while it runs. */
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { ENGINE_ORIGIN } from "./kernel/index.js";
|
|
4
|
+
const EXTENSION_CALL_ID_PREFIX = "ext-";
|
|
5
|
+
export function mintExtensionCallId() {
|
|
6
|
+
return `${EXTENSION_CALL_ID_PREFIX}${randomUUID()}`;
|
|
7
|
+
}
|
|
8
|
+
export function isExtensionCallId(id) {
|
|
9
|
+
return typeof id === "string" && id.startsWith(EXTENSION_CALL_ID_PREFIX);
|
|
10
|
+
}
|
|
3
11
|
const store = new AsyncLocalStorage();
|
|
4
12
|
export function extensionCallOf(bus, toolCallId) {
|
|
5
13
|
const c = store.getStore();
|
|
@@ -8,9 +8,8 @@ import { ENGINE_ORIGIN } from "./kernel/index.js";
|
|
|
8
8
|
import { isPlainRecord } from "./kernel/receive.js";
|
|
9
9
|
import { NEXT_IN_FLIGHT } from "./kernel/site-rules.js";
|
|
10
10
|
import { classicEventBase, failedHandlerClause, failedHandlerName, judgedInputOf } from "./stations.js";
|
|
11
|
-
import { runExtensionCall } from "./extension-call.js";
|
|
11
|
+
import { mintExtensionCallId, runExtensionCall } from "./extension-call.js";
|
|
12
12
|
import { settleWithheldResult } from "../frame-settlement.js";
|
|
13
|
-
import { randomUUID } from "node:crypto";
|
|
14
13
|
const FORM = "tool.call takes next(e), { deny: <reason> } or { result } (a string, or a list of text blocks)";
|
|
15
14
|
const denyOf = (a) => isPlainRecord(a) && Object.keys(a).length === 1 && typeof a["deny"] === "string" && a["deny"] !== "" ? a["deny"] : undefined;
|
|
16
15
|
function substituteOf(a) {
|
|
@@ -54,7 +53,7 @@ export function createToolCallStation(input) {
|
|
|
54
53
|
const content = [{ type: "text", text: formatHookFeedback(text, input.reminderMark) }];
|
|
55
54
|
if (by !== undefined) {
|
|
56
55
|
if (input.occurrences.get(call.toolCallId) !== undefined) {
|
|
57
|
-
input.occurrences.refuse(call.toolCallId, "hook", by);
|
|
56
|
+
input.occurrences.refuse(call.toolCallId, "hook", { extension: by });
|
|
58
57
|
input.occurrences.answeredInPlace(call.toolCallId, by);
|
|
59
58
|
}
|
|
60
59
|
input.blockedToolCalls.add(call.toolCallId);
|
|
@@ -151,7 +150,7 @@ export function createToolCallEntry(input) {
|
|
|
151
150
|
const { tool, ...callInput } = args;
|
|
152
151
|
if (typeof tool !== "string" || tool === "")
|
|
153
152
|
throw new TypeError(`${by}: $.tool.call takes the event's input: { tool, ...args }`);
|
|
154
|
-
const toolCallId =
|
|
153
|
+
const toolCallId = mintExtensionCallId();
|
|
155
154
|
return runExtensionCall(input.bus, toolCallId, "tool.call", ctx, async (call) => {
|
|
156
155
|
const finalized = await input.harness.callTool({ type: "toolCall", id: toolCallId, name: tool, arguments: { ...callInput } }, ctx.signal, (t) => {
|
|
157
156
|
const contractId = input.faceOf(t.name)?.contractId;
|
|
@@ -41,11 +41,11 @@ export type ParentSpecSeatFields = Pick<TaskSpec, "principal" | "oneShot" | "cli
|
|
|
41
41
|
* · `memory` — the request-level "memory is off" FACT, `{ enabled: false }` and nothing else of the declaration (the clamp
|
|
42
42
|
* table's `memory.enabled` row; present only when the parent stated `enabled: false`): a REMOVAL (floor) that
|
|
43
43
|
* REWRITES the one member on the child's own memory declaration — its scopes and knobs are the child's.
|
|
44
|
-
* · `compaction` — the request's CONTEXT-MANAGEMENT settings (
|
|
44
|
+
* · `compaction` — the request's CONTEXT-MANAGEMENT settings (autoCompact / manualCompact / withinTask / reserve / keepRecent /
|
|
45
45
|
* instructions / attachWorkingFiles / staleToolResultOffload / clampTolerance). One set of settings for the
|
|
46
46
|
* whole delegation tree, measured per leg against the leg's OWN window: the numbers are repaired against the
|
|
47
47
|
* child's model by the same sanitizer every leg runs (`sanitizeCompactionSettings`), so a parent's 128k-tuned
|
|
48
|
-
* reserve does not have to be re-tuned to be legal on a 6k child. `
|
|
48
|
+
* reserve does not have to be re-tuned to be legal on a 6k child. A seat's `false` is NOT a removal — the
|
|
49
49
|
* reference implementation shares one settings object down the tree rather than flooring children, and a
|
|
50
50
|
* child that authors its own settings wins the whole object (an ORDINARY seat member).
|
|
51
51
|
* · `skillListingBudgetFraction` / `skillListingMaxDescChars` — the listing-budget knobs, the same shape for the
|
|
@@ -6,6 +6,11 @@ export interface PeerChannelSelf {
|
|
|
6
6
|
sessionId: string;
|
|
7
7
|
/** The mailbox scope this session's box lives in. */
|
|
8
8
|
scope: string;
|
|
9
|
+
/** The occupant of this session's row — its `SessionMetadata.incarnation` — or `null` when the row carries no token. REQUIRED,
|
|
10
|
+
* `null` included: every frame the listener appends is stamped for it (`MailboxPeerMeta.occupant`), the session's drain hands a
|
|
11
|
+
* record only to the occupant it names, and the published registration row carries it so a peer of this engine addresses this
|
|
12
|
+
* session's box the same way. An addressing fact, never a credential. */
|
|
13
|
+
occupant: string | null;
|
|
9
14
|
/** The doorbell rang (a peer appended to this session's box). The HOST decides what to do with it —
|
|
10
15
|
* start a turn now, or let the next boundary drain; the engine never starts a turn on a frame. */
|
|
11
16
|
onNudge?: () => void;
|