@sema-agent/server 7.132.0 → 7.133.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 +266 -0
- package/README.md +8 -9
- package/README.zh-CN.md +7 -6
- package/USAGE.md +174 -55
- package/deploy/sema-up/README.md +19 -1
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -2
- package/deploy/sema-up/chart/templates/server.yaml +5 -2
- package/deploy/sema-up/stack/compose.yaml +3 -0
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -2
- package/dist/adoption/plan.d.ts +3 -2
- package/dist/adoption/plan.js +7 -5
- package/dist/adoption/runner.js +3 -10
- package/dist/adoption/sql.d.ts +3 -2
- package/dist/adoption/sql.js +3 -5
- package/dist/adoption/wire.d.ts +4 -1
- package/dist/adoption/wire.js +1 -0
- package/dist/approval-ask-audit-store.d.ts +31 -13
- package/dist/approval-ask-audit-store.js +272 -74
- package/dist/approval-ask-machine.d.ts +15 -0
- package/dist/approval-ask-machine.js +6 -0
- package/dist/approval-ask-retention.d.ts +136 -0
- package/dist/approval-ask-retention.js +102 -0
- package/dist/approval-card.d.ts +79 -19
- package/dist/approval-card.js +44 -13
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval.d.ts +9 -0
- package/dist/approval.js +24 -3
- package/dist/audit.d.ts +27 -10
- package/dist/audit.js +12 -16
- package/dist/bake-runner/main.js +3 -2
- package/dist/boot/deferred-sandbox-path-env.js +1 -1
- package/dist/boot/execution-env.js +9 -7
- package/dist/boot/execution-lane.js +11 -0
- package/dist/boot/leader.js +2 -0
- package/dist/boot/memory-boundary.js +2 -2
- package/dist/boot/memory-consolidation.d.ts +5 -4
- package/dist/boot/memory-consolidation.js +7 -6
- package/dist/boot/org-delivery.d.ts +28 -0
- package/dist/boot/org-delivery.js +20 -0
- package/dist/boot/reapers.d.ts +3 -0
- package/dist/boot/reapers.js +21 -1
- package/dist/boot/resolve-spec.d.ts +3 -0
- package/dist/boot/resolve-spec.js +60 -81
- package/dist/boot/runner-deps.js +1 -0
- package/dist/boot/session-faces.d.ts +1 -0
- package/dist/boot/session-faces.js +4 -2
- package/dist/boot/stage-02-web-admin-pull.js +4 -1
- package/dist/boot/stage-06-runners.d.ts +2 -0
- package/dist/boot/stage-06-runners.js +6 -3
- package/dist/boot/stage-07-capability-layer.d.ts +2 -0
- package/dist/boot/stage-07-capability-layer.js +24 -3
- package/dist/boot/stage-08-reapers.d.ts +2 -0
- package/dist/boot/stage-08-reapers.js +2 -2
- package/dist/boot/stage-09-leader.d.ts +3 -0
- package/dist/boot/stage-10-http-server.d.ts +3 -0
- package/dist/boot/stage-10-http-server.js +5 -6
- package/dist/boot/stores.js +2 -2
- package/dist/boot/web-admin.d.ts +4 -0
- package/dist/boot/web-admin.js +151 -63
- package/dist/boot/workflow-orchestration.d.ts +2 -0
- package/dist/boot/workflow-orchestration.js +2 -1
- package/dist/brain.js +8 -3
- package/dist/breaker-key.d.ts +6 -0
- package/dist/breaker-key.js +29 -0
- package/dist/caller-text-echo.d.ts +9 -6
- package/dist/caller-text-echo.js +8 -11
- package/dist/capabilities/center-plugins.d.ts +7 -0
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +21 -0
- package/dist/capabilities/hands-lane.js +10 -0
- package/dist/capabilities/mcp-probe.d.ts +36 -4
- package/dist/capabilities/mcp-probe.js +27 -4
- package/dist/capabilities/scenarios.d.ts +63 -7
- package/dist/capabilities/scenarios.js +39 -7
- package/dist/capability-facts.d.ts +34 -4
- package/dist/capability-facts.js +28 -2
- package/dist/center-config-tier.d.ts +69 -0
- package/dist/center-config-tier.js +42 -0
- package/dist/checkpoint-identity.d.ts +16 -0
- package/dist/checkpoint-identity.js +19 -0
- package/dist/config-catalog.d.ts +17 -10
- package/dist/config-catalog.js +43 -28
- package/dist/config-d-migration.d.ts +3 -1
- package/dist/config-d-migration.js +2 -2
- package/dist/config-dir-trust.d.ts +114 -0
- package/dist/config-dir-trust.js +388 -0
- package/dist/config-invariants.d.ts +18 -5
- package/dist/config-invariants.js +35 -3
- package/dist/config-provider.d.ts +6 -1
- package/dist/config-provider.js +6 -2
- package/dist/config-types.d.ts +71 -14
- package/dist/config-types.js +8 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +121 -59
- package/dist/delegated-session-owner.d.ts +185 -0
- package/dist/delegated-session-owner.js +119 -0
- package/dist/device-protocol.d.ts +5 -3
- package/dist/device-protocol.js +1 -1
- package/dist/device-ws-hub.js +21 -2
- package/dist/device-ws-protocol.d.ts +70 -6
- package/dist/device-ws-protocol.js +50 -23
- package/dist/elicitation.js +3 -2
- package/dist/entry-problems.d.ts +34 -0
- package/dist/entry-problems.js +14 -0
- package/dist/execution-lane-caps.d.ts +49 -10
- package/dist/execution-lane-caps.js +43 -4
- package/dist/field-conflict.d.ts +43 -0
- package/dist/field-conflict.js +20 -0
- package/dist/fleet/fleet-bus.d.ts +80 -6
- package/dist/fleet/fleet-bus.js +41 -9
- package/dist/hooks/classic-stations.d.ts +10 -5
- package/dist/hooks/classic-stations.js +4 -4
- package/dist/hooks/command-spawn.d.ts +57 -0
- package/dist/hooks/command-spawn.js +139 -0
- package/dist/hooks/hook-llm.js +2 -2
- package/dist/hooks/hook-runner.d.ts +127 -25
- package/dist/hooks/hook-runner.js +668 -287
- package/dist/hooks/hook-source.d.ts +44 -0
- package/dist/hooks/hook-source.js +40 -0
- package/dist/http/active-run-conflict.d.ts +5 -13
- package/dist/http/active-run-conflict.js +17 -27
- package/dist/http/admission.js +103 -60
- package/dist/http/approval-sweeps.js +55 -18
- package/dist/http/caller-trust.d.ts +77 -0
- package/dist/http/caller-trust.js +143 -0
- package/dist/http/checkpoint-ctx.d.ts +16 -16
- package/dist/http/checkpoint-ctx.js +13 -10
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/device-placement.d.ts +2 -4
- package/dist/http/device-placement.js +2 -1
- package/dist/http/dispatch.js +10 -4
- package/dist/http/durable-run-leg.d.ts +4 -32
- package/dist/http/durable-run-leg.js +34 -10
- package/dist/http/owner-access.d.ts +56 -0
- package/dist/http/owner-access.js +42 -0
- package/dist/http/principal-gate.d.ts +48 -23
- package/dist/http/principal-gate.js +39 -12
- package/dist/http/readiness.d.ts +11 -5
- package/dist/http/readiness.js +10 -3
- package/dist/http/request-guards.d.ts +16 -23
- package/dist/http/request-guards.js +30 -15
- package/dist/http/resume-ctx-read.d.ts +2 -5
- package/dist/http/resume-ctx-read.js +7 -4
- package/dist/http/resume-legs.d.ts +3 -4
- package/dist/http/resume-legs.js +126 -69
- package/dist/http/retired-service-deps.d.ts +43 -0
- package/dist/http/retired-service-deps.js +18 -0
- package/dist/http/route-ctx.d.ts +44 -28
- package/dist/http/route-ctx.js +4 -0
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/a2a-serve.js +3 -4
- package/dist/http/routes/admin-config-refresh.js +1 -1
- package/dist/http/routes/admin-drain.js +1 -1
- package/dist/http/routes/admin-memory-optout.js +5 -1
- package/dist/http/routes/adoption.js +2 -9
- package/dist/http/routes/approvals-assistant.js +49 -48
- package/dist/http/routes/background.js +3 -2
- package/dist/http/routes/capabilities.js +20 -4
- package/dist/http/routes/config-catalog.d.ts +3 -3
- package/dist/http/routes/config-catalog.js +1 -1
- package/dist/http/routes/devices.js +3 -17
- package/dist/http/routes/diagnostics.js +5 -1
- package/dist/http/routes/images.js +6 -7
- package/dist/http/routes/leader.js +1 -8
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +3 -2
- package/dist/http/routes/memory-bundle.js +1 -1
- package/dist/http/routes/memory-compliance.js +1 -1
- package/dist/http/routes/memory-consolidation.js +1 -1
- package/dist/http/routes/memory-origin.js +1 -1
- package/dist/http/routes/memory-policy.d.ts +1 -1
- package/dist/http/routes/memory-policy.js +3 -2
- package/dist/http/routes/notify-wake.js +8 -21
- package/dist/http/routes/observability.js +2 -2
- package/dist/http/routes/principal-inbox.d.ts +39 -0
- package/dist/http/routes/principal-inbox.js +76 -0
- package/dist/http/routes/retention-ops.js +2 -9
- package/dist/http/routes/rules.js +5 -18
- package/dist/http/routes/runs.d.ts +5 -0
- package/dist/http/routes/runs.js +33 -106
- package/dist/http/routes/session-sync.js +15 -28
- package/dist/http/routes/sessions.js +30 -40
- package/dist/http/routes/side-query.js +6 -4
- package/dist/http/routes/tasks.js +50 -14
- package/dist/http/routes/workflows.d.ts +351 -0
- package/dist/http/routes/workflows.js +153 -119
- package/dist/http/send.d.ts +24 -3
- package/dist/http/send.js +14 -2
- package/dist/http/server.d.ts +17 -18
- package/dist/http/server.js +15 -13
- package/dist/http/stored-body-replay.js +17 -4
- package/dist/http/submit-ctx.js +4 -3
- package/dist/http/submit-replay.d.ts +4 -3
- package/dist/http/submit-replay.js +5 -4
- package/dist/http/wire-types.d.ts +10 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -1
- package/dist/lane-home-probe.d.ts +78 -9
- package/dist/lane-home-probe.js +78 -12
- package/dist/leader/endpoint.d.ts +4 -1
- package/dist/leader/endpoint.js +11 -10
- package/dist/limit-refusal.d.ts +17 -5
- package/dist/limit-refusal.js +4 -1
- package/dist/mcp-assertion-header.d.ts +31 -10
- package/dist/mcp-assertion-header.js +10 -3
- package/dist/mcp-tool-faces.js +1 -3
- package/dist/memory-project-layer.d.ts +37 -0
- package/dist/memory-project-layer.js +46 -0
- package/dist/memory-scope.d.ts +23 -16
- package/dist/memory-scope.js +24 -8
- package/dist/memory-sync-client.d.ts +27 -13
- package/dist/memory-sync-client.js +107 -18
- package/dist/model-entry-refusal.d.ts +9 -1
- package/dist/model-entry-refusal.js +6 -1
- package/dist/model-plane-face.d.ts +51 -0
- package/dist/model-plane-face.js +24 -0
- package/dist/model-provider.d.ts +5 -0
- package/dist/model-provider.js +4 -2
- package/dist/model-route-endpoint.d.ts +8 -11
- package/dist/model-route-endpoint.js +4 -7
- package/dist/model-route-env.d.ts +22 -0
- package/dist/model-route-env.js +2 -0
- package/dist/model-route-gap.d.ts +60 -30
- package/dist/model-route-gap.js +21 -15
- package/dist/observability/corrupt-read-seat.d.ts +7 -0
- package/dist/observability/corrupt-read-seat.js +9 -0
- package/dist/observability/err-text.d.ts +6 -0
- package/dist/observability/err-text.js +18 -4
- package/dist/observability/fail-open.d.ts +35 -9
- package/dist/observability/fail-open.js +35 -9
- package/dist/observability/metrics.js +1 -0
- package/dist/observability/prompt-manifest.d.ts +3 -17
- package/dist/observability/prompt-manifest.js +45 -42
- package/dist/observability/tool-trace.js +9 -9
- package/dist/operator-ask.d.ts +10 -0
- package/dist/operator-ask.js +3 -0
- package/dist/orchestration/workflow-agent-session-index.d.ts +12 -12
- package/dist/orchestration/workflow-agent-session-index.js +9 -13
- package/dist/orchestration/workflow-completion-inbox.d.ts +42 -15
- package/dist/orchestration/workflow-completion-inbox.js +13 -0
- package/dist/orchestration/workflow-notify-journal.d.ts +13 -32
- package/dist/orchestration/workflow-notify-journal.js +27 -34
- package/dist/orchestration/workflow-park-decision.d.ts +89 -0
- package/dist/orchestration/workflow-park-decision.js +118 -0
- package/dist/org-delivery-gate.d.ts +81 -0
- package/dist/org-delivery-gate.js +59 -0
- package/dist/panel-tool-names.d.ts +23 -0
- package/dist/panel-tool-names.js +8 -0
- package/dist/parked-decide.d.ts +39 -6
- package/dist/parked-decide.js +98 -51
- package/dist/parked-revive-surface.d.ts +9 -2
- package/dist/parked-revive-surface.js +11 -8
- package/dist/permission-rule-list.d.ts +1 -1
- package/dist/permission-rule-list.js +2 -2
- package/dist/plugins/approval-ask-store-file.d.ts +16 -1
- package/dist/plugins/approval-ask-store-file.js +21 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +18 -1
- package/dist/plugins/approval-ask-store-memory.js +34 -2
- package/dist/plugins/approval-ask-store-sql.d.ts +25 -0
- package/dist/plugins/approval-ask-store-sql.js +37 -1
- package/dist/plugins/blob-backend.d.ts +38 -25
- package/dist/plugins/blob-backend.js +29 -19
- package/dist/plugins/breaker-state-sql.d.ts +2 -2
- package/dist/plugins/breaker-state-sql.js +4 -4
- package/dist/plugins/caching-session-store.d.ts +3 -0
- package/dist/plugins/caching-session-store.js +3 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +14 -0
- package/dist/plugins/checkpoint-store-sql.js +20 -2
- package/dist/plugins/file-history-store-sql.d.ts +5 -2
- package/dist/plugins/file-history-store-sql.js +3 -1
- package/dist/plugins/file-run-store.d.ts +5 -13
- package/dist/plugins/file-run-store.js +9 -0
- package/dist/plugins/fork-routing-session-store.d.ts +9 -1
- package/dist/plugins/fork-routing-session-store.js +12 -1
- package/dist/plugins/host-platform.d.ts +2 -0
- package/dist/plugins/host-platform.js +2 -1
- package/dist/plugins/local-checkpoint-store.d.ts +2 -0
- package/dist/plugins/local-checkpoint-store.js +6 -1
- package/dist/plugins/local-session-store.d.ts +1 -1
- package/dist/plugins/local-session-window.d.ts +39 -0
- package/dist/plugins/local-session-window.js +54 -0
- package/dist/plugins/mailbox-recipient-lifecycle.d.ts +3 -2
- package/dist/plugins/mailbox-store-sql.d.ts +30 -48
- package/dist/plugins/mailbox-store-sql.js +77 -52
- package/dist/plugins/memory-embedder-fingerprint.js +2 -1
- package/dist/plugins/memory-run-store.d.ts +5 -13
- package/dist/plugins/memory-run-store.js +8 -0
- package/dist/plugins/one-time-migrations.d.ts +110 -5
- package/dist/plugins/one-time-migrations.js +320 -8
- package/dist/plugins/org-delivery-quota-store.d.ts +123 -0
- package/dist/plugins/org-delivery-quota-store.js +228 -0
- package/dist/plugins/pg-pool.js +39 -7
- package/dist/plugins/pg-session-storage.d.ts +17 -4
- package/dist/plugins/pg-session-storage.js +29 -6
- package/dist/plugins/remote-env-adb.d.ts +6 -12
- package/dist/plugins/remote-env-adb.js +12 -2
- package/dist/plugins/remote-env-k8s.d.ts +8 -12
- package/dist/plugins/remote-env-k8s.js +23 -5
- package/dist/plugins/remote-env-local-docker.d.ts +10 -15
- package/dist/plugins/remote-env-local-docker.js +12 -9
- package/dist/plugins/remote-env-ssh.d.ts +10 -16
- package/dist/plugins/remote-env-ssh.js +17 -11
- package/dist/plugins/run-store-sql.d.ts +16 -14
- package/dist/plugins/run-store-sql.js +22 -2
- package/dist/plugins/schema-indexes.js +2 -0
- package/dist/plugins/send-user-file.js +2 -2
- package/dist/plugins/session-epoch-anchor.d.ts +32 -6
- package/dist/plugins/session-epoch-anchor.js +2 -3
- package/dist/plugins/session-store.d.ts +18 -8
- package/dist/plugins/session-store.js +15 -4
- package/dist/plugins/sql-driver.d.ts +74 -11
- package/dist/plugins/sql-driver.js +210 -12
- package/dist/plugins/sql-errors.d.ts +23 -0
- package/dist/plugins/sql-errors.js +21 -0
- package/dist/plugins/store-backend.d.ts +36 -1
- package/dist/plugins/store-backend.js +40 -14
- package/dist/plugins/store-contracts.d.ts +42 -0
- package/dist/plugins/store-contracts.js +1 -0
- package/dist/plugins/tidb-pool.d.ts +6 -1
- package/dist/plugins/tidb-pool.js +44 -10
- package/dist/plugins/tidb-session-storage.d.ts +3 -2
- package/dist/plugins/tidb-session-storage.js +2 -2
- package/dist/plugins/tidb-session-store.d.ts +24 -4
- package/dist/plugins/tidb-session-store.js +28 -4
- package/dist/plugins/workflow-journal-store-sql.d.ts +73 -19
- package/dist/plugins/workflow-journal-store-sql.js +19 -6
- package/dist/plugins/workflow-run-store-sql.d.ts +30 -8
- package/dist/plugins/workflow-run-store-sql.js +50 -9
- package/dist/posture-source.d.ts +18 -10
- package/dist/posture-source.js +4 -1
- package/dist/project-identity.d.ts +45 -6
- package/dist/project-identity.js +162 -8
- package/dist/project-layer-key.d.ts +28 -0
- package/dist/project-layer-key.js +29 -0
- package/dist/question.js +3 -2
- package/dist/read-deny-entry.d.ts +25 -0
- package/dist/read-deny-entry.js +12 -0
- package/dist/read-face-posture.d.ts +37 -11
- package/dist/read-face-posture.js +32 -3
- package/dist/request-key-closure.d.ts +7 -0
- package/dist/request-key-closure.js +9 -1
- package/dist/request-value-closure.d.ts +5 -0
- package/dist/request-value-closure.js +11 -3
- package/dist/rule-entry-list.d.ts +26 -2
- package/dist/rule-entry-list.js +72 -12
- package/dist/rules-consent.js +3 -4
- package/dist/run-acceptance.d.ts +19 -3
- package/dist/run-acceptance.js +13 -1
- package/dist/run-local.js +36 -6
- package/dist/runs.d.ts +10 -9
- package/dist/runs.js +21 -3
- package/dist/runtime-caps-resolver.d.ts +16 -6
- package/dist/runtime-caps-resolver.js +18 -5
- package/dist/sandbox-pkg-source.d.ts +19 -1
- package/dist/sandbox-pkg-source.js +29 -7
- package/dist/security.d.ts +87 -9
- package/dist/security.js +52 -9
- package/dist/session-error-wire.d.ts +19 -2
- package/dist/session-error-wire.js +5 -1
- package/dist/session-titled-frame.d.ts +33 -0
- package/dist/session-titled-frame.js +4 -0
- package/dist/session-titler.d.ts +9 -1
- package/dist/session-titler.js +15 -4
- package/dist/spec-fields.js +21 -2
- package/dist/sql-engine-posture.d.ts +3 -1
- package/dist/task-cwd.d.ts +1 -1
- package/dist/task-mcp.d.ts +3 -3
- package/dist/task-mcp.js +7 -66
- package/dist/task-settings.d.ts +89 -88
- package/dist/task-settings.js +71 -63
- package/dist/text-bidi.d.ts +0 -4
- package/dist/text-bidi.js +1 -3
- package/dist/tighten-only-seats.d.ts +150 -0
- package/dist/tighten-only-seats.js +196 -0
- package/dist/tool-approval.d.ts +303 -87
- package/dist/tool-approval.js +623 -239
- package/dist/trace/core-keyset-guard.d.ts +104 -22
- package/dist/trace/exit-seat.d.ts +28 -0
- package/dist/trace/exit-seat.js +76 -0
- package/dist/trace/ledger-events.d.ts +3 -2
- package/dist/trace/project.d.ts +80 -12
- package/dist/trace/project.js +41 -28
- package/dist/trace/projection-table.d.ts +100 -0
- package/dist/trace/projection-table.js +130 -0
- package/dist/trace/redact.d.ts +54 -0
- package/dist/trace/redact.js +778 -152
- package/dist/trace/self-minted-wire.d.ts +345 -1
- package/dist/trace/self-minted-wire.js +117 -1
- package/dist/trace/wire-projection-faces.d.ts +298 -2
- package/dist/trace/wire-projection-faces.js +154 -13
- package/dist/url-refusal.js +2 -0
- package/dist/web-admin-client/apply-effective.d.ts +12 -0
- package/dist/web-admin-client/apply-effective.js +56 -5
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/read-face.js +5 -9
- package/dist/web-admin-client/skills-mcp.js +4 -5
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +57 -9
- package/package.json +7 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { realpathSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { NodeExecutionEnv, QUESTION_AWAITS_RESUME,
|
|
3
|
+
import { NodeExecutionEnv, QUESTION_AWAITS_RESUME, deriveAskEffective, expandTiers, modePolicyOf, resolveAskSeamForm } from "@sema-agent/core";
|
|
4
4
|
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 { buildPromptSeats, createScenarioGate, mergeUserSkills, selectScenario } from "../capabilities/scenarios.js";
|
|
8
|
+
import { buildExcludeToolsSeat, buildPromptSeats, createScenarioGate, mergeUserSkills, selectScenario } from "../capabilities/scenarios.js";
|
|
9
9
|
import { stampHandsLane, toolPolicyForHands } from "../capabilities/hands-lane.js";
|
|
10
10
|
import { applyLongtailDefer } from "../capabilities/tool-defer.js";
|
|
11
11
|
import { assertGuardPatternsUsable, buildApprovalGrantNotice, buildOnlySensitiveBaselineWarning, createApprovalBaselinePolicy, createDeploymentGovernanceInputs } from "../deployment-governance.js";
|
|
@@ -17,7 +17,7 @@ import { HOST_POSTURE_REFUSED_CODE, taskInheritEnvRefusal, taskWriteFaceRefusal
|
|
|
17
17
|
import { headerStr } from "../http/principal-gate.js";
|
|
18
18
|
import { explicitOperatorOk } from "../http/server.js";
|
|
19
19
|
import { isAtMentionable, matchCatalogModel, modelSupportsImages, refusedCatalogEntry, resolveTaskModel, selectableCatalog, terminalCatalogName } from "../model-select.js";
|
|
20
|
-
import { modelUnavailableMessage } from "../model-entry-refusal.js";
|
|
20
|
+
import { echoModelRef, modelUnavailableMessage } from "../model-entry-refusal.js";
|
|
21
21
|
import { PerTaskImageRegistry, resolveSandboxImageRef } from "../per-task-image.js";
|
|
22
22
|
import { isRemoteScratchpadLane, remoteScratchpadDirFor } from "../plugins/remote-scratchpad.js";
|
|
23
23
|
import { bindAttachmentsForTask } from "../plugins/task-attachment-store.js";
|
|
@@ -27,7 +27,9 @@ import { tightenGoverned } from "../governance-overrides.js";
|
|
|
27
27
|
import { gateExecutionLane } from "../runtime-caps-resolver.js";
|
|
28
28
|
import { applyRuntimeGovernance } from "../runtime-governance.js";
|
|
29
29
|
import { HttpError, createCodedHttpError, encodeCheckpointScope } from "../security.js";
|
|
30
|
-
import {
|
|
30
|
+
import { sessionFaceReadOf } from "../session-incarnation.js";
|
|
31
|
+
import { memorySpecForRequest } from "../memory-scope.js";
|
|
32
|
+
import { createMemoryProjectLayers } from "../memory-project-layer.js";
|
|
31
33
|
import { inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
|
|
32
34
|
import { a2aForScenario, mcpForScenario } from "../web-admin-client/facade.js";
|
|
33
35
|
import { normalizeAttachments, normalizeResilience, normalizeResumeAtMode, normalizeSuggestNextPrompts, promptProfileFromBody, resolveTaskLimits, retainBackgroundProcessesFromBody, taskAgentsSpecFragment, toolMaterializeStrategyFromBody, allowToolsSpecFragment, toolNameListFromBody } from "../spec-fields.js";
|
|
@@ -37,17 +39,21 @@ import { assertRequestA2aUnlocked, resolveRequestA2a } from "../task-a2a.js";
|
|
|
37
39
|
import { assertRequestMcpEntries, assertRequestMcpUnlocked, resolveRequestMcp } from "../task-mcp.js";
|
|
38
40
|
import { storedToolAxesRereadM19 } from "../stored-request-tool-axes-m19.js";
|
|
39
41
|
import { storedHooksRereadM20 } from "../stored-request-hooks-m20.js";
|
|
40
|
-
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, REQUEST_SETTINGS_REFUSAL_PREFIX, acceptAppendSystemPrompt, applyTaskSettings, effectivePermissionMode, effectiveThinking, parseTaskSettings, taskHooksHonored, settingsPermissionBucketIssue
|
|
42
|
+
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";
|
|
43
|
+
import { tightenOnlySeatIssue } from "../tighten-only-seats.js";
|
|
44
|
+
import { entryProblemsFacts } from "../entry-problems.js";
|
|
41
45
|
import { inertToolListEntryOf } from "../rule-entry-list.js";
|
|
42
46
|
import { TENANCY_WALL_CLOCK_BASE_SEC, enableForkFromBody, normalizeRetainSubagentSessions, selfOrchestrationFromBody } from "../task-workflow.js";
|
|
43
47
|
import { redactSecrets } from "../trace/redact.js";
|
|
44
48
|
import { DeferredSandboxPathEnv, isSandboxPathAdjudicationLane, sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
|
|
45
|
-
import {
|
|
49
|
+
import { executionLaneHomeDir, executionLaneOf, laneWiresExecutionEnv } from "../execution-lane-caps.js";
|
|
46
50
|
import { effectiveMemoryPersistenceCapable } from "./memory-boundary.js";
|
|
47
51
|
import { withUnattendedLeg } from "../unattended-permission-mode.js";
|
|
52
|
+
import { fieldConflictFacts } from "../field-conflict.js";
|
|
48
53
|
export function createResolveSpec(ctx) {
|
|
49
|
-
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, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, liveQuestionFace, approverSeat, lockedKeys, } = ctx;
|
|
54
|
+
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;
|
|
50
55
|
const scenarioGate = createScenarioGate({ config, scenarios, principalCaps, logger }, "enforce");
|
|
56
|
+
const readSessionFace = sessionFaceReadOf(ownerAware);
|
|
51
57
|
assertGuardPatternsUsable(config);
|
|
52
58
|
const onlySensitiveBaseline = buildOnlySensitiveBaselineWarning(config, {
|
|
53
59
|
approvalSeat: durableEnabled ? "durable" : "absent",
|
|
@@ -59,6 +65,7 @@ export function createResolveSpec(ctx) {
|
|
|
59
65
|
const sessionCwd = auth?.sessionId ? effectiveHostWorkspace(perSessionCwd.get(auth.sessionId), {}) : undefined;
|
|
60
66
|
return sessionCwd ?? (config.remoteExec === undefined ? process.cwd() : undefined);
|
|
61
67
|
};
|
|
68
|
+
const memoryProjectLayers = createMemoryProjectLayers({ backend: memoryEngine?.backend, syncRunner: memorySyncRunner, log: logger });
|
|
62
69
|
if (onlySensitiveBaseline)
|
|
63
70
|
logger.warn(onlySensitiveBaseline.event, onlySensitiveBaseline.fields);
|
|
64
71
|
const approvalGrantNotice = buildApprovalGrantNotice(config);
|
|
@@ -81,7 +88,7 @@ export function createResolveSpec(ctx) {
|
|
|
81
88
|
cwdHonored: cwdHonored(config),
|
|
82
89
|
});
|
|
83
90
|
if (conflict) {
|
|
84
|
-
throw new HttpError(400, `cwd "${conflict.cwd.asSpelled}" is inside this session's scratchpad "${conflict.scratchpadDir.asSpelled}" — the scratchpad is the fs-write gate's EXEMPT directory, so a task rooted there would auto-approve every write under its own root and the engine refuses to build the gate at all (config.write_exempt_dir_covers_root). Point cwd at the project directory instead (or send no cwd and let the session keep the one it has): this session registers the cwd you send, so a task that happens not to mount the write gate would still leave every LATER task on this session rooted in the exemption. A workflow that really is meant to write without prompts says so with a knob that means it (a permission mode, an open write face) and still keeps its root outside the scratchpad — those knobs do not lift this refusal, because the conflict is between two fields of this request, not a permission level.`, { code: "request.field_conflict", extra: { cwd: conflict.cwd, scratchpadDir: conflict.scratchpadDir } });
|
|
91
|
+
throw new HttpError(400, `cwd "${conflict.cwd.asSpelled}" is inside this session's scratchpad "${conflict.scratchpadDir.asSpelled}" — the scratchpad is the fs-write gate's EXEMPT directory, so a task rooted there would auto-approve every write under its own root and the engine refuses to build the gate at all (config.write_exempt_dir_covers_root). Point cwd at the project directory instead (or send no cwd and let the session keep the one it has): this session registers the cwd you send, so a task that happens not to mount the write gate would still leave every LATER task on this session rooted in the exemption. A workflow that really is meant to write without prompts says so with a knob that means it (a permission mode, an open write face) and still keeps its root outside the scratchpad — those knobs do not lift this refusal, because the conflict is between two fields of this request, not a permission level.`, { code: "request.field_conflict", extra: { ...fieldConflictFacts("scratchpad_root", body.scratchpadDir === conflict.scratchpadDir.asSpelled ? ["cwd", "scratchpadDir"] : ["cwd"]), cwd: conflict.cwd, scratchpadDir: conflict.scratchpadDir } });
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
const offFieldIssue = singleMemberOffFieldIssue(body);
|
|
@@ -109,6 +116,11 @@ export function createResolveSpec(ctx) {
|
|
|
109
116
|
if (bucketIssue)
|
|
110
117
|
throw new HttpError(400, bucketIssue.message, { code: "request.field_invalid", extra: bucketIssue.fields });
|
|
111
118
|
}
|
|
119
|
+
{
|
|
120
|
+
const seatIssue = tightenOnlySeatIssue(body.settings);
|
|
121
|
+
if (seatIssue)
|
|
122
|
+
throw new HttpError(400, seatIssue.message, { code: "request.field_invalid", extra: seatIssue.fields });
|
|
123
|
+
}
|
|
112
124
|
{
|
|
113
125
|
const replay = opts?.leg === "resume";
|
|
114
126
|
const inertList = inertToolListEntryOf(body, replay ? ["deny"] : undefined);
|
|
@@ -136,8 +148,9 @@ export function createResolveSpec(ctx) {
|
|
|
136
148
|
}
|
|
137
149
|
const lane = bindSettingsCwdEnvAndModel(body, auth, gated, opts);
|
|
138
150
|
const anchors = await resolveHistoryAnchors(body, auth);
|
|
139
|
-
const
|
|
140
|
-
const
|
|
151
|
+
const projectKey = memoryEngine ? await memoryProjectLayers.prepare(config, auth?.memoryScope, realTaskRootOf(auth)) : undefined;
|
|
152
|
+
const spec = assembleSpecLiteral(body, auth, req, opts, { ...gated, ...lane, ...anchors, projectKey }, effMode);
|
|
153
|
+
const folded = await foldGovernanceAndSettings(body, auth, spec, gated);
|
|
141
154
|
const final = await applyImageFactsAndRouting(body, auth, folded.governed, {
|
|
142
155
|
scenarioName: gated.scenarioName,
|
|
143
156
|
scratchpadDir: folded.scratchpadDir,
|
|
@@ -149,7 +162,7 @@ export function createResolveSpec(ctx) {
|
|
|
149
162
|
const gateScenarioAndAppend = async (body, auth, opts) => {
|
|
150
163
|
const scenarioName = await scenarioGate(auth?.principal, body.scenario);
|
|
151
164
|
gateExecutionLane(await principalCaps?.executionRuling(auth?.principal), executionLaneOf(config.remoteExec?.provider), logger);
|
|
152
|
-
const cap = selectScenario(scenarios, scenarioName)(body, auth?.principal, auth?.sessionId !== undefined ? { sessionId: auth.sessionId } : {});
|
|
165
|
+
const cap = selectScenario(scenarios, scenarioName)(body, auth?.principal, auth?.sessionId !== undefined ? { sessionId: auth.sessionId, delegationRoot: { sessionId: auth.sessionId, incarnation: (await readSessionFace?.(auth.sessionId))?.incarnation ?? null } } : {});
|
|
153
166
|
const acceptedAppend = acceptAppendSystemPrompt(body.appendSystemPrompt, (detail) => logger.warn("append_system_prompt_dropped", { detail, sessionId: auth?.sessionId ?? null }));
|
|
154
167
|
const objective = typeof body.objective === "string" ? body.objective : "";
|
|
155
168
|
const parsedSettings = parseTaskSettings(body.settings, opts?.leg === "fresh" || !taskHooksHonored(config) ? {} : { storedHooksReread: storedHooksRereadM20(new Date().toISOString().slice(0, 10)) });
|
|
@@ -274,22 +287,22 @@ export function createResolveSpec(ctx) {
|
|
|
274
287
|
if (picked.unavailable !== undefined) {
|
|
275
288
|
const { requested, name, refusal, source } = picked.unavailable;
|
|
276
289
|
if (opts?.leg === "fresh") {
|
|
277
|
-
throw new HttpError(400, modelUnavailableMessage(source === "mention" ? "@-mention" : "model", requested
|
|
290
|
+
throw new HttpError(400, modelUnavailableMessage(source === "mention" ? "@-mention" : "model", requested, name, refusal), { code: "request.model_unavailable" });
|
|
278
291
|
}
|
|
279
292
|
metrics.inc("task_model_unavailable_fallback_total");
|
|
280
|
-
logger.warn("task_model_unavailable_fallback", { requested: requested
|
|
293
|
+
logger.warn("task_model_unavailable_fallback", { requested: echoModelRef(requested), name, code: refusal.code, source, fallback: picked.model, sessionId: auth?.sessionId ?? null });
|
|
281
294
|
}
|
|
282
295
|
if (picked.notAllowed !== undefined) {
|
|
283
296
|
const { requested, resolved, source } = picked.notAllowed;
|
|
284
297
|
if (opts?.leg === "fresh") {
|
|
285
|
-
throw new HttpError(400, `model "${requested
|
|
298
|
+
throw new HttpError(400, `model "${echoModelRef(requested)}" is not @-mentionable on this deployment (it resolves to catalog model "${resolved}") — which models can be @-mentioned is configured by the operator (models.atMention)`, { code: "request.model_not_allowed" });
|
|
286
299
|
}
|
|
287
300
|
metrics.inc("task_model_not_allowlisted_resume_total");
|
|
288
|
-
logger.warn("task_model_not_allowlisted_resume", { requested: requested
|
|
301
|
+
logger.warn("task_model_not_allowlisted_resume", { requested: echoModelRef(requested), resolved, source, sessionId: auth?.sessionId ?? null, note: "resumed leg keeps running the model it was started on — the allowlist gates fresh picks only" });
|
|
289
302
|
}
|
|
290
303
|
if (picked.unknownExplicit !== undefined) {
|
|
291
304
|
metrics.inc("task_model_unknown_fallback_total");
|
|
292
|
-
logger.warn("task_model_unknown_fallback", { requested: picked.unknownExplicit
|
|
305
|
+
logger.warn("task_model_unknown_fallback", { requested: echoModelRef(picked.unknownExplicit), fallback: picked.model, sessionId: auth?.sessionId ?? null });
|
|
293
306
|
}
|
|
294
307
|
if (Array.isArray(body.images) && body.images.length > 0 && !modelSupportsImages(wireCatalog[picked.model])) {
|
|
295
308
|
metrics.inc("images_omitted_total", { model: picked.model });
|
|
@@ -338,7 +351,7 @@ export function createResolveSpec(ctx) {
|
|
|
338
351
|
return deriveAskEffective(askForm.form, "unresolved") === "human_reachable";
|
|
339
352
|
};
|
|
340
353
|
const assembleSpecLiteral = (body, auth, req, opts, parts, effMode) => {
|
|
341
|
-
const { scenarioName, cap, hands, acceptedAppend, parsedSettings, attachmentNotice, taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, } = parts;
|
|
354
|
+
const { scenarioName, cap, hands, acceptedAppend, parsedSettings, attachmentNotice, taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, projectKey, } = parts;
|
|
342
355
|
const storedToolAxes = opts?.leg === "fresh" ? undefined : storedToolAxesRereadM19(new Date().toISOString().slice(0, 10));
|
|
343
356
|
const spec = {
|
|
344
357
|
objective: attachmentNotice ? `${picked.cleanedObjective}\n\n${attachmentNotice}` : picked.cleanedObjective,
|
|
@@ -380,7 +393,7 @@ export function createResolveSpec(ctx) {
|
|
|
380
393
|
? { retainBackgroundProcesses: true }
|
|
381
394
|
: {}),
|
|
382
395
|
...(body.excludeAllTools === true ? { excludeAllTools: true } : {}),
|
|
383
|
-
...(
|
|
396
|
+
...buildExcludeToolsSeat(cap.excludeTools, toolNameListFromBody(body.excludeTools)),
|
|
384
397
|
...allowToolsSpecFragment(body.allowTools),
|
|
385
398
|
...(() => { const v = toolNameListFromBody(body.deferTools); return v ? { deferTools: v } : {}; })(),
|
|
386
399
|
...(() => { const v = promptProfileFromBody(body.promptProfile); return v ? { promptProfile: v } : {}; })(),
|
|
@@ -389,7 +402,7 @@ export function createResolveSpec(ctx) {
|
|
|
389
402
|
...(declaresInteractivePosture(body, req, opts) ? { interactionPosture: "interactive" } : {}),
|
|
390
403
|
...(body.approvalReach !== undefined ? { approvalReach: body.approvalReach } : {}),
|
|
391
404
|
...(typeof body.oneShot === "boolean" ? { oneShot: body.oneShot } : {}),
|
|
392
|
-
resilience: normalizeResilience(body.resilience, explicitOperatorOk(auth?.principal, config
|
|
405
|
+
resilience: normalizeResilience(body.resilience, explicitOperatorOk(auth?.principal, config)),
|
|
393
406
|
finalVerification: cap.finalVerification === true || body.finalVerification === true ? true : undefined,
|
|
394
407
|
attachments: normalizeAttachments(body.attachments),
|
|
395
408
|
...(taskHooks ? { mods: [taskHooks] } : {}),
|
|
@@ -400,23 +413,23 @@ export function createResolveSpec(ctx) {
|
|
|
400
413
|
const cm = matchCatalogModel(body.compactionModel, wireCatalog, config.modelRefusals);
|
|
401
414
|
const refusedCm = cm === undefined ? refusedCatalogEntry(body.compactionModel, config.modelRefusals) : undefined;
|
|
402
415
|
if (refusedCm !== undefined && opts?.leg === "fresh") {
|
|
403
|
-
throw new HttpError(400, modelUnavailableMessage("compactionModel", body.compactionModel
|
|
416
|
+
throw new HttpError(400, modelUnavailableMessage("compactionModel", body.compactionModel, refusedCm.name, refusedCm.refusal), { code: "request.model_unavailable" });
|
|
404
417
|
}
|
|
405
418
|
if (cm === undefined) {
|
|
406
419
|
if (opts?.leg === "fresh") {
|
|
407
|
-
throw new HttpError(400, `unknown compactionModel "${body.compactionModel
|
|
420
|
+
throw new HttpError(400, `unknown compactionModel "${echoModelRef(body.compactionModel)}" — not in the configured catalog (name, tier word, or id; a catalog refresh may have removed it mid-request)`);
|
|
408
421
|
}
|
|
409
422
|
metrics.inc("task_model_unknown_fallback_total");
|
|
410
|
-
logger.warn("compaction_model_unknown_fallback", { requested: body.compactionModel
|
|
423
|
+
logger.warn("compaction_model_unknown_fallback", { requested: echoModelRef(body.compactionModel), sessionId: auth?.sessionId ?? null });
|
|
411
424
|
return {};
|
|
412
425
|
}
|
|
413
426
|
if (!isAtMentionable(cm, wireCatalog, config.atMention, config.modelRefusals)) {
|
|
414
427
|
const terminal = terminalCatalogName(cm, wireCatalog, config.modelRefusals) ?? cm;
|
|
415
428
|
if (opts?.leg === "fresh") {
|
|
416
|
-
throw new HttpError(400, `compactionModel "${body.compactionModel
|
|
429
|
+
throw new HttpError(400, `compactionModel "${echoModelRef(body.compactionModel)}" is not @-mentionable on this deployment (it resolves to catalog model "${terminal}") — which models can be @-mentioned is configured by the operator (models.atMention)`, { code: "request.model_not_allowed" });
|
|
417
430
|
}
|
|
418
431
|
metrics.inc("task_model_not_allowlisted_resume_total");
|
|
419
|
-
logger.warn("task_model_not_allowlisted_resume", { requested: body.compactionModel
|
|
432
|
+
logger.warn("task_model_not_allowlisted_resume", { requested: echoModelRef(body.compactionModel), resolved: terminal, source: "compaction", sessionId: auth?.sessionId ?? null, note: "resumed leg keeps the compaction model it was started with — the allowlist gates fresh picks only" });
|
|
420
433
|
}
|
|
421
434
|
return { compactionModel: cm };
|
|
422
435
|
})()),
|
|
@@ -459,7 +472,7 @@ export function createResolveSpec(ctx) {
|
|
|
459
472
|
})(),
|
|
460
473
|
...(config.requirePrincipal !== true ? { backgroundScope: "session" } : {}),
|
|
461
474
|
memory: memoryEngine
|
|
462
|
-
? memorySpecForRequest(auth?.memoryScope,
|
|
475
|
+
? memorySpecForRequest(auth?.memoryScope, projectKey, body.memoryWrite, s4DefaultScopes, { multiTenant: config.requirePrincipal === true }, { memory: body.memory, memoryCapture: body.memoryCapture })
|
|
463
476
|
: undefined,
|
|
464
477
|
...((v) => (v !== undefined ? { memoryPersistenceCapable: v } : {}))(effectiveMemoryPersistenceCapable(config)),
|
|
465
478
|
tools: ((base) => {
|
|
@@ -505,7 +518,7 @@ export function createResolveSpec(ctx) {
|
|
|
505
518
|
};
|
|
506
519
|
return spec;
|
|
507
520
|
};
|
|
508
|
-
const foldGovernanceAndSettings = async (body, auth, spec, gated
|
|
521
|
+
const foldGovernanceAndSettings = async (body, auth, spec, gated) => {
|
|
509
522
|
const { acceptedAppend, parsedSettings } = gated;
|
|
510
523
|
const hostSemanticsLane = !isSandboxPathAdjudicationLane(config.remoteExec?.provider);
|
|
511
524
|
const laneHomeBase = () => {
|
|
@@ -533,7 +546,7 @@ export function createResolveSpec(ctx) {
|
|
|
533
546
|
};
|
|
534
547
|
const governedBase = applyRuntimeGovernance(spec, createDeploymentGovernanceInputs(config, pathAdjudication));
|
|
535
548
|
let governed = governedBase;
|
|
536
|
-
let effectiveSettings =
|
|
549
|
+
let effectiveSettings = parsedSettings.settings;
|
|
537
550
|
if (effectiveSettings?.outputStyle && acceptedAppend && acceptedAppend.length + 2 + effectiveSettings.outputStyle.length > MAX_SETTINGS_OUTPUT_STYLE_CHARS) {
|
|
538
551
|
logger.warn("output_style_dropped", { detail: `combined append carriers exceed the ${MAX_SETTINGS_OUTPUT_STYLE_CHARS} cap (rider ${acceptedAppend.length} + style ${effectiveSettings.outputStyle.length}) — style dropped (pre-cap stored body on a resume leg?)`, sessionId: auth?.sessionId ?? null });
|
|
539
552
|
const { outputStyle: _dropped2, ...rest2 } = effectiveSettings;
|
|
@@ -549,65 +562,31 @@ export function createResolveSpec(ctx) {
|
|
|
549
562
|
? await ensureScratchpadDir(config.localDataRoot ?? localRoot, auth.sessionId, (msg, meta) => logger.warn(msg, { ...(meta ?? {}), sessionId: auth.sessionId }))
|
|
550
563
|
: undefined);
|
|
551
564
|
if (effectiveSettings) {
|
|
552
|
-
const
|
|
553
|
-
...(
|
|
554
|
-
|
|
555
|
-
isExempt: async (toolName) => {
|
|
556
|
-
const hit = await approvalExemptionStore.has(auth.sessionId, toolName);
|
|
557
|
-
if (hit)
|
|
558
|
-
logger.info("fs_write_gate_exempted", { toolName, sessionId: auth.sessionId });
|
|
559
|
-
return hit;
|
|
560
|
-
},
|
|
561
|
-
}
|
|
562
|
-
: {}),
|
|
565
|
+
const ruleBases = {
|
|
566
|
+
...(pathAdjudication.taskRoot !== undefined ? { taskRoot: pathAdjudication.taskRoot } : {}),
|
|
567
|
+
...(pathAdjudication.taskHome !== undefined ? { taskHome: pathAdjudication.taskHome } : {}),
|
|
563
568
|
};
|
|
564
|
-
const fsWriteGate = hostSemanticsLane
|
|
565
|
-
? {
|
|
566
|
-
env: pathAdjudication.env,
|
|
567
|
-
...(pathAdjudication.cwd !== undefined ? { cwd: pathAdjudication.cwd } : {}),
|
|
568
|
-
...(pathAdjudication.taskRoot !== undefined ? { taskRoot: pathAdjudication.taskRoot } : {}),
|
|
569
|
-
...(pathAdjudication.taskHome !== undefined ? { taskHome: pathAdjudication.taskHome } : {}),
|
|
570
|
-
...(scratchpadDir ? { scratchpadDir } : {}),
|
|
571
|
-
...gateCommon,
|
|
572
|
-
}
|
|
573
|
-
:
|
|
574
|
-
(() => {
|
|
575
|
-
const sandboxScratchpadDir = isRemoteScratchpadLane(config.remoteExec?.provider) ? remoteScratchpadDirFor(auth?.sessionId) : undefined;
|
|
576
|
-
return {
|
|
577
|
-
env: pathAdjudication.env,
|
|
578
|
-
...(pathAdjudication.taskHome !== undefined ? { taskHome: pathAdjudication.taskHome } : {}),
|
|
579
|
-
...gateCommon,
|
|
580
|
-
...(sandboxScratchpadDir ? { scratchpadDir: sandboxScratchpadDir } : {}),
|
|
581
|
-
...(gateCommon.isExempt
|
|
582
|
-
? {
|
|
583
|
-
isExempt: (toolName, canonicalPath) => canonicalPath.startsWith("/") ? gateCommon.isExempt(toolName) : false,
|
|
584
|
-
}
|
|
585
|
-
: {}),
|
|
586
|
-
};
|
|
587
|
-
})();
|
|
588
|
-
const workflowGate = approvalExemptionStore && auth?.sessionId
|
|
589
|
-
? {
|
|
590
|
-
isExempt: async (toolName) => {
|
|
591
|
-
const hit = await approvalExemptionStore.has(auth.sessionId, toolName);
|
|
592
|
-
if (hit)
|
|
593
|
-
logger.info("workflow_gate_exempted", { toolName, sessionId: auth.sessionId });
|
|
594
|
-
return hit;
|
|
595
|
-
},
|
|
596
|
-
}
|
|
597
|
-
: undefined;
|
|
598
569
|
try {
|
|
599
|
-
governed = applyTaskSettings(governedBase, effectiveSettings,
|
|
570
|
+
governed = applyTaskSettings(governedBase, effectiveSettings, ruleBases);
|
|
600
571
|
}
|
|
601
572
|
catch (e) {
|
|
602
|
-
if (e
|
|
603
|
-
throw new HttpError(
|
|
604
|
-
code: "request.field_conflict",
|
|
605
|
-
...(e.detail !== undefined ? { extra: { writeExemptDirCoversRoot: e.detail } } : {}),
|
|
606
|
-
});
|
|
607
|
-
}
|
|
573
|
+
if (e instanceof SettingsRuleRefusalError)
|
|
574
|
+
throw new HttpError(422, `${REQUEST_SETTINGS_REFUSAL_PREFIX}${e.message}`, { code: SETTINGS_RULE_REFUSAL_CODE, extra: { ...entryProblemsFacts(e.problems) } });
|
|
608
575
|
throw new HttpError(422, `${REQUEST_SETTINGS_REFUSAL_PREFIX}${e.message}`);
|
|
609
576
|
}
|
|
610
577
|
}
|
|
578
|
+
if (governed.selfOrchestration === true) {
|
|
579
|
+
governed = tightenGoverned(governed, {
|
|
580
|
+
toolPolicy: createWorkflowAskPolicy(approvalExemptionStore && auth?.sessionId
|
|
581
|
+
? async (toolName) => {
|
|
582
|
+
const hit = await approvalExemptionStore.has(auth.sessionId, toolName);
|
|
583
|
+
if (hit)
|
|
584
|
+
logger.info("workflow_gate_exempted", { toolName, sessionId: auth.sessionId });
|
|
585
|
+
return hit;
|
|
586
|
+
}
|
|
587
|
+
: undefined),
|
|
588
|
+
});
|
|
589
|
+
}
|
|
611
590
|
return { governed, scratchpadDir, hostSemanticsLane };
|
|
612
591
|
};
|
|
613
592
|
const applyImageFactsAndRouting = async (body, auth, governed, folded) => {
|
|
@@ -631,7 +610,7 @@ export function createResolveSpec(ctx) {
|
|
|
631
610
|
const resolved = await resolveSandboxImageRef({
|
|
632
611
|
profile: taskImageProfile,
|
|
633
612
|
...(capsNeeded && capsNeeded.length > 0 ? { capabilitiesNeeded: capsNeeded } : {}),
|
|
634
|
-
viewer: { operator: explicitOperatorOk(auth.principal, config
|
|
613
|
+
viewer: { operator: explicitOperatorOk(auth.principal, config), tenantId: auth.principal ?? null },
|
|
635
614
|
index: imageIndex,
|
|
636
615
|
});
|
|
637
616
|
if (!resolved.ok)
|
|
@@ -662,7 +641,7 @@ export function createResolveSpec(ctx) {
|
|
|
662
641
|
const isolatedExecEnv = isIsolatedExecEnv(config.remoteExec?.provider, config.remoteExec?.provider === "k8s" ? config.remoteExec.runtimeClass : undefined);
|
|
663
642
|
const decision = routeServiceTask({
|
|
664
643
|
isolatedExecEnv,
|
|
665
|
-
hasExecutionEnv:
|
|
644
|
+
hasExecutionEnv: laneWiresExecutionEnv(executionLaneOf(config.remoteExec?.provider)),
|
|
666
645
|
...(config.autonomy ? { autonomy: config.autonomy } : {}),
|
|
667
646
|
});
|
|
668
647
|
logger.info("orchestration_routed", { mode: decision.mode, reason: decision.reason, sessionId: auth?.sessionId ?? null });
|
package/dist/boot/runner-deps.js
CHANGED
|
@@ -180,6 +180,7 @@ export function createRunnerDeps(ctx) {
|
|
|
180
180
|
logger,
|
|
181
181
|
})
|
|
182
182
|
: undefined,
|
|
183
|
+
principalInboxConsumer: config.principalInboxAssistant !== undefined ? { assistant: config.principalInboxAssistant } : undefined,
|
|
183
184
|
onTaskOutcome: outcomeSink
|
|
184
185
|
? (o) => {
|
|
185
186
|
metrics.inc("task_outcomes_total", { status: o.status, green: String(o.oracle?.green ?? "unknown") });
|
|
@@ -69,6 +69,7 @@ export interface SessionFacesCtx {
|
|
|
69
69
|
export declare function createSessionFaces(ctx: SessionFacesCtx): {
|
|
70
70
|
ownerAware: OwnerAwareSessionStore;
|
|
71
71
|
sessionAudit: ((sessionId: string, opts?: SessionAuditReadOpts) => Promise<{
|
|
72
|
+
agent?: import("../audit.js").SessionAgent | undefined;
|
|
72
73
|
owner: string | null;
|
|
73
74
|
sessionId: string;
|
|
74
75
|
createdAt: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildRewindHandles, buildSessionAudit, buildSessionAuditLocal, buildSessionAuditPg } from "../audit.js";
|
|
1
|
+
import { buildRewindHandles, buildSessionAudit, buildSessionAuditLocal, buildSessionAuditPg, sessionAgentOf } from "../audit.js";
|
|
2
2
|
import { makeDegenerateInstrument } from "../degenerate-instrument.js";
|
|
3
3
|
import { PlanCacheProbe } from "../plan-cache-probe.js";
|
|
4
4
|
import { purgeScratchpadDir } from "../env-facts.js";
|
|
@@ -25,7 +25,9 @@ export function createSessionFaces(ctx) {
|
|
|
25
25
|
: await buildSessionAuditLocal(auditLocalRoot, sessionId, handles);
|
|
26
26
|
if (!audit)
|
|
27
27
|
return undefined;
|
|
28
|
-
|
|
28
|
+
const [owner, placement] = await Promise.all([ownerAware.ownerOf?.(sessionId), opts !== undefined ? ownerAware.placementOf?.(sessionId) : undefined]);
|
|
29
|
+
const agent = sessionAgentOf(placement);
|
|
30
|
+
return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}) };
|
|
29
31
|
}
|
|
30
32
|
: undefined;
|
|
31
33
|
const sessionWatchRegistry = ownerAware.getHead && ownerAware.ownerOf
|
|
@@ -3,6 +3,7 @@ import { createWebAdminRuntime } from "./web-admin.js";
|
|
|
3
3
|
import { composeExecutionLane, FILE_SOURCED_LANES } from "./execution-lane.js";
|
|
4
4
|
import { serviceConfigSourceKind } from "../config-provider.js";
|
|
5
5
|
import { logConfigDirMigration, migrateLocalConfigDirectory } from "../config-d-migration.js";
|
|
6
|
+
import { assertLocalConfigDirTrusted } from "../config-dir-trust.js";
|
|
6
7
|
import { defaultModelRefusal, refusedNameMintedRefusal } from "../model-entry-refusal.js";
|
|
7
8
|
import { isRosterGateArmed } from "../config.js";
|
|
8
9
|
import { judgeServedModelRoute } from "../model-route-endpoint.js";
|
|
@@ -10,8 +11,10 @@ import { servedModelTableLeg } from "../model-select.js";
|
|
|
10
11
|
export async function runStage02(ctx) {
|
|
11
12
|
const { config, localRoot, logger, metrics } = ctx;
|
|
12
13
|
const configSource = serviceConfigSourceKind(config);
|
|
13
|
-
if (configSource === "local")
|
|
14
|
+
if (configSource === "local") {
|
|
15
|
+
await assertLocalConfigDirTrusted({ root: localRoot, declaredOwnerUid: config.configLocalOwnerUid });
|
|
14
16
|
logConfigDirMigration(logger, await migrateLocalConfigDirectory(localRoot));
|
|
17
|
+
}
|
|
15
18
|
await composeExecutionLane(config, { configSource, localRoot, logger, drivesFromFile: FILE_SOURCED_LANES });
|
|
16
19
|
const webAdmin = await createWebAdminRuntime({ config, logger, metrics, localRoot });
|
|
17
20
|
const servedLeg = servedModelTableLeg(config);
|
|
@@ -51,6 +51,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
51
51
|
workflowCompletionInbox: import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox | undefined;
|
|
52
52
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
53
53
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
54
|
+
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
54
55
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
55
56
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
56
57
|
workflowRecoverOpts: {
|
|
@@ -60,6 +61,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
|
|
|
60
61
|
};
|
|
61
62
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
62
63
|
workflowsCapable: boolean;
|
|
64
|
+
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
63
65
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
64
66
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
65
67
|
dropSessionScoped: (sid: string) => void;
|
|
@@ -7,6 +7,7 @@ import { withoutHands } from "../capabilities/hands-lane.js";
|
|
|
7
7
|
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
8
8
|
import { redactSecrets } from "../trace/redact.js";
|
|
9
9
|
import { hasServiceAuth } from "../http/server.js";
|
|
10
|
+
import { operatorRosterPresent } from "../http/principal-gate.js";
|
|
10
11
|
import { workflowModelAllowlistFor } from "../task-workflow.js";
|
|
11
12
|
import { createHookLlm, buildHookFailureText } from "../hooks/hook-llm.js";
|
|
12
13
|
import { assertRetentionLaneWirable } from "./retention-lane.js";
|
|
@@ -21,11 +22,12 @@ import { defaultEngineNoticeRouter } from "../trace/engine-notice-wire.js";
|
|
|
21
22
|
import { createOrgMemoryAdmissionWiring } from "./org-memory.js";
|
|
22
23
|
import { createGovernanceSeams } from "./governance-seams.js";
|
|
23
24
|
import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-authorizer.js";
|
|
25
|
+
import { mountOrgDeliveryGate } from "./org-delivery.js";
|
|
24
26
|
import { parkedAskRedeem, runStore } from "./late-binds.js";
|
|
25
27
|
import { withInternalRunEnvs } from "../internal-run-env.js";
|
|
26
28
|
export function runStage06(ctx) {
|
|
27
29
|
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;
|
|
28
|
-
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
|
|
30
|
+
const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, workflowParkDecisions, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
|
|
29
31
|
const parkCommitted = backend?.checkpoint && config.durableApproval ? createParkCommitWatch(backend.checkpoint(logger)) : undefined;
|
|
30
32
|
const checkpointStore = parkCommitted?.store;
|
|
31
33
|
const parkCommits = parkCommitted?.watch;
|
|
@@ -83,7 +85,7 @@ export function runStage06(ctx) {
|
|
|
83
85
|
: undefined;
|
|
84
86
|
for (const w of buildConsolidationValveAudit({
|
|
85
87
|
valve: consolidationValve,
|
|
86
|
-
|
|
88
|
+
operatorRosterPresent: operatorRosterPresent(config),
|
|
87
89
|
hasServiceAuth: hasServiceAuth(config),
|
|
88
90
|
allowUnauthedWrites: config.allowUnauthedWrites ?? false,
|
|
89
91
|
}).warnings) {
|
|
@@ -127,6 +129,7 @@ export function runStage06(ctx) {
|
|
|
127
129
|
sharedMemoryStores: sharedMemoryStore ? sharedMemoryStore : undefined,
|
|
128
130
|
getRunStore: () => runStore,
|
|
129
131
|
});
|
|
132
|
+
const orgDeliveryGate = mountOrgDeliveryGate({ runnerDeps, directory: orgMemoryAdmission.directory, mailboxStore, backend, logger });
|
|
130
133
|
const runner = new Runner(runnerDeps);
|
|
131
134
|
const handslessRunner = new Runner(withoutHands(runnerDeps));
|
|
132
135
|
const { hookModelFor, hookLlm } = createHookLlm({ config, getKeyResolver: () => webAdmin.getKeyResolver(), metrics });
|
|
@@ -210,6 +213,6 @@ export function runStage06(ctx) {
|
|
|
210
213
|
onError: runnerDeps.onError ? runnerDeps.onError : undefined,
|
|
211
214
|
};
|
|
212
215
|
const subRunner = new Runner(subRunnerDeps);
|
|
213
|
-
return { ...ctx, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, parkCommits, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekResolver, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subRunnerSessions, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable };
|
|
216
|
+
return { ...ctx, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, parkCommits, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekResolver, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subRunnerSessions, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowParkDecisions, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate };
|
|
214
217
|
}
|
|
215
218
|
//# sourceMappingURL=stage-06-runners.js.map
|
|
@@ -66,6 +66,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
66
66
|
workflowCompletionInbox: import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox | undefined;
|
|
67
67
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
68
68
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
69
|
+
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
69
70
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
70
71
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
71
72
|
workflowRecoverOpts: {
|
|
@@ -75,6 +76,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
|
|
|
75
76
|
};
|
|
76
77
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
77
78
|
workflowsCapable: boolean;
|
|
79
|
+
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
78
80
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
79
81
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
80
82
|
dropSessionScoped: (sid: string) => void;
|
|
@@ -7,13 +7,14 @@ import { ensureChildSessionDurableWithPromotion } from "../plugins/session-store
|
|
|
7
7
|
import { webSearchConfigFromEnv, createWebSearchBackend, shouldProbeWebSearchOnBoot } from "../plugins/web-search.js";
|
|
8
8
|
import { createAuthorizer } from "../security.js";
|
|
9
9
|
import { buildForceDurableGateInertNotice, buildNoResponderBootWarns, gateIntentUnserviceableReason, singleUserAutoAcceptBaselineApplies } from "../approval.js";
|
|
10
|
-
import { executionLaneOf } from "../execution-lane-caps.js";
|
|
10
|
+
import { executionLaneOf, laneWiresExecutionEnv } from "../execution-lane-caps.js";
|
|
11
11
|
import { loadDeploymentSkills } from "../capabilities/skills.js";
|
|
12
12
|
import { createRepoClient } from "../capabilities/repo-tools.js";
|
|
13
13
|
import { buildScenarios, builtinScenarioDetails, danglingScenarioRefusal } from "../capabilities/scenarios.js";
|
|
14
14
|
import { isBrandedDeployment } from "../capabilities/brand-identity.js";
|
|
15
15
|
import { RateLimiter } from "../observability/rate-limit.js";
|
|
16
16
|
import { explicitOperatorOk } from "../http/server.js";
|
|
17
|
+
import { buildOperatorUndeclaredNotice } from "../http/principal-gate.js";
|
|
17
18
|
import { selfOrchestrationDenial } from "../task-workflow.js";
|
|
18
19
|
import { centerEntitlementSourceWired } from "../runtime-caps-resolver.js";
|
|
19
20
|
import { reclaimOrphansAtBoot } from "../boot-reclaim.js";
|
|
@@ -56,6 +57,18 @@ export async function runStage07(ctx) {
|
|
|
56
57
|
throw new Error(gateRefusal);
|
|
57
58
|
await reclaimOrphansAtBoot(runStore, checkpointStore, logger);
|
|
58
59
|
await runBootCrashConvergence({ backend, runStore, liveAudit: approvalAskAudit, localDataRoot: config.localDataRoot, logger });
|
|
60
|
+
const adoption = await toolApproval?.adoptOpenAsks();
|
|
61
|
+
if (adoption !== undefined && (adoption.capped || adoption.cardUnreadable > 0)) {
|
|
62
|
+
logger.warn("approval_ask_adopted_partially", {
|
|
63
|
+
adopted: adoption.adopted,
|
|
64
|
+
cardUnreadable: adoption.cardUnreadable,
|
|
65
|
+
capped: adoption.capped,
|
|
66
|
+
note: "some approval asks still pending in the ask ledger were not taken into this replica's live list: unreadable card envelopes are skipped, and only the oldest pending rows up to the adoption cap are taken. The skipped asks stay answerable through POST /v1/tasks/:taskId/asks/:askId/decision and are expired by the reconciler on their own window.",
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else if (adoption !== undefined && adoption.adopted > 0) {
|
|
70
|
+
logger.info("approval_ask_adopted", { adopted: adoption.adopted, alreadyLive: adoption.alreadyLive });
|
|
71
|
+
}
|
|
59
72
|
const userInputLedgerStore = backend && runStore ? backend.userInputLedger() : undefined;
|
|
60
73
|
const userInputLedger = backend && runStore && userInputLedgerStore
|
|
61
74
|
? await (async () => {
|
|
@@ -75,7 +88,7 @@ export async function runStage07(ctx) {
|
|
|
75
88
|
? selectEnvironmentTool({
|
|
76
89
|
catalog: imageIndex,
|
|
77
90
|
selection: sessionEnvSelection,
|
|
78
|
-
viewerFor: (principal) => ({ operator: explicitOperatorOk(principal, config
|
|
91
|
+
viewerFor: (principal) => ({ operator: explicitOperatorOk(principal, config), tenantId: principal ?? null }),
|
|
79
92
|
})
|
|
80
93
|
: undefined;
|
|
81
94
|
const imageBakes = backend?.imageBake && config.imageBakes.enabled ? backend.imageBake() : undefined;
|
|
@@ -83,6 +96,11 @@ export async function runStage07(ctx) {
|
|
|
83
96
|
logger.info("image_bakes_enabled", { operators: config.operatorPrincipals.length, runner: config.imageBakes.runnerPrincipal });
|
|
84
97
|
if (durableEnabled)
|
|
85
98
|
logger.info("durable_approval_enabled", { toolApprovalGate: config.approvalRequire.length });
|
|
99
|
+
{
|
|
100
|
+
const undeclared = buildOperatorUndeclaredNotice(config, durableEnabled);
|
|
101
|
+
if (undeclared)
|
|
102
|
+
logger.warn(undeclared.event, undeclared.fields);
|
|
103
|
+
}
|
|
86
104
|
if (config.a2aServe) {
|
|
87
105
|
const peer = facts.a2aServe({ config, runStore });
|
|
88
106
|
if (peer.available) {
|
|
@@ -151,10 +169,13 @@ export async function runStage07(ctx) {
|
|
|
151
169
|
})
|
|
152
170
|
.catch((e) => logger.warn("web_search_probe_failed", { provider: webSearchCfg.provider, error: e instanceof Error ? e.message : String(e) }));
|
|
153
171
|
}
|
|
154
|
-
const ensureChildSessionDurable = checkpointStore && config.sessionBackend === "tidb"
|
|
172
|
+
const ensureChildSessionDurable = checkpointStore && config.sessionBackend === "tidb"
|
|
173
|
+
? (sessionId, root) => ensureChildSessionDurableWithPromotion(sessionStore, subRunnerSessions, sessionId, root, logger)
|
|
174
|
+
: undefined;
|
|
155
175
|
const webFetchSummarize = createWebFetchSummarizeLane({ brain, config, getKeyResolver: () => webAdmin.getKeyResolver(), logger });
|
|
156
176
|
const scenarioDeps = {
|
|
157
177
|
runner, subRunner, model: DEFAULT_MODEL_REF, skills, repoClient, requirePrincipal: config.requirePrincipal,
|
|
178
|
+
handsLane: laneWiresExecutionEnv(executionLaneOf(config.remoteExec?.provider)),
|
|
158
179
|
webSearch: webSearch ? webSearch : undefined, logger, webFetchSummarize,
|
|
159
180
|
backgroundAgentStore: backgroundAgentStore ? backgroundAgentStore : undefined,
|
|
160
181
|
checkpointStore: checkpointStore ? checkpointStore : undefined,
|
|
@@ -79,6 +79,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
79
79
|
workflowCompletionInbox: import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox | undefined;
|
|
80
80
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
81
81
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
82
|
+
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
82
83
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
83
84
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
84
85
|
workflowRecoverOpts: {
|
|
@@ -88,6 +89,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
|
|
|
88
89
|
};
|
|
89
90
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
90
91
|
workflowsCapable: boolean;
|
|
92
|
+
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
91
93
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
92
94
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
93
95
|
dropSessionScoped: (sid: string) => void;
|
|
@@ -5,12 +5,12 @@ import { startRetentionLane, RETENTION_LEASE_TTL_FACTOR } from "./retention-lane
|
|
|
5
5
|
import { createLimitSync } from "./limit-sync.js";
|
|
6
6
|
import { runDenySweep } from "./late-binds.js";
|
|
7
7
|
export function runStage08(ctx) {
|
|
8
|
-
const { approvalNonceStore, backend, backgroundAgentStore, ceilingVerdict, checkpointStore, parkCommits, config, webAdmin, consolidationSeatWatch, costQuota, degradeRouteWatch, fileHistoryErasure, spaceReclaimer, handslessRunner, hookAgentRunner, imageBakes, instanceId, localRoot, logger, mailboxStore, metrics, permissionRuleStores, pricing, rateLimiter, retentionExecutor, retentionLaneStore, rosterStore, runStore, runner, sqlWorkflowRunStore, subRunner, taskAttachmentStore, toolApproval, toolResultStore, userInputLedger, workflowJournalStore, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, worktreeReap } = ctx;
|
|
8
|
+
const { approvalAskAudit, approvalNonceStore, backend, backgroundAgentStore, ceilingVerdict, checkpointStore, parkCommits, config, webAdmin, consolidationSeatWatch, costQuota, degradeRouteWatch, fileHistoryErasure, spaceReclaimer, handslessRunner, hookAgentRunner, imageBakes, instanceId, localRoot, logger, mailboxStore, metrics, permissionRuleStores, pricing, rateLimiter, retentionExecutor, retentionLaneStore, rosterStore, runStore, runner, sqlWorkflowRunStore, subRunner, taskAttachmentStore, toolApproval, toolResultStore, userInputLedger, workflowJournalStore, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, worktreeReap } = ctx;
|
|
9
9
|
const reaper = startReapers({
|
|
10
10
|
config, logger, metrics, localRoot, backend, subRunner, runStore, checkpointStore, parkCommits,
|
|
11
11
|
rateLimiter, costQuota, toolResultStore, fileHistoryErasure, taskAttachmentStore, imageBakes, worktreeReap,
|
|
12
12
|
workflowNotifyGate, workflowRecoverOpts, workflowJournalStore, sqlWorkflowRunStore, workflowNotifyJournal, rosterStore,
|
|
13
|
-
backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, userInputLedger,
|
|
13
|
+
backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, userInputLedger, approvalAskAudit,
|
|
14
14
|
getRunDenySweep: () => runDenySweep,
|
|
15
15
|
});
|
|
16
16
|
const ttlMs = config.retentionSweep.intervalSec * 1000 * RETENTION_LEASE_TTL_FACTOR;
|
|
@@ -18,6 +18,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
18
18
|
}>) | undefined;
|
|
19
19
|
webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
|
|
20
20
|
sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
|
|
21
|
+
agent?: import("../audit.js").SessionAgent | undefined;
|
|
21
22
|
owner: string | null;
|
|
22
23
|
sessionId: string;
|
|
23
24
|
createdAt: string;
|
|
@@ -102,6 +103,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
102
103
|
workflowCompletionInbox: import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox | undefined;
|
|
103
104
|
workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
|
|
104
105
|
workflowModelAllowlistSnapshot: readonly string[];
|
|
106
|
+
workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
|
|
105
107
|
workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
|
|
106
108
|
workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
|
|
107
109
|
workflowRecoverOpts: {
|
|
@@ -111,6 +113,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
|
|
|
111
113
|
};
|
|
112
114
|
workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
|
|
113
115
|
workflowsCapable: boolean;
|
|
116
|
+
orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
|
|
114
117
|
deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
|
|
115
118
|
deviceLane: import("./device-lane.js").DeviceLane | undefined;
|
|
116
119
|
dropSessionScoped: (sid: string) => void;
|