@sema-agent/core 7.69.0 → 7.69.1
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 +583 -0
- package/dist/agents/repair-loop.js +6 -14
- package/dist/agents/subagent.js +2 -1
- package/dist/agents/verify.d.ts +1 -1
- package/dist/agents/verify.js +7 -1
- package/dist/brain/reasoning-request.d.ts +7 -0
- package/dist/brain/reasoning-request.js +6 -0
- package/dist/core/agent-config-dir.d.ts +39 -3
- package/dist/core/agent-config-dir.js +67 -11
- package/dist/core/allow-entry.d.ts +5 -5
- package/dist/core/allow-entry.js +12 -6
- package/dist/core/ask-headline.d.ts +2 -2
- package/dist/core/ask-origin.d.ts +31 -31
- package/dist/core/ask-origin.js +20 -13
- package/dist/core/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +1 -0
- package/dist/core/auto-compaction.d.ts +44 -62
- package/dist/core/auto-compaction.js +44 -103
- package/dist/core/cache-break-detector.d.ts +23 -11
- package/dist/core/cache-break-detector.js +11 -5
- package/dist/core/checkpoint-features.d.ts +1 -1
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-requirements.d.ts +19 -1
- package/dist/core/checkpoint-requirements.js +6 -0
- package/dist/core/checkpoint-row-verdict.js +3 -0
- package/dist/core/checkpoint-store.d.ts +13 -2
- package/dist/core/child-clamp-seats.d.ts +30 -3
- package/dist/core/child-clamp-seats.js +24 -0
- package/dist/core/compaction-retired-members.d.ts +12 -0
- package/dist/core/compaction-retired-members.js +22 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +2 -0
- package/dist/core/context-edit.d.ts +32 -17
- package/dist/core/context-edit.js +28 -0
- package/dist/core/cron.d.ts +68 -0
- package/dist/core/cron.js +259 -0
- package/dist/core/engine-attestation.d.ts +16 -0
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-capabilities.d.ts +14 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +18 -7
- package/dist/core/engine-version.js +1 -1
- package/dist/core/gate-outcome.d.ts +29 -2
- package/dist/core/gate-outcome.js +6 -0
- package/dist/core/git-read-only.d.ts +10 -0
- package/dist/core/git-read-only.js +1 -0
- package/dist/core/git-worktree-env.js +9 -8
- package/dist/core/governance-codes.d.ts +9 -2
- package/dist/core/governance-codes.js +9 -0
- package/dist/core/locked-config.js +7 -3
- package/dist/core/lsp.d.ts +3 -0
- package/dist/core/lsp.js +3 -2
- package/dist/core/memory-engine/engine.d.ts +48 -12
- package/dist/core/memory-engine/engine.js +108 -46
- package/dist/core/memory-engine/file-backend.d.ts +2 -1
- package/dist/core/memory-engine/index-copies.d.ts +47 -0
- package/dist/core/memory-engine/index-copies.js +88 -0
- package/dist/core/memory-engine/layout.d.ts +20 -3
- package/dist/core/memory-engine/layout.js +39 -3
- package/dist/core/memory-engine/origin-clearance.d.ts +9 -7
- package/dist/core/memory-engine/origin-clearance.js +2 -4
- package/dist/core/memory-engine/types.d.ts +16 -3
- package/dist/core/mode-policy.d.ts +7 -1
- package/dist/core/mode-policy.js +9 -0
- package/dist/core/mods/session-compact.js +3 -3
- package/dist/core/mods/stations.d.ts +2 -0
- package/dist/core/mods/stations.js +2 -1
- package/dist/core/path-guard-rows.d.ts +8 -3
- package/dist/core/path-guard-rows.js +18 -5
- package/dist/core/peer-seat.d.ts +3 -0
- package/dist/core/peer-seat.js +3 -0
- package/dist/core/permission-rule-model.js +3 -2
- package/dist/core/process-identity.d.ts +11 -3
- package/dist/core/process-identity.js +26 -16
- package/dist/core/runner/assemble-result.d.ts +5 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/cleared-results-record.d.ts +33 -0
- package/dist/core/runner/cleared-results-record.js +56 -0
- package/dist/core/runner/compact-session.js +14 -9
- package/dist/core/runner/compaction-knobs.d.ts +1 -1
- package/dist/core/runner/continuation-gate.js +2 -1
- package/dist/core/runner/continues-from.d.ts +1 -1
- package/dist/core/runner/continues-from.js +1 -1
- package/dist/core/runner/contracts.d.ts +83 -31
- package/dist/core/runner/conversation-segment.d.ts +19 -12
- package/dist/core/runner/conversation-segment.js +27 -7
- package/dist/core/runner/derived-route-fallback.d.ts +2 -12
- package/dist/core/runner/derived-route-fallback.js +0 -6
- package/dist/core/runner/gate-exit.d.ts +2 -1
- package/dist/core/runner/gate-exit.js +4 -2
- package/dist/core/runner/git-status-frame.d.ts +2 -2
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/leg-caller-places.d.ts +39 -0
- package/dist/core/runner/leg-caller-places.js +23 -0
- package/dist/core/runner/leg-frame.d.ts +8 -2
- package/dist/core/runner/leg-receipt.d.ts +29 -2
- package/dist/core/runner/leg-receipt.js +37 -6
- package/dist/core/runner/media-removed-seat.d.ts +10 -6
- package/dist/core/runner/media-removed-seat.js +6 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -1
- package/dist/core/runner/messages-omitted-seat.js +15 -5
- package/dist/core/runner/person-path-rows.d.ts +25 -7
- package/dist/core/runner/person-path-rows.js +16 -2
- package/dist/core/runner/prefix-ledger.d.ts +120 -0
- package/dist/core/runner/prefix-ledger.js +176 -0
- package/dist/core/runner/prepare-advisor.d.ts +2 -0
- package/dist/core/runner/prepare-advisor.js +2 -1
- package/dist/core/runner/prepare-artifact.d.ts +3 -0
- package/dist/core/runner/prepare-artifact.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -8
- package/dist/core/runner/prepare-config-doors.js +15 -12
- package/dist/core/runner/prepare-context-lane.d.ts +25 -6
- package/dist/core/runner/prepare-context-lane.js +82 -27
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -2
- package/dist/core/runner/prepare-gate-stations.js +2 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +18 -5
- package/dist/core/runner/prepare-hands-readface.js +41 -22
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -0
- package/dist/core/runner/prepare-inherited-gate.js +2 -0
- package/dist/core/runner/prepare-memory.d.ts +10 -2
- package/dist/core/runner/prepare-memory.js +51 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +3 -0
- package/dist/core/runner/prepare-policy-chain.js +13 -2
- package/dist/core/runner/prepare-prompt-assembly.d.ts +12 -4
- package/dist/core/runner/prepare-prompt-assembly.js +10 -4
- package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -7
- package/dist/core/runner/prepare-prompt-inputs.js +6 -7
- package/dist/core/runner/prepare-safety-scan.js +7 -0
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -0
- package/dist/core/runner/prepare-suspend-saga.js +3 -2
- package/dist/core/runner/prepare-task.js +59 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +5 -11
- package/dist/core/runner/prepare-tool-disclosure-mount.js +7 -8
- package/dist/core/runner/prepare-turn-wiring.d.ts +16 -25
- package/dist/core/runner/prepare-turn-wiring.js +8 -18
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/prompt-suggestions.d.ts +3 -1
- package/dist/core/runner/prompt-suggestions.js +1 -1
- package/dist/core/runner/read-block-judge.d.ts +47 -0
- package/dist/core/runner/read-block-judge.js +33 -0
- package/dist/core/runner/role-resolution-table.d.ts +15 -10
- package/dist/core/runner/role-resolution-table.js +4 -5
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +7 -4
- package/dist/core/runner/rule-store-unreadable-notice.js +4 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +0 -10
- package/dist/core/runner/run-compaction-machinery.js +3 -39
- package/dist/core/runner/run-harness-handlers.js +4 -17
- package/dist/core/runner/run-identity-wiring.js +4 -1
- package/dist/core/runner/run-leg.js +11 -1
- package/dist/core/runner/run-recovery-lanes.d.ts +0 -4
- package/dist/core/runner/run-recovery-lanes.js +34 -18
- package/dist/core/runner/run-settle-and-teardown.d.ts +1 -3
- package/dist/core/runner/run-settle-and-teardown.js +14 -22
- package/dist/core/runner/run-telemetry-and-budget-seats.js +0 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +11 -30
- package/dist/core/runner/run-terminal-adoption.js +5 -88
- package/dist/core/runner/run-tool-mount-facts.js +1 -5
- package/dist/core/runner/run-turn-boundary.js +56 -26
- package/dist/core/runner/runtask.js +7 -7
- package/dist/core/runner/session-hash-salt.d.ts +18 -0
- package/dist/core/runner/session-hash-salt.js +36 -0
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +3 -3
- package/dist/core/runner/side-call-account.d.ts +9 -1
- package/dist/core/runner/side-call-account.js +15 -4
- package/dist/core/runner/skill-mention.d.ts +12 -0
- package/dist/core/runner/skill-mention.js +50 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-table-view.d.ts +5 -9
- package/dist/core/runner/tool-table-view.js +23 -21
- package/dist/core/runner/write-protection-station.d.ts +5 -2
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +25 -27
- package/dist/core/scheduler.d.ts +13 -3
- package/dist/core/scheduler.js +0 -12
- package/dist/core/secret-env.d.ts +47 -11
- package/dist/core/secret-env.js +65 -4
- package/dist/core/sensitive-path-policy.js +4 -0
- package/dist/core/session-checkout.js +10 -9
- package/dist/core/shell-read-silence.d.ts +2 -1
- package/dist/core/shell-run-candidates.d.ts +1 -1
- package/dist/core/shell-run-candidates.js +11 -3
- package/dist/core/task-event.d.ts +32 -10
- package/dist/core/task-intake.d.ts +5 -3
- package/dist/core/task-intake.js +6 -2
- package/dist/core/task-result.d.ts +39 -0
- package/dist/core/task-spec-members.d.ts +3 -0
- package/dist/core/task-spec-members.js +2 -2
- package/dist/core/task-spec.d.ts +37 -20
- package/dist/core/tool-policy.d.ts +30 -18
- package/dist/core/tool-policy.js +44 -32
- package/dist/core/tool-roster.d.ts +21 -7
- package/dist/core/tool-roster.js +34 -6
- package/dist/core/tool-spec-members.js +1 -1
- package/dist/core/tool-spec.d.ts +27 -0
- package/dist/core/tools.js +1 -0
- package/dist/core/trace.d.ts +42 -19
- package/dist/core/unc-spelling.d.ts +31 -0
- package/dist/core/unc-spelling.js +51 -0
- package/dist/core/wiring-manifest.d.ts +30 -3
- package/dist/core/wiring-manifest.js +10 -0
- package/dist/core/workflow-run-store-contract.js +22 -0
- package/dist/core/workflow-run-store.d.ts +17 -13
- package/dist/core/workflow-run-store.js +1 -1
- package/dist/core/write-protect.d.ts +4 -0
- package/dist/core/write-protect.js +17 -15
- package/dist/engine/compaction/compaction.d.ts +48 -98
- package/dist/engine/compaction/compaction.js +136 -216
- package/dist/engine/compaction/utils.d.ts +2 -11
- package/dist/engine/compaction/utils.js +4 -13
- package/dist/engine/execution-env/node-execution-env.js +17 -6
- package/dist/engine/harness/agent-harness.d.ts +19 -5
- package/dist/engine/harness/agent-harness.js +18 -7
- package/dist/engine/harness/types.d.ts +5 -7
- package/dist/engine/loop/agent-loop.d.ts +14 -1
- package/dist/engine/loop/agent-loop.js +31 -11
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/index.d.ts +9 -6
- package/dist/index.js +8 -6
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/orchestration/run-spec.js +7 -2
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow-park-adoption.d.ts +66 -8
- package/dist/orchestration/workflow-park-adoption.js +195 -45
- package/dist/orchestration/workflow-types.d.ts +20 -0
- package/dist/orchestration/workflow-types.js +1 -0
- package/dist/orchestration/workflow.d.ts +3 -2
- package/dist/orchestration/workflow.js +10 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/events.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/mechanism.d.ts +8 -0
- package/dist/prompt-assembly/catalog/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +1 -1
- package/dist/prompt-assembly/catalog/schema.js +1 -0
- package/dist/prompt-assembly/catalog/sections.js +8 -0
- package/dist/prompt-assembly/event-registry.js +1 -0
- package/dist/prompt-assembly/select.js +1 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +14 -27
- package/dist/prompt-assembly/turn-snapshot.js +6 -18
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/default.d.ts +9 -0
- package/dist/prompts/default.js +4 -0
- package/dist/shell/lex.d.ts +75 -11
- package/dist/shell/lex.js +340 -76
- package/dist/tools/fs/bash-program-position.js +2 -6
- package/dist/tools/fs/bash-readonly-classifier.d.ts +18 -3
- package/dist/tools/fs/bash-readonly-classifier.js +19 -9
- package/dist/tools/fs/containment-face.d.ts +12 -3
- package/dist/tools/fs/containment-face.js +16 -7
- package/dist/tools/fs/file-read-check.d.ts +26 -1
- package/dist/tools/fs/file-read-check.js +20 -2
- package/dist/tools/fs/fs-bash.js +4 -4
- package/dist/tools/fs/fs-read.d.ts +3 -0
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-search-tools.d.ts +2 -2
- package/dist/tools/fs/fs-search-tools.js +4 -4
- package/dist/tools/fs/index.js +5 -3
- package/dist/tools/fs/pdf.js +12 -4
- package/dist/tools/fs/read-deny-home.d.ts +13 -2
- package/dist/tools/fs/read-deny-home.js +26 -22
- package/dist/tools/fs/read-deny.js +15 -6
- package/dist/tools/fs/removal-targets.d.ts +33 -17
- package/dist/tools/fs/removal-targets.js +160 -61
- package/dist/tools/fs/repo-map.d.ts +1 -1
- package/dist/tools/fs/repo-map.js +2 -2
- package/dist/tools/fs/safety.d.ts +28 -5
- package/dist/tools/fs/safety.js +72 -8
- package/dist/tools/fs/shell-read-bindings.d.ts +8 -2
- package/dist/tools/fs/shell-read-bindings.js +25 -6
- package/dist/tools/fs/shell-read-check.d.ts +3 -0
- package/dist/tools/fs/shell-read-check.js +22 -4
- package/dist/tools/fs/shell-read-establish.js +73 -43
- package/dist/tools/fs/shell-read-judge.d.ts +32 -14
- package/dist/tools/fs/shell-read-judge.js +13 -5
- package/dist/tools/fs/shell-read-object-path.d.ts +5 -1
- package/dist/tools/fs/shell-read-object-path.js +17 -4
- package/dist/tools/fs/shell-read-plan.d.ts +8 -2
- package/dist/tools/fs/shell-read-plan.js +36 -22
- package/dist/tools/fs/shell-read-sourced.js +12 -4
- package/dist/tools/fs/shell-read-start.d.ts +4 -2
- package/dist/tools/fs/shell-read-start.js +3 -3
- package/dist/tools/fs/shell-read-workdir.d.ts +14 -6
- package/dist/tools/fs/shell-read-workdir.js +35 -17
- package/dist/tools/scheduler-tools.d.ts +7 -17
- package/dist/tools/scheduler-tools.js +9 -85
- package/dist/tools/worktree.js +5 -4
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +47 -1
- package/wire-changes/core-stores-sql@7.68.6.json +39 -0
- package/wire-changes/core-stores-sql@7.69.1.json +39 -0
- package/wire-changes/core@7.68.6.json +125 -0
- package/wire-changes/core@7.69.1.json +2561 -0
- package/wire-changes/mods-kernel@7.68.6.json +39 -0
- package/wire-changes/mods-kernel@7.69.1.json +39 -0
- package/wire-changes/primitives@7.68.6.json +39 -0
- package/wire-changes/primitives@7.69.1.json +39 -0
- package/wire-changes/wiki-gate@7.68.6.json +39 -0
- package/wire-changes/wiki-gate@7.69.1.json +39 -0
- package/dist/core/runner/prompt-hash-salt.d.ts +0 -1
- package/dist/core/runner/prompt-hash-salt.js +0 -2
|
@@ -128,9 +128,9 @@ export function budgetInvokedSkillsRetention(newestFirst, maxTotalChars) {
|
|
|
128
128
|
}
|
|
129
129
|
return out;
|
|
130
130
|
}
|
|
131
|
-
export function replaceInvokedSkillBodiesForSummary(
|
|
131
|
+
export function replaceInvokedSkillBodiesForSummary(messages, retainedNames) {
|
|
132
132
|
const callIdToSkillName = new Map();
|
|
133
|
-
for (const msg of
|
|
133
|
+
for (const msg of messages) {
|
|
134
134
|
if (msg.role !== "assistant" || !("content" in msg) || !Array.isArray(msg.content))
|
|
135
135
|
continue;
|
|
136
136
|
for (const block of msg.content) {
|
|
@@ -146,7 +146,7 @@ export function replaceInvokedSkillBodiesForSummary(groups, retainedNames) {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
return
|
|
149
|
+
return messages.map((msg) => {
|
|
150
150
|
if (msg.role !== "toolResult" || msg.toolName !== SKILL_TOOL_NAME_LITERAL || msg.isError)
|
|
151
151
|
return msg;
|
|
152
152
|
const skillName = callIdToSkillName.get(msg.toolCallId);
|
|
@@ -161,7 +161,7 @@ export function replaceInvokedSkillBodiesForSummary(groups, retainedNames) {
|
|
|
161
161
|
? `[Skill "${skillName}" instructions (${chars} chars) are carried in the invoked-skills area of the compaction summary — omitted from this summarization input to avoid double-carrying them.]`
|
|
162
162
|
: `[Skill "${skillName}" instructions (${chars} chars) were omitted here and did not fit the invoked-skills retention budget — re-invoke the Skill tool if they are needed again.]`;
|
|
163
163
|
return { ...msg, content: [{ type: "text", text: note }] };
|
|
164
|
-
})
|
|
164
|
+
});
|
|
165
165
|
}
|
|
166
166
|
export function readRetainedInvokedSkills(details) {
|
|
167
167
|
if (details === null || typeof details !== "object")
|
|
@@ -269,15 +269,6 @@ export function formatFileOperations(readFiles, modifiedFiles) {
|
|
|
269
269
|
}
|
|
270
270
|
return `\n\n${sections.join("\n\n")}`;
|
|
271
271
|
}
|
|
272
|
-
export function stripFileOperationsFooter(summary) {
|
|
273
|
-
let out = summary;
|
|
274
|
-
for (;;) {
|
|
275
|
-
const next = out.replace(/\n\n<(read-files|modified-files|persisted-tool-outputs)>\n[\s\S]*?\n<\/\1>\s*$/, "");
|
|
276
|
-
if (next === out)
|
|
277
|
-
return out;
|
|
278
|
-
out = next;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
272
|
const TOOL_RESULT_MAX_CHARS = 2000;
|
|
282
273
|
function safeJsonStringify(value) {
|
|
283
274
|
try {
|
|
@@ -210,6 +210,17 @@ function fileInfoFromStats(path, stats) {
|
|
|
210
210
|
function isNodeError(error) {
|
|
211
211
|
return error instanceof Error && "code" in error;
|
|
212
212
|
}
|
|
213
|
+
async function listedEntryInfo(shown, statAt) {
|
|
214
|
+
try {
|
|
215
|
+
const info = fileInfoFromStats(shown, await lstat(statAt));
|
|
216
|
+
return info.ok ? info.value : undefined;
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
if (isNodeError(error) && error.code === "ENOENT")
|
|
220
|
+
return undefined;
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
213
224
|
function toFileError(error, path) {
|
|
214
225
|
if (error instanceof FileError) {
|
|
215
226
|
return error;
|
|
@@ -1373,9 +1384,9 @@ export class NodeExecutionEnv {
|
|
|
1373
1384
|
}
|
|
1374
1385
|
const entryPath = anchorAtLinkDir(resolved, entry.name, sep);
|
|
1375
1386
|
try {
|
|
1376
|
-
const info =
|
|
1377
|
-
if (info
|
|
1378
|
-
infos.push(info
|
|
1387
|
+
const info = await listedEntryInfo(entryPath, entryPath);
|
|
1388
|
+
if (info !== undefined) {
|
|
1389
|
+
infos.push(info);
|
|
1379
1390
|
}
|
|
1380
1391
|
}
|
|
1381
1392
|
catch (error) {
|
|
@@ -1504,9 +1515,9 @@ export class NodeExecutionEnv {
|
|
|
1504
1515
|
const loopAbort = abortResult(abortSignal, resolved);
|
|
1505
1516
|
if (loopAbort)
|
|
1506
1517
|
return loopAbort;
|
|
1507
|
-
const info =
|
|
1508
|
-
if (info
|
|
1509
|
-
infos.push(info
|
|
1518
|
+
const info = await listedEntryInfo(anchorAtLinkDir(resolved, entry.name, sep), anchorAtLinkDir(listed, entry.name, sep));
|
|
1519
|
+
if (info !== undefined)
|
|
1520
|
+
infos.push(info);
|
|
1510
1521
|
}
|
|
1511
1522
|
if (!throughHandle) {
|
|
1512
1523
|
const after = await stat(resolved, { bigint: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ActorAssertion, AssistantMessage, ImageContent, Message, Model, TextContent, UserMessage, UserMessageAttachment } from "../llm/index.js";
|
|
1
|
+
import type { ActorAssertion, AssistantMessage, Context, ImageContent, Message, Model, TextContent, UserMessage, UserMessageAttachment } from "../llm/index.js";
|
|
2
2
|
import { type ChangedFilesNotice, type ToolTurnRepair } from "../llm/index.js";
|
|
3
3
|
import { type RejectedImageRemoval } from "../llm/rejected-images.js";
|
|
4
|
-
import { runToolCall, type ExecutedToolCallOutcome, type GivenAnswer } from "../loop/agent-loop.js";
|
|
4
|
+
import { loopRequestControls, runToolCall, type ExecutedToolCallOutcome, type GivenAnswer } from "../loop/agent-loop.js";
|
|
5
5
|
import type { HaltRemainingDirective } from "../loop/types.js";
|
|
6
6
|
import type { AgentMessage, AgentTool, AgentToolCall, LoopMalformedToolUseRecovery, LoopThinkingOnlyRecovery, LoopTruncatedOutputRecovery, QueueMode, ThinkingLevel } from "../loop/types.js";
|
|
7
7
|
import { type EngineSegment } from "../../core/untrusted-text.js";
|
|
@@ -220,12 +220,13 @@ export interface HarnessLoopRecovery {
|
|
|
220
220
|
maxContinues?: number;
|
|
221
221
|
};
|
|
222
222
|
promptTooLong?: {
|
|
223
|
-
/**
|
|
223
|
+
/** Make the resend carry less — a reduction persisted to the SESSION (the resend is rebuilt from it), or a lower line
|
|
224
|
+
* the resend's own request build trims to; return true if the resend will carry less. Must not throw.
|
|
224
225
|
* `turnSignal` is the TURN-scoped abort (#474 ②): a policy whose work is expensive (a forced
|
|
225
226
|
* compaction's summary call) must ride it so a turn interrupt cuts the pass short instead of
|
|
226
227
|
* being waited out — and a policy that declines under it leaves the loop settling the turn as
|
|
227
|
-
* an interrupted one, never as the provider error's terminal. */
|
|
228
|
-
recover: (attempt: number, turnSignal?: AbortSignal) => Promise<boolean>;
|
|
228
|
+
* an interrupted one, never as the provider error's terminal. `refused` is the failure being recovered. */
|
|
229
|
+
recover: (attempt: number, turnSignal?: AbortSignal, refused?: AssistantMessage) => Promise<boolean>;
|
|
229
230
|
/** Override the loop's default prompt-too-long classifier. */
|
|
230
231
|
detect?: (message: AssistantMessage) => boolean;
|
|
231
232
|
/** Max recovery retries per turn (loop default: 2). */
|
|
@@ -396,6 +397,19 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
396
397
|
private imageRefusalView;
|
|
397
398
|
/** The provider-bound view: the tool-turn law, then the request's copy projection over what the law leaves. */
|
|
398
399
|
private holdToolTurnLaw;
|
|
400
|
+
/** The same view and the repairs it made, told to no one (a rendering of a request that may never be sent). */
|
|
401
|
+
private toolTurnLawView;
|
|
402
|
+
/**
|
|
403
|
+
* The request the running loop would send for `view` now: the loop's own assembly ({@link llmRequestContext}) over the
|
|
404
|
+
* provider boundary's path (convert → tool-turn law → copy projection → metadata strip) and the loop's request controls
|
|
405
|
+
* ({@link loopRequestControls}). Side-effect free — a repair the law makes is returned, never told — so it may render a
|
|
406
|
+
* request that is never sent (the turn-start compaction lane reuses it as the main request). `undefined` outside a run.
|
|
407
|
+
*/
|
|
408
|
+
requestOf(view: AgentMessage[]): {
|
|
409
|
+
context: Context;
|
|
410
|
+
controls: ReturnType<typeof loopRequestControls>;
|
|
411
|
+
repairs: readonly ToolTurnRepair[];
|
|
412
|
+
} | undefined;
|
|
399
413
|
/** RB-30 R2 belt-and-braces: runner-callable idempotent recovery for exit paths that reach
|
|
400
414
|
* neither agent_end nor abort() (a pre-prompt throw after prepare). Swept entries are removed,
|
|
401
415
|
* so a double call is a no-op. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { changedFilesNoticesOf, createAssistantMessageEventStream, ensureToolTurnInvariants, findToolByName, snapshotActorAssertion, stripEngineMetadata, userAttachmentOf } from "../llm/index.js";
|
|
2
2
|
import { imageRefusalAt, isImageRefusal, removeRefusedRequestParts } from "../llm/rejected-images.js";
|
|
3
|
-
import { finalizeToolOutcome, findUnansweredToolBatch, isBatchSafeToolCall, runAgentLoop, runToolCall, TURN_ENDED_TOOL_TEXT, TURN_INTERRUPTED_TOOL_TEXT } from "../loop/agent-loop.js";
|
|
3
|
+
import { finalizeToolOutcome, findUnansweredToolBatch, isBatchSafeToolCall, llmRequestContext, loopRequestControls, runAgentLoop, runToolCall, TURN_ENDED_TOOL_TEXT, TURN_INTERRUPTED_TOOL_TEXT } from "../loop/agent-loop.js";
|
|
4
4
|
import { resolveAgentCoreStreamFn } from "../loop/runtime-deps.js";
|
|
5
5
|
import { normalizeEngineSegments } from "../../core/untrusted-text.js";
|
|
6
6
|
import { isCredentialHeaderName } from "../../core/secret-env.js";
|
|
@@ -305,15 +305,26 @@ export class AgentHarness {
|
|
|
305
305
|
return view.messages;
|
|
306
306
|
}
|
|
307
307
|
holdToolTurnLaw(messages) {
|
|
308
|
-
const view =
|
|
309
|
-
if (
|
|
308
|
+
const { messages: view, repairs } = this.toolTurnLawView(messages);
|
|
309
|
+
if (repairs.length > 0) {
|
|
310
310
|
try {
|
|
311
|
-
this.onToolTurnRepaired?.(
|
|
311
|
+
this.onToolTurnRepaired?.(repairs);
|
|
312
312
|
}
|
|
313
313
|
catch {
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
return
|
|
316
|
+
return view;
|
|
317
|
+
}
|
|
318
|
+
toolTurnLawView(messages) {
|
|
319
|
+
const view = ensureToolTurnInvariants(messages, this.runHistory);
|
|
320
|
+
return { messages: this.projectRequestCopies?.(view.messages, view.folds) ?? view.messages, repairs: view.repairs };
|
|
321
|
+
}
|
|
322
|
+
requestOf(view) {
|
|
323
|
+
const run = this.activeRun;
|
|
324
|
+
if (run === undefined)
|
|
325
|
+
return undefined;
|
|
326
|
+
const law = this.toolTurnLawView(convertToLlm(view));
|
|
327
|
+
return { context: llmRequestContext(run.context(), stripEngineMetadata(law.messages)), controls: loopRequestControls(run.config), repairs: law.repairs };
|
|
317
328
|
}
|
|
318
329
|
recoverUndrainedEngineNotes() {
|
|
319
330
|
this.sweepUndrainedEngineNotes([this.drainedPendingInjection, this.nextTurnQueue, this.steerQueue, this.followUpQueue]);
|
|
@@ -878,10 +889,10 @@ export class AgentHarness {
|
|
|
878
889
|
detect: ptl.detect,
|
|
879
890
|
maxRetries: ptl.maxRetries,
|
|
880
891
|
withholdErrorEvents: ptl.withholdErrorEvents,
|
|
881
|
-
recover: async (_messages, attempt, turnSignal) => {
|
|
892
|
+
recover: async (_messages, attempt, turnSignal, refused) => {
|
|
882
893
|
let shrank = false;
|
|
883
894
|
try {
|
|
884
|
-
shrank = await ptl.recover(attempt, turnSignal);
|
|
895
|
+
shrank = await ptl.recover(attempt, turnSignal, refused);
|
|
885
896
|
}
|
|
886
897
|
catch {
|
|
887
898
|
shrank = false;
|
|
@@ -1756,19 +1756,17 @@ export interface CompactionSettings {
|
|
|
1756
1756
|
enabled: boolean;
|
|
1757
1757
|
reserveTokens: number;
|
|
1758
1758
|
keepRecentTokens: number;
|
|
1759
|
-
/**
|
|
1760
|
-
*
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1759
|
+
/** Not read since #4865: the summary always runs on the main model, reusing the main request, so no
|
|
1760
|
+
* window-safety fallback to it remains and nothing reads this ratio. The task's own member
|
|
1761
|
+
* (`TaskSpec.compaction.clampTolerance`, and the same on `Runner.compactSession`) is received and
|
|
1762
|
+
* ignored, told once per process (`config.compaction_member_ignored`), and refused by name from
|
|
1763
|
+
* 7.70.0. */
|
|
1764
1764
|
clampTolerance?: number;
|
|
1765
1765
|
}
|
|
1766
1766
|
/** Prepared compaction inputs exposed to hooks before a summary is generated. */
|
|
1767
1767
|
export interface CompactionPreparation {
|
|
1768
1768
|
firstKeptEntryId: string;
|
|
1769
1769
|
messagesToSummarize: AgentMessage[];
|
|
1770
|
-
turnPrefixMessages: AgentMessage[];
|
|
1771
|
-
isSplitTurn: boolean;
|
|
1772
1770
|
tokensBefore: number;
|
|
1773
1771
|
previousSummary?: string;
|
|
1774
1772
|
fileOps: FileOperations;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* otherwise stop (Continue `follow_up_injected`). Never merge these into one queue.
|
|
22
22
|
* - text_delta.partial reconstruction (upstream cherry-pick 6fcc945702).
|
|
23
23
|
*/
|
|
24
|
-
import type { AssistantMessage, ToolResultMessage } from "../llm/index.js";
|
|
24
|
+
import type { AssistantMessage, Context, ToolResultMessage } from "../llm/index.js";
|
|
25
25
|
import { type AgentCoreStreamRuntimeDeps } from "./runtime-deps.js";
|
|
26
26
|
import type { AfterToolCallResult, AgentContext, AgentEvent, AgentLoopConfig, AgentMessage, AgentTool, AgentToolCall, AgentToolResult, HaltRemainingDirective, StreamFn, TurnCutSettlement } from "./types.js";
|
|
27
27
|
/** Callback used by synchronous loop runners to publish agent lifecycle events. */
|
|
@@ -187,6 +187,19 @@ export declare const TURN_ENDED_TOOL_TEXT = "[Tool call did not complete: the tu
|
|
|
187
187
|
/** The loop's own settlement row — a cut the host answers no row for (a raw loop, a seat cut by no named source): the
|
|
188
188
|
* user interrupt's text, the marker, and a running command ended with its call. */
|
|
189
189
|
export declare const INTERRUPT_TURN_CUT_SETTLEMENT: TurnCutSettlement;
|
|
190
|
+
/**
|
|
191
|
+
* The request context a turn of this loop sends for messages already converted for the provider: the context's prompt face
|
|
192
|
+
* and its tool view. One assembly for the loop's own call and for a rendering of the request the loop is about to send
|
|
193
|
+
* (`AgentHarness.requestOf`), so the two cannot differ.
|
|
194
|
+
*/
|
|
195
|
+
export declare function llmRequestContext(context: AgentContext, llmMessages: Context["messages"]): Context;
|
|
196
|
+
/** The request controls a turn's call carries (read from the same members the call spreads): the thinking tier, the output
|
|
197
|
+
* cap (the per-call cap when the host shrinks it), and the requester's try-undeclared posture. */
|
|
198
|
+
export declare function loopRequestControls(config: AgentLoopConfig): {
|
|
199
|
+
reasoning?: AgentLoopConfig["reasoning"];
|
|
200
|
+
maxTokens?: number;
|
|
201
|
+
tryUndeclared: true;
|
|
202
|
+
};
|
|
190
203
|
type ExecutedToolCallBatch = {
|
|
191
204
|
messages: ToolResultMessage[];
|
|
192
205
|
terminate: boolean;
|
|
@@ -384,6 +384,10 @@ function underMalformedBudget(state, count) {
|
|
|
384
384
|
const malformed = state.config.recovery?.malformedToolUse;
|
|
385
385
|
return malformed !== undefined && count < (malformed.maxRetries ?? 2);
|
|
386
386
|
}
|
|
387
|
+
function countReask(state) {
|
|
388
|
+
state.malformedToolUseRetries++;
|
|
389
|
+
state.config.recovery?.malformedToolUse?.onReask?.();
|
|
390
|
+
}
|
|
387
391
|
function malformedRetryLeft(state) {
|
|
388
392
|
return underMalformedBudget(state, state.malformedToolUseRetries);
|
|
389
393
|
}
|
|
@@ -516,7 +520,7 @@ async function runTurnPhases(state, signal, turnController, publishSeat, retract
|
|
|
516
520
|
}
|
|
517
521
|
let replaced;
|
|
518
522
|
try {
|
|
519
|
-
replaced = await ptl.recover(state.context.messages, attempt, turnController.signal);
|
|
523
|
+
replaced = await ptl.recover(state.context.messages, attempt, turnController.signal, message);
|
|
520
524
|
}
|
|
521
525
|
catch {
|
|
522
526
|
replaced = undefined;
|
|
@@ -587,7 +591,9 @@ async function runTurnPhases(state, signal, turnController, publishSeat, retract
|
|
|
587
591
|
if (message.stopReason !== "error")
|
|
588
592
|
state.degenerateContinues = 0;
|
|
589
593
|
}
|
|
590
|
-
|
|
594
|
+
const lostEveryCall = message.stopReason === "error" && toolCalls.length === 0 && message.modelOutputInvalid !== undefined && state.config.recovery?.malformedToolUse !== undefined && signal?.aborted !== true;
|
|
595
|
+
const carriedOn = lostEveryCall && (state.config.pendingInjectionCount?.() ?? 1) > 0;
|
|
596
|
+
if ((message.stopReason === "error" || message.stopReason === "aborted") && !carriedOn) {
|
|
591
597
|
retractSeat();
|
|
592
598
|
await endTurn(state, emit, message, []);
|
|
593
599
|
await emit({ type: "agent_end", messages: state.newMessages });
|
|
@@ -669,11 +675,18 @@ async function runTurnPhases(state, signal, turnController, publishSeat, retract
|
|
|
669
675
|
state.streakMissedNames = missedKey;
|
|
670
676
|
}
|
|
671
677
|
clearCountsOnPersonsInput(state, state.pendingMessages);
|
|
678
|
+
if (carriedOn) {
|
|
679
|
+
if (state.pendingMessages.some(isPersonsInput) && malformedRetryLeft(state)) {
|
|
680
|
+
countReask(state);
|
|
681
|
+
return { kind: "ran" };
|
|
682
|
+
}
|
|
683
|
+
await emit({ type: "agent_end", messages: state.newMessages });
|
|
684
|
+
return { kind: "terminal", reason: "assistant_error" };
|
|
685
|
+
}
|
|
672
686
|
if (malformed && (noParseableCall || missedKey !== undefined)) {
|
|
673
687
|
if (noParseableCall ? malformedRetryLeft(state) : underMalformedBudget(state, state.missedToolRetries)) {
|
|
674
688
|
if (noParseableCall) {
|
|
675
|
-
state
|
|
676
|
-
malformed.onReask?.();
|
|
689
|
+
countReask(state);
|
|
677
690
|
if (state.pendingMessages.length > 0)
|
|
678
691
|
return { kind: "ran" };
|
|
679
692
|
state.pendingMessages = [createMalformedToolUseNudge()];
|
|
@@ -814,6 +827,19 @@ async function settleInterruptedTurn(state, message, committedResults, signal, e
|
|
|
814
827
|
state.pendingMessages = (await state.config.getSteeringMessages?.(state.hasMoreToolCalls)) || [];
|
|
815
828
|
return { kind: "ran" };
|
|
816
829
|
}
|
|
830
|
+
export function llmRequestContext(context, llmMessages) {
|
|
831
|
+
return {
|
|
832
|
+
systemPrompt: context.systemPrompt,
|
|
833
|
+
...(context.systemBlocks ? { systemBlocks: context.systemBlocks } : {}),
|
|
834
|
+
messages: llmMessages,
|
|
835
|
+
tools: withoutRefusedToolSchemas(context.tools, context.messages),
|
|
836
|
+
...(context.promptLocale !== undefined ? { promptLocale: context.promptLocale } : {}),
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
export function loopRequestControls(config) {
|
|
840
|
+
const maxTokens = config.maxTokensPerCall?.() ?? config.maxTokens;
|
|
841
|
+
return { ...(config.reasoning !== undefined ? { reasoning: config.reasoning } : {}), ...(maxTokens !== undefined ? { maxTokens } : {}), tryUndeclared: true };
|
|
842
|
+
}
|
|
817
843
|
async function streamAssistantResponse(context, config, signal, emit, streamFn, runtime, grants = {}, onObtained, onDispatch) {
|
|
818
844
|
let messages = context.messages;
|
|
819
845
|
if (config.transformContext) {
|
|
@@ -832,13 +858,7 @@ async function streamAssistantResponse(context, config, signal, emit, streamFn,
|
|
|
832
858
|
if (llmMessages[llmMessages.length - 1]?.role === "assistant") {
|
|
833
859
|
throw new Error("a model request must not end on the assistant's own row: the context to send is hand-built or its transcript is corrupt");
|
|
834
860
|
}
|
|
835
|
-
const llmContext =
|
|
836
|
-
systemPrompt: context.systemPrompt,
|
|
837
|
-
...(context.systemBlocks ? { systemBlocks: context.systemBlocks } : {}),
|
|
838
|
-
messages: llmMessages,
|
|
839
|
-
tools: withoutRefusedToolSchemas(context.tools, context.messages),
|
|
840
|
-
...(context.promptLocale !== undefined ? { promptLocale: context.promptLocale } : {}),
|
|
841
|
-
};
|
|
861
|
+
const llmContext = llmRequestContext(context, llmMessages);
|
|
842
862
|
const streamFunction = resolveAgentCoreStreamFn(runtime, streamFn);
|
|
843
863
|
const resolvedApiKey = (config.getApiKey ? await config.getApiKey(config.model.provider) : undefined) || config.apiKey;
|
|
844
864
|
const perCallMaxTokens = config.maxTokensPerCall?.();
|
|
@@ -222,8 +222,11 @@ export interface LoopPromptTooLongRecovery {
|
|
|
222
222
|
* the interjection is served now instead of after the whole pass. A policy that DECLINES while
|
|
223
223
|
* this signal is aborted does not leave the run holding the provider error: the loop settles the
|
|
224
224
|
* turn as an interrupted one and continues.
|
|
225
|
+
*
|
|
226
|
+
* `refused` is the failure being recovered (already off `messages`): its error text is the provider's own evidence of
|
|
227
|
+
* how far over the request was.
|
|
225
228
|
*/
|
|
226
|
-
recover: (messages: AgentMessage[], attempt: number, turnSignal?: AbortSignal) => Promise<AgentMessage[] | AdoptedLoopContext | undefined>;
|
|
229
|
+
recover: (messages: AgentMessage[], attempt: number, turnSignal?: AbortSignal, refused?: AssistantMessage) => Promise<AgentMessage[] | AdoptedLoopContext | undefined>;
|
|
227
230
|
/** Override the prompt-too-long classifier. Default (design/374 slice 2): the TYPED cause first
|
|
228
231
|
* (`errorKind: "input_too_long"`, stamped by the brains from provenance-checked provider
|
|
229
232
|
* signals), then the conservative provider-message prose pattern as the fallback for brains
|
|
@@ -264,7 +267,10 @@ export interface LoopTruncatedOutputRecovery {
|
|
|
264
267
|
* end the run silently mid-task. When enabled, inject a synthetic retry nudge and run another turn,
|
|
265
268
|
* up to `maxRetries` times (CC: up to twice): the count clears when a call ran or a person's input (a row marked
|
|
266
269
|
* `origin: "human_input"`) reached the model or waits to; a message already waiting takes the nudge's place and the
|
|
267
|
-
* turn counts all the same.
|
|
270
|
+
* turn counts all the same. A turn that lost every call and failed at the cap (the brain's failure, its re-ask grant
|
|
271
|
+
* withheld) while input was queued in its request's flight takes the turn boundary a turn that goes on takes: a person's
|
|
272
|
+
* input among what its drain brings takes the same rule — clears the counts, the turn counts as one re-ask, the run goes on
|
|
273
|
+
* with it; with no person's input the failure ends the run. The same budget bounds a model that keeps calling a tool the roster does not mount (its own
|
|
268
274
|
* count): a turn whose every call is answered `tool.not_found` counts while it misses the same names as the streak's
|
|
269
275
|
* last such turn (no nudge — its results name the roster), a miss under other names or a person's input (the same rule
|
|
270
276
|
* as above) starts the count over, a name the next turn's roster mounts is no miss, and the exhausted exit is the same
|
package/dist/index.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export { judgeSessionMetaKey, MCP_SESSION_META_KEY_MAX_CHARS, type SessionMetaKe
|
|
|
81
81
|
export { McpConnectionPool, type ForgetMcpFailureRequest, type ForgetMcpFailureResult } from "./core/mcp-connection-pool.js";
|
|
82
82
|
export { probeMcpServers, type McpProbeResult } from "./core/mcp-probe.js";
|
|
83
83
|
export { judgeMcpNames, describeMcpNameConflict, type McpNameConflict, type McpNameSetServer, type McpNameVerdict } from "./core/mcp-name-judge.js";
|
|
84
|
-
export { MCP_FAILURE_KINDS, MCP_DELIVERY_VERDICTS, MCP_LIVENESS_STATES, MCP_AUTHORIZATION_REASONS, classifyMcpFailure, type McpFailure, type McpFailureFields, type McpFailureKind, type McpDelivered, type McpLivenessState, type McpServerLiveness, type McpAuthorization, type McpAuthorizationReason } from "./core/mcp-failure.js";
|
|
84
|
+
export { MCP_FAILURE_KINDS, MCP_DELIVERY_VERDICTS, MCP_LIVENESS_STATES, MCP_AUTHORIZATION_REASONS, classifyMcpFailure, owesAuthorization, type McpFailure, type McpFailureFields, type McpFailureKind, type McpDelivered, type McpLivenessState, type McpServerLiveness, type McpAuthorization, type McpAuthorizationReason } from "./core/mcp-failure.js";
|
|
85
85
|
export { MCP_INJECTION_DROP_REASONS, MCP_INJECTION_DROP_TEXT, mcpInjectionDroppedNotice, type McpInjectionDropReason, type McpInjectionDropFacts } from "./core/mcp-injection-drop.js";
|
|
86
86
|
export { askUnresolvableNotice, type AskUnresolvableFacts } from "./core/ask-unresolvable-notice.js";
|
|
87
87
|
export { ASK_UNRESOLVABLE_CAUSES, type AskUnresolvableCause } from "./core/ask-unresolvable-notice.js";
|
|
@@ -156,7 +156,7 @@ export { bashReversibilityProbe, BASH_READONLY_DEFAULT_ALLOW, parseLeadingComman
|
|
|
156
156
|
export { classifyCompoundReadonlyDetailed, formatOutOfRootReadApprovalOption, type BashReadonlyRootBoundary, type CompoundReadonlyVerdict, } from "./tools/fs/index.js";
|
|
157
157
|
export { resolveBashTimeoutCaps } from "./tools/fs/index.js";
|
|
158
158
|
export { READ_FACE_DEFAULT_DENY_ENTRIES, READ_FACE_BUILTIN_DENY_TABLE, READ_DENY_BUILTIN_TIERS, READ_DENY_DEFAULT_TIERS, resolveReadDenyBuiltins, compileReadDeny, READ_DENY_HOME_WORD, readDenyPatternRun, readDenyRowAnchor, readDenyHomesOf, compileWriteDeny, DENY_FACES, type DenyFace, type PathRuleDenyRow, type WriteDenyMatcher, type ReadDenyEntry, type ReadDenyMatcher, type NormalizedReadDenyEntry, type ReadDenyBuiltinTier, type ReadDenyBuiltinRow, type ReadDenyBuiltinConfig, } from "./tools/fs/index.js";
|
|
159
|
-
export { deploymentFaceClampNotice, resolveContainmentFace, type ContainmentFace, type ContainmentFaceInputs, type ContainmentFaceKind, type ContainmentFaceLayer, } from "./tools/fs/index.js";
|
|
159
|
+
export { deploymentFaceClampNotice, FACE_CLAMP_CAUSES, type FaceClampCause, resolveContainmentFace, type ContainmentFace, type ContainmentFaceInputs, type ContainmentFaceKind, type ContainmentFaceLayer, } from "./tools/fs/index.js";
|
|
160
160
|
export { WRITE_PROTECTED_DEFAULT_TABLE, resolveWriteProtectedTable, compileWriteProtection, type WriteProtectedEntry, type WriteProtectedRow, type WriteProtectedKind, type WriteProtectedHit, type WriteProtectionMatcher, type WriteProtectionVerdict, type WriteProtectionViewAbsence, type WriteProtectionJudgeContext, type WriteProtectionCompileOptions, type WriteProtectionCheck, WRITE_PROTECTION_TARGET_VIEWS, type WriteProtectionTargetView, type WriteProtectionMount, } from "./core/write-protect.js";
|
|
161
161
|
export { InMemoryToolResultStore, OFFLOAD_TOOL_NAME, DEFAULT_TOOL_RESULT_THRESHOLD_CHARS, assertSafeToolResultRef, buildToolResultRef, toolResultContentSegment, MAX_MINTED_TOOL_RESULT_REF_CHARS, type ToolResultProvenance, assertToolResultProvenanceMatch, normalizeToolResultProvenance, toolResultProvenanceOf, type ToolResultReadRefusal, ToolResultRefConflictError, TOOL_RESULT_REF_CONFLICT_CODE, ToolResultBytesOverLimitError, TOOL_RESULT_BYTES_OVER_LIMIT_CODE, type ToolResultStore, type ToolResultSeat, rekeyToolResultOwner, type ToolResultRekeyVerdict, type ToolResultSlice, type ToolResultDeletionReport, type ToolResultSessionListing, type ToolResultListedEntry, offloadedDetailOf, type OffloadedDetail, } from "./core/tool-result-store.js";
|
|
162
162
|
export { type OwnerIdentity, ownerIdentityOf, type IdentityReadVerdict, identityReadVerdict, encodePrincipalColumn, decodePrincipalColumn } from "./core/owner-identity.js";
|
|
@@ -255,7 +255,8 @@ export { createImageDownsampler, sharpImageDownsampler, type ImageDownsampler, t
|
|
|
255
255
|
export { IMAGE_ADMISSION } from "./core/image-admission.js";
|
|
256
256
|
export { hasBackgroundShell, BackgroundShellError } from "./core/background-shell.js";
|
|
257
257
|
export type { BackgroundShellCapability, BackgroundShellId, BackgroundShellStatus, BackgroundShellErrorCode, BackgroundSpawnOptions, BackgroundPoll, BackgroundHardKillOutcome, } from "./core/background-shell.js";
|
|
258
|
-
export { hasScheduler,
|
|
258
|
+
export { hasScheduler, SchedulerError } from "./core/scheduler.js";
|
|
259
|
+
export { isValidCronExpr, nextCronFireTime } from "./core/cron.js";
|
|
259
260
|
export type { SchedulerCapability, SchedulerErrorCode, ScheduledIntent, SchedulerContext, ScheduledTaskId, ScheduledTaskSummary, } from "./core/scheduler.js";
|
|
260
261
|
export { createSchedulerTools, type SchedulerToolContext, sessionLaneScopeOf, schedulerLanesOf, listScheduled, cancelScheduled, type SchedulerLanes, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
|
|
261
262
|
export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, type AutonomousLoopPromptOptions, } from "./tools/loop-tick.js";
|
|
@@ -266,6 +267,7 @@ export { createAllowDenyPolicy, createApprovalPolicy,
|
|
|
266
267
|
* policy verdict cannot get re-adjudicated). Exported so a host can NAME it instead of deriving it through
|
|
267
268
|
* `Parameters<typeof createApprovalPolicy>[0]["approve"]`. */
|
|
268
269
|
type ApprovalSeatOutcome, COARSE_SHELL_TOOLS, createCoarseCommandNamePolicy, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, combinePolicies, abortedSeatDeny, noApproverSeatDeny, wrapToolPolicy, decisionText, resolveAsk, toolPolicyNameSets, toolPolicyPathRules, type ToolPolicyNameSets, type NamedToolPolicy, type ToolPolicyProjection, type ToolPolicyProjectionComponent, type ConstraintChainEntry, checkToolPolicyProjection, constraintChainEntryOf, constraintChainDigest, type ToolPolicy, type ToolCallRequest, type PermissionResult, type DecisionReason, screenApproverAttribution, APPROVER_ATTRIBUTION_MAX_CHARS, BIDI_CONTROL_CHARS, carriesBidiControls, type OnAsk, asPolicyApprover, isPolicyApprover, declareClassAnswers, type AskOutcome, type ResolvedAsk, type EngineAttestation, type AskRequest, type AskDelegationProvenance, type AskRuleEvidence, type AskEvidenceAbsence, ASK_EVIDENCE_ABSENCE_VALUES, } from "./core/tool-policy.js";
|
|
270
|
+
export type { StationRefusal, StationRefusalLayer } from "./core/engine-attestation.js";
|
|
269
271
|
export { writtenFeedback, unfitFeedbackOf, type UnfitFeedback } from "./core/approval-words.js";
|
|
270
272
|
export { type ExistingTarget, type ExistingTargetKind, type ExistingTargetWithheldReason, EXISTING_TARGET_KINDS, EXISTING_TARGET_WITHHELD_REASONS, EXISTING_TARGET_READ_CAP, } from "./core/existing-target.js";
|
|
271
273
|
export { type ReadRootGrantScreen } from "./core/read-root-grant-screen.js";
|
|
@@ -324,8 +326,8 @@ export { removePersistedRule, addPersistedRule, applyTombstones, sameScope, same
|
|
|
324
326
|
export { readRuleOwner, sameRuleOwner, type RuleOwner, RULE_OWNER_KINDS, } from "./core/rule-owner.js";
|
|
325
327
|
export { principalNameOf, PRINCIPAL_NAME_MAX_CHARS } from "./core/principal-name.js";
|
|
326
328
|
export { isolationScopeOf, callScopeOf } from "./core/isolation-scope.js";
|
|
327
|
-
export { REKEY_MODES, ONE_STEP_REKEY_MODES, readPrincipalRekeyInput, readScopeRekeyInput, readIdentityRekeyInput, rekeyOwnerIdentity, oneStepRekeyAnswerOf, type RekeyMode, type PrincipalRekeyInput, type ScopeRekeyInput, type ScopeRekeyPair, type IdentityRekeyInput, type IdentityRekeyMap, type OwnerIdentityRekeyVerdict, type OneStepRekeyCount, type RekeyPlan, type IdentityRekeyPlan, type RekeyDone, type RekeyConflict, } from "./core/identity-rekey.js";
|
|
328
|
-
export { rekeyCheckpointRow, CHECKPOINT_IDENTITY_MEMBERS, type CheckpointRekeyVerdict } from "./core/checkpoint-rekey.js";
|
|
329
|
+
export { REKEY_MODES, ONE_STEP_REKEY_MODES, readPrincipalRekeyInput, readScopeRekeyInput, readIdentityRekeyInput, rekeyOwnerIdentity, oneStepRekeyAnswerOf, judgePrincipalRekey, eraseStepOf, type OneStepRekeyMode, type RekeyStamp, type RekeyRowStamp, type RekeyArrivalRecord, type RekeyMarkReading, type PrincipalRekeyKeyState, type PrincipalRekeyWrite, type RekeyMode, type PrincipalRekeyInput, type ScopeRekeyInput, type ScopeRekeyPair, type IdentityRekeyInput, type IdentityRekeyMap, type OwnerIdentityRekeyVerdict, type OneStepRekeyCount, type RekeyPlan, type IdentityRekeyPlan, type RekeyDone, type RekeyConflict, } from "./core/identity-rekey.js";
|
|
330
|
+
export { rekeyCheckpointRow, checkpointRekeySelects, CHECKPOINT_IDENTITY_MEMBERS, type CheckpointRekeyVerdict } from "./core/checkpoint-rekey.js";
|
|
329
331
|
export { syncPermissionRules, parseRuleSyncResponse, PERMISSION_RULE_SYNC_PATH, LOCAL_OWNER_UNSYNCABLE_CODE, type PermissionRuleSyncTransport, type PermissionRuleSyncResult, type RuleSyncRequestBody, type RuleSyncResponseBody, } from "./core/permission-rule-sync.js";
|
|
330
332
|
export { createPermissionRuleStoreProvider, effectivePermissionRules, effectiveOrThrow, ruleSourceOf, type PermissionRuleStore, type PermissionRuleStoreProvider, type PermissionRuleStoreConfig, type EffectivePermissionRules, type EffectivePermissionRule, type RemovedPermissionRule, type RuleSource, } from "./core/permission-rule-provider.js";
|
|
331
333
|
export { RULE_STORE_FAULT_REASONS, type RuleStoreFault, type RuleStoreFaultReason, type RuleStoreSource } from "./core/rule-store-fault.js";
|
|
@@ -420,6 +422,7 @@ export { type WorkflowRunStore, type WorkflowRunSummary, type ReadableWorkflowRu
|
|
|
420
422
|
export { WORKFLOW_RUN_STATUSES } from "./orchestration/workflow-types.js";
|
|
421
423
|
export { workflowParkHolderOf, type WorkflowParkHolder } from "./orchestration/workflow-types.js";
|
|
422
424
|
export { WORKFLOW_PARK_UNUSED_REASONS, type WorkflowParkUnusedReason } from "./orchestration/workflow-park-adoption.js";
|
|
425
|
+
export { workflowParkDecisionOf, WORKFLOW_PARK_SETTLING_REASONS, type WorkflowParkDecisionState, type WorkflowParkSettlingReason } from "./orchestration/workflow-park-adoption.js";
|
|
423
426
|
export { FileWorkflowRunStore, type FileWorkflowRunStoreOptions } from "./stores/file/workflow-run-store.js";
|
|
424
427
|
export { workflowRunStoreContract, type WorkflowRunStoreContractHooks } from "./core/workflow-run-store-contract.js";
|
|
425
428
|
export { CONTRACT_KIT_ENGINE_VERSION } from "./core/store-contracts/contract-kit-version.js";
|
|
@@ -437,7 +440,7 @@ export { permissionRuleWriteContract, type PermissionRuleWriteContractHooks } fr
|
|
|
437
440
|
export { MAILBOX_CONTRACT_SCOPE, mailboxStoreContract, mailboxAckOwnershipContract, mailboxBundledOnlyContract, mailboxTombstonedRecipientContract, type MailboxTombstonedRecipientContractHooks, mailboxCrossProcessContract, type MailboxCrossProcessContractHooks, type MailboxStoreContractHooks, } from "./core/store-contracts/mailbox-store-contract.js";
|
|
438
441
|
export { BACKGROUND_AGENT_CONTRACT_SCOPE, backgroundAgentStoreContract, backgroundAgentStoreScopesContract, type BackgroundAgentStoreContractHooks, } from "./core/store-contracts/background-agent-store-contract.js";
|
|
439
442
|
export { PEER_DIRECTORY_CONTRACT_SCOPE, peerDirectoryContract, type PeerDirectoryContractHooks } from "./core/store-contracts/peer-directory-contract.js";
|
|
440
|
-
export { type BackgroundAgentStore, type BackgroundAgentRecord, type BackgroundAgentRowSummary, type BackgroundAgentUsage, canAccessAgentRecord, STALE_RUNNING_REAP_ATTRIBUTION, staleRunningFlip, staleRunningFlipOf, BackgroundAgentStoreError, InMemoryBackgroundAgentStore, reconcileParkedAgents, queryBackgroundAgents, type BackgroundAgentQuery, BACKGROUND_AGENT_ROW_SHAPE, BACKGROUND_AGENT_ROW_MALFORMED_CODE, BACKGROUND_AGENT_STATUSES, type BackgroundAgentStatus, type ReadableBackgroundAgentRowSummary, type DamagedBackgroundAgentRowSummary, readStoredBackgroundAgent, admitBackgroundAgent, summarizeStoredBackgroundAgent, nextBackgroundAgentOnUpdate, assertDelegationRoot, } from "./core/background-agent-store.js";
|
|
443
|
+
export { type BackgroundAgentStore, type BackgroundAgentRecord, type BackgroundAgentRowSummary, type BackgroundAgentUsage, canAccessAgentRecord, STALE_RUNNING_REAP_ATTRIBUTION, staleRunningFlip, staleRunningFlipOf, BackgroundAgentStoreError, InMemoryBackgroundAgentStore, reconcileParkedAgents, queryBackgroundAgents, type BackgroundAgentQuery, BACKGROUND_AGENT_ROW_SHAPE, BACKGROUND_AGENT_ROW_MALFORMED_CODE, BACKGROUND_AGENT_STATUSES, type BackgroundAgentStatus, type ReadableBackgroundAgentRowSummary, type DamagedBackgroundAgentRowSummary, readStoredBackgroundAgent, admitBackgroundAgent, planScopeRekey, scopeRekeyWritesOf, type ScopeRekeyMove, summarizeStoredBackgroundAgent, nextBackgroundAgentOnUpdate, assertDelegationRoot, } from "./core/background-agent-store.js";
|
|
441
444
|
export { serveDurableAgentRowLane, buildAgentPollDetails, type AgentPollDetailsInput, } from "./core/task-registry-agent.js";
|
|
442
445
|
export { readAgentState, agentStateSourceOfRecord, agentStateSummary, type AgentState, type AgentPark, type AgentParkGate, type AgentParkState, type AgentStateRow, type AgentStateSource, } from "./core/agent-state.js";
|
|
443
446
|
export type { TranscriptStep } from "./agents/subagent-steps.js";
|
package/dist/index.js
CHANGED
|
@@ -63,7 +63,7 @@ export { judgeSessionMetaKey, MCP_SESSION_META_KEY_MAX_CHARS } from "./core/mcp-
|
|
|
63
63
|
export { McpConnectionPool } from "./core/mcp-connection-pool.js";
|
|
64
64
|
export { probeMcpServers } from "./core/mcp-probe.js";
|
|
65
65
|
export { judgeMcpNames, describeMcpNameConflict } from "./core/mcp-name-judge.js";
|
|
66
|
-
export { MCP_FAILURE_KINDS, MCP_DELIVERY_VERDICTS, MCP_LIVENESS_STATES, MCP_AUTHORIZATION_REASONS, classifyMcpFailure } from "./core/mcp-failure.js";
|
|
66
|
+
export { MCP_FAILURE_KINDS, MCP_DELIVERY_VERDICTS, MCP_LIVENESS_STATES, MCP_AUTHORIZATION_REASONS, classifyMcpFailure, owesAuthorization } from "./core/mcp-failure.js";
|
|
67
67
|
export { MCP_INJECTION_DROP_REASONS, MCP_INJECTION_DROP_TEXT, mcpInjectionDroppedNotice } from "./core/mcp-injection-drop.js";
|
|
68
68
|
export { askUnresolvableNotice } from "./core/ask-unresolvable-notice.js";
|
|
69
69
|
export { ASK_UNRESOLVABLE_CAUSES } from "./core/ask-unresolvable-notice.js";
|
|
@@ -126,7 +126,7 @@ export { bashReversibilityProbe, BASH_READONLY_DEFAULT_ALLOW, parseLeadingComman
|
|
|
126
126
|
export { classifyCompoundReadonlyDetailed, formatOutOfRootReadApprovalOption, } from "./tools/fs/index.js";
|
|
127
127
|
export { resolveBashTimeoutCaps } from "./tools/fs/index.js";
|
|
128
128
|
export { READ_FACE_DEFAULT_DENY_ENTRIES, READ_FACE_BUILTIN_DENY_TABLE, READ_DENY_BUILTIN_TIERS, READ_DENY_DEFAULT_TIERS, resolveReadDenyBuiltins, compileReadDeny, READ_DENY_HOME_WORD, readDenyPatternRun, readDenyRowAnchor, readDenyHomesOf, compileWriteDeny, DENY_FACES, } from "./tools/fs/index.js";
|
|
129
|
-
export { deploymentFaceClampNotice, resolveContainmentFace, } from "./tools/fs/index.js";
|
|
129
|
+
export { deploymentFaceClampNotice, FACE_CLAMP_CAUSES, resolveContainmentFace, } from "./tools/fs/index.js";
|
|
130
130
|
export { WRITE_PROTECTED_DEFAULT_TABLE, resolveWriteProtectedTable, compileWriteProtection, WRITE_PROTECTION_TARGET_VIEWS, } from "./core/write-protect.js";
|
|
131
131
|
export { InMemoryToolResultStore, OFFLOAD_TOOL_NAME, DEFAULT_TOOL_RESULT_THRESHOLD_CHARS, assertSafeToolResultRef, buildToolResultRef, toolResultContentSegment, MAX_MINTED_TOOL_RESULT_REF_CHARS, assertToolResultProvenanceMatch, normalizeToolResultProvenance, toolResultProvenanceOf, ToolResultRefConflictError, TOOL_RESULT_REF_CONFLICT_CODE, ToolResultBytesOverLimitError, TOOL_RESULT_BYTES_OVER_LIMIT_CODE, rekeyToolResultOwner, offloadedDetailOf, } from "./core/tool-result-store.js";
|
|
132
132
|
export { ownerIdentityOf, identityReadVerdict, encodePrincipalColumn, decodePrincipalColumn } from "./core/owner-identity.js";
|
|
@@ -205,7 +205,8 @@ export { createWorktreeTools } from "./tools/worktree.js";
|
|
|
205
205
|
export { createImageDownsampler, sharpImageDownsampler } from "./core/image-downsample.js";
|
|
206
206
|
export { IMAGE_ADMISSION } from "./core/image-admission.js";
|
|
207
207
|
export { hasBackgroundShell, BackgroundShellError } from "./core/background-shell.js";
|
|
208
|
-
export { hasScheduler,
|
|
208
|
+
export { hasScheduler, SchedulerError } from "./core/scheduler.js";
|
|
209
|
+
export { isValidCronExpr, nextCronFireTime } from "./core/cron.js";
|
|
209
210
|
export { createSchedulerTools, sessionLaneScopeOf, schedulerLanesOf, listScheduled, cancelScheduled, SCHEDULE_WAKEUP_TOOL_NAME, AUTONOMOUS_LOOP_SENTINEL, AUTONOMOUS_LOOP_DYNAMIC_SENTINEL, } from "./tools/scheduler-tools.js";
|
|
210
211
|
export { resolveAutonomousLoopPrompt, AUTONOMOUS_LOOP_PREAMBLE, AUTONOMOUS_LOOP_PREAMBLE_PERSISTENT, } from "./tools/loop-tick.js";
|
|
211
212
|
export { tightenTaskSpec, TaskSpecTightenError } from "./core/tighten-task-spec.js";
|
|
@@ -247,8 +248,8 @@ export { removePersistedRule, addPersistedRule, applyTombstones, sameScope, same
|
|
|
247
248
|
export { readRuleOwner, sameRuleOwner, RULE_OWNER_KINDS, } from "./core/rule-owner.js";
|
|
248
249
|
export { principalNameOf, PRINCIPAL_NAME_MAX_CHARS } from "./core/principal-name.js";
|
|
249
250
|
export { isolationScopeOf, callScopeOf } from "./core/isolation-scope.js";
|
|
250
|
-
export { REKEY_MODES, ONE_STEP_REKEY_MODES, readPrincipalRekeyInput, readScopeRekeyInput, readIdentityRekeyInput, rekeyOwnerIdentity, oneStepRekeyAnswerOf, } from "./core/identity-rekey.js";
|
|
251
|
-
export { rekeyCheckpointRow, CHECKPOINT_IDENTITY_MEMBERS } from "./core/checkpoint-rekey.js";
|
|
251
|
+
export { REKEY_MODES, ONE_STEP_REKEY_MODES, readPrincipalRekeyInput, readScopeRekeyInput, readIdentityRekeyInput, rekeyOwnerIdentity, oneStepRekeyAnswerOf, judgePrincipalRekey, eraseStepOf, } from "./core/identity-rekey.js";
|
|
252
|
+
export { rekeyCheckpointRow, checkpointRekeySelects, CHECKPOINT_IDENTITY_MEMBERS } from "./core/checkpoint-rekey.js";
|
|
252
253
|
export { syncPermissionRules, parseRuleSyncResponse, PERMISSION_RULE_SYNC_PATH, LOCAL_OWNER_UNSYNCABLE_CODE, } from "./core/permission-rule-sync.js";
|
|
253
254
|
export { createPermissionRuleStoreProvider, effectivePermissionRules, effectiveOrThrow, ruleSourceOf, } from "./core/permission-rule-provider.js";
|
|
254
255
|
export { RULE_STORE_FAULT_REASONS } from "./core/rule-store-fault.js";
|
|
@@ -336,6 +337,7 @@ export { summarizeWorkflowRun, isTerminalWorkflowStatus, WorkflowRunStoreError,
|
|
|
336
337
|
export { WORKFLOW_RUN_STATUSES } from "./orchestration/workflow-types.js";
|
|
337
338
|
export { workflowParkHolderOf } from "./orchestration/workflow-types.js";
|
|
338
339
|
export { WORKFLOW_PARK_UNUSED_REASONS } from "./orchestration/workflow-park-adoption.js";
|
|
340
|
+
export { workflowParkDecisionOf, WORKFLOW_PARK_SETTLING_REASONS } from "./orchestration/workflow-park-adoption.js";
|
|
339
341
|
export { FileWorkflowRunStore } from "./stores/file/workflow-run-store.js";
|
|
340
342
|
export { workflowRunStoreContract } from "./core/workflow-run-store-contract.js";
|
|
341
343
|
export { CONTRACT_KIT_ENGINE_VERSION } from "./core/store-contracts/contract-kit-version.js";
|
|
@@ -353,7 +355,7 @@ export { permissionRuleWriteContract } from "./core/store-contracts/permission-r
|
|
|
353
355
|
export { MAILBOX_CONTRACT_SCOPE, mailboxStoreContract, mailboxAckOwnershipContract, mailboxBundledOnlyContract, mailboxTombstonedRecipientContract, mailboxCrossProcessContract, } from "./core/store-contracts/mailbox-store-contract.js";
|
|
354
356
|
export { BACKGROUND_AGENT_CONTRACT_SCOPE, backgroundAgentStoreContract, backgroundAgentStoreScopesContract, } from "./core/store-contracts/background-agent-store-contract.js";
|
|
355
357
|
export { PEER_DIRECTORY_CONTRACT_SCOPE, peerDirectoryContract } from "./core/store-contracts/peer-directory-contract.js";
|
|
356
|
-
export { canAccessAgentRecord, STALE_RUNNING_REAP_ATTRIBUTION, staleRunningFlip, staleRunningFlipOf, BackgroundAgentStoreError, InMemoryBackgroundAgentStore, reconcileParkedAgents, queryBackgroundAgents, BACKGROUND_AGENT_ROW_SHAPE, BACKGROUND_AGENT_ROW_MALFORMED_CODE, BACKGROUND_AGENT_STATUSES, readStoredBackgroundAgent, admitBackgroundAgent, summarizeStoredBackgroundAgent, nextBackgroundAgentOnUpdate, assertDelegationRoot, } from "./core/background-agent-store.js";
|
|
358
|
+
export { canAccessAgentRecord, STALE_RUNNING_REAP_ATTRIBUTION, staleRunningFlip, staleRunningFlipOf, BackgroundAgentStoreError, InMemoryBackgroundAgentStore, reconcileParkedAgents, queryBackgroundAgents, BACKGROUND_AGENT_ROW_SHAPE, BACKGROUND_AGENT_ROW_MALFORMED_CODE, BACKGROUND_AGENT_STATUSES, readStoredBackgroundAgent, admitBackgroundAgent, planScopeRekey, scopeRekeyWritesOf, summarizeStoredBackgroundAgent, nextBackgroundAgentOnUpdate, assertDelegationRoot, } from "./core/background-agent-store.js";
|
|
357
359
|
export { serveDurableAgentRowLane, buildAgentPollDetails, } from "./core/task-registry-agent.js";
|
|
358
360
|
export { readAgentState, agentStateSourceOfRecord, agentStateSummary, } from "./core/agent-state.js";
|
|
359
361
|
export { TASK_OUTPUT_REPLAY_KINDS } from "./core/task-registry-shared.js";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* that only need harness types (not the NodeExecutionEnv value export) import from here instead, so
|
|
5
5
|
* their compile-time dependency graph never has to reach the value side of the facade.
|
|
6
6
|
*/
|
|
7
|
-
export type { CompactionPreparation
|
|
7
|
+
export type { CompactionPreparation } from "../engine/compaction/compaction.js";
|
|
8
8
|
export type { InvokedSkillRetention } from "../engine/compaction/utils.js";
|
|
9
9
|
export type { AgentCoreRuntimeDeps } from "../engine/loop/runtime-deps.js";
|
|
10
10
|
export type { LoopTerminalReason } from "../engine/loop/agent-loop.js";
|
|
@@ -13,7 +13,7 @@ export * from "./harness-types.js";
|
|
|
13
13
|
export { AgentHarness, turnContextOptions } from "../engine/harness/agent-harness.js";
|
|
14
14
|
export type { AnsweredInputSeed, HaltConsumption, PromptCommittedCallback, SeatCutSource, StopRequestSource, TrailingToolBatchOptions, TurnCutVerdict } from "../engine/harness/agent-harness.js";
|
|
15
15
|
export { CompactionError, ExecutionError, FileError, isTimeCutCode, NothingQueuedError, ok, err } from "../engine/harness/types.js";
|
|
16
|
-
export { DEFAULT_CHARS_PER_TOKEN,
|
|
16
|
+
export { DEFAULT_CHARS_PER_TOKEN, DEFAULT_COMPACTION_SETTINGS, calculateContextTokens, compact, computeFileLists, estimateContextTokens, estimateTokens, prepareCompaction, refusalShortfall, shouldCompact, summaryOutputBudgetTokens, } from "../engine/compaction/compaction.js";
|
|
17
17
|
export { SKILL_RETENTION_PER_SKILL_MAX_CHARS, SKILL_RETENTION_TOTAL_MAX_CHARS, SKILL_RETENTION_TRUNCATION_MARKER, formatFileOperations, formatPersistedOutputRefs, readCompactionActiveTools, readRetainedInvokedSkills, renderInvokedSkillsRetention, } from "../engine/compaction/utils.js";
|
|
18
18
|
export { NodeExecutionEnv } from "../engine/execution-env/node-execution-env.js";
|
|
19
19
|
export { StoredSession, buildSessionContext } from "../engine/session/session.js";
|
package/dist/internal/harness.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./harness-types.js";
|
|
2
2
|
export { AgentHarness, turnContextOptions } from "../engine/harness/agent-harness.js";
|
|
3
3
|
export { CompactionError, ExecutionError, FileError, isTimeCutCode, NothingQueuedError, ok, err } from "../engine/harness/types.js";
|
|
4
|
-
export { DEFAULT_CHARS_PER_TOKEN,
|
|
4
|
+
export { DEFAULT_CHARS_PER_TOKEN, DEFAULT_COMPACTION_SETTINGS, calculateContextTokens, compact, computeFileLists, estimateContextTokens, estimateTokens, prepareCompaction, refusalShortfall, shouldCompact, summaryOutputBudgetTokens, } from "../engine/compaction/compaction.js";
|
|
5
5
|
export { SKILL_RETENTION_PER_SKILL_MAX_CHARS, SKILL_RETENTION_TOTAL_MAX_CHARS, SKILL_RETENTION_TRUNCATION_MARKER, formatFileOperations, formatPersistedOutputRefs, readCompactionActiveTools, readRetainedInvokedSkills, renderInvokedSkillsRetention, } from "../engine/compaction/utils.js";
|
|
6
6
|
export { NodeExecutionEnv } from "../engine/execution-env/node-execution-env.js";
|
|
7
7
|
export { StoredSession, buildSessionContext } from "../engine/session/session.js";
|
|
@@ -3,10 +3,13 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { isAbsolute, resolve, sep } from "node:path";
|
|
4
4
|
import { combinePolicies } from "../core/tool-policy.js";
|
|
5
5
|
import { delimitUntrusted } from "../core/untrusted-text.js";
|
|
6
|
+
import { receivePeerDeclarations } from "../core/locked-config.js";
|
|
7
|
+
import { receiveHeldDeclarations } from "../core/runner/leg-receipt.js";
|
|
6
8
|
import { isDurablePause } from "../agents/suspend-guard.js";
|
|
7
9
|
import { terminalProjection } from "../core/runner/terminal-projection.js";
|
|
8
10
|
import { writeTargetPath } from "../tools/fs/safety.js";
|
|
9
11
|
import { callTargetViewsOf } from "../core/effective-path-target.js";
|
|
12
|
+
import { judgePathRows } from "../core/path-guard-rows.js";
|
|
10
13
|
import { captureBaseline, resolveFrozenPaths, restoreFrozenPaths, runOracle, snapshotFrozenPaths, specError, } from "../core/spec-contract.js";
|
|
11
14
|
import { isProtectedWrite } from "../core/tool-registry.js";
|
|
12
15
|
const RUN_SPEC_ORACLE_GATE = "run-spec-oracle-gate";
|
|
@@ -20,6 +23,7 @@ const pathKey = (p) => {
|
|
|
20
23
|
};
|
|
21
24
|
export function frozenDenyPolicy(rootDir, frozenResolved) {
|
|
22
25
|
const frozen = new Set(frozenResolved.map(pathKey));
|
|
26
|
+
const row = { reach: (v) => (frozen.has(pathKey(v.path)) ? { reach: "reached" } : { reach: "not_reached" }) };
|
|
23
27
|
return {
|
|
24
28
|
check(req) {
|
|
25
29
|
if (!isProtectedWrite(req))
|
|
@@ -28,8 +32,7 @@ export function frozenDenyPolicy(rootDir, frozenResolved) {
|
|
|
28
32
|
if (views === undefined || views.views.length === 0)
|
|
29
33
|
return { action: "allow" };
|
|
30
34
|
const raw = writeTargetPath(req);
|
|
31
|
-
|
|
32
|
-
if (hit) {
|
|
35
|
+
if (judgePathRows([row], views, "tighten")?.view !== undefined) {
|
|
33
36
|
return { action: "deny", message: `${typeof raw === "string" && raw.length > 0 ? raw : views.views[0].path} is part of the frozen specification surface (read-only).` };
|
|
34
37
|
}
|
|
35
38
|
return { action: "allow" };
|
|
@@ -81,6 +84,8 @@ export async function runSpec(runner, contract, opts) {
|
|
|
81
84
|
const rootDir = resolve(opts.rootDir);
|
|
82
85
|
const specText = loadSpecText(contract, rootDir);
|
|
83
86
|
const startedAt = Date.now();
|
|
87
|
+
receivePeerDeclarations(opts.taskSpec, {});
|
|
88
|
+
receiveHeldDeclarations(opts.taskSpec);
|
|
84
89
|
const frozenResolved = resolveFrozenPaths(rootDir, contract.frozenPaths);
|
|
85
90
|
const snapshot = snapshotFrozenPaths(frozenResolved);
|
|
86
91
|
const noticeSeat = opts.onNotice !== undefined ? { onNotice: opts.onNotice } : {};
|
|
@@ -466,7 +466,7 @@ async function mountRunWorkflowTool(d) {
|
|
|
466
466
|
clamps: () => {
|
|
467
467
|
const host = d.parentClamps?.();
|
|
468
468
|
assertClampRecord(host, "RunWorkflowToolDeps.parentClamps()", "clamp");
|
|
469
|
-
return foldClampSources(clampSourceOf(ctx), host);
|
|
469
|
+
return clampSourceOf(foldClampSources(clampSourceOf(ctx, "clamp"), host), "clamp");
|
|
470
470
|
},
|
|
471
471
|
posture: () => ctx.interactionPosture ?? d.parentInteractionPosture,
|
|
472
472
|
model: inherited.model,
|
|
@@ -825,6 +825,7 @@ async function mountRunWorkflowTool(d) {
|
|
|
825
825
|
const parentCenterArtifactDigest = centerFromCtx ? ctx.centerArtifactDigest : d.parentCenterArtifactDigest?.();
|
|
826
826
|
const parentCenterSourceRevision = centerFromCtx ? ctx.centerSourceRevision : d.parentCenterSourceRevision?.();
|
|
827
827
|
let continuationClaim;
|
|
828
|
+
let continuationDecisions = continuation?.decisions;
|
|
828
829
|
const releaseContinuationClaim = () => {
|
|
829
830
|
if (continuationClaim !== undefined && d.journalStore !== undefined)
|
|
830
831
|
void releaseWorkflowResumeClaim(d.journalStore, continuationClaim.args, continuationClaim.fallback);
|
|
@@ -871,11 +872,12 @@ async function mountRunWorkflowTool(d) {
|
|
|
871
872
|
catch {
|
|
872
873
|
confirmed = false;
|
|
873
874
|
}
|
|
874
|
-
if (
|
|
875
|
+
if (confirmed === false) {
|
|
875
876
|
releaseContinuationClaim();
|
|
876
877
|
continuation.onSuperseded();
|
|
877
878
|
return structuredError("the approval card changed while this continuation waited for its resume claim — not started");
|
|
878
879
|
}
|
|
880
|
+
continuationDecisions = confirmed;
|
|
879
881
|
}
|
|
880
882
|
if (ctx.signal?.aborted) {
|
|
881
883
|
releaseContinuationClaim();
|
|
@@ -945,7 +947,7 @@ async function mountRunWorkflowTool(d) {
|
|
|
945
947
|
...(detachedSeat?.internalsFlag.questionFaceStripped === true || ctx.questionFaceStripped === true || d.parentQuestionFaceStripped === true ? { questionFaceStripped: true } : {}),
|
|
946
948
|
...(hostDurableApproval !== undefined && d.store !== undefined && parkStore !== undefined && journalKeepsLaunches(d.journalStore) ? { defaultDurableApproval: { ...hostDurableApproval } } : {}),
|
|
947
949
|
...(() => {
|
|
948
|
-
const carried = continuation !== undefined ?
|
|
950
|
+
const carried = continuation !== undefined ? continuationDecisions : held !== undefined && "decisions" in held ? held.decisions : undefined;
|
|
949
951
|
return carried !== undefined && carried.length > 0 ? { parkedResume: carried.map((e) => ({ ...e })) } : {};
|
|
950
952
|
})(),
|
|
951
953
|
...(d.holder !== undefined ? { holder: d.holder } : {}),
|