@sema-agent/server 7.140.0 → 7.142.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 +505 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/USAGE.md +142 -25
- package/dist/approval-ask-audit-store.d.ts +54 -38
- package/dist/approval-ask-audit-store.js +58 -39
- package/dist/approval-batch-census.d.ts +27 -0
- package/dist/approval-batch-census.js +27 -0
- package/dist/approval-card.d.ts +39 -24
- package/dist/approval-card.js +6 -3
- package/dist/approval-crash-convergence.d.ts +17 -7
- package/dist/approval-crash-convergence.js +94 -22
- package/dist/approval-deny-reasons.d.ts +34 -30
- package/dist/approval-deny-reasons.js +21 -6
- package/dist/approval-policy-settlement.d.ts +1 -1
- package/dist/approval-reconciler.d.ts +33 -1
- package/dist/approval-reconciler.js +43 -40
- package/dist/approval.d.ts +15 -0
- package/dist/approval.js +10 -0
- package/dist/audit.d.ts +4 -2
- package/dist/audit.js +2 -2
- package/dist/auth-bridge.d.ts +9 -6
- package/dist/auth-bridge.js +9 -3
- package/dist/boot/adoption.js +2 -1
- package/dist/boot/budget-tracing.d.ts +16 -0
- package/dist/boot/budget-tracing.js +10 -6
- package/dist/boot/device-lane.d.ts +11 -0
- package/dist/boot/device-lane.js +16 -0
- package/dist/boot/engine-lease.d.ts +24 -3
- package/dist/boot/engine-lease.js +9 -2
- package/dist/boot/execution-env.d.ts +24 -4
- package/dist/boot/execution-env.js +34 -27
- package/dist/boot/execution-lane.js +2 -1
- package/dist/boot/exit-boundary.js +5 -4
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +1 -1
- package/dist/boot/memory-consolidation.js +3 -2
- package/dist/boot/parked-revive-gate.js +2 -1
- package/dist/boot/permission-rules-audit.d.ts +0 -28
- package/dist/boot/permission-rules-audit.js +2 -1
- package/dist/boot/read-deny-anchor-audit.js +2 -1
- package/dist/boot/reapers.d.ts +2 -2
- package/dist/boot/reapers.js +4 -3
- package/dist/boot/resolve-spec.js +18 -6
- package/dist/boot/retention-lane.js +5 -3
- package/dist/boot/runner-deps.js +16 -13
- package/dist/boot/runtime-caps.js +3 -2
- package/dist/boot/session-faces.d.ts +1 -1
- package/dist/boot/session-faces.js +8 -6
- package/dist/boot/shutdown.js +8 -2
- package/dist/boot/stage-04-stores.js +3 -2
- package/dist/boot/stage-05-execution-env.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.js +11 -7
- package/dist/boot/stage-06-runners.d.ts +1 -3
- package/dist/boot/stage-06-runners.js +3 -2
- package/dist/boot/stage-07-capability-layer.d.ts +1 -2
- package/dist/boot/stage-07-capability-layer.js +10 -11
- package/dist/boot/stage-08-reapers.d.ts +1 -2
- package/dist/boot/stage-08-reapers.js +3 -2
- package/dist/boot/stage-09-leader.d.ts +1 -2
- package/dist/boot/stage-10-http-server.d.ts +1 -2
- package/dist/boot/stage-10-http-server.js +6 -4
- package/dist/boot/stores.js +13 -6
- package/dist/boot/web-admin.js +18 -17
- package/dist/boot/webfetch-summarize-lane.js +2 -1
- package/dist/boot/workflow-orchestration.js +3 -2
- package/dist/capabilities/builtin-tools.d.ts +2 -1
- package/dist/capabilities/builtin-tools.js +2 -4
- package/dist/capabilities/composite-members.d.ts +2 -1
- package/dist/capabilities/composite-members.js +2 -1
- package/dist/capabilities/scenarios.d.ts +1 -1
- package/dist/capability-facts.d.ts +33 -0
- package/dist/capability-facts.js +32 -0
- package/dist/card-void.d.ts +38 -0
- package/dist/card-void.js +23 -0
- package/dist/config-catalog.js +12 -8
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +19 -33
- package/dist/config-types.d.ts +39 -10
- package/dist/config.d.ts +6 -0
- package/dist/config.js +72 -49
- package/dist/delegated-session-owner.d.ts +21 -19
- package/dist/delegated-session-owner.js +1 -1
- package/dist/device-store.d.ts +7 -0
- package/dist/device-store.js +3 -0
- package/dist/execution-config-root.d.ts +22 -0
- package/dist/execution-config-root.js +35 -0
- package/dist/execution-lane-caps.d.ts +50 -2
- package/dist/execution-lane-caps.js +90 -13
- package/dist/execution-placement.d.ts +3 -0
- package/dist/execution-placement.js +7 -0
- package/dist/fleet/drain-entry.d.ts +3 -0
- package/dist/fleet/fleet-bus.d.ts +6 -3
- package/dist/hooks/hook-runner.d.ts +6 -0
- package/dist/hooks/hook-runner.js +30 -1
- package/dist/hosted-posture.d.ts +8 -0
- package/dist/hosted-posture.js +4 -0
- package/dist/http/admission.js +3 -3
- package/dist/http/caller-trust.d.ts +3 -2
- package/dist/http/caller-trust.js +2 -1
- package/dist/http/dispatch.js +8 -2
- package/dist/http/execution-context.d.ts +2 -2
- package/dist/http/idempotency.d.ts +1 -1
- package/dist/http/live-frame.d.ts +24 -0
- package/dist/http/live-frame.js +16 -0
- package/dist/http/principal-gate.d.ts +3 -1
- package/dist/http/principal-gate.js +17 -8
- package/dist/http/resume-legs.js +42 -29
- package/dist/http/route-table.js +4 -0
- package/dist/http/routes/approvals-assistant.js +1 -0
- package/dist/http/routes/attachments.js +18 -0
- package/dist/http/routes/capabilities.js +10 -6
- package/dist/http/routes/diagnostics.d.ts +0 -19
- package/dist/http/routes/diagnostics.js +16 -2
- package/dist/http/routes/memory-bundle.d.ts +2 -2
- package/dist/http/routes/memory-bundle.js +1 -1
- package/dist/http/routes/memory-compliance.js +1 -1
- package/dist/http/routes/memory-policy.js +27 -7
- package/dist/http/routes/run-permission-mode.d.ts +75 -0
- package/dist/http/routes/run-permission-mode.js +170 -0
- package/dist/http/routes/runs.js +3 -3
- package/dist/http/routes/session-memory-sync.d.ts +63 -0
- package/dist/http/routes/session-memory-sync.js +157 -0
- package/dist/http/routes/session-sync.d.ts +3 -6
- package/dist/http/routes/session-sync.js +7 -2
- package/dist/http/routes/sessions-list.d.ts +2 -1
- package/dist/http/routes/sessions.js +5 -4
- package/dist/http/routes/tasks.js +70 -71
- package/dist/http/run-read-face.d.ts +7 -0
- package/dist/http/run-read-face.js +10 -4
- package/dist/http/send.d.ts +6 -1
- package/dist/http/send.js +10 -3
- package/dist/http/server.d.ts +20 -7
- package/dist/http/server.js +2 -4
- package/dist/http/sse-log.d.ts +3 -8
- package/dist/http/stored-body-replay.d.ts +3 -3
- package/dist/http/stored-body-replay.js +3 -1
- package/dist/http/submit-replay.d.ts +4 -3
- package/dist/http/submit-replay.js +2 -2
- package/dist/http/sync-submit-body.d.ts +21 -4
- package/dist/http/sync-submit-body.js +13 -0
- package/dist/identity-source.d.ts +21 -2
- package/dist/identity-source.js +6 -0
- package/dist/instruction-source-notice.d.ts +7 -0
- package/dist/instruction-source-notice.js +6 -6
- package/dist/mcp-assertion-header.d.ts +4 -0
- package/dist/mcp-assertion-header.js +5 -0
- package/dist/memory-incident-sink.d.ts +19 -6
- package/dist/memory-incident-sink.js +8 -4
- package/dist/memory-posture.d.ts +1 -1
- package/dist/memory-scope.d.ts +4 -4
- package/dist/memory-scope.js +1 -1
- package/dist/memory-sync-client.d.ts +35 -23
- package/dist/memory-sync-client.js +122 -52
- package/dist/memory-sync-identity.d.ts +24 -0
- package/dist/memory-sync-identity.js +57 -0
- package/dist/memory-sync.d.ts +7 -1
- package/dist/memory-sync.js +6 -3
- package/dist/observability/fail-open.d.ts +57 -12
- package/dist/observability/fail-open.js +50 -9
- package/dist/observability/metrics.js +0 -1
- package/dist/observability/run-terminal.d.ts +93 -31
- package/dist/observability/run-terminal.js +175 -171
- package/dist/observability/secret-env-scrub.d.ts +20 -1
- package/dist/observability/secret-env-scrub.js +14 -0
- package/dist/orchestration/workflow-completion-inbox.d.ts +5 -2
- package/dist/orchestration/workflow-completion-inbox.js +13 -5
- package/dist/orchestration/workflow-notify-journal.d.ts +5 -3
- package/dist/orchestration/workflow-notify-journal.js +2 -1
- package/dist/permission-mode-admission.d.ts +68 -0
- package/dist/permission-mode-admission.js +23 -0
- package/dist/permission-rule-list.d.ts +55 -6
- package/dist/permission-rule-list.js +52 -5
- package/dist/plugins/approval-ask-store-file.d.ts +14 -4
- package/dist/plugins/approval-ask-store-file.js +48 -7
- package/dist/plugins/approval-ask-store-memory.d.ts +2 -1
- package/dist/plugins/approval-ask-store-memory.js +9 -8
- package/dist/plugins/approval-ask-store-sql.d.ts +42 -10
- package/dist/plugins/approval-ask-store-sql.js +49 -19
- package/dist/plugins/caching-session-store.d.ts +6 -0
- package/dist/plugins/caching-session-store.js +3 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +65 -17
- package/dist/plugins/checkpoint-store-sql.js +74 -3
- package/dist/plugins/device-store-sql.d.ts +5 -2
- package/dist/plugins/device-store-sql.js +4 -1
- package/dist/plugins/execution-placement-sql.d.ts +11 -1
- package/dist/plugins/execution-placement-sql.js +12 -1
- package/dist/plugins/file-run-store.d.ts +7 -2
- package/dist/plugins/file-run-store.js +12 -2
- package/dist/plugins/fork-routing-session-store.d.ts +10 -32
- package/dist/plugins/fork-routing-session-store.js +2 -61
- package/dist/plugins/k8s-exec-protocol.d.ts +4 -1
- package/dist/plugins/k8s-exec-protocol.js +6 -1
- package/dist/plugins/local-checkpoint-store.d.ts +10 -1
- package/dist/plugins/local-checkpoint-store.js +22 -0
- package/dist/plugins/local-session-store.d.ts +260 -39
- package/dist/plugins/local-session-store.js +582 -57
- package/dist/plugins/local-session-window.d.ts +17 -3
- package/dist/plugins/local-session-window.js +7 -13
- package/dist/plugins/local-task-attachment-store.d.ts +12 -2
- package/dist/plugins/local-task-attachment-store.js +67 -43
- package/dist/plugins/memory-key-guards.d.ts +3 -3
- package/dist/plugins/memory-run-store.d.ts +7 -2
- package/dist/plugins/memory-run-store.js +12 -2
- package/dist/plugins/one-time-migrations.d.ts +68 -2
- package/dist/plugins/one-time-migrations.js +120 -4
- package/dist/plugins/pg-pool.js +3 -2
- package/dist/plugins/pg-session-storage.d.ts +2 -0
- package/dist/plugins/pg-session-storage.js +3 -2
- package/dist/plugins/remote-env-e2b.d.ts +47 -7
- package/dist/plugins/remote-env-e2b.js +242 -46
- package/dist/plugins/remote-env-k8s.d.ts +51 -6
- package/dist/plugins/remote-env-k8s.js +234 -44
- package/dist/plugins/remote-env-local-docker.d.ts +40 -14
- package/dist/plugins/remote-env-local-docker.js +127 -33
- package/dist/plugins/run-store-sql.d.ts +11 -3
- package/dist/plugins/run-store-sql.js +13 -4
- package/dist/plugins/sandbox-read-floor.d.ts +273 -0
- package/dist/plugins/sandbox-read-floor.js +608 -0
- package/dist/plugins/session-ownership.d.ts +2 -1
- package/dist/plugins/session-placement.d.ts +17 -4
- package/dist/plugins/session-placement.js +2 -1
- package/dist/plugins/session-store.d.ts +18 -20
- package/dist/plugins/session-store.js +4 -12
- package/dist/plugins/store-backend.d.ts +41 -7
- package/dist/plugins/store-backend.js +22 -4
- package/dist/plugins/store-contracts.d.ts +35 -3
- package/dist/plugins/store-contracts.js +3 -0
- package/dist/plugins/task-attachment-store.d.ts +112 -14
- package/dist/plugins/task-attachment-store.js +221 -28
- package/dist/plugins/tidb-pool.js +2 -1
- package/dist/plugins/tidb-session-store.d.ts +4 -1
- package/dist/plugins/tidb-session-store.js +3 -2
- package/dist/plugins/workspace-fill.d.ts +60 -0
- package/dist/plugins/workspace-fill.js +106 -0
- package/dist/project-bundle.d.ts +38 -0
- package/dist/project-bundle.js +609 -0
- package/dist/run-cancel-context.d.ts +34 -0
- package/dist/run-cancel-context.js +7 -0
- package/dist/run-local.js +2 -8
- package/dist/runs.d.ts +39 -12
- package/dist/runs.js +69 -55
- package/dist/sandbox-egress-policy.d.ts +4 -1
- package/dist/sandbox-egress-policy.js +3 -1
- package/dist/sandbox-git-plane.d.ts +31 -12
- package/dist/sandbox-git-plane.js +24 -4
- package/dist/security.d.ts +11 -2
- package/dist/security.js +8 -0
- package/dist/server-secret-env.d.ts +2 -1
- package/dist/server-secret-env.js +2 -4
- package/dist/session-error-wire.d.ts +46 -4
- package/dist/session-error-wire.js +23 -0
- package/dist/session-incarnation.d.ts +9 -3
- package/dist/session-sync-kernel.d.ts +42 -1
- package/dist/session-sync-kernel.js +17 -0
- package/dist/session-sync.js +16 -4
- package/dist/sql-engine-coordinates.d.ts +49 -0
- package/dist/sql-engine-coordinates.js +27 -0
- package/dist/standing-answer-grant.d.ts +31 -2
- package/dist/standing-answer-grant.js +14 -2
- package/dist/store-posture.d.ts +1 -1
- package/dist/task-a2a.d.ts +1 -1
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-settings.d.ts +62 -27
- package/dist/task-settings.js +105 -29
- package/dist/terminal.d.ts +97 -20
- package/dist/terminal.js +107 -18
- package/dist/tool-approval.d.ts +4 -3
- package/dist/tool-approval.js +12 -14
- package/dist/trace/core-keyset-guard.d.ts +196 -2
- package/dist/trace/engine-notice-wire.d.ts +8 -2
- package/dist/trace/engine-notice-wire.js +4 -2
- package/dist/trace/exit-seat.d.ts +9 -1
- package/dist/trace/exit-seat.js +1 -0
- package/dist/trace/ledger-sink.d.ts +8 -4
- package/dist/trace/ledger-sink.js +2 -2
- package/dist/trace/model-segment.d.ts +2 -2
- package/dist/trace/project.d.ts +18 -1
- package/dist/trace/project.js +16 -0
- package/dist/trace/redact.js +323 -90
- package/dist/trace/self-minted-wire.d.ts +419 -4
- package/dist/trace/self-minted-wire.js +145 -0
- package/dist/trace/wire-projection-faces.d.ts +1 -1
- package/dist/trace/wire-projection-faces.js +1 -1
- package/dist/verifier-pause-card.d.ts +8 -0
- package/dist/verifier-pause-card.js +19 -0
- package/dist/web-admin-client/apply-effective.d.ts +5 -7
- package/dist/web-admin-client/apply-effective.js +22 -2
- package/dist/web-admin-client/candidate-gate.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +2 -0
- package/dist/web-admin-client/read-warnings.d.ts +2 -2
- package/dist/web-admin-client/types.d.ts +4 -0
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +3 -2
- package/package.json +2 -2
- package/wire-changes/server@7.141.0.json +367 -0
- package/wire-changes/server@7.142.0.json +639 -0
package/dist/config.js
CHANGED
|
@@ -3,13 +3,14 @@ import { DEFAULT_AT_MENTION, DEFAULT_MODEL_REF, mintCapabilityKeys } from "./mod
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { isAbsolute, join, posix as posixPath } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { compileAllowList, inheritEnvPolicyProblem, BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, CROSS_SESSION_INBOUND_SETTINGS, CROSS_SESSION_DIALOG_EXPIRY_VALUES, compileReadDeny, resolveReadDenyBuiltins, isModelPriced, PROTOCOL_TABLE, RECOMMENDED_SENSITIVE_PATTERNS, judgeRuleToolName, resolveFileHistoryRetention, resolveLockedKeys, validatePermissionRules, WRITE_PROTECTED_DEFAULT_TABLE, resolveWriteProtectedTable, principalInboxConsumerOf } from "@sema-agent/core";
|
|
6
|
+
import { compileAllowList, inheritEnvPolicyProblem, BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, CROSS_SESSION_INBOUND_SETTINGS, CROSS_SESSION_DIALOG_EXPIRY_VALUES, compileReadDeny, resolveReadDenyBuiltins, isModelPriced, PROTOCOL_TABLE, RECOMMENDED_SENSITIVE_PATTERNS, judgeRuleToolName, resolveFileHistoryRetention, resolveLockedKeys, validatePermissionRules, WRITE_PROTECTED_DEFAULT_TABLE, resolveWriteProtectedTable, principalInboxConsumerOf, carriesCredential } from "@sema-agent/core";
|
|
7
7
|
import { ROSTER_PRIMARY_ROLES, ROSTER_CHEAP_ROLES, WEB_ADMIN_ENV, retiredEnvRefusal, stripControlAndBidi } from "@sema-agent/settings-schema";
|
|
8
8
|
import { parseApprovalHmacKeys, parsePrincipalJwks } from "./auth-keys.js";
|
|
9
9
|
import { DEFAULT_ELICITATION_THROTTLE } from "./elicitation.js";
|
|
10
10
|
import { buildRuleListJudgeOptions } from "./permission-rule-list.js";
|
|
11
11
|
import { isV2ScopeKey, memoryReplicationCoverage, replicatesProjectLayersOf } from "./memory-scope.js";
|
|
12
12
|
import { memorySyncPeerOf } from "./memory-sync-client.js";
|
|
13
|
+
import { buildMemorySyncIdentityBootRefusal, declaredMemorySyncIdentityFlaw } from "./memory-sync-identity.js";
|
|
13
14
|
import { assertProjectLayerOwnable } from "./project-identity.js";
|
|
14
15
|
import { projectLayerOwnerOf } from "./project-layer-key.js";
|
|
15
16
|
import { DEFAULT_QUESTION_THROTTLE } from "./question.js";
|
|
@@ -36,7 +37,8 @@ import { laneLivenessOf } from "./exec-bounds.js";
|
|
|
36
37
|
import { SANDBOX_IPV6_DEFAULT, SANDBOX_IPV6_WORDS } from "./sandbox-egress-policy.js";
|
|
37
38
|
import { WORKSPACE_CACHE_DEFAULT, WORKSPACE_CACHE_MOUNT_DEFAULT, WORKSPACE_CACHE_MOUNT_RESERVED, WORKSPACE_CACHE_SIZE_DEFAULT, WORKSPACE_CACHE_WORDS, isK8sQuantity, mountsOverlap, reservedMountCollision } from "./workspace-cache.js";
|
|
38
39
|
import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
39
|
-
import {
|
|
40
|
+
import { sandboxForwardedEnvOf } from "./execution-config-root.js";
|
|
41
|
+
import { SANDBOX_READ_FLOOR_DEFAULT, SANDBOX_READ_FLOOR_WORDS, executionLaneOf, executionLaneRequiredRefusal, laneMissingEnv, readDeclaredLaneTable } from "./execution-lane-caps.js";
|
|
40
42
|
import { MEMORY_ENGINE_BACKENDS, SESSION_BACKENDS, STORE_BACKENDS } from "@sema-agent/settings-schema/execution-lanes";
|
|
41
43
|
import { AUTONOMY_MODES } from "./runtime-governance.js";
|
|
42
44
|
import { MAX_NAMED_INERT_ENTRIES, allowLayerEntryCountIssue, describeInertRuleEntries, inertRuleEntriesOf, inertRuleEntryGuidance, ruleEntryListShapeOk } from "./rule-entry-list.js";
|
|
@@ -45,7 +47,7 @@ import { createCenterCredentialSource, readCenterCredentialDeclaration } from ".
|
|
|
45
47
|
import { parseCenterCredentialRenewLeadMs } from "./center-credential-renewer.js";
|
|
46
48
|
import { modelProviderRefusal } from "./model-provider.js";
|
|
47
49
|
import { modelRouteUrlRefusal } from "./model-route-url.js";
|
|
48
|
-
import { httpUrlFlaws } from "@sema-agent/settings-schema";
|
|
50
|
+
import { DEVICE_RELAY_NONE, DEVICE_RELAY_RULE, deviceRelayFlaws, httpUrlFlaws } from "@sema-agent/settings-schema";
|
|
49
51
|
import { buildHttpUrlRefusal, buildRefusalShownUrl } from "./url-refusal.js";
|
|
50
52
|
import { customPkgSourceFromEnv } from "./sandbox-pkg-source.js";
|
|
51
53
|
import { anthropicCredentialRefusal, csvOf, declaredCredential, envLaneTable, mintedCheapId, readModelRouteEnv } from "./model-route-gap.js";
|
|
@@ -57,6 +59,7 @@ import { allowlistedEnv } from "./server-secret-env.js";
|
|
|
57
59
|
import { ENV_NAME_ALLOWLIST_KNOBS, ENV_NAME_ALLOWLIST_KNOB_NAMES, describeAllowlistPostures } from "./env-name-allowlist-knobs.js";
|
|
58
60
|
import { APPROVAL_ASK_RETENTION_DEFAULT_MS, APPROVAL_ASK_RETENTION_FLOOR_MS } from "./approval-ask-retention.js";
|
|
59
61
|
import { parseModsDeclaration } from "./mods-declaration.js";
|
|
62
|
+
import { buildDeclaredEngineWithoutCoordinatesRefusal, missingSqlCoordinateKeys } from "./sql-engine-coordinates.js";
|
|
60
63
|
export { RETENTION_MODES, MEMORY_CONSOLIDATION_MIN_INTERVAL_SEC } from "./config-types.js";
|
|
61
64
|
function csv(name) {
|
|
62
65
|
return csvOf(process.env[name]);
|
|
@@ -378,17 +381,16 @@ function credentialLawRewriteOf(href) {
|
|
|
378
381
|
const scanned = redactSecrets(href);
|
|
379
382
|
return scanned === href ? undefined : scanned;
|
|
380
383
|
}
|
|
381
|
-
function parseDeviceRelayUrlEnv() {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const flaws =
|
|
384
|
+
function parseDeviceRelayUrlEnv(raw) {
|
|
385
|
+
if (raw === undefined) {
|
|
386
|
+
throw new Error("internal: the device lane was assembled without DEVICE_RELAY_URL — the lane's required-env gate must refuse this first (the settings-schema lane table lists DEVICE_RELAY_URL as required for device)");
|
|
387
|
+
}
|
|
388
|
+
if (raw === DEVICE_RELAY_NONE)
|
|
389
|
+
return { kind: "none" };
|
|
390
|
+
const flaws = deviceRelayFlaws(raw);
|
|
388
391
|
if (flaws.length > 0) {
|
|
389
|
-
throw new Error(`env DEVICE_RELAY_URL
|
|
390
|
-
`
|
|
391
|
-
`Leave it unset when devices reach this engine at its own address — they then dial it at deviceExecutor.wsPath.`);
|
|
392
|
+
throw new Error(`env DEVICE_RELAY_URL ${DEVICE_RELAY_RULE} — found: ${flaws.join(", ")}; got ${JSON.stringify(buildRefusalShownUrl(raw))}. ` +
|
|
393
|
+
`A URL has no room for credentials (devices authenticate by signature). Set it to "${DEVICE_RELAY_NONE}" when devices reach this engine at its own address — they then dial it at deviceExecutor.wsPath.`);
|
|
392
394
|
}
|
|
393
395
|
const href = new URL(raw).href;
|
|
394
396
|
const credentialScan = credentialLawRewriteOf(href);
|
|
@@ -396,7 +398,26 @@ function parseDeviceRelayUrlEnv() {
|
|
|
396
398
|
throw new Error(`env DEVICE_RELAY_URL carries something the credential-redaction law recognizes (${credentialScan}) — it is published verbatim on GET /v1/capabilities (deviceExecutor.relayUrl), ` +
|
|
397
399
|
`so it must not carry a token-shaped path segment; keep it to ws(s)://host[:port][/path] (devices authenticate by signature, not by the URL).`);
|
|
398
400
|
}
|
|
399
|
-
return raw;
|
|
401
|
+
return { kind: "url", url: raw };
|
|
402
|
+
}
|
|
403
|
+
function declaredExecutionLane(raw) {
|
|
404
|
+
if (raw === undefined || raw === "")
|
|
405
|
+
return undefined;
|
|
406
|
+
const table = readDeclaredLaneTable(raw);
|
|
407
|
+
if ("refusal" in table)
|
|
408
|
+
throw new Error(table.refusal);
|
|
409
|
+
const [lane, ...rest] = table.lanes;
|
|
410
|
+
if (rest.length > 0) {
|
|
411
|
+
throw new Error(`REMOTE_EXEC="${raw}" declares ${table.lanes.length} execution lanes (${table.lanes.join(", ")}; the first is the default) — this engine wires exactly one execution lane per process, ` +
|
|
412
|
+
`so ${rest.join(", ")} would never run anything while the deployment declares ${rest.length === 1 ? "it" : "them"}. ` +
|
|
413
|
+
`Refusing to start rather than serving "${lane}" alone: declare one lane per engine (REMOTE_EXEC=${lane}) and run a separate engine for each further lane.`);
|
|
414
|
+
}
|
|
415
|
+
const missing = laneMissingEnv(lane, process.env);
|
|
416
|
+
if (missing.length > 0) {
|
|
417
|
+
throw new Error(`REMOTE_EXEC=${lane} but required env ${missing.join(", ")} ${missing.length === 1 ? "is" : "are"} unset, empty or whitespace-only — it counts as absent: ` +
|
|
418
|
+
`refusing to start rather than silently downgrading to the host/in-process lane (#157; set ${missing.length === 1 ? "it" : "them"}, or unset REMOTE_EXEC if you meant no sandbox lane).`);
|
|
419
|
+
}
|
|
420
|
+
return lane;
|
|
400
421
|
}
|
|
401
422
|
function parseDevicePreAuthPerRemoteEnv() {
|
|
402
423
|
const raw = process.env.DEVICE_MAX_PREAUTH_PER_REMOTE;
|
|
@@ -515,17 +536,16 @@ const OWN_CREDENTIAL_HANDOFF = {
|
|
|
515
536
|
"sandbox-grant": { where: "a sandbox list puts the named variable, as written, into a sandbox the model can read", whom: "the sandbox" },
|
|
516
537
|
};
|
|
517
538
|
function ownCredentialNameProblem(name, channel) {
|
|
518
|
-
|
|
519
|
-
if (engine === undefined)
|
|
539
|
+
if (inheritEnvPolicyProblem([name]) === undefined)
|
|
520
540
|
return undefined;
|
|
521
541
|
const { where, whom } = OWN_CREDENTIAL_HANDOFF[channel];
|
|
522
|
-
return `this deployment's own credential — ${where}; give ${whom} a credential of its own (another name and another value) and list that name instead (the engine refuses it on any allow list
|
|
542
|
+
return `this deployment's own credential — ${where}; give ${whom} a credential of its own (another name and another value) and list that name instead (the engine refuses it on any allow list)`;
|
|
523
543
|
}
|
|
524
544
|
const NAMES_IN_FORCE = {
|
|
525
545
|
LSP_ENV_ALLOW: (c) => c.lspEnvAllow,
|
|
526
|
-
E2B_SANDBOX_ENV: (c) => (c.remoteExec?.provider === "e2b" ? Object.keys(c
|
|
527
|
-
K8S_SANDBOX_ENV: (c) => (c.remoteExec?.provider === "k8s" ? Object.keys(c
|
|
528
|
-
DOCKER_SANDBOX_ENV: (c) => (c.remoteExec?.provider === "local-docker" ? Object.keys(c
|
|
546
|
+
E2B_SANDBOX_ENV: (c) => (c.remoteExec?.provider === "e2b" ? Object.keys(sandboxForwardedEnvOf(c)) : []),
|
|
547
|
+
K8S_SANDBOX_ENV: (c) => (c.remoteExec?.provider === "k8s" ? Object.keys(sandboxForwardedEnvOf(c)) : []),
|
|
548
|
+
DOCKER_SANDBOX_ENV: (c) => (c.remoteExec?.provider === "local-docker" ? Object.keys(sandboxForwardedEnvOf(c)) : []),
|
|
529
549
|
};
|
|
530
550
|
const SERVER_ENV_NAME_ALLOWLIST_KNOBS = Object.keys(NAMES_IN_FORCE);
|
|
531
551
|
export function sandboxEnvNamesInForce(seats) {
|
|
@@ -889,11 +909,14 @@ function parseStoreDomain(ctx) {
|
|
|
889
909
|
},
|
|
890
910
|
});
|
|
891
911
|
}
|
|
892
|
-
const
|
|
893
|
-
const sessionBackendRaw = enumEnv("SESSION_BACKEND",
|
|
912
|
+
const declaredSqlEngine = dbBackendSet && (dbBackend === "mysql" || dbBackend === "pg") ? dbBackend : undefined;
|
|
913
|
+
const sessionBackendRaw = enumEnv("SESSION_BACKEND", declaredSqlEngine !== undefined ? "mysql" : "memory", SESSION_BACKENDS);
|
|
894
914
|
const sessionBackend = sessionBackendRaw === "mysql" ? "tidb" : sessionBackendRaw;
|
|
895
915
|
const localDataRoot = resolveLocalDataRoot(process.env, homedir());
|
|
896
916
|
const dbHostSet = dbBackend === "pg" ? !!process.env.PG_HOST : !!process.env.MYSQL_HOST;
|
|
917
|
+
if (declaredSqlEngine !== undefined && !dbHostSet) {
|
|
918
|
+
throw new Error(buildDeclaredEngineWithoutCoordinatesRefusal(declaredSqlEngine, missingSqlCoordinateKeys(declaredSqlEngine, process.env)));
|
|
919
|
+
}
|
|
897
920
|
const needsTidb = sessionBackend === "tidb" || (sessionBackend === "auto" && dbHostSet);
|
|
898
921
|
const needsDb = needsTidb;
|
|
899
922
|
const sqlCoordinateKeys = [...(process.env.MYSQL_HOST ? ["MYSQL_HOST"] : []), ...(process.env.PG_HOST ? ["PG_HOST"] : [])];
|
|
@@ -1631,7 +1654,7 @@ function parseMemoryEmbedder(ctx) {
|
|
|
1631
1654
|
throw new Error(`MEMORY_EMBEDDER_DIM="${dimRaw}" must be a positive integer (the embedding dimension, e.g. 1024). A wrong dimension writes wrong-length vectors into the memory embedding column, which neither the DB nor retrieval reports — the vector plane just silently degrades to the lexical floor (#228).`);
|
|
1632
1655
|
}
|
|
1633
1656
|
if (ctx.memoryEngineBackend !== "pg") {
|
|
1634
|
-
throw new Error(`MEMORY_EMBEDDER_* is set but MEMORY_ENGINE_BACKEND=${ctx.memoryEngineBackend} — the vector plane exists only on the pg memory backend (the
|
|
1657
|
+
throw new Error(`MEMORY_EMBEDDER_* is set but MEMORY_ENGINE_BACKEND=${ctx.memoryEngineBackend} — the vector plane exists only on the pg memory backend (the mysql backend is lexical-only in v1 and refuses an embedder; the file engine has no embedder seam). Set MEMORY_ENGINE_BACKEND=pg, or unset MEMORY_EMBEDDER_*.`);
|
|
1635
1658
|
}
|
|
1636
1659
|
if (!ctx.memoryEngineEnabled) {
|
|
1637
1660
|
throw new Error("MEMORY_EMBEDDER_* is set but MEMORY_ENGINE=off — the memory engine is not wired at all, so the embedder would never be called; unset one of the two (#228)");
|
|
@@ -1734,6 +1757,9 @@ function parseMemoryDomain(ctx) {
|
|
|
1734
1757
|
if (scope === undefined) {
|
|
1735
1758
|
throw new Error("MEMORY_SYNC_URL is set but no sync scope is derivable (memory engine off or multi-tenant without an explicit scope) — set MEMORY_SYNC_SCOPE, or run the single-user file memory engine with a typed MEMORY_SCOPE (e.g. user:<tenant>) so it provides one");
|
|
1736
1759
|
}
|
|
1760
|
+
if (carriesCredential(scope)) {
|
|
1761
|
+
throw new Error(`${memorySyncScopeRaw !== undefined ? "MEMORY_SYNC_SCOPE" : "MEMORY_SCOPE"} (the memory sync layer's name) holds a credential-shaped part — the layer name travels verbatim in every sync request path and report, so it is refused, never cleaned: rename the layer`);
|
|
1762
|
+
}
|
|
1737
1763
|
assertProjectLayerOwnable(scope, memorySyncScopeRaw !== undefined ? "MEMORY_SYNC_SCOPE" : "MEMORY_SCOPE");
|
|
1738
1764
|
memorySync = {
|
|
1739
1765
|
url: memorySyncUrl,
|
|
@@ -1771,6 +1797,7 @@ function parseMemoryDomain(ctx) {
|
|
|
1771
1797
|
memoryScope,
|
|
1772
1798
|
...((v) => (v !== undefined ? { memoryPersistenceCapable: v } : {}))(parseMemoryPersistenceCapable(process.env.MEMORY_PERSISTENCE_CAPABLE)),
|
|
1773
1799
|
...(memorySync ? { memorySync } : {}),
|
|
1800
|
+
...((v) => (v !== undefined ? { memorySyncServeIdentity: v } : {}))(parseMemorySyncServeIdentity(process.env.MEMORY_SYNC_SERVE_IDENTITY)),
|
|
1774
1801
|
...((v) => (v !== undefined ? { memoryEmbedder: v } : {}))(parseMemoryEmbedder({ memoryEngineBackend, memoryEngineEnabled })),
|
|
1775
1802
|
memoryOrgAdmissionMode,
|
|
1776
1803
|
...(process.env.MEMORY_DELEGATION_EVIDENCE !== undefined
|
|
@@ -1915,21 +1942,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
1915
1942
|
return boolEnv("LSP_HOST_ENABLED", true);
|
|
1916
1943
|
})();
|
|
1917
1944
|
const lspEnvAllow = parseEnvNameAllowlist("LSP_ENV_ALLOW", singleUserTurnkey) ?? [];
|
|
1918
|
-
|
|
1919
|
-
const lane = process.env.REMOTE_EXEC;
|
|
1920
|
-
if (lane !== undefined && lane !== "") {
|
|
1921
|
-
const word = REMOTE_EXEC_PROVIDER_WORDS.find((w) => w === lane);
|
|
1922
|
-
if (word === undefined) {
|
|
1923
|
-
throw new Error(`REMOTE_EXEC="${lane}" is not an execution lane — valid: ${REMOTE_EXEC_PROVIDER_WORDS.join(" | ")}. ` +
|
|
1924
|
-
`An unrecognized value used to fall through to the host/in-process lane silently; refusing to start instead (#157).`);
|
|
1925
|
-
}
|
|
1926
|
-
const missing = laneMissingEnv(word, process.env);
|
|
1927
|
-
if (missing.length > 0) {
|
|
1928
|
-
throw new Error(`REMOTE_EXEC=${lane} but required env ${missing.join(", ")} ${missing.length === 1 ? "is" : "are"} unset, empty or whitespace-only — it counts as absent: ` +
|
|
1929
|
-
`refusing to start rather than silently downgrading to the host/in-process lane (#157; set ${missing.length === 1 ? "it" : "them"}, or unset REMOTE_EXEC if you meant no sandbox lane).`);
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1945
|
+
const declaredLane = declaredExecutionLane(process.env.REMOTE_EXEC);
|
|
1933
1946
|
const readFaceFacts = process.env.READ_FACE !== undefined
|
|
1934
1947
|
? { readFace: enumEnv("READ_FACE", "roots", ["open", "roots"]), readFaceSource: "env" }
|
|
1935
1948
|
: { readFaceSource: "engine-default" };
|
|
@@ -1945,6 +1958,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
1945
1958
|
return { ...(tiers !== undefined ? { readDenyBuiltinTiers: tiers } : {}), ...(exclude !== undefined ? { readDenyBuiltinExclude: exclude } : {}) };
|
|
1946
1959
|
})(),
|
|
1947
1960
|
readDenyFloorRequired: boolEnv("READ_DENY_FLOOR_REQUIRED", false),
|
|
1961
|
+
sandboxReadFloor: enumEnv("SANDBOX_READ_FLOOR", SANDBOX_READ_FLOOR_DEFAULT, SANDBOX_READ_FLOOR_WORDS),
|
|
1948
1962
|
...((dir) => (dir !== undefined ? { agentConfigDir: dir } : {}))(declaredSemaConfigDir()),
|
|
1949
1963
|
...((p) => (p !== undefined ? { configLkgPath: p } : {}))(lkgPathOverrideOf(process.env.CONFIG_LKG_PATH)),
|
|
1950
1964
|
configLkgEnabled: boolEnv("CONFIG_LKG_ENABLED", true),
|
|
@@ -1960,7 +1974,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
1960
1974
|
}
|
|
1961
1975
|
return raw;
|
|
1962
1976
|
})()),
|
|
1963
|
-
remoteExec:
|
|
1977
|
+
remoteExec: declaredLane === "e2b" && process.env.E2B_API_KEY
|
|
1964
1978
|
? {
|
|
1965
1979
|
provider: "e2b",
|
|
1966
1980
|
apiKey: process.env.E2B_API_KEY,
|
|
@@ -1973,7 +1987,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
1973
1987
|
orphanReclaim: boolEnv("E2B_ORPHAN_RECLAIM", true),
|
|
1974
1988
|
}
|
|
1975
1989
|
:
|
|
1976
|
-
|
|
1990
|
+
declaredLane === "k8s" && process.env.K8S_SANDBOX_IMAGE && process.env.K8S_NAMESPACE
|
|
1977
1991
|
? {
|
|
1978
1992
|
provider: "k8s",
|
|
1979
1993
|
image: process.env.K8S_SANDBOX_IMAGE,
|
|
@@ -1995,7 +2009,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
1995
2009
|
...((c) => (c !== undefined ? { workspaceCache: c } : {}))(k8sWorkspaceCache()),
|
|
1996
2010
|
}
|
|
1997
2011
|
:
|
|
1998
|
-
|
|
2012
|
+
declaredLane === "ssh" && process.env.SSH_HOST && process.env.SSH_USER && process.env.SSH_PRIVATE_KEY
|
|
1999
2013
|
? {
|
|
2000
2014
|
provider: "ssh",
|
|
2001
2015
|
host: process.env.SSH_HOST,
|
|
@@ -2006,7 +2020,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
2006
2020
|
...((hk) => (hk !== undefined ? { hostKey: hk } : {}))(parseSshHostKeyEnv()),
|
|
2007
2021
|
}
|
|
2008
2022
|
:
|
|
2009
|
-
|
|
2023
|
+
declaredLane === "adb" && process.env.ADB_SERIAL
|
|
2010
2024
|
? {
|
|
2011
2025
|
provider: "adb",
|
|
2012
2026
|
serial: process.env.ADB_SERIAL,
|
|
@@ -2014,14 +2028,14 @@ function parseOrchestrationDomain(ctx) {
|
|
|
2014
2028
|
...(process.env.ADB_MOUNT_PATH ? { mountPath: process.env.ADB_MOUNT_PATH } : {}),
|
|
2015
2029
|
}
|
|
2016
2030
|
:
|
|
2017
|
-
|
|
2031
|
+
declaredLane === "host"
|
|
2018
2032
|
? {
|
|
2019
2033
|
provider: "host",
|
|
2020
2034
|
...(process.env.HOST_WORKSPACE_BASE ? { workspaceBase: process.env.HOST_WORKSPACE_BASE } : {}),
|
|
2021
2035
|
...((n) => (n !== undefined ? { commandTimeoutMs: n } : {}))(optNumEnvStrict("HOST_COMMAND_TIMEOUT_MS")),
|
|
2022
2036
|
}
|
|
2023
2037
|
:
|
|
2024
|
-
|
|
2038
|
+
declaredLane === "local-docker" && process.env.DOCKER_IMAGE
|
|
2025
2039
|
? {
|
|
2026
2040
|
provider: "local-docker",
|
|
2027
2041
|
image: process.env.DOCKER_IMAGE,
|
|
@@ -2039,7 +2053,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
2039
2053
|
...((names) => (names !== undefined ? { env: allowlistedEnv(names, process.env) } : {}))(parseEnvNameAllowlist("DOCKER_SANDBOX_ENV", singleUserTurnkey)),
|
|
2040
2054
|
}
|
|
2041
2055
|
:
|
|
2042
|
-
|
|
2056
|
+
declaredLane === "device"
|
|
2043
2057
|
? {
|
|
2044
2058
|
provider: "device",
|
|
2045
2059
|
...((n) => (n !== undefined ? { deliveryTimeoutMs: n } : {}))(parseDeviceBoundedIntEnv("DEVICE_DELIVERY_TIMEOUT_MS", process.env.DEVICE_DELIVERY_TIMEOUT_MS, DEVICE_DELIVERY_TIMEOUT_BOUNDS)),
|
|
@@ -2048,7 +2062,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
2048
2062
|
...((n) => (n !== undefined ? { maxInflightPerDevice: n } : {}))(parseDeviceBoundedIntEnv("DEVICE_MAX_INFLIGHT_PER_DEVICE", process.env.DEVICE_MAX_INFLIGHT_PER_DEVICE, DEVICE_HELLO_ACK_BOUNDS.maxInflight)),
|
|
2049
2063
|
...((n) => (n !== undefined ? { maxPreAuthPerRemote: n } : {}))(parseDevicePreAuthPerRemoteEnv()),
|
|
2050
2064
|
...((n) => (n !== undefined ? { enrollTokenTtlSec: n } : {}))(parseDeviceEnrollTokenTtlEnv()),
|
|
2051
|
-
|
|
2065
|
+
relay: parseDeviceRelayUrlEnv(process.env.DEVICE_RELAY_URL),
|
|
2052
2066
|
...(process.env.DEVICE_SUPERSEDE ? { supersede: enumEnv("DEVICE_SUPERSEDE", "stale_only", ["stale_only", "deny"]) } : {}),
|
|
2053
2067
|
}
|
|
2054
2068
|
:
|
|
@@ -2296,6 +2310,15 @@ function parseFleetScope(raw) {
|
|
|
2296
2310
|
}
|
|
2297
2311
|
return fleetScopeOf(raw);
|
|
2298
2312
|
}
|
|
2313
|
+
export function parseMemorySyncServeIdentity(raw) {
|
|
2314
|
+
if (raw === undefined || raw === "")
|
|
2315
|
+
return undefined;
|
|
2316
|
+
const flaw = declaredMemorySyncIdentityFlaw(raw);
|
|
2317
|
+
if (flaw !== undefined) {
|
|
2318
|
+
throw new Error(buildMemorySyncIdentityBootRefusal("MEMORY_SYNC_SERVE_IDENTITY", raw, flaw, "clients authenticate with MEMORY_SYNC_TOKEN; set MEMORY_SYNC_SERVE_IDENTITY to the bare base address clients reach this center's sync face at"));
|
|
2319
|
+
}
|
|
2320
|
+
return raw;
|
|
2321
|
+
}
|
|
2299
2322
|
function parseFleetAdvertiseAddress(raw) {
|
|
2300
2323
|
const name = "FLEET_ADVERTISE_ADDRESS";
|
|
2301
2324
|
if (raw === undefined || raw === "")
|
|
@@ -2455,7 +2478,7 @@ const APPROVAL_GROUP_KEYS = [
|
|
|
2455
2478
|
];
|
|
2456
2479
|
const MEMORY_GROUP_KEYS = [
|
|
2457
2480
|
"memoryEngineEnabled", "memoryEngineDir", "memoryEngineRemoteLaneAllowed", "memoryEngineBackend", "memoryScope",
|
|
2458
|
-
"memoryPersistenceCapable", "memorySync", "memoryEmbedder", "memoryOrgAdmissionMode", "memoryDelegationEvidence", "memoryProvenance", "memoryCapturePolicy", "memoryConsolidationDriver", "memoryOrgDirectoryJson", "memoryOrgGrantTtlMs", "memoryOrgUnavailableBackoffMs",
|
|
2481
|
+
"memoryPersistenceCapable", "memorySync", "memorySyncServeIdentity", "memoryEmbedder", "memoryOrgAdmissionMode", "memoryDelegationEvidence", "memoryProvenance", "memoryCapturePolicy", "memoryConsolidationDriver", "memoryOrgDirectoryJson", "memoryOrgGrantTtlMs", "memoryOrgUnavailableBackoffMs",
|
|
2459
2482
|
"projectMemoryEnabled", "syncImportLeaseStaleSec",
|
|
2460
2483
|
];
|
|
2461
2484
|
const AUTH_GROUP_KEYS = [
|
|
@@ -2465,14 +2488,14 @@ const AUTH_GROUP_KEYS = [
|
|
|
2465
2488
|
"principalJwtMaxTtlSec", "authBridgeIssuer", "bindHost", "bindHostSource",
|
|
2466
2489
|
];
|
|
2467
2490
|
const ORCHESTRATION_GROUP_KEYS = [
|
|
2468
|
-
"remoteExec", "remoteExecHomeDir", "requireExecutionLane", "worktreeIsolation", "leaderEnabled", "leaderFanoutEnabled", "routerEnabled", "selfOrchestrationEnabled",
|
|
2491
|
+
"sandboxGit", "remoteExec", "remoteExecHomeDir", "requireExecutionLane", "worktreeIsolation", "leaderEnabled", "leaderFanoutEnabled", "routerEnabled", "selfOrchestrationEnabled",
|
|
2469
2492
|
"selfOrchestrationModels", "selfOrchestrationWorkerIsolation", "forkEnabled", "experimentalObserverAgents",
|
|
2470
2493
|
"schedulerEnabled", "schedulerSessionWakeup", "schedulerSessionLifetime", "schedulerStorePath", "planModeEnabled", "hooksTimeoutMs", "workflowRunStoreBackend",
|
|
2471
2494
|
"workflowOrphanGraceMs", "workflowJournalRetentionMs", "workflowRunRetentionMs", "usageWindows", "workflowAgentsReadOnly",
|
|
2472
2495
|
"workflowSizeGuideline", "backgroundAgentRetentionMs", "backgroundAgentStaleRunningMs",
|
|
2473
2496
|
"backgroundAgentParkClaimStaleMs", "delegationEntryCaps", "rosterRetentionMs", "leaderRunStaleMs", "scratchpadSweepTtlMs", "sandboxPkgSource", "sandboxPkgSourceCustom",
|
|
2474
2497
|
"sessionAutoTitle", "sessionAutoTitleSource", "selectEnvironmentTool", "envFactsEnabled", "toolDeferLongtail", "lspEnabled", "lspHostEnabled", "lspEnvAllow",
|
|
2475
|
-
"imageBakes", "readFace", "readFaceSource", "taskWriteFaceEscalation", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude", "readDenyFloorRequired",
|
|
2498
|
+
"imageBakes", "readFace", "readFaceSource", "taskWriteFaceEscalation", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude", "readDenyFloorRequired", "sandboxReadFloor",
|
|
2476
2499
|
"agentConfigDir", "configLkgPath", "configLkgEnabled",
|
|
2477
2500
|
];
|
|
2478
2501
|
const LIMITS_HTTP_GROUP_KEYS = [
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 🔴 **委派子代会话的属主 —— 一条律;三处写点,各自的来源集;属主 = 判断时见证到的,写只 CAS 子行自己**([ref])。
|
|
3
3
|
*
|
|
4
4
|
* ## 律
|
|
5
|
-
* 一只委派子代会话(引擎为委派铸的 placed
|
|
5
|
+
* 一只委派子代会话(引擎为委派铸的 placed 会话;升级前停驻时晋升进宿主店的普通行在停驻挂点也按这条律比对)的属主**不是它自己的事实**:它是发起它的那棵委派树的
|
|
6
6
|
* **根会话的属主**。树根是**铸行那一刻存在的那只根行**(id + 住客化身,`session-incarnation.ts`);此后同 id 另起的会话不是这棵树的根。所以写下的属主 =
|
|
7
7
|
* **判断时见证到的**(读法顺序按写点交来的来源集):
|
|
8
8
|
* 1. 根会话在本店有行 ⇒ 它的属主(根无主 ⇒ 子代也无主 —— 与根同读数,不是另一种读数);
|
|
@@ -29,26 +29,28 @@
|
|
|
29
29
|
* 会话面 / fork / 删除 / 审批豁免 / notify 同读;dev-open 照旧 fleet-wide),具名主体与没有 service 凭据的无身份调用方一律与别人的行同体 404 ——
|
|
30
30
|
* 所以还没定下的行只是暂时只有 fleet 面读得到,不是谁都能读。它们由一次性迁移 M23(窗内每次起服)或这一行的下一次停驻(停驻挂点的认领)
|
|
31
31
|
* 定下;两处都不承诺「一次收敛」。
|
|
32
|
-
*
|
|
33
|
-
* (
|
|
32
|
+
* **只有记录委派树的行才认领**:三只持久会话店的 placed 行都记着委派树(placement 元组:SQL 两店在 `session_meta`,local 店在会话存档行头);
|
|
33
|
+
* 不记委派树的行(普通行,含升级前停驻时晋升进来的行)⇒ 没有可按的树 ⇒ 不认领(在停驻挂点照「属主不是律给的那一只 ⇒ 拒」处置)。不按更松的判据认领。
|
|
34
34
|
*
|
|
35
35
|
* ## 三处写点 —— 律一只,**来源集按写点不同**(都调这里,不各写一份判据)
|
|
36
|
-
* ·
|
|
37
|
-
*
|
|
36
|
+
* · **三只持久会话店按 placement 建行**({@link createPlacedSessionRow}:`plugins/tidb-session-store.ts` / `plugins/pg-session-storage.ts` 的 acquire 一条 INSERT,属主与 placement
|
|
37
|
+
* 同一笔落库;`plugins/local-session-store.ts` 的 acquire 先建存档(行头带元组)、再写会话元数据那一格(属主 + 化身))。来源 = placement 上的根、父两只 id({@link ownerSourcesOf});
|
|
38
|
+
* 读来源 → 判 → 写(首写律)。读来源之后来源才变有主(滚动升级窗里别的副本的
|
|
38
39
|
* M23 回填了无主的父)⇒ 写下的仍是判断时的读数 —— 按律如此;那一行若因此无主,照上一节处置。
|
|
39
|
-
* · **停驻挂点**(`plugins/session-store.ts` 的 `
|
|
40
|
+
* · **停驻挂点**(`plugins/session-store.ts` 的 `attestChildSessionDurable`;只验、不搬):来源 = **调用方交出的委派树根,只有这一只**,连同
|
|
40
41
|
* 调用方判断那一刻读到的根行住客({@link DelegationRootWitness};见证值,判断用,不进 CAS):请求腿 = 本请求经鉴权解析的会话,住客 = 受理时那一读
|
|
41
42
|
* (`boot/resolve-spec.ts`);`/decide` 的赎回腿 = 行上的 `rootSessionId`,住客 = 赎回腿写口放行的那一位(认领之前解析器那一读;`parked-revive-surface.ts`,每一行都交)。
|
|
42
|
-
* 挂点先读一次根行:它在而住客不是见证的那一位 ⇒ 根被删、同 id 换了住客 ⇒ **拒**(
|
|
43
|
+
* 挂点先读一次根行:它在而住客不是见证的那一位 ⇒ 根被删、同 id 换了住客 ⇒ **拒**(不按新住客认领,{@link assertRootStillWitnessed});它不在 ⇒ 律给哨兵
|
|
43
44
|
* (根真没了)。不回落父:core 的挂点 `ensureChildSessionDurable(sessionId)` 只交子代 id,父 id 在这一写点拿不到;两条候选读法都读不到东西 ——
|
|
44
|
-
* ①
|
|
45
|
+
* ① 读子代行记下的父:记着委派树的行(placed 行)在下面的定夺里本就按**它记录的**根、父再判一次;不记委派树的行(升级前晋升进来的普通行)没有这一格;
|
|
45
46
|
* ② 登记簿(后台子代行 / core 注册簿):core 接口没有「按子代 sessionId 查行」的读口,SQL 表 `background_agent.session_id` 无索引,加一条只在一处用的私有读腿
|
|
46
47
|
* = 多一只读法;`scope` 列还把匿名折成 `"default"`(与真名 `default` 的租户不可分)。行上没有根(没有会话的取用形)⇒ 来源集空 ⇒ 哨兵。
|
|
47
48
|
* 宿主行的属主经 {@link settleDelegatedOwner} 定下:宿主行记着委派树而不是这一棵 ⇒ 拒(两边属主都是 null 也拒);记着这一棵 ⇒ 按**它记录的** placement(根、父)
|
|
48
49
|
* 再判一次(与 M23 对同一行同读数 —— 见证只答「是不是这一棵、根住客换没换」,来源集取行上记的),无主 ⇒ 认领(CAS 子行),认领试了没落下 ⇒ 拒;然后比对 ——
|
|
49
|
-
* 不是律给的那一只 ⇒
|
|
50
|
+
* 不是律给的那一只 ⇒ 停驻否决。
|
|
50
51
|
* · **一次性迁移 M23**(`plugins/one-time-migrations.ts`):存量 placed 行,来源 = 根、父(扫描时同一条语句连读两行);回填 = 认领(同一句,绑扫描读到的子行化身)。
|
|
51
|
-
* local
|
|
52
|
+
* local 店没有第三处:它的 placed 行自本律起由第一处写下(属主在建行那一笔);存档在而那一格缺(建行两笔之间崩了,或同一数据根上 run-local 腿写下的 placed 存档)
|
|
53
|
+
* 读作从没被记下的属主 = 无主,照「无主的子代行」一节处置(停驻挂点的认领)。
|
|
52
54
|
*/
|
|
53
55
|
import type { SessionPlacement } from "@sema-agent/core";
|
|
54
56
|
import { type HeadRead, type SessionFace } from "./session-incarnation.js";
|
|
@@ -103,8 +105,8 @@ export declare function readDelegatedOwner(childId: string, placement: Placement
|
|
|
103
105
|
export interface OrphanOwnerLog {
|
|
104
106
|
warn(msg: string, fields?: Record<string, unknown>): void;
|
|
105
107
|
}
|
|
106
|
-
/** 写点的名字(warn 行的 `site` 字段:运维据它知道是哪一笔写下的哨兵)。`
|
|
107
|
-
export type DelegatedOwnerSite = "placed_create" | "
|
|
108
|
+
/** 写点的名字(warn 行的 `site` 字段:运维据它知道是哪一笔写下的哨兵)。`placed_create` = 按 placement 建行;`park` = 停驻挂点对宿主无主 placed 行的认领。 */
|
|
109
|
+
export type DelegatedOwnerSite = "placed_create" | "park";
|
|
108
110
|
/** 一笔写**已落下**之后调:写下的是孤行哨兵 ⇒ 一行 warn(写失败的那一笔走不到这里,不留下「已写」的话)。继承来的属主(含继承自孤行祖先的哨兵)不告。 */
|
|
109
111
|
export declare function reportWrittenOwner(log: OrphanOwnerLog, site: DelegatedOwnerSite, childId: string, judged: JudgedOwner): void;
|
|
110
112
|
/**
|
|
@@ -116,7 +118,7 @@ export declare function reportWrittenOwner(log: OrphanOwnerLog, site: DelegatedO
|
|
|
116
118
|
export declare const CLAIM_OWNERLESS_PLACED_SQL: Readonly<Record<SqlDialect, string>>;
|
|
117
119
|
/** 认领句的绑参(两方言同序;店与 M23 都经它,不各排一份):`incarnation` = 判断时读到的子行化身。 */
|
|
118
120
|
export declare function claimOwnerlessParams(sessionId: string, incarnation: string, owner: string): readonly [string, string, string];
|
|
119
|
-
/** 店的认领口(
|
|
121
|
+
/** 店的认领口(三只持久会话店 + 缓存包装层同一个签名):这只会话的那一位住客(`incarnation`)仍是无主的 placed 行 ⇒ 写 `owner`,返回是否写成。 */
|
|
120
122
|
export type OwnerlessClaim = (sessionId: string, incarnation: string, owner: string) => Promise<boolean>;
|
|
121
123
|
/** 一只 SQL 店建 placed 行要交的 I/O(两店按各自方言交,都是店的既有读写口;读法与顺序只住在 {@link createPlacedSessionRow})。 */
|
|
122
124
|
export interface PlacedRowWriter {
|
|
@@ -146,7 +148,7 @@ export interface DelegationRootWitness {
|
|
|
146
148
|
* 根行此刻不在 ⇒ 不抛(根真没了 ⇒ 律给哨兵,不是「换了住客」)。这是**判断**的一部分;判断之后、写之前根的变化不改变写进去的值(律:属主 = 判断时见证到的)。
|
|
147
149
|
*/
|
|
148
150
|
export declare function assertRootStillWitnessed(sessionId: string, witness: DelegationRootWitness | undefined, judged: JudgedOwner): void;
|
|
149
|
-
/** 记录委派树的宿主店多交的两只口(
|
|
151
|
+
/** 记录委派树的宿主店多交的两只口(三只持久会话店与缓存包装层;无 repo 的内存店两只都没有 ⇒ 没有可按的树 ⇒ 不认领)。 */
|
|
150
152
|
export interface DelegationTreeStore {
|
|
151
153
|
/** 本行落库的 placement 元组(`undefined` = 本行不是 placed 行 ⇒ 不记委派树)。 */
|
|
152
154
|
readonly placementOf: (sessionId: string) => Promise<PlacementSources | undefined>;
|
|
@@ -159,7 +161,7 @@ export interface DelegatedOwnerHost {
|
|
|
159
161
|
readonly trees: DelegationTreeStore | undefined;
|
|
160
162
|
}
|
|
161
163
|
/**
|
|
162
|
-
* 「这只宿主店能不能承载委派子代的属主」—— 只判这一处(
|
|
164
|
+
* 「这只宿主店能不能承载委派子代的属主」—— 只判这一处(停驻挂点读它):店有按 id 的头读(`headOf`,「有没有」沿用 `headReadOf` 的同一处判法)⇒
|
|
163
165
|
* 绑好的 {@link DelegatedOwnerHost};没有 ⇒ `undefined`(调用方响亮拒:读不回属主的宿主店上,停驻出来的就是一只谁都能读的转录)。记录委派树的两只口
|
|
164
166
|
* (`placementOf` + `claimOwnerless`)**同在或同缺**:同在 ⇒ `trees`;同缺 ⇒ 不记委派树;只有一只 ⇒ `undefined`(记着树却认领不了,或认领却读不回树 —— 半只店不猜)。
|
|
165
167
|
*/
|
|
@@ -174,13 +176,13 @@ export interface SettledOwner {
|
|
|
174
176
|
readonly judged: JudgedOwner | undefined;
|
|
175
177
|
}
|
|
176
178
|
/**
|
|
177
|
-
* 宿主店里这只会话的行属主**按律定下来**(
|
|
178
|
-
* `owner` / `tree` =
|
|
179
|
-
* 1. 宿主行**记着委派树**(
|
|
179
|
+
* 宿主店里这只会话的行属主**按律定下来**(停驻挂点的那一道;拒句不带任何一方的属主值 —— 它会进停驻否决的错误面)。
|
|
180
|
+
* `owner` / `tree` = 调用方按见证的根判出的属主与委派树。
|
|
181
|
+
* 1. 宿主行**记着委派树**(placed 行):记下的根 ≠ `tree.root` ⇒ 抛(不以属主是否 null 为前提:那是另一棵树的行);是这一棵 ⇒ **按它记录的 placement(根、父)
|
|
180
182
|
* 再判一次**(唯一判据 {@link judgeDelegatedOwner} —— 与 M23 / 建行复核对这一行同读数:根不在取父),调用方那一读之后根住客变了 ⇒ 抛({@link assertRootStillWitnessed},
|
|
181
183
|
* 调用方的读数当见证);行无主而律给出属主 ⇒ 认领(CAS 刚读到的那一位住客;写进去的是这一次判的读数)—— **试了没落下 ⇒ 抛**(这一行在判断之后被写过 /
|
|
182
184
|
* 删过 / 换了住客,不由事后的属主比对放行);
|
|
183
|
-
* 2. 不记委派树的行(
|
|
185
|
+
* 2. 不记委派树的行(普通行,含升级前晋升进来的行)不认领、不再判;
|
|
184
186
|
* 3. 比对 —— 此刻的属主不是律给的那一只(记着委派树 ⇒ 按记录的树判的那一只;否则 = `owner`)⇒ 抛。
|
|
185
187
|
*/
|
|
186
188
|
export declare function settleDelegatedOwner(host: DelegatedOwnerHost, sessionId: string, owner: string | null, tree: DelegationTree): Promise<SettledOwner>;
|
|
@@ -80,7 +80,7 @@ export function delegatedOwnerHostOf(store) {
|
|
|
80
80
|
}
|
|
81
81
|
export async function settleDelegatedOwner(host, sessionId, owner, tree) {
|
|
82
82
|
const refuse = () => new Error(`session "${sessionId}" cannot be parked as this delegated session: the host session store holds a session with this id that is not this delegation tree's ` +
|
|
83
|
-
"(a different owner, or a different recorded delegation root),
|
|
83
|
+
"(a different owner, or a different recorded delegation root), so it does not attest this delegated transcript");
|
|
84
84
|
const face = sessionFaceOfHead(sessionId, await host.headOf(sessionId));
|
|
85
85
|
const trees = host.trees;
|
|
86
86
|
const recorded = face === undefined || trees === undefined ? undefined : await trees.placementOf(sessionId);
|
package/dist/device-store.d.ts
CHANGED
|
@@ -395,6 +395,12 @@ export interface DeviceStore {
|
|
|
395
395
|
placeDeviceExecution(input: PlaceDeviceExecutionInput): Promise<PlaceDeviceExecutionResult>;
|
|
396
396
|
/** O4 显式换绑(v2 稿 §2 步 2/3/5):目标设备门 + 写事务内锁根行读认领 + 前态 CAS + `session_rebound` 审计行同一事务。 */
|
|
397
397
|
rebindDeviceExecution(input: RebindDeviceExecutionInput): Promise<RebindDeviceExecutionResult>;
|
|
398
|
+
/**
|
|
399
|
+
* 绑定数:根会话行上 writer(device, D) 的格数 —— 唯一读法 `boundDeviceOf` 的聚合(SQL 侧只缩小读的行,每行过唯一解码:`execution-placement-sql.ts`
|
|
400
|
+
* `countDeviceBindingsOn`)。数的是格,不 join 设备行(吊销设备上的格照数:格还在,会话仍放在那台设备上)。只交一个数。读故障与解码器拒的行原样抛(不折成 0)。
|
|
401
|
+
* 读者:起服门「设备入口 × 已绑设备」(`boot/device-lane.ts`)。
|
|
402
|
+
*/
|
|
403
|
+
countDeviceBindings(): Promise<number>;
|
|
398
404
|
appendAudit(input: AppendAuditInput): Promise<void>;
|
|
399
405
|
listAudit(filter?: ListAuditFilter): Promise<DeviceAuditRow[]>;
|
|
400
406
|
}
|
|
@@ -432,6 +438,7 @@ export declare class InMemoryDeviceStore implements DeviceStore {
|
|
|
432
438
|
releaseConnection(deviceId: string, generation: number): Promise<boolean>;
|
|
433
439
|
placeDeviceExecution(input: PlaceDeviceExecutionInput): Promise<PlaceDeviceExecutionResult>;
|
|
434
440
|
rebindDeviceExecution(input: RebindDeviceExecutionInput): Promise<RebindDeviceExecutionResult>;
|
|
441
|
+
countDeviceBindings(): Promise<number>;
|
|
435
442
|
appendAudit(input: AppendAuditInput): Promise<void>;
|
|
436
443
|
listAudit(filter?: ListAuditFilter): Promise<DeviceAuditRow[]>;
|
|
437
444
|
private isOnline;
|
package/dist/device-store.js
CHANGED
|
@@ -386,6 +386,9 @@ export class InMemoryDeviceStore {
|
|
|
386
386
|
this.pushAudit({ event: "session_rebound", deviceId: input.targetDeviceId, owner: input.owner, detail: { from: out.from, to: input.targetDeviceId, rev: out.device.rev } });
|
|
387
387
|
return out;
|
|
388
388
|
}
|
|
389
|
+
async countDeviceBindings() {
|
|
390
|
+
return this.seat.countDeviceBindings();
|
|
391
|
+
}
|
|
389
392
|
async appendAudit(input) {
|
|
390
393
|
this.pushAudit(input);
|
|
391
394
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type LaneHomeDeployment, type RemoteExecProvider } from "./execution-lane-caps.js";
|
|
2
|
+
/** 选中车道转进沙箱的 env 那一座(`ServiceConfig.remoteExec` 的判别联合每一臂结构上都满足:e2b / k8s 的 `sandboxEnv`、local-docker 的 `env`,别的臂两键都没有)。 */
|
|
3
|
+
export interface SandboxEnvSeat {
|
|
4
|
+
readonly remoteExec?: {
|
|
5
|
+
readonly provider: RemoteExecProvider;
|
|
6
|
+
readonly sandboxEnv?: Readonly<Record<string, string>> | undefined;
|
|
7
|
+
readonly env?: Readonly<Record<string, string>> | undefined;
|
|
8
|
+
} | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** 求配置根要读的部署事实(`ServiceConfig` 结构上满足;存体预判的问点传活配置整份)。 */
|
|
11
|
+
export interface ExecutionConfigRootDeployment extends LaneHomeDeployment, SandboxEnvSeat {
|
|
12
|
+
readonly agentConfigDir?: string;
|
|
13
|
+
readonly remoteExec?: SandboxEnvSeat["remoteExec"];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 被选中的沙箱车道上运维点名转进沙箱的 env(e2b / k8s 的 `sandboxEnv`、local-docker 的 `env` —— 名单型旋钮经 `allowlistedEnv` 取的原值);
|
|
17
|
+
* 车道没有这一座 ⇒ 空。名单此刻交出去的名(`config.ts` 的 `sandboxEnvNamesInForce`)读的也是这一只。
|
|
18
|
+
*/
|
|
19
|
+
export declare function sandboxForwardedEnvOf(deployment: SandboxEnvSeat): Readonly<Record<string, string>>;
|
|
20
|
+
/** 执行环境的配置根(规则见文件头);读不出 ⇒ `undefined`。 */
|
|
21
|
+
export declare function executionConfigRootOf(deployment: ExecutionConfigRootDeployment): string | undefined;
|
|
22
|
+
//# sourceMappingURL=execution-config-root.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
3
|
+
import { executionLaneHomeDir, executionLaneOf } from "./execution-lane-caps.js";
|
|
4
|
+
import { configRootOf } from "./sema-config-dir.js";
|
|
5
|
+
const CONFIG_DIR_ENV = "SEMA_CONFIG_DIR";
|
|
6
|
+
export function sandboxForwardedEnvOf(deployment) {
|
|
7
|
+
const lane = executionLaneOf(deployment.remoteExec?.provider);
|
|
8
|
+
switch (lane) {
|
|
9
|
+
case "e2b":
|
|
10
|
+
case "k8s":
|
|
11
|
+
return deployment.remoteExec?.sandboxEnv ?? {};
|
|
12
|
+
case "local-docker":
|
|
13
|
+
return deployment.remoteExec?.env ?? {};
|
|
14
|
+
case "in-process":
|
|
15
|
+
case "host":
|
|
16
|
+
case "ssh":
|
|
17
|
+
case "adb":
|
|
18
|
+
case "device":
|
|
19
|
+
return {};
|
|
20
|
+
default: {
|
|
21
|
+
const unhandled = lane;
|
|
22
|
+
return unhandled;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function executionConfigRootOf(deployment) {
|
|
27
|
+
if (!DEPLOYMENT_SHAPE_PREDICATES.sandboxPathAdjudication.holds(deployment))
|
|
28
|
+
return configRootOf(deployment);
|
|
29
|
+
const forwarded = sandboxForwardedEnvOf(deployment)[CONFIG_DIR_ENV];
|
|
30
|
+
if (forwarded !== undefined)
|
|
31
|
+
return forwarded;
|
|
32
|
+
const home = executionLaneHomeDir(deployment);
|
|
33
|
+
return home === undefined ? undefined : posix.join(home, ".sema");
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=execution-config-root.js.map
|
|
@@ -65,12 +65,34 @@ export interface ExecutionLaneCaps {
|
|
|
65
65
|
* (不是遗漏:设备侧长驻进程、LSP sidecar、直传腿都是 follow-on,声明了就是谎)。
|
|
66
66
|
*/
|
|
67
67
|
export declare function executionLaneCaps(lane: ExecutionLane): ExecutionLaneCaps;
|
|
68
|
-
/**
|
|
68
|
+
/** 读地板旋钮的 env 名(拒起句与起服行点名它)。 */
|
|
69
|
+
export declare const SANDBOX_READ_FLOOR_ENV = "SANDBOX_READ_FLOOR";
|
|
70
|
+
/** `SANDBOX_READ_FLOOR` 闭集:`keep` = 地板模块服务这条车道时守地板;`off` = 不守(车道块 `keepsReadFloor:false`,起动字节与没有地板模块时同)。 */
|
|
71
|
+
export declare const SANDBOX_READ_FLOOR_WORDS: readonly ["keep", "off"];
|
|
72
|
+
export type SandboxReadFloorKnob = (typeof SANDBOX_READ_FLOOR_WORDS)[number];
|
|
73
|
+
/** 缺省 `keep`:服务集翻进一条车道的那一版,这条车道就守地板(运维不必再开一次)。 */
|
|
74
|
+
export declare const SANDBOX_READ_FLOOR_DEFAULT: SandboxReadFloorKnob;
|
|
75
|
+
/** 地板模块能服务的车道(沙箱三车道;主机 / ssh / adb / device 约束不了进程,恒不守)。 */
|
|
76
|
+
export type SandboxFloorLane = Extract<ExecutionLane, "e2b" | "k8s" | "local-docker">;
|
|
77
|
+
/** 一条沙箱车道此刻的地板状态:`kept` = 守 · `off` = 部署关了 · `unserved` = 地板模块还不服务这条车道。起服行原样报这个词。 */
|
|
78
|
+
export type SandboxReadFloorState = "kept" | "off" | "unserved";
|
|
79
|
+
/** 派生的纯形(旋钮 × 服务与否 → 状态);`off` 先于服务集(部署关掉的车道不论服务与否都报 `off`)。 */
|
|
80
|
+
export declare function readFloorStateOf(knob: SandboxReadFloorKnob, served: boolean): SandboxReadFloorState;
|
|
81
|
+
/**
|
|
82
|
+
* 一条沙箱车道的地板状态 —— 沙箱块 `keepsReadFloor`(`=== "kept"`)、起服行与适配器手里地板模块的**唯一**判据。旋钮缺席 ⇒ {@link SANDBOX_READ_FLOOR_DEFAULT}。
|
|
83
|
+
*
|
|
84
|
+
* **服务集**住在这里,每条车道一臂(穷举 switch、无 default 臂):第二个实参 = 地板模块在这条车道上的起动接缝已经过真沙箱验收(性能闸 + 黑盒复跑)、
|
|
85
|
+
* 可以如实声明守地板。今天三臂皆 `false` —— 翻某一臂的前提是 core 让每一次起动都带地板、契约写明路径语义,以及那条车道的真跑读数。
|
|
86
|
+
*/
|
|
87
|
+
export declare function sandboxReadFloorState(lane: SandboxFloorLane, knob: SandboxReadFloorKnob | undefined): SandboxReadFloorState;
|
|
88
|
+
/** {@link capabilitiesFor} 读的部署配置:已装配的 `remoteExec` 里决定块的两键(`ServiceConfig` 的判别联合每一臂结构上都满足)+ 部署级读地板旋钮
|
|
89
|
+
* (`SANDBOX_READ_FLOOR`;缺席 ⇒ 缺省 `keep`,与 loader 同一只常量)。 */
|
|
69
90
|
export interface CapabilitiesDeployment {
|
|
70
91
|
readonly remoteExec?: {
|
|
71
92
|
readonly provider?: string | undefined;
|
|
72
93
|
readonly s3Snapshot?: unknown;
|
|
73
94
|
} | undefined;
|
|
95
|
+
readonly sandboxReadFloor?: SandboxReadFloorKnob | undefined;
|
|
74
96
|
}
|
|
75
97
|
/**
|
|
76
98
|
* 「这份部署上 run 所在的执行环境能做什么」—— 引擎能力块(八键)的**唯一作者**。
|
|
@@ -87,8 +109,15 @@ export declare function capabilitiesFor(deployment: {
|
|
|
87
109
|
readonly provider: RemoteExecProvider;
|
|
88
110
|
readonly s3Snapshot?: unknown;
|
|
89
111
|
} | undefined;
|
|
112
|
+
readonly sandboxReadFloor?: SandboxReadFloorKnob | undefined;
|
|
90
113
|
}): ExecutionEnvCapabilities;
|
|
91
114
|
export declare function capabilitiesFor(deployment: CapabilitiesDeployment): ExecutionEnvCapabilities | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* 本部署车道的读地板状态(`kept` / `off` / `unserved`;纯数据)—— 只沙箱三车道有这一格,别的车道(与认不出的词)⇒ `undefined`。
|
|
117
|
+
* 判据与块的 `keepsReadFloor` 同一只({@link sandboxBlock} 读的 `sandboxReadFloorState`):`keepsReadFloor === (本值 === "kept")` 是构造保证。
|
|
118
|
+
* 读者:起服行 `remote_exec_enabled.sandboxReadFloor`(说清不守的原因:部署关了,还是模块还没服务这条车道)。穷举 switch、无 default 臂。
|
|
119
|
+
*/
|
|
120
|
+
export declare function laneSandboxReadFloorState(deployment: CapabilitiesDeployment): SandboxReadFloorState | undefined;
|
|
92
121
|
/**
|
|
93
122
|
* 车道普查全集 = 本仓内部状态名 `in-process` + 词表正本的可声明车道(次序 = 正本声明序;对账测试按它逐 lane 跑真判别式)。
|
|
94
123
|
* 由正本派生、不手维护(手维护的「全表」已被代码反证漏过行)。
|
|
@@ -109,7 +138,8 @@ export declare function executionLaneRow(lane: RemoteExecProvider): ExecutionLan
|
|
|
109
138
|
* 一条车道**必需**的 env 键名 = 正本表行的 `requiredEnv ∪ requiredSecretEnv`(次序:非密坐标在前、密钥在后 —— 与 7.113.0 本仓手写表逐字同)。
|
|
110
139
|
* 读者:`config.ts` 的 [ref] 拒启门(点了名却缺件 ⇒ 点名缺哪几键)、部署面门(`test/deploy-lanes-contract.test.ts`:`lanes.json` 每行登记
|
|
111
140
|
* 本车道必需键)、`scripts/gen-deploy-lanes.ts`(从同一张正本生成 `lanes.json` 的必需键列,以及根 / review compose 与 sema-up 栈 compose 里的必需键透传)。
|
|
112
|
-
* device
|
|
141
|
+
* 每条车道的必需键都在这一张表上、缺席都由下面的 {@link laneMissingEnv} 一只判官判 —— device 行也是(契约包 16.0.0 起 `requiredEnv: ["DEVICE_RELAY_URL"]`):缺席 / 空串 / 只含空白在 `declaredExecutionLane` 的必需 env 门被拒,
|
|
142
|
+
* 走到 `config.ts` 的设备入口解析器 `parseDeviceRelayUrlEnv` 时值一定在,它只判值的文法与凭据形。没有哪个必需键另有一臂缺席判官。
|
|
113
143
|
*/
|
|
114
144
|
export declare function laneRequiredEnv(lane: RemoteExecProvider): readonly string[];
|
|
115
145
|
/**
|
|
@@ -126,6 +156,24 @@ export declare function isBlankRequiredEnvValue(value: string | undefined): bool
|
|
|
126
156
|
* 读者:`config.ts` 的 [ref] 拒启门(非空 ⇒ 拒启并点名缺哪几键);判的是调用方交来的 env 快照,本函数不读 `process.env`。
|
|
127
157
|
*/
|
|
128
158
|
export declare function laneMissingEnv(lane: RemoteExecProvider, env: Readonly<Record<string, string | undefined>>): readonly string[];
|
|
159
|
+
/** {@link readDeclaredLaneTable} 的答案:合文法 ⇒ 有序车道表(非空;首项 = 缺省);不合 ⇒ 拒句(点名那一段)。 */
|
|
160
|
+
export type DeclaredLaneTableReading = {
|
|
161
|
+
readonly lanes: readonly [RemoteExecProvider, ...RemoteExecProvider[]];
|
|
162
|
+
} | {
|
|
163
|
+
readonly refusal: string;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* `REMOTE_EXEC` 的**唯一读法** —— 部署声明的有序执行车道表。它是契约 `runtime.execution.lanes`(settings-schema 16.0.0 起是车道集)渲成 env 的形:
|
|
167
|
+
* `lanes.join(",")`,首项 = 缺省;单词 = 一元表,与此前的单值读法逐字同。
|
|
168
|
+
*
|
|
169
|
+
* 文法(契约写闸对 `lanes` 的同一组规则,在 env 串上的读法):逗号分段;每段**逐字**是一个可声明车道词({@link REMOTE_EXEC_PROVIDER_WORDS} = 契约词表,
|
|
170
|
+
* 不 trim、不折大小写 —— 渲染器不写空白,` k8s` 不是车道词);段不空;一条车道至多出现一次。`in-process` 是「没点名」这个状态的名字,不是可写词。
|
|
171
|
+
* 未设 / 空串**不是表**(没有声明 —— 调用方先判,本函数只收非空串)。
|
|
172
|
+
* 不合文法 ⇒ `refusal`,拒句点名那一段;只有一段时与单值时代的拒句逐字同。契约的退役车道值(墓碑 `RETIRED_LANE_WORDS`)拒句取契约的
|
|
173
|
+
* `retiredLaneWordRefusal`(出路在源头给,一句 —— 车道文件 `provider` 读到同一个旧词时契约给的是同一句)。本函数只判文法;本引擎版本能服务几条车道、
|
|
174
|
+
* 每条车道缺不缺必需键,是调用方的门。
|
|
175
|
+
*/
|
|
176
|
+
export declare function readDeclaredLaneTable(raw: string): DeclaredLaneTableReading;
|
|
129
177
|
/**
|
|
130
178
|
* [ref] 件③ / [ref] —— **「`REQUIRE_EXECUTION_LANE=true` ∧ 没有任何车道被点名 ⇒ 拒启」的判据与拒因句的唯一属主**(`modelProviderRefusal` /
|
|
131
179
|
* `modelRouteEndpointRefusal` 同形:属主在叶模块,执法点各自调它,登记在 `config-invariants.ts`)。
|