@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/tenant/commands.js
CHANGED
|
@@ -25,10 +25,12 @@ import { lockedSession, } from "./context.js";
|
|
|
25
25
|
import { fail } from "./http.js";
|
|
26
26
|
import { accessOf } from "./auth.js";
|
|
27
27
|
import { chargeTurn } from "./subject-limits.js";
|
|
28
|
+
import { checkSandboxTurn } from "./sandboxes.js";
|
|
28
29
|
import { actionTarget, rebaseSessionState, turnManifestOf, variantStore, } from "./session.js";
|
|
29
|
-
import { signalSessionCancel } from "./streams.js";
|
|
30
|
+
import { signalActionOutcome, signalSessionCancel } from "./streams.js";
|
|
30
31
|
import { toolIds } from "./transcript.js";
|
|
31
32
|
import { slimModelEffects } from "./slim.js";
|
|
33
|
+
import { resolveMessageParts } from "../artifacts/parts.js";
|
|
32
34
|
/** `outcome`, or a failed one when a tool's output does not match its stored output schema. */
|
|
33
35
|
export function acceptedOutcome(action, outcome) {
|
|
34
36
|
if (action.kind !== "tool" || !action.outputSchema)
|
|
@@ -178,6 +180,9 @@ export async function command(ctx, id, input, scope) {
|
|
|
178
180
|
if (command.type === "message") {
|
|
179
181
|
if (!["idle", "completed", "failed", "cancelled"].includes(s.status))
|
|
180
182
|
fail(409, "Session has active or unresolved work");
|
|
183
|
+
// Every turn start on a sandbox: it exists, the token's `sbx` reaches it, and no other
|
|
184
|
+
// session's turn holds it. Before the charge, so a refused turn costs nothing.
|
|
185
|
+
await checkSandboxTurn(t, s, scope, ctx);
|
|
181
186
|
// After the replay check above, so a retried message is never charged twice.
|
|
182
187
|
if (scope.kind === "token" && scope.limits)
|
|
183
188
|
await chargeTurn(t, scope.subject, scope.limits);
|
|
@@ -186,8 +191,17 @@ export async function command(ctx, id, input, scope) {
|
|
|
186
191
|
if (s.history?.snapshot !== undefined)
|
|
187
192
|
s.history = { ...s.history, from: s.history.snapshot };
|
|
188
193
|
s.activeTurnId = randomUUID();
|
|
194
|
+
// File parts name artifacts the caller may read; each is pinned to a version now.
|
|
195
|
+
const parts = "parts" in command
|
|
196
|
+
? await resolveMessageParts(t, command.parts, id, accessOf(scope))
|
|
197
|
+
: undefined;
|
|
198
|
+
const data = "data" in command ? command.data : undefined;
|
|
189
199
|
if (isWorkflowManifest(s.manifest)) {
|
|
190
|
-
const input = "content" in command
|
|
200
|
+
const input = "content" in command
|
|
201
|
+
? command.content
|
|
202
|
+
: parts
|
|
203
|
+
? { parts: parts.pinned }
|
|
204
|
+
: data;
|
|
191
205
|
s.checkpoint = createFlowCheckpoint({
|
|
192
206
|
manifest: s.manifest,
|
|
193
207
|
sessionId: id,
|
|
@@ -214,9 +228,11 @@ export async function command(ctx, id, input, scope) {
|
|
|
214
228
|
turnId: s.activeTurnId,
|
|
215
229
|
input: "content" in command
|
|
216
230
|
? command.content
|
|
217
|
-
:
|
|
218
|
-
?
|
|
219
|
-
:
|
|
231
|
+
: parts
|
|
232
|
+
? { content: parts.engine }
|
|
233
|
+
: typeof data === "string"
|
|
234
|
+
? data
|
|
235
|
+
: JSON.stringify(data),
|
|
220
236
|
state: s.state,
|
|
221
237
|
info: s.info,
|
|
222
238
|
});
|
|
@@ -334,6 +350,15 @@ export async function recordActionOutcome(t, ctx, s, action, received, options =
|
|
|
334
350
|
dedupeKey: `action_result:${action.turnId}:${action.actionId}:${action.generation}`,
|
|
335
351
|
};
|
|
336
352
|
t.afterCommit(() => ctx.wake(s.id, resultWake));
|
|
353
|
+
// A run held while the Action was pending goes on with it in the same lease (F6.2): here, or
|
|
354
|
+
// on the process whose harness holds it. The wake finds the session settled, or resumes it
|
|
355
|
+
// by replay when the run had already ended.
|
|
356
|
+
t.afterCommit(() => {
|
|
357
|
+
if (ctx.harness.holds(s.id))
|
|
358
|
+
ctx.harness.resolved(s.id, action.actionId, outcome);
|
|
359
|
+
else
|
|
360
|
+
signalActionOutcome(ctx, s.id, action.actionId);
|
|
361
|
+
});
|
|
337
362
|
const event = await t.event(s.id, s.activeTurnId, "action.completed", {
|
|
338
363
|
actionId: action.actionId,
|
|
339
364
|
...actionTarget(action),
|
package/dist/tenant/context.d.ts
CHANGED
|
@@ -27,12 +27,18 @@ import type { Keys } from "../keys/keys.js";
|
|
|
27
27
|
import type { VaultService } from "../vault/service.js";
|
|
28
28
|
import type { McpPool } from "../mcp/pool.js";
|
|
29
29
|
import type { McpDiagnostic, McpSnapshot } from "../mcp/snapshot.js";
|
|
30
|
-
import type {
|
|
30
|
+
import type { HarnessApiServer } from "../harness-api/server.js";
|
|
31
|
+
import type { WorkspacePort } from "../harness-api/workspace.js";
|
|
32
|
+
import type { SandboxesClient } from "../sandbox/pods/client.js";
|
|
33
|
+
import type { SandboxSignal } from "../execution/types.js";
|
|
31
34
|
import type { TenantConfig } from "./types.js";
|
|
32
35
|
import type { SessionStreams } from "./session-streams.js";
|
|
33
36
|
import type { StuckInvocation, Wake } from "../execution/types.js";
|
|
34
37
|
import type { WorkState } from "./scheduler.js";
|
|
35
38
|
import type { SigningKeys } from "./signing-keys.js";
|
|
39
|
+
import type { BlobStore } from "../blob/index.js";
|
|
40
|
+
import type { WorkspaceReader } from "../artifacts/workspace.js";
|
|
41
|
+
import type { RunGrants } from "./run-grants.js";
|
|
36
42
|
export interface Session {
|
|
37
43
|
id: string;
|
|
38
44
|
agentId: string;
|
|
@@ -70,14 +76,19 @@ export interface Session {
|
|
|
70
76
|
mcpDiagnostics?: readonly McpDiagnostic[];
|
|
71
77
|
/** Session id that keys the shared sandbox; absent means this session owns it. */
|
|
72
78
|
sandboxOwnerId?: string;
|
|
79
|
+
/**
|
|
80
|
+
* The sandbox resource the session is attached to (`sandbox: { id }`): its workspace is the
|
|
81
|
+
* sandbox's, shared with every session attached to it, and it outlives the session.
|
|
82
|
+
*/
|
|
83
|
+
sandboxId?: string;
|
|
73
84
|
/**
|
|
74
85
|
* The sandbox chosen when the session was opened, resolved against the Tenant's limits, or
|
|
75
86
|
* inherited from the session it shares with. Absent when the session has no sandbox or its
|
|
76
87
|
* definition declares one (`.sandbox()`).
|
|
77
88
|
*/
|
|
78
89
|
sandbox?: SandboxManifest;
|
|
79
|
-
/** Where `sandbox` came from. */
|
|
80
|
-
sandboxSource?: "default" | "inline" | "shared";
|
|
90
|
+
/** Where `sandbox` came from: `sandbox` is a sandbox resource's spec. */
|
|
91
|
+
sandboxSource?: "default" | "inline" | "shared" | "sandbox";
|
|
81
92
|
}
|
|
82
93
|
export type AuthScope = {
|
|
83
94
|
kind: "application";
|
|
@@ -94,6 +105,8 @@ export type AuthScope = {
|
|
|
94
105
|
agents: ReadonlySet<string> | "*";
|
|
95
106
|
role: string;
|
|
96
107
|
limits?: RoleLimits;
|
|
108
|
+
/** The token's `sbx` grants: the sandboxes it reaches. Absent reaches none. */
|
|
109
|
+
sandboxes?: readonly string[];
|
|
97
110
|
epoch: number;
|
|
98
111
|
expiresAt: number;
|
|
99
112
|
tokenId: string;
|
|
@@ -138,8 +151,16 @@ export interface TenantContext {
|
|
|
138
151
|
readonly envelope: TenantEnvelope;
|
|
139
152
|
readonly store: SessionStore;
|
|
140
153
|
readonly vault: VaultService;
|
|
141
|
-
|
|
142
|
-
|
|
154
|
+
/**
|
|
155
|
+
* The MCP pool of the Tenant's in-process harness. Absent when harnesses run elsewhere
|
|
156
|
+
* (`NYLORUN_HARNESS=remote`): each keeps its own (F6.2).
|
|
157
|
+
*/
|
|
158
|
+
readonly mcp?: McpPool;
|
|
159
|
+
/**
|
|
160
|
+
* The workspace capability (F6.2): the Tenant's SandboxManager with an in-process harness,
|
|
161
|
+
* else the harness that serves workspaces (`harness-api/workspace.ts`).
|
|
162
|
+
*/
|
|
163
|
+
readonly sandbox: WorkspacePort;
|
|
143
164
|
readonly flowLimits: FlowLimits;
|
|
144
165
|
readonly modelProvider: ModelProvider;
|
|
145
166
|
/** True when the model comes from the Tenant vault selection, served by `modelGate`. */
|
|
@@ -157,6 +178,28 @@ export interface TenantContext {
|
|
|
157
178
|
* `signingKeys`' private key.
|
|
158
179
|
*/
|
|
159
180
|
readonly keys: Keys;
|
|
181
|
+
/**
|
|
182
|
+
* The Object store's `BlobStore` seam (D35): the Host's `s3` store (RustFS in the local
|
|
183
|
+
* stack), or the `fs` store under `paths.blobs` without one. Bytes only; Postgres holds what
|
|
184
|
+
* they mean, and a blob counts once a committed row names its key.
|
|
185
|
+
*/
|
|
186
|
+
readonly blobs: BlobStore;
|
|
187
|
+
/**
|
|
188
|
+
* How core reads a session's sandbox workspace at turn end, to export its outputs (F8.2): over
|
|
189
|
+
* this process's `sandbox` today; over the Harness API's `workspace.read` from F6.2.
|
|
190
|
+
*/
|
|
191
|
+
readonly workspaces: WorkspaceReader;
|
|
192
|
+
/**
|
|
193
|
+
* The run token of each session an advance of this process owns (F5): the credential the
|
|
194
|
+
* HTTP gate clients present for that session's model and MCP calls (`run-grants.ts`).
|
|
195
|
+
* Absent when the gates run in this process, which needs no token (G6).
|
|
196
|
+
*/
|
|
197
|
+
readonly runGrants?: RunGrants;
|
|
198
|
+
/**
|
|
199
|
+
* The Harness API server (D37): advances offer their segments here, and the Tenant's
|
|
200
|
+
* harnesses (the in-process one, or attached ones) run them.
|
|
201
|
+
*/
|
|
202
|
+
readonly harness: HarnessApiServer;
|
|
160
203
|
/** Set by drain/close; reset clears it again. Stops new advances. */
|
|
161
204
|
closing: boolean;
|
|
162
205
|
/** Set once close has finished releasing resources. */
|
|
@@ -187,6 +230,16 @@ export interface TenantContext {
|
|
|
187
230
|
* from `t.afterCommit`. Dropped while the Tenant is closing; the sweep re-sends it.
|
|
188
231
|
*/
|
|
189
232
|
deliver(actionId: string): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Sandbox pods (F7.2): the sandboxes service and the Runtime image pods copy the engine from.
|
|
235
|
+
* Absent without a cluster (`nylorun sandbox enable`): kind `pod` is `sandbox_unavailable`.
|
|
236
|
+
*/
|
|
237
|
+
readonly pods?: TenantPods;
|
|
238
|
+
/**
|
|
239
|
+
* Seam: reconcile a pod sandbox, or arm one of its timers (`DurableExecution.sandbox`). Call
|
|
240
|
+
* it from `t.afterCommit`. Dropped while the Tenant is closing; the sweep re-sends reconciles.
|
|
241
|
+
*/
|
|
242
|
+
sandboxSignal(sandboxId: string, signal: SandboxSignal): Promise<void>;
|
|
190
243
|
/** This Tenant's execution invocations that need an operator, for Tenant status. */
|
|
191
244
|
readonly stuckInvocations?: () => Promise<StuckInvocation[]>;
|
|
192
245
|
/** Callbacks the Tenant sweep runs after its own steps (`sweep.ts`). */
|
|
@@ -225,3 +278,9 @@ export declare function loadSession(ctx: TenantContext, id: string, access?: Ses
|
|
|
225
278
|
* the sandbox-sharing helpers, which walk that chain synchronously.
|
|
226
279
|
*/
|
|
227
280
|
export declare function sandboxLookup(t: Tx, start: string | undefined): Promise<(id: string) => Session | undefined>;
|
|
281
|
+
/** The sandboxes service a Tenant drives its pod sandboxes with (`TenantContext.pods`). */
|
|
282
|
+
export interface TenantPods {
|
|
283
|
+
readonly client: SandboxesClient;
|
|
284
|
+
/** The Runtime image the pods copy the engine from (`NYLORUN_SANDBOX_HARNESS_IMAGE`). */
|
|
285
|
+
readonly harnessImage: string;
|
|
286
|
+
}
|
package/dist/tenant/effects.d.ts
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's side of effects: `resolveNewFlowEffect` journals and dispatches new workflow effects
|
|
3
|
+
* (linked agent sessions, tool nodes, fn, verify); the takeover helpers say which calls their
|
|
4
|
+
* gate recovers. Also vault authorization for MCP servers. The journal of a run's effects is
|
|
5
|
+
* `harness-api/record.ts`; a harness readies the session's MCP servers itself (`session.mcp`).
|
|
6
|
+
*
|
|
7
|
+
* Every journal write runs in a transaction that locks the effect's session first and checks
|
|
8
|
+
* the advance's ownership epoch (`ownedSession`): after another Worker takes over, the next
|
|
9
|
+
* write throws `ownership.lost` and nothing is written. The model, MCP, sandbox and vault
|
|
10
|
+
* calls run between transactions, never inside one.
|
|
11
|
+
*/
|
|
12
|
+
import type { ActionOutcome } from "@nylorun/core/contracts";
|
|
1
13
|
import type { EffectResolution, HostEffect } from "@nylorun/harness/run";
|
|
14
|
+
import type { Tx } from "../store/types.js";
|
|
2
15
|
import type { AuthorizeResult } from "../vault/service.js";
|
|
3
16
|
import { type Lease, type Session, type TenantContext } from "./context.js";
|
|
4
|
-
import type { ModelProvider } from "../core/provider.js";
|
|
5
|
-
/** What one advance's segment decides for all its effects. */
|
|
6
|
-
export interface SegmentOptions {
|
|
7
|
-
/** Overrides the Tenant's model (the fixture-model Tenant setting, `model-setting.ts`). */
|
|
8
|
-
model?: ModelProvider;
|
|
9
|
-
}
|
|
10
17
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* advance decides what the abort means.
|
|
18
|
+
* The outcome of a flow `agent` effect once the linked turn it started ended, or undefined
|
|
19
|
+
* while it has not. The linked session may still show an earlier iteration's turn.
|
|
14
20
|
*/
|
|
15
|
-
export declare function
|
|
21
|
+
export declare function linkedOutcome(t: Tx, effect: {
|
|
22
|
+
request: HostEffect;
|
|
23
|
+
agentSessionId?: string;
|
|
24
|
+
}, agent: Session | undefined): Promise<ActionOutcome | undefined>;
|
|
16
25
|
/**
|
|
17
26
|
* True when this Tenant's remote MCP calls outlive the process that sent them (the gates
|
|
18
27
|
* service, F4.1 G3): after a takeover or a shutdown, the journaled call is re-sent and joins
|
|
@@ -27,11 +36,8 @@ export declare function isRemoteMcpEffect(s: Session, request: HostEffect): bool
|
|
|
27
36
|
* the running call or gets its outcome, instead of becoming `uncertain`.
|
|
28
37
|
*/
|
|
29
38
|
export declare function recoversModelCalls(ctx: TenantContext): boolean;
|
|
30
|
-
export declare function resolveEffect(ctx: TenantContext, request: HostEffect, signal: AbortSignal, lease: Lease, segment?: SegmentOptions): Promise<EffectResolution>;
|
|
31
39
|
/** Journal and dispatch a new flow effect (agent / tool node / fn / verify). */
|
|
32
40
|
export declare function resolveNewFlowEffect(ctx: TenantContext, request: HostEffect, signal: AbortSignal, lease: Lease): Promise<EffectResolution>;
|
|
33
|
-
/** Discover the session's MCP tools once, or reconnect and refresh diagnostics. */
|
|
34
|
-
export declare function prepareMcp(ctx: TenantContext, lease: Lease, signal: AbortSignal): Promise<void>;
|
|
35
41
|
/** Vault authorization for an MCP server request made on behalf of a session. */
|
|
36
42
|
export declare function authorize(ctx: TenantContext, sessionId: string, request: {
|
|
37
43
|
url: string;
|