@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
|
@@ -17,7 +17,7 @@ import { redactSecrets } from "../trace/redact.js";
|
|
|
17
17
|
import { CLAIM_OWNERLESS_PLACED_SQL, claimOwnerlessParams, isOrphanSessionOwner, judgeDelegatedOwner } from "../delegated-session-owner.js";
|
|
18
18
|
import { MAILBOX_KEYED_TABLES, mailboxKeyDeleteSql, storedMailboxKeyless } from "./mailbox-store-sql.js";
|
|
19
19
|
import { SESSION_META_PLACEMENT_COLUMNS, backfillWriterStatement, countOrphanBindingsStatement, migrateDeviceBindingsStatement } from "./execution-placement-sql.js";
|
|
20
|
-
import { APPROVAL_ASK_EXECUTION_LANE_COLUMN, APPROVAL_ASK_TABLE } from "./approval-ask-store-sql.js";
|
|
20
|
+
import { APPROVAL_ASK_ENDING_CAUSE_COLUMN, APPROVAL_ASK_EXECUTION_LANE_COLUMN, APPROVAL_ASK_PARK_TRIGGER_COLUMN, APPROVAL_ASK_TABLE } from "./approval-ask-store-sql.js";
|
|
21
21
|
import { isUnusableArchive } from "../execution-placement.js";
|
|
22
22
|
const RETIRED_SESSION_RULE_BUCKETS = ["commandAllow", "commandDeny"];
|
|
23
23
|
export function buildMigrationReceipts() {
|
|
@@ -55,6 +55,14 @@ export function buildMigrationReceipts() {
|
|
|
55
55
|
executionPlacementsBackfilled: 0,
|
|
56
56
|
askExecutionLanesBackfilled: 0,
|
|
57
57
|
executionPlacementSessionsUnreadable: [],
|
|
58
|
+
localArchiveRowFactsBackfilled: 0,
|
|
59
|
+
localArchivesAnonymized: 0,
|
|
60
|
+
localArchivesKeptStamped: [],
|
|
61
|
+
localArchivesUnreadable: [],
|
|
62
|
+
localArchiveSnapshotsRecovered: 0,
|
|
63
|
+
askCauseColumnsChanged: 0,
|
|
64
|
+
askParkTriggersMoved: 0,
|
|
65
|
+
askJournalRecordsUpgraded: 0,
|
|
58
66
|
};
|
|
59
67
|
}
|
|
60
68
|
function completedReport(r) {
|
|
@@ -100,7 +108,15 @@ function changedAnything(r) {
|
|
|
100
108
|
r.deviceBindingTablesDropped > 0 ||
|
|
101
109
|
r.executionPlacementsBackfilled > 0 ||
|
|
102
110
|
r.askExecutionLanesBackfilled > 0 ||
|
|
103
|
-
r.executionPlacementSessionsUnreadable.length > 0
|
|
111
|
+
r.executionPlacementSessionsUnreadable.length > 0 ||
|
|
112
|
+
r.localArchiveRowFactsBackfilled > 0 ||
|
|
113
|
+
r.localArchivesAnonymized > 0 ||
|
|
114
|
+
r.localArchivesKeptStamped.length > 0 ||
|
|
115
|
+
r.localArchivesUnreadable.length > 0 ||
|
|
116
|
+
r.localArchiveSnapshotsRecovered > 0 ||
|
|
117
|
+
r.askCauseColumnsChanged > 0 ||
|
|
118
|
+
r.askParkTriggersMoved > 0 ||
|
|
119
|
+
r.askJournalRecordsUpgraded > 0);
|
|
104
120
|
}
|
|
105
121
|
function readingsSnapshot(r) {
|
|
106
122
|
return {
|
|
@@ -113,6 +129,8 @@ function readingsSnapshot(r) {
|
|
|
113
129
|
parkedApprovalCardRowsUnreadable: [...r.parkedApprovalCardRowsUnreadable],
|
|
114
130
|
parkedApprovalCardRowsTooLong: [...r.parkedApprovalCardRowsTooLong],
|
|
115
131
|
executionPlacementSessionsUnreadable: [...r.executionPlacementSessionsUnreadable],
|
|
132
|
+
localArchivesKeptStamped: [...r.localArchivesKeptStamped],
|
|
133
|
+
localArchivesUnreadable: [...r.localArchivesUnreadable],
|
|
116
134
|
};
|
|
117
135
|
}
|
|
118
136
|
function receiptSentence(r) {
|
|
@@ -381,7 +399,7 @@ export const ONE_TIME_MIGRATIONS = [
|
|
|
381
399
|
removal: "删 migrateOn 的 M23 步(`inheritPlacedSessionOwners`:placed ∧ 属主 NULL 的行按 session_id 键集分页单趟扫描 + 同一条语句连读根 / 父两行 + 按认领句回写属主)与 `PLACED_OWNER_SCAN_PAGE` / `placedOwnerScanSql` / `scannedPlacement` / `scannedFaces` / `scannedPlacedSources`(`isOrphanSessionOwner` 若再无别的读者一并删);" +
|
|
382
400
|
"**同窗同删的另一半**(认领:按律给升级前写下的无主子代行写属主 —— 停驻挂点对宿主无主行做的就是本条对那一行的单行步):`delegated-session-owner.ts` 的 `CLAIM_OWNERLESS_PLACED_SQL` / `claimOwnerlessParams` / `OwnerlessClaim` / " +
|
|
383
401
|
"`settleDelegatedOwner` 的认领一步(删后它只剩树比对与属主比对)/ `DelegationTreeStore.claimOwnerless`," +
|
|
384
|
-
"两只 SQL 店(`tidb-session-store.ts` / `pg-session-storage.ts`)的 `claimOwnerless`、`CachingSessionStore` 的转发、`OwnerAwareSessionStore.claimOwnerless`、`delegatedOwnerHostOf` 对它的「与 `placementOf` 同在或同缺」;" +
|
|
402
|
+
"两只 SQL 店(`tidb-session-store.ts` / `pg-session-storage.ts`)与 local 店(`local-session-store.ts` 的 `claimOwnerless` 字段与 `claimOwnerlessPlaced`)的 `claimOwnerless`、`CachingSessionStore` 的转发、`OwnerAwareSessionStore.claimOwnerless`、`delegatedOwnerHostOf` 对它的「与 `placementOf` 同在或同缺」;" +
|
|
385
403
|
"报告、日志行与 `NO_SQL_MIGRATIONS` 的 `placedSessionOwnersInherited` / `placedSessionOwnersOrphaned` / `placedSessionOwnersRemaining` 与 `placed_session_owners_orphaned` 那一行 warn;" +
|
|
386
404
|
"`test/one-time-migrations.test.ts` 的 M23 组与 `test/one-time-migrations-db-integration.test.ts` 的 M23 格。" +
|
|
387
405
|
"**不随本条删**:属主为 NULL 的 placed 行只对 fleet 调用方放行(`security.ts` 的 `ownerlessRowOpen` / `sessionOwnerCellOf` 与各门读 `placementOf` 的那一次)—— 那是常设的读面律",
|
|
@@ -531,6 +549,40 @@ export const ONE_TIME_MIGRATIONS = [
|
|
|
531
549
|
"跳过了带本条的版本直接升的库响亮拒启,出路 = 先在带本条的版本起服一次让切换走完,再升;缺执行放置列的库由列集对账缺列拒启(`config.schema_mismatch`,拒句给 ALTER),同一出路",
|
|
532
550
|
reportKeys: ["executionPlacementColumnsAdded", "deviceBindingsMoved", "deviceBindingsOrphaned", "deviceBindingTablesDropped", "executionPlacementsBackfilled", "askExecutionLanesBackfilled", "executionPlacementSessionsUnreadable"],
|
|
533
551
|
},
|
|
552
|
+
{
|
|
553
|
+
id: "M33",
|
|
554
|
+
introducedIn: "7.141.0",
|
|
555
|
+
releasedOn: "2026-10-30",
|
|
556
|
+
removableAfter: "2026-11-29",
|
|
557
|
+
removal: "删 `LocalSessionStore.migrateLocalArchives` 与它的私有助手 `anonymizeArchiveHeld` / `fillRowFacts`、`settleArchiveSnapshots` 里除最后一句常设臂 `assertNoArchiveSnapshots(dir)` 以外的一切(逐份消化的循环与 `settleArchiveSnapshot`)、" +
|
|
558
|
+
"`archiveSnapshotsSettled` 字段、`syncArchiveDirectory`、`rowFactsFilled` / `ArchivedRowFacts` / `archivedRowFactsOf` / `ARCHIVE_SNAPSHOT_RECORD` / `ArchiveSnapshotRecord` / `readArchiveSnapshotRecord` / `sameLog` / " +
|
|
559
|
+
"`ArchiveRewriteStep` / `LocalArchiveMigrationReading` / `errnoOf`、" +
|
|
560
|
+
"`archiveRewriteReadScope` / `noteReplayInArchiveRewriteRead` 与 `createLocalSessionRepo` 座里调它的那一腿、`SidecarMap.syncToDisk`(若再无别的调用方)与 `fsyncPaths`(同);" +
|
|
561
|
+
"`store-backend.ts` 的 `LocalBackend.runOneTimeMigrations` 里对 `migrateLocalArchives` 的调用与报告五键的那五行;本文件的 `LocalArchiveKeptReason` / `LocalArchiveKeptStamped` / `LocalArchiveUnreadable`、" +
|
|
562
|
+
"报告 / 收据 / `changedAnything` / `readingsSnapshot` / `readingFields` 里的 `localArchiveRowFactsBackfilled` / `localArchivesAnonymized` / `localArchivesKeptStamped` / `localArchivesUnreadable` / `localArchiveSnapshotsRecovered`、" +
|
|
563
|
+
"`local_archive_kept_stamped` / `local_archive_unreadable` 两行 warn、读数行 note 里的 M33 句与头注 M33 段;`test/local-archive-owner.test.ts` 里标题含 `P3` / `P4` / `P5` / `P6` / `F1` / `F2` / `F3` 的格与 `legacyRoot` / `writeArchive` / `boot` / `M33_ZERO` / `m33Of` 助手。" +
|
|
564
|
+
"**不随本条删**:行格的 `createdAt` / `forkedFrom` 两键(常设的数据形)、`LocalArchiveSnapshotsPresentError` / `assertNoArchiveSnapshots` / `LOCAL_ARCHIVE_SNAPSHOT_DIR` 与 `LocalBackend.ensureSchema` 里调它的那一句、" +
|
|
565
|
+
"`session-error-wire.ts` 的 `StampedSessionArchiveError` / `STAMPED_SESSION_ARCHIVE_SENTENCE` / `sessionErrorWireOf` 与本店两处带戳判(fork 的源、改日志推送的落点)、行上缺建档时刻的 F 类读法(`server.local-session-row.created-at-absent`)",
|
|
566
|
+
afterRemoval: "三只常设臂接住:① 数据根下的快照目录非空 ⇒ 拒启(`config.local_archive_snapshot_present`,点名文件与两条出路);② 跳过了带本条的版本直接升的数据根(或本条留着的存档),带属主戳的存档被 fork 与改日志的推送同一只具名拒(409 `conflict` + 固定句,零写 / 行格净零写)," +
|
|
567
|
+
"读 / 续跑 / 拉取照常 —— 出路 = 删掉会话后重推,或升级时先过一次带本条的版本并在窗内起服;③ 行上没有建档时刻的格(同一类数据根)⇒ 列表 / 会话视图 / 交出的元数据读纪元(F 类 tag 计数)",
|
|
568
|
+
reportKeys: ["localArchiveRowFactsBackfilled", "localArchivesAnonymized", "localArchivesKeptStamped", "localArchivesUnreadable", "localArchiveSnapshotsRecovered"],
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
id: "M34",
|
|
572
|
+
introducedIn: "7.142.0",
|
|
573
|
+
releasedOn: "2026-10-30",
|
|
574
|
+
removableAfter: "2026-11-29",
|
|
575
|
+
removal: "删 migrateStepsOn 的 M34 步(`splitApprovalAskCauseColumns`、`RETIRED_ASK_CAUSE_COLUMN`、`renameAskCauseColumnSql`)与本文件的 `askCauseColumnsChanged` / `askParkTriggersMoved` / `askJournalRecordsUpgraded`" +
|
|
576
|
+
"(报告 / 收据 / `changedAnything` / `readingFields` / `NO_SQL_MIGRATIONS` 与读数行 note 里的 M34 句、头注 M34 段);`approval-ask-store-file.ts` 的 v1 读侧半场 " +
|
|
577
|
+
"(`translateJournalV1Record`、`JOURNAL_V1_ENVELOPE`、`V1_ENDING_STATES` / `V1_TRIGGER_STATES`、`replayRecord` 里认 v1 的那两行与 `journalV1Records`)与 local 腿 `upgradeJournalEnvelope`、" +
|
|
578
|
+
"`store-backend.ts` 的 `LocalBackend.runOneTimeMigrations` 里报 `askJournalRecordsUpgraded` 的那一行;`test/approval-ask-store-db-integration.test.ts` 的 M34 组与 " +
|
|
579
|
+
"`test/approval-ask-cause-columns.test.ts` 里标题含 ⑤ 与 local 腿读数的格。**不随本条删**:两列与它们的列定义(`APPROVAL_ASK_ENDING_CAUSE_COLUMN` / `APPROVAL_ASK_PARK_TRIGGER_COLUMN`)、" +
|
|
580
|
+
"两只读口(`askRowEndingCause` / `askRowParkTrigger`)、信封号 2 与「认不出的信封号 ⇒ 拒启」那一臂(常设的数据形)",
|
|
581
|
+
afterRemoval: "两只常设臂接住:① SQL —— 删码同版把 `approval_ask.denied_reason` 加进退役 schema 判据(`schema-consistency.ts` 的跳版库探针,先于建表)⇒ 跳过了带本条的版本直接升的库响亮拒启," +
|
|
582
|
+
"出路 = 先在带本条的版本起服一次让迁移走完,再升(列册对账见幽灵列 / 缺列同样拒启,但它的拒句给的是加列,不是这一出路 —— 所以退役判据要在删码同版加上);" +
|
|
583
|
+
"② local —— 信封号 1 的日志记录走 File 问账店「认不出的信封号」拒启(`unknown envelope version`,点名文件与出路:用写下它的那一版起服一次,或移开文件)",
|
|
584
|
+
reportKeys: ["askCauseColumnsChanged", "askParkTriggersMoved", "askJournalRecordsUpgraded"],
|
|
585
|
+
},
|
|
534
586
|
];
|
|
535
587
|
export function migrationWindowOpen(window, today) {
|
|
536
588
|
return window.removableAfter === null || today <= window.removableAfter;
|
|
@@ -576,6 +628,8 @@ export const NO_SQL_MIGRATIONS = {
|
|
|
576
628
|
deviceBindingsMoved: 0,
|
|
577
629
|
deviceBindingsOrphaned: 0,
|
|
578
630
|
deviceBindingTablesDropped: 0,
|
|
631
|
+
askCauseColumnsChanged: 0,
|
|
632
|
+
askParkTriggersMoved: 0,
|
|
579
633
|
};
|
|
580
634
|
function mysqlDb(conn) {
|
|
581
635
|
return {
|
|
@@ -671,6 +725,7 @@ async function migrateStepsOn(db, dialect, receipts, input) {
|
|
|
671
725
|
: "UPDATE task_run SET error_code = $1 WHERE status = 'failed' AND error_code IS NULL AND (error = $2 OR error LIKE $3)", [RUN_HOLDER_DEATH_CODES.orphaned, RUN_ORPHANED_ERROR, `${RUN_ORPHANED_ERROR} (%`]);
|
|
672
726
|
await migrateShadowedRuleKey(db, dialect, receipts);
|
|
673
727
|
await migrateRetiredCardWords(db, dialect, receipts);
|
|
728
|
+
await splitApprovalAskCauseColumns(db, dialect, receipts);
|
|
674
729
|
await reshapeWorkflowParkIndex(db, dialect, receipts);
|
|
675
730
|
await migrateSessionRuleGrammar(db, dialect, receipts);
|
|
676
731
|
await repairParkedRows(db, dialect, receipts);
|
|
@@ -685,6 +740,28 @@ async function migrateStepsOn(db, dialect, receipts, input) {
|
|
|
685
740
|
await dropRejectedMailboxKeys(db, dialect, receipts);
|
|
686
741
|
await switchExecutionPlacement(db, dialect, receipts, input);
|
|
687
742
|
}
|
|
743
|
+
const RETIRED_ASK_CAUSE_COLUMN = "denied_reason";
|
|
744
|
+
function renameAskCauseColumnSql(dialect) {
|
|
745
|
+
return dialect === "mysql"
|
|
746
|
+
? `ALTER TABLE ${APPROVAL_ASK_TABLE} CHANGE COLUMN ${RETIRED_ASK_CAUSE_COLUMN} ${APPROVAL_ASK_ENDING_CAUSE_COLUMN.mysql}`
|
|
747
|
+
: `ALTER TABLE ${APPROVAL_ASK_TABLE} RENAME COLUMN ${RETIRED_ASK_CAUSE_COLUMN} TO ${APPROVAL_ASK_ENDING_CAUSE_COLUMN.name}`;
|
|
748
|
+
}
|
|
749
|
+
export async function splitApprovalAskCauseColumns(db, dialect, receipts) {
|
|
750
|
+
if (!(await tableExists(db, dialect, APPROVAL_ASK_TABLE)))
|
|
751
|
+
return;
|
|
752
|
+
const has = (column) => columnExists(db, dialect, APPROVAL_ASK_TABLE, column);
|
|
753
|
+
if (await has(RETIRED_ASK_CAUSE_COLUMN)) {
|
|
754
|
+
await execUntil(db, renameAskCauseColumnSql(dialect), async () => !(await has(RETIRED_ASK_CAUSE_COLUMN)) && (await has(APPROVAL_ASK_ENDING_CAUSE_COLUMN.name)));
|
|
755
|
+
receipts.askCauseColumnsChanged += 1;
|
|
756
|
+
}
|
|
757
|
+
if (!(await has(APPROVAL_ASK_PARK_TRIGGER_COLUMN.name))) {
|
|
758
|
+
await execUntil(db, `ALTER TABLE ${APPROVAL_ASK_TABLE} ADD COLUMN ${APPROVAL_ASK_PARK_TRIGGER_COLUMN[dialect]}`, () => has(APPROVAL_ASK_PARK_TRIGGER_COLUMN.name));
|
|
759
|
+
receipts.askCauseColumnsChanged += 1;
|
|
760
|
+
}
|
|
761
|
+
receipts.askParkTriggersMoved += await db.exec(`UPDATE ${APPROVAL_ASK_TABLE} SET ${APPROVAL_ASK_PARK_TRIGGER_COLUMN.name} = ${APPROVAL_ASK_ENDING_CAUSE_COLUMN.name} ` +
|
|
762
|
+
`WHERE state IN ('PARKING', 'PARKED') AND ${APPROVAL_ASK_PARK_TRIGGER_COLUMN.name} IS NULL AND ${APPROVAL_ASK_ENDING_CAUSE_COLUMN.name} IS NOT NULL`);
|
|
763
|
+
await db.exec(`UPDATE ${APPROVAL_ASK_TABLE} SET ${APPROVAL_ASK_ENDING_CAUSE_COLUMN.name} = NULL WHERE state IN ('PARKING', 'PARKED') AND ${APPROVAL_ASK_ENDING_CAUSE_COLUMN.name} IS NOT NULL`);
|
|
764
|
+
}
|
|
688
765
|
const RETIRED_DEVICE_BINDING_TABLE = "device_session";
|
|
689
766
|
const PARKED_DEVICE_BINDING_TABLE = "device_session_retired";
|
|
690
767
|
const BINDING_COLUMNS = "root_session_id, device_id, owner_tenant, owner_subject, bound_at, rev";
|
|
@@ -1602,6 +1679,14 @@ function readingFields(r) {
|
|
|
1602
1679
|
executionPlacementsBackfilled: r.executionPlacementsBackfilled,
|
|
1603
1680
|
askExecutionLanesBackfilled: r.askExecutionLanesBackfilled,
|
|
1604
1681
|
executionPlacementSessionsUnreadable: r.executionPlacementSessionsUnreadable.length,
|
|
1682
|
+
localArchiveRowFactsBackfilled: r.localArchiveRowFactsBackfilled,
|
|
1683
|
+
localArchivesAnonymized: r.localArchivesAnonymized,
|
|
1684
|
+
localArchivesKeptStamped: r.localArchivesKeptStamped.length,
|
|
1685
|
+
localArchivesUnreadable: r.localArchivesUnreadable.length,
|
|
1686
|
+
localArchiveSnapshotsRecovered: r.localArchiveSnapshotsRecovered,
|
|
1687
|
+
askCauseColumnsChanged: r.askCauseColumnsChanged,
|
|
1688
|
+
askParkTriggersMoved: r.askParkTriggersMoved,
|
|
1689
|
+
askJournalRecordsUpgraded: r.askJournalRecordsUpgraded,
|
|
1605
1690
|
};
|
|
1606
1691
|
}
|
|
1607
1692
|
export function logOneTimeMigrations(log, backend, report) {
|
|
@@ -1650,7 +1735,16 @@ export function logOneTimeMigrations(log, backend, report) {
|
|
|
1650
1735
|
"M32: session↔device bindings moved from the retired table device_session onto the root session rows (the table is first renamed device_session_retired, " +
|
|
1651
1736
|
"the eight execution placement columns are added to session_meta, every binding overwrites the device placement of its root session row — a binding whose " +
|
|
1652
1737
|
"root session row is gone is dropped and counted, named by a device_bindings_orphaned line — and the renamed table is dropped), and session rows that have " +
|
|
1653
|
-
"runs but no execution placement placed on the only declared lane; once the switch is complete this step does nothing
|
|
1738
|
+
"runs but no execution placement placed on the only declared lane; once the switch is complete this step does nothing; " +
|
|
1739
|
+
"M33 (local backend only): each local session's creation time and fork lineage were copied from its stored archive into its session-metadata cell, and archives " +
|
|
1740
|
+
"that still carried an importer's owner stamp were rewritten as anonymous with every entry kept as it was (a snapshot of the log is written before each rewrite " +
|
|
1741
|
+
"and removed after it; an interrupted rewrite is finished from the snapshot on the next boot); an archive whose log the import check refuses, whose re-import would " +
|
|
1742
|
+
"change its content, or whose read skipped unreadable records is left byte for byte as it was and named by a local_archive_kept_stamped line, and a session whose " +
|
|
1743
|
+
"archive header cannot be read is named by a local_archive_unreadable line; " +
|
|
1744
|
+
"M34: the approval ask table's single cause column denied_reason — the reason a row was moved to the delivery surface while it is PARKING or PARKED, " +
|
|
1745
|
+
"the reason it ended without a human answer while it is VOID or DENIED, overwritten by the second when a parked row was closed — renamed ending_cause, " +
|
|
1746
|
+
"a column park_trigger added, and the word on PARKING and PARKED rows moved into park_trigger; on the local backend the approval ask journal is rewritten " +
|
|
1747
|
+
"once with record envelope 2, its envelope-1 records read with the same meaning). Each step " +
|
|
1654
1748
|
"runs on every boot until its window closes (the release that introduced it + 30 days; the per-step date is in " +
|
|
1655
1749
|
"removableAfter, null while that release is not published yet) and is deleted in the first minor after that — start a " +
|
|
1656
1750
|
"version that still carries a step at least once before upgrading past its deletion.",
|
|
@@ -1658,6 +1752,28 @@ export function logOneTimeMigrations(log, backend, report) {
|
|
|
1658
1752
|
logReceiptRows(log, backend, report);
|
|
1659
1753
|
}
|
|
1660
1754
|
function logReceiptRows(log, backend, r) {
|
|
1755
|
+
for (const row of r.localArchivesKeptStamped) {
|
|
1756
|
+
log.warn("local_archive_kept_stamped", {
|
|
1757
|
+
backend,
|
|
1758
|
+
sessionId: row.sessionId,
|
|
1759
|
+
reason: row.reason,
|
|
1760
|
+
...(row.detail !== undefined ? { detail: row.detail } : {}),
|
|
1761
|
+
note: "this local session's stored archive still carries the owner stamp an earlier version wrote, and the one-time migration that rewrites such archives as anonymous left it byte for byte as it was " +
|
|
1762
|
+
"(reason invalid = the import check refuses its log; normalizes = re-importing would change its content; records_skipped = reading it skipped unreadable records, which a rewrite would erase). " +
|
|
1763
|
+
"Reading, resuming and pulling the session work as before; forking it is refused and a push that changes its log answers 409 conflict. Way out: delete the session and push it again " +
|
|
1764
|
+
"(a push onto an absent session creates it anew), or repair the archive under the data root's sessions directory. Named on every boot until then",
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
for (const row of r.localArchivesUnreadable) {
|
|
1768
|
+
log.warn("local_archive_unreadable", {
|
|
1769
|
+
backend,
|
|
1770
|
+
sessionId: row.sessionId,
|
|
1771
|
+
...(row.errno !== undefined ? { errno: row.errno } : {}),
|
|
1772
|
+
note: "this local session's stored archive cannot be read (its header, or the whole archive), so the one-time migration could neither copy its creation time into its session-metadata cell nor rewrite it; " +
|
|
1773
|
+
"nothing was written. Every request that needs the session keeps answering the archive's own fault until the archive under the data root's sessions directory is restored from a kept copy " +
|
|
1774
|
+
"(the next boot then migrates it) or the session is deleted. Named on every boot until then",
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1661
1777
|
if (r.deviceBindingsOrphaned > 0) {
|
|
1662
1778
|
log.warn("device_bindings_orphaned", {
|
|
1663
1779
|
backend,
|
package/dist/plugins/pg-pool.js
CHANGED
|
@@ -347,8 +347,9 @@ export const PG_SCHEMA_STATEMENTS = [
|
|
|
347
347
|
enqueued_at_ms BIGINT NOT NULL,
|
|
348
348
|
-- 1.109 delivery envelope. kind NULL = a LEGACY \`workflow_complete\` row (the shape that predates the
|
|
349
349
|
-- envelope); readers must keep treating NULL as that kind, it is not "unknown". payload = the kind's JSON
|
|
350
|
-
-- extras: task_notification: task_type / result / …; workflow_complete: at most {"completionId": …}
|
|
351
|
-
-- engine's own correlation id, verbatim;
|
|
350
|
+
-- extras: task_notification: task_type / result / …; workflow_complete: at most {"completionId": …, "diagnostics": …}
|
|
351
|
+
-- (the engine's own correlation id, verbatim; the engine's diagnostic teaching text, redacted + bounded at enqueue;
|
|
352
|
+
-- each key absent when the engine minted none, NULL when neither).
|
|
352
353
|
kind VARCHAR(24) COLLATE "C",
|
|
353
354
|
payload TEXT COLLATE "C",
|
|
354
355
|
PRIMARY KEY (session_id, run_id),
|
|
@@ -67,6 +67,8 @@ export declare class PgSessionStore implements SessionStore {
|
|
|
67
67
|
readonly durability: "durable";
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
|
+
/** 会话耐久声明(TiDB 孪生同格,同一只常量 {@link SESSION_DURABILITY};理由见 `session-placement.ts` 的常量注)。 */
|
|
71
|
+
readonly durability: "durable";
|
|
70
72
|
/** In-flight acquisitions keyed by id, so concurrent acquire(sameId) in one process share one. */
|
|
71
73
|
private readonly pending;
|
|
72
74
|
/** 委派子代孤行那一行 warn 的去处(TiDB 孪生同格)。 */
|
|
@@ -8,7 +8,7 @@ import { scanEpochAnchor } from "./session-epoch-anchor.js";
|
|
|
8
8
|
import { jsonColumnText } from "./sql-json-column.js";
|
|
9
9
|
import { pgSafeJsonStringify } from "./pg-safe-json.js";
|
|
10
10
|
import { toIso } from "./sql-row-helpers.js";
|
|
11
|
-
import { placementCapabilityOf, LIST_PLACED_BATCH, PLACEMENT_SELECT_COLUMNS, placedRowFromRow, placementFromRow, placementInsertValues,
|
|
11
|
+
import { placementCapabilityOf, LIST_PLACED_BATCH, PLACEMENT_SELECT_COLUMNS, placedRowFromRow, placementFromRow, placementInsertValues, SESSION_DURABILITY, SESSION_PLACEMENTS, } from "./session-placement.js";
|
|
12
12
|
import { contentForkRelation, fastForwardSharedContentDiverged } from "../session-sync-content.js";
|
|
13
13
|
import { CLAIM_OWNERLESS_PLACED_SQL, claimOwnerlessParams, createPlacedSessionRow } from "../delegated-session-owner.js";
|
|
14
14
|
import { createLogger } from "../observability/logger.js";
|
|
@@ -188,7 +188,8 @@ export class PgSessionStorage extends BaseSessionStorage {
|
|
|
188
188
|
export class PgSessionStore {
|
|
189
189
|
pool;
|
|
190
190
|
retention;
|
|
191
|
-
placements =
|
|
191
|
+
placements = SESSION_PLACEMENTS;
|
|
192
|
+
durability = SESSION_DURABILITY;
|
|
192
193
|
pending = new Map();
|
|
193
194
|
log;
|
|
194
195
|
executionPlacement;
|
|
@@ -20,8 +20,11 @@
|
|
|
20
20
|
* iterator MAY throw `RemoteExecutionError` mid-stream before an `exit` chunk (seam contract, OutputChunk).
|
|
21
21
|
*/
|
|
22
22
|
import { Sandbox, type SandboxOpts, type SandboxConnectOpts } from "e2b";
|
|
23
|
-
import { FileError, ExecutionError, RemoteExecutionError, type ExecutionEnv, type RemoteExecutionEnv, type WorkspaceHandle, type FileInfo, type Result, type SymlinkChain, type OutputChunk, type ExecStreamOptions, type RemoteConnectConfig, type SnapshotId, type SessionToken, type ExecutionEnvFactory, type VmLifecycleOptions, type BackgroundShellCapability, type BackgroundShellId, type BackgroundShellError, type BackgroundSpawnOptions, type BackgroundPoll } from "@sema-agent/core";
|
|
23
|
+
import { FileError, ExecutionError, RemoteExecutionError, type ExecutionEnv, type RemoteExecutionEnv, type WorkspaceHandle, type FileInfo, type Result, type SymlinkChain, type OutputChunk, type ExecStreamOptions, type RemoteConnectConfig, type SnapshotId, type SessionToken, type ExecutionEnvFactory, type VmLifecycleOptions, type BackgroundShellCapability, type BackgroundShellId, type BackgroundShellError, type BackgroundSpawnOptions, type BackgroundPoll, type ExecutionEnvCapabilities } from "@sema-agent/core";
|
|
24
|
+
import { type SandboxReadFloorKnob } from "../execution-lane-caps.js";
|
|
25
|
+
import { type SandboxReadFloor } from "./sandbox-read-floor.js";
|
|
24
26
|
import { type LaneHomeConfig } from "../lane-home-probe.js";
|
|
27
|
+
import type { WorkspaceFill, WorkspaceFillOf } from "./workspace-fill.js";
|
|
25
28
|
/** Options accepted by `ExecutionEnv.exec` (core does not re-export the type; derive it from the seam). */
|
|
26
29
|
type ExecOpts = Parameters<ExecutionEnv["exec"]>[1];
|
|
27
30
|
/** Minimal optional observability hooks (kept structural so the adapter stays standalone-testable). */
|
|
@@ -71,6 +74,10 @@ export interface RemoteContainerEnvConfig extends RemoteEnvObservers, LaneHomeCo
|
|
|
71
74
|
* create/connect) — wider than {@link rpcTimeoutMs} so a legit multi-minute transfer is not killed. Default
|
|
72
75
|
* {@link DEFAULT_DATA_TIMEOUT_MS}. */
|
|
73
76
|
dataTimeoutMs?: number;
|
|
77
|
+
/** `SANDBOX_READ_FLOOR`(keep | off;缺席 ⇒ keep):本沙箱守不守读拒表的字节地板 = 读地板模块服务本车道 ∧ 本键不是 off(`sandbox-read-floor.ts`)。 */
|
|
78
|
+
sandboxReadFloor?: SandboxReadFloorKnob;
|
|
79
|
+
/** 恢复点的填充座(`workspace-fill.ts`;工厂按 run 装配):沙箱新建 / 恢复之后、交给本环境之前,经本适配器已连上的通道往工作区里放内容。缺席 ⇒ 不放。 */
|
|
80
|
+
workspaceFill?: WorkspaceFill;
|
|
74
81
|
}
|
|
75
82
|
/** Minimal slice of the E2B `Sandbox` static API the adapter uses — injectable so tests pass a fake. */
|
|
76
83
|
export interface SandboxApi {
|
|
@@ -80,6 +87,8 @@ export interface SandboxApi {
|
|
|
80
87
|
/** Inject the E2B SDK for tests (a fake `Sandbox`). Defaults to the real SDK. */
|
|
81
88
|
export interface RemoteContainerEnvDeps {
|
|
82
89
|
sandboxApi?: SandboxApi;
|
|
90
|
+
/** 这只环境手里的读地板模块(缺席 ⇒ `createSandboxReadFloor` 按旋钮选;钉注入守地板的模块)。能力块的 `keepsReadFloor` 读它的状态。 */
|
|
91
|
+
readFloor?: SandboxReadFloor;
|
|
83
92
|
}
|
|
84
93
|
/**
|
|
85
94
|
* E2B-backed remote `ExecutionEnv`. **Lazy by default (v1b):** the VM is provisioned on the
|
|
@@ -118,9 +127,12 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
118
127
|
private destroyed;
|
|
119
128
|
/** 家目录的座(主张在场 ⇒ 每只沙箱对证 · 否则建沙箱那一拍实测 · 实测缺席 ⇒ 缺席 + 一行 warn)。 */
|
|
120
129
|
private readonly homeSeat;
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
/** 这只环境的拒 —— 记一次、此后每次连接 / 恢复原样回它(同一模板同一个答案:不再建沙箱、不再问)。两个写者:家目录(沙箱答了而与主张不一致,或答的不是绝对路径)
|
|
131
|
+
* 与恢复点的填充(换一台沙箱也是同一个答的拒:种子不是项目包、摘要不符、镜像没有 `tar`、镜像预置撞名 —— `FillOutcome.standing`)。 */
|
|
132
|
+
private connectRefusal?;
|
|
133
|
+
/** In-flight connect/resume, memoized so concurrent lazy first-use OR resume provisions exactly one VM (no double-bill). `target` = the snapshot a resume
|
|
134
|
+
* restores (`undefined` = a fresh sandbox): {@link resumeVM} shares only a resume of the SAME snapshot — a connect for anything else is not the
|
|
135
|
+
* workspace it is asked to restore (it waits that one out, then releases the sandbox it left). */
|
|
124
136
|
private connecting?;
|
|
125
137
|
/** Count of exec/execStream calls in flight — `suspendVM` refuses while > 0 (council #4: never snapshot a running command). */
|
|
126
138
|
private activeCommands;
|
|
@@ -130,8 +142,22 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
130
142
|
* SAME env instance skips the reconnect and every later fs/exec runs against the dead VM. */
|
|
131
143
|
private paused;
|
|
132
144
|
constructor(config: RemoteContainerEnvConfig, deps?: RemoteContainerEnvDeps);
|
|
133
|
-
/** 能力块的唯一作者 = `capabilitiesFor`(`execution-lane-caps.ts`;逐键表态与理由在那里,本类零能力字面量)
|
|
134
|
-
readonly capabilities:
|
|
145
|
+
/** 能力块的唯一作者 = `capabilitiesFor`(`execution-lane-caps.ts`;逐键表态与理由在那里,本类零能力字面量)。读地板旋钮是它的输入,{@link floor} 由同一只判据、同一个旋钮值选出。 */
|
|
146
|
+
readonly capabilities: ExecutionEnvCapabilities;
|
|
147
|
+
/** 读拒表字节地板模块:沙箱里每一次 `commands.run` 起动都先经它的 `wrap`({@link startIn} → {@link runIn},唯一接缝)。 */
|
|
148
|
+
private readonly floor;
|
|
149
|
+
/**
|
|
150
|
+
* **唯一起动接缝(上半)**:一次起动 → 地板模块 `wrap` → e2b 编码(身份 + 命令行;不守地板 ⇒ 命令与每命令 env 原样,与改前逐字同)。
|
|
151
|
+
* 本适配器对地板零判断;模块拒 ⇒ `spawn_error`,命令从未起。
|
|
152
|
+
*/
|
|
153
|
+
private startIn;
|
|
154
|
+
/** **唯一起动接缝(下半)**:本文件里每一次 `commands.run`(中继除外:那是地板模块自己的进程)都经这里,身份与 env 只取起动编码。 */
|
|
155
|
+
private runIn;
|
|
156
|
+
/** 地板模块的三件原语。引导命令经 {@link startIn}(起动形 `bootstrap`:只在附着中合法);放置 = root 建目录 → `files.write`(root)写暂存件 →
|
|
157
|
+
* root `chmod 0755 && mv -f`;中继 = 以模块给的身份起一只长连后台命令(stdin 开着:`sendStdin` 写答,stdout 回调读问)。 */
|
|
158
|
+
private floorTransport;
|
|
159
|
+
/** 收据句柄。还没连上(懒环境:续跑腿的引擎在 `resumeVM` **之前**先取它比车道)⇒ 未连接形 `{ sandboxId: "(unconnected)", provider, mountPath }`(与 k8s 车道同形),
|
|
160
|
+
* 不抛 —— 抛了,续跑腿在恢复之前就失败。 */
|
|
135
161
|
workspaceHandle(): WorkspaceHandle;
|
|
136
162
|
/**
|
|
137
163
|
* Public host for a port inside the sandbox (E2B reverse proxy → `<port>-<id>.e2b.app`). The LSP sidecar
|
|
@@ -179,6 +205,11 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
179
205
|
ok: false;
|
|
180
206
|
error: RemoteExecutionError;
|
|
181
207
|
}>;
|
|
208
|
+
/** The one walk of a resume ({@link resumeVM} memoizes it). */
|
|
209
|
+
private resumeWalk;
|
|
210
|
+
/** Kill the fresh sandbox this env holds (minted before a restore point that restores another): no second billable VM, no answer from the wrong workspace.
|
|
211
|
+
* The connect memo is the calling resume's own ({@link resumeVM}) — left as it is. */
|
|
212
|
+
private releaseMinted;
|
|
182
213
|
private doResumeVM;
|
|
183
214
|
/** Cross-replica re-attach to a still-running VM = v2 ([ref] council #15: v1.5 always snapshots→resumeVM). */
|
|
184
215
|
reconnect(_sessionToken: SessionToken): Promise<{
|
|
@@ -209,6 +240,10 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
209
240
|
* 上界 = 控制面 RPC 的墙钟(`rpcTimeoutMs`:问一个环境变量,不是跑用户命令)。
|
|
210
241
|
*/
|
|
211
242
|
private homeVerdict;
|
|
243
|
+
/** 恢复点的填充:有座 ⇒ 经这只沙箱的通道({@link fillChannel})放(`origin` = 新建的沙箱 / 恢复出来的沙箱);没有 ⇒ 什么都不放。 */
|
|
244
|
+
private fillAt;
|
|
245
|
+
/** 恢复点手里的通道:固定命令经唯一起动接缝(起动形 `adapter`,与引擎命令同一执行用户)、写 = `files.write`(与文件面同一个缺省用户);两件都受数据墙钟。 */
|
|
246
|
+
private fillChannel;
|
|
212
247
|
/** BL-31 — (re)start the periodic sandbox-lifetime extension. `setTimeout(timeoutMs)` resets the auto-kill window
|
|
213
248
|
* from now; we re-arm at ~80% of the (clamped, ≤1h) window so a long-held sandbox never expires mid-run. A no-op
|
|
214
249
|
* when paused/destroyed; `unref`'d so it never keeps the process alive; cleared on destroy. */
|
|
@@ -224,6 +259,9 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
224
259
|
shellId: string;
|
|
225
260
|
};
|
|
226
261
|
}, ExecutionError>>;
|
|
262
|
+
/** 适配器自己的固定命令(文件面助手:readlink / realpath / rm / mktemp / 暂存写的提交)—— 与 {@link exec} 同一条路,起动形 `adapter`。 */
|
|
263
|
+
private execInternal;
|
|
264
|
+
private execAs;
|
|
227
265
|
execStream(command: string, options?: ExecStreamOptions): AsyncIterable<OutputChunk>;
|
|
228
266
|
readonly backgroundCapabilities: {
|
|
229
267
|
readonly supported: true;
|
|
@@ -359,6 +397,8 @@ export declare class RemoteContainerExecutionEnv implements RemoteExecutionEnv,
|
|
|
359
397
|
* so a task that never touches the hand (e.g. a leader that only plans) pays zero VM cost. The Runner owns the
|
|
360
398
|
* lifetime and calls `destroy()` on task end (via `hasDestroy`); a never-used env's destroy is a no-op.
|
|
361
399
|
*/
|
|
362
|
-
export declare function e2bExecutionEnvFactory(config: RemoteContainerEnvConfig,
|
|
400
|
+
export declare function e2bExecutionEnvFactory(config: Omit<RemoteContainerEnvConfig, "workspaceFill"> & {
|
|
401
|
+
readonly workspaceFillOf?: WorkspaceFillOf;
|
|
402
|
+
}, deps?: RemoteContainerEnvDeps): ExecutionEnvFactory;
|
|
363
403
|
export {};
|
|
364
404
|
//# sourceMappingURL=remote-env-e2b.d.ts.map
|