@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
package/dist/http/send.d.ts
CHANGED
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
* no longer exists, so quoting its line numbers here would point at nothing). `server.ts`
|
|
8
8
|
* now imports them from here, so all ~500 existing `sendJson(...)` call sites are unchanged text.
|
|
9
9
|
*/
|
|
10
|
-
import type { ServerResponse } from "node:http";
|
|
10
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
11
11
|
import { type SessionErrorFace } from "../session-error-wire.js";
|
|
12
|
-
import type {
|
|
12
|
+
import type { Logger } from "../observability/logger.js";
|
|
13
|
+
import { type HttpError } from "../security.js";
|
|
13
14
|
import { type Refusal, type RefusalBody } from "./refusal-body.js";
|
|
14
15
|
/**
|
|
15
16
|
* [ref](黑板 [ref]②)—— 一条响应「是 SSE 流」的**在场标记**。
|
|
@@ -72,6 +73,20 @@ export declare function sendJson(res: ServerResponse, status: number, body: unkn
|
|
|
72
73
|
* where `error`/`errorCode` aren't cleanly separable from the rest of the body, are left on raw
|
|
73
74
|
* `sendJson` (see the A6 migration notes for the callers still doing that on purpose). */
|
|
74
75
|
export declare function sendError(res: ServerResponse, status: number, errorCode: string, message: string, extra?: Readonly<Record<string, unknown>>): void;
|
|
76
|
+
/** `request.invalid_json` 的机读 `reason`(闭集两词):`not_json` = 体不是合法 JSON;`not_object` = 是合法 JSON,但这一口要的是对象。 */
|
|
77
|
+
export declare const INVALID_JSON_REASONS: readonly ["not_json", "not_object"];
|
|
78
|
+
export type InvalidJsonReason = (typeof INVALID_JSON_REASONS)[number];
|
|
79
|
+
/** 每个 `reason` 的句子(wire 文案,冻结在 `test/api-error-text-freeze.test.ts` 的常量锚格;句子由 `reason` 定,调用点不另写一句)。 */
|
|
80
|
+
export declare const INVALID_JSON_MESSAGES: {
|
|
81
|
+
readonly not_json: "invalid JSON body";
|
|
82
|
+
readonly not_object: "body must be a JSON object when present";
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* 请求体不是这一口要的 JSON ⇒ 400 `request.invalid_json` + `reason`。**全仓唯一铸这个码的地方**:请求体读取器(`request-guards.ts` 的 `readJson`,体不是合法 JSON)与要求对象体的口
|
|
86
|
+
* (体是合法 JSON、却不是对象)都经它抛 / 渲;路由域不再各自在本地 catch 里自铸同一个码(那些回落臂在读取器抛无码 `HttpError` 的年月里恒不可达,
|
|
87
|
+
* 且裸 catch 会把读取器的 413 一并折成「JSON 非法」)。
|
|
88
|
+
*/
|
|
89
|
+
export declare function invalidJsonError(reason: InvalidJsonReason): HttpError;
|
|
75
90
|
/** B7([ref] lens1 §C3):`HttpError` 的兜底 catch-all 站点没有自己的语义分支——`err.code` 在 42 个
|
|
76
91
|
* throw 点里只有 3 个带。为了让「errorCode 恒在」在这些站点也成立(而不是靠豁免表放行),按**状态码**
|
|
77
92
|
* 给一个诚实的粗码:它只声明「这类拒绝」,不冒充比 throw 点更细的语义。带 `code` 的 throw 点原样优先。 */
|
|
@@ -102,11 +117,17 @@ export declare function sendSessionPolicyError(res: ServerResponse, e: unknown,
|
|
|
102
117
|
* 回 `true` = 已应答,调用点 `return`;`false` = 不是 `SessionError`,或这个词在这一面上是登记过的留白(站点的既有
|
|
103
118
|
* 处置照旧 —— 通常是继续上抛到全局兜底)。
|
|
104
119
|
*
|
|
105
|
-
* 句子:属主给了固定句就发它(import 面 `invalid_session`
|
|
120
|
+
* 句子:属主给了固定句就发它(import 面 `invalid_session` / `placement_refused` 两句),否则发 core 的原句过既有脱敏(`redactErrorMessage`:
|
|
106
121
|
* 不抛、有上限)。core 的 `corrupt_session` 原句只点名会话 id 与跳过计数(「Session <id> is unreadable: its log has no
|
|
107
122
|
* meta header (N of M records skipped as corrupt)」),SQL 两店的原句点名 `<表>.<列>` 与行号 —— 两者都不含盘上路径
|
|
108
123
|
* (路径只进运维面:`server.session-repo.corrupt-record-skipped` 的探针行,S-990;SQL 两店走各自的拒绝句)。
|
|
109
124
|
*/
|
|
110
125
|
export declare function sendSessionError(res: ServerResponse, e: unknown, face: SessionErrorFace): boolean;
|
|
111
126
|
export declare function msg(e: unknown): string;
|
|
127
|
+
/**
|
|
128
|
+
* 路由抛出的未归类错误的运维行 `request_error` —— **唯一写者**。外层兜底(`server.ts`)与「就地经映射下发」的站点(会话同步的暂存提交 catch)同调它:
|
|
129
|
+
* 后者在兜底之前就把错误换成了有名字的应答,不经这一行的话,被映射接走的错误(如提交门抛的 `corrupt_session`,句子点名表列与行号)会从服务端日志里消失。
|
|
130
|
+
* codex r10 [high] 纵深:错误句可带凭据回显 ⇒ 先过 `redactHead`(有上限、不抛)。
|
|
131
|
+
*/
|
|
132
|
+
export declare function logRequestError(logger: Logger | undefined, req: IncomingMessage, err: unknown): void;
|
|
112
133
|
//# sourceMappingURL=send.d.ts.map
|
package/dist/http/send.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SessionError, SessionPolicyError } from "@sema-agent/core";
|
|
2
2
|
import { sessionPolicyErrorFacts, sessionPolicyErrorHttp, sessionPolicyErrorSentence } from "../session-policy-wire.js";
|
|
3
3
|
import { sessionErrorHttp } from "../session-error-wire.js";
|
|
4
|
-
import { redactErrorMessage } from "../observability/run-terminal.js";
|
|
4
|
+
import { redactErrorMessage, redactHead } from "../observability/run-terminal.js";
|
|
5
|
+
import { createCodedHttpError } from "../security.js";
|
|
5
6
|
import { refusalBody } from "./refusal-body.js";
|
|
6
7
|
export const SSE_RESPONSE_MARK = Symbol("sema.http.sse-response");
|
|
7
8
|
export function isSseResponse(res) {
|
|
@@ -34,6 +35,14 @@ export function sendJson(res, status, body) {
|
|
|
34
35
|
export function sendError(res, status, errorCode, message, extra) {
|
|
35
36
|
sendJson(res, status, refusalBody(extra === undefined ? { errorCode, message } : { errorCode, message, facts: extra }));
|
|
36
37
|
}
|
|
38
|
+
export const INVALID_JSON_REASONS = ["not_json", "not_object"];
|
|
39
|
+
export const INVALID_JSON_MESSAGES = {
|
|
40
|
+
not_json: "invalid JSON body",
|
|
41
|
+
not_object: "body must be a JSON object when present",
|
|
42
|
+
};
|
|
43
|
+
export function invalidJsonError(reason) {
|
|
44
|
+
return createCodedHttpError(400, "request.invalid_json", INVALID_JSON_MESSAGES[reason], { reason });
|
|
45
|
+
}
|
|
37
46
|
export function httpErrorCode(status, code) {
|
|
38
47
|
if (code)
|
|
39
48
|
return code;
|
|
@@ -73,10 +82,13 @@ export function sendSessionError(res, e, face) {
|
|
|
73
82
|
const wire = sessionErrorHttp(e.code, face);
|
|
74
83
|
if (wire === undefined)
|
|
75
84
|
return false;
|
|
76
|
-
sendError(res, wire.status, wire.errorCode, wire.sentence ?? redactErrorMessage(e.message) ?? "session store error");
|
|
85
|
+
sendError(res, wire.status, wire.errorCode, wire.sentence ?? redactErrorMessage(e.message) ?? "session store error", wire.detail === undefined ? undefined : { detail: wire.detail });
|
|
77
86
|
return true;
|
|
78
87
|
}
|
|
79
88
|
export function msg(e) {
|
|
80
89
|
return e instanceof Error ? e.message : String(e);
|
|
81
90
|
}
|
|
91
|
+
export function logRequestError(logger, req, err) {
|
|
92
|
+
logger?.error("request_error", { method: req.method, url: req.url, err: redactHead(msg(err), 2000) });
|
|
93
|
+
}
|
|
82
94
|
//# sourceMappingURL=send.js.map
|
package/dist/http/server.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import type { RunStore, ImageIndex, ImageBake, CheckpointStoreFull, ResumeAnchor
|
|
|
10
10
|
import type { RuleConsentLane } from "../rules-consent.js";
|
|
11
11
|
import { type MemorySyncRequest, type MemorySyncResponse } from "../memory-sync.js";
|
|
12
12
|
import type { TaskAttachmentStore } from "../plugins/task-attachment-store.js";
|
|
13
|
-
import type { SqlBlobCapReading } from "../plugins/blob-backend.js";
|
|
14
13
|
import type { LeaderEndpoint } from "../leader/endpoint.js";
|
|
15
14
|
import { type WorkflowAgentRegistry } from "../orchestration/workflow-agent-steer.js";
|
|
16
15
|
import type { SubagentSteerRegistry } from "../orchestration/subagent-steer.js";
|
|
@@ -38,8 +37,8 @@ import { MAX_SKILL_CONTENT_CHARS, MAX_SYSTEM_PROMPT_CHARS, MAX_OUTPUT_SCHEMA_CHA
|
|
|
38
37
|
import { routeLabel, isBillableSubmitPath, isCredentialGatedRewrite, isMethodDispatchedSubmitPath } from "./route-table.js";
|
|
39
38
|
export { routeLabel, isBillableSubmitPath, isCredentialGatedRewrite, isMethodDispatchedSubmitPath, hasServiceAuth };
|
|
40
39
|
export { MAX_SKILL_CONTENT_CHARS, MAX_SYSTEM_PROMPT_CHARS, MAX_OUTPUT_SCHEMA_CHARS, validateUserSkills };
|
|
41
|
-
import { explicitOperatorOk,
|
|
42
|
-
export { explicitOperatorOk
|
|
40
|
+
import { explicitOperatorOk, hasServiceAuth } from "./principal-gate.js";
|
|
41
|
+
export { explicitOperatorOk };
|
|
43
42
|
/** Per-request authorization context resolved before building the spec (identity, owned session). */
|
|
44
43
|
export interface RequestAuth {
|
|
45
44
|
principal?: string;
|
|
@@ -209,6 +208,10 @@ export interface ServiceStoreDeps {
|
|
|
209
208
|
* (boot/workflow-orchestration.ts);任一缺席 = 那条车道不存在(workflow 出身的 park 落 legacy 腿,
|
|
210
209
|
* 与本批之前逐字同形)。契约与单写者纪律的属主 = orchestration/workflow-agent-session-index.ts。 */
|
|
211
210
|
workflowAgentSessionIndex?: import("../orchestration/workflow-agent-session-index.js").WorkflowAgentSessionIndex;
|
|
211
|
+
/** workflow 子代停驻卡的耐久决定行(一张卡一行,键 = 子代 checkpoint 的 token):写者 = `/decide` 的 workflow 车道,读者 = 每一只起跑器开跑前的那一只读者。
|
|
212
|
+
* 必须绑在 `runStore` 这一只上(与它同出一个 store backend:`run()` / `workflowParkDecisions()`);park 索引与 run 店都在时必填 ——
|
|
213
|
+
* 起服判官 `parkDecisionStoreRefusal` 判。契约与律的属主 = orchestration/workflow-park-decision.ts。 */
|
|
214
|
+
workflowParkDecisions?: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore;
|
|
212
215
|
/** [ref] journal 读面(PAIR-REVIEW 修车批):GET /v1/workflows/:runId/journal 的数据源——与 runner 侧
|
|
213
216
|
* workflowJournalStore 同一实例(main.ts backend.workflowJournal());缺席=501(与 workflowRunStore 同门)。 */
|
|
214
217
|
workflowJournalStore?: import("@sema-agent/core").WorkflowJournalStore;
|
|
@@ -315,9 +318,7 @@ export interface ServiceCoordinatorDeps {
|
|
|
315
318
|
* LEADER_ENABLED + the leader wiring (e2b workers + git push) is configured. */
|
|
316
319
|
leaderEndpoint?: LeaderEndpoint;
|
|
317
320
|
/** Fire-and-forget session auto-titler (first-submit hook; absent = feature dark). */
|
|
318
|
-
sessionTitler?:
|
|
319
|
-
maybeTitle(sessionId: string, objective: string, model?: string): void;
|
|
320
|
-
};
|
|
321
|
+
sessionTitler?: import("../session-titler.js").SessionTitler;
|
|
321
322
|
}
|
|
322
323
|
/** **函数/构件缝**:main.ts 把跨多个子系统的动作编译成一个可调用面交给路由(路由不该自己
|
|
323
324
|
* 重组零件——见 backend 的同款论证)。parked-revive 三件是同族的构件缝(boot 期从生产装配取的裸
|
|
@@ -567,6 +568,10 @@ export interface ServiceSeamDeps {
|
|
|
567
568
|
* 🔴 缺席 ⇒ `/v1/shared-memory/*` 整域不挂载(诚实缺席);挂载还另要 {@link orgMemoryDirectory}
|
|
568
569
|
* 在场 —— 没有成员性判据的读面只能全放或全拒,两个都比「这个面不存在」差。 */
|
|
569
570
|
sharedMemoryStore?: import("@sema-agent/core").SharedMemoryStoreProvider;
|
|
571
|
+
/** [ref] §10.2 —— 跨主体投递门(`createOrgDeliveryGate` 的产物,`boot/stage-06-runners.ts` 装配的唯一实例)。
|
|
572
|
+
* `POST /v1/principal-inbox/messages` 只经它投递;缺席 = 本部署没声明收件箱消费方(`PRINCIPAL_INBOX_ASSISTANT` 未设)⇒
|
|
573
|
+
* 那一口 501、能力位 `principalInboxDelivery` false(同读事实 `principalInboxDelivery`)。 */
|
|
574
|
+
orgDeliveryGate?: import("@sema-agent/core").OrgDeliveryGate;
|
|
570
575
|
/** WEB-SETUP-RECON 附B — org sessionMirror 治理态的 SERVICE 半场 = **观测面(audit),非执法面**。
|
|
571
576
|
* 裁定 (c):「该镜像而未镜像」发生在数据产生端(壳)——本 server 是镜像**目标**,只看得见到达的 push;
|
|
572
577
|
* 没到达的会话对 server 不存在(无客户端会话清单、无心跳契约),required 锁的真执法只能在壳(CC
|
|
@@ -726,6 +731,9 @@ export interface ServiceDeploymentDeps {
|
|
|
726
731
|
* `buildCenterCredentialHealthView` 铸形,只有闭集词 / 时刻 / 计数,不带路径与令牌)。缺席 / 返回 undefined = 健康或没有中心
|
|
727
732
|
* ⇒ `/health` 形状逐字不变(additive)。 */
|
|
728
733
|
centerCredentialState?: () => import("../center-credential-renewer.js").CenterCredentialHealthView | undefined;
|
|
734
|
+
/** S-667:`/health.centerIdentityNotice` —— 中心凭证换人后的**最近一条**两态通告(`center-config-tier.ts` 铸:`{ code, message, at }`,码闭集两词、句冻结)。取值口交出的
|
|
735
|
+
* 就是 wire 形,`/health` 不另投影;无鉴权面,只有码 / 冻结句 / 时刻。缺席 / 返回 undefined = 从未换过人或没有中心 ⇒ `/health` 形状逐字不变(additive)。 */
|
|
736
|
+
centerIdentityNoticeState?: () => import("../center-config-tier.js").CenterIdentityNotice | undefined;
|
|
729
737
|
/** S-768:模型拒因信号(`/health.modelRefusals`,settings-schema 6.2.0 `ModelRefusalsSignal` 形:名 → 码 + 组拒码)。fleet 心跳读**这同一只**
|
|
730
738
|
* (`boot/stage-10-http-server.ts` → `modelRefusals: () => deployment.modelRefusalsState?.()`)—— 一处铸、两出口。缺席 / 返回 undefined =
|
|
731
739
|
* 没有可报的拒或没有配置管道 ⇒ `/health` 形状逐字不变(additive)。 */
|
|
@@ -780,8 +788,8 @@ export interface ServiceDeploymentDeps {
|
|
|
780
788
|
/** S-131:SQL **引擎读口**(`sql-engine-posture.ts` 的单一推导点 —— boot 期借一条池连接触发驱动的连接初始化,交回本池的驱动:
|
|
781
789
|
* `dialect`(SQL 文本轴,恒在)+ 活的 `facts`(`SET` 之后**回读复核**过的真值;池重连后驱动会重新初始化并刷新,快照会说谎)。
|
|
782
790
|
* 读者:`GET /v1/diagnostics/wiring` 的 `sqlEngine` 段(operator-only,全量含版本与两堵墙)与 `GET /v1/capabilities` 的 `store.sql` 位(窄投影;
|
|
783
|
-
* 7.106.0 前是顶层 `sql`,S-866 ①)读 `facts`;提交受理口的 413 把整只读口交给唯一判官 `sql-driver.ts` `sqlWallsOf`(
|
|
784
|
-
* `
|
|
791
|
+
* 7.106.0 前是顶层 `sql`,S-866 ①)读 `facts`;提交受理口的 413 把整只读口交给唯一判官 `sql-driver.ts` `sqlWallsOf`(墙的方言只从这里来(与事实同出一只驱动),不另从店后端读);其中包墙是连接级事实 ——
|
|
792
|
+
* 这里的包墙是最近一次初始化的那条连接的读数,受理口那一腿是同一只规则的提前一跑,终判在将要执行写入的那条连接上(`sql-driver.ts` `connectJudged`;SQL 快照 blob 的店判与 `PUT /sync/blobs` 的 413 来自它)。
|
|
785
793
|
* 两种缺席、两个值:**席缺席** = 本部署没有 SQL 后端(env-only worker、local 文件后端);**`facts` 是 `null`** = 有 SQL 后端、但事实此刻没建立
|
|
786
794
|
* (池上最近一次连接初始化被拒,驱动当场作废了事实)。两者在两个读面上都报缺席(诚实缺席,不铸空壳);墙按方言读后者(MySQL 协议 ⇒ 最保守的假定墙)。
|
|
787
795
|
* 7.132.0 前这一席是 `sqlEngineFacts: () => SqlEngineFacts | null`(只给事实、不给方言);照旧传它 ⇒ `createHttpServer` 起服拒。
|
|
@@ -826,15 +834,6 @@ export interface ServiceDeploymentDeps {
|
|
|
826
834
|
}
|
|
827
835
|
/** **数值旋钮**:部署可调的上限/拍距。缺省值写在消费点(`?? 256` 之类),此处只承载覆写。 */
|
|
828
836
|
export interface ServiceKnobDeps {
|
|
829
|
-
/** (a)(clay 拍 a+c,2026-07-27)当快照 blob 走 SQL 默认店时(逃生口形/覆写形),该店的 per-blob
|
|
830
|
-
* 承载帽的**读口**——PUT /sync/blobs 面每个请求调一次、据此**前置 413**(typed `blob_too_large_for_sql`)。
|
|
831
|
-
* 键缺席=不前置(MinIO 形无帽);读口答 `undefined`=此刻没有墙(pg 形)=不前置。读口而非数字:帽由库报的墙推导,
|
|
832
|
-
* 库调墙、池连接换代后活事实会变,门限必须跟着变(与店写口 `SqlBlobBackend` 读同一份池级事实、同一只函数
|
|
833
|
-
* `sqlBlobCapOf`)。读口答的是**帽 + 它的出处**(`{ capBytes, source }`,`source` ∈ `operator` / `reported` / `assumed`,见 `SqlBlobCapReading`):
|
|
834
|
-
* 413 的句子与机读位 `wallSource` 按出处分三形(运维旋钮 / 库报的墙 / 假定的墙),不把假定或运维的旋钮说成库的上限。
|
|
835
|
-
* 为什么在 HTTP 面重复店里的检查:店的 never-throw 结果形把一切写失败折成 502,而 502
|
|
836
|
-
* 语义=可重试,对端会对一个永远过不去的 blob 无限重试——413 才是「别再送了」的诚实形。 */
|
|
837
|
-
snapshotBlobSqlCap?: () => SqlBlobCapReading | undefined;
|
|
838
837
|
/** [ref] SSE 连接帽(缺省 256/副本;超限 503+Retry-After=消费方回落 /head 轮询)。 */
|
|
839
838
|
sessionEventsMaxConnections?: number;
|
|
840
839
|
/** [ref] SSE 心跳/owner 复核拍距 ms(缺省 25s;测试注入用)。 */
|
|
@@ -862,7 +861,7 @@ export declare function flattenServiceDeps(deps: ServiceDeps): FlatServiceDeps;
|
|
|
862
861
|
/** The TRUSTED end-user principal for an owner-gated / per-tenant request. On a direct-door worker the
|
|
863
862
|
* trusted-header path is OFF (x-agent-principal is client-self-asserted), so identity comes from the crypto-VERIFIED
|
|
864
863
|
* principal JWT (`x-approval-principal-token`, principal-only proof — no cnf.bnd action binding); otherwise the
|
|
865
|
-
* BFF-minted trusted header. undefined when absent/invalid (fail-closed → callers map to 401
|
|
864
|
+
* BFF-minted trusted header. undefined when absent/invalid (fail-closed → callers map to 401, or to the anonymous scope `"_"` on the approval queue faces).
|
|
866
865
|
* 🔴 Use this for ANY endpoint that reads or gates PER-TENANT data — NOT `principalFrom` directly, which trusts
|
|
867
866
|
* the self-asserted header on a direct door (/v1/usage + the trace owner-gate
|
|
868
867
|
* had drifted to a bare principalFrom, unlike the leader/images/approvals identity paths). One source of truth
|
package/dist/http/server.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import http from "node:http";
|
|
2
2
|
import { outwardPlane } from "../terminal.js";
|
|
3
|
-
import { redactHead } from "../observability/run-terminal.js";
|
|
4
3
|
import { validatePendingSteer } from "@sema-agent/core";
|
|
5
4
|
import {} from "../web-admin-client/facade.js";
|
|
6
5
|
import { describeValueShape } from "@sema-agent/settings-schema";
|
|
@@ -18,9 +17,11 @@ import { cascadeConfig } from "./run-meta.js";
|
|
|
18
17
|
export { cascadeConfig };
|
|
19
18
|
import { coarseStatusForState, errorCodeForExit } from "./routes/images.js";
|
|
20
19
|
export { coarseStatusForState, errorCodeForExit };
|
|
21
|
-
import { sendError, sendHttpError, sendSessionError,
|
|
20
|
+
import { sendError, sendHttpError, sendSessionError, logRequestError } from "./send.js";
|
|
22
21
|
import { createRequestGuards } from "./request-guards.js";
|
|
23
22
|
import { sqlEngineSeatIssue } from "../sql-engine-posture.js";
|
|
23
|
+
import { parkDecisionStoreRefusal } from "../orchestration/workflow-park-decision.js";
|
|
24
|
+
import { retiredServiceDepsRefusal } from "./retired-service-deps.js";
|
|
24
25
|
import { createAdmission, MAX_SKILL_CONTENT_CHARS, MAX_SYSTEM_PROMPT_CHARS, MAX_OUTPUT_SCHEMA_CHARS, validateUserSkills } from "./admission.js";
|
|
25
26
|
import { createResumeLegs } from "./resume-legs.js";
|
|
26
27
|
import * as facts from "../capability-facts.js";
|
|
@@ -29,8 +30,8 @@ import { routeLabel, isBillableSubmitPath, isCredentialGatedRewrite, isMethodDis
|
|
|
29
30
|
import { createApprovalSweeps } from "./approval-sweeps.js";
|
|
30
31
|
export { routeLabel, isBillableSubmitPath, isCredentialGatedRewrite, isMethodDispatchedSubmitPath, hasServiceAuth };
|
|
31
32
|
export { MAX_SKILL_CONTENT_CHARS, MAX_SYSTEM_PROMPT_CHARS, MAX_OUTPUT_SCHEMA_CHARS, validateUserSkills };
|
|
32
|
-
import { explicitOperatorOk,
|
|
33
|
-
export { explicitOperatorOk
|
|
33
|
+
import { explicitOperatorOk, hasServiceAuth } from "./principal-gate.js";
|
|
34
|
+
export { explicitOperatorOk };
|
|
34
35
|
class DrainYieldingPreemptBook extends Map {
|
|
35
36
|
drainingNow;
|
|
36
37
|
constructor(drainingNow) {
|
|
@@ -59,14 +60,10 @@ export function createHttpServer(rawDeps) {
|
|
|
59
60
|
if (typeof deps.runnerFor !== "function") {
|
|
60
61
|
throw new Error("createHttpServer: the runnerFor seat is required (it picks each task's Runner from its execution lane) — pass the hands-lane selector, or `runnerFor: () => runner` for a single-Runner embedding; refusing to start rather than run every task on the widest Runner");
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
throw new Error(`createHttpServer: snapshotBlobSqlCap must be a reader \`() => { capBytes, source } | undefined\` (called on every PUT /v1/sessions/:id/sync/blobs/:hash), got ${typeof deps.snapshotBlobSqlCap} — pass the reader (or \`() => undefined\` for no cap), or leave it unset; refusing to start rather than answer every blob upload with a 500`);
|
|
67
|
-
}
|
|
68
|
-
if (deps.sqlEngineFacts !== undefined) {
|
|
69
|
-
throw new Error("createHttpServer: sqlEngineFacts was replaced by sqlEngine in 7.132.0 — pass the SQL pool's engine reading as sqlEngine: `{ dialect: \"tidb\" | \"pg\", facts }` where `facts` is read live (a getter) and is null while the pool's connection setup has not succeeded, or leave both unset when there is no SQL store; refusing to start rather than run the submit admission without the database's walls");
|
|
63
|
+
{
|
|
64
|
+
const retired = retiredServiceDepsRefusal(deps);
|
|
65
|
+
if (retired !== undefined)
|
|
66
|
+
throw new Error(retired);
|
|
70
67
|
}
|
|
71
68
|
{
|
|
72
69
|
const issue = sqlEngineSeatIssue(deps.backend, deps.sqlEngine);
|
|
@@ -83,6 +80,11 @@ export function createHttpServer(rawDeps) {
|
|
|
83
80
|
}
|
|
84
81
|
}
|
|
85
82
|
}
|
|
83
|
+
{
|
|
84
|
+
const refusal = parkDecisionStoreRefusal(deps);
|
|
85
|
+
if (refusal !== undefined)
|
|
86
|
+
throw new Error(`createHttpServer: ${refusal}`);
|
|
87
|
+
}
|
|
86
88
|
const idemCache = new IdempotencyCache();
|
|
87
89
|
const inflightRuns = new Map();
|
|
88
90
|
const preemptableRuns = new DrainYieldingPreemptBook(() => deps.drainState?.draining === true);
|
|
@@ -152,7 +154,7 @@ export function createHttpServer(rawDeps) {
|
|
|
152
154
|
res.end();
|
|
153
155
|
return;
|
|
154
156
|
}
|
|
155
|
-
deps.logger
|
|
157
|
+
logRequestError(deps.logger, req, err);
|
|
156
158
|
if (res.headersSent) {
|
|
157
159
|
res.end();
|
|
158
160
|
return;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { REQUEST_SETTINGS_REFUSAL_PREFIX, rulePolicyBucketsRefusal, settingsPermissionBucketIssue, storedBodyPermissionMode } from "../task-settings.js";
|
|
1
|
+
import { REQUEST_SETTINGS_REFUSAL_PREFIX, SETTINGS_RULE_REFUSAL_CODE, neverAutoNamesRefusal, rulePolicyBucketsRefusal, settingsPermissionBucketIssue, storedBodyPermissionMode } from "../task-settings.js";
|
|
2
|
+
import { readTightenOnlySeats, tightenOnlySeatField, tightenOnlySeatIssue } from "../tighten-only-seats.js";
|
|
3
|
+
import { entryProblemsFacts } from "../entry-problems.js";
|
|
2
4
|
import { autonomyModeFloor, entryPermissionMode } from "../runtime-governance.js";
|
|
3
5
|
import { inertToolListEntryOf, replayInertEntry } from "../rule-entry-list.js";
|
|
4
6
|
import { executionLaneHomeDir } from "../execution-lane-caps.js";
|
|
5
|
-
import { httpErrorCode } from "./send.js";
|
|
6
7
|
import { allowListReadingEraOf, allowListReadingUnstated, permissionModeReadingStated } from "./checkpoint-ctx.js";
|
|
7
8
|
export function permissionModeReadingUnstated(ctx, floor) {
|
|
8
9
|
if (floor === undefined || permissionModeReadingStated(ctx))
|
|
@@ -21,19 +22,31 @@ function storedPermissionBucketRefusal(body) {
|
|
|
21
22
|
return undefined;
|
|
22
23
|
return replayInertEntry(issue.fields.field, issue.fields.field === "settings.permissions.allow" ? "allow" : "deny", BUCKET_GATE_CODE, issue.message, { ...issue.fields });
|
|
23
24
|
}
|
|
25
|
+
function storedTightenOnlySeatRefusal(body) {
|
|
26
|
+
const issue = tightenOnlySeatIssue(body?.settings);
|
|
27
|
+
if (issue === null)
|
|
28
|
+
return undefined;
|
|
29
|
+
return replayInertEntry(tightenOnlySeatField(issue.seat), "deny", BUCKET_GATE_CODE, issue.message, { ...issue.fields });
|
|
30
|
+
}
|
|
24
31
|
function storedRulePolicyRefusal(body, deployment) {
|
|
25
32
|
const permissions = storedPermissions(body);
|
|
26
33
|
if (permissions === undefined)
|
|
27
34
|
return undefined;
|
|
28
35
|
const home = executionLaneHomeDir(deployment);
|
|
29
36
|
const refused = rulePolicyBucketsRefusal({ ...(Array.isArray(permissions["ask"]) ? { ask: permissions["ask"] } : {}), ...(Array.isArray(permissions["deny"]) ? { deny: permissions["deny"] } : {}) }, home !== undefined ? { home } : {});
|
|
30
|
-
|
|
37
|
+
if (refused !== undefined)
|
|
38
|
+
return replayInertEntry(`settings.permissions.${refused.bucket}`, "deny", SETTINGS_RULE_REFUSAL_CODE, `${REQUEST_SETTINGS_REFUSAL_PREFIX}${refused.message}`, { ...entryProblemsFacts(refused.problems) });
|
|
39
|
+
const neverAuto = readTightenOnlySeats({ permissions }).values.neverAuto;
|
|
40
|
+
if (neverAuto === undefined)
|
|
41
|
+
return undefined;
|
|
42
|
+
const neverAutoRefused = neverAutoNamesRefusal(neverAuto);
|
|
43
|
+
return neverAutoRefused === undefined ? undefined : replayInertEntry(tightenOnlySeatField("neverAuto"), "deny", SETTINGS_RULE_REFUSAL_CODE, `${REQUEST_SETTINGS_REFUSAL_PREFIX}${neverAutoRefused.message}`, { ...entryProblemsFacts(neverAutoRefused.problems) });
|
|
31
44
|
}
|
|
32
45
|
export function storedBodyReplayRefusal(ctx, deployment) {
|
|
33
46
|
const writer = ctx.writerVersion !== undefined ? { writerVersion: ctx.writerVersion } : {};
|
|
34
47
|
if (allowListReadingUnstated(ctx))
|
|
35
48
|
return { kind: "allow_list_reading", era: allowListReadingEraOf(ctx), ...writer };
|
|
36
|
-
const entry = storedPermissionBucketRefusal(ctx.body) ?? inertToolListEntryOf(ctx.body, ["deny"]) ?? storedRulePolicyRefusal(ctx.body, deployment);
|
|
49
|
+
const entry = storedPermissionBucketRefusal(ctx.body) ?? storedTightenOnlySeatRefusal(ctx.body) ?? inertToolListEntryOf(ctx.body, ["deny"]) ?? storedRulePolicyRefusal(ctx.body, deployment);
|
|
37
50
|
if (entry !== undefined)
|
|
38
51
|
return { kind: "inert_tool_list", entry };
|
|
39
52
|
const mode = permissionModeReadingUnstated(ctx, autonomyModeFloor(deployment.autonomy));
|
package/dist/http/submit-ctx.js
CHANGED
|
@@ -2,14 +2,15 @@ import { StoreRowTooLargeError } from "../plugins/sql-errors.js";
|
|
|
2
2
|
import { releaseClaimedRun } from "./claimed-run.js";
|
|
3
3
|
import { buildCheckpointCtx } from "./checkpoint-ctx.js";
|
|
4
4
|
import { refusalBody } from "./refusal-body.js";
|
|
5
|
+
import { limitFactsUnmeasured } from "../limit-refusal.js";
|
|
5
6
|
function rowTooLargeRefusal(tooLarge) {
|
|
6
7
|
switch (tooLarge.wall) {
|
|
7
8
|
case "row":
|
|
8
|
-
return { status: 413, body: refusalBody({ errorCode: "request.payload_too_large", message: `the database refused to store this task: it is larger than the database keeps in one row (${tooLarge.dbMessage}) — nothing was run; shrink the inline images / userAttachments, or ask the operator to raise the database's single-row limit (TiDB performance.txn-entry-size-limit)
|
|
9
|
+
return { status: 413, body: refusalBody({ errorCode: "request.payload_too_large", message: `the database refused to store this task: it is larger than the database keeps in one row (${tooLarge.dbMessage}) — nothing was run; shrink the inline images / userAttachments, or ask the operator to raise the database's single-row limit (TiDB performance.txn-entry-size-limit)`, facts: limitFactsUnmeasured("body", "bytes") }) };
|
|
9
10
|
case "statement":
|
|
10
|
-
return { status: 413, body: refusalBody({ errorCode: "request.payload_too_large", message: `the database refused to store this task: it is larger than the database accepts in one statement (${tooLarge.dbMessage}) — nothing was run; shrink the inline images / userAttachments, or ask the operator to raise the database's max_allowed_packet
|
|
11
|
+
return { status: 413, body: refusalBody({ errorCode: "request.payload_too_large", message: `the database refused to store this task: it is larger than the database accepts in one statement (${tooLarge.dbMessage}) — nothing was run; shrink the inline images / userAttachments, or ask the operator to raise the database's max_allowed_packet`, facts: limitFactsUnmeasured("body", "bytes") }) };
|
|
11
12
|
case "value":
|
|
12
|
-
return { status: 413, body: refusalBody({ errorCode: "request.payload_too_large", message: `the database refused to store this task: it is larger than PostgreSQL holds in one value (${tooLarge.dbMessage}) — nothing was run; shrink the inline images / userAttachments
|
|
13
|
+
return { status: 413, body: refusalBody({ errorCode: "request.payload_too_large", message: `the database refused to store this task: it is larger than PostgreSQL holds in one value (${tooLarge.dbMessage}) — nothing was run; shrink the inline images / userAttachments`, facts: limitFactsUnmeasured("body", "bytes") }) };
|
|
13
14
|
default: {
|
|
14
15
|
const unhandled = tooLarge.wall;
|
|
15
16
|
throw new Error(`row-too-large refusal without an HTTP answer: ${String(unhandled)}`);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* ## 判定(三条,按序;别的一律不放)
|
|
11
11
|
* · 这次提交自带 taskId 而命中的行**不是**那一条(`Idempotency-Key` 指向别的行)⇒ 冲突;
|
|
12
|
-
* · 调用方读不到这一行(属主门 = `runOwnerReadable`,「这个调用方读得到这一行 run
|
|
12
|
+
* · 调用方读不到这一行(属主门 = `runOwnerReadable`,「这个调用方读得到这一行 run 吗」的唯一谓词,经属主存取器 `owner-access.ts` 读)⇒ 冲突;
|
|
13
13
|
* 冲突 ⇒ `409 conflict.run_exists`,体里**不回显**那条行的任何标识(不给跨租户预言机)。先于下一条判:读不到的行不比体。
|
|
14
14
|
* · 这次提交带 `Idempotency-Key`(`caller.idem` 在场)、那一行绑的**就是这把键**,而它记着的请求体指纹与这次不同 ⇒
|
|
15
15
|
* `409 conflict.idempotency_payload_mismatch`(同形 `{ error, errorCode }`,不回显键与那一行);**不**回放首发、不新建、那一行不动。
|
|
@@ -26,12 +26,13 @@ import type { RunIdemBinding, RunRecord } from "../plugins/store-contracts.js";
|
|
|
26
26
|
import type { RunStore } from "../plugins/store-backend.js";
|
|
27
27
|
import type { ServiceConfig } from "../config-types.js";
|
|
28
28
|
import type { SubmitOutcome } from "./idempotency.js";
|
|
29
|
+
import type { Principal } from "../security.js";
|
|
29
30
|
/** 提交腿的回执形(闭集;穷举 `switch`,加一形不写这里 = 编译红)。 */
|
|
30
31
|
export type SubmitReplayFace = "durable" | "sync";
|
|
31
32
|
/** 发起这次提交的一方。 */
|
|
32
33
|
export interface ReplayCaller {
|
|
33
|
-
/** 已验身份(`gatedPrincipal`)。 */
|
|
34
|
-
principal:
|
|
34
|
+
/** 已验身份(`gatedPrincipal` 的回值,`Principal` 品牌)。 */
|
|
35
|
+
principal: Principal | undefined;
|
|
35
36
|
/** 这次提交自带的 taskId(`body.taskId`;A2A 派生值)。缺席 = 只凭 `Idempotency-Key` 命中。 */
|
|
36
37
|
clientTaskId?: string;
|
|
37
38
|
/** 这次提交的账本绑定(键 + 请求体指纹;`RunIdemBinding`)。`undefined` = 这次提交没带 `Idempotency-Key`(只凭 `body.taskId`)⇒ 不比体。
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { runRowReadable } from "./owner-access.js";
|
|
2
2
|
import { readRunFace } from "./run-read-face.js";
|
|
3
|
+
import { refusalBody } from "./refusal-body.js";
|
|
3
4
|
export function isRunExistsConflictBody(body) {
|
|
4
5
|
return typeof body === "object" && body !== null && body.errorCode === "conflict.run_exists";
|
|
5
6
|
}
|
|
6
7
|
export async function replayOfExistingRun(row, caller, face, deps, runStore) {
|
|
7
8
|
const sameRun = caller.clientTaskId === undefined || caller.clientTaskId === row.taskId;
|
|
8
|
-
if (!sameRun || !
|
|
9
|
-
return { status: 409, body: {
|
|
9
|
+
if (!sameRun || !runRowReadable(deps.config, caller.principal, row.owner, "owner")) {
|
|
10
|
+
return { status: 409, body: refusalBody({ errorCode: "conflict.run_exists", message: "a run already exists for this submission's taskId or Idempotency-Key" }) };
|
|
10
11
|
}
|
|
11
12
|
if (caller.idem !== undefined) {
|
|
12
13
|
const held = await runStore.bindIdemBodyFingerprint(row.taskId, caller.idem);
|
|
13
14
|
if (held !== null && held !== caller.idem.bodyFingerprint) {
|
|
14
|
-
return { status: 409, body: {
|
|
15
|
+
return { status: 409, body: refusalBody({ errorCode: "conflict.idempotency_payload_mismatch", message: "this Idempotency-Key was already used for a different request body — a retry must resend the same body; send a different request with a new Idempotency-Key" }) };
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
switch (face) {
|
|
@@ -10,11 +10,12 @@ import type { A2aServerSpec, AgentDefinition, ApprovalReach, PermissionMode, Ski
|
|
|
10
10
|
import type { RequestMcpServerSpec } from "../mcp-assertion-header.js";
|
|
11
11
|
import type { wiringManifestFaceEventData } from "../trace/project.js";
|
|
12
12
|
import type { buildSyncSubmitBody } from "./sync-submit-body.js";
|
|
13
|
+
import type { EntryProblem } from "../entry-problems.js";
|
|
13
14
|
export interface TaskRequestBody {
|
|
14
15
|
objective: string;
|
|
15
16
|
sessionId?: string;
|
|
16
17
|
/** Which deployment SCENARIO assembles this task's tools/prompt/skills (the keys of the worker's scenario
|
|
17
|
-
* table — e.g. "default"/"code"/"code-review"/"scan"). An INTENT bounded by the deployment's own table AND,
|
|
18
|
+
* table — e.g. "default"/"code"/"code-review"/"scan"/"cowork"). An INTENT bounded by the deployment's own table AND,
|
|
18
19
|
* on a governed worker, by the principal's center-resolved allowlist: an unknown name is a typed 400
|
|
19
20
|
* `scenario_unknown`, a known-but-not-allowed one a typed 400 `scenario_not_allowed`; absent ⇒ the ruling's
|
|
20
21
|
* assigned scenario, else `DEFAULT_SCENARIO` (consumed at `boot/resolve-spec.ts` via `gateScenarioRequest`). A name
|
|
@@ -260,7 +261,7 @@ export interface TaskRequestBody {
|
|
|
260
261
|
forwardSubagentEvents?: boolean;
|
|
261
262
|
/** G3([ref] 壳侧承诺③/[ref]③):壳供 per-session scratchpad 路径(壳 vendored getScratchpadDir 的
|
|
262
263
|
* 约定路径)。接受后优先于 server 自算,同源喂 envFacts.scratchpadDir 宣告(core 据它开根围栏的洞,
|
|
263
|
-
* S-842
|
|
264
|
+
* S-842 起是唯一写者,引擎的模式门也据它免问)—— 壳提示词与引擎的写根指同一个目录。验收 fail-closed(单用户 +
|
|
264
265
|
* host-semantics lane + 绝对路径/深度/长度门,规则在 env-facts.acceptShellScratchpadDir),拒收形
|
|
265
266
|
* warn 后回落自算——「没到货引擎忽略 = 无害 additive」的对偶:异形键忽略,任务照跑。 */
|
|
266
267
|
scratchpadDir?: string;
|
|
@@ -349,11 +350,11 @@ export interface TaskRequestBody {
|
|
|
349
350
|
toolMaterializeStrategy?: "static" | "swap";
|
|
350
351
|
/** R4 (CC parity): the LIGHT top-level per-turn permission-mode intent (CC `permissionMode`). The shell sends
|
|
351
352
|
* the RAW mode (axis-agnostic, no client-side interpretation); the SERVICE interprets it tighten-only vs the
|
|
352
|
-
* deployment baseline. All SIX core modes
|
|
353
|
-
* `
|
|
354
|
-
*
|
|
355
|
-
* `deniedBy:"mode"`)
|
|
356
|
-
*
|
|
353
|
+
* deployment baseline. All SIX core modes ride verbatim into `TaskSpec.permissionMode` and only the engine's mode table
|
|
354
|
+
* interprets them (`plan` asks at the call for writes and non-read-only calls; `acceptEdits` writes inside the write roots — the
|
|
355
|
+
* task root plus `additionalDirectories` — without asking; `dontAsk` refuses every ask by the mode, zero cards, the gate records
|
|
356
|
+
* `deniedBy:"mode"`); none can subtract from deployment/operator policy or the request's own deny / ask rules (tightenTaskSpec
|
|
357
|
+
* deny-wins). The top-level word wins over `settings.permissions.defaultMode` (the heavier bundle) — one precedence, read in one place.
|
|
357
358
|
* [ref]-②: CLOSED enum on the wire — an unknown word 400s at submit (`request.field_invalid`, sibling of
|
|
358
359
|
* promptProfile) instead of silently coercing to `default`; resume replay of a stored body stays lenient
|
|
359
360
|
* (coercePermissionMode).
|
|
@@ -610,5 +611,7 @@ export type SyncSubmitBody = ReturnType<typeof buildSyncSubmitBody>;
|
|
|
610
611
|
export interface SyncSubmitExtraKeys {
|
|
611
612
|
notice?: string;
|
|
612
613
|
wiringManifest?: WiringManifestReceipt;
|
|
614
|
+
/** 受理告知(`entry-problems.ts` 的条目形):放行侧选择器清单里什么也不放的条目,**present-iff** 有话说;流式腿的同名键在 `meta` 帧、异步腿的在 202 回执。 */
|
|
615
|
+
warnings?: readonly EntryProblem[];
|
|
613
616
|
}
|
|
614
617
|
//# sourceMappingURL=wire-types.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ export { createSideQueryLane, type KeyResolver, type SideQueryLane, type SideQue
|
|
|
28
28
|
export { createKeyResolver, resolveModelApiKey, type ModelKeyRef } from "./key-resolver.js";
|
|
29
29
|
export { isModelKeyPoison, ModelKeyPoisonedError, type ModelKeyPoison, type ModelKeyPoisonReason } from "./key-resolver.js";
|
|
30
30
|
export { CATALOG_ENTRY_HEADER_LANES, CATALOG_ENTRY_HEADER_NAMES, type CatalogEntryHeaderName } from "./model-entry-headers.js";
|
|
31
|
-
export { judgeModelRouteGap, type ModelRouteGapReading, type ModelRouteGapOptions } from "./model-route-gap.js";
|
|
32
31
|
export type { ModelRouteGap } from "./model-route-endpoint.js";
|
|
33
32
|
export { judgeServedModelRoute, type ServedModelRouteView, type ServedModelRouteOptions, type ModelRouteEndpointVerdict } from "./model-route-endpoint.js";
|
|
34
33
|
export type { UserInputLedgerStore, UserInputAcceptance, NewUserInputAcceptance, OpenScanCursor, OpenScanPage, SettleHow, WriterGoneEvidence } from "./user-input-ledger.js";
|
|
34
|
+
export type { OrgDeliveryQuotaStore, OrgDeliveryQuotaPolicy } from "./plugins/org-delivery-quota-store.js";
|
|
35
35
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,5 @@ export { createSideQueryLane } from "./boot/side-query-lane.js";
|
|
|
25
25
|
export { createKeyResolver, resolveModelApiKey } from "./key-resolver.js";
|
|
26
26
|
export { isModelKeyPoison, ModelKeyPoisonedError } from "./key-resolver.js";
|
|
27
27
|
export { CATALOG_ENTRY_HEADER_LANES, CATALOG_ENTRY_HEADER_NAMES } from "./model-entry-headers.js";
|
|
28
|
-
export { judgeModelRouteGap } from "./model-route-gap.js";
|
|
29
28
|
export { judgeServedModelRoute } from "./model-route-endpoint.js";
|
|
30
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 执行环境的家目录:**声明 ×
|
|
2
|
+
* 执行环境的家目录:**声明 × 实测**的唯一判官与唯一的座(纯叶:零值依赖)。
|
|
3
3
|
*
|
|
4
|
-
* ## 病
|
|
4
|
+
* ## 病(一)—— 声明了却对不上
|
|
5
5
|
* `REMOTE_EXEC_HOME_DIR` 是运维对「执行环境以哪个用户的家目录运行」的声明,它是 `~/` 形权限规则的基、引擎家锚拒读行(`~/.ssh` / `~/.npmrc` …)
|
|
6
|
-
* 的落点(`execution-lane-caps.ts` `executionLaneHomeDir`
|
|
6
|
+
* 的落点(`execution-lane-caps.ts` `executionLaneHomeDir` 一只属主,几个消费面同读)。k8s / local-docker / ssh 三条车道的家目录是镜像 / 目标机
|
|
7
7
|
* 登录用户的属性,boot 期不可知 —— 声明了就照单全收。声明 `/home/y` 而车道真实家目录是 `/home/x` 时,`Edit(~/.ssh/**)` 守的是 `/home/y`,
|
|
8
8
|
* `/home/x/.ssh` 照读照写,运维与用户零告警:限制写了不生效且无人知。
|
|
9
9
|
*
|
|
10
|
-
* ##
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* ## 病(二)—— 没声明就恒问人
|
|
11
|
+
* 执行环境不声明家目录时,引擎的家锚拒读行放不下 ⇒ 每一次泄内容的递归读(`grep -r` / `rg` / `git grep` / `tar c`)在全 shell 面恒问人、只读面直接拒。
|
|
12
|
+
* 家目录是执行环境自己的事实,车道开环境那一拍问一次就知道 —— 不必要运维手填。
|
|
13
|
+
*
|
|
14
|
+
* ## 律(一只座、两个来源、一条取值律 —— {@link LaneHomeSeat},四条会问的车道各持一只,不各写一份)
|
|
15
|
+
* · **声明在场 ⇒ 声明**(座 = 声明原样)。车道对证与否是车道的姿势(`verifiesDeclared`):对证的车道在开环境那一拍问一次(与命令同一条 shell、同一份 env:
|
|
16
|
+
* `printf %s "$HOME"`),两者不一致 ⇒ 这只执行环境不开(拒句点名两值与两条改法),环境答了的判定记在环境上(同一镜像 / 同一目标机再问也是同一个答案,不重试成风暴);
|
|
17
|
+
* 问不出答案同样不开(证不了声明 = 不拿一个没证过的目录去守),但不记 —— 与任何一次建连失败同,下一次重问;不对证的车道(adb:Android 没有 POSIX 登录家目录,声明是运维的断言)声明照单全收。
|
|
18
|
+
* · **没声明 ⇒ 实测**:同一拍问同一句;答出绝对路径 ⇒ 座 = 它,之后不再问;
|
|
19
|
+
* · **实测也缺席**(问不出 / 答的不是绝对路径,含空串)⇒ 座缺席(引擎失败关闭,不猜、不补 `/`),环境照开(没声明就没有声明可拒),一行 warn(点名读到了什么与出路)。
|
|
20
|
+
* 规则基与 422 门在下单那一刻就要家目录,而那一刻执行环境还没开 —— 它们仍只读声明(`executionLaneHomeDir`);实测值只填引擎手里的这一只座。
|
|
15
21
|
*/
|
|
16
22
|
/** 探针答案的行首标记:登录脚本 / profile 往 stdout 打的横幅不会被读成家目录 —— 只认带这个标记的那一行(取最后一行)。 */
|
|
17
23
|
export declare const LANE_HOME_PROBE_MARKER = "sema-lane-home=";
|
|
@@ -37,7 +43,70 @@ export type LaneHomeVerdict = {
|
|
|
37
43
|
readonly answered: boolean;
|
|
38
44
|
} | undefined;
|
|
39
45
|
/**
|
|
40
|
-
* 声明 ×
|
|
46
|
+
* 声明 × 实测的判官。`lane` 只进句子。拒句三形:实测与声明不一致 / 实测不是绝对路径(含空)/ 没问到。每一形都点名声明值与改法,不回显任何别的东西。
|
|
41
47
|
*/
|
|
42
48
|
export declare function judgeLaneHome(lane: string, declared: string, probe: LaneHomeProbe): LaneHomeVerdict;
|
|
49
|
+
/** 起服与每只环境「家目录答不出」那一行 warn 的事件名 —— 一只 code,起服(车道读不了)与环境(实测缺席)共用。 */
|
|
50
|
+
export declare const LANE_HOME_UNDECLARED_EVENT = "execution_lane_home_undeclared";
|
|
51
|
+
/**
|
|
52
|
+
* 「这条车道的执行环境没有家目录」的一句(纯字符串 ⇒ `build*`):`cause` 说为什么(没声明 + 车道读不了 / 读了没读到),`remedy` 说出路。
|
|
53
|
+
* 起服那一行(车道没有读数办法)与每只环境那一行(实测缺席)都走它 —— 代价那一半只有一份文字。
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildHomeAbsentNote(lane: string, cause: string, remedy: string): string;
|
|
56
|
+
/** 车道读不了家目录时的出路(起服那一行):声明它。 */
|
|
57
|
+
export declare const DECLARE_HOME_REMEDY = "Declare the home: REMOTE_EXEC_HOME_DIR=<the absolute path the environment's $HOME reads>";
|
|
58
|
+
/** 一行「这只环境没有家目录」的事实:交给运维的那一行 warn 的两个字段。 */
|
|
59
|
+
export interface LaneHomeAbsence {
|
|
60
|
+
readonly provider: string;
|
|
61
|
+
readonly note: string;
|
|
62
|
+
}
|
|
63
|
+
/** 这条车道的座怎么长出来:`declared` = 运维声明(`REMOTE_EXEC_HOME_DIR`,boot 期的唯一属主 `executionLaneHomeDir` 的答案);`verifiesDeclared` = 车道对声明对证。 */
|
|
64
|
+
export interface LaneHomeSeatOptions {
|
|
65
|
+
readonly lane: string;
|
|
66
|
+
readonly declared: string | undefined;
|
|
67
|
+
readonly verifiesDeclared: boolean;
|
|
68
|
+
/** 实测缺席时交出那一行 warn(缺席 = 不交;生产装配由 boot 递一只带去重的报告座,见 {@link createLaneHomeAbsenceReporter})。 */
|
|
69
|
+
readonly onAbsent?: ((absence: LaneHomeAbsence) => void) | undefined;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 四条会问家目录的车道(k8s / local-docker / ssh / adb)的适配器配置里与家目录有关的两个键 —— 文字只写这一处,四个配置接口 `extends` 它。
|
|
73
|
+
*/
|
|
74
|
+
export interface LaneHomeConfig {
|
|
75
|
+
/**
|
|
76
|
+
* S-213④ / core [ref] —— 运维声明的执行环境 **home 目录**(绝对路径,本环境自己的命名空间里;`REMOTE_EXEC_HOME_DIR`)。`~/…` 形权限规则(`Edit(~/.ssh/**)`)对**跑在本 env 里的调用**
|
|
77
|
+
* 就以它为基。值由 `boot/execution-env.ts` 从**唯一属主** `execution-lane-caps.ts` 的 `executionLaneHomeDir` 递进来;adapter 不自算(两处各算一份 = 422 门与引擎对同一条规则给相反答案)。
|
|
78
|
+
* 缺席 ⇒ 不声明:车道建环境时自己问执行环境的 `$HOME`({@link LaneHomeSeat});实测也缺席 ⇒ 本 env 的 `homeDir` 座缺席,core 对 `~/` 规则判 `unreadable`
|
|
79
|
+
* (fail-closed 的 ask),绝不回落引擎进程自己的 home(那在远端腿上是另一个用户的另一个目录 —— 静默守错目录正是 [ref] 的病)。
|
|
80
|
+
*/
|
|
81
|
+
homeDir?: string;
|
|
82
|
+
/** 实测缺席(没声明、也没问到绝对路径)时交出那一行 warn;缺席 = 不交。生产装配由 boot 递一只带去重的报告座({@link createLaneHomeAbsenceReporter})。 */
|
|
83
|
+
onHomeAbsent?: (absence: LaneHomeAbsence) => void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 一只执行环境的家目录座 —— `ExecutionEnv.homeDir` 的**唯一取值律**:声明在场 ⇒ 声明;否则 ⇒ 车道开环境时实测到的绝对路径;实测也缺席 ⇒ `undefined`(引擎失败关闭)。
|
|
87
|
+
* 车道只做两件事:`asks` 为真时经自己的命令通道跑一次 {@link LANE_HOME_PROBE_COMMAND},把读数交给 {@link settle};`homeDir` 读 {@link home}。
|
|
88
|
+
*/
|
|
89
|
+
export declare class LaneHomeSeat {
|
|
90
|
+
private measured;
|
|
91
|
+
private readonly lane;
|
|
92
|
+
private readonly declared;
|
|
93
|
+
private readonly verifiesDeclared;
|
|
94
|
+
private readonly onAbsent;
|
|
95
|
+
constructor(options: LaneHomeSeatOptions);
|
|
96
|
+
/** 座:声明胜,否则实测,否则缺席。 */
|
|
97
|
+
get home(): string | undefined;
|
|
98
|
+
/** 这一拍还要不要问:声明在场 ⇒ 只有对证的车道问(每次连接);没声明 ⇒ 问到量出绝对路径为止。 */
|
|
99
|
+
get asks(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 收一次读数。声明在场(且车道对证)⇒ {@link judgeLaneHome}:`undefined` = 一致,否则这只环境不开(拒句 + 记不记见 {@link LaneHomeVerdict});
|
|
102
|
+
* 没声明 ⇒ 读到绝对路径就记下;读不到 / 不是绝对路径 ⇒ 座缺席、交一行 warn、**不拒环境**(`undefined`)—— 没声明就没有声明可拒,引擎对缺席座失败关闭。
|
|
103
|
+
* 不对证的车道声明在场时不该来问(`asks` 为假),来了照单全收。
|
|
104
|
+
*/
|
|
105
|
+
settle(probe: LaneHomeProbe): LaneHomeVerdict;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 每个部署一只的「家目录实测缺席」报告座(闭包 ⇒ `create*`):同一(车道, 句子)只响一行 `execution_lane_home_undeclared`(同一镜像每个 run 的环境都读到同一个缺席,
|
|
109
|
+
* 每只环境各响一行 = 刷屏),不同的句子各响一次。`warn` 是服务日志的 warn。
|
|
110
|
+
*/
|
|
111
|
+
export declare function createLaneHomeAbsenceReporter(warn: (event: string, fields: Record<string, unknown>) => void): (absence: LaneHomeAbsence) => void;
|
|
43
112
|
//# sourceMappingURL=lane-home-probe.d.ts.map
|