@sema-agent/server 7.136.0 → 7.138.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/MIGRATION.md +501 -139
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/USAGE.md +149 -34
- package/deploy/sema-up/README.md +14 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +7 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +7 -1
- package/dist/approval-card.d.ts +21 -14
- package/dist/approval-card.js +1 -0
- package/dist/approval-content-kind.d.ts +6 -0
- package/dist/approval-content-kind.js +7 -0
- package/dist/approval-gate-currency.d.ts +48 -6
- package/dist/approval-gate-currency.js +16 -9
- package/dist/approval-hmac.d.ts +13 -1
- package/dist/approval-hmac.js +1 -1
- package/dist/approval.js +3 -3
- package/dist/audit.js +1 -0
- package/dist/auth-bridge.js +2 -2
- package/dist/background-agent-name.d.ts +5 -0
- package/dist/background-agent-name.js +5 -0
- package/dist/boot/budget-tracing.d.ts +1 -12
- package/dist/boot/deployment-mods.d.ts +46 -16
- package/dist/boot/deployment-mods.js +82 -6
- package/dist/boot/execution-env.d.ts +24 -1
- package/dist/boot/execution-env.js +69 -6
- package/dist/boot/governance-seams.d.ts +10 -17
- package/dist/boot/governance-seams.js +5 -17
- package/dist/boot/leader.d.ts +3 -0
- package/dist/boot/leader.js +1 -0
- package/dist/boot/org-delivery.js +15 -2
- package/dist/boot/reapers.d.ts +3 -0
- package/dist/boot/reapers.js +15 -1
- package/dist/boot/resolve-spec.d.ts +7 -0
- package/dist/boot/resolve-spec.js +36 -26
- package/dist/boot/retention-lane.d.ts +11 -5
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +7 -3
- package/dist/boot/runner-deps.js +1 -0
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-04-stores.d.ts +2 -13
- package/dist/boot/stage-05-execution-env.d.ts +6 -13
- package/dist/boot/stage-05-execution-env.js +17 -5
- package/dist/boot/stage-06-runners.d.ts +6 -13
- package/dist/boot/stage-06-runners.js +10 -3
- package/dist/boot/stage-07-capability-layer.d.ts +7 -13
- package/dist/boot/stage-07-capability-layer.js +3 -3
- package/dist/boot/stage-08-reapers.d.ts +7 -13
- package/dist/boot/stage-08-reapers.js +2 -1
- package/dist/boot/stage-09-leader.d.ts +7 -13
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +7 -13
- package/dist/boot/stage-10-http-server.js +6 -3
- package/dist/boot/stores.d.ts +1 -1
- package/dist/boot/web-admin.d.ts +5 -2
- package/dist/boot/web-admin.js +3 -3
- package/dist/brain.js +5 -5
- package/dist/broker/broker.d.ts +89 -0
- package/dist/broker/broker.js +287 -0
- package/dist/broker/constants.d.ts +39 -0
- package/dist/broker/constants.js +15 -0
- package/dist/broker/http1.d.ts +111 -0
- package/dist/broker/http1.js +256 -0
- package/dist/broker/lease-book.d.ts +87 -0
- package/dist/broker/lease-book.js +142 -0
- package/dist/broker/lease-file.d.ts +60 -0
- package/dist/broker/lease-file.js +127 -0
- package/dist/broker/main.d.ts +2 -0
- package/dist/broker/main.js +20 -0
- package/dist/budget.d.ts +17 -15
- package/dist/budget.js +2 -2
- package/dist/capabilities/composite-members.d.ts +2 -1
- package/dist/capabilities/composite-members.js +2 -1
- package/dist/capabilities/engine-capabilities.js +1 -0
- package/dist/capabilities/mcp-probe.d.ts +36 -11
- package/dist/capabilities/mcp-probe.js +44 -5
- package/dist/capabilities/scenarios.d.ts +23 -8
- package/dist/capabilities/scenarios.js +13 -8
- package/dist/capabilities/skills.d.ts +28 -5
- package/dist/capabilities/skills.js +8 -0
- package/dist/capability-facts.d.ts +6 -0
- package/dist/capability-facts.js +5 -0
- package/dist/center-credential-renewer.js +5 -1
- package/dist/checkpoint-ctx-seal-m28.d.ts +3 -10
- package/dist/checkpoint-ctx-seal-m28.js +1 -1
- package/dist/checkpoint-identity.d.ts +13 -6
- package/dist/config-catalog.js +16 -7
- package/dist/config-types.d.ts +24 -7
- package/dist/config.d.ts +1 -1
- package/dist/config.js +42 -13
- package/dist/deployment-governance.d.ts +2 -2
- package/dist/deployment-governance.js +7 -9
- package/dist/deployment-shape.d.ts +6 -6
- package/dist/device-ws-protocol.d.ts +1 -0
- package/dist/device-ws-protocol.js +2 -1
- package/dist/file-history-disclosure.d.ts +4 -2
- package/dist/file-history-disclosure.js +2 -0
- package/dist/gate-settlement.d.ts +71 -0
- package/dist/gate-settlement.js +40 -0
- package/dist/hooks/classic-stations.d.ts +12 -54
- package/dist/hooks/classic-stations.js +1 -0
- package/dist/hooks/command-spawn.d.ts +2 -2
- package/dist/hooks/hook-runner.js +14 -14
- package/dist/http/admission.js +14 -9
- package/dist/http/approval-sweeps.js +4 -3
- package/dist/http/caller-trust.d.ts +2 -1
- package/dist/http/caller-trust.js +1 -3
- package/dist/http/checkpoint-ctx.d.ts +48 -7
- package/dist/http/checkpoint-ctx.js +40 -0
- package/dist/http/dispatch.d.ts +4 -0
- package/dist/http/dispatch.js +18 -10
- package/dist/http/durable-run-leg.d.ts +5 -1
- package/dist/http/durable-run-leg.js +5 -3
- package/dist/http/health-self-report.d.ts +2 -2
- package/dist/http/memory-compliance-failure-reply.js +3 -0
- package/dist/http/principal-gate.d.ts +15 -10
- package/dist/http/principal-gate.js +48 -9
- package/dist/http/resume-legs.d.ts +7 -31
- package/dist/http/resume-legs.js +185 -126
- package/dist/http/route-ctx.d.ts +38 -53
- package/dist/http/route-ctx.js +2 -5
- package/dist/http/routes/a2a-serve.js +10 -4
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +5 -1
- package/dist/http/routes/approvals-assistant.js +24 -10
- package/dist/http/routes/capabilities.js +23 -11
- package/dist/http/routes/mcp-reconnect.d.ts +3 -2
- package/dist/http/routes/mcp-reconnect.js +7 -7
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/rules.js +3 -3
- package/dist/http/routes/runs.js +13 -8
- package/dist/http/routes/session-sync.js +42 -6
- package/dist/http/routes/sessions.js +6 -3
- package/dist/http/routes/side-query.js +2 -3
- package/dist/http/routes/tasks.js +794 -780
- package/dist/http/server.d.ts +35 -25
- package/dist/http/stored-body-replay.d.ts +3 -3
- package/dist/http/stored-body-replay.js +6 -1
- package/dist/http/wire-types.d.ts +66 -33
- package/dist/identity-source.d.ts +65 -0
- package/dist/identity-source.js +45 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/leader/wire.d.ts +7 -0
- package/dist/leader/wire.js +5 -4
- package/dist/mcp-assertion-header.d.ts +51 -40
- package/dist/mcp-assertion-header.js +10 -11
- package/dist/mcp-authorization-face.d.ts +27 -0
- package/dist/mcp-authorization-face.js +15 -0
- package/dist/memory-operator-faces.d.ts +13 -4
- package/dist/memory-operator-faces.js +1 -17
- package/dist/memory-store-refusal.d.ts +3 -3
- package/dist/memory-sync-client.js +72 -57
- package/dist/memory-sync.d.ts +1 -1
- package/dist/model-entry-refusal.d.ts +2 -0
- package/dist/model-entry-refusal.js +11 -0
- package/dist/model-route-gap.d.ts +6 -22
- package/dist/model-route-gap.js +7 -5
- package/dist/model-select.d.ts +6 -17
- package/dist/model-select.js +0 -3
- package/dist/mods-declaration.d.ts +110 -0
- package/dist/mods-declaration.js +109 -0
- package/dist/namespaced-rule-name.d.ts +1 -1
- package/dist/observability/err-text.d.ts +5 -0
- package/dist/observability/err-text.js +9 -0
- package/dist/observability/fail-open.d.ts +17 -1
- package/dist/observability/fail-open.js +17 -1
- package/dist/observability/metrics.js +1 -1
- package/dist/observability/run-terminal.js +1 -0
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/secret-env-scrub.js +1 -1
- package/dist/operator-ask.d.ts +2 -2
- package/dist/org-delivery-gate.js +1 -1
- package/dist/org-memory-admission.d.ts +2 -2
- package/dist/org-memory-admission.js +39 -2
- package/dist/parked-decide.d.ts +15 -2
- package/dist/parked-decide.js +17 -10
- package/dist/peer-directory.js +2 -0
- package/dist/peer-seat.d.ts +150 -0
- package/dist/peer-seat.js +239 -0
- package/dist/permission-rule-list.d.ts +2 -2
- package/dist/permission-rule-vocab.d.ts +7 -7
- package/dist/permission-rule-vocab.js +3 -3
- package/dist/plain-string-record.d.ts +38 -0
- package/dist/plain-string-record.js +38 -0
- package/dist/plugins/background-agent-store-sql.js +6 -3
- package/dist/plugins/caching-session-store.d.ts +5 -0
- package/dist/plugins/caching-session-store.js +6 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +34 -29
- package/dist/plugins/checkpoint-store-sql.js +14 -14
- package/dist/plugins/file-history-store-sql.js +10 -16
- package/dist/plugins/file-run-store.js +8 -2
- package/dist/plugins/k8s-exec-protocol.d.ts +69 -13
- package/dist/plugins/k8s-exec-protocol.js +116 -28
- package/dist/plugins/k8s-pod-delete-failure.d.ts +25 -0
- package/dist/plugins/k8s-pod-delete-failure.js +17 -0
- package/dist/plugins/k8s-pod-reaper.d.ts +106 -0
- package/dist/plugins/k8s-pod-reaper.js +122 -0
- package/dist/plugins/local-checkpoint-store.d.ts +4 -17
- package/dist/plugins/local-checkpoint-store.js +3 -4
- package/dist/plugins/local-session-store.d.ts +66 -27
- package/dist/plugins/local-session-store.js +60 -28
- package/dist/plugins/mailbox-store-sql.d.ts +11 -3
- package/dist/plugins/mailbox-store-sql.js +103 -15
- package/dist/plugins/memory-run-store.js +2 -0
- package/dist/plugins/memory-sync-store-pg.d.ts +16 -5
- package/dist/plugins/memory-sync-store-tidb.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +34 -12
- package/dist/plugins/one-time-migrations.js +51 -9
- package/dist/plugins/permission-rule-store-file.js +2 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +17 -17
- package/dist/plugins/permission-rule-store-sql.js +37 -30
- package/dist/plugins/pg-pool.js +4 -0
- package/dist/plugins/pg-session-storage.d.ts +10 -2
- package/dist/plugins/pg-session-storage.js +20 -7
- package/dist/plugins/remote-env-adb.d.ts +6 -1
- package/dist/plugins/remote-env-adb.js +2 -1
- package/dist/plugins/remote-env-device.d.ts +6 -1
- package/dist/plugins/remote-env-device.js +5 -1
- package/dist/plugins/remote-env-e2b.d.ts +5 -0
- package/dist/plugins/remote-env-e2b.js +2 -1
- package/dist/plugins/remote-env-file-error.d.ts +8 -1
- package/dist/plugins/remote-env-file-error.js +7 -1
- package/dist/plugins/remote-env-host.d.ts +10 -2
- package/dist/plugins/remote-env-host.js +8 -2
- package/dist/plugins/remote-env-k8s.d.ts +140 -11
- package/dist/plugins/remote-env-k8s.js +277 -15
- package/dist/plugins/remote-env-local-docker.d.ts +5 -0
- package/dist/plugins/remote-env-local-docker.js +2 -1
- package/dist/plugins/remote-env-ssh.d.ts +6 -1
- package/dist/plugins/remote-env-ssh.js +2 -1
- package/dist/plugins/retention-store-sql.d.ts +14 -2
- package/dist/plugins/retention-store-sql.js +6 -0
- package/dist/plugins/run-store-sql.js +10 -4
- package/dist/plugins/session-fork.d.ts +10 -13
- package/dist/plugins/session-fork.js +5 -25
- package/dist/plugins/session-ownership.d.ts +24 -3
- package/dist/plugins/session-ownership.js +24 -5
- package/dist/plugins/session-workspace-cell.d.ts +17 -0
- package/dist/plugins/session-workspace-cell.js +38 -0
- package/dist/plugins/sql-errors.d.ts +23 -2
- package/dist/plugins/sql-errors.js +15 -0
- package/dist/plugins/store-backend.js +7 -7
- package/dist/plugins/store-contracts.d.ts +10 -1
- package/dist/plugins/store-fault.d.ts +2 -2
- package/dist/plugins/store-fault.js +4 -2
- package/dist/plugins/tidb-pool.js +13 -0
- package/dist/plugins/tidb-session-store.d.ts +17 -2
- package/dist/plugins/tidb-session-store.js +18 -7
- package/dist/plugins/tool-result-store-sql.d.ts +13 -6
- package/dist/plugins/tool-result-store-sql.js +8 -7
- package/dist/plugins/worktree-isolation.d.ts +3 -2
- package/dist/plugins/worktree-isolation.js +1 -7
- package/dist/project-identity.d.ts +1 -14
- package/dist/project-identity.js +0 -4
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +31 -2
- package/dist/request-value-closure.js +7 -1
- package/dist/rule-entry-list.d.ts +3 -2
- package/dist/rule-entry-list.js +2 -2
- package/dist/rules-consent.js +12 -7
- package/dist/run-local.d.ts +2 -2
- package/dist/run-local.js +12 -6
- package/dist/runs.d.ts +7 -1
- package/dist/runs.js +8 -2
- package/dist/runtime-governance.d.ts +5 -5
- package/dist/sandbox-git-lease.d.ts +49 -0
- package/dist/sandbox-git-lease.js +60 -0
- package/dist/sandbox-git-plane.d.ts +84 -0
- package/dist/sandbox-git-plane.js +105 -0
- package/dist/security.d.ts +16 -4
- package/dist/security.js +8 -3
- package/dist/server-secret-env.d.ts +12 -3
- package/dist/server-secret-env.js +18 -2
- package/dist/session-error-wire.d.ts +14 -6
- package/dist/session-error-wire.js +2 -1
- package/dist/session-incarnation.d.ts +4 -5
- package/dist/session-incarnation.js +2 -2
- package/dist/session-policy-wire.d.ts +1 -1
- package/dist/session-policy-wire.js +2 -2
- package/dist/session-sync.d.ts +1 -1
- package/dist/session-workspace.d.ts +130 -0
- package/dist/session-workspace.js +83 -0
- package/dist/spec-fields.d.ts +44 -14
- package/dist/spec-fields.js +33 -12
- package/dist/standing-answer-grant.d.ts +2 -13
- package/dist/standing-answer-grant.js +0 -7
- package/dist/stored-request-prompt-profile-m30.d.ts +49 -0
- package/dist/stored-request-prompt-profile-m30.js +25 -0
- package/dist/task-a2a.d.ts +44 -14
- package/dist/task-a2a.js +46 -20
- package/dist/task-mcp.d.ts +34 -21
- package/dist/task-mcp.js +46 -22
- package/dist/task-settings.d.ts +2 -2
- package/dist/tool-approval.d.ts +43 -9
- package/dist/tool-approval.js +57 -15
- package/dist/tool-rule-names.d.ts +5 -0
- package/dist/trace/core-keyset-guard.d.ts +34 -19
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +4 -0
- package/dist/trace/exit-seat.d.ts +20 -1
- package/dist/trace/exit-seat.js +5 -2
- package/dist/trace/extension-call-face.d.ts +33 -0
- package/dist/trace/extension-call-face.js +39 -0
- package/dist/trace/ledger-sink.d.ts +4 -5
- package/dist/trace/ledger-sink.js +3 -7
- package/dist/trace/project.d.ts +62 -10
- package/dist/trace/project.js +49 -9
- package/dist/trace/redact.d.ts +18 -6
- package/dist/trace/redact.js +154 -60
- package/dist/trace/self-minted-wire.d.ts +500 -7
- package/dist/trace/self-minted-wire.js +182 -1
- package/dist/trace/wire-projection-faces.d.ts +7 -5
- package/dist/trace/wire-projection-faces.js +9 -4
- package/dist/user-authored-text.d.ts +2 -2
- package/dist/user-authored-text.js +16 -1
- package/dist/web-admin-client/apply-effective.js +0 -1
- package/dist/web-admin-client/center-request.d.ts +23 -4
- package/dist/web-admin-client/center-request.js +42 -8
- package/dist/web-admin-client/http-client.js +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +8 -4
- package/dist/web-admin-client/skills-mcp.js +31 -18
- package/dist/web-admin-client/types.d.ts +10 -5
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +11 -5
- package/package.json +3 -3
- package/wire-changes/server@7.137.0.json +825 -0
- package/wire-changes/server@7.138.0.json +446 -0
|
@@ -5,7 +5,8 @@ import { cappedCeiling } from "../budget.js";
|
|
|
5
5
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
6
6
|
import { SessionEnvironmentSelection, selectEnvironmentTool } from "../capabilities/select-environment-tool.js";
|
|
7
7
|
import { sendUserFileTool } from "../capabilities/send-user-file-tool.js";
|
|
8
|
-
import { buildExcludeToolsSeat, buildPromptSeats,
|
|
8
|
+
import { buildExcludeToolsSeat, buildPromptSeats, buildRunSkills, createScenarioGate, selectScenario } from "../capabilities/scenarios.js";
|
|
9
|
+
import { stampRunSkills } from "../capabilities/skills.js";
|
|
9
10
|
import { stampHandsLane, toolPolicyForHands } from "../capabilities/hands-lane.js";
|
|
10
11
|
import { applyLongtailDefer } from "../capabilities/tool-defer.js";
|
|
11
12
|
import { assertGuardPatternsUsable, buildApprovalGrantNotice, buildOnlySensitiveBaselineWarning, createApprovalBaselinePolicy, createDeploymentGovernanceInputs } from "../deployment-governance.js";
|
|
@@ -16,7 +17,7 @@ import { createSettingsHooksRegistration, settingsHooksBudgetMs } from "../hooks
|
|
|
16
17
|
import { HOST_POSTURE_REFUSED_CODE, taskInheritEnvRefusal, taskWriteFaceRefusal } from "../hosted-posture.js";
|
|
17
18
|
import { headerStr } from "../http/principal-gate.js";
|
|
18
19
|
import { explicitOperatorOk } from "../http/server.js";
|
|
19
|
-
import { isAtMentionable, matchCatalogModel,
|
|
20
|
+
import { isAtMentionable, matchCatalogModel, refusedCatalogEntry, resolveTaskModel, selectableCatalog, terminalCatalogName } from "../model-select.js";
|
|
20
21
|
import { echoModelRef, modelUnavailableMessage } from "../model-entry-refusal.js";
|
|
21
22
|
import { PerTaskImageRegistry, resolveSandboxImageRef } from "../per-task-image.js";
|
|
22
23
|
import { remoteScratchpadDirFor } from "../plugins/remote-scratchpad.js";
|
|
@@ -28,17 +29,19 @@ import { gateExecutionLane } from "../runtime-caps-resolver.js";
|
|
|
28
29
|
import { applyRuntimeGovernance } from "../runtime-governance.js";
|
|
29
30
|
import { HttpError, createCodedHttpError, encodeCheckpointScope } from "../security.js";
|
|
30
31
|
import { headReadOf, sessionFaceOfHead } from "../session-incarnation.js";
|
|
32
|
+
import { legProjectIdOf, sessionWorkspaceStoreOf, stampLegSessionWitness } from "../session-workspace.js";
|
|
31
33
|
import { memorySpecForRequest } from "../memory-scope.js";
|
|
32
34
|
import { createMemoryProjectLayers } from "../memory-project-layer.js";
|
|
33
|
-
import { inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
|
|
35
|
+
import { inheritEnvFacts, inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
|
|
34
36
|
import { a2aForScenario, mcpForScenario } from "../web-admin-client/facade.js";
|
|
35
|
-
import { normalizeAttachments, normalizeResilience, normalizeResumeAtMode, normalizeSuggestNextPrompts,
|
|
37
|
+
import { normalizeAttachments, normalizeResilience, normalizeResumeAtMode, normalizeSuggestNextPrompts, promptLeanSpecFragment, resolveTaskLimits, retainBackgroundProcessesFromBody, taskAgentsSpecFragment, toolMaterializeStrategyFromBody, allowToolsSpecFragment, toolNameListFromBody } from "../spec-fields.js";
|
|
36
38
|
import { isAbsoluteHostPath } from "@sema-agent/settings-schema";
|
|
37
39
|
import { effectiveHostWorkspace, parseAdditionalDirectories, satisfiedByProcessCwd, shellEnvMismatchCount } from "../task-cwd.js";
|
|
38
40
|
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
39
41
|
import { assertRequestA2aEntries, resolveRequestA2a, snapshotRequestA2a } from "../task-a2a.js";
|
|
40
42
|
import { assertRequestImageUrls } from "../request-image-urls.js";
|
|
41
43
|
import { assertRequestMcpEntries, assertRequestMcpUnlocked, resolveRequestMcp } from "../task-mcp.js";
|
|
44
|
+
import { GOVERNANCE_HTTP_STATUS } from "../governance-http-status.js";
|
|
42
45
|
import { storedToolAxesRereadM19 } from "../stored-request-tool-axes-m19.js";
|
|
43
46
|
import { storedHooksRereadM20 } from "../stored-request-hooks-m20.js";
|
|
44
47
|
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, REQUEST_SETTINGS_REFUSAL_PREFIX, SETTINGS_RULE_REFUSAL_CODE, SettingsRuleRefusalError, acceptAppendSystemPrompt, applyTaskSettings, createWorkflowAskPolicy, effectivePermissionMode, effectiveThinking, parseTaskSettings, taskHooksHonored, settingsPermissionBucketIssue } from "../task-settings.js";
|
|
@@ -53,9 +56,11 @@ import { effectiveMemoryPersistenceCapable } from "./memory-boundary.js";
|
|
|
53
56
|
import { withUnattendedLeg } from "../unattended-permission-mode.js";
|
|
54
57
|
import { fieldConflictFacts } from "../field-conflict.js";
|
|
55
58
|
export function createResolveSpec(ctx) {
|
|
56
|
-
const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, hookLlm, hookAgent, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, liveQuestionFace, approverSeat, lockedKeys, } = ctx;
|
|
59
|
+
const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, hookLlm, hookAgent, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, liveQuestionFace, approverSeat, lockedKeys, loadedSkills, peerDesk, } = ctx;
|
|
60
|
+
const deploymentSkillSources = new Map(loadedSkills.map((k) => [k.spec.name, k.source]));
|
|
57
61
|
const scenarioGate = createScenarioGate({ config, scenarios, principalCaps, logger }, "enforce");
|
|
58
62
|
const sessionHeadOf = headReadOf(ownerAware);
|
|
63
|
+
const sessionWorkspace = sessionWorkspaceStoreOf(ownerAware);
|
|
59
64
|
assertGuardPatternsUsable(config);
|
|
60
65
|
const onlySensitiveBaseline = buildOnlySensitiveBaselineWarning(config, {
|
|
61
66
|
approvalSeat: durableEnabled ? "durable" : "absent",
|
|
@@ -78,6 +83,13 @@ export function createResolveSpec(ctx) {
|
|
|
78
83
|
if (seatRefusal !== undefined)
|
|
79
84
|
throw createCodedHttpError(501, "capability.checkpoint_store_required", seatRefusal);
|
|
80
85
|
assertRequestMcpUnlocked(body.mcpServers, lockedKeys);
|
|
86
|
+
const storedToolAxes = opts?.leg === "fresh" ? undefined : storedToolAxesRereadM19(new Date().toISOString().slice(0, 10));
|
|
87
|
+
const a2aPeers = snapshotRequestA2a(body.a2aPeers, { reread: storedToolAxes !== undefined });
|
|
88
|
+
if (lockedKeys.has("a2a") && a2aPeers !== undefined && a2aPeers !== null) {
|
|
89
|
+
throw new HttpError(GOVERNANCE_HTTP_STATUS["config.locked_key"], "`a2aPeers` is administratively locked by this deployment (locked key \"a2a\") — task-supplied A2A peers are refused; locks are config-time and there is no request-time unlock", {
|
|
90
|
+
code: "config.locked_key",
|
|
91
|
+
});
|
|
92
|
+
}
|
|
81
93
|
if (opts?.leg === "fresh")
|
|
82
94
|
assertRequestMcpEntries(body.mcpServers);
|
|
83
95
|
if (opts?.leg === "fresh") {
|
|
@@ -100,17 +112,17 @@ export function createResolveSpec(ctx) {
|
|
|
100
112
|
{
|
|
101
113
|
const inheritEnvIssue = inheritEnvFieldIssue(body);
|
|
102
114
|
if (inheritEnvIssue)
|
|
103
|
-
throw new HttpError(400, inheritEnvIssue, { code: "request.field_invalid" });
|
|
115
|
+
throw new HttpError(400, inheritEnvIssue.message, { code: "request.field_invalid", extra: inheritEnvIssue.facts });
|
|
104
116
|
if (body.inheritEnv === "all") {
|
|
105
117
|
const lane = executionLaneOf(config.remoteExec?.provider);
|
|
106
118
|
if (lane !== "host") {
|
|
107
|
-
throw new HttpError(400, `inheritEnv:"all" applies to the host lane only (this deployment runs ${lane}) — only the host lane builds the model-driven shell's environment from this machine's own, so the declaration has no effect here; omit it (or send "scrub", the default, which every lane accepts)`, { code: "request.field_invalid" });
|
|
119
|
+
throw new HttpError(400, `inheritEnv:"all" applies to the host lane only (this deployment runs ${lane}) — only the host lane builds the model-driven shell's environment from this machine's own, so the declaration has no effect here; omit it (or send "scrub", the default, which every lane accepts)`, { code: "request.field_invalid", extra: inheritEnvFacts("lane_not_host") });
|
|
108
120
|
}
|
|
109
121
|
const why = taskInheritEnvRefusal(config);
|
|
110
122
|
if (why !== undefined)
|
|
111
123
|
throw new HttpError(422, why, { code: HOST_POSTURE_REFUSED_CODE });
|
|
112
124
|
if (!auth?.sessionId)
|
|
113
|
-
throw new HttpError(400, `inheritEnv:"all" requires a session-resolving deployment (no authorizer session) — the host shell's environment is bound per session`, { code: "request.field_invalid" });
|
|
125
|
+
throw new HttpError(400, `inheritEnv:"all" requires a session-resolving deployment (no authorizer session) — the host shell's environment is bound per session`, { code: "request.field_invalid", extra: inheritEnvFacts("no_authorizer_session") });
|
|
114
126
|
}
|
|
115
127
|
}
|
|
116
128
|
{
|
|
@@ -140,8 +152,6 @@ export function createResolveSpec(ctx) {
|
|
|
140
152
|
}
|
|
141
153
|
}
|
|
142
154
|
}
|
|
143
|
-
const storedToolAxes = opts?.leg === "fresh" ? undefined : storedToolAxesRereadM19(new Date().toISOString().slice(0, 10));
|
|
144
|
-
const a2aPeers = snapshotRequestA2a(body.a2aPeers, { reread: storedToolAxes !== undefined });
|
|
145
155
|
if (opts?.leg === "fresh")
|
|
146
156
|
assertRequestA2aEntries(a2aPeers);
|
|
147
157
|
if (opts?.leg === "fresh")
|
|
@@ -156,7 +166,8 @@ export function createResolveSpec(ctx) {
|
|
|
156
166
|
const lane = bindSettingsCwdEnvAndModel(body, auth, gated, opts);
|
|
157
167
|
const anchors = await resolveHistoryAnchors(body, auth);
|
|
158
168
|
const projectKey = memoryEngine ? await memoryProjectLayers.prepare(config, auth?.memoryScope, realTaskRootOf(auth)) : undefined;
|
|
159
|
-
const
|
|
169
|
+
const runSkills = buildRunSkills({ scenario: gated.cap.skills, request: body.skills, disable: body.disableSkills === true, deploymentSources: deploymentSkillSources }, logger);
|
|
170
|
+
const spec = assembleSpecLiteral(body, auth, req, opts, { ...gated, ...lane, ...anchors, projectKey, a2aPeers, storedToolAxes, runSkills }, effMode);
|
|
160
171
|
const folded = await foldGovernanceAndSettings(body, auth, spec, gated);
|
|
161
172
|
const final = await applyImageFactsAndRouting(body, auth, folded.governed, {
|
|
162
173
|
scenarioName: gated.scenarioName,
|
|
@@ -164,12 +175,13 @@ export function createResolveSpec(ctx) {
|
|
|
164
175
|
hostSemanticsLane: folded.hostSemanticsLane,
|
|
165
176
|
});
|
|
166
177
|
const stamped = stampHandsLane(final, gated.hands);
|
|
167
|
-
return stamped;
|
|
178
|
+
return stampLegSessionWitness(stampRunSkills(stamped, runSkills.roster), gated.sessionWitness);
|
|
168
179
|
};
|
|
169
180
|
const gateScenarioAndAppend = async (body, auth, opts) => {
|
|
170
181
|
const scenarioName = await scenarioGate(auth?.principal, body.scenario);
|
|
171
182
|
gateExecutionLane(await principalCaps?.executionRuling(auth?.principal), executionLaneOf(config.remoteExec?.provider), logger);
|
|
172
|
-
const
|
|
183
|
+
const sessionWitness = auth?.sessionId !== undefined ? { sessionId: auth.sessionId, incarnation: (sessionHeadOf === undefined ? undefined : sessionFaceOfHead(auth.sessionId, await sessionHeadOf(auth.sessionId)))?.incarnation ?? null } : undefined;
|
|
184
|
+
const cap = selectScenario(scenarios, scenarioName)(body, auth?.principal, sessionWitness !== undefined ? { sessionId: sessionWitness.sessionId, delegationRoot: sessionWitness } : {});
|
|
173
185
|
const acceptedAppend = acceptAppendSystemPrompt(body.appendSystemPrompt, (detail) => logger.warn("append_system_prompt_dropped", { detail, sessionId: auth?.sessionId ?? null }));
|
|
174
186
|
const objective = typeof body.objective === "string" ? body.objective : "";
|
|
175
187
|
const parsedSettings = parseTaskSettings(body.settings, opts?.leg === "fresh" || !taskHooksHonored(config) ? {} : { storedHooksReread: storedHooksRereadM20(new Date().toISOString().slice(0, 10)) });
|
|
@@ -219,7 +231,7 @@ export function createResolveSpec(ctx) {
|
|
|
219
231
|
}
|
|
220
232
|
}
|
|
221
233
|
}
|
|
222
|
-
return { scenarioName, cap, hands: cap.hands, acceptedAppend, objective, parsedSettings, attachmentNotice };
|
|
234
|
+
return { scenarioName, cap, hands: cap.hands, acceptedAppend, objective, parsedSettings, attachmentNotice, sessionWitness };
|
|
223
235
|
};
|
|
224
236
|
const bindSettingsCwdEnvAndModel = (body, auth, gated, opts) => {
|
|
225
237
|
const { objective, parsedSettings } = gated;
|
|
@@ -312,10 +324,6 @@ export function createResolveSpec(ctx) {
|
|
|
312
324
|
metrics.inc("task_model_unknown_fallback_total");
|
|
313
325
|
logger.warn("task_model_unknown_fallback", { requested: echoModelRef(picked.unknownExplicit), fallback: picked.model, sessionId: auth?.sessionId ?? null });
|
|
314
326
|
}
|
|
315
|
-
if (Array.isArray(body.images) && body.images.length > 0 && !modelSupportsImages(wireCatalog[picked.model])) {
|
|
316
|
-
metrics.inc("images_omitted_total", { model: picked.model });
|
|
317
|
-
logger.warn("images_omitted_no_vision_model", { model: picked.model, count: body.images.length });
|
|
318
|
-
}
|
|
319
327
|
return { taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked };
|
|
320
328
|
};
|
|
321
329
|
const NO_ANCHOR_HINT = "no rewind anchor is recorded under that handle (a prompt that carried attachments records none when its attachment frames were interrupted or their count did not match)";
|
|
@@ -340,9 +348,10 @@ export function createResolveSpec(ctx) {
|
|
|
340
348
|
if (rewindFilesToEntryId === undefined)
|
|
341
349
|
throw new HttpError(404, `rewindFilesTo: no such message in this session (rewind_files_to.unknown_event) — ${NO_ANCHOR_HINT}; name another prompt`, { code: "rewind_files_to.unknown_event" });
|
|
342
350
|
}
|
|
343
|
-
const
|
|
344
|
-
const s4DefaultScopes =
|
|
345
|
-
|
|
351
|
+
const submittedProjectId = auth?.resolvedProjectId ?? (typeof body.projectId === "string" && body.projectId ? body.projectId.toLowerCase() : undefined);
|
|
352
|
+
const s4DefaultScopes = submittedProjectId ? config.projects[submittedProjectId]?.defaultScopes : undefined;
|
|
353
|
+
const legProjectId = await legProjectIdOf(submittedProjectId, sessionWorkspace, auth?.sessionId);
|
|
354
|
+
return { resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, legProjectId };
|
|
346
355
|
};
|
|
347
356
|
const declaresInteractivePosture = (body, req, opts) => {
|
|
348
357
|
if (opts?.liveStream !== true)
|
|
@@ -359,7 +368,7 @@ export function createResolveSpec(ctx) {
|
|
|
359
368
|
return deriveAskEffective(askForm.form, "unresolved") === "human_reachable";
|
|
360
369
|
};
|
|
361
370
|
const assembleSpecLiteral = (body, auth, req, opts, parts, effMode) => {
|
|
362
|
-
const { scenarioName, cap, hands, acceptedAppend, parsedSettings, attachmentNotice, taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, projectKey, a2aPeers, storedToolAxes, } = parts;
|
|
371
|
+
const { scenarioName, cap, hands, acceptedAppend, parsedSettings, attachmentNotice, taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, legProjectId, projectKey, a2aPeers, storedToolAxes, runSkills, } = parts;
|
|
363
372
|
const spec = {
|
|
364
373
|
objective: attachmentNotice ? `${picked.cleanedObjective}\n\n${attachmentNotice}` : picked.cleanedObjective,
|
|
365
374
|
...buildPromptSeats(scenarioName, cap.prompt, typeof body.systemPrompt === "string" ? body.systemPrompt : undefined),
|
|
@@ -367,6 +376,7 @@ export function createResolveSpec(ctx) {
|
|
|
367
376
|
...(body.outputStyle !== undefined ? { outputStyle: body.outputStyle } : {}),
|
|
368
377
|
...(body.projectMemory !== undefined ? { projectMemory: body.projectMemory } : {}),
|
|
369
378
|
sessionId: auth?.sessionId,
|
|
379
|
+
...(legProjectId !== undefined ? { projectId: legProjectId } : {}),
|
|
370
380
|
principal: auth?.principal,
|
|
371
381
|
images: body.images,
|
|
372
382
|
...(body.userAttachments !== undefined ? { userAttachments: body.userAttachments } : {}),
|
|
@@ -404,7 +414,7 @@ export function createResolveSpec(ctx) {
|
|
|
404
414
|
...buildExcludeToolsSeat(cap.excludeTools, toolNameListFromBody(body.excludeTools)),
|
|
405
415
|
...allowToolsSpecFragment(body.allowTools),
|
|
406
416
|
...(() => { const v = toolNameListFromBody(body.deferTools); return v ? { deferTools: v } : {}; })(),
|
|
407
|
-
...(
|
|
417
|
+
...promptLeanSpecFragment(body),
|
|
408
418
|
...(() => { const v = toolMaterializeStrategyFromBody(body.toolMaterializeStrategy); return v ? { toolMaterializeStrategy: v } : {}; })(),
|
|
409
419
|
...(typeof body.interactiveTools === "boolean" ? { interactiveTools: body.interactiveTools } : {}),
|
|
410
420
|
...(declaresInteractivePosture(body, req, opts) ? { interactionPosture: "interactive" } : {}),
|
|
@@ -488,12 +498,12 @@ export function createResolveSpec(ctx) {
|
|
|
488
498
|
const merged = extra.length > 0 ? [...(base ?? []), ...extra] : base;
|
|
489
499
|
return merged && config.toolDeferLongtail ? applyLongtailDefer(merged, true) : merged;
|
|
490
500
|
})(cap.tools),
|
|
491
|
-
skills:
|
|
501
|
+
skills: runSkills.specs,
|
|
492
502
|
...(() => { const v = toolNameListFromBody(body.userInvokedSkills); return v ? { userInvokedSkills: v } : {}; })(),
|
|
493
503
|
...(parsedSettings.settings?.skillListingBudgetFraction !== undefined ? { skillListingBudgetFraction: parsedSettings.settings.skillListingBudgetFraction } : {}),
|
|
494
504
|
...(parsedSettings.settings?.skillListingMaxDescChars !== undefined ? { skillListingMaxDescChars: parsedSettings.settings.skillListingMaxDescChars } : {}),
|
|
495
|
-
mcp: resolveRequestMcp(mcpForScenario(config.mcpServers, scenarioName), body.mcpServers, config, logger, opts?.onNotice !== undefined ? { sessionId: auth?.sessionId, emit: opts.onNotice } : undefined, storedToolAxes),
|
|
496
|
-
a2a: resolveRequestA2a(a2aForScenario(config.a2aPeers, scenarioName), a2aPeers, config, logger, opts?.leg === "fresh" ? "fresh" : "resume", storedToolAxes),
|
|
505
|
+
mcp: resolveRequestMcp(mcpForScenario(config.mcpServers, scenarioName), body.mcpServers, config, peerDesk, opts.lease, logger, opts?.onNotice !== undefined ? { sessionId: auth?.sessionId, emit: opts.onNotice } : undefined, storedToolAxes),
|
|
506
|
+
a2a: resolveRequestA2a(a2aForScenario(config.a2aPeers, scenarioName), a2aPeers, config, peerDesk, opts.lease, logger, opts?.leg === "fresh" ? "fresh" : "resume", storedToolAxes),
|
|
497
507
|
toolPolicy: toolPolicyForHands(hands, durableEnabled
|
|
498
508
|
? createApprovalBaselinePolicy(config, {
|
|
499
509
|
kind: "durable",
|
|
@@ -155,15 +155,21 @@ export interface RetentionSweepOutcome {
|
|
|
155
155
|
/**
|
|
156
156
|
* lane **自持的** boot 不变式(设计稿 §7,codex F3)—— 与 core 的 `assertRetentionCapability` 是两道门,
|
|
157
157
|
* 各答各的问题:
|
|
158
|
-
* · core
|
|
159
|
-
*
|
|
158
|
+
* · core 那道判**配对**,锁不锁都判(`executor` 必给):声明 `managed` 的店 × 没有执行器(`null`)⇒ 拒;执行器四个契约方法
|
|
159
|
+
* (`listRetentionDomains` / `expireCheckpoints` / `deleteExpiredSessions` / `deleteOrphanToolResults`)缺一 ⇒ 拒;
|
|
160
|
+
* **锁着**的策略盖在声明 `none` 的店上 ⇒ 拒。它不问 lane 开没开、策略在不在,也不拦没锁时「执行器在场 × 店声明 `none`」(部署可以持有执行器而不在某只店上跑);
|
|
161
|
+
* · **本道**问的是「lane 开着的时候,它真的能删吗」——**不看 locked 状态**:策略在场、执行器在场、lane 调的**五**个方法都在
|
|
162
|
+
* (多出的 `previewRetention` 是 audit-only 档的读数口,不在 core 的四方法契约里,引擎的检查覆盖不到它)、每只被 lane 消费的店都声明 `managed`。
|
|
163
|
+
* 「执行器在场」与「契约方法齐」两格和引擎的判官说的是同一件事(各自一句拒句),其余几格是引擎不问的。
|
|
160
164
|
*
|
|
161
|
-
*
|
|
165
|
+
* 为什么本道必须存在:引擎的门不拦
|
|
162
166
|
* ① `RETENTION_SWEEP_INTERVAL_SEC>0` 而 policy 缺席 = 没有有效 cutoff 的 sweep(每 tick 什么都算不出来,
|
|
163
167
|
* 读数一路 0,看起来像"没有候选");
|
|
164
|
-
* ②
|
|
168
|
+
* ② 没锁时,执行器在场 × 一只 `"none"` 的店 —— 部署于是**广告了一个不执行的留存面**:能力位说
|
|
165
169
|
* `{mode,maxAgeDays}`、审计表也在长,而那只店的行谁都没在删。
|
|
166
|
-
*
|
|
170
|
+
* 本仓的 SQL 后端按同一个事实(扫车道开不开,`plugins/retention-store-sql.ts` 的 `retentionSweepRuns`)给它铸的三只店声明词,所以 lane 开着时
|
|
171
|
+
* 这三只店在这一格上恒是 `managed`;这一格防的是声明与 lane 脱钩的店(别的后端、替身)。
|
|
172
|
+
* 这些都在**启动期**拒(安全控件不得半开),不是让运维从一台"启动成功、什么也没删"的机器上猜。
|
|
167
173
|
*
|
|
168
174
|
* @param locked 只进文案(让拒启信息能说清"你锁没锁都一样拒");**判据本身不读它** —— 这一格的存在
|
|
169
175
|
* 就是为了让"不看 locked"这句话在签名上可见,而不是靠注释声明。
|
|
@@ -2,6 +2,7 @@ import { recordFailOpen } from "../observability/fail-open.js";
|
|
|
2
2
|
export const RETENTION_SWEEP_STUCK_THRESHOLD = 5;
|
|
3
3
|
export const RETENTION_LEASE_TTL_FACTOR = 2;
|
|
4
4
|
const DAY_MS = 86_400_000;
|
|
5
|
+
const LANE_EXECUTOR_METHODS = ["listRetentionDomains", "previewRetention", "expireCheckpoints", "deleteExpiredSessions", "deleteOrphanToolResults"];
|
|
5
6
|
export function assertRetentionLaneWirable(input) {
|
|
6
7
|
if (input.intervalSec <= 0)
|
|
7
8
|
return;
|
|
@@ -18,8 +19,7 @@ export function assertRetentionLaneWirable(input) {
|
|
|
18
19
|
`declares retention:"none" and nothing would delete a row${lockNote}. Run a SQL backend, or set RETENTION_SWEEP_INTERVAL_SEC=0.`);
|
|
19
20
|
}
|
|
20
21
|
const executor = input.executor;
|
|
21
|
-
const
|
|
22
|
-
for (const m of CONTRACT_METHODS) {
|
|
22
|
+
for (const m of LANE_EXECUTOR_METHODS) {
|
|
23
23
|
if (typeof executor[m] !== "function") {
|
|
24
24
|
throw new Error(`the wired retention executor is missing \`${m}\` — a store that declares retention:"managed" PROMISES the whole ` +
|
|
25
25
|
`ManagedRetentionCapability contract, and the sweep lane calls every method of it${lockNote}. Refusing to start with a ` +
|
|
@@ -29,6 +29,7 @@ import type { ToolApprovalCoordinator } from "../tool-approval.js";
|
|
|
29
29
|
import type { MemoryBackend } from "@sema-agent/core";
|
|
30
30
|
import type { MemorySyncRunner } from "../memory-sync-client.js";
|
|
31
31
|
import type { MailboxRecipientLifecycle } from "../plugins/mailbox-recipient-lifecycle.js";
|
|
32
|
+
import type { PeerDesk } from "../peer-seat.js";
|
|
32
33
|
/**
|
|
33
34
|
* `RunnerDeps.onAsk` 的装配([ref] 件4:从内联闭包提为具名导出,**纯 testability 重构、零行为变化**)。
|
|
34
35
|
*
|
|
@@ -163,6 +164,8 @@ export interface RunnerDepsCtx {
|
|
|
163
164
|
/** core 7.49.0 [ref]:引擎数据根(boot 事实,`boot/stores.ts` 恒铸 —— 记忆引擎开不开都在)。共享基座把它交成每只 Runner 的
|
|
164
165
|
* `memoryEngineDir`:引擎从它解出每条腿的唯一豁免根(守卫集不再收 `dataRoot`)。开引擎时与 `memoryEngine.root` 同一只。 */
|
|
165
166
|
engineDataRoot: string;
|
|
167
|
+
/** 对端座的 desk(进程一只,`peer-seat.ts`):共享基座把它的座交成每只 Runner 的 `peerSeat` —— MCP / A2A 声明里的引用只经它在发送时作答。 */
|
|
168
|
+
peerDesk: PeerDesk;
|
|
166
169
|
/**
|
|
167
170
|
* [ref](core 7.21.1)—— 记忆整理的**已解析座**(`boot/memory-consolidation.ts` 的
|
|
168
171
|
* `resolveConsolidationDriverSeat` 产物),在场 **iff** 整理阀门开着(`resolveConsolidationValve` 的判决:
|
|
@@ -228,7 +231,8 @@ export interface RunnerDepsCtx {
|
|
|
228
231
|
executionEnvFactory: RunnerDeps["executionEnvFactory"];
|
|
229
232
|
lspManager: RunnerDeps["lspManager"];
|
|
230
233
|
fleetBus: FleetEventBus;
|
|
231
|
-
/** 部署座的 mods 注册(
|
|
234
|
+
/** 部署座的 mods 注册(起服第 5 段装配口 `assembleDeploymentMods` 铸:自铸 + 运维声明的包,起服自证过)—— 主 / handless / hookAgent / sub 经本共享基座、
|
|
235
|
+
* leader 车道的路由 / worker / 修复腿经 `LeaderWireConfig.mods`(`boot/leader.ts` 递同一份),每一只 Runner 同一份。 */
|
|
232
236
|
deploymentMods: NonNullable<RunnerDeps["mods"]>;
|
|
233
237
|
workflowRunStore: WorkflowRunStore | undefined;
|
|
234
238
|
workflowJournalStore: ServiceWorkflowJournalStore | undefined;
|
|
@@ -241,7 +245,7 @@ export interface RunnerDepsCtx {
|
|
|
241
245
|
}
|
|
242
246
|
/** [ref] A10 留档发现②:main runner `RunnerDeps` 与 main.ts subRunner 字面量之间此前手工重复
|
|
243
247
|
* 的 ~15 个键,类型标注见 {@link createSharedRunnerDeps} 头注。 */
|
|
244
|
-
export type SharedRunnerDeps = Pick<RunnerDeps, "brain" | "readFace" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "delegationEntryCaps" | "crossSessionInbound" | "crossSessionDialogExpiry" | "writeProtectedPaths" | "memoryEngineDir" | "allowedTools" | "crossBoundaryPosture" | "models" | "roles" | "tiers" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "mods" | "toolResultStore" | "checkpointStore" | "hands" | "sessionPolicyStore" | "usageWindows" | "usageWindowStore" | "memoryScopeAdmission" | "deploymentMemoryScopes" | "sharedMemoryStores" | "compliancePostureResolver" | "lockedConfig" | "retentionPolicy" | "onNotice" | "mcpRevocations">;
|
|
248
|
+
export type SharedRunnerDeps = Pick<RunnerDeps, "brain" | "readFace" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "delegationEntryCaps" | "crossSessionInbound" | "crossSessionDialogExpiry" | "writeProtectedPaths" | "memoryEngineDir" | "allowedTools" | "crossBoundaryPosture" | "models" | "roles" | "tiers" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "mods" | "toolResultStore" | "checkpointStore" | "hands" | "sessionPolicyStore" | "usageWindows" | "usageWindowStore" | "memoryScopeAdmission" | "deploymentMemoryScopes" | "sharedMemoryStores" | "compliancePostureResolver" | "lockedConfig" | "retentionPolicy" | "onNotice" | "mcpRevocations" | "peerSeat">;
|
|
245
249
|
/**
|
|
246
250
|
* [ref] A10 留档发现②(review 2026-07-29,[ref]§三族A 同源修补的延续):main runner 的
|
|
247
251
|
* `RunnerDeps` 字面量(下方 `createRunnerDeps`)与 `main.ts` 里 subRunner 的 `new Runner({...})`
|
|
@@ -268,7 +272,7 @@ export type SharedRunnerDeps = Pick<RunnerDeps, "brain" | "readFace" | "readDeny
|
|
|
268
272
|
* 属性,比再抽一层共享基座更强的同源保证),不重复收纳进这里。
|
|
269
273
|
*/
|
|
270
274
|
/** 基座真实消费的窄面(Pick)——subRunner 调用点(main.ts)只需凑这 13 个字段,不必造全量 ctx。 */
|
|
271
|
-
export type SharedRunnerDepsCtx = Pick<RunnerDepsCtx, "config" | "brain" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "deploymentMods" | "toolResultStore" | "checkpointStore" | "sessionPolicyStore" | "hands" | "usageWindowStore" | "orgMemoryAdmission" | "sharedMemoryStores" | "logger" | "governanceSeams" | "mcpRevocations" | "metrics" | "engineDataRoot">;
|
|
275
|
+
export type SharedRunnerDepsCtx = Pick<RunnerDepsCtx, "config" | "brain" | "pricing" | "tracer" | "promptSource" | "executionEnvFactory" | "lspManager" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "deploymentMods" | "toolResultStore" | "checkpointStore" | "sessionPolicyStore" | "hands" | "usageWindowStore" | "orgMemoryAdmission" | "sharedMemoryStores" | "logger" | "governanceSeams" | "mcpRevocations" | "metrics" | "engineDataRoot" | "peerDesk">;
|
|
272
276
|
/** 转发席只需要 `inc` —— 刻意窄到这一个动词,免得把整只 Metrics 拖进这条纯转发腿。 */
|
|
273
277
|
export interface EngineNoticeMetricsSeat {
|
|
274
278
|
inc: (name: string, labels?: Record<string, string>) => void;
|
package/dist/boot/runner-deps.js
CHANGED
|
@@ -131,6 +131,7 @@ export function createSharedRunnerDeps(ctx) {
|
|
|
131
131
|
lockedConfig: ctx.governanceSeams.lockedConfig,
|
|
132
132
|
retentionPolicy: ctx.governanceSeams.retentionPolicy,
|
|
133
133
|
mcpRevocations: ctx.mcpRevocations ? ctx.mcpRevocations : undefined,
|
|
134
|
+
peerSeat: ctx.peerDesk.seat.answer,
|
|
134
135
|
};
|
|
135
136
|
return shared;
|
|
136
137
|
}
|
|
@@ -18,7 +18,7 @@ export declare function runStage03(ctx: Awaited<ReturnType<typeof runStage02>>):
|
|
|
18
18
|
rosterStore: import("@sema-agent/core").RosterStore | undefined;
|
|
19
19
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
20
20
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
21
|
-
sessionStore: import("@sema-agent/core").SessionStore
|
|
21
|
+
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
22
22
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
23
23
|
storePosture: import("../store-posture.js").StorePosture;
|
|
24
24
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
@@ -27,18 +27,7 @@ export declare function runStage04(ctx: Awaited<ReturnType<typeof runStage03>>):
|
|
|
27
27
|
ruleConsent: import("../rules-consent.js").RuleConsentLane | undefined;
|
|
28
28
|
sessionMemoryStatusFace: import("../memory-operator-faces.js").SessionMemoryStatusFace | undefined;
|
|
29
29
|
sessionPolicyStore: import("@sema-agent/core").SessionPolicyStore | undefined;
|
|
30
|
-
sideQueryAccounting: (
|
|
31
|
-
model: string;
|
|
32
|
-
usage?: {
|
|
33
|
-
input?: number;
|
|
34
|
-
output?: number;
|
|
35
|
-
cacheRead?: number;
|
|
36
|
-
cacheWrite?: number;
|
|
37
|
-
cost?: {
|
|
38
|
-
total?: number;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
}) => void;
|
|
30
|
+
sideQueryAccounting: import("../budget.js").SideQueryAccounting;
|
|
42
31
|
toolResultStore: import("../plugins/store-backend.js").ToolResultStoreFull | undefined;
|
|
43
32
|
tracer: import("@sema-agent/core").TracerHook;
|
|
44
33
|
backend: import("../index.js").StoreBackend | undefined;
|
|
@@ -59,7 +48,7 @@ export declare function runStage04(ctx: Awaited<ReturnType<typeof runStage03>>):
|
|
|
59
48
|
rosterStore: import("@sema-agent/core").RosterStore | undefined;
|
|
60
49
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
61
50
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
62
|
-
sessionStore: import("@sema-agent/core").SessionStore
|
|
51
|
+
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
63
52
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
64
53
|
storePosture: import("../store-posture.js").StorePosture;
|
|
65
54
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { runStage04 } from "./stage-04-stores.js";
|
|
2
2
|
export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>): Promise<{
|
|
3
3
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
4
|
+
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
4
5
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
6
|
+
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
5
7
|
dropSessionScoped: (sid: string) => void;
|
|
6
8
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
7
9
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
8
10
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
9
11
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
12
|
+
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
13
|
+
sandboxGitPlane: import("../sandbox-git-plane.js").SandboxGitPlane;
|
|
10
14
|
perSessionCwd: Map<string, string>;
|
|
11
15
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
12
16
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
@@ -42,18 +46,7 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
|
|
|
42
46
|
ruleConsent: import("../rules-consent.js").RuleConsentLane | undefined;
|
|
43
47
|
sessionMemoryStatusFace: import("../memory-operator-faces.js").SessionMemoryStatusFace | undefined;
|
|
44
48
|
sessionPolicyStore: import("@sema-agent/core").SessionPolicyStore | undefined;
|
|
45
|
-
sideQueryAccounting: (
|
|
46
|
-
model: string;
|
|
47
|
-
usage?: {
|
|
48
|
-
input?: number;
|
|
49
|
-
output?: number;
|
|
50
|
-
cacheRead?: number;
|
|
51
|
-
cacheWrite?: number;
|
|
52
|
-
cost?: {
|
|
53
|
-
total?: number;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
}) => void;
|
|
49
|
+
sideQueryAccounting: import("../budget.js").SideQueryAccounting;
|
|
57
50
|
toolResultStore: import("../plugins/store-backend.js").ToolResultStoreFull | undefined;
|
|
58
51
|
tracer: import("@sema-agent/core").TracerHook;
|
|
59
52
|
backend: import("../index.js").StoreBackend | undefined;
|
|
@@ -74,7 +67,7 @@ export declare function runStage05(ctx: Awaited<ReturnType<typeof runStage04>>):
|
|
|
74
67
|
rosterStore: import("@sema-agent/core").RosterStore | undefined;
|
|
75
68
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
76
69
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
77
|
-
sessionStore: import("@sema-agent/core").SessionStore
|
|
70
|
+
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
78
71
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
79
72
|
storePosture: import("../store-posture.js").StorePosture;
|
|
80
73
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assembleDeploymentMods } from "./deployment-mods.js";
|
|
2
2
|
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
3
3
|
import { assertDeviceLaneWired, createDeviceLane } from "./device-lane.js";
|
|
4
4
|
import { assertWorkspaceSpaceReadable, createExecutionEnv } from "./execution-env.js";
|
|
@@ -6,18 +6,30 @@ import { headReadOf } from "../session-incarnation.js";
|
|
|
6
6
|
import * as facts from "../capability-facts.js";
|
|
7
7
|
import { sessionStoreLabelOf } from "../store-posture.js";
|
|
8
8
|
import { runStore } from "./late-binds.js";
|
|
9
|
+
import { SANDBOX_GIT_PLANE_OFF_TEXT } from "../sandbox-git-plane.js";
|
|
10
|
+
import { createPeerDesk } from "../peer-seat.js";
|
|
9
11
|
export async function runStage05(ctx) {
|
|
10
12
|
const { backend, config, instanceId, logger, metrics, sessionStore, taskAttachmentStore } = ctx;
|
|
11
13
|
const deviceLane = config.remoteExec?.provider === "device" ? createDeviceLane({ config, logger, metrics, backend, replicaId: instanceId }) : undefined;
|
|
12
14
|
const headOf = headReadOf(sessionStore);
|
|
13
15
|
const spaceCommits = backend !== undefined ? () => runStore : undefined;
|
|
14
|
-
const { perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv, fenceSessionOwner, dropSessionScoped, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}), ...(spaceCommits !== undefined ? { spaceCommits } : {}), ...(headOf !== undefined ? { headOf } : {}) });
|
|
16
|
+
const { perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv, fenceSessionOwner, dropSessionScoped, executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, sandboxSecretSeatGate, sandboxPodReaper, readSandboxGitPlane, } = createExecutionEnv({ config, logger, metrics, taskAttachmentStore, ...(deviceLane ? { deviceLane } : {}), ...(spaceCommits !== undefined ? { spaceCommits } : {}), ...(headOf !== undefined ? { headOf } : {}), ...(backend !== undefined ? { runRows: () => runStore } : {}) });
|
|
15
17
|
assertDeviceLaneWired(config.remoteExec?.provider === "device", deviceLane, executionEnvFactory !== undefined);
|
|
16
18
|
assertWorkspaceSpaceReadable(facts.workspaceSpace(config), { headOf, spaceCommits }, facts.workspaceCache(config), sessionStoreLabelOf(config.sessionBackend, backend?.kind));
|
|
17
|
-
|
|
19
|
+
if (sandboxSecretSeatGate !== undefined)
|
|
20
|
+
await sandboxSecretSeatGate();
|
|
21
|
+
const sandboxGitPlane = await readSandboxGitPlane();
|
|
22
|
+
if (sandboxGitPlane.state === "on")
|
|
23
|
+
logger.info("credential_plane_sandbox_git", { state: "on", origins: sandboxGitPlane.origins });
|
|
24
|
+
else if (sandboxGitPlane.reason !== "single_user" && sandboxGitPlane.reason !== "lane_without_boundary") {
|
|
25
|
+
logger.info("credential_plane_sandbox_git", { state: "off", reason: sandboxGitPlane.reason, why: SANDBOX_GIT_PLANE_OFF_TEXT[sandboxGitPlane.reason] });
|
|
26
|
+
}
|
|
18
27
|
if (config.toolTrace)
|
|
19
28
|
logger.info("tool_trace_enabled", {});
|
|
20
|
-
await
|
|
21
|
-
|
|
29
|
+
const { registrations: deploymentMods, loaded: deploymentModsLoaded } = await assembleDeploymentMods({ metrics, ...(config.toolTrace ? { traceLogger: logger } : {}), brandIdentity: isBrandedDeployment(config), declaration: config.modsDeclaration, logger });
|
|
30
|
+
const peerDesk = createPeerDesk({ log: logger });
|
|
31
|
+
metrics.dynamicGauge("peer_registry_entries", "Peer desk entries (declared peer credentials registered for in-flight legs and the roster)", () => peerDesk.size().entries);
|
|
32
|
+
metrics.dynamicGauge("peer_registry_holders", "Peer desk host leases holding entries, summed across entries", () => peerDesk.size().holders);
|
|
33
|
+
return { ...ctx, deploymentMods, deploymentModsLoaded, deviceLane, peerDesk, dropSessionScoped, executionEnvFactory, fenceSessionOwner, lspManager, spaceReclaimer, sandboxPodReaper, sandboxGitPlane, perSessionCwd, perTaskImage, sendUserFileTaskEnvs, sessionEnvSelection, setSessionCwd, setSessionInheritEnv, setSessionShellEnv, worktreeReap };
|
|
22
34
|
}
|
|
23
35
|
//# sourceMappingURL=stage-05-execution-env.js.map
|
|
@@ -64,12 +64,16 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
64
64
|
workflowsCapable: boolean;
|
|
65
65
|
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
66
66
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
67
|
+
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
67
68
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
69
|
+
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
68
70
|
dropSessionScoped: (sid: string) => void;
|
|
69
71
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
70
72
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
71
73
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
72
74
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
75
|
+
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
76
|
+
sandboxGitPlane: import("../sandbox-git-plane.js").SandboxGitPlane;
|
|
73
77
|
perSessionCwd: Map<string, string>;
|
|
74
78
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
75
79
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
@@ -105,18 +109,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
105
109
|
ruleConsent: import("../rules-consent.js").RuleConsentLane | undefined;
|
|
106
110
|
sessionMemoryStatusFace: import("../memory-operator-faces.js").SessionMemoryStatusFace | undefined;
|
|
107
111
|
sessionPolicyStore: import("@sema-agent/core").SessionPolicyStore | undefined;
|
|
108
|
-
sideQueryAccounting: (
|
|
109
|
-
model: string;
|
|
110
|
-
usage?: {
|
|
111
|
-
input?: number;
|
|
112
|
-
output?: number;
|
|
113
|
-
cacheRead?: number;
|
|
114
|
-
cacheWrite?: number;
|
|
115
|
-
cost?: {
|
|
116
|
-
total?: number;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
}) => void;
|
|
112
|
+
sideQueryAccounting: import("../budget.js").SideQueryAccounting;
|
|
120
113
|
toolResultStore: import("../plugins/store-backend.js").ToolResultStoreFull | undefined;
|
|
121
114
|
tracer: import("@sema-agent/core").TracerHook;
|
|
122
115
|
backend: import("../index.js").StoreBackend | undefined;
|
|
@@ -137,7 +130,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
137
130
|
rosterStore: import("@sema-agent/core").RosterStore | undefined;
|
|
138
131
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
139
132
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
140
|
-
sessionStore: import("@sema-agent/core").SessionStore
|
|
133
|
+
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
141
134
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
142
135
|
storePosture: import("../store-posture.js").StorePosture;
|
|
143
136
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|
|
@@ -18,6 +18,7 @@ import { assertApprovalAskRuleMaterialOnBackend } from "./stores.js";
|
|
|
18
18
|
import { createParkCommitWatch } from "../plugins/park-commit-watch.js";
|
|
19
19
|
import { CHECKPOINT_CTX_SEALING_REQUIRED } from "../http/checkpoint-ctx.js";
|
|
20
20
|
import { sealCheckpointCtxCredentialsM28 } from "../checkpoint-ctx-seal-m28.js";
|
|
21
|
+
import { retirePromptProfileM30 } from "../stored-request-prompt-profile-m30.js";
|
|
21
22
|
import { createRuntimeCaps } from "./runtime-caps.js";
|
|
22
23
|
import { createEngineNoticeForwarder, createRunnerDeps, createSharedRunnerDeps } from "./runner-deps.js";
|
|
23
24
|
import { defaultEngineNoticeRouter } from "../trace/engine-notice-wire.js";
|
|
@@ -27,8 +28,9 @@ import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-author
|
|
|
27
28
|
import { mountOrgDeliveryGate } from "./org-delivery.js";
|
|
28
29
|
import { parkedAskRedeem, runStore } from "./late-binds.js";
|
|
29
30
|
import { withInternalRunEnvs } from "../internal-run-env.js";
|
|
31
|
+
import { retentionSweepRuns } from "../plugins/retention-store-sql.js";
|
|
30
32
|
export async function runStage06(ctx) {
|
|
31
|
-
const { backend, backgroundAgentStore, brain, engineDataRoot, config, webAdmin, consolidationValve, deploymentMods, executionEnvFactory, fileHistoryStore, localRoot, logger, lspManager, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memorySyncRunner, metrics, perSessionCwd, permissionRuleProvider, pricing, rosterStore, ruleConsent, sendUserFileTaskEnvs, sessionCaptureRecordStore, sessionCaptureRecords, sessionPolicyStore, sessionStore, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore } = ctx;
|
|
33
|
+
const { backend, backgroundAgentStore, brain, engineDataRoot, peerDesk, config, webAdmin, consolidationValve, deploymentMods, executionEnvFactory, fileHistoryStore, localRoot, logger, lspManager, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memorySyncRunner, metrics, perSessionCwd, permissionRuleProvider, pricing, rosterStore, ruleConsent, sendUserFileTaskEnvs, sessionCaptureRecordStore, sessionCaptureRecords, sessionPolicyStore, sessionStore, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore } = ctx;
|
|
32
34
|
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, workflowParkDecisions, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
|
|
33
35
|
const parkCommitted = backend?.checkpoint && config.durableApproval ? createParkCommitWatch(backend.checkpoint(logger)) : undefined;
|
|
34
36
|
const checkpointStore = parkCommitted?.store;
|
|
@@ -37,8 +39,11 @@ export async function runStage06(ctx) {
|
|
|
37
39
|
if (checkpointStore !== undefined) {
|
|
38
40
|
if (checkpointCtxSealing === undefined)
|
|
39
41
|
throw new Error(CHECKPOINT_CTX_SEALING_REQUIRED);
|
|
40
|
-
const
|
|
42
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
43
|
+
const m28 = await sealCheckpointCtxCredentialsM28(checkpointStore, checkpointCtxSealing, { today });
|
|
41
44
|
logger.info("checkpoint_ctx_credentials_sealed", { ...m28, note: "one-time migration M28: plaintext request credentials in suspended tasks' resume contexts sealed in place" });
|
|
45
|
+
const m30 = await retirePromptProfileM30(checkpointStore, { today });
|
|
46
|
+
logger.info("checkpoint_ctx_prompt_profile_rewritten", { ...m30, note: "one-time migration M30: the retired request key promptProfile in suspended tasks' stored requests rewritten in place (classic becomes promptLean: false); a stored request this did not reach is refused on resume" });
|
|
42
47
|
}
|
|
43
48
|
const { elicitation, question, toolApproval, durableEnabled, streamApprovalGate, approvalAskAudit, approvalExemptionStore, sendUserFileEmitter, sendFileLedger, sendUserFileToolSpec } = createLiveCoordinators({
|
|
44
49
|
config, logger, backend, sendUserFileTaskEnvs, ruleConsent, parkCommits,
|
|
@@ -121,7 +126,7 @@ export async function runStage06(ctx) {
|
|
|
121
126
|
{ name: "checkpointStore", store: checkpointStore },
|
|
122
127
|
{ name: "toolResultStore", store: runnerOffloadStore },
|
|
123
128
|
],
|
|
124
|
-
|
|
129
|
+
retentionExecutor: retentionSweepRuns(config.retentionSweep) ? (retentionExecutor ?? null) : null,
|
|
125
130
|
});
|
|
126
131
|
const mcpRevocations = webAdmin.takeMcpRevocations();
|
|
127
132
|
const workflowModelAllowlistSnapshot = workflowModelAllowlistFor(config) ?? [];
|
|
@@ -132,6 +137,7 @@ export async function runStage06(ctx) {
|
|
|
132
137
|
config, logger, metrics, localRoot, promptSource: webAdmin.promptSource, rosterStore, backgroundAgentStore, mailboxStore, mailboxRecipientLifecycle, usageWindowStore, brain,
|
|
133
138
|
pricing, tracer, outcomeSink, elicitation, question, toolApproval, sessionStore, memoryEngine,
|
|
134
139
|
engineDataRoot,
|
|
140
|
+
peerDesk,
|
|
135
141
|
sessionCaptureRecords,
|
|
136
142
|
memorySyncRunner, toolResultStore: runnerOffloadStore, checkpointStore, sessionPolicyStore, runtimeCapsResolver, fileHistoryStore,
|
|
137
143
|
permissionRuleStore: permissionRuleProvider,
|
|
@@ -216,6 +222,7 @@ export async function runStage06(ctx) {
|
|
|
216
222
|
governanceSeams,
|
|
217
223
|
sharedMemoryStores: sharedMemoryStore ? sharedMemoryStore : undefined,
|
|
218
224
|
engineDataRoot,
|
|
225
|
+
peerDesk,
|
|
219
226
|
}),
|
|
220
227
|
sessionStore: subRunnerSessions,
|
|
221
228
|
onBackgroundChildEvent: runnerDeps.onBackgroundChildEvent ? runnerDeps.onBackgroundChildEvent : undefined,
|
|
@@ -9,6 +9,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
9
9
|
}) => Promise<import("../security.js").AuthContext>;
|
|
10
10
|
imageBakes: import("../plugins/store-backend.js").ImageBake | undefined;
|
|
11
11
|
imageIndex: import("../plugins/store-backend.js").ImageIndex | undefined;
|
|
12
|
+
loadedSkills: import("../capabilities/skills.js").LoadedSkill[];
|
|
12
13
|
parkedReviveInheritedGate: ((row: import("@sema-agent/core").BackgroundAgentRecord, identity: import("./parked-revive-gate.js").ParkedReviveIdentity) => Promise<import("./parked-revive-gate.js").RebuiltInheritedGate>) | undefined;
|
|
13
14
|
parkedReviveSurface: import("../parked-revive-surface.js").ParkedReviveSurfaceFactory | undefined;
|
|
14
15
|
rateLimiter: RateLimiter | import("../plugins/pg-rate-limiter.js").PgRateLimiter | import("../plugins/tidb-rate-limiter.js").TiDBRateLimiter;
|
|
@@ -79,12 +80,16 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
79
80
|
workflowsCapable: boolean;
|
|
80
81
|
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
81
82
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
83
|
+
deploymentModsLoaded: readonly import("./deployment-mods.js").LoadedModPackage[];
|
|
82
84
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
85
|
+
peerDesk: import("../peer-seat.js").PeerDesk;
|
|
83
86
|
dropSessionScoped: (sid: string) => void;
|
|
84
87
|
executionEnvFactory: import("@sema-agent/core").ExecutionEnvFactory | undefined;
|
|
85
88
|
fenceSessionOwner: (sid: string, owner: string | null) => void;
|
|
86
89
|
lspManager: import("@sema-agent/core").NodeLspManager | import("../lsp/manager.js").E2bLspManager | undefined;
|
|
87
90
|
spaceReclaimer: import("../workspace-space.js").SpaceReclaimer | undefined;
|
|
91
|
+
sandboxPodReaper: import("../plugins/k8s-pod-reaper.js").SandboxPodReaper | undefined;
|
|
92
|
+
sandboxGitPlane: import("../sandbox-git-plane.js").SandboxGitPlane;
|
|
88
93
|
perSessionCwd: Map<string, string>;
|
|
89
94
|
perTaskImage: import("../per-task-image.js").PerTaskImageRegistry;
|
|
90
95
|
sendUserFileTaskEnvs: import("../capabilities/sandbox-file-send.js").TaskEnvRegistry | undefined;
|
|
@@ -120,18 +125,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
120
125
|
ruleConsent: import("../rules-consent.js").RuleConsentLane | undefined;
|
|
121
126
|
sessionMemoryStatusFace: import("../memory-operator-faces.js").SessionMemoryStatusFace | undefined;
|
|
122
127
|
sessionPolicyStore: import("@sema-agent/core").SessionPolicyStore | undefined;
|
|
123
|
-
sideQueryAccounting: (
|
|
124
|
-
model: string;
|
|
125
|
-
usage?: {
|
|
126
|
-
input?: number;
|
|
127
|
-
output?: number;
|
|
128
|
-
cacheRead?: number;
|
|
129
|
-
cacheWrite?: number;
|
|
130
|
-
cost?: {
|
|
131
|
-
total?: number;
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
}) => void;
|
|
128
|
+
sideQueryAccounting: import("../budget.js").SideQueryAccounting;
|
|
135
129
|
toolResultStore: import("../plugins/store-backend.js").ToolResultStoreFull | undefined;
|
|
136
130
|
tracer: import("@sema-agent/core").TracerHook;
|
|
137
131
|
backend: import("../index.js").StoreBackend | undefined;
|
|
@@ -152,7 +146,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
152
146
|
rosterStore: import("@sema-agent/core").RosterStore | undefined;
|
|
153
147
|
sessionCaptureRecordStore: import("@sema-agent/core").SessionCaptureRecordStore | undefined;
|
|
154
148
|
sessionCaptureRecords: import("../index.js").SessionCaptureRecordSource | undefined;
|
|
155
|
-
sessionStore: import("@sema-agent/core").SessionStore
|
|
149
|
+
sessionStore: import("@sema-agent/core").SessionStore<import("@sema-agent/core").SessionStoreSummary, import("@sema-agent/core").SessionListQuery>;
|
|
156
150
|
sqlEngine: import("../plugins/sql-driver.js").SqlEngineReading | undefined;
|
|
157
151
|
storePosture: import("../store-posture.js").StorePosture;
|
|
158
152
|
taskAttachmentStore: import("../plugins/task-attachment-store.js").TaskAttachmentStore | undefined;
|