@sema-agent/core 7.71.1 → 7.73.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 +500 -0
- package/dist/agents/cross-session-ref.d.ts +2 -2
- package/dist/agents/cross-session-ref.js +7 -2
- package/dist/agents/inherited-tool-pool.d.ts +30 -2
- package/dist/agents/inherited-tool-pool.js +53 -7
- package/dist/agents/parked-resume-drive.d.ts +10 -0
- package/dist/agents/parked-resume-drive.js +9 -0
- package/dist/agents/retain-ledger.d.ts +3 -0
- package/dist/agents/send-message-tool.js +7 -2
- package/dist/agents/send-user-message-tool.d.ts +12 -0
- package/dist/agents/send-user-message-tool.js +67 -0
- package/dist/agents/subagent-steps.d.ts +9 -0
- package/dist/agents/subagent-steps.js +38 -0
- package/dist/agents/subagent.d.ts +2 -0
- package/dist/agents/subagent.js +47 -12
- package/dist/agents/verify.js +23 -7
- package/dist/agents/yield-adoption.js +3 -1
- package/dist/brain/anthropic.js +14 -9
- package/dist/brain/open-responses.js +4 -5
- package/dist/brain/openai.js +30 -23
- package/dist/brain/stream-engine.js +159 -151
- package/dist/core/a2a.d.ts +24 -3
- package/dist/core/a2a.js +27 -8
- package/dist/core/actions-digest.d.ts +43 -0
- package/dist/core/actions-digest.js +22 -0
- package/dist/core/agent-state.d.ts +28 -7
- package/dist/core/agent-state.js +19 -6
- package/dist/core/allow-entry.js +3 -3
- package/dist/core/approval-object.d.ts +7 -3
- package/dist/core/approval-object.js +30 -9
- package/dist/core/auto-mode.d.ts +7 -9
- package/dist/core/auto-mode.js +114 -8
- package/dist/core/checkpoint-features.d.ts +16 -5
- package/dist/core/checkpoint-features.js +35 -6
- package/dist/core/checkpoint-rekey.d.ts +1 -1
- package/dist/core/checkpoint-rekey.js +6 -1
- package/dist/core/checkpoint-requirements.d.ts +23 -3
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-row-verdict.d.ts +1 -1
- package/dist/core/checkpoint-row-verdict.js +10 -4
- package/dist/core/checkpoint-store.d.ts +24 -2
- package/dist/core/checkpoint-store.js +1 -0
- package/dist/core/child-clamp-seats.d.ts +15 -0
- package/dist/core/child-clamp-seats.js +15 -0
- package/dist/core/delegation-frames.d.ts +1 -0
- package/dist/core/delegation-frames.js +1 -1
- package/dist/core/effective-path-target.d.ts +19 -0
- package/dist/core/effective-path-target.js +95 -38
- package/dist/core/engine-capabilities.d.ts +5 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +34 -23
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +19 -7
- package/dist/core/entries-not-applied.js +33 -1
- package/dist/core/file-history-store.d.ts +15 -4
- package/dist/core/file-history-store.js +53 -23
- package/dist/core/gate-fold.js +3 -1
- package/dist/core/governance-codes.d.ts +10 -1
- package/dist/core/governance-codes.js +17 -5
- package/dist/core/hooks.d.ts +3 -0
- package/dist/core/hooks.js +1 -0
- package/dist/core/host-instance.d.ts +23 -0
- package/dist/core/host-instance.js +69 -0
- package/dist/core/instruction-preview.d.ts +63 -0
- package/dist/core/instruction-preview.js +406 -0
- package/dist/core/judged-read.d.ts +57 -0
- package/dist/core/judged-read.js +1 -0
- package/dist/core/leg-budget.d.ts +26 -0
- package/dist/core/leg-budget.js +9 -0
- package/dist/core/leg-identity.d.ts +51 -1
- package/dist/core/leg-identity.js +45 -2
- package/dist/core/manager-launch-check.d.ts +48 -0
- package/dist/core/manager-launch-check.js +64 -0
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-host-seat.d.ts +5 -0
- package/dist/core/mcp-host-seat.js +7 -1
- package/dist/core/mcp-injection-drop.d.ts +20 -10
- package/dist/core/mcp-injection-drop.js +9 -3
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/mcp.js +3 -1
- package/dist/core/member-outcome.d.ts +3 -2
- package/dist/core/member-outcome.js +1 -1
- package/dist/core/memory-engine/deletion-record.d.ts +46 -0
- package/dist/core/memory-engine/deletion-record.js +96 -0
- package/dist/core/memory-engine/engine.js +24 -16
- package/dist/core/memory-engine/file-backend.js +7 -5
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layout.js +6 -4
- package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
- package/dist/core/memory-engine/projection-ledger.js +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +69 -11
- package/dist/core/memory-engine/scope-contract.js +99 -34
- package/dist/core/memory-engine/sync-client.js +26 -6
- package/dist/core/memory-engine/sync.d.ts +20 -2
- package/dist/core/memory-engine/sync.js +18 -17
- package/dist/core/mode-policy.d.ts +21 -6
- package/dist/core/mode-policy.js +15 -6
- package/dist/core/mounted-mcp.d.ts +7 -2
- package/dist/core/mounted-mcp.js +10 -1
- package/dist/core/own-property-receipt.js +11 -4
- package/dist/core/param-rule-reach.d.ts +8 -3
- package/dist/core/param-rule-reach.js +9 -1
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +18 -0
- package/dist/core/peer-registration.d.ts +52 -0
- package/dist/core/peer-registration.js +37 -0
- package/dist/core/peer-seat.d.ts +3 -1
- package/dist/core/peer-seat.js +3 -3
- package/dist/core/peer-task-store.d.ts +365 -0
- package/dist/core/peer-task-store.js +682 -0
- package/dist/core/permission-rule-consent.js +6 -11
- package/dist/core/permission-rule-model.d.ts +27 -0
- package/dist/core/permission-rule-model.js +34 -6
- package/dist/core/permission-rule-provider.d.ts +35 -33
- package/dist/core/permission-rule-provider.js +38 -295
- package/dist/core/permission-rule-store.d.ts +181 -8
- package/dist/core/permission-rule-store.js +420 -17
- package/dist/core/permission-rule-sync.js +15 -1
- package/dist/core/project-seat.d.ts +55 -0
- package/dist/core/project-seat.js +96 -0
- package/dist/core/protocol-http-auth.d.ts +3 -2
- package/dist/core/protocol-http-auth.js +26 -18
- package/dist/core/remote-env.d.ts +4 -4
- package/dist/core/retired-keys.js +1 -0
- package/dist/core/rule-offer-read.d.ts +1 -1
- package/dist/core/rule-offer-read.js +32 -4
- package/dist/core/run-ledger-seat.d.ts +66 -0
- package/dist/core/run-ledger-seat.js +70 -0
- package/dist/core/run-ledger.d.ts +332 -0
- package/dist/core/run-ledger.js +550 -0
- package/dist/core/runner/chain-mismatch.d.ts +32 -0
- package/dist/core/runner/chain-mismatch.js +29 -0
- package/dist/core/runner/changes-history.d.ts +1 -0
- package/dist/core/runner/changes-history.js +2 -2
- package/dist/core/runner/checkpoint-scope.d.ts +13 -3
- package/dist/core/runner/checkpoint-scope.js +12 -4
- package/dist/core/runner/construction-doors.js +6 -0
- package/dist/core/runner/contracts.d.ts +22 -3
- package/dist/core/runner/delegation-owner.d.ts +30 -0
- package/dist/core/runner/delegation-owner.js +20 -4
- package/dist/core/runner/file-history-restore.d.ts +3 -1
- package/dist/core/runner/file-history-restore.js +9 -6
- package/dist/core/runner/finish-reason-seat.js +4 -2
- package/dist/core/runner/leg-frame.js +3 -0
- package/dist/core/runner/loaded-skills.d.ts +2 -0
- package/dist/core/runner/loaded-skills.js +10 -0
- package/dist/core/runner/nested-memory-lane.d.ts +22 -5
- package/dist/core/runner/nested-memory-lane.js +91 -30
- package/dist/core/runner/person-path-rows.d.ts +23 -20
- package/dist/core/runner/person-path-rows.js +82 -18
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +105 -90
- package/dist/core/runner/prepare-config-doors.d.ts +1 -0
- package/dist/core/runner/prepare-config-doors.js +5 -3
- package/dist/core/runner/prepare-context-lane.js +1 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +6 -0
- package/dist/core/runner/prepare-execution-env.d.ts +3 -3
- package/dist/core/runner/prepare-file-history.js +1 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +10 -2
- package/dist/core/runner/prepare-hands-readface.js +36 -22
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -5
- package/dist/core/runner/prepare-inherited-gate.js +14 -6
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -2
- package/dist/core/runner/prepare-memory-engine-session.js +2 -2
- package/dist/core/runner/prepare-memory.js +3 -15
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +3 -7
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -0
- package/dist/core/runner/prepare-protocol-tools.js +2 -2
- package/dist/core/runner/prepare-run-refs.d.ts +1 -1
- package/dist/core/runner/prepare-run-refs.js +3 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
- package/dist/core/runner/prepare-suspend-saga.js +4 -2
- package/dist/core/runner/prepare-task.js +50 -37
- package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
- package/dist/core/runner/prepare-turn-wiring.js +2 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -1
- package/dist/core/runner/prepare-wiring-manifest.js +8 -4
- package/dist/core/runner/read-session-changes.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -5
- package/dist/core/runner/resume-checkpoint-screen.d.ts +8 -7
- package/dist/core/runner/resume-checkpoint-screen.js +7 -6
- package/dist/core/runner/resume-review-outcome.d.ts +3 -0
- package/dist/core/runner/resume-review-outcome.js +24 -1
- package/dist/core/runner/rewind-files.js +3 -2
- package/dist/core/runner/run-harness-handlers.js +3 -0
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +9 -2
- package/dist/core/runner/run-notification-lane.js +20 -1
- package/dist/core/runner/run-settle-and-teardown.js +21 -12
- package/dist/core/runner/run-stop-and-final-verify.js +6 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/runtask.d.ts +6 -2
- package/dist/core/runner/runtask.js +21 -9
- package/dist/core/runner/shell-env-withheld.d.ts +3 -2
- package/dist/core/runner/shell-env-withheld.js +1 -2
- package/dist/core/runner/stop-tail-notice.d.ts +10 -2
- package/dist/core/runner/stop-tail-notice.js +9 -2
- package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/task-start-doors.js +6 -3
- package/dist/core/runner/terminal-account.d.ts +10 -1
- package/dist/core/runner/terminal-account.js +23 -3
- package/dist/core/runner/tool-face-overlay.d.ts +2 -11
- package/dist/core/runner/tool-face-overlay.js +39 -0
- package/dist/core/runner/trim-stretch.js +7 -2
- package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
- package/dist/core/runner-deps.d.ts +13 -10
- package/dist/core/scheduler.d.ts +47 -7
- package/dist/core/scheduler.js +19 -7
- package/dist/core/secret-env.d.ts +60 -37
- package/dist/core/secret-env.js +45 -48
- package/dist/core/sensitive-path-policy.js +14 -7
- package/dist/core/session-checkout.d.ts +3 -0
- package/dist/core/session-checkout.js +1 -0
- package/dist/core/session-store.d.ts +12 -6
- package/dist/core/session-store.js +26 -6
- package/dist/core/session.d.ts +31 -8
- package/dist/core/shell-read-silence.js +1 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +17 -0
- package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
- package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/session-store-contract.js +87 -3
- package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
- package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
- package/dist/core/task-event.d.ts +11 -3
- package/dist/core/task-notification.d.ts +97 -10
- package/dist/core/task-notification.js +129 -5
- package/dist/core/task-registry-shared.d.ts +12 -1
- package/dist/core/task-registry-shared.js +3 -1
- package/dist/core/task-registry-workflow.d.ts +1 -1
- package/dist/core/task-registry-workflow.js +9 -1
- package/dist/core/task-registry.d.ts +39 -2
- package/dist/core/task-registry.js +76 -12
- package/dist/core/task-result.d.ts +13 -0
- package/dist/core/task-spec-members.d.ts +3 -1
- package/dist/core/task-spec-members.js +11 -3
- package/dist/core/task-spec.d.ts +57 -23
- package/dist/core/tool-catalog-entries.js +4 -0
- package/dist/core/tool-face-reader.js +1 -1
- package/dist/core/tool-face.d.ts +7 -0
- package/dist/core/tool-face.js +1 -0
- package/dist/core/tool-mount-facts.d.ts +5 -3
- package/dist/core/tool-mount-facts.js +4 -3
- package/dist/core/tool-mount-plan.d.ts +7 -3
- package/dist/core/tool-mount-plan.js +11 -5
- package/dist/core/tool-mount-static.d.ts +2 -2
- package/dist/core/tool-mount-static.js +28 -14
- package/dist/core/tool-registry.d.ts +33 -1
- package/dist/core/tool-registry.js +33 -0
- package/dist/core/tool-result-store.d.ts +19 -2
- package/dist/core/tool-result-store.js +51 -2
- package/dist/core/tool-roster.d.ts +16 -0
- package/dist/core/tool-roster.js +6 -0
- package/dist/core/tool-spec.d.ts +13 -4
- package/dist/core/tools.d.ts +6 -0
- package/dist/core/tools.js +1 -1
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +14 -7
- package/dist/core/wiring-manifest.d.ts +89 -29
- package/dist/core/wiring-manifest.js +44 -4
- package/dist/core/workflow-journal-store.d.ts +53 -10
- package/dist/core/workflow-journal-store.js +27 -4
- package/dist/core/workflow-run-store-contract.js +16 -0
- package/dist/core/workflow-run-store.d.ts +9 -7
- package/dist/core/workflow-run-store.js +4 -1
- package/dist/engine/execution-env/node-execution-env.js +3 -1
- package/dist/engine/harness/messages.d.ts +1 -1
- package/dist/engine/harness/messages.js +2 -1
- package/dist/engine/harness/types.d.ts +24 -1
- package/dist/engine/harness/types.js +10 -0
- package/dist/engine/llm/types.d.ts +5 -7
- package/dist/engine/loop/types.d.ts +2 -0
- package/dist/engine/lsp/node-lsp-manager.js +2 -1
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/session.d.ts +15 -2
- package/dist/engine/session/session.js +35 -5
- package/dist/index.d.ts +27 -12
- package/dist/index.js +20 -8
- package/dist/orchestration/run-workflow-tool.js +40 -32
- package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
- package/dist/orchestration/workflow-park-adoption.js +47 -12
- package/dist/orchestration/workflow-stop.d.ts +128 -0
- package/dist/orchestration/workflow-stop.js +156 -0
- package/dist/orchestration/workflow.d.ts +30 -6
- package/dist/orchestration/workflow.js +117 -54
- package/dist/prompts/manager-recipe.d.ts +18 -0
- package/dist/prompts/manager-recipe.js +24 -0
- package/dist/stores/file/adoption/marker.d.ts +2 -27
- package/dist/stores/file/adoption/marker.js +12 -0
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +1 -1
- package/dist/stores/file/permission-rule-store.d.ts +3 -1
- package/dist/stores/file/permission-rule-store.js +0 -1
- package/dist/stores/file/workflow-journal-store.d.ts +16 -3
- package/dist/stores/file/workflow-journal-store.js +93 -5
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/tools/artifact/artifact-tool.js +11 -6
- package/dist/tools/fs/file-read-check.d.ts +45 -11
- package/dist/tools/fs/file-read-check.js +200 -57
- package/dist/tools/fs/file-write-check.js +9 -3
- package/dist/tools/fs/index.d.ts +8 -7
- package/dist/tools/fs/index.js +4 -4
- package/dist/tools/fs/judged-reads.d.ts +51 -0
- package/dist/tools/fs/judged-reads.js +68 -0
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -5
- package/dist/tools/fs/read-deny.d.ts +33 -8
- package/dist/tools/fs/read-deny.js +114 -25
- package/dist/tools/fs/safety.d.ts +12 -1
- package/dist/tools/fs/safety.js +16 -3
- package/dist/tools/fs/shell-read-check.d.ts +25 -5
- package/dist/tools/fs/shell-read-check.js +100 -15
- package/dist/tools/fs/shell-read-establish.d.ts +9 -0
- package/dist/tools/fs/shell-read-establish.js +34 -14
- package/dist/tools/fs/shell-read-judge.d.ts +13 -1
- package/dist/tools/fs/shell-read-judge.js +26 -7
- package/dist/tools/fs/shell-read-plan.d.ts +5 -0
- package/dist/tools/fs/shell-read-write-targets.js +17 -9
- package/dist/tools/scheduler-store-move.d.ts +74 -0
- package/dist/tools/scheduler-store-move.js +103 -0
- package/dist/tools/scheduler-tools.d.ts +43 -29
- package/dist/tools/scheduler-tools.js +161 -118
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +173 -3
- package/wire-changes/answers/core-stores-sql@7.72.0.json +12 -0
- package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
- package/wire-changes/answers/core@7.72.0.json +84 -0
- package/wire-changes/answers/core@7.73.0.json +216 -0
- package/wire-changes/answers/mods-kernel@7.72.0.json +7 -0
- package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
- package/wire-changes/answers/primitives@7.72.0.json +6 -0
- package/wire-changes/answers/primitives@7.73.0.json +12 -0
- package/wire-changes/answers/wiki-gate@7.72.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
- package/wire-changes/core-stores-sql@7.72.0.json +215 -0
- package/wire-changes/core-stores-sql@7.73.0.json +326 -0
- package/wire-changes/core@7.72.0.json +2426 -0
- package/wire-changes/core@7.73.0.json +6480 -0
- package/wire-changes/mods-kernel@7.72.0.json +147 -0
- package/wire-changes/mods-kernel@7.73.0.json +147 -0
- package/wire-changes/primitives@7.72.0.json +143 -0
- package/wire-changes/primitives@7.73.0.json +227 -0
- package/wire-changes/wiki-gate@7.72.0.json +145 -0
- package/wire-changes/wiki-gate@7.73.0.json +145 -0
|
@@ -6,9 +6,12 @@ import { PEER_MESSAGE_NOTICE } from "../agents/peer-admission.js";
|
|
|
6
6
|
import { buildCrossSessionEnvelope, CROSS_PRINCIPAL_MESSAGE_NOTICE, CROSS_SESSION_MESSAGE_NOTICE, neutralizePeerBody } from "../agents/cross-session-envelope.js";
|
|
7
7
|
import { isMemberOutcome, isMemberCoverage, isRefusedAskList, memberRefusalFaces, outcomeOfLegacyRow, sealMemberLedger, sealMemberOutcome } from "./member-outcome.js";
|
|
8
8
|
import { deliverEngineNotice } from "./engine-notice.js";
|
|
9
|
+
import { isSubagentActions, subagentActionsLine } from "./actions-digest.js";
|
|
9
10
|
import { isAutoModeFallbackCause } from "./auto-mode.js";
|
|
10
11
|
import { sameOccupant } from "../engine/session/repo-utils.js";
|
|
11
12
|
import { codedRefusal } from "./thrown-value.js";
|
|
13
|
+
import { PEER_TASK_HANDLE_RE } from "./task-registry-shared.js";
|
|
14
|
+
import { A2A_WAITING_FOR } from "./a2a-task-state.js";
|
|
12
15
|
import { ONE_SHOT_WAIT_CEILING_DEFAULT_MS } from "../config/defaults.js";
|
|
13
16
|
export { ONE_SHOT_WAIT_CEILING_DEFAULT_MS };
|
|
14
17
|
export const TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze(["completed", "failed", "killed", "cancelled"]);
|
|
@@ -48,6 +51,7 @@ const TASK_NOTIFICATION_TAGS = [
|
|
|
48
51
|
"session-id",
|
|
49
52
|
"recent-steps",
|
|
50
53
|
"edited-files",
|
|
54
|
+
"actions",
|
|
51
55
|
"refused-asks",
|
|
52
56
|
"resumable",
|
|
53
57
|
"agent-name",
|
|
@@ -156,6 +160,7 @@ function renderTaskNotificationCarrier(n) {
|
|
|
156
160
|
const residual = renderResidual(n);
|
|
157
161
|
return residual !== undefined ? [tag("recent-steps", residual)] : [];
|
|
158
162
|
})(),
|
|
163
|
+
...(n.actions !== undefined ? [tag("actions", subagentActionsLine(n.actions))] : []),
|
|
159
164
|
...((faces) => [...(faces.asks !== undefined ? [tag("refused-asks", faces.asks)] : []), ...(faces.rest !== undefined ? [tag("refused", faces.rest)] : [])])(memberRefusalFaces(n.outcome)),
|
|
160
165
|
...(n.resumable !== undefined ? [tag("resumable", n.resumable)] : []),
|
|
161
166
|
...(n.compaction !== undefined ? [tag("context", renderCompactionDisclosure(n.compaction))] : []),
|
|
@@ -246,14 +251,64 @@ export async function completionResultField(result, persist, record, notifier) {
|
|
|
246
251
|
record(artifact.ref);
|
|
247
252
|
return { text: `${report.slice(0, COMPLETION_REPORT_MAX)}\n[result truncated: ${report.length} chars total — ${cutReportReading(artifact)}]` };
|
|
248
253
|
}
|
|
249
|
-
export const
|
|
250
|
-
export const
|
|
254
|
+
export const PEER_TASK_FOLLOW_UPS = Object.freeze(["accepted", "not_accepted"]);
|
|
255
|
+
export const PEER_TASK_CANCEL_STATES = Object.freeze(["not_requested", "requested", "confirmed"]);
|
|
256
|
+
export const PEER_TASK_CLOCK_STATES = Object.freeze(["running", "paused"]);
|
|
257
|
+
export const PEER_TASK_REMINDER_TARGETS = Object.freeze(["peer", "peer_owner", "peer_approver"]);
|
|
258
|
+
export const PEER_TASK_REMINDER_DISPOSITIONS = Object.freeze(["due", "skipped_not_sent", "sent", "received", "answered"]);
|
|
259
|
+
export const PEER_TASK_REMINDER_ROUTES = Object.freeze(["pending_list", "run", "none"]);
|
|
260
|
+
export function peerTaskNotification(input) {
|
|
261
|
+
if (!PEER_TASK_HANDLE_RE.test(input.task_id)) {
|
|
262
|
+
throw new RangeError(`peerTaskNotification: task_id must match ${PEER_TASK_HANDLE_RE}, got ${JSON.stringify(input.task_id)}`);
|
|
263
|
+
}
|
|
264
|
+
if (!Number.isSafeInteger(input.seq) || input.seq < 1) {
|
|
265
|
+
throw new RangeError(`peerTaskNotification: seq must be a positive safe integer, got ${String(input.seq)}`);
|
|
266
|
+
}
|
|
267
|
+
if (input.overdueTail === true && input.status !== "event") {
|
|
268
|
+
throw new RangeError(`peerTaskNotification: overdueTail frames must carry status "event", got ${JSON.stringify(input.status)}`);
|
|
269
|
+
}
|
|
270
|
+
const pt = input.peerTask;
|
|
271
|
+
const terminal = isTerminalTaskNotification({ status: input.status });
|
|
272
|
+
const peerTask = {
|
|
273
|
+
destination: pt.destination,
|
|
274
|
+
followUps: pt.followUps,
|
|
275
|
+
cancel: pt.cancel,
|
|
276
|
+
ackBy: pt.ackBy,
|
|
277
|
+
finalBy: pt.finalBy,
|
|
278
|
+
...(!terminal && pt.waitingFor !== undefined ? { waitingFor: pt.waitingFor } : {}),
|
|
279
|
+
...((terminal || input.overdueTail === true) && pt.remoteMayContinue === true ? { remoteMayContinue: true } : {}),
|
|
280
|
+
};
|
|
281
|
+
const bad = malformedPeerTaskFacet(peerTask);
|
|
282
|
+
if (bad !== undefined)
|
|
283
|
+
throw new RangeError(`peerTaskNotification: ${bad}`);
|
|
284
|
+
const noWake = input.overdueTail === true && input.status === "event" && pt.destination.boundary === "outside";
|
|
285
|
+
return {
|
|
286
|
+
task_id: input.task_id,
|
|
287
|
+
task_type: "peer_task",
|
|
288
|
+
status: input.status,
|
|
289
|
+
seq: input.seq,
|
|
290
|
+
summary: input.summary,
|
|
291
|
+
...(input.result !== undefined ? { result: input.result } : {}),
|
|
292
|
+
...(input.error !== undefined ? { error: input.error } : {}),
|
|
293
|
+
...(input.errorCode !== undefined ? { errorCode: input.errorCode } : {}),
|
|
294
|
+
...(input.stoppedBy !== undefined ? { stoppedBy: input.stoppedBy } : {}),
|
|
295
|
+
...(input.outcome !== undefined ? { outcome: input.outcome } : {}),
|
|
296
|
+
...(input.completionId !== undefined ? { completionId: input.completionId } : {}),
|
|
297
|
+
...(noWake ? { noWake: true } : {}),
|
|
298
|
+
peerTask,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
export const ENGINE_FRAME_CODEC_VERSION = 2;
|
|
302
|
+
export const ENGINE_FRAME_TASK_TYPES = Object.freeze(["background_agent", "monitor", "workflow", "peer_task"]);
|
|
303
|
+
export function engineFrameCodecVersionFor(taskType) {
|
|
304
|
+
return taskType === "peer_task" ? 2 : 1;
|
|
305
|
+
}
|
|
251
306
|
const SHELL_LESS_CARRIERS = ["agentMessage", "crossSessionMessage", "crossSessionNotice", "inboxNotice", "_sema_provenance"];
|
|
252
307
|
export function isEngineFrameParkable(payload) {
|
|
253
308
|
return ENGINE_FRAME_TASK_TYPES.includes(payload.task_type) && SHELL_LESS_CARRIERS.every((k) => payload[k] === undefined);
|
|
254
309
|
}
|
|
255
310
|
export function encodeEngineFrame(payload, priority) {
|
|
256
|
-
return JSON.stringify({ codecVersion:
|
|
311
|
+
return JSON.stringify({ codecVersion: engineFrameCodecVersionFor(payload.task_type), priority, payload });
|
|
257
312
|
}
|
|
258
313
|
export function decodeEngineFrame(content) {
|
|
259
314
|
let raw;
|
|
@@ -282,9 +337,13 @@ export function decodeEngineFrame(content) {
|
|
|
282
337
|
return { ok: false, reason: "malformed", detail: "task_id missing" };
|
|
283
338
|
if (!ENGINE_FRAME_TASK_TYPES.includes(f["task_type"]))
|
|
284
339
|
return { ok: false, reason: "malformed", detail: "task_type outside the engine's lanes" };
|
|
340
|
+
const requiredVersion = engineFrameCodecVersionFor(f["task_type"]);
|
|
341
|
+
if (version < requiredVersion) {
|
|
342
|
+
return { ok: false, reason: "malformed", detail: `task_type ${String(f["task_type"])} requires codec version ${requiredVersion}, got ${version}` };
|
|
343
|
+
}
|
|
285
344
|
if (typeof f["status"] !== "string" || typeof f["summary"] !== "string")
|
|
286
345
|
return { ok: false, reason: "malformed", detail: "status/summary missing" };
|
|
287
|
-
const facet = malformedFacet(f);
|
|
346
|
+
const facet = malformedFacet(f, version);
|
|
288
347
|
if (facet !== undefined)
|
|
289
348
|
return { ok: false, reason: "malformed", detail: facet };
|
|
290
349
|
const payload = { ...p };
|
|
@@ -304,7 +363,7 @@ export function decodeEngineFrame(content) {
|
|
|
304
363
|
return { ok: true, payload, priority };
|
|
305
364
|
}
|
|
306
365
|
const SPAWN_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
307
|
-
function malformedFacet(f) {
|
|
366
|
+
function malformedFacet(f, codecVersion) {
|
|
308
367
|
if (f["spawnName"] !== undefined && (typeof f["spawnName"] !== "string" || !SPAWN_NAME_RE.test(f["spawnName"])))
|
|
309
368
|
return "spawnName outside the spawn-name grammar";
|
|
310
369
|
if (f["noWake"] !== undefined && f["noWake"] !== true)
|
|
@@ -324,6 +383,8 @@ function malformedFacet(f) {
|
|
|
324
383
|
const edits = f["editedFiles"];
|
|
325
384
|
if (edits !== undefined && !(Array.isArray(edits) && edits.every((e) => e !== null && typeof e === "object" && typeof e.path === "string" && typeof e.edits === "number")))
|
|
326
385
|
return "editedFiles is not a list of files";
|
|
386
|
+
if (f["actions"] !== undefined && !isSubagentActions(f["actions"]))
|
|
387
|
+
return "actions is not an actions digest";
|
|
327
388
|
const refused = f["refusedAsks"];
|
|
328
389
|
if (refused !== undefined && !isRefusedAskList(refused))
|
|
329
390
|
return "refusedAsks is not a non-empty list of refused asks";
|
|
@@ -347,6 +408,69 @@ function malformedFacet(f) {
|
|
|
347
408
|
if (kind !== undefined && !(typeof kind === "string" && COMPACTION_KINDS.includes(kind)))
|
|
348
409
|
return "compaction.kind outside its closed set";
|
|
349
410
|
}
|
|
411
|
+
const pt = f["peerTask"];
|
|
412
|
+
if (pt !== undefined && codecVersion >= engineFrameCodecVersionFor("peer_task")) {
|
|
413
|
+
const ptBad = malformedPeerTaskFacet(pt);
|
|
414
|
+
if (ptBad !== undefined)
|
|
415
|
+
return ptBad;
|
|
416
|
+
}
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
const isEpochMs = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0;
|
|
420
|
+
function malformedPeerTaskFacet(pt) {
|
|
421
|
+
if (pt === null || typeof pt !== "object" || Array.isArray(pt))
|
|
422
|
+
return "peerTask is not an object";
|
|
423
|
+
const { destination, followUps, cancel, waitingFor, remoteMayContinue, ackBy, finalBy, peerFinalBy, approvalBy, clock, reminder } = pt;
|
|
424
|
+
if (destination !== undefined) {
|
|
425
|
+
if (destination === null || typeof destination !== "object" || Array.isArray(destination))
|
|
426
|
+
return "peerTask.destination is not an object";
|
|
427
|
+
const { kind, peer, displayName, ownerTeam, boundary } = destination;
|
|
428
|
+
if (kind !== "a2a_peer")
|
|
429
|
+
return "peerTask.destination.kind is not a2a_peer";
|
|
430
|
+
if (typeof peer !== "string" || peer === "")
|
|
431
|
+
return "peerTask.destination.peer is not a non-empty string";
|
|
432
|
+
if (boundary !== "inside" && boundary !== "outside")
|
|
433
|
+
return "peerTask.destination.boundary outside its closed set";
|
|
434
|
+
if (displayName !== undefined && typeof displayName !== "string")
|
|
435
|
+
return "peerTask.destination.displayName is not a string";
|
|
436
|
+
if (ownerTeam !== undefined && typeof ownerTeam !== "string")
|
|
437
|
+
return "peerTask.destination.ownerTeam is not a string";
|
|
438
|
+
}
|
|
439
|
+
if (followUps !== undefined && !(typeof followUps === "string" && PEER_TASK_FOLLOW_UPS.includes(followUps)))
|
|
440
|
+
return "peerTask.followUps outside its closed set";
|
|
441
|
+
if (cancel !== undefined && !(typeof cancel === "string" && PEER_TASK_CANCEL_STATES.includes(cancel)))
|
|
442
|
+
return "peerTask.cancel outside its closed set";
|
|
443
|
+
if (waitingFor !== undefined && !(typeof waitingFor === "string" && A2A_WAITING_FOR.includes(waitingFor)))
|
|
444
|
+
return "peerTask.waitingFor outside its closed set";
|
|
445
|
+
if (remoteMayContinue !== undefined && remoteMayContinue !== true)
|
|
446
|
+
return "peerTask.remoteMayContinue is not true";
|
|
447
|
+
if (ackBy !== undefined && !isEpochMs(ackBy))
|
|
448
|
+
return "peerTask.ackBy is not an epoch-ms instant";
|
|
449
|
+
if (finalBy !== undefined && !isEpochMs(finalBy))
|
|
450
|
+
return "peerTask.finalBy is not an epoch-ms instant";
|
|
451
|
+
if (peerFinalBy !== undefined && !isEpochMs(peerFinalBy))
|
|
452
|
+
return "peerTask.peerFinalBy is not an epoch-ms instant";
|
|
453
|
+
if (approvalBy !== undefined && !isEpochMs(approvalBy))
|
|
454
|
+
return "peerTask.approvalBy is not an epoch-ms instant";
|
|
455
|
+
if (clock !== undefined && !(typeof clock === "string" && PEER_TASK_CLOCK_STATES.includes(clock)))
|
|
456
|
+
return "peerTask.clock outside its closed set";
|
|
457
|
+
if (reminder !== undefined) {
|
|
458
|
+
if (reminder === null || typeof reminder !== "object" || Array.isArray(reminder))
|
|
459
|
+
return "peerTask.reminder is not an object";
|
|
460
|
+
const { n, target, disposition, routedTo } = reminder;
|
|
461
|
+
if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1)
|
|
462
|
+
return "peerTask.reminder.n is not a positive integer";
|
|
463
|
+
if (!(typeof target === "string" && PEER_TASK_REMINDER_TARGETS.includes(target)))
|
|
464
|
+
return "peerTask.reminder.target outside its closed set";
|
|
465
|
+
if (!(typeof disposition === "string" && PEER_TASK_REMINDER_DISPOSITIONS.includes(disposition)))
|
|
466
|
+
return "peerTask.reminder.disposition outside its closed set";
|
|
467
|
+
if (routedTo !== undefined) {
|
|
468
|
+
if (disposition !== "received" && disposition !== "answered")
|
|
469
|
+
return "peerTask.reminder.routedTo requires disposition received or answered";
|
|
470
|
+
if (!(typeof routedTo === "string" && PEER_TASK_REMINDER_ROUTES.includes(routedTo)))
|
|
471
|
+
return "peerTask.reminder.routedTo outside its closed set";
|
|
472
|
+
}
|
|
473
|
+
}
|
|
350
474
|
return undefined;
|
|
351
475
|
}
|
|
352
476
|
export function engineFrameRecordOf(payload, priority, to) {
|
|
@@ -9,7 +9,7 @@ import type { TaskArtifactSeat } from "./tool-result-store.js";
|
|
|
9
9
|
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
10
10
|
/** The kinds of background task the registry holds, as ONE list: {@link SemaTaskType} is derived from it, so a consumer that
|
|
11
11
|
* validates a task kind it read off the wire (a stored row, a listing, a frame) iterates the same source the type is. */
|
|
12
|
-
export declare const SEMA_TASK_TYPES: readonly ["background_bash", "workflow", "background_agent", "monitor"];
|
|
12
|
+
export declare const SEMA_TASK_TYPES: readonly ["background_bash", "workflow", "background_agent", "monitor", "peer_task"];
|
|
13
13
|
export type SemaTaskType = (typeof SEMA_TASK_TYPES)[number];
|
|
14
14
|
/** The handle prefix of each kind: a task id is this one lowercase letter followed by 16 lowercase hex digits (8 random bytes) —
|
|
15
15
|
* the table `TaskRegistry.mintTaskId` mints with, the only one (a reader that tells a kind by its handle reads it here, never a
|
|
@@ -19,9 +19,12 @@ export declare const SEMA_TASK_HANDLE_PREFIXES: Readonly<{
|
|
|
19
19
|
readonly workflow: "w";
|
|
20
20
|
readonly background_agent: "a";
|
|
21
21
|
readonly monitor: "m";
|
|
22
|
+
readonly peer_task: "p";
|
|
22
23
|
}>;
|
|
23
24
|
/** Compile-time fence: `never` while every task kind has a handle prefix. */
|
|
24
25
|
export type TaskHandlePrefixesCoverEveryType = AssertAllKeysHandled<Exclude<SemaTaskType, keyof typeof SEMA_TASK_HANDLE_PREFIXES>>;
|
|
26
|
+
/** Strict handle shape of a `peer_task` row (`p` + 16 lowercase hex digits), derived from {@link SEMA_TASK_HANDLE_PREFIXES}. */
|
|
27
|
+
export declare const PEER_TASK_HANDLE_RE: RegExp;
|
|
25
28
|
/** design/134 §3.3 (R3): WHO initiated a kill — recorded at the initiation site (first-marker-wins),
|
|
26
29
|
* because the settle-side then/catch context has already lost it. OPEN ENUM on the wire, now in the
|
|
27
30
|
* TYPE too (`(string & {})` keeps literal completion while admitting future values like "timeout"
|
|
@@ -298,6 +301,11 @@ export interface WorkflowTaskHandle extends SemaTaskHandle {
|
|
|
298
301
|
sessionScoped?: true;
|
|
299
302
|
/** The run's yield intent — see {@link RegisterWorkflowInput.yieldIntent}. Absent ⇒ the run cannot park its legs. */
|
|
300
303
|
yieldIntent?: AbortController;
|
|
304
|
+
/** The task that dispatched the run — see {@link RegisterWorkflowInput.parentTaskId}. */
|
|
305
|
+
parentTaskId?: string;
|
|
306
|
+
/** How the run's own members ended (`workflowMembersOf` over its record), captured when the run settles beside {@link result} —
|
|
307
|
+
* what a member ledger of the dispatching task reads for this row. Absent while it runs. */
|
|
308
|
+
members?: import("./member-outcome.js").MemberLedger;
|
|
301
309
|
/** The bounded return value, captured on the done-hook so the STORE-LESS in-memory lane's
|
|
302
310
|
* terminal poll can hand it over too (the launch note promises it; without a store there was no result). */
|
|
303
311
|
result?: string;
|
|
@@ -672,6 +680,9 @@ export interface RegisterWorkflowInput extends TaskAccess {
|
|
|
672
680
|
* whole-registry {@link TaskRegistry.yieldBackground} aborts it: each leg in flight parks at its own next clean
|
|
673
681
|
* boundary and the run suspends on its parks. ABSENT ⇒ the run cannot yield (`no_park_lane`). */
|
|
674
682
|
yieldIntent?: AbortController;
|
|
683
|
+
/** The task that dispatched the run — the key a member ledger of that task reads its members by, written as a background agent's
|
|
684
|
+
* row writes it (the dispatching leg's task id, when it is not its session id). */
|
|
685
|
+
parentTaskId?: string;
|
|
675
686
|
}
|
|
676
687
|
/** T2A-7 (2026-07-05 soak): one blocked-poll step, CLAMPED to the caller's deadline — a small timeoutMs
|
|
677
688
|
* (e.g. 10ms) must not sleep the full 400ms step (~40× overshoot, and the overshoot window even served a
|
|
@@ -6,13 +6,15 @@ import { boundedRedactedSummary } from "./untrusted-egress.js";
|
|
|
6
6
|
import { clipWithFilePointer, OUTPUT_BUDGET_MIN_CHARS } from "./tool-errors.js";
|
|
7
7
|
import { resolveEnvBudget } from "./env-budget.js";
|
|
8
8
|
import { isOccupantToken, sameOccupant } from "../engine/session/repo-utils.js";
|
|
9
|
-
export const SEMA_TASK_TYPES = Object.freeze(["background_bash", "workflow", "background_agent", "monitor"]);
|
|
9
|
+
export const SEMA_TASK_TYPES = Object.freeze(["background_bash", "workflow", "background_agent", "monitor", "peer_task"]);
|
|
10
10
|
export const SEMA_TASK_HANDLE_PREFIXES = Object.freeze({
|
|
11
11
|
background_bash: "b",
|
|
12
12
|
workflow: "w",
|
|
13
13
|
background_agent: "a",
|
|
14
14
|
monitor: "m",
|
|
15
|
+
peer_task: "p",
|
|
15
16
|
});
|
|
17
|
+
export const PEER_TASK_HANDLE_RE = new RegExp(`^${SEMA_TASK_HANDLE_PREFIXES.peer_task}[0-9a-f]{16}$`);
|
|
16
18
|
export function monotonicNow() {
|
|
17
19
|
return performance.now();
|
|
18
20
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TaskAccess } from "./task-registry-shared.js";
|
|
2
2
|
import type { CheckpointSeat } from "./checkpoint-seat.js";
|
|
3
3
|
import type { WorkflowRunStore } from "./workflow-run-store.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type WorkflowParkWait, type WorkflowRun } from "../orchestration/workflow-types.js";
|
|
5
5
|
import { type RegistryCore, type RegisterWorkflowInput, type WorkflowTaskHandle, type UnifiedTaskResult } from "./task-registry-shared.js";
|
|
6
6
|
export declare function registerWorkflowLane(core: RegistryCore, input: RegisterWorkflowInput): string;
|
|
7
7
|
/** #5146 — the engine's answers for the parks a finished run made, read when both of the host's stores are at hand (the poll face
|
|
@@ -2,6 +2,7 @@ import { boundedRedactedSummary } from "./untrusted-egress.js";
|
|
|
2
2
|
import { delimitUntrusted } from "./untrusted-text.js";
|
|
3
3
|
import { thrownText } from "./thrown-value.js";
|
|
4
4
|
import { settledRunOf } from "./workflow-settled-run.js";
|
|
5
|
+
import { workflowMembersOf } from "../orchestration/workflow-types.js";
|
|
5
6
|
import { assertOwnership, canAccessWorkflowRun, formatWorkflowRun, sleepPollStep, activityStamp, stampActivity, occupantStamp, } from "./task-registry-shared.js";
|
|
6
7
|
export function registerWorkflowLane(core, input) {
|
|
7
8
|
assertOwnership(input, "registerWorkflow");
|
|
@@ -26,8 +27,13 @@ export function registerWorkflowLane(core, input) {
|
|
|
26
27
|
...(input.store !== undefined ? { store: input.store } : {}),
|
|
27
28
|
...(originatingSessionId !== undefined ? { originatingSessionId, sessionScoped: true } : {}),
|
|
28
29
|
...(input.yieldIntent !== undefined ? { yieldIntent: input.yieldIntent } : {}),
|
|
30
|
+
...(input.parentTaskId !== undefined ? { parentTaskId: input.parentTaskId } : {}),
|
|
29
31
|
};
|
|
30
32
|
core.handles.set(id, handle);
|
|
33
|
+
const holdMembers = (run) => {
|
|
34
|
+
if (run !== undefined && Array.isArray(run.agents))
|
|
35
|
+
handle.members = workflowMembersOf(run);
|
|
36
|
+
};
|
|
31
37
|
void input.handle.done.then((res) => {
|
|
32
38
|
handle.status = "completed";
|
|
33
39
|
const run = res?.run;
|
|
@@ -36,6 +42,7 @@ export function registerWorkflowLane(core, input) {
|
|
|
36
42
|
handle.result = r;
|
|
37
43
|
if (run?.completionId !== undefined)
|
|
38
44
|
handle.completionId = run.completionId;
|
|
45
|
+
holdMembers(run);
|
|
39
46
|
stampActivity(handle);
|
|
40
47
|
core.pokeYieldDrains();
|
|
41
48
|
}, (err) => {
|
|
@@ -43,6 +50,7 @@ export function registerWorkflowLane(core, input) {
|
|
|
43
50
|
handle.status = "failed";
|
|
44
51
|
const settledRun = settledRunOf(input.handle.done);
|
|
45
52
|
const settleId = settledRun?.completionId;
|
|
53
|
+
holdMembers(settledRun);
|
|
46
54
|
handle.error = boundedRedactedSummary(thrownText(err), 500);
|
|
47
55
|
if (settleId !== undefined)
|
|
48
56
|
handle.completionId = settleId;
|
|
@@ -135,7 +143,7 @@ export async function stopWorkflowLane(handle) {
|
|
|
135
143
|
type: "workflow",
|
|
136
144
|
status: "cancelled",
|
|
137
145
|
stopped: true,
|
|
138
|
-
note:
|
|
146
|
+
note: `workflow cancelled: what was running was stopped. Its record keeps the outcome the run settles with (a script that returns after its stopped agents' results come back is recorded as completed), and it can be continued with resumeFromRunId: "${handle.id}".`,
|
|
139
147
|
}),
|
|
140
148
|
details: { task_id: handle.id, type: "workflow", status: "cancelled", retrieval_status: "success" },
|
|
141
149
|
};
|
|
@@ -2,14 +2,17 @@ import type { AgentTool, ExecutionEnv } from "../internal/harness.js";
|
|
|
2
2
|
import type { ToolEffect } from "./types.js";
|
|
3
3
|
import { type BackgroundHardKillOutcome, type BackgroundShellCapability, type BackgroundShellId } from "./background-shell.js";
|
|
4
4
|
import type { BoundaryLegsGiven } from "./cross-boundary-taint.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type WorkflowRunStore } from "./workflow-run-store.js";
|
|
6
6
|
import type { WorkflowAgentStopReceipt } from "../orchestration/workflow-types.js";
|
|
7
|
+
import type { WorkflowRunStopReceipt } from "../orchestration/workflow-stop.js";
|
|
8
|
+
import type { WorkflowJournalStore } from "./workflow-journal-store.js";
|
|
9
|
+
import type { CheckpointStore } from "./checkpoint-store.js";
|
|
7
10
|
import { type BackgroundAgentRecord, type BackgroundAgentSettledStatus, type BackgroundAgentStore } from "./background-agent-store.js";
|
|
8
11
|
import type { TaskNotificationPayload } from "./task-notification.js";
|
|
9
12
|
import type { ExtensionRequester } from "./task-event.js";
|
|
10
13
|
import { type TaskArtifactSeat } from "./tool-result-store.js";
|
|
11
14
|
import { type SemaTaskType, type StopSource, type SemaTaskStatus, type TaskRetrievalStatus, type UnifiedTaskOutput, type UnifiedTaskResult, type SemaTaskHandle, type TaskAccess, type BackgroundAgentTaskHandle, type MonitorTimers, type RegisterMonitorInput, type RegisterWorkflowInput, canAccessWorkflowRun, clipTaskOutput, MONITOR_BATCH_WINDOW_MS, MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, MONITOR_MAX_BATCHES_PER_MINUTE, type OccupantMount } from "./task-registry-shared.js";
|
|
12
|
-
export { SEMA_TASK_TYPES, SEMA_TASK_HANDLE_PREFIXES, normalizeAgentName, DURABLE_AGENT_HEARTBEAT_MS, DURABLE_AGENT_HANDLE_RE, BG_AGENT_REAP_STOP_ERROR, engineAgentName, chosenAgentName, PARKED_CLAIM_ROLLBACKS, PARKED_CLAIM_ROLLBACK_FACE } from "./task-registry-shared.js";
|
|
15
|
+
export { SEMA_TASK_TYPES, SEMA_TASK_HANDLE_PREFIXES, PEER_TASK_HANDLE_RE, normalizeAgentName, DURABLE_AGENT_HEARTBEAT_MS, DURABLE_AGENT_HANDLE_RE, BG_AGENT_REAP_STOP_ERROR, engineAgentName, chosenAgentName, PARKED_CLAIM_ROLLBACKS, PARKED_CLAIM_ROLLBACK_FACE } from "./task-registry-shared.js";
|
|
13
16
|
export type { ParkedClaimTicket, ParkedClaimRollback, RegisterBackgroundAgentInput, BackgroundUnyieldableReason, BackgroundYieldLane, BackgroundYieldOptions, BackgroundYieldReport } from "./task-registry-shared.js";
|
|
14
17
|
import type { RegisterBackgroundAgentInput, ParkedClaimTicket, ParkedClaimRollback, ChildSessionStore, LandedAgentTerminal, BackgroundYieldOptions, BackgroundYieldReport } from "./task-registry-shared.js";
|
|
15
18
|
import type { ChildSessionAnchor } from "./task-registry-agent.js";
|
|
@@ -185,6 +188,10 @@ export interface AccessibleTaskRow {
|
|
|
185
188
|
export declare function abortBackgroundAgentsAtRunEnd(registry: TaskRegistry, access: TaskAccess, opts: {
|
|
186
189
|
skipSessionScoped?: boolean;
|
|
187
190
|
}, runEnd: RunEndCause | undefined): number;
|
|
191
|
+
/** Watch the running agents {@link ownerSweepTakes} selects for `access` and `opts`; returns `undefined` when none remain, else an unsubscribe and calls `onSettled` once when they settle. */
|
|
192
|
+
export declare function onRunEndAgentsSettled(registry: TaskRegistry, access: TaskAccess, opts: {
|
|
193
|
+
skipSessionScoped?: boolean;
|
|
194
|
+
}, onSettled: () => void): (() => void) | undefined;
|
|
188
195
|
export declare class TaskRegistry {
|
|
189
196
|
private handles;
|
|
190
197
|
/** observers of the design/129 session terminal anchor — `reapSessionBackground`
|
|
@@ -548,6 +555,9 @@ export declare class TaskRegistry {
|
|
|
548
555
|
* site building that settle's completion frame (read in the settle's own step, like {@link getCompletionId}). Undefined for a
|
|
549
556
|
* row still running or parked, a row of another task kind, or an id this registry never held. */
|
|
550
557
|
getAgentOutcome(id: string): import("./member-outcome.js").MemberOutcome | undefined;
|
|
558
|
+
/** How a workflow run's own members ended, as the row holds it once the run settled ({@link WorkflowTaskHandle.members}) —
|
|
559
|
+
* undefined while it runs, for a row of another task kind, or an id this registry never held. */
|
|
560
|
+
getWorkflowMembers(id: string): import("./member-outcome.js").MemberLedger | undefined;
|
|
551
561
|
/** Record the ref a task's result was stored under (`persistTaskArtifact` landed it) — the read handle a later list of
|
|
552
562
|
* tasks names for it. `completionId` = the settle the result belongs to ({@link getCompletionId}, read in that settle's own
|
|
553
563
|
* synchronous step — every terminal frame carries it): the write records only while the row still holds that settle. A row revived
|
|
@@ -562,6 +572,13 @@ export declare class TaskRegistry {
|
|
|
562
572
|
/** The read handle ({@link taskReadHandleText}) of a task `access` reaches — `undefined` for an unknown or unreachable
|
|
563
573
|
* id (the same info-hiding a poll gives) and for a task with nothing to read beyond its notification. */
|
|
564
574
|
readHandleOf(id: string, access: TaskAccess): string | undefined;
|
|
575
|
+
/** The run teardown's "a person stopped this run" judgement, marked on the background agents the run-end reap takes (the reap's
|
|
576
|
+
* own row set: owner + scope, session-resident rows skipped when `skipSessionScoped`) before that reap marks them "parent" —
|
|
577
|
+
* first-marker-wins then holds "user". Read by the shell settle ({@link settleKilledForOwner}) and by a run whose member ledger
|
|
578
|
+
* reads its last word after the reap (`reapTaskAgentsBeforeLastWord`), whichever runs first. */
|
|
579
|
+
markRunEndAgentsStoppedByUser(access: TaskAccess, opts?: {
|
|
580
|
+
skipSessionScoped?: boolean;
|
|
581
|
+
}): void;
|
|
565
582
|
/** Bulk stop-source attribution for one owner — the registry-side primitive that
|
|
566
583
|
* replaces the service's `list()+markStopSource` per-row loop, which had TWO holes: ① `list()` didn't
|
|
567
584
|
* expose `sessionScoped`, so on the resume leg (canonical taskId==sessionId, rebuilt taskConfig without
|
|
@@ -783,6 +800,22 @@ export declare class TaskRegistry {
|
|
|
783
800
|
readonly stoppedBy?: StopSource;
|
|
784
801
|
readonly workflowStore?: WorkflowRunStore;
|
|
785
802
|
}): Promise<WorkflowAgentStopReceipt>;
|
|
803
|
+
/**
|
|
804
|
+
* #5291 — stop the WORKFLOW `runId` belongs to, for good (`WorkflowHandle.stop`): no run of it starts another step, whichever process
|
|
805
|
+
* continues it, and every approval card of it still waiting is withdrawn. The caller's access is judged before any tree read or write,
|
|
806
|
+
* on the run held here or the record `workflowStore` gives — a run the caller cannot see answers `not_found`, with nothing written. A run held
|
|
807
|
+
* here is stopped through its own handle (its own stores); one read from the store is stopped through the stores given
|
|
808
|
+
* (`journalStore` keeps the stop — without one, or one without `stopResumeClaim`, the stop is not durable; `checkpointStore` is where
|
|
809
|
+
* its cards are withdrawn). The record is read before access is judged (access is judged on it): a row that does not read answers
|
|
810
|
+
* `not_found`, as a missing one does; a store read that throws otherwise rejects. TaskStop ({@link stopTask}) only cancels: a cancelled
|
|
811
|
+
* run can be continued.
|
|
812
|
+
*/
|
|
813
|
+
stopWorkflowRun(runId: string, access: TaskAccess, opts?: {
|
|
814
|
+
readonly stoppedBy?: StopSource;
|
|
815
|
+
readonly workflowStore?: WorkflowRunStore;
|
|
816
|
+
readonly journalStore?: WorkflowJournalStore;
|
|
817
|
+
readonly checkpointStore?: CheckpointStore;
|
|
818
|
+
}): Promise<WorkflowRunStopReceipt>;
|
|
786
819
|
stopTask(id: string, access: TaskAccess, opts?: TaskStopOptions): Promise<UnifiedTaskResult>;
|
|
787
820
|
/** S2b — bounded delivery-confirmation wait (see deliverToRunningAgent). Test-tunable. */
|
|
788
821
|
deliverConfirmTimeoutMs: number;
|
|
@@ -801,6 +834,10 @@ export declare class TaskRegistry {
|
|
|
801
834
|
* cap ({@link list}'s): the one reading of a leg's live background tasks (its end's {@link owedDeliveries}, the post-compaction
|
|
802
835
|
* listing and the resume's orphan diff, the suspend's snapshot), each consumer projecting its own columns from it. */
|
|
803
836
|
liveTasks(access: TaskAccess): TaskListRow[];
|
|
837
|
+
/** The background agents and workflow runs `access` reaches whose row names `taskId` as the task that dispatched them
|
|
838
|
+
* (`parentTaskId`), newest first — EVERY one, with no display cap: a task's members read as one set, however many rows of other
|
|
839
|
+
* tasks the reach holds. */
|
|
840
|
+
membersOfTask(access: TaskAccess, taskId: string): TaskListRow[];
|
|
804
841
|
/** The child session task `taskId`'s row is anchored to — its id and the store the child's run holds it through — when
|
|
805
842
|
* `access` reaches the row (the reach {@link list} reads with): `undefined` for an unknown or out-of-reach id, `null` for a
|
|
806
843
|
* reached row with no anchor (no background agent's row, not bound yet, or released). */
|
|
@@ -3,6 +3,7 @@ import { defineTool, errorResult } from "./tools.js";
|
|
|
3
3
|
import { envDeclaresRetain, hasBackgroundShell, retainsBackgroundProcesses } from "./background-shell.js";
|
|
4
4
|
import { shutdownDebug } from "./shutdown-debug.js";
|
|
5
5
|
import { mintCompletionId } from "./completion-id.js";
|
|
6
|
+
import { WORKFLOW_RUN_ROW_MALFORMED_CODE, WorkflowRunStoreError } from "./workflow-run-store.js";
|
|
6
7
|
import { canAccessAgentRecord, } from "./background-agent-store.js";
|
|
7
8
|
import { delimitUntrusted } from "./untrusted-text.js";
|
|
8
9
|
import { createSafeNotifier } from "./safe-notify.js";
|
|
@@ -12,7 +13,7 @@ import { persistTaskArtifact, taskArtifactOriginOf } from "./tool-result-store.j
|
|
|
12
13
|
import { registerMonitorLane, pollMonitorLane, stopMonitorLane } from "./task-registry-monitor.js";
|
|
13
14
|
import { registerWorkflowLane, pollWorkflowLane, stopWorkflowLane, workflowParkWaitsOf } from "./task-registry-workflow.js";
|
|
14
15
|
import { taskReadHandleText, canAccessWorkflowRun, formatWorkflowRun, clipTaskOutput, assertOwnership, sleepPollStep, statusFromBackground, rollSpoolText, accountDroppedBytes, dropFactsOf, renderSpoolBody, stdoutHeadingOf, REPLAY_FACE, SPOOL_REPLAY, INCREMENT_REPLAY, spoolDropNote, droppedGapNote, alreadyTerminalStopNote, terminalTaskSummary, TASK_OUTPUT_MAX_CHARS, MONITOR_BATCH_WINDOW_MS, MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, MONITOR_MAX_BATCHES_PER_MINUTE, canAccess, isLiveSessionResidentAgent, DURABLE_AGENT_HANDLE_RE, SEMA_TASK_HANDLE_PREFIXES, activityStamp, stampActivity, occupantStamp, callOccupant, } from "./task-registry-shared.js";
|
|
15
|
-
export { SEMA_TASK_TYPES, SEMA_TASK_HANDLE_PREFIXES, normalizeAgentName, DURABLE_AGENT_HEARTBEAT_MS, DURABLE_AGENT_HANDLE_RE, BG_AGENT_REAP_STOP_ERROR, engineAgentName, chosenAgentName, PARKED_CLAIM_ROLLBACKS, PARKED_CLAIM_ROLLBACK_FACE } from "./task-registry-shared.js";
|
|
16
|
+
export { SEMA_TASK_TYPES, SEMA_TASK_HANDLE_PREFIXES, PEER_TASK_HANDLE_RE, normalizeAgentName, DURABLE_AGENT_HEARTBEAT_MS, DURABLE_AGENT_HANDLE_RE, BG_AGENT_REAP_STOP_ERROR, engineAgentName, chosenAgentName, PARKED_CLAIM_ROLLBACKS, PARKED_CLAIM_ROLLBACK_FACE } from "./task-registry-shared.js";
|
|
16
17
|
import { attachYieldLegLane, requestYieldLane, yieldCovers, yieldPopulationLane, yieldPopulationLeftRunning, yieldPopulationWrites, yieldRequested } from "./task-registry-yield.js";
|
|
17
18
|
import { TASK_STOP_TOOL_NAME, TASK_STOP_MISSING_ID_MESSAGE, TASK_STOP_PARAMS, TASK_STOP_DESCRIPTION, resolveTaskIdArg } from "./task-tool-shape.js";
|
|
18
19
|
import { durableAgentArmedLane, durableAgentRowProbeLane, durableAgentRowFactsLane, beginDurableClaimLane, endDurableClaimLane, reapDurableAgentsLane, noteBackgroundAgentActivityLane, reapStaleSessionBackgroundAgentsLane, announceLandedAgentTerminal, releaseDurableTranscriptAnchorLane, bindBackgroundAgentSessionLane, childSessionAnchorOf, registerBackgroundAgentLane, recordBackgroundAgentOrgAdmissionLane, parkBackgroundAgentLane, reconcileParkedAgentsLane, claimParkedAgentLane, rollbackParkedClaimLane, consumeParkedFlipLane, finalizeParkedResumeLane, settleBackgroundAgentLane, abortBackgroundAgentsForOwnerLane, ownerSweepTakes, serveDurableAgentRowLane, agentHandleOutcomeOf, resolveBackgroundAgentByNameLane, claimBackgroundAgentNameLane, backgroundAgentCycleSeqLane, activeDelegationHandlesLane, activeDelegationHandlesByRootLane, activeDelegationOccupantsLane, markRetainedContinuationLane, reviveBackgroundAgentLane, settleRevivedAgentLane, unmarkRetainedContinuationLane, endRetentionHoldLane, attachAgentNotifyLane, deliverToRunningAgentLane, runningBackgroundAgentLabelsLane, runningAgentFooterLane, notFoundRunningAgentsTail, pollBackgroundAgentLane, stopBackgroundAgentLane, } from "./task-registry-agent.js";
|
|
@@ -161,6 +162,10 @@ let sweepAtRunEnd;
|
|
|
161
162
|
export function abortBackgroundAgentsAtRunEnd(registry, access, opts, runEnd) {
|
|
162
163
|
return sweepAtRunEnd(registry, access, opts, runEnd);
|
|
163
164
|
}
|
|
165
|
+
let watchRunEndAgents;
|
|
166
|
+
export function onRunEndAgentsSettled(registry, access, opts, onSettled) {
|
|
167
|
+
return watchRunEndAgents(registry, access, opts, onSettled);
|
|
168
|
+
}
|
|
164
169
|
export class TaskRegistry {
|
|
165
170
|
handles = new Map();
|
|
166
171
|
sessionReapHooks = new Set();
|
|
@@ -310,6 +315,24 @@ export class TaskRegistry {
|
|
|
310
315
|
}
|
|
311
316
|
static {
|
|
312
317
|
sweepAtRunEnd = (registry, access, opts, runEnd) => abortBackgroundAgentsForOwnerLane(registry.core, access, opts, runEnd);
|
|
318
|
+
watchRunEndAgents = (registry, access, opts, onSettled) => {
|
|
319
|
+
const anyLeft = () => {
|
|
320
|
+
for (const handle of registry.handles.values())
|
|
321
|
+
if (ownerSweepTakes(handle, access, opts))
|
|
322
|
+
return true;
|
|
323
|
+
return false;
|
|
324
|
+
};
|
|
325
|
+
if (!anyLeft())
|
|
326
|
+
return undefined;
|
|
327
|
+
const check = () => {
|
|
328
|
+
if (!registry.drainChecks.has(check) || anyLeft())
|
|
329
|
+
return;
|
|
330
|
+
registry.drainChecks.delete(check);
|
|
331
|
+
onSettled();
|
|
332
|
+
};
|
|
333
|
+
registry.drainChecks.add(check);
|
|
334
|
+
return () => void registry.drainChecks.delete(check);
|
|
335
|
+
};
|
|
313
336
|
}
|
|
314
337
|
serveDurableAgentRow(row, checkpointSeat) {
|
|
315
338
|
const read = readAgentState(agentStateSourceOfRecord(row), checkpointSeat, Date.now());
|
|
@@ -514,6 +537,10 @@ export class TaskRegistry {
|
|
|
514
537
|
const h = this.handles.get(id);
|
|
515
538
|
return h?.type === "background_agent" ? h.outcome : undefined;
|
|
516
539
|
}
|
|
540
|
+
getWorkflowMembers(id) {
|
|
541
|
+
const h = this.handles.get(id);
|
|
542
|
+
return h?.type === "workflow" ? h.members : undefined;
|
|
543
|
+
}
|
|
517
544
|
recordArtifactRef(id, ref, completionId) {
|
|
518
545
|
const h = this.handles.get(id);
|
|
519
546
|
if (h === undefined || completionId === undefined || h.completionId !== completionId)
|
|
@@ -528,6 +555,17 @@ export class TaskRegistry {
|
|
|
528
555
|
const h = this.handles.get(id);
|
|
529
556
|
return h !== undefined && canAccess(h, access) ? taskReadHandleText(h) : undefined;
|
|
530
557
|
}
|
|
558
|
+
markRunEndAgentsStoppedByUser(access, opts) {
|
|
559
|
+
for (const handle of this.handles.values()) {
|
|
560
|
+
if (handle.type !== "background_agent" || handle.status !== "running")
|
|
561
|
+
continue;
|
|
562
|
+
if (!canAccess(handle, { owner: access.owner, scope: access.scope }))
|
|
563
|
+
continue;
|
|
564
|
+
if (opts?.skipSessionScoped && handle.sessionScoped)
|
|
565
|
+
continue;
|
|
566
|
+
this.markStopSource(handle.id, "user");
|
|
567
|
+
}
|
|
568
|
+
}
|
|
531
569
|
markStopSourceForOwner(access, source, opts) {
|
|
532
570
|
let marked = 0;
|
|
533
571
|
for (const handle of this.handles.values()) {
|
|
@@ -551,17 +589,8 @@ export class TaskRegistry {
|
|
|
551
589
|
async settleKilledForOwner(access, opts) {
|
|
552
590
|
const source = opts?.source ?? "parent";
|
|
553
591
|
const clause = (by) => by === "user" ? "stopped by user" : by === "parent" ? "its parent run ended" : `stopped by ${by}`;
|
|
554
|
-
if (source === "user")
|
|
555
|
-
|
|
556
|
-
if (handle.type !== "background_agent" || handle.status !== "running")
|
|
557
|
-
continue;
|
|
558
|
-
if (!canAccess(handle, { owner: access.owner, scope: access.scope }))
|
|
559
|
-
continue;
|
|
560
|
-
if (opts?.skipSessionScoped && handle.sessionScoped)
|
|
561
|
-
continue;
|
|
562
|
-
this.markStopSource(handle.id, source);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
592
|
+
if (source === "user")
|
|
593
|
+
this.markRunEndAgentsStoppedByUser(access, opts);
|
|
565
594
|
let settled = 0;
|
|
566
595
|
for (const handle of this.handles.values()) {
|
|
567
596
|
if (handle.type !== "background_bash" && handle.type !== "monitor")
|
|
@@ -1115,6 +1144,32 @@ The durable record is still marked running (last update ${new Date(row.updatedAt
|
|
|
1115
1144
|
}
|
|
1116
1145
|
return { answer: "not_found" };
|
|
1117
1146
|
}
|
|
1147
|
+
async stopWorkflowRun(runId, access, opts = {}) {
|
|
1148
|
+
const id = runId.trim();
|
|
1149
|
+
const { readWorkflowStopper, stopWorkflowTree } = await import("../orchestration/workflow-stop.js");
|
|
1150
|
+
const stoppedBy = readWorkflowStopper(opts.stoppedBy, "TaskRegistry.stopWorkflowRun");
|
|
1151
|
+
const handle = this.resolveInternal(id, access);
|
|
1152
|
+
if (handle !== undefined)
|
|
1153
|
+
return handle.type === "workflow" && handle.handle.stop !== undefined ? handle.handle.stop({ stoppedBy }) : { answer: "not_found" };
|
|
1154
|
+
const store = opts.workflowStore;
|
|
1155
|
+
if (store === undefined)
|
|
1156
|
+
return { answer: "not_found" };
|
|
1157
|
+
let run;
|
|
1158
|
+
try {
|
|
1159
|
+
run = await store.get(id);
|
|
1160
|
+
}
|
|
1161
|
+
catch (err) {
|
|
1162
|
+
if (err instanceof WorkflowRunStoreError && err.code === WORKFLOW_RUN_ROW_MALFORMED_CODE)
|
|
1163
|
+
return { answer: "not_found" };
|
|
1164
|
+
throw err;
|
|
1165
|
+
}
|
|
1166
|
+
const now = this.heldWorkflow(id, store);
|
|
1167
|
+
if (now !== undefined && canAccess(now, access))
|
|
1168
|
+
return now.handle.stop !== undefined ? now.handle.stop({ stoppedBy }) : { answer: "not_found" };
|
|
1169
|
+
if (!run || !canAccessWorkflowRun(run, access, now))
|
|
1170
|
+
return { answer: "not_found" };
|
|
1171
|
+
return stopWorkflowTree(id, run.scope, stoppedBy, { runStore: store, ...(opts.journalStore !== undefined ? { journalStore: opts.journalStore } : {}), ...(opts.checkpointStore !== undefined ? { checkpointStore: opts.checkpointStore } : {}) });
|
|
1172
|
+
}
|
|
1118
1173
|
async stopTask(id, access, opts = {}) {
|
|
1119
1174
|
const taskId = id.trim();
|
|
1120
1175
|
const handle = this.resolveInternal(taskId, access);
|
|
@@ -1199,6 +1254,15 @@ The durable record is still marked running (last update ${new Date(row.updatedAt
|
|
|
1199
1254
|
liveTasks(access) {
|
|
1200
1255
|
return this.rowsUnder(access).filter((t) => t.status === "pending" || t.status === "running" || t.status === "parked");
|
|
1201
1256
|
}
|
|
1257
|
+
membersOfTask(access, taskId) {
|
|
1258
|
+
const out = [];
|
|
1259
|
+
for (const h of this.handles.values()) {
|
|
1260
|
+
if ((h.type === "background_agent" || h.type === "workflow") && h.parentTaskId === taskId && canAccess(h, access))
|
|
1261
|
+
out.push(this.projectedRow(h));
|
|
1262
|
+
}
|
|
1263
|
+
out.sort((a, b) => b.createdAt - a.createdAt);
|
|
1264
|
+
return out;
|
|
1265
|
+
}
|
|
1202
1266
|
anchoredSession(taskId, access) {
|
|
1203
1267
|
const h = this.handles.get(taskId);
|
|
1204
1268
|
return h !== undefined && canAccess(h, access) ? (childSessionAnchorOf(h) ?? null) : undefined;
|
|
@@ -803,6 +803,19 @@ export interface TaskResult {
|
|
|
803
803
|
* know whether it is reading a saturated list can compare the length against that ceiling.
|
|
804
804
|
*/
|
|
805
805
|
editedFiles?: import("../agents/subagent-steps.js").SubagentEditedFile[];
|
|
806
|
+
/**
|
|
807
|
+
* The run's MEMBER LEDGER (`RunLedger`) — present exactly when the task keeps one (its first leg declared `TaskSpec.runLedger`;
|
|
808
|
+
* a resumed leg keeps its row's), on every terminal:
|
|
809
|
+
* one row per member it dispatched with the engine's reading of how each ended, what each said and did, and which completed
|
|
810
|
+
* rows no accepted check points at; the run's coverage; a headline computed from those counts (never the model's words); and
|
|
811
|
+
* the same in fixed sentences (`text`) for an outlet with no interface of its own. `result` is unchanged by it — the ledger
|
|
812
|
+
* stands BESIDE the model's answer. A host's wire carries it under {@link import("./run-ledger.js").RUN_LEDGER_WIRE_KEY}.
|
|
813
|
+
*/
|
|
814
|
+
runLedger?: import("./run-ledger.js").RunLedger;
|
|
815
|
+
/** Present exactly on a resumed leg whose spec declares `TaskSpec.runLedger` while the row it resumed was parked by a leg that
|
|
816
|
+
* kept no ledger: the sentence saying the task keeps none ({@link import("./run-ledger.js").RUN_LEDGER_NOT_KEPT_SENTENCE}) —
|
|
817
|
+
* whether a task keeps one is fixed by its first leg. No notice code. */
|
|
818
|
+
runLedgerNotKept?: string;
|
|
806
819
|
/**
|
|
807
820
|
* Present (`true`) exactly when the run's FINAL turn was halted by a person's BARE rejection of a
|
|
808
821
|
* tool call, or of the plan a plan pause held — the parent-thread control-flow boundary: the rejected
|
|
@@ -45,7 +45,7 @@ declare const SPEC_MEMBER_TABLE: {
|
|
|
45
45
|
images: 0;
|
|
46
46
|
userAttachments: 0;
|
|
47
47
|
sessionId: "session";
|
|
48
|
-
|
|
48
|
+
project: 0;
|
|
49
49
|
workspace: 0;
|
|
50
50
|
requireExistingSession: "session";
|
|
51
51
|
oneShot: 0;
|
|
@@ -101,6 +101,8 @@ declare const SPEC_MEMBER_TABLE: {
|
|
|
101
101
|
maxSuspends: 0;
|
|
102
102
|
checkpointStore: 0;
|
|
103
103
|
handsReadOnly: 0;
|
|
104
|
+
ownHandsReadOnly: 0;
|
|
105
|
+
runLedger: 0;
|
|
104
106
|
memoryPersistenceCapable: 0;
|
|
105
107
|
additionalDirectories: 0;
|
|
106
108
|
additionalReadDirectories: 0;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { RETIRED_TASK_SPEC_KEYS, retiredKeyOf, retiredKeyRefusal } from "./retired-keys.js";
|
|
2
|
-
import { thrownText } from "./thrown-value.js";
|
|
2
|
+
import { codedRefusal, thrownText } from "./thrown-value.js";
|
|
3
|
+
import { screenProjectSeat } from "./project-seat.js";
|
|
3
4
|
import { callerKey } from "./caller-text.js";
|
|
4
5
|
import { strayMembersOf } from "./own-property-receipt.js";
|
|
5
6
|
const SESSION = "session";
|
|
6
7
|
const ENTRY = "entry";
|
|
7
8
|
const SPEC_MEMBER_TABLE = {
|
|
8
9
|
taskId: 0, objective: 0, wake: ENTRY, principal: 0, isolationScope: 0, actor: 0, runOrigin: 0, interactionPosture: 0, approvalReach: 0, interactiveQuestionFallback: 0,
|
|
9
|
-
images: 0, userAttachments: 0, sessionId: SESSION,
|
|
10
|
+
images: 0, userAttachments: 0, sessionId: SESSION, project: 0, workspace: 0, requireExistingSession: SESSION, oneShot: 0, clientContext: 0, resumeAt: ENTRY,
|
|
10
11
|
resumeAtMode: ENTRY, model: 0, modelRole: 0, roles: 0, advisorModel: 0, thinking: 0, fastMode: 0, systemPrompt: 0,
|
|
11
12
|
promptRole: 0, promptForm: 0, promptBinding: 0, promptLocale: 0, appendSystemPrompt: 0, outputStyle: 0, memory: 0, suggestNextPrompts: 0, fileHistory: 0,
|
|
12
13
|
projectMemory: 0, instructionFamily: 0, restoreFiles: ENTRY, acceptPartialRestore: ENTRY, unplacedHistoryRecordedUnder: ENTRY, rewindFilesTo: ENTRY, tools: 0, allowTools: 0, excludeTools: 0, excludeAllTools: 0,
|
|
13
14
|
deferTools: 0, toolMaterializeStrategy: 0, alwaysLoadTools: 0, restoreGatedTools: 0, deferSelfResolve: 0, promptLean: 0, agents: 0, toolPolicy: 0,
|
|
14
15
|
basePolicyForResumeEdit: 0, onAsk: 0, onQuestion: 0, lspManager: 0, lspDiagnostics: 0, mods: 0, peerPresence: 0, durableApproval: 0,
|
|
15
|
-
resourceSuspend: 0, preemptSignal: 0, resilience: 0, finalVerification: 0, maxSuspends: 0, checkpointStore: 0, handsReadOnly: 0, memoryPersistenceCapable: 0,
|
|
16
|
+
resourceSuspend: 0, preemptSignal: 0, resilience: 0, finalVerification: 0, maxSuspends: 0, checkpointStore: 0, handsReadOnly: 0, ownHandsReadOnly: 0, runLedger: 0, memoryPersistenceCapable: 0,
|
|
16
17
|
additionalDirectories: 0, additionalReadDirectories: 0, readDenyPatterns: 0, writeProtectedAdditions: 0, agentConfigDirs: 0, agentHomeDirs: 0, complianceAdditionalDenies: 0, readFace: 0, writeFace: 0, enablePlanMode: 0,
|
|
17
18
|
planFile: 0, interactiveTools: 0, enableFork: 0, shellGate: 0, permissionMode: 0, classifyAllShell: 0, blockReadsOutsideRoots: 0, mcp: 0, a2a: 0,
|
|
18
19
|
skills: 0, userInvokedSkills: 0, allowedTools: 0, skillListingBudgetFraction: 0, skillListingMaxDescChars: 0, backgroundScope: 0, sandbox: 0, envFacts: 0, limits: 0,
|
|
@@ -110,6 +111,13 @@ export function readCallerSpec(spec, takeSeat) {
|
|
|
110
111
|
else if (own.stray !== undefined)
|
|
111
112
|
refusal = unknownKeys(own.stray.names);
|
|
112
113
|
}
|
|
114
|
+
if (refusal === undefined && "project" in values) {
|
|
115
|
+
const screened = screenProjectSeat(values["project"]);
|
|
116
|
+
if (screened.ok)
|
|
117
|
+
values["project"] = screened.seat;
|
|
118
|
+
else
|
|
119
|
+
refusal = codedRefusal(screened.code, screened.message);
|
|
120
|
+
}
|
|
113
121
|
const members = {};
|
|
114
122
|
for (const name of TASK_SPEC_MEMBERS)
|
|
115
123
|
if (name in values)
|