@sema-agent/server 7.136.0 → 7.137.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 +173 -0
- package/USAGE.md +84 -16
- package/deploy/sema-up/README.md +14 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +7 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +7 -1
- package/dist/approval-content-kind.d.ts +6 -0
- package/dist/approval-content-kind.js +7 -0
- package/dist/approval-gate-currency.d.ts +48 -6
- package/dist/approval-gate-currency.js +16 -9
- package/dist/approval-hmac.d.ts +13 -1
- package/dist/approval-hmac.js +1 -1
- package/dist/approval.js +3 -3
- package/dist/auth-bridge.js +2 -2
- package/dist/boot/execution-env.d.ts +24 -1
- package/dist/boot/execution-env.js +69 -6
- package/dist/boot/reapers.d.ts +3 -0
- package/dist/boot/reapers.js +15 -1
- package/dist/boot/resolve-spec.d.ts +4 -0
- package/dist/boot/resolve-spec.js +16 -17
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +3 -1
- package/dist/boot/stage-05-execution-env.js +11 -2
- package/dist/boot/stage-06-runners.d.ts +3 -1
- package/dist/boot/stage-06-runners.js +5 -1
- package/dist/boot/stage-07-capability-layer.d.ts +4 -1
- package/dist/boot/stage-07-capability-layer.js +1 -1
- package/dist/boot/stage-08-reapers.d.ts +4 -1
- package/dist/boot/stage-08-reapers.js +2 -1
- package/dist/boot/stage-09-leader.d.ts +4 -1
- package/dist/boot/stage-10-http-server.d.ts +4 -1
- package/dist/boot/stage-10-http-server.js +3 -2
- package/dist/boot/stores.d.ts +1 -1
- package/dist/broker/broker.d.ts +89 -0
- package/dist/broker/broker.js +287 -0
- package/dist/broker/constants.d.ts +39 -0
- package/dist/broker/constants.js +15 -0
- package/dist/broker/http1.d.ts +111 -0
- package/dist/broker/http1.js +256 -0
- package/dist/broker/lease-book.d.ts +87 -0
- package/dist/broker/lease-book.js +142 -0
- package/dist/broker/lease-file.d.ts +60 -0
- package/dist/broker/lease-file.js +127 -0
- package/dist/broker/main.d.ts +2 -0
- package/dist/broker/main.js +20 -0
- package/dist/capabilities/composite-members.d.ts +2 -1
- package/dist/capabilities/composite-members.js +2 -1
- package/dist/capabilities/engine-capabilities.js +1 -0
- package/dist/capabilities/scenarios.d.ts +23 -8
- package/dist/capabilities/scenarios.js +13 -8
- package/dist/capabilities/skills.d.ts +28 -5
- package/dist/capabilities/skills.js +8 -0
- package/dist/center-credential-renewer.js +5 -1
- package/dist/checkpoint-ctx-seal-m28.d.ts +3 -10
- package/dist/checkpoint-ctx-seal-m28.js +1 -1
- package/dist/checkpoint-identity.d.ts +3 -3
- package/dist/config-catalog.js +9 -6
- package/dist/config-types.d.ts +9 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +34 -8
- package/dist/deployment-governance.d.ts +2 -2
- package/dist/deployment-governance.js +7 -9
- package/dist/device-ws-protocol.d.ts +1 -0
- package/dist/device-ws-protocol.js +2 -1
- package/dist/file-history-disclosure.d.ts +4 -2
- package/dist/file-history-disclosure.js +2 -0
- package/dist/hooks/classic-stations.d.ts +11 -54
- package/dist/http/admission.js +10 -7
- package/dist/http/approval-sweeps.js +4 -3
- package/dist/http/caller-trust.d.ts +2 -1
- package/dist/http/caller-trust.js +1 -3
- package/dist/http/checkpoint-ctx.d.ts +48 -7
- package/dist/http/checkpoint-ctx.js +40 -0
- package/dist/http/dispatch.js +15 -10
- package/dist/http/durable-run-leg.d.ts +5 -1
- package/dist/http/durable-run-leg.js +1 -1
- package/dist/http/health-self-report.d.ts +2 -2
- package/dist/http/mcp-remote-text.d.ts +5 -0
- package/dist/http/mcp-remote-text.js +7 -0
- package/dist/http/principal-gate.d.ts +15 -10
- package/dist/http/principal-gate.js +48 -9
- package/dist/http/resume-legs.d.ts +2 -20
- package/dist/http/resume-legs.js +52 -38
- package/dist/http/route-ctx.d.ts +8 -2
- package/dist/http/routes/approvals-assistant.js +18 -4
- package/dist/http/routes/capabilities.js +11 -1
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +5 -7
- package/dist/http/routes/runs.js +2 -1
- package/dist/http/routes/session-sync.js +42 -6
- package/dist/http/routes/sessions.js +2 -1
- package/dist/http/routes/tasks.js +8 -6
- package/dist/http/server.d.ts +4 -0
- package/dist/http/stored-body-replay.d.ts +3 -3
- package/dist/http/stored-body-replay.js +6 -1
- package/dist/http/wire-types.d.ts +52 -27
- package/dist/identity-source.d.ts +65 -0
- package/dist/identity-source.js +45 -0
- package/dist/memory-store-refusal.d.ts +3 -3
- package/dist/model-entry-refusal.d.ts +2 -0
- package/dist/model-entry-refusal.js +11 -0
- package/dist/model-select.d.ts +6 -17
- package/dist/model-select.js +0 -3
- package/dist/namespaced-rule-name.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +13 -1
- package/dist/observability/fail-open.js +13 -1
- package/dist/observability/metrics.js +1 -1
- package/dist/observability/run-terminal.js +1 -0
- package/dist/operator-ask.d.ts +2 -2
- package/dist/org-delivery-gate.js +1 -1
- package/dist/org-memory-admission.d.ts +2 -2
- package/dist/org-memory-admission.js +39 -2
- package/dist/parked-decide.js +3 -2
- package/dist/peer-directory.js +2 -0
- package/dist/permission-rule-list.d.ts +2 -2
- package/dist/plugins/checkpoint-store-sql.d.ts +19 -9
- package/dist/plugins/checkpoint-store-sql.js +6 -6
- package/dist/plugins/file-history-store-sql.js +7 -14
- package/dist/plugins/file-run-store.js +8 -2
- package/dist/plugins/k8s-exec-protocol.d.ts +69 -13
- package/dist/plugins/k8s-exec-protocol.js +116 -28
- package/dist/plugins/k8s-pod-delete-failure.d.ts +25 -0
- package/dist/plugins/k8s-pod-delete-failure.js +17 -0
- package/dist/plugins/k8s-pod-reaper.d.ts +112 -0
- package/dist/plugins/k8s-pod-reaper.js +122 -0
- package/dist/plugins/local-checkpoint-store.d.ts +3 -6
- package/dist/plugins/local-checkpoint-store.js +3 -3
- package/dist/plugins/memory-run-store.js +2 -0
- package/dist/plugins/one-time-migrations.d.ts +28 -9
- package/dist/plugins/one-time-migrations.js +48 -5
- package/dist/plugins/permission-rule-store-file.js +2 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +17 -17
- package/dist/plugins/permission-rule-store-sql.js +16 -17
- package/dist/plugins/pg-pool.js +4 -0
- package/dist/plugins/pg-session-storage.js +2 -2
- package/dist/plugins/remote-env-adb.d.ts +3 -0
- package/dist/plugins/remote-env-adb.js +1 -0
- package/dist/plugins/remote-env-device.d.ts +3 -0
- package/dist/plugins/remote-env-device.js +4 -0
- package/dist/plugins/remote-env-e2b.d.ts +3 -0
- package/dist/plugins/remote-env-e2b.js +1 -0
- package/dist/plugins/remote-env-file-error.d.ts +8 -1
- package/dist/plugins/remote-env-file-error.js +7 -1
- package/dist/plugins/remote-env-host.d.ts +7 -1
- package/dist/plugins/remote-env-host.js +7 -1
- package/dist/plugins/remote-env-k8s.d.ts +137 -10
- package/dist/plugins/remote-env-k8s.js +276 -14
- package/dist/plugins/remote-env-local-docker.d.ts +3 -0
- package/dist/plugins/remote-env-local-docker.js +1 -0
- package/dist/plugins/remote-env-ssh.d.ts +3 -0
- package/dist/plugins/remote-env-ssh.js +1 -0
- package/dist/plugins/run-store-sql.js +10 -4
- package/dist/plugins/session-ownership.d.ts +17 -3
- package/dist/plugins/session-ownership.js +19 -5
- package/dist/plugins/sql-errors.d.ts +23 -2
- package/dist/plugins/sql-errors.js +15 -0
- package/dist/plugins/store-contracts.d.ts +10 -1
- package/dist/plugins/store-fault.d.ts +2 -2
- package/dist/plugins/store-fault.js +4 -2
- package/dist/plugins/tidb-pool.js +7 -0
- package/dist/plugins/tidb-session-store.js +2 -2
- package/dist/request-key-closure.js +1 -1
- package/dist/request-value-closure.d.ts +31 -2
- package/dist/request-value-closure.js +7 -1
- package/dist/rule-entry-list.d.ts +3 -2
- package/dist/rule-entry-list.js +2 -2
- package/dist/rules-consent.js +7 -4
- package/dist/run-local.d.ts +2 -2
- package/dist/runs.js +2 -1
- package/dist/runtime-governance.d.ts +5 -5
- package/dist/sandbox-git-lease.d.ts +49 -0
- package/dist/sandbox-git-lease.js +60 -0
- package/dist/sandbox-git-plane.d.ts +84 -0
- package/dist/sandbox-git-plane.js +105 -0
- package/dist/security.d.ts +16 -4
- package/dist/security.js +8 -3
- package/dist/server-secret-env.d.ts +6 -0
- package/dist/server-secret-env.js +14 -0
- package/dist/session-error-wire.d.ts +14 -6
- package/dist/session-error-wire.js +2 -1
- package/dist/session-policy-wire.d.ts +1 -1
- package/dist/session-policy-wire.js +2 -2
- package/dist/session-sync.d.ts +1 -1
- package/dist/spec-fields.d.ts +43 -13
- package/dist/spec-fields.js +33 -12
- package/dist/stored-request-prompt-profile-m30.d.ts +49 -0
- package/dist/stored-request-prompt-profile-m30.js +25 -0
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-settings.d.ts +2 -2
- package/dist/tool-approval.d.ts +12 -2
- package/dist/tool-approval.js +8 -3
- package/dist/tool-rule-names.d.ts +5 -0
- package/dist/trace/core-keyset-guard.d.ts +4 -4
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +2 -0
- package/dist/trace/exit-seat.js +2 -2
- package/dist/trace/ledger-sink.d.ts +4 -5
- package/dist/trace/ledger-sink.js +3 -7
- package/dist/trace/project.d.ts +37 -3
- package/dist/trace/project.js +20 -6
- package/dist/trace/redact.d.ts +18 -6
- package/dist/trace/redact.js +118 -53
- package/dist/trace/self-minted-wire.d.ts +377 -3
- package/dist/trace/self-minted-wire.js +122 -0
- package/dist/trace/wire-projection-faces.d.ts +5 -3
- package/dist/trace/wire-projection-faces.js +7 -3
- package/dist/web-admin-client/apply-effective.js +0 -1
- package/dist/web-admin-client/center-request.d.ts +20 -2
- package/dist/web-admin-client/center-request.js +40 -5
- package/dist/web-admin-client/http-client.js +6 -6
- package/dist/web-admin-client/types.d.ts +5 -5
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +11 -5
- package/package.json +2 -2
- package/wire-changes/server@7.137.0.json +825 -0
|
@@ -110,9 +110,11 @@ export interface K8sEnvConfig extends LaneHomeConfig {
|
|
|
110
110
|
cacheMisses?: CacheMissMemory;
|
|
111
111
|
/** Operator log seat (the e2b adapter's shape): `workspace_snapshot_failed` / `workspace_snapshot_prune_failed` /
|
|
112
112
|
* `workspace_space_unavailable` / `workspace_space_unreadable_occupant` / `workspace_commit_abandoned` / `workspace_latest_dangling` /
|
|
113
|
-
* `workspace_restore_failed` / `workspace_snapshot_bucket_missing` / `workspace_cache_fresh` / `workspace_cache_unavailable
|
|
113
|
+
* `workspace_restore_failed` / `workspace_snapshot_bucket_missing` / `workspace_cache_fresh` / `workspace_cache_unavailable`, and — at `error` level, on a seat
|
|
114
|
+
* that has one (the deployment's logger does; the seat itself is optional, and the counter behind the line does not depend on it) — `sandbox_pod_delete_failed`. */
|
|
114
115
|
logger?: {
|
|
115
116
|
warn(event: string, fields?: Record<string, unknown>): void;
|
|
117
|
+
error?(event: string, fields?: Record<string, unknown>): void;
|
|
116
118
|
};
|
|
117
119
|
/** Run-end outcome seat — called once per `destroy()` that attempted a space snapshot (the factory's caller binds it
|
|
118
120
|
* to the run, so the run's terminal frame can carry `workspaceSnapshot: "failed"`). */
|
|
@@ -130,13 +132,39 @@ export interface K8sEnvConfig extends LaneHomeConfig {
|
|
|
130
132
|
podSpecPatch?: PodSpecPatch;
|
|
131
133
|
/** RFC B5 (sema-internal server/docs/design/ENV-SELECT-AND-REGION-SOURCE.md 抽象点②): operator-trusted env injected into the
|
|
132
134
|
* sandbox container (e.g. `SEMA_PKG_SOURCE=cn|global` — the runtime package-source selector the image's
|
|
133
|
-
* pkg-source.sh hook materializes at start). Deployment config, NEVER task-controlled.
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* never a command string, the workspace or a snapshot. Absent = the pod is byte-identical to today. */
|
|
135
|
+
* pkg-source.sh hook materializes at start). Deployment config, NEVER task-controlled. The pod's NON-SECRET env seat: the region
|
|
136
|
+
* package-source set (and the cache env layered under it) — values that are no secret go into `containers[0].env[]` as `{ name, value }`.
|
|
137
|
+
* Never a command string, the workspace or a snapshot. Absent = no such entries. */
|
|
137
138
|
podEnv?: Record<string, string>;
|
|
139
|
+
/** The pod's SECRET env seat: the deployer-named forwarding (`K8S_SANDBOX_ENV` keys, original values; disjoint from {@link podEnv} — the boot
|
|
140
|
+
* assembly drops a collided name from the non-secret seat, explicit wins; a name in both is read here). The values reach the agent container
|
|
141
|
+
* ONLY through this pod's own Secret: the pod spec carries `valueFrom.secretKeyRef` and no value; the Secret is created after the pod, owned by
|
|
142
|
+
* it (`ownerReferences`, `immutable`) — a Secret that cannot be created ⇒ the pod is deleted and the connect refused, never a plaintext fallback.
|
|
143
|
+
* Absent / empty ⇒ no Secret, the pod as without it. */
|
|
144
|
+
podSecretEnv?: Record<string, string>;
|
|
145
|
+
/** The server run that owns this env — the TOP-LEVEL run's id (its task id), handed in by the per-run binding (`boot/execution-env.ts`), which
|
|
146
|
+
* hands none to a delegated child, a run the service starts for itself, or a run without a task id. Carried as the pod label `sema.io/run`
|
|
147
|
+
* (the reaper's key: a pod whose run is over is removed); a value that is no label value is not carried. Absent ⇒ the pod names no run. */
|
|
148
|
+
runId?: string;
|
|
149
|
+
/**
|
|
150
|
+
* The member git-credential broker seat — present ⇔ the per-run binding found the plane on and this run a member's (`sso`) run
|
|
151
|
+
* (`sandbox-git-plane.ts` `sandboxBrokerSeatOf`). The pod then carries the broker container (`containers[1]`: the fixed program of
|
|
152
|
+
* `broker/constants.ts`, image = `image`, the securityContext written key by key, an exec readiness probe), its lease volume (a SECOND
|
|
153
|
+
* per-pod Secret, `sema.io/sandbox-lease` — mutable, owned by the pod, only `broker.json`; created after the pod holding a placeholder lease
|
|
154
|
+
* in which every entry is withdrawn), `shareProcessNamespace: false`, and on the agent container one `GIT_CONFIG_*` insteadOf route per
|
|
155
|
+
* origin (`origins` = the pod's origin table, in order — the same table every lease write is stamped from). The connect waits for the
|
|
156
|
+
* broker container to be ready; any failure on that path deletes the pod and refuses the connect. A deployment patch that could reach
|
|
157
|
+
* the broker refuses the connect before any pod is created. Absent ⇒ the pod as without it (byte-identical).
|
|
158
|
+
*/
|
|
159
|
+
sandboxBroker?: {
|
|
160
|
+
readonly image: string;
|
|
161
|
+
readonly origins: readonly string[];
|
|
162
|
+
};
|
|
138
163
|
}
|
|
164
|
+
import { type SandboxSecretSeatKind, type SandboxSecretVerb } from "./k8s-exec-protocol.js";
|
|
139
165
|
export { type PodSpecPatch, applyPodSpecPatch } from "./k8s-exec-protocol.js";
|
|
166
|
+
import { type SandboxPodApi, type SandboxPodListing } from "./k8s-pod-reaper.js";
|
|
167
|
+
import { type SandboxLeaseEntryInput } from "../sandbox-git-lease.js";
|
|
140
168
|
type ConnectResult = {
|
|
141
169
|
ok: true;
|
|
142
170
|
value: WorkspaceHandle;
|
|
@@ -154,11 +182,14 @@ export interface ExecSocket {
|
|
|
154
182
|
* Test seam ([ref] §9.3 fault-injection): inject the REST `request` and/or the exec-socket factory, so pod
|
|
155
183
|
* lifecycle, retry policy, channel framing and liveness are deterministically testable without a cluster.
|
|
156
184
|
*/
|
|
185
|
+
/** One control-plane request's options: its wall-clock, its abort, and the body's media type (default `application/json`; a merge-patch says so). */
|
|
186
|
+
export interface K8sRequestOptions {
|
|
187
|
+
timeoutMs?: number;
|
|
188
|
+
signal?: AbortSignal;
|
|
189
|
+
contentType?: string;
|
|
190
|
+
}
|
|
157
191
|
export interface K8sEnvDeps {
|
|
158
|
-
request?: (method: string, apiPath: string, body?: unknown, opts?: {
|
|
159
|
-
timeoutMs?: number;
|
|
160
|
-
signal?: AbortSignal;
|
|
161
|
-
}) => Promise<{
|
|
192
|
+
request?: (method: string, apiPath: string, body?: unknown, opts?: K8sRequestOptions) => Promise<{
|
|
162
193
|
status: number;
|
|
163
194
|
json: unknown;
|
|
164
195
|
}>;
|
|
@@ -229,6 +260,35 @@ export declare function errorMessageOf(e: unknown): string;
|
|
|
229
260
|
export { exitCodeFromStatus } from "./k8s-exec-protocol.js";
|
|
230
261
|
/** The sandbox namespace when `K8S_NAMESPACE` is unset (the one spelling: the adapter and the boot's egress line read it). */
|
|
231
262
|
export declare const K8S_SANDBOX_NAMESPACE_DEFAULT = "sandboxes";
|
|
263
|
+
/**
|
|
264
|
+
* The boot reading of the sandbox Secret seat, a closed set: `granted` — every verb allowed · `denied` — the API answered "not allowed" for these
|
|
265
|
+
* verbs (a definite answer; it wins over a verb that could not be asked) · `unverified` — some verb could not be asked (the request failed, the
|
|
266
|
+
* review itself was refused, the answer had no `status.allowed`) and none was denied.
|
|
267
|
+
*/
|
|
268
|
+
export type SandboxSecretSeat = {
|
|
269
|
+
readonly state: "granted";
|
|
270
|
+
} | {
|
|
271
|
+
readonly state: "denied";
|
|
272
|
+
readonly verbs: SandboxSecretVerb[];
|
|
273
|
+
} | {
|
|
274
|
+
readonly state: "unverified";
|
|
275
|
+
readonly detail: string;
|
|
276
|
+
};
|
|
277
|
+
/** Where a pod's lease lives and which origin table it was built with — what {@link writeSandboxLease} needs (read it from {@link RemoteK8sExecutionEnv.sandboxLeaseRef}). */
|
|
278
|
+
export interface SandboxLeaseRef {
|
|
279
|
+
readonly namespace: string;
|
|
280
|
+
readonly podName: string;
|
|
281
|
+
readonly leaseSecretName: string;
|
|
282
|
+
readonly origins: readonly string[];
|
|
283
|
+
}
|
|
284
|
+
/** One lease write's outcome (closed set): written · refused before sending (the broker would refuse it) · refused by the API · the Secret is gone (so is its pod) · any other failure. */
|
|
285
|
+
export type SandboxLeaseWrite = {
|
|
286
|
+
readonly ok: true;
|
|
287
|
+
} | {
|
|
288
|
+
readonly ok: false;
|
|
289
|
+
readonly code: "lease_invalid" | "auth_failed" | "gone" | "write_failed";
|
|
290
|
+
readonly message: string;
|
|
291
|
+
};
|
|
232
292
|
export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, BackgroundShellCapability {
|
|
233
293
|
/**
|
|
234
294
|
* 🔴 **[ref] / core 7.20.0([ref])`canonicalPathAuthoritative: true`** —— 本适配器的 `canonicalPath`
|
|
@@ -250,6 +310,8 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
250
310
|
/** Cluster-internal pod address, captured when the pod reaches Running — the LSP `getHost` surface.
|
|
251
311
|
* Lifecycle mirrors podName exactly (set on connect, cleared on suspend/destroy/dead-reconnect). */
|
|
252
312
|
private podIP?;
|
|
313
|
+
/** The broker lease seat of the pod this env holds (set with {@link podName}; read through {@link sandboxLeaseRef}). */
|
|
314
|
+
private leaseRef?;
|
|
253
315
|
private destroyed;
|
|
254
316
|
/** Set after a successful resumeVM so workspaceHandle() carries the snapshot it was restored from. */
|
|
255
317
|
private handleSnapshotId?;
|
|
@@ -274,6 +336,9 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
274
336
|
/** core 7.49.0 [ref]:shell 子进程真拿到的 `CDPATH` 条目 —— 本车道的命令跑在 pod 里(镜像与 pod spec 的 env),本类不读那份 env ⇒ `"unknown"`(core 契约:说不出就说 unknown,
|
|
275
337
|
* 不许报一张没读过的空表;删除守卫因此对裸 `cd <相对名>` 之后的删除问人,而不是按「没有 CDPATH」放行)。 */
|
|
276
338
|
readonly cdPath: "unknown";
|
|
339
|
+
/** core 7.56.0 [ref]:shell 子进程继承的环境里收不到的条目 —— 本车道 shell 的环境在 pod 里**构建**(本进程的 env 从不注入,只有引擎逐次交的 `env`
|
|
340
|
+
* 这条显式授予),没有一条是从本进程继承的 ⇒ `[]`(core 契约:「`[]` when its shell environment is built rather than inherited」)。 */
|
|
341
|
+
readonly withheldEnv: readonly [];
|
|
277
342
|
private readonly cfg;
|
|
278
343
|
private readonly deps;
|
|
279
344
|
/** The known occupant's incarnation (`undefined` = this run has no known occupant: a delegated child, an unread session, a direct construction) — the
|
|
@@ -295,6 +360,8 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
295
360
|
private readonly onWorkspaceSnapshot?;
|
|
296
361
|
private readonly cacheMisses?;
|
|
297
362
|
constructor(config: K8sEnvConfig, deps?: K8sEnvDeps);
|
|
363
|
+
/** The lease seat of the pod this env holds now — `undefined` without a broker seat or without a pod (the server's lease writes follow it: a resumed env holds a new pod and a new seat). */
|
|
364
|
+
get sandboxLeaseRef(): SandboxLeaseRef | undefined;
|
|
298
365
|
/** 166-T2 — ExecutionEnv 寿命声明:pod `activeDeadlineSeconds = ceil(timeoutMs/1000)` 是平台真硬死线
|
|
299
366
|
* (k8s 到点杀 pod,无 keepalive 续期机制)⇒ 恒声明,core 在死线−60s 处 suspend(基建合格)或响亮
|
|
300
367
|
* 终局(env.lifetime_expired)。`lifetimeStartedAt` 有意不声明:core 只在 prepare 期读一次,lazy-connect
|
|
@@ -410,6 +477,15 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
410
477
|
* same merge `createPod` applies). A read that is refused / fails / times out is a `unreadable` gap, never a guess. Never throws.
|
|
411
478
|
*/
|
|
412
479
|
egressPolicyGaps(): Promise<SandboxEgressGap[]>;
|
|
480
|
+
/**
|
|
481
|
+
* The boot reading of one sandbox Secret seat ({@link SandboxSecretSeat}): one SelfSubjectAccessReview per verb of that seat's row in {@link SANDBOX_SECRET_SEAT_VERBS}
|
|
482
|
+
* on `secrets` in this env's namespace. An answer with `status.allowed: false` is a denial (RBAC never answers `denied: true` — "no rule allows
|
|
483
|
+
* it" IS its refusal); a failed request, a refused review or an answer without a boolean `status.allowed` is a verb not asked. The verbs are
|
|
484
|
+
* asked at once (the boot waits one control-plane bound, not four). Never throws.
|
|
485
|
+
*/
|
|
486
|
+
secretSeatReading(seat: SandboxSecretSeatKind): Promise<SandboxSecretSeat>;
|
|
487
|
+
/** The sandbox pods of this env's namespace (selected by the identity labels), read for the reaper ({@link createSandboxPodApi}). Throws on a failed / refused listing. */
|
|
488
|
+
listSandboxPods(): Promise<SandboxPodListing[]>;
|
|
413
489
|
/** The one spelling of "the reclaim call's deadline passed" — both halves of the reclaim (volume and objects) say it with this. */
|
|
414
490
|
private reclaimDeadlinePassed;
|
|
415
491
|
/** The cache volume could not be had: counted (`recordFailOpen`) and one operator line — once per env. */
|
|
@@ -417,6 +493,34 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
417
493
|
/** Create one pod (with the cache volume when given) and wait for it to run. A {@link CacheMiss} = a pod carrying the
|
|
418
494
|
* volume did not become ready (its claim unbound past the bind deadline, or bound and still not ready) — already deleted. */
|
|
419
495
|
private createPod;
|
|
496
|
+
/**
|
|
497
|
+
* This pod's own Secret — the secret env seat ({@link K8sEnvConfig.podSecretEnv}): created AFTER the pod, owned by it (`ownerReferences` → the
|
|
498
|
+
* pod's uid, `blockOwnerDeletion: false` — the cluster's garbage collector removes it with the pod), `immutable`, `data["env.<NAME>"]` = the
|
|
499
|
+
* value (base64). The caller deletes the pod on any refusal: no uid to bind (`connect_failed`), refused (401 / 403 ⇒ `auth_failed`, not
|
|
500
|
+
* retried), any other answer or a failed request (`connect_failed`). A refusal never carries a value: the API's text is scrubbed of every value
|
|
501
|
+
* (raw and base64) before it enters the sentence.
|
|
502
|
+
*/
|
|
503
|
+
private createPodSecret;
|
|
504
|
+
/**
|
|
505
|
+
* This pod's lease Secret — the member-credential broker's seat ({@link K8sEnvConfig.sandboxBroker}): created after the pod, owned by it
|
|
506
|
+
* (the same `ownerReferences` as the env Secret), NOT immutable (the server rewrites the lease: {@link writeSandboxLease}), one data key
|
|
507
|
+
* `broker.json` = the placeholder lease. Refusals as for the env Secret; the caller deletes the pod on any of them.
|
|
508
|
+
*/
|
|
509
|
+
private createLeaseSecret;
|
|
510
|
+
/**
|
|
511
|
+
* One Secret owned by this pod (`ownerReferences` → its uid, `blockOwnerDeletion: false`; the cluster's garbage collector removes it with
|
|
512
|
+
* the pod). No uid to bind ⇒ `connect_failed`; refused (401 / 403) ⇒ `auth_failed`; any other answer or a failed request ⇒ `connect_failed`.
|
|
513
|
+
* A refusal never carries a value: the API's text is scrubbed of every `hidden` string before it enters the sentence.
|
|
514
|
+
*/
|
|
515
|
+
private createOwnedSecret;
|
|
516
|
+
/**
|
|
517
|
+
* Rewrite one pod's lease (the server's ONLY lease write — {@link writeSandboxLease}): the file is built by the one lease builder from the
|
|
518
|
+
* pod's origin table (fresh `leaseId` per ready entry, the broker's own parser judges it — a file the broker would refuse is never sent) and
|
|
519
|
+
* lands as a merge-patch of `broker.json` on the pod's lease Secret. Every failure is typed, says one operator line
|
|
520
|
+
* (`sandbox_lease_write_failed`), carries no credential (the API's text is scrubbed of every secret and of the encoded file), and falls
|
|
521
|
+
* back to nothing: the broker keeps the lease it has, which lapses on its own clock.
|
|
522
|
+
*/
|
|
523
|
+
writeLease(ref: SandboxLeaseRef, entries: readonly SandboxLeaseEntryInput[]): Promise<SandboxLeaseWrite>;
|
|
420
524
|
/**
|
|
421
525
|
* Build a validated, presigned URL for a snapshot object of either lane (see {@link SnapshotTarget}) — the ONE place a
|
|
422
526
|
* snapshot object key is spelled, and the one place each lane's partition is chosen (park = the session id, space = the
|
|
@@ -584,7 +688,20 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
584
688
|
error: RemoteExecutionError;
|
|
585
689
|
}>;
|
|
586
690
|
reconnect(_sessionToken: SessionToken): Promise<ConnectResult>;
|
|
587
|
-
|
|
691
|
+
/**
|
|
692
|
+
* Delete one pod — the ONE request path of "delete a sandbox pod" (the run-end delete, every refusal / reconnect clean-up, and the reaper's face: no grace).
|
|
693
|
+
* Resolves `"deleted"` (2xx) or `"gone"` (404: the pod never was / is already gone); throws {@link PodDeleteRefused} on any other answer and the request's own error on a transport failure.
|
|
694
|
+
*/
|
|
695
|
+
deletePod(name: string): Promise<"deleted" | "gone">;
|
|
696
|
+
/**
|
|
697
|
+
* Give up the pod a refused connect had already created. The refusal is the caller's answer; the delete is the clean-up behind it — and a clean-up that FAILS leaves
|
|
698
|
+
* the pod, and the Secret(s) it owns (the deployer-named env values / the lease placeholder: data at rest that no connection carries), in the sandbox namespace until
|
|
699
|
+
* the pod reaper's backstop reaches them. That is said, not swallowed — through the ONE reporter the reaper's own delete step shares
|
|
700
|
+
* ({@link reportPodDeleteFailed}: the F-class counter `server.sandbox-pod.delete-failed` and one error line naming the pod, the namespace, why the pod was being
|
|
701
|
+
* given up and how the delete failed (`http_<status>` / `request_failed`) — never a value, never the API's own text).
|
|
702
|
+
* Never throws: the refusal the caller goes on to return stays the original one.
|
|
703
|
+
*/
|
|
704
|
+
private discardRefusedPod;
|
|
588
705
|
/**
|
|
589
706
|
* Delete the sandbox pod. Idempotent, never throws. Space lane open and a pod exists ⇒ FIRST the run-end space
|
|
590
707
|
* snapshot ({@link persistWorkspace}) — after the pod's processes are confirmed stopped, the commands still in flight having ended or been cut first ({@link quiesce}); from the
|
|
@@ -766,6 +883,16 @@ export declare function createSpaceReclaimer(config: K8sEnvConfig, deps?: K8sEnv
|
|
|
766
883
|
* nodes that join after boot are read at the next boot. Never throws (a read failure is an `unreadable` gap).
|
|
767
884
|
*/
|
|
768
885
|
export declare function checkSandboxEgressPolicy(config: K8sEnvConfig, deps?: K8sEnvDeps): Promise<SandboxEgressGap[]>;
|
|
886
|
+
/** The boot reading of one sandbox Secret seat for this k8s config ({@link RemoteK8sExecutionEnv.secretSeatReading}; a control-plane env, no pod). Never throws. */
|
|
887
|
+
export declare function readSandboxSecretSeat(config: K8sEnvConfig, seat: SandboxSecretSeatKind, deps?: K8sEnvDeps): Promise<SandboxSecretSeat>;
|
|
888
|
+
/**
|
|
889
|
+
* The server's one lease writer for a pod that carries the member-credential broker ({@link RemoteK8sExecutionEnv.writeLease}): `ref` is the
|
|
890
|
+
* pod's lease seat ({@link RemoteK8sExecutionEnv.sandboxLeaseRef}), `entries` one per origin of its table. A control-plane env, no pod.
|
|
891
|
+
*/
|
|
892
|
+
export declare function writeSandboxLease(config: K8sEnvConfig, ref: SandboxLeaseRef, entries: readonly SandboxLeaseEntryInput[], deps?: K8sEnvDeps): Promise<SandboxLeaseWrite>;
|
|
893
|
+
/** The reaper's narrow face onto the sandbox namespace (list by identity labels, delete one) — a control-plane env, no pod, built at first use
|
|
894
|
+
* (as the space reclaimer builds its envs per call: the boot never constructs an env just to hold this face). */
|
|
895
|
+
export declare function createSandboxPodApi(config: K8sEnvConfig, deps?: K8sEnvDeps): SandboxPodApi;
|
|
769
896
|
/**
|
|
770
897
|
* `ExecutionEnvFactory` for the k8s pod-sandbox backend — one fresh (unconnected) env per task; the pod is
|
|
771
898
|
* created lazily on connect and deleted by `destroy()` (Runner-owned lifetime; `activeDeadlineSeconds` is the
|