@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/boot/stores.js
CHANGED
|
@@ -18,6 +18,8 @@ import { PgRosterStore, TiDBRosterStore, ensurePgRosterSchema, ensureTiDBRosterS
|
|
|
18
18
|
import { LocalTaskAttachmentStore } from "../plugins/local-task-attachment-store.js";
|
|
19
19
|
import { PgTaskAttachmentStore, TiDBTaskAttachmentStore, ensurePgTaskAttachmentSchema, ensureTiDBTaskAttachmentSchema } from "../plugins/task-attachment-store.js";
|
|
20
20
|
import { createSessionStore } from "../plugins/session-store.js";
|
|
21
|
+
import { buildSqlPoolMissingRefusal, missingSqlCoordinateKeys } from "../sql-engine-coordinates.js";
|
|
22
|
+
import { runApprovalBatchKindlessCensus } from "../approval-batch-census.js";
|
|
21
23
|
import { runAndLogOneTimeMigrations } from "../plugins/one-time-migrations.js";
|
|
22
24
|
import { createTaskListLane } from "./task-list-lane.js";
|
|
23
25
|
import { ensurePgTaskListSchema, ensureTiDBTaskListSchema } from "../plugins/task-list-store-sql.js";
|
|
@@ -33,16 +35,17 @@ import { assertToolResultProvenanceSchema } from "../plugins/tool-result-store-s
|
|
|
33
35
|
import { assertPermissionRuleApprovalSchema, assertPermissionRuleTicketSchema } from "../plugins/permission-rule-store-sql.js";
|
|
34
36
|
import { assertApprovalAskRuleMaterialSchema } from "../plugins/approval-ask-store-sql.js";
|
|
35
37
|
import { assertSchemaMatchesCode } from "../plugins/schema-consistency.js";
|
|
36
|
-
import { assertCheckpointColumnSchema } from "../plugins/checkpoint-store-sql.js";
|
|
38
|
+
import { SqlCheckpointStore, assertCheckpointColumnSchema } from "../plugins/checkpoint-store-sql.js";
|
|
37
39
|
import { assertFileHistorySchema } from "../plugins/file-history-store-sql.js";
|
|
38
40
|
import { buildMemoryBoundaryLaneFacts, buildMemoryWriteBoundaryAudit } from "./memory-boundary.js";
|
|
39
41
|
import { buildMemoryPosture } from "../memory-posture.js";
|
|
40
42
|
import { headReadOf } from "../session-incarnation.js";
|
|
41
43
|
import { establishSqlEnginePosture, sqlPoolsOf } from "../sql-engine-posture.js";
|
|
42
44
|
import { buildStorePosture } from "../store-posture.js";
|
|
45
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
43
46
|
const DARK_REASON_PROSE = {
|
|
44
47
|
engine_off: () => "MEMORY_ENGINE=off",
|
|
45
|
-
multi_tenant_file_backend: () => "multi-tenant on the FILE backend (no tenant isolation; set MEMORY_ENGINE_BACKEND=pg|
|
|
48
|
+
multi_tenant_file_backend: () => "multi-tenant on the FILE backend (no tenant isolation; set MEMORY_ENGINE_BACKEND=pg|mysql to light up)",
|
|
46
49
|
remote_lane_split: (lane) => `remote exec lane "${lane}" (worker/sandbox file planes split; MEMORY_ENGINE_REMOTE_LANE=allow overrides)`,
|
|
47
50
|
};
|
|
48
51
|
export async function assertApprovalAskRuleMaterialOnBackend(backend) {
|
|
@@ -97,6 +100,10 @@ export async function openStores(ctx) {
|
|
|
97
100
|
}
|
|
98
101
|
if (backend)
|
|
99
102
|
await runAndLogOneTimeMigrations(logger, backend);
|
|
103
|
+
{
|
|
104
|
+
const censusStore = backend !== undefined && backend.kind !== "local" ? backend.checkpoint?.() : undefined;
|
|
105
|
+
void runApprovalBatchKindlessCensus(censusStore instanceof SqlCheckpointStore ? censusStore : undefined, logger);
|
|
106
|
+
}
|
|
100
107
|
if ((process.env.REWIND_SNAPSHOT_MAX_MB ?? "") !== "") {
|
|
101
108
|
logger.warn("rewind_snapshot_max_mb_retired", {
|
|
102
109
|
note: "REWIND_SNAPSHOT_MAX_MB no longer has an effect: the whole-tree snapshot epoch is retired (S-15); per-edited-file history captures only files the agent touches, with no tree walk and no size gate. Remove the env var. Per-blob SQL sizing is governed by SNAPSHOT_BLOB_SQL_MAX_BYTES / object storage as before.",
|
|
@@ -136,7 +143,7 @@ export async function openStores(ctx) {
|
|
|
136
143
|
if (dialect === "pg") {
|
|
137
144
|
const pool = backend?.pgPool();
|
|
138
145
|
if (!pool)
|
|
139
|
-
throw new Error(
|
|
146
|
+
throw new Error(buildSqlPoolMissingRefusal({ engine: dialect, declared: config.dbBackend === dialect, missing: missingSqlCoordinateKeys(dialect, process.env) }));
|
|
140
147
|
const q = async (text, params) => { const r = await pool.query(text, params); return { rows: r.rows }; };
|
|
141
148
|
await ensurePgMemoryEngineSchema(q);
|
|
142
149
|
await ensurePgMemoryHistorySchema(q);
|
|
@@ -147,7 +154,7 @@ export async function openStores(ctx) {
|
|
|
147
154
|
metrics.inc("memory_embed_failed_total", { backend: dialect });
|
|
148
155
|
logger.warn("memory_embedder_failed", {
|
|
149
156
|
model: config.memoryEmbedder?.model,
|
|
150
|
-
err: String(err)
|
|
157
|
+
err: seatText("operator-log-text", String(err)),
|
|
151
158
|
note: "memory writes for this batch report an io-error conflict and retrieval falls back to the lexical floor until the embedder recovers",
|
|
152
159
|
});
|
|
153
160
|
},
|
|
@@ -173,7 +180,7 @@ export async function openStores(ctx) {
|
|
|
173
180
|
else {
|
|
174
181
|
const pool = backend?.mysqlPool();
|
|
175
182
|
if (!pool)
|
|
176
|
-
throw new Error(
|
|
183
|
+
throw new Error(buildSqlPoolMissingRefusal({ engine: dialect, declared: config.dbBackend === dialect, missing: missingSqlCoordinateKeys(dialect, process.env) }));
|
|
177
184
|
await ensureTiDBMemoryEngineSchema(pool);
|
|
178
185
|
await ensureTiDBMemoryHistorySchema(pool);
|
|
179
186
|
await ensureTiDBMemorySyncSchema(pool);
|
|
@@ -271,7 +278,7 @@ export async function openStores(ctx) {
|
|
|
271
278
|
if (pgPool) {
|
|
272
279
|
const q = async (text, params) => { const r = await pgPool.query(text, params); return { rows: r.rows }; };
|
|
273
280
|
await ensurePgTaskAttachmentSchema(q);
|
|
274
|
-
taskAttachmentStore = new PgTaskAttachmentStore(
|
|
281
|
+
taskAttachmentStore = new PgTaskAttachmentStore(pgPool, bytes);
|
|
275
282
|
}
|
|
276
283
|
else {
|
|
277
284
|
await ensureTiDBTaskAttachmentSchema(mysqlPool);
|
package/dist/boot/web-admin.js
CHANGED
|
@@ -30,13 +30,14 @@ import { CONFIG_DOMAIN_INVALID_NOTE, buildCandidateRejectedFields, candidateReje
|
|
|
30
30
|
import { SHA256_HEX_RE } from "../digest-form.js";
|
|
31
31
|
import { BOOT_REJUDGE_OF_REFUSED_GROUP, createConfigApplyLedger, modelPlaneCommitted, refusedGroups } from "../web-admin-client/apply-ledger.js";
|
|
32
32
|
import { announceReadDenyRows, buildDeploymentPostureSeats } from "./runner-deps.js";
|
|
33
|
-
import {
|
|
33
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
34
34
|
const MODELS_REJECTION_PHRASE = {
|
|
35
35
|
domain_invalid: "models 域判形失败",
|
|
36
36
|
empty: "读不出(空 / 纯空白:半写或截断)",
|
|
37
37
|
invalid_json: "读不出(不是合法的 JSON)",
|
|
38
38
|
not_object: "读不出(解析出来不是 JSON 对象:null / 数组 / 标量)",
|
|
39
39
|
io: "读不出(文件读失败:权限、路径是目录或 I/O 错误)",
|
|
40
|
+
too_deep: "读不出(嵌套过深:深过整棵目录的内容版本能算的层数)",
|
|
40
41
|
retired_domain: "是带事实的退役域文档",
|
|
41
42
|
};
|
|
42
43
|
function lkgReadNote(scope) {
|
|
@@ -160,14 +161,14 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
160
161
|
`refusing to start rather than run with every sealed model unusable (no_key_store). Make that directory creatable, owned by ` +
|
|
161
162
|
`the service user and chmod-able to 0700 on a writable filesystem, or unset SEALED_KEY_DIR to use <data root>/sealed-key.`);
|
|
162
163
|
}
|
|
163
|
-
logger.warn("sealed_key_store_unavailable", { err: String(err), note: "sealed api keys cannot be unsealed on this host — models carrying sealedApiKey will fail loud per-model" });
|
|
164
|
+
logger.warn("sealed_key_store_unavailable", { err: seatText("operator-log-text", String(err)), note: "sealed api keys cannot be unsealed on this host — models carrying sealedApiKey will fail loud per-model" });
|
|
164
165
|
}
|
|
165
166
|
let checkpointCtxSealing;
|
|
166
167
|
try {
|
|
167
168
|
checkpointCtxSealing = await ensureCheckpointCtxSealing(sealedKeyDir, logger);
|
|
168
169
|
}
|
|
169
170
|
catch (err) {
|
|
170
|
-
logger.warn("checkpoint_ctx_sealing_unavailable", { err: err instanceof Error ? err.message : String(err), dir: join(sealedKeyDir, "checkpoint-ctx-keys"), note: "suspended tasks' request credentials cannot be sealed on this host; with durable approvals on the boot refuses — make that directory (under the sealed-key custody directory: SEALED_KEY_DIR, default <data root>/sealed-key) creatable and chmod-able by the service, or repair / remove a key file there whose public and private halves do not belong together" });
|
|
171
|
+
logger.warn("checkpoint_ctx_sealing_unavailable", { err: seatText("operator-log-text", err instanceof Error ? err.message : String(err)), dir: join(sealedKeyDir, "checkpoint-ctx-keys"), note: "suspended tasks' request credentials cannot be sealed on this host; with durable approvals on the boot refuses — make that directory (under the sealed-key custody directory: SEALED_KEY_DIR, default <data root>/sealed-key) creatable and chmod-able by the service, or repair / remove a key file there whose public and private halves do not belong together" });
|
|
171
172
|
}
|
|
172
173
|
const configProvider = configSourceKind(config) !== undefined
|
|
173
174
|
? createConfigProvider({
|
|
@@ -233,7 +234,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
233
234
|
listener(changed);
|
|
234
235
|
}
|
|
235
236
|
catch (err) {
|
|
236
|
-
logger.warn("self_report_listener_failed", { changed, error: err instanceof Error ? err.message : String(err), note: "a self-report subscriber threw; the state change stands regardless and the next fleet heartbeat carries it" });
|
|
237
|
+
logger.warn("self_report_listener_failed", { changed, error: seatText("operator-log-text", err instanceof Error ? err.message : String(err)), note: "a self-report subscriber threw; the state change stands regardless and the next fleet heartbeat carries it" });
|
|
237
238
|
}
|
|
238
239
|
}
|
|
239
240
|
};
|
|
@@ -325,7 +326,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
325
326
|
});
|
|
326
327
|
}
|
|
327
328
|
catch (e) {
|
|
328
|
-
logger.warn("center_prompts_store_unwritable", { dir: promptEpochDir, err: String(e), note: "file-backed prompt-epoch store unavailable — memory fallback (the center candidate is not restart-durable); built-ins unaffected" });
|
|
329
|
+
logger.warn("center_prompts_store_unwritable", { dir: promptEpochDir, err: seatText("operator-log-text", String(e)), note: "file-backed prompt-epoch store unavailable — memory fallback (the center candidate is not restart-durable); built-ins unaffected" });
|
|
329
330
|
return new CenterPromptSource({
|
|
330
331
|
store: withByDigestBackfill(new MemoryPromptArtifactStore()),
|
|
331
332
|
stateStore: recordingStateStore(binnedPromptStateStore(storePerBin(() => new MemoryPromptSourceStateStore()))),
|
|
@@ -348,7 +349,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
348
349
|
await promptSource.restore();
|
|
349
350
|
}
|
|
350
351
|
catch (e) {
|
|
351
|
-
logger.warn("center_prompts_catalog_restore_failed", { phase, err: String(e), note: "the persisted center-layer state for this credential identity could not be loaded — the center candidate is absent until the next adopt; built-ins unaffected" });
|
|
352
|
+
logger.warn("center_prompts_catalog_restore_failed", { phase, err: seatText("operator-log-text", String(e)), note: "the persisted center-layer state for this credential identity could not be loaded — the center candidate is absent until the next adopt; built-ins unaffected" });
|
|
352
353
|
}
|
|
353
354
|
if (cc !== undefined && identity !== undefined && currentIdentity() !== identity) {
|
|
354
355
|
promptStateIdentity = undefined;
|
|
@@ -473,7 +474,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
473
474
|
return lkgSurvivesRestart;
|
|
474
475
|
}
|
|
475
476
|
catch (err) {
|
|
476
|
-
logger.warn("config_lkg_save_failed", { path: lkgPath, err: String(err), note: "durable persist failed — restart signal proceeds anyway (a dead disk + dead center double-fault can re-loop; fix the disk)" });
|
|
477
|
+
logger.warn("config_lkg_save_failed", { path: lkgPath, err: seatText("operator-log-text", String(err)), note: "durable persist failed — restart signal proceeds anyway (a dead disk + dead center double-fault can re-loop; fix the disk)" });
|
|
477
478
|
return false;
|
|
478
479
|
}
|
|
479
480
|
};
|
|
@@ -510,7 +511,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
510
511
|
await saveLkg(lkgPath, cc?.worker, identity, read.lkg.effective, read.lkg.etag);
|
|
511
512
|
}
|
|
512
513
|
catch (err) {
|
|
513
|
-
logger.warn("config_lkg_save_failed", { path: lkgPath, err: String(err), note: "the migrated LKG is used from memory this boot; the on-disk copy is migrated again on the next read-back and replaced by the next clean candidate" });
|
|
514
|
+
logger.warn("config_lkg_save_failed", { path: lkgPath, err: seatText("operator-log-text", String(err)), note: "the migrated LKG is used from memory this boot; the on-disk copy is migrated again on the next read-back and replaced by the next clean candidate" });
|
|
514
515
|
}
|
|
515
516
|
}
|
|
516
517
|
logger.info("config_loaded_lkg", { path: lkgPath, savedAt: read.lkg.savedAt, why, scope, note: lkgReadNote(scope) });
|
|
@@ -561,7 +562,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
561
562
|
}
|
|
562
563
|
catch (applyErr) {
|
|
563
564
|
lkgBooted = false;
|
|
564
|
-
logger.warn("config_lkg_apply_failed", { err: String(applyErr), note: "persisted LKG failed to apply — env fallback serves; the cache rewrites on the next clean candidate" });
|
|
565
|
+
logger.warn("config_lkg_apply_failed", { err: seatText("operator-log-text", String(applyErr)), note: "persisted LKG failed to apply — env fallback serves; the cache rewrites on the next clean candidate" });
|
|
565
566
|
}
|
|
566
567
|
};
|
|
567
568
|
const warnLocalNoModels = (r, verdict) => {
|
|
@@ -680,10 +681,10 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
680
681
|
if (err instanceof ConfigDirUntrustedError)
|
|
681
682
|
throw err;
|
|
682
683
|
if (bootApplyPhase)
|
|
683
|
-
logger.warn("config_apply_refused", { source: configProvider.kind, err: String(err), note: "the pulled candidate failed to apply at boot — falling back to the LKG / env; this is not a reachability failure" });
|
|
684
|
+
logger.warn("config_apply_refused", { source: configProvider.kind, err: seatText("operator-log-text", String(err)), note: "the pulled candidate failed to apply at boot — falling back to the LKG / env; this is not a reachability failure" });
|
|
684
685
|
else
|
|
685
|
-
logger.warn("config_source_unreachable_using_env", { source: configProvider.kind, err: String(err) });
|
|
686
|
-
await bootFallBackWhole(`${bootApplyPhase ? "boot apply refused" : "boot fetch failed"}: ${
|
|
686
|
+
logger.warn("config_source_unreachable_using_env", { source: configProvider.kind, err: seatText("operator-log-text", String(err)) });
|
|
687
|
+
await bootFallBackWhole(`${bootApplyPhase ? "boot apply refused" : "boot fetch failed"}: ${seatText("operator-log-text", String(err))}`);
|
|
687
688
|
}
|
|
688
689
|
if (!dryRun && cc !== undefined && currentIdentity() !== promptStateIdentity)
|
|
689
690
|
await rebasePromptState(currentIdentity(), "boot-end");
|
|
@@ -769,7 +770,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
769
770
|
toolsShareThisFilesystem: DEPLOYMENT_SHAPE_PREDICATES.toolsOnThisHost.holds(config),
|
|
770
771
|
logger,
|
|
771
772
|
}).catch((err) => {
|
|
772
|
-
logger.warn("center_plugins_apply_failed", { error: err instanceof Error ? err.message : String(err) });
|
|
773
|
+
logger.warn("center_plugins_apply_failed", { error: seatText("operator-log-text", err instanceof Error ? err.message : String(err)) });
|
|
773
774
|
return undefined;
|
|
774
775
|
});
|
|
775
776
|
if (pluginOut) {
|
|
@@ -781,7 +782,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
781
782
|
}
|
|
782
783
|
if (bootLkgCandidate && lkgEnabled) {
|
|
783
784
|
const bootPublished = await persistLkgDurable(bootLkgCandidate.effective, bootLkgCandidate.etag).catch((err) => {
|
|
784
|
-
logger.warn("config_lkg_save_failed", { err: String(err), note: "boot LKG persist failed — retained for the per-tick retry" });
|
|
785
|
+
logger.warn("config_lkg_save_failed", { err: seatText("operator-log-text", String(err)), note: "boot LKG persist failed — retained for the per-tick retry" });
|
|
785
786
|
return false;
|
|
786
787
|
});
|
|
787
788
|
{
|
|
@@ -1053,7 +1054,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
1053
1054
|
}
|
|
1054
1055
|
}
|
|
1055
1056
|
catch (err) {
|
|
1056
|
-
logger.warn("web_admin_refresh_failed", { err: String(err), note: "etag NOT advanced — the same candidate is re-fetched and re-applied next poll" });
|
|
1057
|
+
logger.warn("web_admin_refresh_failed", { err: seatText("operator-log-text", String(err)), note: "etag NOT advanced — the same candidate is re-fetched and re-applied next poll" });
|
|
1057
1058
|
return "failed";
|
|
1058
1059
|
}
|
|
1059
1060
|
finally {
|
|
@@ -1112,7 +1113,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
1112
1113
|
lastPull = "ok";
|
|
1113
1114
|
}
|
|
1114
1115
|
catch (err) {
|
|
1115
|
-
logger.warn("web_admin_refresh_failed", { err: String(err), leg: "boot-deferred", note: "etag NOT advanced — the refresh cadence re-fetches and re-applies the same candidate" });
|
|
1116
|
+
logger.warn("web_admin_refresh_failed", { err: seatText("operator-log-text", String(err)), leg: "boot-deferred", note: "etag NOT advanced — the refresh cadence re-fetches and re-applies the same candidate" });
|
|
1116
1117
|
}
|
|
1117
1118
|
finally {
|
|
1118
1119
|
refreshInFlight = false;
|
|
@@ -1163,7 +1164,7 @@ export async function createWebAdminRuntime(ctx) {
|
|
|
1163
1164
|
void bootConfigPending.then((r) => {
|
|
1164
1165
|
if (r !== null && configProvider.kind === "remote" && candidateIdentityOf(r.effective) !== currentIdentity()) {
|
|
1165
1166
|
logger.warn("config_boot_arrival_identity_changed", { note: "the late boot pull landed under a center credential that is no longer current — not adopted; re-pulling once under the current credential" });
|
|
1166
|
-
void pullEffective(configProvider, undefined).then(continueArrival, (err) => logger.warn("config_boot_arrival_repull_failed", { err: String(err), note: "the refresh cadence retries under the current credential" }));
|
|
1167
|
+
void pullEffective(configProvider, undefined).then(continueArrival, (err) => logger.warn("config_boot_arrival_repull_failed", { err: seatText("operator-log-text", String(err)), note: "the refresh cadence retries under the current credential" }));
|
|
1167
1168
|
return;
|
|
1168
1169
|
}
|
|
1169
1170
|
continueArrival(r);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createWebFetchSummarizer, resolveTaskModel as coreResolveTaskModel } from "@sema-agent/core";
|
|
2
2
|
import { createPerModelAuthSeat } from "./side-query-lane.js";
|
|
3
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
3
4
|
export function createWebFetchSummarizeLane(ctx) {
|
|
4
5
|
return async (content, prompt, signal) => {
|
|
5
6
|
const model = (() => {
|
|
@@ -7,7 +8,7 @@ export function createWebFetchSummarizeLane(ctx) {
|
|
|
7
8
|
return coreResolveTaskModel({ modelRole: "summarize" }, { models: ctx.config.models, roles: ctx.config.roles }).model;
|
|
8
9
|
}
|
|
9
10
|
catch (err) {
|
|
10
|
-
ctx.logger.warn("webfetch_summarizer_model_unresolved", { err: String(err), note: "this fetch falls back to raw page content" });
|
|
11
|
+
ctx.logger.warn("webfetch_summarizer_model_unresolved", { err: seatText("operator-log-text", String(err)), note: "this fetch falls back to raw page content" });
|
|
11
12
|
return undefined;
|
|
12
13
|
}
|
|
13
14
|
})();
|
|
@@ -7,6 +7,7 @@ import { FileWorkflowCompletionInbox, InMemoryWorkflowCompletionInbox, buildWork
|
|
|
7
7
|
import { FileWorkflowNotifyJournalStore, JournalingWorkflowRunStore, WorkflowNotifyGate } from "../orchestration/workflow-notify-journal.js";
|
|
8
8
|
import { SubagentSteerRegistry } from "../orchestration/subagent-steer.js";
|
|
9
9
|
import { WorkflowAgentRegistry } from "../orchestration/workflow-agent-steer.js";
|
|
10
|
+
import { seatText } from "../trace/exit-seat.js";
|
|
10
11
|
export function createWorkflowOrchestration(ctx) {
|
|
11
12
|
const { config, logger, metrics, localRoot, backend, getRunStore } = ctx;
|
|
12
13
|
const workflowBootAtMs = Date.now();
|
|
@@ -43,12 +44,12 @@ export function createWorkflowOrchestration(ctx) {
|
|
|
43
44
|
await workflowCompletionInbox.enqueue(buildWorkflowCompleteInboxEntry(route, p, Date.now()));
|
|
44
45
|
}
|
|
45
46
|
catch (err) {
|
|
46
|
-
logger.warn("workflow_completion_enqueue_failed", { runId: p.runId, err: String(err) });
|
|
47
|
+
logger.warn("workflow_completion_enqueue_failed", { runId: p.runId, err: seatText("operator-log-text", String(err)) });
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
50
|
const workflowNotifyGate = baseWorkflowRunStore && workflowNotifyJournal
|
|
50
51
|
? new WorkflowNotifyGate(workflowNotifyJournal, baseWorkflowRunStore, deliverWorkflowCompletion, {
|
|
51
|
-
onError: (stage, runId, err) => logger.warn("workflow_notify_failed", { stage, runId, err: String(err) }),
|
|
52
|
+
onError: (stage, runId, err) => logger.warn("workflow_notify_failed", { stage, runId, err: seatText("operator-log-text", String(err)) }),
|
|
52
53
|
})
|
|
53
54
|
: undefined;
|
|
54
55
|
const fleetBus = new FleetEventBus();
|
|
@@ -37,7 +37,8 @@ export declare function createSubagentExtraTools(deployment?: SubagentExtraToolS
|
|
|
37
37
|
/**
|
|
38
38
|
* `onExtraToolsError` 收到的错误 → 运维行 `subagent_extra_tools_error` 的字段:句子,加上错误**自带**的码与 `detail.reason`(在场才铸)。
|
|
39
39
|
* core 7.46.0 [ref] 被拒的 spawn(产物不在名册里)带 `config.extra_tool_names` + `undeclared_name` / `undeclared_origin`;部署工厂自己抛的错多半两位都不带。
|
|
40
|
-
* 本仓不按码分支、不重铸 ——
|
|
40
|
+
* 本仓不按码分支、不重铸 —— 只把错误说的话过境到运维面(修前只记句子,码与原因词丢在这一跳)。码是别人写的串(引擎的 `config.extra_tool_names`,或部署工厂自己抛的错):
|
|
41
|
+
* 与运维日志里其余各处同一只判官 —— 是码才带 `code`,其余键缺席({@link codeFieldOf})。
|
|
41
42
|
*/
|
|
42
43
|
export declare function extraToolsErrorFields(err: unknown): Record<string, unknown>;
|
|
43
44
|
//# sourceMappingURL=builtin-tools.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { NOW_TOOL_NAME } from "./host-tool-names.js";
|
|
3
|
+
import { codeFieldOf } from "../terminal.js";
|
|
3
4
|
export function nowTool() {
|
|
4
5
|
return {
|
|
5
6
|
name: NOW_TOOL_NAME,
|
|
@@ -21,12 +22,9 @@ export function createSubagentExtraTools(deployment) {
|
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
export function extraToolsErrorFields(err) {
|
|
24
|
-
const fields = { err: err instanceof Error ? err.message : String(err) };
|
|
25
|
+
const fields = { err: err instanceof Error ? err.message : String(err), ...codeFieldOf(err) };
|
|
25
26
|
if (err === null || typeof err !== "object")
|
|
26
27
|
return fields;
|
|
27
|
-
const code = Reflect.get(err, "code");
|
|
28
|
-
if (typeof code === "string")
|
|
29
|
-
fields.code = code;
|
|
30
28
|
const detail = Reflect.get(err, "detail");
|
|
31
29
|
const reason = detail !== null && typeof detail === "object" ? Reflect.get(detail, "reason") : undefined;
|
|
32
30
|
if (typeof reason === "string")
|
|
@@ -45,7 +45,7 @@ export declare const COMPOSITE_CAPABILITY_MEMBERS: {
|
|
|
45
45
|
readonly centerWiring: readonly ["effectivePull", "effectiveRevision", "lease", "leaseHealth", "failMode", "usageReport", "issuer", "worker", "caller"];
|
|
46
46
|
readonly webSearch: readonly ["backend"];
|
|
47
47
|
readonly background: readonly ["listFace", "exitFaces"];
|
|
48
|
-
readonly taskSettings: readonly ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "tightenOnlySeats", "approvalFrameFamilies"];
|
|
48
|
+
readonly taskSettings: readonly ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "httpHookAllowlists", "tightenOnlySeats", "approvalFrameFamilies"];
|
|
49
49
|
readonly settings: readonly ["permissions"];
|
|
50
50
|
readonly permissionModeAuto: readonly ["accepted", "classifierSeat", "entitlementSource", "armed", "reason", "model"];
|
|
51
51
|
readonly writeProtection: readonly ["armed", "rows", "replaced"];
|
|
@@ -56,6 +56,7 @@ export declare const COMPOSITE_CAPABILITY_MEMBERS: {
|
|
|
56
56
|
readonly workspaceSync: readonly ["persist", "keep", "timeoutMs", "cache"];
|
|
57
57
|
readonly userAttachments: readonly ["entries", "kinds", "supplies", "limits"];
|
|
58
58
|
readonly credentialPlane: readonly ["sandboxGit"];
|
|
59
|
+
readonly memorySyncServe: readonly ["identity"];
|
|
59
60
|
};
|
|
60
61
|
type CompositeTable = typeof COMPOSITE_CAPABILITY_MEMBERS;
|
|
61
62
|
/** 值的**具名成员对象臂**(标量 / 字面词 / `false` / `null` / `undefined` / 数组 / 函数臂剥掉)。 */
|
|
@@ -6,7 +6,7 @@ export const COMPOSITE_CAPABILITY_MEMBERS = {
|
|
|
6
6
|
centerWiring: ["effectivePull", "effectiveRevision", "lease", "leaseHealth", "failMode", "usageReport", "issuer", "worker", "caller"],
|
|
7
7
|
webSearch: ["backend"],
|
|
8
8
|
background: ["listFace", "exitFaces"],
|
|
9
|
-
taskSettings: ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "tightenOnlySeats", "approvalFrameFamilies"],
|
|
9
|
+
taskSettings: ["permissions", "permissionMode", "model", "outputStyle", "env", "hooks", "pluginHooks", "managedHookGroups", "httpHookAllowlists", "tightenOnlySeats", "approvalFrameFamilies"],
|
|
10
10
|
settings: ["permissions"],
|
|
11
11
|
permissionModeAuto: ["accepted", "classifierSeat", "entitlementSource", "armed", "reason", "model"],
|
|
12
12
|
writeProtection: ["armed", "rows", "replaced"],
|
|
@@ -17,6 +17,7 @@ export const COMPOSITE_CAPABILITY_MEMBERS = {
|
|
|
17
17
|
workspaceSync: ["persist", "keep", "timeoutMs", "cache"],
|
|
18
18
|
userAttachments: ["entries", "kinds", "supplies", "limits"],
|
|
19
19
|
credentialPlane: ["sandboxGit"],
|
|
20
|
+
memorySyncServe: ["identity"],
|
|
20
21
|
};
|
|
21
22
|
export function gateCompositeMembers(body) {
|
|
22
23
|
return body;
|
|
@@ -87,7 +87,7 @@ export interface ScenarioContext {
|
|
|
87
87
|
* 由**每一个**接了停驻挂点的取用方显式交出(一条读法,没有回落):请求腿 = 本请求经鉴权解析的会话与受理时那一读(`boot/resolve-spec.ts`);`/decide` 赎回面 = 行上的
|
|
88
88
|
* `rootSessionId` 与赎回腿写口放行的那一位住客(`parked-revive-surface.ts`,交不交座都交)。它**只**喂停驻挂点,不挂任何会话级设施(那是 {@link sessionId} 的事,
|
|
89
89
|
* 判据是「这只 bundle 是不是在那只会话上取用的」,与属主来源是两个独立判据)。缺席 = 没有根可交(boot 期探针、run-local、行上没有根)⇒ 律给哨兵。
|
|
90
|
-
* 挂点在停驻那一刻再读一次根行:住客不是见证的那一位(删了、同 id 被重新登记)⇒ 停驻否决 ——
|
|
90
|
+
* 挂点在停驻那一刻再读一次根行:住客不是见证的那一位(删了、同 id 被重新登记)⇒ 停驻否决 —— 不按新住客认领。
|
|
91
91
|
*/
|
|
92
92
|
delegationRoot?: DelegationRootWitness;
|
|
93
93
|
}
|
|
@@ -65,6 +65,9 @@ export declare const CAPABILITY_FACT_WHY: {
|
|
|
65
65
|
readonly memory_origin_faces_absent: "the memory engine's origin marking faces are not wired";
|
|
66
66
|
readonly consolidation_valve_closed: "the memory consolidation valve is closed (MEMORY_CONSOLIDATION_DRIVER)";
|
|
67
67
|
readonly memory_optout_grant_absent: "no memory-capture opt-out grant store is wired (SQL backends only)";
|
|
68
|
+
readonly memory_db_plane_absent: "this is not a DB memory plane (MEMORY_ENGINE_BACKEND=pg|mysql): the central memory faces are not wired";
|
|
69
|
+
readonly memory_sync_identity_undeclared: "the DB memory plane declares no sync identity (MEMORY_SYNC_SERVE_IDENTITY), so it serves no sync round";
|
|
70
|
+
readonly memory_sync_leg_absent: "no memory sync leg runs here (a file memory engine with MEMORY_SYNC_URL)";
|
|
68
71
|
readonly outcome_ledger_unqueryable: "the outcome sink has no query face (File sink)";
|
|
69
72
|
readonly config_catalog_disabled: "the config catalog is switched off (CONFIG_CATALOG_ENABLED=false)";
|
|
70
73
|
readonly rule_store_absent: "no permission-rule store is wired";
|
|
@@ -140,6 +143,15 @@ export declare function mcpReconnect(d: Pick<Deps, "runStore" | "sessionStorage"
|
|
|
140
143
|
runStore: Store<"runStore">;
|
|
141
144
|
sessionStorage: HeadReadingSessionStore;
|
|
142
145
|
}>;
|
|
146
|
+
/**
|
|
147
|
+
* 在飞 run 的切档口(`POST /v1/runs/:id/permission-mode`)= 持久 run 账面 ∧ checkpoint 店(ctx 面)。后一格是承重的:切档要读这条 run 的
|
|
148
|
+
* **存储体**(本任务 settings 的 kill-switch 由受理判官折,与提交口同一份事实),也要把准入的词写回存储体(run 模式词的唯一来源,续跑腿读它);
|
|
149
|
+
* 没有 ctx 面的部署两件都做不了 ⇒ 不提供这一口(能力位 `permissionModeWrite` 同读本事实)。
|
|
150
|
+
*/
|
|
151
|
+
export declare function permissionModeWrite(d: Pick<Deps, "runStore" | "checkpointStore">): Fact<"run_store_absent" | "checkpoint_store_absent", {
|
|
152
|
+
runStore: Store<"runStore">;
|
|
153
|
+
checkpointStore: Store<"checkpointStore">;
|
|
154
|
+
}>;
|
|
143
155
|
export declare function sessionAuditView(d: Pick<Deps, "sessionAudit">): Fact<"session_audit_absent", {
|
|
144
156
|
sessionAudit: Store<"sessionAudit">;
|
|
145
157
|
}>;
|
|
@@ -263,6 +275,27 @@ export declare function sharedMemoryRead(d: Pick<Deps, "sharedMemoryStore" | "or
|
|
|
263
275
|
provider: Store<"sharedMemoryStore">;
|
|
264
276
|
directory: Store<"orgMemoryDirectory">;
|
|
265
277
|
}>;
|
|
278
|
+
/** 中心侧记忆导出读(`GET /v1/memory/export`):DB 记忆平面的导出读面在场(只在 DB 记忆平面装配)。门读本事实,不读 `MEMORY_ENGINE_BACKEND`。 */
|
|
279
|
+
export declare function memoryExport(d: Pick<Deps, "memoryExport">): Fact<"memory_db_plane_absent", {
|
|
280
|
+
read: Store<"memoryExport">;
|
|
281
|
+
}>;
|
|
282
|
+
/**
|
|
283
|
+
* 中心侧同步口(`POST /v1/memory/sync/:scope`):DB 记忆平面的同步执行位在场 ∧ 本中心声明了同步身份(`MEMORY_SYNC_SERVE_IDENTITY`)。
|
|
284
|
+
* 见证 = 执行位 + 那份声明 —— 能力位 `memorySyncServe` 的 `{ identity }` 逐字投影它,入站 `peer` 与它按串比:一处声明,两个读者读同一个值。
|
|
285
|
+
*/
|
|
286
|
+
export declare function memorySyncServe(d: Pick<Deps, "memorySync" | "config">): Fact<"memory_db_plane_absent" | "memory_sync_identity_undeclared", {
|
|
287
|
+
perform: Store<"memorySync">;
|
|
288
|
+
identity: string;
|
|
289
|
+
}>;
|
|
290
|
+
/**
|
|
291
|
+
* 会话记忆同步触发口(`POST /v1/sessions/:id/memory/sync`):本机同步腿在场 ∧ 持久 run 账面(读集 = 会话最近一条已结腿的记忆观测;收割栅栏读会话的 run 认领)
|
|
292
|
+
* ∧ 会话头读(属主门与 `sourceRevision` = 同一次头读的叶子)。
|
|
293
|
+
*/
|
|
294
|
+
export declare function sessionMemorySync(d: Pick<Deps, "memorySyncLeg" | "runStore" | "sessionStorage">): Fact<"memory_sync_leg_absent" | "run_store_absent" | "session_head_face_absent", {
|
|
295
|
+
leg: Store<"memorySyncLeg">;
|
|
296
|
+
runStore: Store<"runStore">;
|
|
297
|
+
sessionStorage: HeadReadingSessionStore;
|
|
298
|
+
}>;
|
|
266
299
|
/** 跨主体投递门在座(`POST /v1/principal-inbox/messages` 的可用性门与能力位 `principalInboxDelivery` 同读这一只)。门的装配本身是
|
|
267
300
|
* 一道合取(收件箱消费方声明 ∧ 耐久 mailbox ∧ org 成员目录 ∧ 配额店,缺一拒启 —— `boot/stage-06-runners.ts`),
|
|
268
301
|
* 所以这里只判「门在不在」:在 ⟺ 那四件都在。 */
|
package/dist/capability-facts.js
CHANGED
|
@@ -45,6 +45,9 @@ export const CAPABILITY_FACT_WHY = {
|
|
|
45
45
|
memory_origin_faces_absent: "the memory engine's origin marking faces are not wired",
|
|
46
46
|
consolidation_valve_closed: "the memory consolidation valve is closed (MEMORY_CONSOLIDATION_DRIVER)",
|
|
47
47
|
memory_optout_grant_absent: "no memory-capture opt-out grant store is wired (SQL backends only)",
|
|
48
|
+
memory_db_plane_absent: "this is not a DB memory plane (MEMORY_ENGINE_BACKEND=pg|mysql): the central memory faces are not wired",
|
|
49
|
+
memory_sync_identity_undeclared: "the DB memory plane declares no sync identity (MEMORY_SYNC_SERVE_IDENTITY), so it serves no sync round",
|
|
50
|
+
memory_sync_leg_absent: "no memory sync leg runs here (a file memory engine with MEMORY_SYNC_URL)",
|
|
48
51
|
outcome_ledger_unqueryable: "the outcome sink has no query face (File sink)",
|
|
49
52
|
config_catalog_disabled: "the config catalog is switched off (CONFIG_CATALOG_ENABLED=false)",
|
|
50
53
|
rule_store_absent: "no permission-rule store is wired",
|
|
@@ -113,6 +116,15 @@ export function mcpReconnect(d) {
|
|
|
113
116
|
return owned;
|
|
114
117
|
return yes({ runStore: runs.runStore, sessionStorage: owned.sessionStorage });
|
|
115
118
|
}
|
|
119
|
+
export function permissionModeWrite(d) {
|
|
120
|
+
const runs = durableRuns(d);
|
|
121
|
+
if (!runs.available)
|
|
122
|
+
return runs;
|
|
123
|
+
const park = checkpointPark(d);
|
|
124
|
+
if (!park.available)
|
|
125
|
+
return park;
|
|
126
|
+
return yes({ runStore: runs.runStore, checkpointStore: park.checkpointStore });
|
|
127
|
+
}
|
|
116
128
|
export function sessionAuditView(d) {
|
|
117
129
|
return d.sessionAudit !== undefined ? yes({ sessionAudit: d.sessionAudit }) : no("session_audit_absent");
|
|
118
130
|
}
|
|
@@ -277,6 +289,26 @@ export function sharedMemoryRead(d) {
|
|
|
277
289
|
return no("org_memory_directory_absent");
|
|
278
290
|
return yes({ provider: d.sharedMemoryStore, directory: d.orgMemoryDirectory });
|
|
279
291
|
}
|
|
292
|
+
export function memoryExport(d) {
|
|
293
|
+
return d.memoryExport !== undefined ? yes({ read: d.memoryExport }) : no("memory_db_plane_absent");
|
|
294
|
+
}
|
|
295
|
+
export function memorySyncServe(d) {
|
|
296
|
+
if (d.memorySync === undefined)
|
|
297
|
+
return no("memory_db_plane_absent");
|
|
298
|
+
const identity = d.config.memorySyncServeIdentity;
|
|
299
|
+
return identity !== undefined ? yes({ perform: d.memorySync, identity }) : no("memory_sync_identity_undeclared");
|
|
300
|
+
}
|
|
301
|
+
export function sessionMemorySync(d) {
|
|
302
|
+
if (d.memorySyncLeg === undefined)
|
|
303
|
+
return no("memory_sync_leg_absent");
|
|
304
|
+
const runs = durableRuns(d);
|
|
305
|
+
if (!runs.available)
|
|
306
|
+
return runs;
|
|
307
|
+
const owned = sessionOwnership(d);
|
|
308
|
+
if (!owned.available)
|
|
309
|
+
return owned;
|
|
310
|
+
return yes({ leg: d.memorySyncLeg, runStore: runs.runStore, sessionStorage: owned.sessionStorage });
|
|
311
|
+
}
|
|
280
312
|
export function principalInboxDelivery(d) {
|
|
281
313
|
return d.orgDeliveryGate !== undefined ? yes({ gate: d.orgDeliveryGate }) : no("org_delivery_gate_absent");
|
|
282
314
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **结算时作废一张本服务兑现不了的卡** —— 全仓「结算作废」的唯一动词:读卡 → 卡仍 pending ∧ 卡在调用方说的那只会话上 ⇒
|
|
3
|
+
* 按卡**自己的** scope 走 checkpoint 店的 `expire`(与引擎的本进程仲裁器、续跑的 resolve 同一只 CAS,恰一个赢家)。不新增任何持久态。
|
|
4
|
+
*
|
|
5
|
+
* 规则只有一条:**本服务兑现不了的卡不留在待决面上**。两个产地读这一只动词,各自只答「手里是哪一张卡、它该在哪只会话上」:
|
|
6
|
+
* · 验证器自己的停驻(`verifier-pause-card.ts`):卡在验证器现铸的会话上,本服务的续跑链连不回它;
|
|
7
|
+
* · 停驻没落定就以失败收场的腿(`runs.ts` 的 `voidHeldParkCard`:后台腿与续跑腿):卡在本 run 的会话上,但兑现它的那条 run 已经
|
|
8
|
+
* `failed`、认领已放 —— 卡的命运先于认领释放(调用方先调本动词、再放认领)。
|
|
9
|
+
*
|
|
10
|
+
* 不抛:作废没做成(店读 / 作废抛错、卡的会话对不上、没接店)⇒ 卡回到「留在待决面上、由审批兜底收割收走」的形,按产地登记的 tag
|
|
11
|
+
* 响亮留痕(计数 + 探针行 + 一次 warn),结算照常往下走。卡已不 pending / 已不在 ⇒ 什么都不做(CAS 输给了别的结算者,结局相同)。
|
|
12
|
+
*
|
|
13
|
+
* ## 🚧 过渡(引擎动词到货即改调)
|
|
14
|
+
* 店级 `expire` 只作废卡,**不释放**引擎为这张卡钉住的会话(引擎在停驻时 pin 会话,只在续跑终局 / 续跑失败臂 unpin):
|
|
15
|
+
* 被作废的卡的会话在本副本内存里一直常驻到进程重启。引擎给出「作废停驻卡并释放其会话」的动词之后,本动词改调它(两个产地一字不改)。
|
|
16
|
+
*/
|
|
17
|
+
import type { CheckpointToken } from "@sema-agent/core";
|
|
18
|
+
import { type FailOpenTag } from "./observability/fail-open.js";
|
|
19
|
+
/** 结算点手里那只 checkpoint 店的两个动词:读卡(取它自己的 scope / 会话 / 状态)→ 按卡自己的 scope CAS 作废。 */
|
|
20
|
+
export interface CardVoidPort {
|
|
21
|
+
get(token: CheckpointToken): Promise<{
|
|
22
|
+
readonly scope?: string;
|
|
23
|
+
readonly sessionId?: string;
|
|
24
|
+
readonly status?: string;
|
|
25
|
+
} | null>;
|
|
26
|
+
expire(token: CheckpointToken, scope: string): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
/** 要作废的那一张:停驻带回的凭据 + 它应在的会话(对不上就不动它 —— 只作废**这一张**)。 */
|
|
29
|
+
export interface CardRef {
|
|
30
|
+
readonly token: CheckpointToken;
|
|
31
|
+
readonly sessionId: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 作废 `card`(见模块头注)。`tag` = 产地登记的 F 类 tag;`at` = 探针行上的产地现场(例 `leg=bg`),接在 `reason=` 之后;
|
|
35
|
+
* detail 形 `reason=<词>[ <at>][ err=<原句>]`,不含凭据。
|
|
36
|
+
*/
|
|
37
|
+
export declare function voidPendingCard(card: CardRef, cards: CardVoidPort | undefined, tag: FailOpenTag, at?: string): Promise<void>;
|
|
38
|
+
//# sourceMappingURL=card-void.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { errorText } from "./observability/err-text.js";
|
|
2
|
+
import { recordFailOpen } from "./observability/fail-open.js";
|
|
3
|
+
export async function voidPendingCard(card, cards, tag, at) {
|
|
4
|
+
const miss = (reason, err) => recordFailOpen(tag, `reason=${reason}${at === undefined ? "" : ` ${at}`}${err === undefined ? "" : ` err=${err}`}`);
|
|
5
|
+
if (cards === undefined) {
|
|
6
|
+
miss("no_checkpoint_store");
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const live = await cards.get(card.token);
|
|
11
|
+
if (live === null || live.status !== "pending")
|
|
12
|
+
return;
|
|
13
|
+
if (card.sessionId === undefined || live.sessionId !== card.sessionId || typeof live.scope !== "string") {
|
|
14
|
+
miss("card_mismatch");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
await cards.expire(card.token, live.scope);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
miss("store_error", errorText(e));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=card-void.js.map
|