@sema-agent/server 7.141.0 → 7.143.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 +657 -0
- package/USAGE.md +102 -30
- package/dist/adoption/plan.js +22 -0
- package/dist/approval-ask-audit-store.d.ts +61 -43
- package/dist/approval-ask-audit-store.js +69 -44
- package/dist/approval-ask-machine.d.ts +15 -7
- package/dist/approval-ask-machine.js +10 -4
- package/dist/approval-card.d.ts +126 -27
- package/dist/approval-card.js +103 -23
- 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-queue-kind.d.ts +27 -0
- package/dist/approval-queue-kind.js +6 -0
- package/dist/approval-reconciler.d.ts +41 -9
- package/dist/approval-reconciler.js +45 -42
- package/dist/audit.js +4 -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 +17 -1
- package/dist/boot/budget-tracing.js +10 -6
- package/dist/boot/device-lane.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +24 -4
- package/dist/boot/execution-env.js +26 -23
- package/dist/boot/execution-lane.js +2 -1
- package/dist/boot/exit-boundary.js +5 -4
- package/dist/boot/governance-seams.d.ts +26 -41
- package/dist/boot/governance-seams.js +61 -28
- package/dist/boot/late-binds.d.ts +7 -4
- package/dist/boot/late-binds.js +3 -1
- package/dist/boot/leader.js +2 -4
- package/dist/boot/memory-consolidation.d.ts +0 -8
- package/dist/boot/memory-consolidation.js +5 -4
- 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.js +9 -7
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +19 -10
- package/dist/boot/retention-lane.js +5 -3
- package/dist/boot/runner-deps.d.ts +10 -7
- package/dist/boot/runner-deps.js +20 -29
- package/dist/boot/runtime-caps.js +3 -2
- package/dist/boot/session-faces.js +4 -3
- package/dist/boot/shutdown.d.ts +9 -0
- package/dist/boot/shutdown.js +19 -4
- package/dist/boot/stage-02-web-admin-pull.js +3 -0
- package/dist/boot/stage-03-store-backend.d.ts +4 -1
- package/dist/boot/stage-03-store-backend.js +1 -2
- package/dist/boot/stage-04-stores.d.ts +5 -2
- package/dist/boot/stage-04-stores.js +6 -7
- package/dist/boot/stage-05-execution-env.d.ts +6 -3
- package/dist/boot/stage-05-execution-env.js +8 -6
- package/dist/boot/stage-06-runners.d.ts +6 -3
- package/dist/boot/stage-06-runners.js +3 -4
- package/dist/boot/stage-07-capability-layer.d.ts +6 -3
- package/dist/boot/stage-07-capability-layer.js +7 -2
- package/dist/boot/stage-08-reapers.d.ts +6 -3
- package/dist/boot/stage-08-reapers.js +3 -2
- package/dist/boot/stage-09-leader.d.ts +6 -3
- package/dist/boot/stage-10-http-server.d.ts +6 -3
- package/dist/boot/stage-10-http-server.js +14 -5
- package/dist/boot/stores.d.ts +5 -2
- package/dist/boot/stores.js +10 -9
- package/dist/boot/web-admin.d.ts +5 -1
- package/dist/boot/web-admin.js +48 -36
- 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/hands-lane.d.ts +9 -39
- package/dist/capabilities/hands-lane.js +8 -13
- package/dist/capabilities/mcp-probe.d.ts +3 -2
- package/dist/capabilities/scenarios.d.ts +11 -1
- package/dist/capabilities/scenarios.js +1 -0
- package/dist/capabilities/skills.d.ts +1 -17
- package/dist/capabilities/skills.js +0 -8
- package/dist/capability-facts.d.ts +31 -7
- package/dist/capability-facts.js +27 -4
- package/dist/card-void.d.ts +6 -9
- package/dist/config-catalog.js +2 -1
- package/dist/config-dir-trust.js +58 -29
- package/dist/config-invariants.d.ts +7 -1
- package/dist/config-invariants.js +7 -0
- package/dist/config-provider.d.ts +10 -0
- package/dist/config-provider.js +15 -4
- package/dist/config-root-migration.d.ts +13 -0
- package/dist/config-root-migration.js +99 -0
- package/dist/config-types.d.ts +19 -8
- package/dist/config.d.ts +10 -3
- package/dist/config.js +18 -4
- package/dist/delegated-session-owner.d.ts +5 -3
- package/dist/delegated-session-owner.js +1 -1
- package/dist/device-ws-protocol.d.ts +1 -0
- package/dist/device-ws-protocol.js +2 -1
- package/dist/env-model-table-gate.d.ts +53 -0
- package/dist/env-model-table-gate.js +53 -0
- package/dist/execution-lane-caps.d.ts +2 -1
- package/dist/fleet/fleet-bus.d.ts +34 -55
- package/dist/fleet/fleet-bus.js +35 -100
- package/dist/fleet/fleet-reconciler.d.ts +4 -4
- package/dist/fleet/fleet-reconciler.js +1 -1
- package/dist/fleet/subagent-tail-bus.d.ts +14 -11
- package/dist/fleet/subagent-tail-bus.js +15 -28
- package/dist/hooks/hook-runner.d.ts +6 -0
- package/dist/hooks/hook-runner.js +58 -8
- package/dist/host-decision.d.ts +54 -20
- package/dist/host-decision.js +42 -14
- package/dist/http/admission.d.ts +1 -1
- package/dist/http/admission.js +7 -3
- package/dist/http/approval-sweeps.js +11 -8
- package/dist/http/caller-trust.d.ts +1 -1
- package/dist/http/dispatch.js +4 -2
- package/dist/http/durable-run-leg.js +2 -2
- package/dist/http/engine-refusal.d.ts +16 -0
- package/dist/http/engine-refusal.js +17 -0
- package/dist/http/execution-context.d.ts +2 -2
- package/dist/http/idempotency.d.ts +1 -1
- package/dist/http/memory-compliance-failure-reply.d.ts +1 -3
- package/dist/http/memory-compliance-failure-reply.js +4 -6
- package/dist/http/owner-access.d.ts +11 -0
- package/dist/http/owner-access.js +13 -0
- package/dist/http/principal-gate.d.ts +3 -1
- package/dist/http/principal-gate.js +17 -8
- package/dist/http/resume-legs.d.ts +21 -7
- package/dist/http/resume-legs.js +76 -58
- package/dist/http/resume-restatement.d.ts +39 -0
- package/dist/http/resume-restatement.js +25 -0
- package/dist/http/route-ctx.d.ts +35 -10
- package/dist/http/route-ctx.js +1 -1
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/approvals-assistant.d.ts +9 -1
- package/dist/http/routes/approvals-assistant.js +142 -31
- package/dist/http/routes/attachments.js +18 -0
- package/dist/http/routes/capabilities.js +16 -4
- package/dist/http/routes/memory-policy.d.ts +2 -2
- package/dist/http/routes/memory-policy.js +27 -7
- package/dist/http/routes/notify-wake.js +23 -25
- package/dist/http/routes/rules.js +48 -13
- package/dist/http/routes/runs.js +12 -11
- package/dist/http/routes/session-memory-sync.d.ts +91 -0
- package/dist/http/routes/session-memory-sync.js +174 -0
- package/dist/http/routes/session-sync.js +13 -20
- package/dist/http/routes/sessions-list.d.ts +2 -1
- package/dist/http/routes/sessions.d.ts +2 -2
- package/dist/http/routes/sessions.js +22 -23
- package/dist/http/routes/tasks.js +34 -54
- package/dist/http/run-read-face.d.ts +7 -0
- package/dist/http/run-read-face.js +9 -3
- package/dist/http/send.d.ts +5 -0
- package/dist/http/send.js +9 -2
- package/dist/http/server.d.ts +27 -15
- package/dist/http/server.js +4 -6
- package/dist/http/stored-body-replay.js +15 -4
- 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/http/wire-types.d.ts +17 -7
- package/dist/identity-source.d.ts +21 -2
- package/dist/identity-source.js +6 -0
- package/dist/leader/leader.js +5 -2
- package/dist/leader/wire.d.ts +7 -1
- package/dist/leader/wire.js +6 -5
- package/dist/leg-facts.d.ts +37 -0
- package/dist/leg-facts.js +15 -0
- package/dist/memory-bundle-engine.d.ts +1 -4
- package/dist/memory-bundle-engine.js +2 -2
- package/dist/memory-incident-sink.d.ts +19 -6
- package/dist/memory-incident-sink.js +8 -4
- package/dist/memory-operator-faces.d.ts +30 -66
- package/dist/memory-operator-faces.js +17 -88
- package/dist/memory-scope-stores.d.ts +38 -40
- package/dist/memory-scope-stores.js +51 -36
- package/dist/memory-scope.d.ts +0 -9
- package/dist/memory-scope.js +0 -9
- package/dist/memory-sync-client.d.ts +21 -21
- package/dist/memory-sync-client.js +62 -43
- package/dist/memory-sync-identity.d.ts +24 -0
- package/dist/memory-sync-identity.js +57 -0
- package/dist/memory-sync.d.ts +27 -5
- package/dist/memory-sync.js +29 -7
- package/dist/model-plane-face.d.ts +13 -7
- package/dist/model-plane-face.js +2 -1
- package/dist/observability/fail-open.d.ts +47 -14
- package/dist/observability/fail-open.js +37 -11
- package/dist/observability/run-terminal.d.ts +92 -34
- package/dist/observability/run-terminal.js +171 -162
- package/dist/orchestration/workflow-completion-inbox.d.ts +5 -19
- package/dist/orchestration/workflow-completion-inbox.js +0 -12
- package/dist/orchestration/workflow-notify-journal.d.ts +3 -2
- package/dist/orchestration/workflow-park-decision.d.ts +8 -3
- package/dist/orchestration/workflow-park-decision.js +5 -3
- package/dist/org-delivery-gate.d.ts +11 -0
- package/dist/org-delivery-gate.js +19 -1
- package/dist/parked-decide.d.ts +13 -9
- package/dist/parked-decide.js +7 -7
- package/dist/parked-revive-surface.js +1 -1
- package/dist/peer-inbound-face.d.ts +127 -0
- package/dist/peer-inbound-face.js +158 -0
- package/dist/permission-rule-list.d.ts +13 -9
- package/dist/permission-rule-list.js +7 -3
- package/dist/plugins/approval-ask-store-file.d.ts +14 -4
- package/dist/plugins/approval-ask-store-file.js +64 -11
- package/dist/plugins/approval-ask-store-memory.d.ts +2 -1
- package/dist/plugins/approval-ask-store-memory.js +17 -14
- package/dist/plugins/approval-ask-store-sql.d.ts +70 -23
- package/dist/plugins/approval-ask-store-sql.js +79 -30
- package/dist/plugins/checkpoint-store-sql.d.ts +4 -4
- package/dist/plugins/checkpoint-store-sql.js +9 -7
- package/dist/plugins/file-history-store-sql.d.ts +24 -18
- package/dist/plugins/file-history-store-sql.js +24 -19
- package/dist/plugins/file-run-store.d.ts +35 -1
- package/dist/plugins/file-run-store.js +108 -9
- package/dist/plugins/imported-layer-root-retirement.d.ts +82 -0
- package/dist/plugins/imported-layer-root-retirement.js +96 -0
- package/dist/plugins/local-checkpoint-store.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.js +2 -2
- package/dist/plugins/local-session-store.d.ts +42 -9
- package/dist/plugins/local-session-store.js +83 -33
- package/dist/plugins/local-task-attachment-store.d.ts +12 -2
- package/dist/plugins/local-task-attachment-store.js +67 -43
- package/dist/plugins/mailbox-recipient-lifecycle.d.ts +9 -31
- package/dist/plugins/mailbox-recipient-lifecycle.js +4 -0
- package/dist/plugins/mailbox-store-sql.d.ts +12 -8
- package/dist/plugins/mailbox-store-sql.js +76 -7
- package/dist/plugins/memory-key-guards.d.ts +3 -3
- package/dist/plugins/memory-run-store.d.ts +6 -1
- package/dist/plugins/memory-run-store.js +11 -1
- package/dist/plugins/memory-sync-store-pg.d.ts +15 -0
- package/dist/plugins/memory-sync-store-pg.js +21 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts +2 -0
- package/dist/plugins/memory-sync-store-tidb.js +13 -1
- package/dist/plugins/one-time-migrations.d.ts +58 -2
- package/dist/plugins/one-time-migrations.js +161 -4
- package/dist/plugins/org-delivery-quota-store.d.ts +1 -1
- package/dist/plugins/org-delivery-quota-store.js +2 -12
- package/dist/plugins/park-commit-watch.d.ts +1 -1
- package/dist/plugins/permission-rule-store-file.d.ts +10 -1
- package/dist/plugins/permission-rule-store-file.js +15 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +31 -1
- package/dist/plugins/permission-rule-store-sql.js +35 -2
- package/dist/plugins/remote-env-device.d.ts +8 -11
- package/dist/plugins/remote-env-device.js +6 -3
- package/dist/plugins/remote-env-e2b.d.ts +23 -4
- package/dist/plugins/remote-env-e2b.js +111 -28
- package/dist/plugins/remote-env-k8s.d.ts +61 -22
- package/dist/plugins/remote-env-k8s.js +133 -33
- package/dist/plugins/remote-env-local-docker.d.ts +15 -3
- package/dist/plugins/remote-env-local-docker.js +40 -12
- package/dist/plugins/retention-store-sql.d.ts +2 -2
- package/dist/plugins/run-store-sql.d.ts +9 -1
- package/dist/plugins/run-store-sql.js +9 -1
- package/dist/plugins/sandbox-read-floor.d.ts +5 -7
- package/dist/plugins/sandbox-read-floor.js +2 -7
- package/dist/plugins/sql-errors.d.ts +10 -1
- package/dist/plugins/sql-errors.js +13 -0
- package/dist/plugins/store-backend.d.ts +33 -35
- package/dist/plugins/store-backend.js +10 -1
- package/dist/plugins/store-contracts.d.ts +50 -1
- package/dist/plugins/store-contracts.js +6 -0
- package/dist/plugins/task-attachment-store.d.ts +112 -14
- package/dist/plugins/task-attachment-store.js +207 -29
- package/dist/plugins/tool-result-store-sql.d.ts +9 -8
- package/dist/plugins/tool-result-store-sql.js +23 -2
- package/dist/plugins/wiring-section-codec.d.ts +32 -0
- package/dist/plugins/wiring-section-codec.js +55 -0
- 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/rule-entry-list.d.ts +3 -2
- package/dist/rule-entry-list.js +5 -1
- package/dist/rules-consent.d.ts +28 -5
- package/dist/rules-consent.js +40 -28
- package/dist/run-local.js +11 -13
- package/dist/runs.d.ts +12 -8
- package/dist/runs.js +6 -8
- package/dist/runtime-governance.d.ts +1 -1
- 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 +9 -0
- package/dist/security.js +8 -0
- package/dist/server-secret-env.d.ts +4 -0
- package/dist/session-error-wire.d.ts +36 -0
- package/dist/session-error-wire.js +13 -0
- package/dist/session-incarnation.d.ts +1 -1
- package/dist/session-notify-door.d.ts +106 -0
- package/dist/session-notify-door.js +93 -0
- package/dist/session-sync.d.ts +9 -14
- package/dist/session-sync.js +5 -5
- package/dist/session-workspace.d.ts +3 -13
- package/dist/session-workspace.js +0 -9
- package/dist/standing-answer-grant.d.ts +5 -0
- package/dist/standing-answer-grant.js +10 -0
- package/dist/stores-sql/session-policy-store-sql.d.ts +4 -2
- package/dist/stores-sql/session-policy-store-sql.js +3 -13
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-settings.d.ts +21 -10
- package/dist/task-settings.js +46 -13
- package/dist/terminal.d.ts +39 -19
- package/dist/terminal.js +65 -22
- package/dist/tool-approval.d.ts +56 -37
- package/dist/tool-approval.js +78 -71
- package/dist/trace/core-keyset-guard.d.ts +134 -14
- package/dist/trace/engine-notice-wire.d.ts +9 -3
- package/dist/trace/engine-notice-wire.js +7 -3
- package/dist/trace/exit-seat.d.ts +9 -2
- package/dist/trace/exit-seat.js +1 -0
- package/dist/trace/ledger-sink.d.ts +10 -6
- package/dist/trace/ledger-sink.js +2 -2
- package/dist/trace/model-segment.d.ts +55 -25
- package/dist/trace/model-segment.js +101 -33
- package/dist/trace/project.d.ts +25 -5
- package/dist/trace/project.js +22 -0
- package/dist/trace/redact.d.ts +61 -9
- package/dist/trace/redact.js +1490 -468
- package/dist/trace/self-minted-wire.d.ts +745 -24
- package/dist/trace/self-minted-wire.js +239 -9
- package/dist/trace/wire-projection-faces.d.ts +2 -2
- package/dist/trace/wire-projection-faces.js +2 -2
- package/dist/verifier-pause-card.d.ts +33 -5
- package/dist/verifier-pause-card.js +15 -10
- package/dist/web-admin-client/apply-effective.d.ts +12 -16
- package/dist/web-admin-client/apply-effective.js +109 -9
- package/dist/web-admin-client/effective-keys.js +2 -0
- package/dist/web-admin-client/types.d.ts +4 -0
- package/dist/workspace-space.d.ts +19 -3
- package/dist/workspace-space.js +8 -4
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +3 -1
- package/package.json +3 -2
- package/wire-changes/server@7.142.0.json +639 -0
- package/wire-changes/server@7.143.0.json +1167 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { formatConfigPath } from "@sema-agent/settings-schema";
|
|
2
|
+
import { migrateEnvModelsDecision } from "@sema-agent/settings-schema/node";
|
|
3
|
+
import { envModelsDocumentPath } from "./env-model-table-gate.js";
|
|
4
|
+
const markerWriteFailureAnnounced = new Set();
|
|
5
|
+
export function runEnvModelsMigration(input) {
|
|
6
|
+
return migrateEnvModelsDecision({ root: input.root, env: input.env });
|
|
7
|
+
}
|
|
8
|
+
export function logEnvModelsMigration(log, input, m) {
|
|
9
|
+
const dir = input.root;
|
|
10
|
+
switch (m.kind) {
|
|
11
|
+
case "already_ran":
|
|
12
|
+
case "not_minter":
|
|
13
|
+
return;
|
|
14
|
+
case "marker_unreadable":
|
|
15
|
+
log.warn("config_env_models_marker_unreadable", {
|
|
16
|
+
dir,
|
|
17
|
+
reason: m.reason,
|
|
18
|
+
note: "the SS-M11 run marker on this config root does not read — it counts as run, so no decision is minted for anyone; an absent decision reads as kept",
|
|
19
|
+
});
|
|
20
|
+
return;
|
|
21
|
+
case "marker_write_failed":
|
|
22
|
+
if (markerWriteFailureAnnounced.has(dir))
|
|
23
|
+
return;
|
|
24
|
+
markerWriteFailureAnnounced.add(dir);
|
|
25
|
+
log.warn("config_dir_migration_failed", {
|
|
26
|
+
dir,
|
|
27
|
+
migration: "SS-M11",
|
|
28
|
+
reason: m.error,
|
|
29
|
+
...(m.errno !== undefined ? { errno: m.errno } : {}),
|
|
30
|
+
wayOut: m.wayOut,
|
|
31
|
+
note: "the SS-M11 run marker could not be created, so no decision was minted — an absent decision reads as kept (a decision written by hand still applies); said once per process",
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
case "recorded":
|
|
35
|
+
logMint(log, input, m.mint, m.createdRoot, m.decision.kind);
|
|
36
|
+
return;
|
|
37
|
+
default: {
|
|
38
|
+
const unhandled = m;
|
|
39
|
+
throw new Error(`SS-M11 migration: unknown result ${JSON.stringify(unhandled)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function logMint(log, input, mint, createdRoot, decisionBefore) {
|
|
44
|
+
const dir = input.root;
|
|
45
|
+
const decisionFile = envModelsDocumentPath(dir);
|
|
46
|
+
switch (mint.kind) {
|
|
47
|
+
case "minted":
|
|
48
|
+
log.info("config_dir_migrated", {
|
|
49
|
+
dir,
|
|
50
|
+
receipts: [{ migration: mint.receipt.migration, document: mint.receipt.document, path: formatConfigPath(mint.receipt.path), appliedAs: mint.receipt.appliedAs }],
|
|
51
|
+
written: [decisionFile],
|
|
52
|
+
removed: [],
|
|
53
|
+
createdRoot,
|
|
54
|
+
migration: "SS-M11",
|
|
55
|
+
minted: true,
|
|
56
|
+
note: "settings-schema one-time migration SS-M11 recorded that a catalog managing the model plane replaces the env model table on this config root (the reading before the decision existed); it runs once per config root",
|
|
57
|
+
});
|
|
58
|
+
if (mint.replacedEnvModels.length > 0 && !input.envTableIsPlaceholder) {
|
|
59
|
+
log.warn("config_env_models_replaced_by_migration", {
|
|
60
|
+
dir,
|
|
61
|
+
envModels: mint.replacedEnvModels.map((e) => ({ id: e.id, env: e.env })),
|
|
62
|
+
decisionFile,
|
|
63
|
+
note: `the local catalog keeps replacing these env models (as before this version). To serve the env models instead, delete ${decisionFile} or write it as {"envModels":"kept"}; a running process keeps the catalog it serves until the next start`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
case "exists":
|
|
68
|
+
case "skipped":
|
|
69
|
+
log.info("config_dir_migrated", {
|
|
70
|
+
dir,
|
|
71
|
+
receipts: [],
|
|
72
|
+
written: [],
|
|
73
|
+
removed: [],
|
|
74
|
+
createdRoot,
|
|
75
|
+
migration: "SS-M11",
|
|
76
|
+
minted: false,
|
|
77
|
+
why: mint.kind === "exists" ? "decision_written_meanwhile" : mint.why,
|
|
78
|
+
decisionBefore,
|
|
79
|
+
note: "settings-schema one-time migration SS-M11 ran on this config root and minted nothing; an absent decision reads as kept from now on",
|
|
80
|
+
});
|
|
81
|
+
return;
|
|
82
|
+
case "failed":
|
|
83
|
+
case "models_unreadable":
|
|
84
|
+
log.warn("config_env_models_mint_failed", {
|
|
85
|
+
dir,
|
|
86
|
+
cause: mint.kind === "failed" ? "decision_write_failed" : "models_unreadable",
|
|
87
|
+
reason: mint.error,
|
|
88
|
+
...(mint.errno !== undefined ? { errno: mint.errno } : {}),
|
|
89
|
+
wayOut: mint.wayOut,
|
|
90
|
+
note: "SS-M11 did not mint the decision and will not try again on this config root (its run marker is in place) — an absent decision reads as kept, so a local catalog that manages the model plane is refused while env models are declared",
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
default: {
|
|
94
|
+
const unhandled = mint;
|
|
95
|
+
throw new Error(`SS-M11 migration: unknown mint outcome ${JSON.stringify(unhandled)}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=config-root-migration.js.map
|
package/dist/config-types.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type { GitApiKind } from "./git-api-kind.js";
|
|
|
22
22
|
import type { CustomPkgSource } from "./sandbox-pkg-source.js";
|
|
23
23
|
import type { MemoryEngineBackend, StoreBackend as StoreBackendWord } from "@sema-agent/settings-schema/execution-lanes";
|
|
24
24
|
import { DRAIN_GRACE_FLOOR_MS } from "@sema-agent/settings-schema/fleet";
|
|
25
|
-
import type { AtMention } from "@sema-agent/settings-schema";
|
|
25
|
+
import type { AtMention, SandboxGitConfig } from "@sema-agent/settings-schema";
|
|
26
26
|
import type { ModsDeclaration } from "./mods-declaration.js";
|
|
27
27
|
/** [ref]:记忆向量面的 embedder 坐标(env `MEMORY_EMBEDDER_*` 解析结果;单一属主 = 本类型,
|
|
28
28
|
* `plugins/memory-embedder.ts` 的工厂直接消费它,不复制形状)。语义与三问见
|
|
@@ -748,7 +748,7 @@ export interface ServiceConfigFlat {
|
|
|
748
748
|
* git pull 落下的文件都还认),它只是不 harvest;而 declared-false 的部署连收编都不做。 */
|
|
749
749
|
memoryPersistenceCapable?: boolean;
|
|
750
750
|
/** 142-S2.5-W1: TOC 同步 client 腿 —— file memory 形态把本地记忆盘与中心(DB 权威,
|
|
751
|
-
* POST /
|
|
751
|
+
* POST /v2/memory/sync/:scope)做一轮一 RTT 双向同步。env 三键:`MEMORY_SYNC_URL`(设了=开;缺省
|
|
752
752
|
* undefined=纯本地现状零变化)/`MEMORY_SYNC_TOKEN`(Bearer)/`MEMORY_SYNC_SCOPE`(可选,缺省 =
|
|
753
753
|
* memoryScope 本身**仅当它已是 v2 typed key**;非 typed 键 ⇒ 拒启,[ref] —— 旧 formatUserScope 派生臂铸出的是本部署
|
|
754
754
|
* 从不写的层,见 loadConfig)。半配置 fail-loud
|
|
@@ -761,6 +761,10 @@ export interface ServiceConfigFlat {
|
|
|
761
761
|
maxPushEntries?: number;
|
|
762
762
|
maxPullEntries?: number;
|
|
763
763
|
};
|
|
764
|
+
/** [ref] R2:中心(DB 记忆平面)声明的**同步身份** —— 客户端用来到达本中心同步口的基址(env `MEMORY_SYNC_SERVE_IDENTITY`)。
|
|
765
|
+
* 一处声明、三个读者:能力面 `memorySyncServe.identity` 逐字公开;中心入站 `POST /v2/memory/sync/:scope` 的 `peer` 按串与它比(不等 ⇒ 409,零写);
|
|
766
|
+
* 缺席 ⇒ 本中心不服务同步(501 `feature.memory_sync_serve_disabled`)。必须已是规范形(铸点 `memory-sync-identity.ts`),否则拒启 —— 无条件解析。 */
|
|
767
|
+
memorySyncServeIdentity?: string;
|
|
764
768
|
/** [ref](黑板 [ref]/[ref] 两裁):记忆检索的**向量面**接线 —— OpenAI 兼容 `/embeddings` 端点。
|
|
765
769
|
* env 四键(+ 可选 key):`MEMORY_EMBEDDER_ENDPOINT` / `MEMORY_EMBEDDER_MODEL` / `MEMORY_EMBEDDER_DIM`
|
|
766
770
|
* (+ `MEMORY_EMBEDDER_TIMEOUT_MS` / `MEMORY_EMBEDDER_API_KEY`)。三问:
|
|
@@ -928,6 +932,13 @@ export interface ServiceConfigFlat {
|
|
|
928
932
|
* ([ref] 起诊断面**有了** `executionLane` 段,但它就是能力面那一只投影 `{provider, toolsOnThisHost, isolated?}`,**不带**本键。)
|
|
929
933
|
*/
|
|
930
934
|
requireExecutionLane: boolean;
|
|
935
|
+
/**
|
|
936
|
+
* 沙箱 git 平面的有效配置块(本部署经凭据代理路由哪些 git origin;契约 `SandboxGitConfig`:规范形 origin ≤ 16、两两不同、`connectUrl` 必 https、空表合法)。
|
|
937
|
+
* **唯一来源 = 中心有效配置**(`/effective` 的 `sandboxGit`,web-admin 按部署登记册投影;无 env 旋钮,本地配置源没有这一块);唯一判官 = `stageEffective`
|
|
938
|
+
* 的那一次 `SandboxGitConfig.safeParse`,`commitStaged` 整只重赋值 —— 缺席或判不过 ⇒ 键**删**(不写 undefined;判不过 = 当作没有任何 origin,契约 §12.8)。
|
|
939
|
+
* 热:读者(平面座 `sandbox-git-plane.ts` 的每一次读)逐次现读这一键,不捕获对象本身。缺席 = 没有这一块(与契约「可选、无默认」同一种缺席读法,不另设 null)。
|
|
940
|
+
*/
|
|
941
|
+
sandboxGit?: SandboxGitConfig;
|
|
931
942
|
remoteExec?: {
|
|
932
943
|
provider: "e2b";
|
|
933
944
|
apiKey: string;
|
|
@@ -1038,7 +1049,7 @@ export interface ServiceConfigFlat {
|
|
|
1038
1049
|
* 域 = `[1, 86400]` 的十进制正整数,坏值**拒启**([ref] A 档;解析器 `parseDeviceEnrollTokenTtlEnv`)。
|
|
1039
1050
|
* 缺席 ⇒ 签发点的属主默认 900(不在 config 层抄第二份默认,与本族其余旋钮同姿势)。 */
|
|
1040
1051
|
enrollTokenTtlSec?: number;
|
|
1041
|
-
/** `DEVICE_RELAY_URL` = 设备入口的运维声明,**必填**(缺席 / 空串 ⇒
|
|
1052
|
+
/** `DEVICE_RELAY_URL` = 设备入口的运维声明,**必填**(缺席 / 空串 / 只含空白 ⇒ 配置期拒起:契约包车道表 device 行的必需键,同所有车道的必需键判官 `laneMissingEnv`;值的文法与凭据形由解析器 `parseDeviceRelayUrlEnv` 拒):
|
|
1042
1053
|
* `{ kind: "url" }` = 设备连不到本引擎自己的地址(引擎在中继 / 网关之后)时该拨的那一个 ws(s) URL,**逐字**上能力面 `deviceExecutor.relayUrl`
|
|
1043
1054
|
* (唯一消费点 `http/routes/capabilities.ts`);`{ kind: "none" }`(字面 `none`)= 没有中继,设备按本引擎地址 + `deviceExecutor.wsPath` 拨号,能力面不带 `relayUrl`。
|
|
1044
1055
|
* 必填的理由:「设备拨哪里」只有运维知道;缺席曾被读成「直拨」,于是撤掉中继声明而根会话行上还有设备绑定时,设备改拨引擎地址(入口已收窄则拨不到)、
|
|
@@ -1319,9 +1330,9 @@ export interface ServiceConfigFlat {
|
|
|
1319
1330
|
* env `LOCKED_CONFIG_KEYS`(csv;词表 = core 的 `LOCKED_KEY_REGISTRY` 闭集,未知键 boot 拒 =
|
|
1320
1331
|
* `config.locked_registry`「不解析的安全控件不得半开」)。
|
|
1321
1332
|
*
|
|
1322
|
-
* ⚠️
|
|
1323
|
-
* `toolPolicy` 锁与本仓「每条腿自铸 spec.toolPolicy」的装配形结构性冲突,`mcp` 锁与「部署自带 MCP
|
|
1324
|
-
*
|
|
1333
|
+
* ⚠️ 本仓的**装配相容性**判据在 boot/governance-seams.ts(`assertGovernanceAssemblable`,部署 MCP / A2A 基线物化之后判一次):
|
|
1334
|
+
* `toolPolicy` 锁与本仓「每条腿自铸 spec.toolPolicy」的装配形结构性冲突,`mcp` / `a2a` 锁与「部署自带 MCP 服务器 /
|
|
1335
|
+
* A2A 对端」冲突 —— 都在启动期拒,而不是让每条任务腿在 prepare 期各撞一次 `config.locked_key`。
|
|
1325
1336
|
*/
|
|
1326
1337
|
lockedConfigKeys?: readonly LockedKey[];
|
|
1327
1338
|
/**
|
|
@@ -2319,7 +2330,7 @@ export type ServiceModelPlaneConfig = Pick<ServiceConfigFlat, "gatewayBaseUrl" |
|
|
|
2319
2330
|
* 就是本组的门状态,故进组;`parseApprovalDomain` 的返回类型相应是 `Omit<…, "directDoorActive">`。 */
|
|
2320
2331
|
export type ServiceApprovalConfig = Pick<ServiceConfigFlat, "approvalRequire" | "approvalDeny" | "approvalTimeoutSec" | "approvalAskRetentionMs" | "approvalAutoBudget" | "approvalNeverAuto" | "approvalGrant" | "approvalHmacKeys" | "durableApproval" | "durableApprovalSource" | "streamAskWindowMsSource" | "directApprovalDoor" | "directDoorActive" | "resourceSuspend" | "resourceSuspendTtlSec" | "resourceSuspendTotalTokens" | "resourceSuspendTotalBudgetUsd" | "resourceSuspendMaxSlices" | "askQuestionEnabled" | "questionThrottle" | "toolApprovalEnabled" | "permissionRulesEnabled" | "permissionRulesEnabledExplicit" | "streamAskWindowMarginMs" | "streamApproval" | "unattendedApprovalPolicy" | "mcpElicitation" | "sensitiveWritePatterns" | "writeProtectedPaths" | "manualModeShellGate" | "permissionsDisableAutoMode" | "autoModeClassifierFallback" | "autoModeClassifierTimeoutMs" | "crossSessionInbound" | "crossSessionDialogExpiry" | "principalInboxAssistant">;
|
|
2321
2332
|
/** 组:memory(记忆面 + TOC 同步腿)。 */
|
|
2322
|
-
export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled" | "memoryEngineDir" | "memoryEngineRemoteLaneAllowed" | "memoryEngineBackend" | "memoryScope" | "memoryPersistenceCapable" | "memorySync" | "memoryEmbedder" | "memoryOrgAdmissionMode" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "memoryConsolidationDriver" | "memoryOrgDirectoryJson" | "memoryOrgGrantTtlMs" | "memoryOrgUnavailableBackoffMs" | "projectMemoryEnabled" | "syncImportLeaseStaleSec">;
|
|
2333
|
+
export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled" | "memoryEngineDir" | "memoryEngineRemoteLaneAllowed" | "memoryEngineBackend" | "memoryScope" | "memoryPersistenceCapable" | "memorySync" | "memorySyncServeIdentity" | "memoryEmbedder" | "memoryOrgAdmissionMode" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "memoryConsolidationDriver" | "memoryOrgDirectoryJson" | "memoryOrgGrantTtlMs" | "memoryOrgUnavailableBackoffMs" | "projectMemoryEnabled" | "syncImportLeaseStaleSec">;
|
|
2323
2334
|
/** 组:auth(鉴权 / 身份 / 治理棒)。`commandPolicy` 只有 web-admin 腿(无 env 标量形),故 env 解析
|
|
2324
2335
|
* 函数不产出它,但它与 `autonomy` 是同一根治理棒的两半,归本组。
|
|
2325
2336
|
* [ref] 的三件部署治理声明(`compliancePosture`/`lockedConfigKeys`/`retentionPolicy`)同归本组:
|
|
@@ -2328,7 +2339,7 @@ export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled"
|
|
|
2328
2339
|
* config 这一层它只是一句声明。 */
|
|
2329
2340
|
export type ServiceAuthConfig = Pick<ServiceConfigFlat, "authToken" | "authTokens" | "allowUnauthedWrites" | "corsOrigins" | "principalHeader" | "requirePrincipal" | "autonomy" | "commandPolicy" | "compliancePosture" | "lockedConfigKeys" | "configCatalogEnabled" | "retentionPolicy" | "retentionSweep" | "operatorPrincipals" | "operatorSingleUser" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "authBridgeIssuer" | "principalJwtMaxTtlSec" | "bindHost" | "bindHostSource">;
|
|
2330
2341
|
/** 组:orchestration(编排 + 执行车道 + 沙箱面 + workflow/后台 agent 存留)。 */
|
|
2331
|
-
export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "remoteExec" | "remoteExecHomeDir" | "requireExecutionLane" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerSessionLifetime" | "schedulerStorePath" | "planModeEnabled" | "hooksTimeoutMs" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "usageWindows" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentParkClaimStaleMs" | "delegationEntryCaps" | "rosterRetentionMs" | "leaderRunStaleMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sandboxPkgSourceCustom" | "sessionAutoTitle" | "sessionAutoTitleSource" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "lspEnvAllow" | "imageBakes" | "readFace" | "readFaceSource" | "taskWriteFaceEscalation" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "sandboxReadFloor" | "agentConfigDir" | "configLkgPath" | "configLkgEnabled">;
|
|
2342
|
+
export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "sandboxGit" | "remoteExec" | "remoteExecHomeDir" | "requireExecutionLane" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerSessionLifetime" | "schedulerStorePath" | "planModeEnabled" | "hooksTimeoutMs" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "usageWindows" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentParkClaimStaleMs" | "delegationEntryCaps" | "rosterRetentionMs" | "leaderRunStaleMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sandboxPkgSourceCustom" | "sessionAutoTitle" | "sessionAutoTitleSource" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "lspEnvAllow" | "imageBakes" | "readFace" | "readFaceSource" | "taskWriteFaceEscalation" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "sandboxReadFloor" | "agentConfigDir" | "configLkgPath" | "configLkgEnabled">;
|
|
2332
2343
|
/** 组:limitsHttp(HTTP 面 + 各类上限/配额/回收窗)。 */
|
|
2333
2344
|
export type ServiceLimitsHttpConfig = Pick<ServiceConfigFlat, "port" | "attachmentOrphanGraceMs" | "workspaceFileMaxBytes" | "attachmentMaxBytes" | "attachmentMimeAllowlist" | "attachmentUnboundTtlMs" | "infraCostRates" | "drainGraceMs" | "drainSecondSignalMinGapMs" | "sighupIdleGraceMs" | "parentPid" | "engineAutoExit" | "engineLingerMs" | "engineOrphanLingerMs" | "rateLimitPerMin" | "maxTaskCostUsd" | "maxTaskTokens" | "maxPrincipalCostUsd" | "costQuotaWindowSec" | "reapIntervalSec" | "runStaleSec" | "toolResultTtlSec">;
|
|
2334
2345
|
/** 组:observability(可观测)。 */
|
package/dist/config.d.ts
CHANGED
|
@@ -264,10 +264,11 @@ export declare function applyAutoCompactWindow(m: Model, explicit?: number): "ex
|
|
|
264
264
|
/**
|
|
265
265
|
* **严格名册布防**的唯一判据(boot 就绪门 `boot/web-admin.ts` 与装配第 2 段的路由端点判官同调这一只)。
|
|
266
266
|
*
|
|
267
|
-
* 布防 =
|
|
267
|
+
* 布防 = 声明了中心(`webAdmin` 在场)∧ 非 dryRun ∧ `CONFIG_REQUIRE_ROSTER=true`(严格 `"true"`,直读 env、不进 ServiceConfig —— 纯
|
|
268
268
|
* boot 期姿势旋钮,原判据逐字搬来,零语义变化)。布防时运维声明 env MODEL_ID 是**占位**:名册落地前计费提交 503、
|
|
269
|
-
* `/health` ready:false
|
|
270
|
-
*
|
|
269
|
+
* `/health` ready:false,落地后整张模型表被中心目录换装。判据**不看配置源形态**:`CONFIG_PROVIDER=local` 而同时声明了中心与
|
|
270
|
+
* `CONFIG_REQUIRE_ROSTER=true` 的部署同样布防,env 表同样按占位读(路由判官、本地腿的 env 模型表闸都不判它)。没有声明中心的
|
|
271
|
+
* local / 纯 env 部署没有「中心」可等 ⇒ 不布防;dryRun 是 compare-only(名册从不被应用)⇒ 不布防。
|
|
271
272
|
*/
|
|
272
273
|
export declare function isRosterGateArmed(webAdmin: ServiceConfig["webAdmin"]): boolean;
|
|
273
274
|
/**
|
|
@@ -422,6 +423,12 @@ export declare const FLEET_ENV_REFUSAL_CODES: {
|
|
|
422
423
|
readonly member_unfenced: "config.fleet_member_unfenced";
|
|
423
424
|
};
|
|
424
425
|
export type FleetEnvRefusalCode = (typeof FLEET_ENV_REFUSAL_CODES)[keyof typeof FLEET_ENV_REFUSAL_CODES];
|
|
426
|
+
/**
|
|
427
|
+
* `MEMORY_SYNC_SERVE_IDENTITY`(中心声明的同步身份)的**唯一**解析口。**无条件解析**(运维旋钮律,同 `FLEET_ADVERTISE_ADDRESS`):未设 / 空串 ⇒ 缺席;
|
|
428
|
+
* 设了就必须**已是**同步身份的规范形(铸点 `memory-sync-identity.ts` 的「声明的身份」座位)—— 运维写下的就是能力面公开的、中心入站按串比的那一串,
|
|
429
|
+
* 没有第二种拼法 ⇒ 不是规范形就拒启并给出规范形(不静默规范化);带凭据 / 查询 / 片段 / 非 http(s) / 超宽同样拒启,拒句不引路径与凭据。
|
|
430
|
+
*/
|
|
431
|
+
export declare function parseMemorySyncServeIdentity(raw: string | undefined): string | undefined;
|
|
425
432
|
/** 一只 fleet 成员的围栏车道:续租打的中心端点(车道对象原样,含活性基址)+ 代际。 */
|
|
426
433
|
export interface FleetFenceLane {
|
|
427
434
|
readonly center: CenterEndpoint & {
|
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";
|
|
@@ -1741,7 +1742,7 @@ function parseMemoryDomain(ctx) {
|
|
|
1741
1742
|
}
|
|
1742
1743
|
else {
|
|
1743
1744
|
if (memoryEngineBackend !== "file") {
|
|
1744
|
-
throw new Error(`MEMORY_SYNC_URL is a FILE-memory (TOC client) knob, but MEMORY_ENGINE_BACKEND=${memoryEngineBackend} — the DB memory plane IS the central sync authority (it serves POST /
|
|
1745
|
+
throw new Error(`MEMORY_SYNC_URL is a FILE-memory (TOC client) knob, but MEMORY_ENGINE_BACKEND=${memoryEngineBackend} — the DB memory plane IS the central sync authority (it serves POST /v2/memory/sync/:scope) and must not also run the client leg; unset MEMORY_SYNC_* here`);
|
|
1745
1746
|
}
|
|
1746
1747
|
if (memorySyncToken === undefined) {
|
|
1747
1748
|
throw new Error("MEMORY_SYNC_URL is set but MEMORY_SYNC_TOKEN is not — refusing to start half-configured (the central sync face requires a bearer token)");
|
|
@@ -1756,6 +1757,9 @@ function parseMemoryDomain(ctx) {
|
|
|
1756
1757
|
if (scope === undefined) {
|
|
1757
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");
|
|
1758
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
|
+
}
|
|
1759
1763
|
assertProjectLayerOwnable(scope, memorySyncScopeRaw !== undefined ? "MEMORY_SYNC_SCOPE" : "MEMORY_SCOPE");
|
|
1760
1764
|
memorySync = {
|
|
1761
1765
|
url: memorySyncUrl,
|
|
@@ -1793,6 +1797,7 @@ function parseMemoryDomain(ctx) {
|
|
|
1793
1797
|
memoryScope,
|
|
1794
1798
|
...((v) => (v !== undefined ? { memoryPersistenceCapable: v } : {}))(parseMemoryPersistenceCapable(process.env.MEMORY_PERSISTENCE_CAPABLE)),
|
|
1795
1799
|
...(memorySync ? { memorySync } : {}),
|
|
1800
|
+
...((v) => (v !== undefined ? { memorySyncServeIdentity: v } : {}))(parseMemorySyncServeIdentity(process.env.MEMORY_SYNC_SERVE_IDENTITY)),
|
|
1796
1801
|
...((v) => (v !== undefined ? { memoryEmbedder: v } : {}))(parseMemoryEmbedder({ memoryEngineBackend, memoryEngineEnabled })),
|
|
1797
1802
|
memoryOrgAdmissionMode,
|
|
1798
1803
|
...(process.env.MEMORY_DELEGATION_EVIDENCE !== undefined
|
|
@@ -2305,6 +2310,15 @@ function parseFleetScope(raw) {
|
|
|
2305
2310
|
}
|
|
2306
2311
|
return fleetScopeOf(raw);
|
|
2307
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
|
+
}
|
|
2308
2322
|
function parseFleetAdvertiseAddress(raw) {
|
|
2309
2323
|
const name = "FLEET_ADVERTISE_ADDRESS";
|
|
2310
2324
|
if (raw === undefined || raw === "")
|
|
@@ -2464,7 +2478,7 @@ const APPROVAL_GROUP_KEYS = [
|
|
|
2464
2478
|
];
|
|
2465
2479
|
const MEMORY_GROUP_KEYS = [
|
|
2466
2480
|
"memoryEngineEnabled", "memoryEngineDir", "memoryEngineRemoteLaneAllowed", "memoryEngineBackend", "memoryScope",
|
|
2467
|
-
"memoryPersistenceCapable", "memorySync", "memoryEmbedder", "memoryOrgAdmissionMode", "memoryDelegationEvidence", "memoryProvenance", "memoryCapturePolicy", "memoryConsolidationDriver", "memoryOrgDirectoryJson", "memoryOrgGrantTtlMs", "memoryOrgUnavailableBackoffMs",
|
|
2481
|
+
"memoryPersistenceCapable", "memorySync", "memorySyncServeIdentity", "memoryEmbedder", "memoryOrgAdmissionMode", "memoryDelegationEvidence", "memoryProvenance", "memoryCapturePolicy", "memoryConsolidationDriver", "memoryOrgDirectoryJson", "memoryOrgGrantTtlMs", "memoryOrgUnavailableBackoffMs",
|
|
2468
2482
|
"projectMemoryEnabled", "syncImportLeaseStaleSec",
|
|
2469
2483
|
];
|
|
2470
2484
|
const AUTH_GROUP_KEYS = [
|
|
@@ -2474,7 +2488,7 @@ const AUTH_GROUP_KEYS = [
|
|
|
2474
2488
|
"principalJwtMaxTtlSec", "authBridgeIssuer", "bindHost", "bindHostSource",
|
|
2475
2489
|
];
|
|
2476
2490
|
const ORCHESTRATION_GROUP_KEYS = [
|
|
2477
|
-
"remoteExec", "remoteExecHomeDir", "requireExecutionLane", "worktreeIsolation", "leaderEnabled", "leaderFanoutEnabled", "routerEnabled", "selfOrchestrationEnabled",
|
|
2491
|
+
"sandboxGit", "remoteExec", "remoteExecHomeDir", "requireExecutionLane", "worktreeIsolation", "leaderEnabled", "leaderFanoutEnabled", "routerEnabled", "selfOrchestrationEnabled",
|
|
2478
2492
|
"selfOrchestrationModels", "selfOrchestrationWorkerIsolation", "forkEnabled", "experimentalObserverAgents",
|
|
2479
2493
|
"schedulerEnabled", "schedulerSessionWakeup", "schedulerSessionLifetime", "schedulerStorePath", "planModeEnabled", "hooksTimeoutMs", "workflowRunStoreBackend",
|
|
2480
2494
|
"workflowOrphanGraceMs", "workflowJournalRetentionMs", "workflowRunRetentionMs", "usageWindows", "workflowAgentsReadOnly",
|
|
@@ -136,18 +136,20 @@ export interface PlacedRowWriter {
|
|
|
136
136
|
*/
|
|
137
137
|
export declare function createPlacedSessionRow(sessionId: string, placement: PlacementSources, io: PlacedRowWriter, log: OrphanOwnerLog): Promise<void>;
|
|
138
138
|
/**
|
|
139
|
-
* 停驻挂点的**见证**:调用方交出的委派树根 + 调用方判断那一刻读到的根行住客(
|
|
140
|
-
*
|
|
139
|
+
* 停驻挂点的**见证**:调用方交出的委派树根 + 调用方判断那一刻读到的根行住客(属主与化身,同一读;化身 `null` = 那一读里根行不在,此时属主恒 `null`)。
|
|
140
|
+
* 请求腿 = 鉴权解析的会话与受理时那一读;赎回腿 = 行上的根与写口放行的那一位住客(认领之前解析器那一读)。
|
|
141
|
+
* 读者:停驻挂点({@link assertRootStillWitnessed},只比化身)、会话行记录座(化身)、后台子代完成 relay(属主与化身,会话通知门的目标住客)。
|
|
141
142
|
*/
|
|
142
143
|
export interface DelegationRootWitness {
|
|
143
144
|
readonly sessionId: string;
|
|
145
|
+
readonly owner: string | null;
|
|
144
146
|
readonly incarnation: string | null;
|
|
145
147
|
}
|
|
146
148
|
/**
|
|
147
149
|
* 「根行的化身已换 ⇒ 拒」在停驻挂点的那一道(挂点的见证是更早的一读,不是这一读):此刻根行在、而住客不是见证的那一位(见证那一读里不在,或是另一位)⇒ 抛。
|
|
148
150
|
* 根行此刻不在 ⇒ 不抛(根真没了 ⇒ 律给哨兵,不是「换了住客」)。这是**判断**的一部分;判断之后、写之前根的变化不改变写进去的值(律:属主 = 判断时见证到的)。
|
|
149
151
|
*/
|
|
150
|
-
export declare function assertRootStillWitnessed(sessionId: string, witness: DelegationRootWitness | undefined, judged: JudgedOwner): void;
|
|
152
|
+
export declare function assertRootStillWitnessed(sessionId: string, witness: Pick<DelegationRootWitness, "incarnation"> | undefined, judged: JudgedOwner): void;
|
|
151
153
|
/** 记录委派树的宿主店多交的两只口(三只持久会话店与缓存包装层;无 repo 的内存店两只都没有 ⇒ 没有可按的树 ⇒ 不认领)。 */
|
|
152
154
|
export interface DelegationTreeStore {
|
|
153
155
|
/** 本行落库的 placement 元组(`undefined` = 本行不是 placed 行 ⇒ 不记委派树)。 */
|
|
@@ -92,7 +92,7 @@ export async function settleDelegatedOwner(host, sessionId, owner, tree) {
|
|
|
92
92
|
throw refuse();
|
|
93
93
|
judged = await readDelegatedOwner(sessionId, recorded, sourceFacesVia(host.headOf));
|
|
94
94
|
if (tree.root !== null)
|
|
95
|
-
assertRootStillWitnessed(sessionId, {
|
|
95
|
+
assertRootStillWitnessed(sessionId, { incarnation: tree.rootIncarnation }, judged);
|
|
96
96
|
expected = judged.inherited.owner;
|
|
97
97
|
if (face.owner === null && expected !== null) {
|
|
98
98
|
claimed = await trees.claimOwnerless(sessionId, face.incarnation, expected);
|
|
@@ -75,6 +75,7 @@ export declare const DEVICE_OUTCOME_ERROR_CODES_BY_REVISION: {
|
|
|
75
75
|
readonly 1: readonly ["aborted", "already_exists", "auth_failed", "callback_error", "invalid", "is_directory", "not_directory", "not_found", "not_supported", "outcome_unknown", "permission_denied", "precondition_failed", "shell_unavailable", "spawn_error", "suspended", "target_unavailable", "timeout", "transport_lost", "unknown"];
|
|
76
76
|
readonly 2: readonly ["liveness_no_output"];
|
|
77
77
|
readonly 3: readonly ["name_too_long"];
|
|
78
|
+
readonly 4: readonly ["symlink_loop"];
|
|
78
79
|
};
|
|
79
80
|
/** 本包认得的协议修订号(= 增量表的行键)。 */
|
|
80
81
|
export type DeviceProtocolRevision = keyof typeof DEVICE_OUTCOME_ERROR_CODES_BY_REVISION;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createPublicKey, randomBytes, randomInt, verify as edVerify } from "node:crypto";
|
|
2
2
|
import { MAX_TIMER_DELAY_MS, inWholeNumberBounds, wholeNumberBoundsRule } from "./config-types.js";
|
|
3
3
|
export const DEVICE_WS_PATH = "/v1/device/ws";
|
|
4
|
-
export const DEVICE_PROTOCOL_VERSION =
|
|
4
|
+
export const DEVICE_PROTOCOL_VERSION = 4;
|
|
5
5
|
export const DEVICE_MIN_PROTOCOL_VERSION = 1;
|
|
6
6
|
export const DEVICE_HELLO_DOMAIN_TAG = "sema.device.hello.v1";
|
|
7
7
|
export const DEVICE_WS_LIMITS = {
|
|
@@ -67,6 +67,7 @@ export const DEVICE_OUTCOME_ERROR_CODES_BY_REVISION = {
|
|
|
67
67
|
],
|
|
68
68
|
2: ["liveness_no_output"],
|
|
69
69
|
3: ["name_too_long"],
|
|
70
|
+
4: ["symlink_loop"],
|
|
70
71
|
};
|
|
71
72
|
export function deviceOutcomeErrorCodesAt(revision) {
|
|
72
73
|
if (!Number.isInteger(revision) || revision < 1 || revision > DEVICE_PROTOCOL_VERSION) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本地配置腿上「一份管模型面的目录能不能顶替已声明的 env 模型表」—— **唯一判官**与它的拒句;以及候选随身带的那一份事实 {@link CatalogSource}。
|
|
3
|
+
*
|
|
4
|
+
* ## 律(一条)
|
|
5
|
+
* 一份候选的模型面被组拒 `config.catalog_replaces_env_models`,当且仅当四件同时成立:
|
|
6
|
+
* ① 候选来自**本地配置腿**({@link CatalogSource} 的 `local` 臂;中心腿不守卫 —— 中心发布的目录照旧整表顶替 env 表);
|
|
7
|
+
* ② 候选**管**模型面(模型面 stage 已走过「一条启用条目也没有 ⇒ 不管」那条捷径 —— 本判官只在它之后被问);
|
|
8
|
+
* ③ env 模型表**已声明**且不是占位(`MODEL_ID` 铸出了条目;严格名册布防时 env 表是占位、不算);
|
|
9
|
+
* ④ 配置根上的决定读数**不是** `replaced`(缺席 / `kept` / 读不懂 —— 运行记录在场之后缺席 ≡ `kept`,读不懂的不许读成确认)。
|
|
10
|
+
* 拒 ⇒ 模型面这一组停在上一代(起服:env 表;刷新拍:在服的那一代),其余组照落;拒句点名被顶替的 env 模型、决定文件的路径与两条出路。
|
|
11
|
+
*
|
|
12
|
+
* 执法点:模型面 stage 经登记条 `config-invariants.ts` 的 `env-table-replacement-acknowledged` 调本判官(候选的事实随 `CrossInvariantInput.candidate` 交来)。
|
|
13
|
+
*
|
|
14
|
+
* ## 一个读者
|
|
15
|
+
* 决定文件的字节只有契约的 `readEnvModelsDecision` 打开:`LocalConfigProvider.fetchEffective` 在读候选的**同一拍**调它,读数随候选交出
|
|
16
|
+
* (`FetchEffectiveResult.catalogSource`;本地 etag 由同一份读数的身份 `envModelsDecisionTag` 并入)。本模块与模型面 stage 只读这份读数,不开文件。
|
|
17
|
+
* 「env 表已声明」读的是引擎**自己铸的那张** env 表(模型面 stage 的 env 快照),不再读一遍 env。
|
|
18
|
+
*/
|
|
19
|
+
import { CATALOG_REPLACES_ENV_MODELS_CODE, type EnvModelTableEntry, type EnvModelsDecision } from "@sema-agent/settings-schema";
|
|
20
|
+
/**
|
|
21
|
+
* 一份目录候选**从哪条配置腿来**(以及本地腿上,配置根的 env 模型表决定在**同一拍**读作什么)。必填、没有缺省腿:安全轴上「忘了说是哪条腿」
|
|
22
|
+
* 不许静默落成某一种语义(与 `ApplyLeg` 同一条纪律)。铸点:`LocalConfigProvider.fetchEffective`(`local` 臂,带 `root` 与那一读的决定)、
|
|
23
|
+
* `RemoteConfigProvider.fetchEffective` 与盘上 LKG 读回(`remote` 臂 —— LKG 只在中心腿启用)。
|
|
24
|
+
*/
|
|
25
|
+
export type CatalogSource = {
|
|
26
|
+
readonly kind: "local";
|
|
27
|
+
readonly root: string;
|
|
28
|
+
readonly envModels: EnvModelsDecision;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: "remote";
|
|
31
|
+
};
|
|
32
|
+
/** 中心腿的那一份(冻结;中心腿不守卫,没有可带的事实)。 */
|
|
33
|
+
export declare const REMOTE_CATALOG_SOURCE: CatalogSource;
|
|
34
|
+
/** 判官的拒决(码与句出自同一次判决)。 */
|
|
35
|
+
export interface EnvTableReplacementRefusal {
|
|
36
|
+
readonly code: typeof CATALOG_REPLACES_ENV_MODELS_CODE;
|
|
37
|
+
readonly reason: string;
|
|
38
|
+
}
|
|
39
|
+
/** 判官的输入(纯数据)。 */
|
|
40
|
+
export interface EnvTableReplacementInput {
|
|
41
|
+
/** 引擎自己铸的那张 env 表的条目(槽序;空 = env 表没声明)。 */
|
|
42
|
+
readonly envTable: readonly EnvModelTableEntry[];
|
|
43
|
+
/** 严格名册布防(`isRosterGateArmed`):env 表是占位、从不被派发 ⇒ 对本闸等于没声明。 */
|
|
44
|
+
readonly envTableIsPlaceholder: boolean;
|
|
45
|
+
readonly source: CatalogSource;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* **唯一判官**(见文件头的律;② 由调用方的位置保证)。通过 ⇒ `undefined`。两只闭集都穷举:腿加一臂 / 决定加一词不补 ⇒ 编译红。
|
|
49
|
+
*/
|
|
50
|
+
export declare function judgeEnvTableReplacement(input: EnvTableReplacementInput): EnvTableReplacementRefusal | undefined;
|
|
51
|
+
/** 配置根上决定文件的路径(文件名取契约的文档名,不手抄)。 */
|
|
52
|
+
export declare function envModelsDocumentPath(root: string): string;
|
|
53
|
+
//# sourceMappingURL=env-model-table-gate.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CATALOG_REPLACES_ENV_MODELS_CODE, ENV_MODELS_DOCUMENT } from "@sema-agent/settings-schema";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export const REMOTE_CATALOG_SOURCE = Object.freeze({ kind: "remote" });
|
|
4
|
+
export function judgeEnvTableReplacement(input) {
|
|
5
|
+
const { source } = input;
|
|
6
|
+
switch (source.kind) {
|
|
7
|
+
case "remote":
|
|
8
|
+
return undefined;
|
|
9
|
+
case "local":
|
|
10
|
+
break;
|
|
11
|
+
default: {
|
|
12
|
+
const unhandled = source;
|
|
13
|
+
throw new Error(`judgeEnvTableReplacement: unknown catalog source ${JSON.stringify(unhandled)}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (input.envTable.length === 0 || input.envTableIsPlaceholder)
|
|
17
|
+
return undefined;
|
|
18
|
+
const decision = source.envModels;
|
|
19
|
+
switch (decision.kind) {
|
|
20
|
+
case "replaced":
|
|
21
|
+
return undefined;
|
|
22
|
+
case "absent":
|
|
23
|
+
case "kept":
|
|
24
|
+
case "unreadable":
|
|
25
|
+
return { code: CATALOG_REPLACES_ENV_MODELS_CODE, reason: envTableReplacementSentence(input.envTable, decision, envModelsDocumentPath(source.root)) };
|
|
26
|
+
default: {
|
|
27
|
+
const unhandled = decision;
|
|
28
|
+
throw new Error(`judgeEnvTableReplacement: unknown decision ${JSON.stringify(unhandled)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function envModelsDocumentPath(root) {
|
|
33
|
+
return path.join(root, `${ENV_MODELS_DOCUMENT}.json`);
|
|
34
|
+
}
|
|
35
|
+
function decisionPhrase(decision) {
|
|
36
|
+
switch (decision.kind) {
|
|
37
|
+
case "absent":
|
|
38
|
+
return "is absent (an absent decision reads as kept)";
|
|
39
|
+
case "kept":
|
|
40
|
+
return 'says "kept"';
|
|
41
|
+
case "unreadable":
|
|
42
|
+
return decision.reason === "io" ? `cannot be read (${decision.errno}) — an unreadable decision is never read as a confirmation` : `does not read (${decision.reason}) — an unreadable decision is never read as a confirmation`;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function envTableReplacementSentence(envTable, decision, documentPath) {
|
|
46
|
+
const named = envTable.map((e) => `${e.env} "${e.id}"`).join(", ");
|
|
47
|
+
const keys = envTable.map((e) => e.env).join(" / ");
|
|
48
|
+
return (`[${CATALOG_REPLACES_ENV_MODELS_CODE}] config.d/models.json manages the model plane, which would replace the env model table (${named}); ` +
|
|
49
|
+
`the config root's decision ${documentPath} ${decisionPhrase(decision)}, so this catalog's model plane is not adopted and the model plane in force keeps serving ` +
|
|
50
|
+
`(the env models, unless an earlier catalog generation was adopted). To let local catalogs replace the env models on this config root, write ${documentPath} as {"envModels":"replaced"} ` +
|
|
51
|
+
`(a supported writer does this after showing what is replaced), or unset ${keys}.`);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=env-model-table-gate.js.map
|
|
@@ -138,7 +138,8 @@ export declare function executionLaneRow(lane: RemoteExecProvider): ExecutionLan
|
|
|
138
138
|
* 一条车道**必需**的 env 键名 = 正本表行的 `requiredEnv ∪ requiredSecretEnv`(次序:非密坐标在前、密钥在后 —— 与 7.113.0 本仓手写表逐字同)。
|
|
139
139
|
* 读者:`config.ts` 的 [ref] 拒启门(点了名却缺件 ⇒ 点名缺哪几键)、部署面门(`test/deploy-lanes-contract.test.ts`:`lanes.json` 每行登记
|
|
140
140
|
* 本车道必需键)、`scripts/gen-deploy-lanes.ts`(从同一张正本生成 `lanes.json` 的必需键列,以及根 / review compose 与 sema-up 栈 compose 里的必需键透传)。
|
|
141
|
-
* device
|
|
141
|
+
* 每条车道的必需键都在这一张表上、缺席都由下面的 {@link laneMissingEnv} 一只判官判 —— device 行也是(契约包 16.0.0 起 `requiredEnv: ["DEVICE_RELAY_URL"]`):缺席 / 空串 / 只含空白在 `declaredExecutionLane` 的必需 env 门被拒,
|
|
142
|
+
* 走到 `config.ts` 的设备入口解析器 `parseDeviceRelayUrlEnv` 时值一定在,它只判值的文法与凭据形。没有哪个必需键另有一臂缺席判官。
|
|
142
143
|
*/
|
|
143
144
|
export declare function laneRequiredEnv(lane: RemoteExecProvider): readonly string[];
|
|
144
145
|
/**
|