@sema-agent/server 7.134.0 → 7.135.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 +134 -0
- package/USAGE.md +98 -30
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +24 -24
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +62 -150
- package/dist/approval-card.js +33 -51
- package/dist/approval-content-kind.d.ts +22 -5
- package/dist/approval-content-kind.js +8 -1
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +22 -3
- package/dist/approval-gate-currency.js +44 -18
- package/dist/approval-hmac.d.ts +7 -7
- package/dist/approval-policy-settlement.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +3 -3
- package/dist/approval.d.ts +8 -8
- package/dist/approval.js +4 -2
- package/dist/auth-bridge.d.ts +1 -1
- package/dist/auto-mode-face.d.ts +4 -4
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +2 -2
- package/dist/bake-runner/runner.d.ts +4 -4
- package/dist/bench/s1/live-deps.d.ts +1 -1
- package/dist/bench/s1/run-firm.d.ts +1 -1
- package/dist/boot/coordinators.d.ts +2 -2
- package/dist/boot/coordinators.js +2 -2
- package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
- package/dist/boot/deferred-sandbox-path-env.js +0 -5
- package/dist/boot/engine-lease.d.ts +5 -5
- package/dist/boot/execution-env.d.ts +16 -15
- package/dist/boot/execution-env.js +19 -21
- package/dist/boot/fatal-exit.d.ts +2 -2
- package/dist/boot/late-binds.d.ts +1 -1
- package/dist/boot/leader.d.ts +1 -1
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +15 -15
- package/dist/boot/parked-revive-gate.d.ts +3 -3
- package/dist/boot/parked-revive-gate.js +3 -2
- package/dist/boot/reapers.d.ts +4 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +28 -24
- package/dist/boot/runner-deps.d.ts +11 -11
- package/dist/boot/runner-deps.js +3 -2
- package/dist/boot/session-faces.d.ts +3 -3
- package/dist/boot/session-faces.js +11 -30
- package/dist/boot/shutdown.d.ts +5 -5
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.js +0 -2
- package/dist/boot/stores.js +2 -1
- package/dist/boot/web-admin.d.ts +17 -17
- package/dist/boot/web-admin.js +5 -10
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/budget.d.ts +4 -4
- package/dist/capabilities/approvals-push.d.ts +4 -4
- package/dist/capabilities/builtin-tools.d.ts +5 -5
- package/dist/capabilities/center-plugins.d.ts +5 -5
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +1 -1
- package/dist/capabilities/center-wiring.d.ts +1 -1
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/execution-lane.d.ts +5 -5
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +5 -5
- package/dist/capabilities/mcp-probe.d.ts +10 -7
- package/dist/capabilities/sandbox-file-send.d.ts +1 -18
- package/dist/capabilities/sandbox-file-send.js +0 -7
- package/dist/capabilities/scenarios.d.ts +28 -10
- package/dist/capabilities/scenarios.js +15 -5
- package/dist/capabilities/send-user-file-tool.d.ts +1 -1
- package/dist/capabilities/skills.d.ts +31 -12
- package/dist/capabilities/skills.js +23 -17
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +26 -25
- package/dist/capability-facts.js +14 -16
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +4 -4
- package/dist/checkpoint-identity.d.ts +5 -0
- package/dist/checkpoint-identity.js +14 -0
- package/dist/config-catalog.d.ts +12 -12
- package/dist/config-invariants.d.ts +4 -4
- package/dist/config-invariants.js +3 -2
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +83 -83
- package/dist/config.d.ts +26 -24
- package/dist/config.js +12 -10
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/delegated-session-owner.d.ts +16 -13
- package/dist/delegated-session-owner.js +9 -10
- package/dist/deployment-governance.d.ts +16 -16
- package/dist/deployment-shape.d.ts +127 -0
- package/dist/deployment-shape.js +72 -0
- package/dist/device-store.d.ts +1 -1
- package/dist/device-ws-hub.d.ts +1 -1
- package/dist/egress-redirect.d.ts +1 -1
- package/dist/entry-mode-clamp-notice.d.ts +2 -2
- package/dist/env-facts.d.ts +10 -9
- package/dist/env-facts.js +1 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -5
- package/dist/exec-bounds.d.ts +2 -2
- package/dist/execution-lane-caps.d.ts +31 -43
- package/dist/execution-lane-caps.js +0 -13
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +23 -11
- package/dist/file-history-disclosure.js +7 -12
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +22 -14
- package/dist/fleet/fleet-bus.js +5 -5
- package/dist/fleet/fleet-reconciler.d.ts +9 -9
- package/dist/fleet/subagent-tail-bus.d.ts +4 -4
- package/dist/fleet-client.d.ts +13 -13
- package/dist/fleet-lease.d.ts +16 -16
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-runner.d.ts +57 -30
- package/dist/hooks/hook-runner.js +36 -18
- package/dist/host-decision.d.ts +5 -5
- package/dist/host-lsp-manager.d.ts +5 -5
- package/dist/hosted-posture.d.ts +23 -13
- package/dist/hosted-posture.js +4 -9
- package/dist/http/admission.d.ts +2 -2
- package/dist/http/admission.js +20 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +2 -1
- package/dist/http/checkpoint-ctx.d.ts +39 -13
- package/dist/http/checkpoint-ctx.js +74 -35
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/durable-run-leg.js +4 -3
- package/dist/http/idempotency.d.ts +2 -2
- package/dist/http/mcp-dial-deadline.d.ts +7 -5
- package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
- package/dist/http/owner-access.d.ts +4 -6
- package/dist/http/owner-access.js +1 -1
- package/dist/http/principal-gate.d.ts +7 -7
- package/dist/http/principal-gate.js +3 -2
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/request-guards.d.ts +4 -4
- package/dist/http/request-guards.js +2 -1
- package/dist/http/resume-ctx-read.d.ts +7 -7
- package/dist/http/resume-ctx-read.js +1 -1
- package/dist/http/resume-legs.d.ts +3 -3
- package/dist/http/resume-legs.js +11 -8
- package/dist/http/route-ctx.d.ts +29 -29
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +5 -5
- package/dist/http/routes/approvals-assistant.js +55 -15
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +2 -2
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +16 -8
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/devices.d.ts +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +2 -1
- package/dist/http/routes/mcp-reconnect.d.ts +4 -4
- package/dist/http/routes/mcp-reconnect.js +3 -3
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -2
- package/dist/http/routes/rules.d.ts +1 -1
- package/dist/http/routes/runs.js +22 -10
- package/dist/http/routes/session-sync.d.ts +1 -1
- package/dist/http/routes/session-sync.js +73 -44
- package/dist/http/routes/sessions-list.js +1 -1
- package/dist/http/routes/sessions.js +30 -44
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/workflows.d.ts +3 -0
- package/dist/http/routes/workflows.js +31 -28
- package/dist/http/send.d.ts +5 -5
- package/dist/http/server.d.ts +34 -34
- package/dist/http/session-inherit-env.d.ts +3 -3
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +2 -2
- package/dist/http/submit-ctx.js +1 -1
- package/dist/http/sync-submit-body.d.ts +1 -1
- package/dist/http/verify-rounds.d.ts +1 -1
- package/dist/http/wire-types.d.ts +28 -21
- package/dist/instruction-source-notice.d.ts +2 -2
- package/dist/key-resolver.d.ts +3 -3
- package/dist/lane-home-probe.d.ts +1 -1
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/leader/diffup.d.ts +2 -2
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +1 -1
- package/dist/leader/leader.d.ts +4 -4
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/repair-wire.d.ts +1 -1
- package/dist/leader/wire.d.ts +6 -6
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +1 -1
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/memory-layer-legacy-lock.d.ts +1 -1
- package/dist/memory-operator-faces.d.ts +1 -1
- package/dist/memory-posture.js +4 -2
- package/dist/memory-project-layer.d.ts +1 -1
- package/dist/memory-scope.d.ts +19 -19
- package/dist/memory-store-refusal.d.ts +4 -4
- package/dist/model-entry-headers.d.ts +2 -2
- package/dist/model-entry-refusal.d.ts +17 -17
- package/dist/model-provider.d.ts +10 -10
- package/dist/model-reach-scope.d.ts +1 -1
- package/dist/model-route-endpoint.d.ts +6 -6
- package/dist/model-route-url.d.ts +5 -5
- package/dist/model-select.d.ts +15 -6
- package/dist/model-select.js +5 -0
- package/dist/model-unreachable-notice.d.ts +3 -3
- package/dist/namespaced-rule-name.d.ts +15 -5
- package/dist/namespaced-rule-name.js +3 -2
- package/dist/observability/corrupt-read-seat.d.ts +9 -9
- package/dist/observability/cost-taxonomy.d.ts +1 -1
- package/dist/observability/err-text.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/run-terminal.d.ts +36 -36
- package/dist/observability/secret-env-scrub.d.ts +3 -3
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/operator-ask.d.ts +4 -4
- package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
- package/dist/orchestration/workflow-completion-inbox.js +29 -7
- package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
- package/dist/orchestration/workflow-notify-journal.js +17 -0
- package/dist/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +16 -15
- package/dist/parked-decide.js +5 -4
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +3 -3
- package/dist/peer-directory.js +1 -1
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +2 -2
- package/dist/plugins/adoption-log-sql.d.ts +1 -1
- package/dist/plugins/approval-ask-store-file.d.ts +8 -1
- package/dist/plugins/approval-ask-store-file.js +6 -3
- package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
- package/dist/plugins/approval-ask-store-memory.js +11 -7
- package/dist/plugins/approval-ask-store-sql.d.ts +34 -15
- package/dist/plugins/approval-ask-store-sql.js +18 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/background-agent-store-sql.d.ts +1 -1
- package/dist/plugins/background-shell-support.d.ts +2 -2
- package/dist/plugins/blob-backend.d.ts +1 -1
- package/dist/plugins/caching-session-store.d.ts +23 -32
- package/dist/plugins/caching-session-store.js +5 -17
- package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
- package/dist/plugins/checkpoint-index-columns.js +62 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +44 -66
- package/dist/plugins/checkpoint-store-sql.js +55 -102
- package/dist/plugins/device-store-sql.d.ts +7 -6
- package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
- package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
- package/dist/plugins/file-history-store-sql.d.ts +9 -7
- package/dist/plugins/file-history-store-sql.js +27 -15
- package/dist/plugins/file-run-store.d.ts +8 -8
- package/dist/plugins/fork-routing-session-store.d.ts +2 -2
- package/dist/plugins/fork-routing-session-store.js +1 -1
- package/dist/plugins/host-platform.d.ts +10 -10
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +10 -10
- package/dist/plugins/local-checkpoint-store.js +3 -4
- package/dist/plugins/local-session-store.d.ts +34 -38
- package/dist/plugins/local-session-store.js +20 -39
- package/dist/plugins/local-session-window.d.ts +1 -1
- package/dist/plugins/mailbox-store-sql.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-run-store.d.ts +4 -4
- package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +66 -40
- package/dist/plugins/one-time-migrations.js +115 -34
- package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
- package/dist/plugins/park-commit-watch.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +5 -5
- package/dist/plugins/permission-rule-store-file.js +12 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +67 -24
- package/dist/plugins/pg-cost-quota.d.ts +1 -1
- package/dist/plugins/pg-pool.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -2
- package/dist/plugins/pg-rate-limiter.d.ts +1 -1
- package/dist/plugins/pg-session-storage.d.ts +8 -20
- package/dist/plugins/pg-session-storage.js +14 -27
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +10 -9
- package/dist/plugins/remote-env-device.js +6 -2
- package/dist/plugins/remote-env-e2b.d.ts +3 -3
- package/dist/plugins/remote-env-host.d.ts +16 -16
- package/dist/plugins/remote-env-k8s.d.ts +8 -8
- package/dist/plugins/remote-env-local-docker.d.ts +2 -2
- package/dist/plugins/remote-env-ssh.d.ts +4 -4
- package/dist/plugins/remote-scratchpad.d.ts +2 -3
- package/dist/plugins/remote-scratchpad.js +0 -4
- package/dist/plugins/remote-shell.d.ts +6 -6
- package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
- package/dist/plugins/retention-store-sql.d.ts +4 -4
- package/dist/plugins/roster-store-sql.d.ts +1 -1
- package/dist/plugins/run-store-sql.d.ts +8 -8
- package/dist/plugins/schema-consistency.d.ts +2 -2
- package/dist/plugins/schema-ensure-legs.d.ts +3 -3
- package/dist/plugins/schema-indexes.d.ts +1 -1
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-event-payload.d.ts +4 -4
- package/dist/plugins/session-fork.d.ts +34 -0
- package/dist/plugins/session-fork.js +29 -0
- package/dist/plugins/session-ownership.js +1 -1
- package/dist/plugins/session-placement.d.ts +1 -1
- package/dist/plugins/session-policy-store-sql.d.ts +12 -12
- package/dist/plugins/session-store.d.ts +2 -2
- package/dist/plugins/session-store.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
- package/dist/plugins/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +1 -1
- package/dist/plugins/sql-json-column.d.ts +21 -21
- package/dist/plugins/sql-row-helpers.d.ts +2 -2
- package/dist/plugins/store-backend.d.ts +17 -16
- package/dist/plugins/store-backend.js +3 -3
- package/dist/plugins/store-contracts.d.ts +21 -21
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/tidb-pool.d.ts +2 -2
- package/dist/plugins/tidb-pool.js +9 -2
- package/dist/plugins/tidb-session-store.d.ts +16 -26
- package/dist/plugins/tidb-session-store.js +15 -27
- package/dist/plugins/tool-result-store-sql.d.ts +1 -1
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/user-input-ledger-file.d.ts +1 -1
- package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +19 -5
- package/dist/plugins/web-search.js +19 -4
- package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
- package/dist/plugins/workflow-journal-payload.js +32 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
- package/dist/plugins/workflow-journal-store-sql.js +34 -15
- package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
- package/dist/posture-source.d.ts +11 -11
- package/dist/principal-jwt.d.ts +6 -6
- package/dist/project-identity.d.ts +3 -3
- package/dist/project-memory.d.ts +4 -4
- package/dist/read-face-posture.d.ts +7 -7
- package/dist/request-key-closure.d.ts +1 -1
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +15 -8
- package/dist/request-value-closure.js +2 -0
- package/dist/router/route-orchestration.d.ts +11 -16
- package/dist/router/route-orchestration.js +2 -12
- package/dist/rule-entry-list.d.ts +8 -7
- package/dist/rule-entry-list.js +2 -9
- package/dist/rules-consent.d.ts +6 -6
- package/dist/rules-consent.js +2 -0
- package/dist/run-cancel-context.d.ts +5 -5
- package/dist/run-local.d.ts +10 -10
- package/dist/runs.d.ts +13 -11
- package/dist/runs.js +15 -1
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +9 -31
- package/dist/sandbox-pkg-source.js +14 -8
- package/dist/sealed-key.d.ts +3 -3
- package/dist/security.d.ts +23 -26
- package/dist/security.js +12 -9
- package/dist/server-secret-env.d.ts +10 -10
- package/dist/session-children-retire.d.ts +1 -1
- package/dist/session-error-wire.d.ts +7 -7
- package/dist/session-incarnation.d.ts +52 -35
- package/dist/session-incarnation.js +23 -8
- package/dist/session-policy-wire.d.ts +27 -5
- package/dist/session-policy-wire.js +15 -1
- package/dist/session-records-skipped-notice.d.ts +1 -1
- package/dist/session-sync-kernel.d.ts +4 -4
- package/dist/session-sync.d.ts +49 -6
- package/dist/session-sync.js +52 -10
- package/dist/session-titler.d.ts +7 -6
- package/dist/session-titler.js +8 -13
- package/dist/session-watch.d.ts +3 -3
- package/dist/session-watch.js +4 -4
- package/dist/sighup-idle.d.ts +2 -2
- package/dist/spec-fields.d.ts +4 -4
- package/dist/sql-engine-posture.d.ts +3 -3
- package/dist/store-posture.d.ts +2 -2
- package/dist/stored-request-tool-axes-m19.d.ts +1 -1
- package/dist/task-a2a.d.ts +3 -1
- package/dist/task-a2a.js +34 -2
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +12 -8
- package/dist/task-mcp.js +19 -4
- package/dist/task-settings.d.ts +30 -18
- package/dist/task-settings.js +33 -3
- package/dist/task-workflow.d.ts +0 -24
- package/dist/task-workflow.js +2 -1
- package/dist/terminal.d.ts +5 -5
- package/dist/tighten-only-seats.d.ts +7 -6
- package/dist/tighten-only-seats.js +1 -1
- package/dist/tool-approval.d.ts +143 -197
- package/dist/tool-approval.js +13 -28
- package/dist/tool-rule-names.d.ts +2 -2
- package/dist/trace/core-keyset-guard.d.ts +12 -7
- package/dist/trace/engine-notice-wire.d.ts +5 -5
- package/dist/trace/engine-notice-wire.js +1 -0
- package/dist/trace/exit-seat.d.ts +31 -4
- package/dist/trace/exit-seat.js +41 -63
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +47 -45
- package/dist/trace/project.js +33 -1
- package/dist/trace/redact.d.ts +44 -30
- package/dist/trace/redact.js +191 -89
- package/dist/trace/self-minted-wire.d.ts +35 -14
- package/dist/trace/self-minted-wire.js +8 -0
- package/dist/trace/sema-provenance.d.ts +1 -1
- package/dist/trace/task-notification-facets.d.ts +4 -4
- package/dist/trace/wire-projection-faces.d.ts +3 -3
- package/dist/trace/wire-projection-faces.js +1 -1
- package/dist/unattended-permission-mode.d.ts +5 -5
- package/dist/url-credential.d.ts +52 -0
- package/dist/url-credential.js +49 -0
- package/dist/url-refusal.d.ts +6 -2
- package/dist/url-refusal.js +8 -1
- package/dist/usage-analytics.d.ts +2 -2
- package/dist/user-input-ledger.d.ts +23 -23
- package/dist/web-admin-client/apply-effective.d.ts +5 -5
- package/dist/web-admin-client/apply-effective.js +2 -1
- package/dist/web-admin-client/apply-ledger.d.ts +2 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/facade.d.ts +5 -5
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
- package/dist/web-admin-client/http-client.d.ts +4 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/pull-state.d.ts +1 -1
- package/dist/web-admin-client/read-face.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +5 -5
- package/dist/web-admin-client/restart-signal.d.ts +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +28 -3
- package/dist/web-admin-client/skills-mcp.js +29 -1
- package/dist/web-admin-client/types.d.ts +16 -9
- package/dist/workspace-space.d.ts +5 -3
- package/dist/write-protection.d.ts +2 -2
- package/package.json +4 -3
- package/scripts/drain-check-local.mjs +2 -1
- package/scripts/drain-check.mysql.sql +4 -2
- package/scripts/drain-check.pg.sql +4 -2
- package/skills/loop.md +1 -1
- package/dist/http/run-declared-families.d.ts +0 -16
- package/dist/http/run-declared-families.js +0 -12
- package/dist/orchestration/workflow-journal-entry.js +0 -27
|
@@ -4,7 +4,7 @@ export interface RunTerminalRecord {
|
|
|
4
4
|
/** 这条 run 的账本 id = `GET /v1/runs/:id` 的 id(本仓 run 行主键名为 taskId,同一个值)。 */
|
|
5
5
|
runId: string;
|
|
6
6
|
/**
|
|
7
|
-
* 🔴 **只在「这条终局要出声」时在场**(
|
|
7
|
+
* 🔴 **只在「这条终局要出声」时在场**([ref]):三只 store 只在 `runTerminalLogLevel(...) !== undefined`
|
|
8
8
|
* 时才多付那一次 PK 读去装它(成功终局零额外查询 —— 那条注在 `run-store-sql.ts` 的 `setTerminal` 里)。
|
|
9
9
|
* 日志腿恰好只在同一形下运行,所以**它读到的恒是在场的**;行为订阅者不得依赖它。
|
|
10
10
|
*/
|
|
@@ -24,7 +24,7 @@ export interface RunTerminalRecord {
|
|
|
24
24
|
/** **日志腿**收到的是**已判级 + 已脱敏 + 已截断**的成品——装配层只负责把它送进 logger。 */
|
|
25
25
|
export type RunTerminalLogObserver = (level: "error" | "info", fields: Record<string, unknown>) => void;
|
|
26
26
|
/**
|
|
27
|
-
* **行为订阅者**(
|
|
27
|
+
* **行为订阅者**([ref]):CAS 赢的那一刻收到整只 {@link RunTerminalRecord}。
|
|
28
28
|
*
|
|
29
29
|
* 🔴 载荷是**这次写自己的视角**,不是回读的 durable 行 —— 只有 `runId` / `status` 两位在**任何**形下
|
|
30
30
|
* 都为真(CAS 赢 ⇒ 行就是这个词)。日志腿专用的那几位在成功终局上**刻意缺席**(store 不为它们多付一次
|
|
@@ -35,14 +35,14 @@ export type RunTerminalSubscriber = (rec: RunTerminalRecord) => void;
|
|
|
35
35
|
* 终局行的级别判据。`undefined` = 不打行。
|
|
36
36
|
*
|
|
37
37
|
* 一句话:**非成功终局才出声**(`failed` / `blocked`),用户主动取消降 `info`。词的分类不在本模块做 ——
|
|
38
|
-
* 它的唯一属主是 `plugins/store-contracts.ts` 的 `RUN_STATUS_CLASS` 表(
|
|
38
|
+
* 它的唯一属主是 `plugins/store-contracts.ts` 的 `RUN_STATUS_CLASS` 表([ref]③:本模块此前手抄了一张
|
|
39
39
|
* 穷举 switch,并在 `blocked` 那一格给出与 fleet 读面互斥的答案)。表的编译期双向钉在属主处。
|
|
40
40
|
*/
|
|
41
41
|
export declare function runTerminalLogLevel(status: RunRecord["status"], errorCode: string | undefined): "error" | "info" | undefined;
|
|
42
42
|
/** **日志腿**的装配点(`boot/stage-01-config.ts` 唯一)。传 `undefined` 卸载(测试隔离)。 */
|
|
43
43
|
export declare function setRunTerminalLogObserver(fn: RunTerminalLogObserver | undefined): void;
|
|
44
44
|
/**
|
|
45
|
-
* **行为订阅者**的登记口(
|
|
45
|
+
* **行为订阅者**的登记口([ref])。返回解除登记的句柄。
|
|
46
46
|
*
|
|
47
47
|
* 与 {@link setRunTerminalLogObserver} 是**两个语义不同的席**,不是一个带旗的列表:
|
|
48
48
|
* · 日志腿**恰一只**、装配层亲接、**不隔离**(抛出会让 `setTerminal` reject —— 见 {@link notifyRunTerminal});
|
|
@@ -65,7 +65,7 @@ export declare function resetRunTerminalSubscribersForTest(): void;
|
|
|
65
65
|
* 为什么日志腿**刻意不 try**(原文保留,[ref] 的成文理由):静默吞掉观测者异常 = 又造一条「走了兜底与
|
|
66
66
|
* 一切正常同形」的路,方向与本模块的存在理由相反;生产装配的那一只只调 `Logger`(`createLogger` 的 emit
|
|
67
67
|
* 内部已把 JSON.stringify 与 write 全部 try 住,结构上不抛)。
|
|
68
|
-
* 为什么行为订阅者**必须 try**(
|
|
68
|
+
* 为什么行为订阅者**必须 try**([ref] 新加的那一半):它们是**行为腿**,不是一只结构上不抛的 logger;
|
|
69
69
|
* 而本函数跑在 `setTerminal` 的调用栈上、**CAS 已经赢了、行已经落盘**,此时把订阅者的 bug 放大成
|
|
70
70
|
* 「终局写 reject」= run 卡 `running` 到 reaper + claim 悬挂([ref] 指纹)。吞但**不静默**:
|
|
71
71
|
* `recordFailOpen("server.fleet.terminal-notify")`(F 类,普查登记在案)。
|
|
@@ -75,17 +75,17 @@ export declare function resetRunTerminalSubscribersForTest(): void;
|
|
|
75
75
|
* 而引擎日志是运维面、常被整条采集走。`errorCode` / `model` 是闭集式短标量,verbatim。
|
|
76
76
|
*/
|
|
77
77
|
export declare function notifyRunTerminal(rec: RunTerminalRecord): void;
|
|
78
|
-
/**
|
|
78
|
+
/** [ref](test [ref] 旁生):终态**持久化**的 `errorMessage` 与日志副本同一脱敏口——provider 错误体(403 体带回显请求头/
|
|
79
79
|
* 订阅链接)里的密钥形不得原文落 run 行再由 `GET /v1/runs/:id` 直出。三 run store 的 `setTerminal` 写入前同调此函数;
|
|
80
80
|
* `undefined` 透传(缺席仍缺席),不截断(日志上限是日志的事,行上保留全文供取证)。 */
|
|
81
|
-
/** r4 最终轮 [medium]:`redactSecrets` 曾会抛 `RangeError`(关键字/前缀臂那一形由
|
|
82
|
-
* 转义对循环与 PEM 栅栏臂的标签交替循环由
|
|
81
|
+
/** r4 最终轮 [medium]:`redactSecrets` 曾会抛 `RangeError`(关键字/前缀臂那一形由 [ref] 的 `atLeast` 铸点闭掉;JSON 秘密字段臂的
|
|
82
|
+
* 转义对循环与 PEM 栅栏臂的标签交替循环由 [ref] 换成手写线性扫描器闭掉 —— 已知形全部闭掉);[ref] 把脱敏
|
|
83
83
|
* 挪到 `setTerminal` **入口**后,这个抛会先于 CAS/claim 释放 ⇒ run 卡 `running`、会话 claim 悬挂到 reaper。这里 **fail-closed
|
|
84
84
|
* 不抛**:脱敏失败 ⇒ 落固定占位 `«redacted:oversized»`(绝不落原文,也绝不阻断终态翻转),并走既有 fail-open 遥测 tag。
|
|
85
|
-
* 🔴
|
|
85
|
+
* 🔴 [ref] 之后这条 throw 臂**照留**(结构性兜底,不依赖「脱敏器今天抛不抛」):它守的是「终态翻转不被一次脱敏异常拦下」,
|
|
86
86
|
* 而脱敏器是一张会长新臂的表 —— 计数 `server.run-terminal.redact-threw` 恒零是证据,不归零就是新形,运维按 detail 回溯。 */
|
|
87
87
|
export declare const OVERSIZED_REDACTION_PLACEHOLDER = "\u00ABredacted:oversized\u00BB";
|
|
88
|
-
/**
|
|
88
|
+
/** [ref] 窄范围重扫 [medium]:`redactSecrets` 对 PEM 起始栅栏密集的多 MB 文案**不抛但慢**(实测 1MB 1.4s / 8MB 7.9s 同步阻塞
|
|
89
89
|
* 事件循环),而终态座每次写要扫两遍(appendEvent + setTerminal 入口)、每次读再扫一遍。超过本上限的自由文本**整段**换占位
|
|
90
90
|
* (fail-closed:不截断——截断会把密钥切成半截,[ref] 的病;不扫——O(1)),取证面丢的是「>256KB 的错误文案」这一档。 */
|
|
91
91
|
/** codex r2 [medium]:上限按**边界最坏耗时**定——PEM 栅栏密集形 256KB 一次扫 0.25–0.46s、终态一次写扫两遍再加读面,一行
|
|
@@ -97,13 +97,13 @@ export declare const REDACT_INPUT_CAP = 65536;
|
|
|
97
97
|
export declare const REDACT_OUTPUT_MAX_BYTES = 65000;
|
|
98
98
|
export declare function redactErrorMessage(raw: string | undefined): string | undefined;
|
|
99
99
|
/**
|
|
100
|
-
* 🔴 **模型自由文本的唯一装载口**(
|
|
100
|
+
* 🔴 **模型自由文本的唯一装载口**([ref] / [ref],7.75.1)——`TaskResult.result` / `TaskResult.salvagedOutput`
|
|
101
101
|
* 与账本的 `text` / `reasoning` 两行,四座同调本函数。
|
|
102
102
|
*
|
|
103
103
|
* 它**不是第二只脱敏器**:零自有规则表、零自有词表,判「什么算凭据」的仍然只有 {@link redactSecrets} 一只。
|
|
104
104
|
* 本函数只定两件**写回**的事,而这两件事在三条既有纪律面前各只有一个正确答案:
|
|
105
105
|
*
|
|
106
|
-
* ① **认出凭据形才改写字节;没认出就回原串** —— 这就是 `redactSecrets` 自己的语义,本函数不另立读法(
|
|
106
|
+
* ① **认出凭据形才改写字节;没认出就回原串** —— 这就是 `redactSecrets` 自己的语义,本函数不另立读法([ref] 起):
|
|
107
107
|
* 臂只在剥 `\p{Cf}` 后的视图上认凭据,产物按**原文**坐标拼 ⇒ 没有跨度的文本逐字节原样(`👨👩👧` 的 ZWJ、波斯语
|
|
108
108
|
* `میخواهم` 的 ZWNJ 都在),有跨度时只有跨度内的字节被盖 —— 夹在密钥中间的零宽字符随整段密钥一起换成记号,
|
|
109
109
|
* 消费端拿不到可拼回原钥的残片。此前 `redactSecrets` 的产物是剥后文本,本函数为此另比一次「输出 === 剥后原文 ⇒
|
|
@@ -114,7 +114,7 @@ export declare function redactErrorMessage(raw: string | undefined): string | un
|
|
|
114
114
|
* 裸调用会让异常穿过 `redactTerminalResult` → 三孪生 `setTerminal`,**一条跑成功的 run 落成 failed + result:null**
|
|
115
115
|
* (实测读数)。⇒ 与本文件既有的 {@link redactErrorMessage} / `redactDiagnosticText` / `redactArtifactText`
|
|
116
116
|
* 三座**同一条**处置:抛就换占位、计数、留痕([ref] 的 loud,不是静默 fail-open)。丢的是这一条病态文本,
|
|
117
|
-
* 不是这条 run。根因(那条正则)由
|
|
117
|
+
* 不是这条 run。根因(那条正则)由 [ref](7.105.0)换成手写线性扫描器闭掉(同批闭掉同类第二例 PEM 栅栏标签循环);
|
|
118
118
|
* 本处置**照留** —— 理由同 {@link OVERSIZED_REDACTION_PLACEHOLDER} 顶注末句。
|
|
119
119
|
* ③ **不设体量上限**(裁定):`result` 住在 `result` JSON/JSONB 列(亲核 `plugins/tidb-pool.ts` 与
|
|
120
120
|
* `plugins/pg-pool.ts` 的 DDL),数 MB 终稿是正常形 —— {@link redactErrorMessage} 的两道上限是为
|
|
@@ -122,40 +122,40 @@ export declare function redactErrorMessage(raw: string | undefined): string | un
|
|
|
122
122
|
*/
|
|
123
123
|
export declare function redactModelText(raw: string): string;
|
|
124
124
|
/**
|
|
125
|
-
* 🔴 **provider 回声字段的形状闸 —— 唯一铸点**(
|
|
125
|
+
* 🔴 **provider 回声字段的形状闸 —— 唯一铸点**([ref],7.105.0;test [ref] 附带;动作经 [ref] 与 core 源头闸归一)。
|
|
126
126
|
*
|
|
127
127
|
* **回声字段是什么**:模型服务商(上游模型 API / 中间网关)在响应里给、引擎**逐字转交**的不透明标识 ——
|
|
128
128
|
* `apiFailure.requestId`(响应头 `request-id` / `x-request-id`,core `brain/errors.js` 的 `readProviderRequestId`)、
|
|
129
129
|
* `responseModel`(服务商自报的模型名,与账本 `turn_end.responseModel` 是孪生)。字节由**部署方接的那个端点**决定,本栈一个都没铸 ⇒ **不可信**。
|
|
130
|
-
* 工具调用 id(`strandedHumanAnswers[].toolCallId` / `stats.humanReview.gates[].toolCallId`)**出身**同样是服务商,但自 core 7.36.0(
|
|
130
|
+
* 工具调用 id(`strandedHumanAnswers[].toolCallId` / `stats.humanReview.gates[].toolCallId`)**出身**同样是服务商,但自 core 7.36.0([ref])起
|
|
131
131
|
* 它进引擎之前已**准入一次**:三只 brain 在建调用的那一行(`brain/tool-call-id.js` 的 `admitToolCallId`)—— 缺席 ⇒ 车道兜底铸;
|
|
132
132
|
* 在形(可见 ASCII 1–128 且不含 `~`)⇒ 原样;越界 ⇒ 单射折叠成引擎 id(`<前 32 码元,越界字符记 `-`>~<sha256 前 32 hex>`),原字节只挂在
|
|
133
133
|
* 转录的 `ToolCall.wireId` 上、只回给 provider。⇒ 一方 brain 在 7.107.0 起新铸的调用,到达本仓任何一张脸的 `toolCallId` 恒在形。
|
|
134
|
-
* 残余两条(
|
|
134
|
+
* 残余两条([ref],如实):① ≤7.106.0 写下的存量行(待批 park 行 `boundCallId` / 检查点 `pendingAction.toolCallId` / 转录)是服务商原串逐字 —— 新版不对存量行二次准入(e2e G4 钉);② 宿主自己的 `Brain`(不经三只一方 adapter)铸的 id 不准入(core KL-1207-a;本仓生产装配的 brain 恒是 `createBrain` 的一方 adapter 外套委托装饰,这一形只经嵌入 / 测试注入的 brain 到达)。两条残余里的 id 仍是跨面 join 键、每张脸同值,只是形状不保证(本闸照旧不动它们:动一张脸 = join 断)。
|
|
135
135
|
*
|
|
136
136
|
* 🔴 **本闸只施加在「这个值出现的每一张脸都被覆盖到」的回声上**(codex r1 F1,实测成立的回归后改判):工具调用 id 是
|
|
137
137
|
* **跨面 join 键** —— 同一枚 id 同时逐字出现在 `tool_start` / `tool_end` / 审批卡等逐帧面上。只在结果面动它 ⇒ 结果面与逐帧面
|
|
138
138
|
* join 不上。所以它的处置词是 `"provider-join-key"`:出身是 provider,形状在**全部面的共同入口一次施加** —— 那个入口就是上面那条
|
|
139
|
-
* core brain 准入(
|
|
139
|
+
* core brain 准入([ref] v1 / v2 小稿提给 core、[ref] 落地;本仓零闸,不加第二道门),本面逐字 = 每张脸同一枚引擎 id,join 成立。`requestId` / `responseModel` 的每一张脸(结果面四处 + 账本孪生 + 子代通告 + `POST /v1/side-query` 200 体的 `responseModel`,
|
|
140
140
|
* 后者 7.105.0 合并复审 X1 补上 —— `http/routes/side-query.ts` 的 `shapeSideQueryEcho`)本闸都覆盖到了。
|
|
141
141
|
*
|
|
142
|
-
* **只做形状校验,不过脱敏器**(本车裁,与
|
|
142
|
+
* **只做形状校验,不过脱敏器**(本车裁,与 [ref] / clay [ref] ② 的 `structuredOutput` 逐字回声面同一方向):回声值
|
|
143
143
|
* 语义上是**不透明 id**(工单号 / join 键),脱敏器的值臂会把形似密钥的 id 改坏(`sk-…` 形的 id 整段成 `«redacted:key»`),
|
|
144
144
|
* 而 id 被改坏 = 下游 join / 支持工单对不上;该防的是**形**(超长串撑爆终局体与日志、控制字符 / 终端转义序列改写
|
|
145
145
|
* 显示、bidi / 非 ASCII 冒充),不是「里面像不像密钥」。
|
|
146
146
|
*
|
|
147
|
-
* 🔴 **形状与动作 = core 源头闸同一条规则**(
|
|
147
|
+
* 🔴 **形状与动作 = core 源头闸同一条规则**([ref],主会话裁;core **[ref]**,原排 7.34.1、随 7.35.0 到货,包根导出 `PROVIDER_ECHO_SHAPE` +
|
|
148
148
|
* `isProviderEchoShape(value: string): boolean`,字母表采本仓提出的这一张):
|
|
149
149
|
* · **形内** = 字符串、长度 1–128、每个码元都是可见 ASCII(0x21–0x7E;空格、空串与一切控制 / 非 ASCII 码元都在外)⇒ 原样;
|
|
150
150
|
* · **越界**(含非串值)⇒ **缺席**(键删掉 / 不铸)+ 计数 `server.run-terminal.provider-echo-shaped`(detail 只带座位与原长 / 类型,
|
|
151
151
|
* **不带值**)。不截断、不带记号 —— 首版的「截成 127 + `…`」与 core 的「越界 ⇒ 缺席」是同一个键上两种处置,那一形 7.105.0 不发;
|
|
152
152
|
* 截断记号、「截过的形是不动点」那套逻辑随之删除(规则变少)。缺席本来就是这几个键在 wire 上的一等状态(`apiFailure` 留下
|
|
153
153
|
* `{}` = 「provider 故障、无可补充标签」,core 契约原句),消费端不需要新读法。
|
|
154
|
-
* · `undefined` 与**空串** = 缺席本身(服务商什么都没说),不计数、不铸键 —— 空串一臂是
|
|
154
|
+
* · `undefined` 与**空串** = 缺席本身(服务商什么都没说),不计数、不铸键 —— 空串一臂是 [ref] / core 7.35.0 [ref] 的读法
|
|
155
155
|
* (`brain/errors.d.ts` 的 `providerEchoReading` 逐字「a non-string or the empty string states nothing (`absent` — no field,
|
|
156
156
|
* nothing counted)」;修前本仓把空串算越界计一次)。非串值本仓**照旧计数**:core 那句说的是 brain 读服务商原始响应,本口读的是
|
|
157
157
|
* 持久行 / 非 core 的 Runner 给的形,一个非串的回声座是坏行,响亮([ref])。
|
|
158
|
-
* ✅ 谓词 = core 包根导出的 `isProviderEchoShape`(
|
|
158
|
+
* ✅ 谓词 = core 包根导出的 `isProviderEchoShape`([ref] 起换调;本地那两行定义已删 —— 字母表同源,本仓不留第二份)。
|
|
159
159
|
* 🔴 **core 7.35.0 起 core 的 brain 在写侧先判一次**(`brain/stream-shared.js` `noteResponseModel` / `brain/errors.js`
|
|
160
160
|
* `readProviderRequestId`:越界 ⇒ 不写、run 里发 trace `brain.echo_dropped {field}`)⇒ 真 brain 链上越界值到不了本口,本口的
|
|
161
161
|
* 计数只剩「不经 core brain 写侧」的 producer(存量行、宿主自己的 Brain / 自接 `sideQuery` 席)。
|
|
@@ -164,9 +164,9 @@ export declare function redactModelText(raw: string): string;
|
|
|
164
164
|
/** 回声座上的值留不留:形内 ⇒ `true`(原样留);`undefined` / 空串 ⇒ `false`(缺席本身,不计数);其余越界 ⇒ `false` + 计数。
|
|
165
165
|
* 调用方按 `false` 删键 / 不铸键 —— 本函数是全部回声座(结果面 / 账本孪生 / 子代通告 / side-query 200 体)的**唯一**判决口。 */
|
|
166
166
|
export declare function admitProviderEcho(value: unknown, seat: string): value is string;
|
|
167
|
-
/** {@link redactTerminalResult} 会碰的全部顶层键 = 现行形里**不是** `"verbatim"` 的行(`"redacted"` ∪
|
|
167
|
+
/** {@link redactTerminalResult} 会碰的全部顶层键 = 现行形里**不是** `"verbatim"` 的行(`"redacted"` ∪ [ref] 的
|
|
168
168
|
* `"provider-echo"`)∪ 旧形平面键;`memoRedactTerminalResult` 的记忆键由它派生(两处同源,见 `RESULT_KEY_TREATMENT` 顶注)。
|
|
169
|
-
* 🔴
|
|
169
|
+
* 🔴 [ref] 起改名(原 `REDACTABLE_RESULT_LEAVES`):回声键不脱敏但**会被改**(越界 ⇒ 删键),漏进记忆键集 = 读面记忆腿对存量行
|
|
170
170
|
* O(1) 原样直返,读面纵深对那几片恒不生效([ref] 立案时 `editedFiles` 那一格的同一个病)。 */
|
|
171
171
|
export declare const TREATED_RESULT_LEAVES: readonly string[];
|
|
172
172
|
export declare function redactTerminalResult<T extends {
|
|
@@ -178,7 +178,7 @@ export declare function redactTerminalResult<T extends {
|
|
|
178
178
|
remoteEnvFailures?: readonly {
|
|
179
179
|
message?: string | undefined;
|
|
180
180
|
}[] | undefined;
|
|
181
|
-
/**
|
|
181
|
+
/** [ref]:模型自由文本两叶 + 引擎披露散文一族。形上同样取 `unknown`(读面纪律,见下)。 */
|
|
182
182
|
result?: unknown;
|
|
183
183
|
salvagedOutput?: unknown;
|
|
184
184
|
rewindNotes?: unknown;
|
|
@@ -186,19 +186,19 @@ export declare function redactTerminalResult<T extends {
|
|
|
186
186
|
* 声明成 `{path,edits}[]` 会逼每一个喂坏形的调用点铸一次宽松断言 —— 而「坏形从哪来」正是本座要
|
|
187
187
|
* 处理的事(同一份不信任在 `remoteEnvFailures` 的实现里也已成文)。运行期逐项判形,不抛。 */
|
|
188
188
|
editedFiles?: unknown;
|
|
189
|
-
/**
|
|
189
|
+
/** [ref]:形上同样 `unknown` —— 本函数是读盘面,`stats` 的树形逐层现判(见 {@link redactStats})。 */
|
|
190
190
|
stats?: unknown;
|
|
191
|
-
/**
|
|
191
|
+
/** [ref]:provider 回声三键(形上 `unknown`,读盘面纪律同上;处置见 {@link PROVIDER_ECHO_SHAPERS})。 */
|
|
192
192
|
apiFailure?: unknown;
|
|
193
193
|
strandedHumanAnswers?: unknown;
|
|
194
194
|
responseModel?: unknown;
|
|
195
195
|
} | null | undefined>(result: T): T;
|
|
196
196
|
/**
|
|
197
|
-
* 🔴 **
|
|
197
|
+
* 🔴 **[ref] —— run 行 `result` 列的唯一入口**:先过出口封口({@link sealResultForExit}:摘恢复凭据 + 折域外码),
|
|
198
198
|
* 再过 {@link redactTerminalResult}。三家 run 店(SQL 两方言 / file / memory)的**三个**写口 —— `setTerminal` 与
|
|
199
199
|
* park 两口 `setSuspended` / `setNeedsReview` —— 入口各调一次,列上的字节因此只有一条来路。
|
|
200
200
|
*
|
|
201
|
-
* 为什么封口也挪到店的入口(而不只靠调用方):
|
|
201
|
+
* 为什么封口也挪到店的入口(而不只靠调用方):[ref] 之前这一列只收终局结果,而终局结果上凭据只可能藏在
|
|
202
202
|
* `failed.nestedPause` 一处、且每个调用点都已先封口。park 两口收的是 **`paused` 因由** —— 那一臂按 core 的
|
|
203
203
|
* 类型**必带** `token`(引擎内契约)。凭据挂在「每个调用点都记得先封口」上 = 漏一处就是一次凭据落盘、且
|
|
204
204
|
* 不会红([ref] 安全轴:fail-closed,不是约定)。两件事都**幂等**(封过口的再封是同形、脱过的再脱是同一引用),
|
|
@@ -207,12 +207,12 @@ export declare function redactTerminalResult<T extends {
|
|
|
207
207
|
* `null` 原样(= 这条腿没有结果可落:引擎没给终局就收流 / 断连竞态 park / 重开 re-park)。
|
|
208
208
|
*/
|
|
209
209
|
export declare function sealRunRowResult(result: PersistedTaskResult | null): PersistedTaskResult | null;
|
|
210
|
-
/**
|
|
210
|
+
/** [ref](第五轮合并重扫 wf_f00c00bc 两根 [high]):同一个 `TaskResult` 除 run 行外还被逐字追加进 run_events 的 `done` 行
|
|
211
211
|
* (bg/verify/cascade/stream/resume 五腿),`failed` 行带原文 `errorMessage`,`GET /v1/runs/:id/events` 原样回放。
|
|
212
212
|
* 三孪生 `appendEvent` 入口 + 事件读面(旧行纵深)同调本函数:只认 `done.result`(整块走 `redactTerminalResult`)与
|
|
213
213
|
* `failed.errorMessage`,其余事件类型/键逐字不动(它们各有自己的 sink 侧脱敏);形不合(非对象)原样返回,不抛。 */
|
|
214
214
|
export declare function redactLedgerEventData(type: string, data: unknown): unknown;
|
|
215
|
-
/**
|
|
215
|
+
/** [ref] 第三轮窄范围重扫 [high]×2:leader 面的三处原文座——①`WorkerReport.error`(生产路径经 `runWorker` 构造,`fanout.ts`
|
|
216
216
|
* 的 runTaskStream 回退座不是生产座);②`LeaderResult.error`(plan/provision 失败带 `e.message`);③`merge.reason`
|
|
217
217
|
* (coordinator push 失败把 `git clone <带凭据的 durableRemote>` 命令行整段回显)。全部随 leader_run.result JSON 落库并经
|
|
218
218
|
* `GET /v1/leader/:id` 直出。修=**咽喉**:fanOut 边界对每份报告脱一次(不问谁产的),endpoint 落库前 + 读面各脱一次
|
|
@@ -250,13 +250,13 @@ export declare function redactLeaderResultWithFlag(result: unknown): {
|
|
|
250
250
|
changed: boolean;
|
|
251
251
|
};
|
|
252
252
|
export declare function memoRedactedRead<T>(seat: string, raw: T, redact: (v: T) => T): T;
|
|
253
|
-
/** run 终态 result 的读面记忆只按**本函数会改字节的那几叶**({@link TREATED_RESULT_LEAVES}:脱敏叶 ∪
|
|
253
|
+
/** run 终态 result 的读面记忆只按**本函数会改字节的那几叶**({@link TREATED_RESULT_LEAVES}:脱敏叶 ∪ [ref] 回声叶 ∪ 旧形平面键,属主是
|
|
254
254
|
* `RESULT_KEY_TREATMENT`)做键与留体——
|
|
255
255
|
* 第十六轮重扫:按整块 result 摘要每次轮询要 stringify 一份可能数 MB 的 result,且大 result 的脏行永远存不进去。叶全缺席
|
|
256
256
|
* ⇒ O(1) 直返(`redactTerminalResult` 本就同引用)。
|
|
257
|
-
* 🔴
|
|
257
|
+
* 🔴 [ref](core 7.6.0 D-8):新形把前两片搬进了 `terminal`(同属一个键,按它整只做叶更省);旧形的两片
|
|
258
258
|
* **照留**——盘上真有那样的行,而读面纵深正是为它们存在的(codex 对抗复审 r1 [high] 验真后补)。
|
|
259
|
-
* 🔴 **
|
|
259
|
+
* 🔴 **[ref] 起「叶全缺席」这条捷径实际上不再触发**(如实写明,不是漏改):`result` 在 core 类型上是
|
|
260
260
|
* **必填**串,进了叶集就恒在场 ⇒ 每次读面都要对叶子做一次 sha256。代价是有意接受的,因为省下的那条
|
|
261
261
|
* 捷径对**含自由文本的 run(即全部 run)**本来就不成立 —— 不把 `result` 放进叶集才是真的漏:
|
|
262
262
|
* `memoRedactTerminalResult` 会对它 O(1) 直返明文,读面纵深对这一叶恒不生效(这正是 [ref] 立案时
|
|
@@ -264,7 +264,7 @@ export declare function memoRedactedRead<T>(seat: string, raw: T, redact: (v: T)
|
|
|
264
264
|
* 一次即进 clean 集,脏行超过 {@link READ_MEMO_DIRTY_MAX_ENTRY_BYTES} 时退化为每次重扫(既有形)。 */
|
|
265
265
|
export declare function memoRedactTerminalResult<T extends Parameters<typeof redactTerminalResult>[0]>(seat: string, result: T): T;
|
|
266
266
|
/**
|
|
267
|
-
* 🔴 **账本行的读面口 —— 全部耐久读腿共用这一只**(
|
|
267
|
+
* 🔴 **账本行的读面口 —— 全部耐久读腿共用这一只**([ref],7.105.0)。
|
|
268
268
|
*
|
|
269
269
|
* 脱敏的**属主**仍是 {@link redactLedgerEventData}(写读共用的唯一汇点,规则一张:哪些行型有自由文本座、怎么脱);
|
|
270
270
|
* 本函数**不是第二只脱敏器**,只在汇点外面加一层**按型记忆**(读面每次轮询 / 每个观看者 / 每次重连都重放同一批
|
|
@@ -275,8 +275,8 @@ export declare function memoRedactTerminalResult<T extends Parameters<typeof red
|
|
|
275
275
|
*
|
|
276
276
|
* **三条耐久读腿同调**:`GET /v1/runs/:id/events`(账本裸回放)、`GET /v1/tasks/:id/turns`(`projectEvents`)、
|
|
277
277
|
* trace SSE `GET /v1/tasks/:id/stream`(`mapTraceEvent`)。此前只有第一条在 `formatEvent` 里手写了这段分派,后两条
|
|
278
|
-
* **直吃原行** —— 新行在三孪生 `appendEvent` 落库前已脱,所以只打在**存量行**上:7.75.1(
|
|
279
|
-
* 不脱,那批行在两条 trace 腿上原字节回放(
|
|
278
|
+
* **直吃原行** —— 新行在三孪生 `appendEvent` 落库前已脱,所以只打在**存量行**上:7.75.1([ref])之前 `text` 行的写口
|
|
279
|
+
* 不脱,那批行在两条 trace 腿上原字节回放([ref],车EC U-2)。分派收进本函数、三条腿同调 ⇒ 读面纵深一条规则。
|
|
280
280
|
*
|
|
281
281
|
* **性能取舍(读实现后定)**:汇点对已脱行在**输出**上幂等(`redactModelText` 认不出凭据形就回同一引用),但**代价不是
|
|
282
282
|
* 空过** —— 每次都整段重扫(`redactSecrets` 全池一遍)。所以读面走记忆:同一行第二次起只付一次 sha256 摘要 + 集合查找
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* ## 形(照 `fail-open.ts` 的仓内先例)
|
|
15
15
|
* 1. **计数(逐次)** —— `secret_env_scrubbed_total{site,kind,confidence}`;
|
|
16
16
|
* 2. **结构化披露(每 site×key 一次)** —— 首次在某条腿上丢掉某个 key 时一条 `info`,之后同 key 只走计数。
|
|
17
|
-
* 有部署级出路的现场(
|
|
17
|
+
* 有部署级出路的现场([ref]:`server.lsp.spawn-env`;7.103.0 起 + `server.bake-runner.spawn-env`)升 `warn`,并带当前放行名单与出路句
|
|
18
18
|
* —— 规则见 `SecretEnvScrubSiteSpec`。
|
|
19
19
|
* 不是「每 site 一次」:一个**新**的密钥形 key 后来才出现(部署加了一个凭证)时,那才是最该看见的一行。
|
|
20
20
|
* findings 全部是 core 的 `SecretEnvFinding`(7.129.0 / core 7.51.1 起只有引擎一只写手,经 `server-secret-env.ts` 的唯一组合):形状臂的五词
|
|
@@ -38,7 +38,7 @@ import type { Metrics } from "./metrics.js";
|
|
|
38
38
|
/**
|
|
39
39
|
* 一个剥除现场的登记:`note` = 这条腿上泄漏意味着什么;`remedy` = 部署方能不能自己把某个被剥的键放回来。
|
|
40
40
|
*
|
|
41
|
-
* 🔴
|
|
41
|
+
* 🔴 [ref]:`remedy` 在场与否决定披露行的**级别**,规则一句 —— **有出路的现场用 warn,并把出路句与当前放行名单写进同一行**;
|
|
42
42
|
* 没有出路的现场是纯保护留痕,照旧 info。理由:没有出路的剥除(模型可驱动的 shell、git 钩子)是本服务替部署方做的决定,
|
|
43
43
|
* 读者只需要知道它生效了;有出路的剥除(语言服务器)可能让一件功能静默变差(补全 / 诊断缺了私有 registry 的依赖),
|
|
44
44
|
* 那是部署方要自己决定的事 —— 看不见 = 无从归因。出路句不带任何值。
|
|
@@ -96,7 +96,7 @@ interface Sink {
|
|
|
96
96
|
* 记一次剥除。**总不抛** —— 观测本身绝不能变成故障(同 `recordFailOpen` / reapers 的判据)。
|
|
97
97
|
* `findings` 为空(这一次没丢任何 key)时什么也不做:那不是事件,是常态。
|
|
98
98
|
* `findings` 只许装**没有按原样交给子进程**的键(剥掉 / 换成 core 占位半条)—— 点名放回的键取回源值,不是剥除(不计数、不披露)。
|
|
99
|
-
* `allowed` = 这一次生效的点名放行名单(
|
|
99
|
+
* `allowed` = 这一次生效的点名放行名单([ref]),只在有出路的现场(`remedy` 在场)写进披露行;没有放行面的腿传 `[]`。
|
|
100
100
|
*/
|
|
101
101
|
export declare function recordSecretEnvScrub(site: SecretEnvScrubSite, findings: readonly SecretEnvFinding[], allowed: readonly string[]): void;
|
|
102
102
|
/** 装配层把 logger/metrics 接上(main.ts,与 `installFailOpenRecorder` 同一处)。装配前累计的次数在此补进 metrics。 */
|
|
@@ -17,7 +17,7 @@ export declare const TOOL_TRACE_REGISTRATION = "server.tool-trace";
|
|
|
17
17
|
* 🔴 BREAKING(server 7.64.0,core 7.6.0 提货):标签名 `source` → `deniedBy`,词表从七词
|
|
18
18
|
* (`policy/hook/safety/shellGate/planMode/classifier/org`)换成八词
|
|
19
19
|
* (`policy/hook/org/classifier/plan_mode/compliance/write_protection/ask_resolution`)。仪表盘/告警规则要改。
|
|
20
|
-
* 🔁 server 7.106.0(
|
|
20
|
+
* 🔁 server 7.106.0([ref] / core 7.34.0 [ref]):`plan_mode` 这个词退役,换成 `mode`(模式自己拒的那一形:`dontAsk` 拒每一只非授权 ask、
|
|
21
21
|
* `bypassPermissions` 拒判不出保护的写)—— 标签值原样取 core 的 `isDeniedBy`,按 `deniedBy="plan_mode"` 写的告警规则改 `mode`。
|
|
22
22
|
*
|
|
23
23
|
* 🔴 **第二个计数器 `auto_mode_classifier_deny_cause_total{cause}`(server 7.70.0 生为
|
package/dist/operator-ask.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export type OperatorAskResult = Extract<PermissionResult, {
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function operatorAsk(rule: string, message: string): OperatorAskResult;
|
|
50
50
|
/**
|
|
51
|
-
* 🔴 **
|
|
51
|
+
* 🔴 **[ref] 候裁 16 —— 运维声明的「恒问人」**(`APPROVAL_NEVER_AUTO` 的「always human」、耐久资源预算耗尽的「human approval required」):
|
|
52
52
|
* 在 {@link operatorAsk} 之上再盖部署出身 `authoredBy: "deployment"` ⇒ core 类读 `operator_forced`(`ruleClearanceOf`:
|
|
53
53
|
* 「a deployment-authored ask」进强制门 ⇒ `mandated`)—— bypassPermissions 放不掉、**任何**站着的答案(持久规则、会话授权,
|
|
54
54
|
* 任何 scope)退不掉,只有**这一次**的应答能答它。
|
|
@@ -67,7 +67,7 @@ export declare function operatorAsk(rule: string, message: string): OperatorAskR
|
|
|
67
67
|
*/
|
|
68
68
|
export declare function operatorAlwaysHumanAsk(rule: string, message: string): OperatorAskResult;
|
|
69
69
|
/**
|
|
70
|
-
* 🔴 **
|
|
70
|
+
* 🔴 **[ref] —— 请求写下的「恒问人」**(`settings.permissions.neverAuto`):在 {@link operatorAsk} 之上再盖 `requiresRealApproval: true`(core 的治理位 ——
|
|
71
71
|
* 「只有判断能清它」:空白的 `onAsk: "allow"`、任何站着的答案(持久规则、会话授权)、auto 分类器都清不掉,只有**这一次**的真人应答能答),不盖部署出身。
|
|
72
72
|
*
|
|
73
73
|
* 为什么不盖 `authoredBy: "deployment"`:出身位说的是「部署自己的治理层写的」,请求里的声明不是部署写的 —— 盖了就是在审计面冒名。`requiresRealApproval` 是 core 明文开给
|
|
@@ -77,13 +77,13 @@ export declare function operatorAlwaysHumanAsk(rule: string, message: string): O
|
|
|
77
77
|
*/
|
|
78
78
|
export declare function requestAlwaysHumanAsk(rule: string, message: string): OperatorAskResult;
|
|
79
79
|
/**
|
|
80
|
-
* 🔴 **
|
|
80
|
+
* 🔴 **[ref] —— 治理层的叶策略包装**:`leaf` 产的每一只 ask 盖部署出身(经 {@link withDeploymentAuthorship}),allow / deny 原物交回;
|
|
81
81
|
* 成员(`projection` / `pathRules` / `writeTargetGuard` / `nameSets`)经 core `wrapToolPolicy` 随行(契约「包装至少拒内层所拒」:
|
|
82
82
|
* 只加一位、从不放宽)。同步叶保持同步返回;叶抛照抛(fail-closed 的属主仍是叶)。
|
|
83
83
|
*
|
|
84
84
|
* **只收叶**:治理层(`runtime-governance.ts` `applyRuntimeGovernance`)对每一片叶各盖一次,再交 core `combinePolicies` 折**一次**
|
|
85
85
|
* (折叠是最外层,其输出原样交回 —— core 把落选 ask 的类(含本位带出的 `operator_forced`)写进 `foldedAskClasses` 并担保那只对象)。
|
|
86
|
-
* 把一只折叠交给本函数 = 在折叠的输出上展开 —— 那正是
|
|
86
|
+
* 把一只折叠交给本函数 = 在折叠的输出上展开 —— 那正是 [ref] 修掉的病(7.39.0 起按名拒,响亮、fail-closed,不是静默)。
|
|
87
87
|
*/
|
|
88
88
|
export declare function createDeploymentAuthoredPolicy(leaf: ToolPolicy): ToolPolicy;
|
|
89
89
|
//# sourceMappingURL=operator-ask.d.ts.map
|
|
@@ -24,7 +24,7 @@ export interface WorkflowAgentSessionIndex {
|
|
|
24
24
|
listByAgentSession(sessionId: string): Promise<WorkflowAgentSessionRow[]>;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* 🔴 **park 身份的单一真源**(core 7.17.0 [ref];持有者两成员 core 7.44.0
|
|
27
|
+
* 🔴 **park 身份的单一真源**(core 7.17.0 [ref];持有者两成员 core 7.44.0 [ref])—— 引擎写在记录上的 `parks[]` 的元素形。
|
|
28
28
|
*
|
|
29
29
|
* 型从 core 的那一位取、不在本仓复述:core 往元素上加一位 ⇒ `trace/core-keyset-guard.ts` 的 ⑬b 成员门与下面那只读者的构造式**同时**红。
|
|
30
30
|
*/
|
|
@@ -45,7 +45,7 @@ export type WorkflowRunParkKey = NonNullable<WorkflowRun["parks"]>[number];
|
|
|
45
45
|
*/
|
|
46
46
|
export declare function readRunParks(run: unknown): WorkflowRunParkKey[] | undefined;
|
|
47
47
|
/**
|
|
48
|
-
* 🔴 **「这条记录的 run 持有这条停驻」的唯一读法**(core 7.44.0
|
|
48
|
+
* 🔴 **「这条记录的 run 持有这条停驻」的唯一读法**(core 7.44.0 [ref] 逐字):`entry.parkedBy === record.id`。
|
|
49
49
|
* 继承来、本跑还没走到的条目带上一跑的 id;旧引擎写的条目两成员皆无 —— 两者都不是本记录持有的。
|
|
50
50
|
*/
|
|
51
51
|
export declare function heldParksOf(recordId: string, parks: readonly WorkflowRunParkKey[]): WorkflowRunParkKey[];
|
|
@@ -126,7 +126,7 @@ export declare function readAgentSessionLedgerLine(v: unknown): WorkflowAgentSes
|
|
|
126
126
|
*
|
|
127
127
|
* 账本的一行 = **一条 run 当时的整份指针集**(按 runId 后写覆盖;指针只增不删 ⇒ 后一行恒是前一行的超集),所以重放即收敛,不需要压缩腿。
|
|
128
128
|
*
|
|
129
|
-
* 追加 / 重放走本仓 JSONL 店的**共用口**(
|
|
129
|
+
* 追加 / 重放走本仓 JSONL 店的**共用口**([ref];此前 ctor 里自写 `truncateTornTail` + 手写 `split("\n") + JSON.parse` 重放):
|
|
130
130
|
* 追加 = core `AppendLog`(惰性打开、撕尾在**打开与每次追加前**修 —— 修前只在 boot 修,运行期半写后的下一次成功写仍会被粘进残尾),
|
|
131
131
|
* 重放 = `replayJsonlSkipping`(登记座 `workflow-agent-session-index`:中间坏行 —— 含半截 JSON 与形不对的整行 —— 跳过 + 逐条披露 + F tag;
|
|
132
132
|
* 撕尾不计、不披露)。盘上字节 / 0o600 账本 / 0o700 目录与修前逐字同,升级零迁移:一行仍是「这条 run 的指针集」,旧账本行就是旧记录的指针
|
|
@@ -17,8 +17,10 @@ export interface WorkflowCompletionInboxEntry {
|
|
|
17
17
|
* originating leg was IDLE (core's in-process injection had no harness to steer — the durable half
|
|
18
18
|
* is the deployment's job). `runId` then holds the core task_id (disjoint id spaces). */
|
|
19
19
|
kind?: "workflow_complete" | "task_notification";
|
|
20
|
-
/** The
|
|
21
|
-
*
|
|
20
|
+
/** The per-kind extras as a JSON text — bounded + redacted AT ENQUEUE (the store carries only egress-safe bytes).
|
|
21
|
+
* `task_notification`: {task_type, toolUseId?, result?, output_file?, …}. `workflow_complete`: at most `{"completionId": …}`
|
|
22
|
+
* (see {@link buildWorkflowCompleteInboxEntry}; absent when the engine minted none). The SQL stores' existing `payload`
|
|
23
|
+
* column carries it verbatim for both kinds — no DDL. */
|
|
22
24
|
payload?: string;
|
|
23
25
|
}
|
|
24
26
|
/** Session-keyed queue of finished-workflow completions awaiting a push to the originating session.
|
|
@@ -96,12 +98,12 @@ export declare function taskNotificationFoldKey(n: {
|
|
|
96
98
|
* 型取 core 载荷的那五位(`Partial`:帧上任一位都可能缺,缺了就不成键,见 {@link taskNotificationStreamKeyOf})。 */
|
|
97
99
|
export type TaskNotificationKeyFields = Partial<Pick<TaskNotificationPayload, "task_type" | "task_id" | "status" | "seq" | "attempt">>;
|
|
98
100
|
/**
|
|
99
|
-
* **唯一**从一帧上读键字段的地方(
|
|
101
|
+
* **唯一**从一帧上读键字段的地方([ref] 按类修):此前七个调用点各自手抄 `{ task_type, task_id, status, seq }` 四字段投影,
|
|
100
102
|
* core 给帧身份加一个分量(本版的 `attempt`)时,每一处手抄都得有人记得补 —— 漏一处就是那一腿的重供帧被吞。现在调用点
|
|
101
103
|
* 把整只帧交过来,键字段只在这里读。
|
|
102
104
|
*
|
|
103
105
|
* 🔴 **键 = core `taskNotificationDedupKey` 的输出**(NP-6,7.100.0 合并复审 [ref] 交叉表 #8,opus A3;[ref]):本仓流侧键此前
|
|
104
|
-
* 是 core 那只注入去重键的手抄孪生(`域:id:status[#seq]`),
|
|
106
|
+
* 是 core 那只注入去重键的手抄孪生(`域:id:status[#seq]`),[ref] 又逐字抄了它的 `:a<attempt>` 尾 —— core 改一次键规则,
|
|
105
107
|
* 这里就得有人记得跟。键只活在进程内(每腿 {@link NotifiedKeys},不落盘、不上 wire),换成 core 的输出零迁移面。
|
|
106
108
|
* core 那只键同样按车道分域(external 车道 `external:<id>`,其余裸 id —— codex F2 的「external 帧不许与内部帧撞键」照旧成立)、
|
|
107
109
|
* status 保 RAW、`seq` 折入、`attempt` 缺席 / 1 时字节不变。调用点手里已有 core 载荷的(observer 臂)直接调 core 函数。
|
|
@@ -198,6 +200,19 @@ export declare class FileWorkflowCompletionInbox extends InMemoryWorkflowComplet
|
|
|
198
200
|
/** Close the ledger fd (shutdown). */
|
|
199
201
|
close(): void;
|
|
200
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* 一次 workflow 完成 → 入箱条目(`workflow_complete` 家族;启动期投递闭包的**唯一**构造点)。`summary` 在 core 的 notifier seam 上已脱敏 + 限长,这里原样入箱;
|
|
205
|
+
* `completionId`(引擎铸,`WorkflowCompletionPayload` 上在场 iff 引擎给了)逐字落进 `payload` 列 —— 同一次完成的补投帧与 live 帧同一个相关 id,本服务零自铸。
|
|
206
|
+
*/
|
|
207
|
+
export declare function buildWorkflowCompleteInboxEntry(route: {
|
|
208
|
+
sessionId: string;
|
|
209
|
+
owner: string | null;
|
|
210
|
+
}, p: {
|
|
211
|
+
runId: string;
|
|
212
|
+
status: "completed" | "failed";
|
|
213
|
+
summary: string;
|
|
214
|
+
completionId?: string;
|
|
215
|
+
}, enqueuedAt: number): WorkflowCompletionInboxEntry;
|
|
201
216
|
/**
|
|
202
217
|
* P1 ①② delivery half, TWO-PHASE since 1.80: read the session's pending completions, emit
|
|
203
218
|
* one `workflow_complete` out-of-band frame per entry, and `ack` (remove) each entry only AFTER its emit
|
|
@@ -270,7 +285,7 @@ export type EngineNotificationParkInput = ParkedNotificationFields & {
|
|
|
270
285
|
body: string;
|
|
271
286
|
};
|
|
272
287
|
_sema_provenance?: SemaProvenanceInput;
|
|
273
|
-
/**
|
|
288
|
+
/** [ref](core 7.30.0 [ref] S1 / [ref] / [ref]):委派终态帧三枚 facet + 重供两键 —— 判据与 live 腿同一只
|
|
274
289
|
* (`trace/task-notification-facets.ts`,入参按 `unknown` 收、判过形才成 typed)。 */
|
|
275
290
|
spawnName?: string;
|
|
276
291
|
handback?: string;
|
|
@@ -264,6 +264,33 @@ export class FileWorkflowCompletionInbox extends InMemoryWorkflowCompletionInbox
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
+
function readEntryExtras(payload) {
|
|
268
|
+
let extras = {};
|
|
269
|
+
try {
|
|
270
|
+
extras = payload ? JSON.parse(payload) : {};
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
}
|
|
274
|
+
return typeof extras === "object" && extras !== null && !Array.isArray(extras) ? extras : {};
|
|
275
|
+
}
|
|
276
|
+
function encodeWorkflowCompleteExtras(completionId) {
|
|
277
|
+
return completionId ? { payload: JSON.stringify({ completionId }) } : {};
|
|
278
|
+
}
|
|
279
|
+
function workflowCompleteFrameExtras(payload) {
|
|
280
|
+
const id = readEntryExtras(payload).completionId;
|
|
281
|
+
return typeof id === "string" && id !== "" ? { completionId: id } : {};
|
|
282
|
+
}
|
|
283
|
+
export function buildWorkflowCompleteInboxEntry(route, p, enqueuedAt) {
|
|
284
|
+
return {
|
|
285
|
+
sessionId: route.sessionId,
|
|
286
|
+
owner: route.owner,
|
|
287
|
+
runId: p.runId,
|
|
288
|
+
status: p.status,
|
|
289
|
+
summary: p.summary,
|
|
290
|
+
enqueuedAt,
|
|
291
|
+
...encodeWorkflowCompleteExtras(p.completionId),
|
|
292
|
+
};
|
|
293
|
+
}
|
|
267
294
|
export async function emitPendingWorkflowCompletions(inbox, sessionId, callerPrincipal, emit, diag) {
|
|
268
295
|
if (!inbox || !sessionId)
|
|
269
296
|
return;
|
|
@@ -289,16 +316,11 @@ export async function emitPendingWorkflowCompletions(inbox, sessionId, callerPri
|
|
|
289
316
|
continue;
|
|
290
317
|
}
|
|
291
318
|
if (e.kind === "task_notification") {
|
|
292
|
-
|
|
293
|
-
try {
|
|
294
|
-
extras = e.payload ? JSON.parse(e.payload) : {};
|
|
295
|
-
}
|
|
296
|
-
catch {
|
|
297
|
-
}
|
|
319
|
+
const extras = readEntryExtras(e.payload);
|
|
298
320
|
await emit({ type: "task_notification", task_id: e.runId, status: e.status, summary: e.summary, ...extras, injected: false });
|
|
299
321
|
}
|
|
300
322
|
else {
|
|
301
|
-
await emit({ type: "workflow_complete", runId: e.runId, status: e.status, summary: e.summary });
|
|
323
|
+
await emit({ type: "workflow_complete", runId: e.runId, status: e.status, summary: e.summary, ...workflowCompleteFrameExtras(e.payload) });
|
|
302
324
|
}
|
|
303
325
|
await inbox.ack(sessionId, e.runId);
|
|
304
326
|
dlog("workflow_complete_emitted", {
|
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
import { type WorkflowRun, type WorkflowRunStore, type WorkflowRunStatus, type WorkflowRunSummary } from "@sema-agent/core";
|
|
1
|
+
import { type WorkflowCompletionNotifier, type WorkflowRun, type WorkflowRunStore, type WorkflowRunStatus, type WorkflowRunSummary } from "@sema-agent/core";
|
|
2
2
|
import { type FleetEventBus } from "../fleet/fleet-bus.js";
|
|
3
3
|
import { type WorkflowAgentSessionIndex } from "./workflow-agent-session-index.js";
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
/**
|
|
5
|
+
* core 的 notify seam 递来的**每一个键**在这条通知链上的处置 —— 载荷型 {@link WorkflowCompletionPayload} 的**唯一来源**(不再手抄 core 入参型的子集)。
|
|
6
|
+
* core 给 `WorkflowCompletionNotifier.notify` 的入参加一个键 ⇒ 这里编译红(缺一行),逼人对「它上不上这条链」表态;core 删 / 改名一个键 ⇒ 同样红(多一行)。
|
|
7
|
+
* · `carry`:搬运到投递(journal 门 → 收件箱 → `workflow_complete` 帧 / 账本行)。`runId` / `status` / `summary` 必带;其余可选键引擎没给(或空串)⇒ 载荷上缺席。
|
|
8
|
+
* `completionId` = 引擎的一次完成的相关 id(fill-once,终态转换上铸):逐字、不脱敏、本服务零自铸。
|
|
9
|
+
* · `drop`:这条持久链只搬运一句受限摘要 + 路由键 —— `task_id` / `task_type` / `toolUseId` 是 live `task_notification` 帧的键(那条路径自带),`result` / `usage` /
|
|
10
|
+
* `diagnostics` 是完整结果 / 计量 / 诊断路由(终态轮询 `TaskOutput` / `WorkflowStatus` 读得到),不进补投帧。
|
|
11
|
+
* 键名直呼 core 的入参型(型文本里就有 core 名)⇒ 读表的 literals 段收得到这些键。
|
|
12
|
+
*/
|
|
13
|
+
export declare const WORKFLOW_NOTIFY_KEY_DISPOSITION: {
|
|
14
|
+
readonly runId: "carry";
|
|
15
|
+
readonly status: "carry";
|
|
16
|
+
readonly summary: "carry";
|
|
17
|
+
readonly sourceTaskId: "carry";
|
|
18
|
+
readonly principal: "carry";
|
|
19
|
+
readonly originatingSessionId: "carry";
|
|
20
|
+
readonly completionId: "carry";
|
|
21
|
+
readonly task_id: "drop";
|
|
22
|
+
readonly task_type: "drop";
|
|
23
|
+
readonly toolUseId: "drop";
|
|
24
|
+
readonly result: "drop";
|
|
25
|
+
readonly usage: "drop";
|
|
26
|
+
readonly diagnostics: "drop";
|
|
27
|
+
};
|
|
28
|
+
type NotifyKeyDisposition = typeof WORKFLOW_NOTIFY_KEY_DISPOSITION;
|
|
29
|
+
/** 处置表里 `carry` 的键。 */
|
|
30
|
+
export type WorkflowNotifyCarriedKey = {
|
|
31
|
+
[K in keyof NotifyKeyDisposition]: NotifyKeyDisposition[K] extends "carry" ? K : never;
|
|
32
|
+
}[keyof NotifyKeyDisposition];
|
|
33
|
+
/**
|
|
34
|
+
* A workflow completion notification's terminal payload — the bounded, redacted shape core's notifier seam carries,
|
|
35
|
+
* re-derivable from a durable {@link import("@sema-agent/core").WorkflowRun} on the recovery path.
|
|
36
|
+
*
|
|
37
|
+
* **派生型,不是手抄子集**:core `WorkflowCompletionNotifier["notify"]` 入参型按 {@link WORKFLOW_NOTIFY_KEY_DISPOSITION} 里 `carry` 的键挑出来。
|
|
38
|
+
* 键的语义随键住在 core 的入参型上(`summary` 受限 + 脱敏;`originatingSessionId` = Runner 在挂 RunWorkflow 时闭包的发起会话 id,live 路径在、崩溃恢复路径读
|
|
39
|
+
* `WorkflowRun` 行上同名键;`completionId` 见处置表)—— 这里不再复述一份会漂的注释。
|
|
40
|
+
*/
|
|
41
|
+
export type WorkflowCompletionPayload = Pick<Parameters<WorkflowCompletionNotifier["notify"]>[0], WorkflowNotifyCarriedKey>;
|
|
19
42
|
/** The downstream delivery the journal guards (the deployment's real completion route — log+meter today, a full
|
|
20
43
|
* re-invoke into the originator's stream/inbox tomorrow). Idempotent on `runId` by contract; the journal still
|
|
21
44
|
* de-dups so it is invoked AT MOST once per run in steady state and at most one extra time across a crash. */
|
|
@@ -201,7 +224,7 @@ export declare class WorkflowNotifyGate {
|
|
|
201
224
|
* appends, atomic single-line records. Single-instance / TOC-local: a cross-replica TiDB/PG port is a follow-on
|
|
202
225
|
* (the recovery sweep + gate are backend-agnostic).
|
|
203
226
|
*
|
|
204
|
-
* 追加 / 重放走本仓 JSONL 店的**共用口**(
|
|
227
|
+
* 追加 / 重放走本仓 JSONL 店的**共用口**([ref];此前是第二 / 第三份私有实现):追加 = core `AppendLog`(惰性打开;单条 `writeSync`
|
|
205
228
|
* 循环写满、失败的写截回开写处;**撕尾在打开与每次追加前修**,所以崩在一次 append 中途之后的下一条成功写不会被粘进残尾),
|
|
206
229
|
* 重放 = `replayJsonlSkipping`(登记座 `workflow-notify-journal`:中间坏行跳过 + 逐条披露 + F tag;撕尾不计 —— 它是崩溃的正常落盘形;
|
|
207
230
|
* 末行 JSON 完整但缺换行的认下、下一次追加补换行)。盘上字节 / 0o600 账本 / 0o700 目录与修前逐字同,升级零迁移。
|
|
@@ -274,7 +297,7 @@ export declare class JournalingWorkflowRunStore implements WorkflowRunStore {
|
|
|
274
297
|
/** MF-Fleet (data contract): publish the workflow's fleet row on every put/update (the same write-observation
|
|
275
298
|
* point as the notify journal). Optional — undefined ⇒ no fleet publish. */
|
|
276
299
|
private readonly fleetBus?;
|
|
277
|
-
/**
|
|
300
|
+
/** [ref] 车CM:workflow 出身 park 的 join 索引。**本装饰器是它全仓唯一的写者** —— 索引是 `WorkflowRun`
|
|
278
301
|
* 的派生投影,写点必须与 fleet 行投影/notify journal 同一个(见 index 模块的文件头「单写者」段)。
|
|
279
302
|
* 可选:缺席 ⇒ 一位不维护(与 fleet 半场同姿势,行为逐字不变)。 */
|
|
280
303
|
private readonly agentSessionIndex?;
|
|
@@ -287,7 +310,7 @@ export declare class JournalingWorkflowRunStore implements WorkflowRunStore {
|
|
|
287
310
|
/** MF-Fleet (data contract): publish the workflow's fleet row on every put/update (the same write-observation
|
|
288
311
|
* point as the notify journal). Optional — undefined ⇒ no fleet publish. */
|
|
289
312
|
fleetBus?: FleetEventBus | undefined,
|
|
290
|
-
/**
|
|
313
|
+
/** [ref] 车CM:workflow 出身 park 的 join 索引。**本装饰器是它全仓唯一的写者** —— 索引是 `WorkflowRun`
|
|
291
314
|
* 的派生投影,写点必须与 fleet 行投影/notify journal 同一个(见 index 模块的文件头「单写者」段)。
|
|
292
315
|
* 可选:缺席 ⇒ 一位不维护(与 fleet 半场同姿势,行为逐字不变)。 */
|
|
293
316
|
agentSessionIndex?: WorkflowAgentSessionIndex | undefined);
|
|
@@ -328,4 +351,5 @@ export declare class JournalingWorkflowRunStore implements WorkflowRunStore {
|
|
|
328
351
|
keep?: number;
|
|
329
352
|
}): Promise<number>;
|
|
330
353
|
}
|
|
354
|
+
export {};
|
|
331
355
|
//# sourceMappingURL=workflow-notify-journal.d.ts.map
|
|
@@ -5,6 +5,21 @@ import { isTerminalWorkflowRowStatus, seedTerminalWorkflowRow } from "../fleet/f
|
|
|
5
5
|
import { buildParkSessionRows } from "./workflow-agent-session-index.js";
|
|
6
6
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
7
7
|
import { replayJsonlSkipping } from "../observability/corrupt-read-seat.js";
|
|
8
|
+
export const WORKFLOW_NOTIFY_KEY_DISPOSITION = {
|
|
9
|
+
runId: "carry",
|
|
10
|
+
status: "carry",
|
|
11
|
+
summary: "carry",
|
|
12
|
+
sourceTaskId: "carry",
|
|
13
|
+
principal: "carry",
|
|
14
|
+
originatingSessionId: "carry",
|
|
15
|
+
completionId: "carry",
|
|
16
|
+
task_id: "drop",
|
|
17
|
+
task_type: "drop",
|
|
18
|
+
toolUseId: "drop",
|
|
19
|
+
result: "drop",
|
|
20
|
+
usage: "drop",
|
|
21
|
+
diagnostics: "drop",
|
|
22
|
+
};
|
|
8
23
|
const SUMMARY_MAX = 500;
|
|
9
24
|
export function recoverySummary(status, error) {
|
|
10
25
|
if (status === "completed")
|
|
@@ -65,6 +80,7 @@ export class WorkflowNotifyGate {
|
|
|
65
80
|
...(input.sourceTaskId ? { sourceTaskId: input.sourceTaskId } : {}),
|
|
66
81
|
...(input.principal ? { principal: input.principal } : {}),
|
|
67
82
|
...(input.originatingSessionId ? { originatingSessionId: input.originatingSessionId } : {}),
|
|
83
|
+
...(input.completionId ? { completionId: input.completionId } : {}),
|
|
68
84
|
}, input.scope ?? input.principal ?? "default");
|
|
69
85
|
},
|
|
70
86
|
};
|
|
@@ -151,6 +167,7 @@ export class WorkflowNotifyGate {
|
|
|
151
167
|
...(sourceTaskId ? { sourceTaskId } : {}),
|
|
152
168
|
...(principal ? { principal } : {}),
|
|
153
169
|
...(originatingSessionId ? { originatingSessionId } : {}),
|
|
170
|
+
...(run.completionId ? { completionId: run.completionId } : {}),
|
|
154
171
|
}, entry.scope);
|
|
155
172
|
const after = await this.journal.get(entry.runId);
|
|
156
173
|
if (after?.acked)
|