@nylorun/runtime 0.15.1-beta → 0.16.0-beta
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/CHANGELOG.md +82 -0
- package/README.md +33 -6
- package/dist/adapters/execution/restate.d.ts +9 -1
- package/dist/adapters/execution/restate.js +64 -5
- package/dist/adapters/replication/pgoutput.js +3 -1
- package/dist/adapters/sandbox/local.d.ts +10 -0
- package/dist/adapters/sandbox/local.js +195 -0
- package/dist/adapters/sandbox/virtual.js +36 -1
- package/dist/admin-openapi.json +37 -3
- package/dist/api/a2a/tasks.js +6 -1
- package/dist/api/ag-ui/history.js +6 -1
- package/dist/api/ag-ui/routes.js +5 -1
- package/dist/api/components.d.ts +2673 -655
- package/dist/api/components.js +17 -1
- package/dist/api/gate/keys.d.ts +4 -3
- package/dist/api/gate/routes.d.ts +19 -3
- package/dist/api/gate/routes.js +162 -53
- package/dist/api/http/app.js +4 -0
- package/dist/api/http/define.d.ts +10 -0
- package/dist/api/http/define.js +2 -1
- package/dist/api/http/routes/artifacts.d.ts +11 -0
- package/dist/api/http/routes/artifacts.js +518 -0
- package/dist/api/http/routes/sandboxes.d.ts +9 -0
- package/dist/api/http/routes/sandboxes.js +152 -0
- package/dist/api/http/routes/sessions.js +3 -1
- package/dist/api/http/routes/tenant.js +36 -2
- package/dist/artifacts/config.d.ts +23 -0
- package/dist/artifacts/config.js +27 -0
- package/dist/artifacts/export.d.ts +8 -0
- package/dist/artifacts/export.js +205 -0
- package/dist/artifacts/files.d.ts +36 -0
- package/dist/artifacts/files.js +45 -0
- package/dist/artifacts/folders.d.ts +60 -0
- package/dist/artifacts/folders.js +209 -0
- package/dist/artifacts/links.d.ts +28 -0
- package/dist/artifacts/links.js +92 -0
- package/dist/artifacts/media-types.d.ts +13 -0
- package/dist/artifacts/media-types.js +80 -0
- package/dist/artifacts/parts.d.ts +34 -0
- package/dist/artifacts/parts.js +38 -0
- package/dist/artifacts/service.d.ts +74 -0
- package/dist/artifacts/service.js +301 -0
- package/dist/artifacts/workspace.d.ts +60 -0
- package/dist/artifacts/workspace.js +57 -0
- package/dist/artifacts/zip.d.ts +10 -0
- package/dist/artifacts/zip.js +126 -0
- package/dist/blob/fs.d.ts +13 -0
- package/dist/blob/fs.js +194 -0
- package/dist/blob/index.d.ts +9 -0
- package/dist/blob/index.js +9 -0
- package/dist/blob/s3.d.ts +42 -0
- package/dist/blob/s3.js +366 -0
- package/dist/blob/types.d.ts +108 -0
- package/dist/blob/types.js +85 -0
- package/dist/core/sandbox-routes.d.ts +2 -2
- package/dist/core/sandbox-routes.js +4 -3
- package/dist/execution/memory.d.ts +11 -1
- package/dist/execution/memory.js +77 -3
- package/dist/execution/types.d.ts +54 -1
- package/dist/execution/types.js +31 -0
- package/dist/gates/contract.d.ts +14 -13
- package/dist/gates/contract.js +13 -12
- package/dist/gates/egress.d.ts +72 -0
- package/dist/gates/egress.js +319 -0
- package/dist/gates/handler.d.ts +3 -0
- package/dist/gates/handler.js +3 -2
- package/dist/gates/http-client.d.ts +3 -2
- package/dist/gates/http-client.js +17 -6
- package/dist/gates/in-process.d.ts +13 -1
- package/dist/gates/in-process.js +11 -0
- package/dist/gates/inflight.d.ts +23 -4
- package/dist/gates/inflight.js +18 -4
- package/dist/gates/model-gate.d.ts +6 -2
- package/dist/gates/tool-calls.d.ts +9 -5
- package/dist/gates/tool-calls.js +6 -6
- package/dist/gates/tool-client.d.ts +9 -2
- package/dist/gates/tool-client.js +56 -22
- package/dist/gates/tool-contract.d.ts +12 -7
- package/dist/gates/tool-contract.js +10 -4
- package/dist/gates/tool-gate.d.ts +1 -0
- package/dist/harness/calls.d.ts +52 -0
- package/dist/harness/calls.js +113 -0
- package/dist/harness/executors.d.ts +22 -0
- package/dist/harness/executors.js +96 -0
- package/dist/harness/main.d.ts +6 -0
- package/dist/harness/main.js +103 -0
- package/dist/harness/pod.d.ts +21 -0
- package/dist/harness/pod.js +119 -0
- package/dist/harness/run-tokens.d.ts +18 -0
- package/dist/harness/run-tokens.js +15 -0
- package/dist/harness/service.d.ts +46 -0
- package/dist/harness/service.js +179 -0
- package/dist/harness/ws-client.d.ts +43 -0
- package/dist/harness/ws-client.js +122 -0
- package/dist/harness/ws-port.d.ts +22 -0
- package/dist/harness/ws-port.js +78 -0
- package/dist/harness-api/in-process.d.ts +24 -0
- package/dist/harness-api/in-process.js +119 -0
- package/dist/harness-api/record.d.ts +44 -0
- package/dist/harness-api/record.js +250 -0
- package/dist/harness-api/renew.d.ts +37 -0
- package/dist/harness-api/renew.js +77 -0
- package/dist/harness-api/server.d.ts +104 -0
- package/dist/harness-api/server.js +408 -0
- package/dist/harness-api/start.d.ts +36 -0
- package/dist/harness-api/start.js +118 -0
- package/dist/harness-api/workspace.d.ts +53 -0
- package/dist/harness-api/workspace.js +201 -0
- package/dist/harness-api/ws-server.d.ts +34 -0
- package/dist/harness-api/ws-server.js +227 -0
- package/dist/host/app.js +23 -2
- package/dist/host/gates.d.ts +27 -2
- package/dist/host/gates.js +46 -1
- package/dist/host/http.d.ts +4 -1
- package/dist/host/http.js +6 -1
- package/dist/host/main.js +135 -27
- package/dist/host/stack-config.d.ts +101 -1
- package/dist/host/stack-config.js +199 -8
- package/dist/mcp/snapshot.d.ts +8 -1
- package/dist/mcp/snapshot.js +28 -0
- package/dist/media.d.ts +5 -24
- package/dist/media.js +5 -0
- package/dist/model/pi-model.d.ts +6 -2
- package/dist/model/pi-model.js +39 -22
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +1 -1
- package/dist/openapi.json +15245 -8850
- package/dist/record/index.d.ts +1 -0
- package/dist/record/index.js +1 -0
- package/dist/record/sandbox.d.ts +25 -0
- package/dist/record/sandbox.js +43 -0
- package/dist/sandbox/capability.d.ts +3 -0
- package/dist/sandbox/capability.js +10 -0
- package/dist/sandbox/egress-token.d.ts +26 -0
- package/dist/sandbox/egress-token.js +8 -0
- package/dist/sandbox/join.d.ts +37 -0
- package/dist/sandbox/join.js +165 -0
- package/dist/sandbox/manager.d.ts +99 -34
- package/dist/sandbox/manager.js +216 -84
- package/dist/sandbox/placement.d.ts +27 -0
- package/dist/sandbox/placement.js +44 -0
- package/dist/sandbox/pods/client.d.ts +90 -0
- package/dist/sandbox/pods/client.js +79 -0
- package/dist/sandbox/pods/lifecycle.d.ts +91 -0
- package/dist/sandbox/pods/lifecycle.js +178 -0
- package/dist/sandbox/pods/name.d.ts +1 -0
- package/dist/sandbox/pods/name.js +28 -0
- package/dist/sandbox/pods/network-gate.d.ts +25 -0
- package/dist/sandbox/pods/network-gate.js +71 -0
- package/dist/sandbox/pods/reconcile.d.ts +11 -0
- package/dist/sandbox/pods/reconcile.js +152 -0
- package/dist/sandbox/pods/spec.d.ts +45 -0
- package/dist/sandbox/pods/spec.js +62 -0
- package/dist/sandbox/records.d.ts +29 -0
- package/dist/sandbox/records.js +79 -0
- package/dist/sandbox/resolve.d.ts +5 -0
- package/dist/sandbox/resolve.js +3 -2
- package/dist/sandbox/session-sandbox.js +7 -5
- package/dist/sandbox/share.d.ts +11 -0
- package/dist/sandbox/share.js +10 -0
- package/dist/sandbox/tenant-config.d.ts +16 -1
- package/dist/sandbox/tenant-config.js +9 -0
- package/dist/sandbox/types.d.ts +29 -1
- package/dist/sandbox/types.js +13 -1
- package/dist/store/postgres/drizzle/0004_sandbox_resources.sql +20 -0
- package/dist/store/postgres/drizzle/0005_artifacts.sql +27 -0
- package/dist/store/postgres/drizzle/0006_folder_artifacts.sql +12 -0
- package/dist/store/postgres/drizzle/0007_sandbox_pods.sql +14 -0
- package/dist/store/postgres/drizzle/meta/_journal.json +28 -0
- package/dist/store/postgres/record-writer.d.ts +6 -1
- package/dist/store/postgres/record-writer.js +20 -2
- package/dist/store/postgres/schema.d.ts +894 -0
- package/dist/store/postgres/schema.js +130 -2
- package/dist/store/postgres/store.js +289 -4
- package/dist/store/types.d.ts +143 -6
- package/dist/streams/control.d.ts +2 -0
- package/dist/streams/control.js +5 -0
- package/dist/streams/types.d.ts +10 -1
- package/dist/tenant/advance.js +218 -160
- package/dist/tenant/artifact-tool.d.ts +5 -0
- package/dist/tenant/artifact-tool.js +119 -0
- package/dist/tenant/commands.js +30 -5
- package/dist/tenant/context.d.ts +64 -5
- package/dist/tenant/effects.d.ts +19 -13
- package/dist/tenant/effects.js +5 -382
- package/dist/tenant/history.d.ts +13 -23
- package/dist/tenant/history.js +14 -62
- package/dist/tenant/host-token.d.ts +92 -0
- package/dist/tenant/host-token.js +179 -0
- package/dist/tenant/module.js +1 -0
- package/dist/tenant/paths.d.ts +2 -1
- package/dist/tenant/paths.js +3 -1
- package/dist/tenant/reset.d.ts +5 -2
- package/dist/tenant/reset.js +22 -2
- package/dist/tenant/run-grants.d.ts +49 -0
- package/dist/tenant/run-grants.js +62 -0
- package/dist/tenant/run-token.d.ts +70 -0
- package/dist/tenant/run-token.js +138 -0
- package/dist/tenant/runtime.d.ts +38 -0
- package/dist/tenant/runtime.js +120 -32
- package/dist/tenant/sandboxes.d.ts +119 -0
- package/dist/tenant/sandboxes.js +551 -0
- package/dist/tenant/session.d.ts +2 -13
- package/dist/tenant/session.js +4 -28
- package/dist/tenant/sessions.d.ts +5 -0
- package/dist/tenant/sessions.js +28 -1
- package/dist/tenant/status.d.ts +8 -3
- package/dist/tenant/status.js +5 -0
- package/dist/tenant/streams.d.ts +7 -0
- package/dist/tenant/streams.js +24 -1
- package/dist/tenant/sweep.js +37 -4
- package/dist/tenant/tokens.js +9 -2
- package/dist/tenant/types.d.ts +18 -1
- package/dist/tenant/worker.d.ts +11 -5
- package/dist/tenant/worker.js +12 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +13 -10
- package/dist/adapters/media.d.ts +0 -24
- package/dist/adapters/media.js +0 -111
package/dist/store/types.d.ts
CHANGED
|
@@ -55,9 +55,10 @@
|
|
|
55
55
|
* them there (`tenant/session-streams.ts`).
|
|
56
56
|
*/
|
|
57
57
|
import type { RecordReader } from "../streams/relay/types.js";
|
|
58
|
-
import type { Action, EventPayload, EventType, LiveEvent, SessionEventOf } from "@nylorun/core/contracts";
|
|
58
|
+
import type { Action, EventPayload, EventType, LiveEvent, SandboxEvent, SandboxEventPayload, SandboxEventType, SandboxKind, SandboxPodDesired, SandboxPodObserved, SessionEventOf } from "@nylorun/core/contracts";
|
|
59
|
+
import type { SandboxManifest } from "@nylorun/core/define";
|
|
59
60
|
import type { HostEffect } from "@nylorun/harness/run";
|
|
60
|
-
import type { ModelBudgetRow, ModelUsageRow, PrincipalRow, ToolCrossingRow, PublishableKeyRow, SigningKeyRow, SubjectUsageRow, VaultAuditRow, VaultCredentialRow, VaultIdempotencyRow, VaultRow } from "./postgres/schema.js";
|
|
61
|
+
import type { ArtifactRow, ArtifactVersionRow, ModelBudgetRow, ModelUsageRow, PrincipalRow, ToolCrossingRow, PublishableKeyRow, SigningKeyRow, SubjectUsageRow, VaultAuditRow, VaultCredentialRow, VaultIdempotencyRow, VaultRow } from "./postgres/schema.js";
|
|
61
62
|
/** Tables holding JSON documents keyed by `id`. */
|
|
62
63
|
export type DocTable = "definitions" | "sessions" | "commands" | "effects" | "actions" | "sandboxes" | "links";
|
|
63
64
|
export declare const DOC_TABLES: readonly DocTable[];
|
|
@@ -80,6 +81,12 @@ export interface SessionOwnership {
|
|
|
80
81
|
/** ISO time the owner's lease ends, or null without an owner. */
|
|
81
82
|
ownerExpiresAt: string | null;
|
|
82
83
|
}
|
|
84
|
+
/** A session's lease epoch, status and active turn: what a run token must still match. */
|
|
85
|
+
export interface SessionRunState {
|
|
86
|
+
readonly epoch: number;
|
|
87
|
+
readonly status: string;
|
|
88
|
+
readonly activeTurnId: string | null;
|
|
89
|
+
}
|
|
83
90
|
/**
|
|
84
91
|
* The fields of a session document that the store indexes. The
|
|
85
92
|
* Runtime's own session type extends this; everything else in the body is
|
|
@@ -115,6 +122,50 @@ export interface DefinitionDoc {
|
|
|
115
122
|
export interface SandboxDoc {
|
|
116
123
|
key: string;
|
|
117
124
|
}
|
|
125
|
+
/** A sandbox resource (`sandbox_resources`): what `PUT /v1/sandboxes/{id}` created. */
|
|
126
|
+
export interface SandboxResource {
|
|
127
|
+
id: string;
|
|
128
|
+
kind: SandboxKind;
|
|
129
|
+
/** The spec resolved against the Tenant's limits when the sandbox was created. */
|
|
130
|
+
spec: SandboxManifest;
|
|
131
|
+
labels: Record<string, string>;
|
|
132
|
+
createdAt: string;
|
|
133
|
+
updatedAt: string;
|
|
134
|
+
/** Kind `pod`: the pod's lifecycle (F7.2). Absent for a virtual sandbox. */
|
|
135
|
+
pod?: SandboxPodState;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A pod sandbox's lifecycle columns (`sandbox_resources`, F7.2, D34): what the Runtime wants
|
|
139
|
+
* (`desired`), what it last saw (`observed`), and the fences of its incarnations.
|
|
140
|
+
*/
|
|
141
|
+
export interface SandboxPodState {
|
|
142
|
+
/** The agent-sandbox Sandbox's name (`podName`), of generation `volumeGen`. */
|
|
143
|
+
k8sName: string;
|
|
144
|
+
volumeGen: number;
|
|
145
|
+
desired: SandboxPodDesired;
|
|
146
|
+
observed: SandboxPodObserved;
|
|
147
|
+
/** The UID of the pod that last joined. */
|
|
148
|
+
podUid?: string;
|
|
149
|
+
/** Bumped by every join, relaunch, loss and reset; host and egress tokens carry it. */
|
|
150
|
+
hostEpoch: number;
|
|
151
|
+
/** sha256 hex of the incarnation's join token. */
|
|
152
|
+
joinTokenHash?: string;
|
|
153
|
+
/** Bumped by every change asked of the pod (the sandboxes service's `opId`). */
|
|
154
|
+
rev: number;
|
|
155
|
+
/** ISO times. */
|
|
156
|
+
lastActiveAt?: string;
|
|
157
|
+
expiresAt?: string;
|
|
158
|
+
startedAt?: string;
|
|
159
|
+
reason?: string;
|
|
160
|
+
/** An earlier incarnation's Sandbox still to delete (after a reset or a loss). */
|
|
161
|
+
retiring?: string;
|
|
162
|
+
/** The id the engine keeps on the volume, from the first join. */
|
|
163
|
+
volumeId?: string;
|
|
164
|
+
}
|
|
165
|
+
/** A change to a pod's columns: `null` clears an optional one. */
|
|
166
|
+
export type SandboxPodPatch = {
|
|
167
|
+
[K in keyof SandboxPodState]?: undefined extends SandboxPodState[K] ? SandboxPodState[K] | null : SandboxPodState[K];
|
|
168
|
+
};
|
|
118
169
|
/** A session as read from the store: its document plus the store-managed ownership fields. */
|
|
119
170
|
export type StoredSession<T extends SessionDoc = SessionDoc> = T & SessionOwnership;
|
|
120
171
|
/** A link row together with the agent session it names. */
|
|
@@ -194,7 +245,7 @@ export type EndpointHealthUpdate =
|
|
|
194
245
|
* Tenant's signing keys, a subject's turn bucket, a publishable key, a model call in the usage
|
|
195
246
|
* ledger and a model budget.
|
|
196
247
|
*/
|
|
197
|
-
export type { ModelBudgetRow, ModelUsageRow, ToolCrossingRow, PrincipalRow, PublishableKeyRow, SigningKeyRow, SubjectUsageRow, VaultAuditRow, VaultCredentialRow, VaultIdempotencyRow, VaultRow, };
|
|
248
|
+
export type { ArtifactRow, ArtifactVersionRow, ModelBudgetRow, ModelUsageRow, ToolCrossingRow, PrincipalRow, PublishableKeyRow, SigningKeyRow, SubjectUsageRow, VaultAuditRow, VaultCredentialRow, VaultIdempotencyRow, VaultRow, };
|
|
198
249
|
/** Which rows of the usage ledger a total covers. */
|
|
199
250
|
export interface ModelUsageQuery {
|
|
200
251
|
scope: "tenant" | "agent" | "turn";
|
|
@@ -340,6 +391,11 @@ export interface Tx {
|
|
|
340
391
|
* advance calls this first; see `ownedTx` in `store/ownership.ts`.
|
|
341
392
|
*/
|
|
342
393
|
assertEpoch<T extends SessionDoc = SessionDoc>(sessionId: string, epoch: number): Promise<StoredSession<T>>;
|
|
394
|
+
/**
|
|
395
|
+
* What a run token's live check reads of a session (F5 gate trust): its lease epoch, status
|
|
396
|
+
* and active turn, without the body. Undefined when the session is gone. Does not lock.
|
|
397
|
+
*/
|
|
398
|
+
runState(sessionId: string): Promise<SessionRunState | undefined>;
|
|
343
399
|
sessionsWithStatus<T extends SessionDoc = SessionDoc>(statuses: readonly (SessionStatus | (string & {}))[]): Promise<StoredSession<T>[]>;
|
|
344
400
|
/**
|
|
345
401
|
* Sessions `running` or `runnable` with no owner or an owner whose lease
|
|
@@ -353,6 +409,37 @@ export interface Tx {
|
|
|
353
409
|
}): Promise<StoredSession<T>[]>;
|
|
354
410
|
listDefinitions<T extends DefinitionDoc = DefinitionDoc>(): Promise<T[]>;
|
|
355
411
|
listSandboxes<T extends SandboxDoc = SandboxDoc>(): Promise<T[]>;
|
|
412
|
+
/** The sandbox resource `id`; with `lock`, its row is locked until the transaction ends. */
|
|
413
|
+
sandboxResource(id: string, options?: {
|
|
414
|
+
lock?: boolean;
|
|
415
|
+
}): Promise<SandboxResource | undefined>;
|
|
416
|
+
/**
|
|
417
|
+
* Creates the sandbox resource unless one with its id exists, while the Tenant holds fewer
|
|
418
|
+
* than `limit`: `exists` and `limit` write nothing. Serialized with every other create.
|
|
419
|
+
*/
|
|
420
|
+
createSandboxResource(row: SandboxResource, limit: number): Promise<"created" | "exists" | "limit">;
|
|
421
|
+
updateSandboxLabels(id: string, labels: Record<string, string>, updatedAt: string): Promise<void>;
|
|
422
|
+
/** Replaces a sandbox's spec (a pod's new `lifecycle.ttl`; the caller holds the row's lock). */
|
|
423
|
+
updateSandboxSpec(id: string, spec: SandboxManifest, updatedAt: string): Promise<void>;
|
|
424
|
+
/** Changes a pod sandbox's lifecycle columns (the caller holds the row's lock). */
|
|
425
|
+
updateSandboxPod(id: string, patch: SandboxPodPatch, updatedAt: string): Promise<void>;
|
|
426
|
+
deleteSandboxResource(id: string): Promise<void>;
|
|
427
|
+
/** Sandbox resources by id, those with every label in `labels` when it is given. */
|
|
428
|
+
listSandboxResources(filter?: {
|
|
429
|
+
labels?: Record<string, string>;
|
|
430
|
+
}): Promise<SandboxResource[]>;
|
|
431
|
+
/** Sessions attached to sandbox resource `sandboxId` (`Session.sandboxId`), by id. */
|
|
432
|
+
sessionsOnSandbox<T extends SessionDoc = SessionDoc>(sandboxId: string): Promise<StoredSession<T>[]>;
|
|
433
|
+
/**
|
|
434
|
+
* Appends an event to the sandbox's lifecycle stream through the record module. The caller
|
|
435
|
+
* holds the sandbox row's lock (or created the row in this transaction).
|
|
436
|
+
*/
|
|
437
|
+
sandboxEvent<T extends SandboxEventType>(sandboxId: string, type: T, payload: SandboxEventPayload<T>): Promise<SandboxEvent>;
|
|
438
|
+
/** The sandbox's lifecycle stream, from `fromSeq` on, at most `limit` events. */
|
|
439
|
+
sandboxEvents(sandboxId: string, options?: {
|
|
440
|
+
fromSeq?: number;
|
|
441
|
+
limit?: number;
|
|
442
|
+
}): Promise<SandboxEvent[]>;
|
|
356
443
|
/** One agent's `pending` actions, delivered when its endpoint is registered. */
|
|
357
444
|
pendingActions(agentId: string): Promise<ActionDoc[]>;
|
|
358
445
|
/** How many of one agent's actions are `delivering` (Action endpoints). */
|
|
@@ -476,17 +563,67 @@ export interface Tx {
|
|
|
476
563
|
settleToolCrossing(key: string, answer: unknown, settledAt: string): Promise<void>;
|
|
477
564
|
/** Deletes rows that settled before `before`; returns how many. */
|
|
478
565
|
pruneToolCrossings(before: string): Promise<number>;
|
|
566
|
+
/** The artifact `id`; with `lock`, its row is locked until the transaction ends. */
|
|
567
|
+
artifact(id: string, options?: {
|
|
568
|
+
lock?: boolean;
|
|
569
|
+
}): Promise<ArtifactRow | undefined>;
|
|
570
|
+
/** Artifacts by creation time, then id: those of one session when `sessionId` is given. */
|
|
571
|
+
listArtifacts(filter?: {
|
|
572
|
+
sessionId?: string;
|
|
573
|
+
}): Promise<ArtifactRow[]>;
|
|
574
|
+
/** Writes a new artifact with its first version. Rejects on a duplicate id. */
|
|
575
|
+
insertArtifact(row: ArtifactRow, version: ArtifactVersionRow): Promise<void>;
|
|
576
|
+
/**
|
|
577
|
+
* Adds the next version of a locked artifact and makes it the latest (its content type and
|
|
578
|
+
* `updatedAt` follow the version).
|
|
579
|
+
*/
|
|
580
|
+
insertArtifactVersion(version: ArtifactVersionRow): Promise<void>;
|
|
581
|
+
/** One version, or every version oldest first. */
|
|
582
|
+
artifactVersion(artifactId: string, version: number): Promise<ArtifactVersionRow | undefined>;
|
|
583
|
+
artifactVersions(artifactId: string): Promise<ArtifactVersionRow[]>;
|
|
584
|
+
/** Deletes the artifact and its versions; returns the versions' blob keys (empty when none). */
|
|
585
|
+
deleteArtifact(id: string): Promise<string[]>;
|
|
586
|
+
/**
|
|
587
|
+
* Serializes the Tenant's artifact writes: held until the transaction ends. Take it before
|
|
588
|
+
* reading the total a new version must fit under.
|
|
589
|
+
*/
|
|
590
|
+
lockArtifactQuota(): Promise<void>;
|
|
591
|
+
/**
|
|
592
|
+
* The bytes the artifacts store: every file version, plus each distinct content-addressed file
|
|
593
|
+
* of the folders once (F8.2).
|
|
594
|
+
*/
|
|
595
|
+
artifactBytes(): Promise<number>;
|
|
596
|
+
/**
|
|
597
|
+
* The blob keys of every artifact version (a folder's: its manifests): of session artifacts
|
|
598
|
+
* only, or of all of them.
|
|
599
|
+
*/
|
|
600
|
+
artifactBlobKeys(scope: "sessions" | "all"): Promise<string[]>;
|
|
601
|
+
/** Records the distinct content-addressed files a folder version references (F8.2). */
|
|
602
|
+
insertArtifactContent(artifactId: string, version: number, files: readonly {
|
|
603
|
+
sha256: string;
|
|
604
|
+
size: number;
|
|
605
|
+
}[]): Promise<void>;
|
|
606
|
+
/** Those of `shas` some committed folder version references. */
|
|
607
|
+
referencedArtifactContent(shas: readonly string[]): Promise<Set<string>>;
|
|
608
|
+
/**
|
|
609
|
+
* The distinct content-addressed files folder versions reference: of one artifact, of session
|
|
610
|
+
* artifacts only, or of all of them.
|
|
611
|
+
*/
|
|
612
|
+
artifactContentShas(scope: "sessions" | "all" | {
|
|
613
|
+
artifactId: string;
|
|
614
|
+
}): Promise<string[]>;
|
|
479
615
|
getSetting(key: string): Promise<string | undefined>;
|
|
480
616
|
putSetting(key: string, value: string): Promise<void>;
|
|
481
617
|
/**
|
|
482
618
|
* Deletes Tenant state by scope, in this transaction:
|
|
483
619
|
* - `sessions`: sessions, commands, effects, actions, links, subject turn
|
|
484
|
-
* buckets
|
|
620
|
+
* buckets, the artifacts of sessions (their blobs are the caller's to delete) and the
|
|
621
|
+
* Tenant's record rows and log heads. The Tenant moves to the next basin
|
|
485
622
|
* generation and the current one is retired, so session ids it frees start again in an
|
|
486
623
|
* empty basin;
|
|
487
|
-
* - `sandboxes`: sandbox records;
|
|
624
|
+
* - `sandboxes`: sandbox records, sandbox resources and their lifecycle streams;
|
|
488
625
|
* - `all`: both, plus definitions, Action endpoints, user vaults with their credentials,
|
|
489
|
-
* the model usage ledger
|
|
626
|
+
* the model usage ledger, the model budgets and Tenant-wide artifacts. The host vault, principals, signing keys, subject epochs,
|
|
490
627
|
* publishable keys, settings, audit and vault idempotency rows stay.
|
|
491
628
|
*/
|
|
492
629
|
reset(scope: ResetScope): Promise<void>;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { type DurableStreams } from "./types.js";
|
|
7
7
|
/** Appends a `session.cancel` signal: the process running the session's advance aborts it. */
|
|
8
8
|
export declare function signalCancel(streams: DurableStreams, basin: string, sessionId: string, turnId?: string): Promise<void>;
|
|
9
|
+
/** Appends an `action.resolved` signal: a run held for the Action goes on with its outcome. */
|
|
10
|
+
export declare function signalActionResolved(streams: DurableStreams, basin: string, sessionId: string, actionId: string): Promise<void>;
|
|
9
11
|
/**
|
|
10
12
|
* Appends a `sessions.reset` signal to the old generation's basin: every process with the
|
|
11
13
|
* Tenant open moves its readers to `generation` and ends the streams of deleted sessions.
|
package/dist/streams/control.js
CHANGED
|
@@ -15,6 +15,11 @@ export async function signalCancel(streams, basin, sessionId, turnId) {
|
|
|
15
15
|
};
|
|
16
16
|
await streams.append(basin, CONTROL_STREAM, [signal]);
|
|
17
17
|
}
|
|
18
|
+
/** Appends an `action.resolved` signal: a run held for the Action goes on with its outcome. */
|
|
19
|
+
export async function signalActionResolved(streams, basin, sessionId, actionId) {
|
|
20
|
+
const signal = { type: "action.resolved", sessionId, actionId };
|
|
21
|
+
await streams.append(basin, CONTROL_STREAM, [signal]);
|
|
22
|
+
}
|
|
18
23
|
/**
|
|
19
24
|
* Appends a `sessions.reset` signal to the old generation's basin: every process with the
|
|
20
25
|
* Tenant open moves its readers to `generation` and ends the streams of deleted sessions.
|
package/dist/streams/types.d.ts
CHANGED
|
@@ -147,4 +147,13 @@ export interface SubjectRevokedSignal {
|
|
|
147
147
|
subject: string;
|
|
148
148
|
epoch: number;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
/**
|
|
151
|
+
* An Action of `sessionId` has its outcome (F6.2): the process whose harness holds the
|
|
152
|
+
* session's run while the Action is pending passes it on (`effect.resolved`).
|
|
153
|
+
*/
|
|
154
|
+
export interface ActionResolvedSignal {
|
|
155
|
+
type: "action.resolved";
|
|
156
|
+
sessionId: string;
|
|
157
|
+
actionId: string;
|
|
158
|
+
}
|
|
159
|
+
export type ControlSignal = SessionCancelSignal | SessionsResetSignal | SubjectRevokedSignal | ActionResolvedSignal;
|