@nylorun/runtime 0.24.0-beta → 0.25.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 +104 -0
- package/README.md +10 -2
- package/dist/api/a2a/card.d.ts +11 -1
- package/dist/api/a2a/card.js +26 -2
- package/dist/api/a2a/endpoint.js +4 -2
- package/dist/api/a2a/protocol.d.ts +25 -2
- package/dist/api/a2a/protocol.js +20 -3
- package/dist/api/a2a/routes.d.ts +4 -1
- package/dist/api/a2a/routes.js +65 -7
- package/dist/api/ag-ui/endpoint.js +5 -2
- package/dist/api/ag-ui/history.d.ts +6 -1
- package/dist/api/ag-ui/history.js +35 -2
- package/dist/api/ag-ui/routes.js +53 -11
- package/dist/api/components.d.ts +1165 -678
- package/dist/api/components.js +16 -1
- package/dist/api/gate/keys.d.ts +2 -1
- package/dist/api/gate/keys.js +7 -0
- package/dist/api/gate/routes.js +13 -0
- package/dist/api/http/app.js +13 -2
- package/dist/api/http/body.d.ts +3 -3
- package/dist/api/http/body.js +7 -7
- package/dist/api/http/routes/environment-manifests.d.ts +9 -0
- package/dist/api/http/routes/environment-manifests.js +118 -0
- package/dist/api/http/routes/environments.js +61 -12
- package/dist/api/http/routes/reads.d.ts +52 -3
- package/dist/api/http/routes/sessions.js +13 -3
- package/dist/api/http/routes/tenant.js +35 -7
- package/dist/api/inbound-files.d.ts +65 -0
- package/dist/api/inbound-files.js +115 -0
- package/dist/api/openapi.js +18 -3
- package/dist/artifacts/disk.js +20 -14
- package/dist/artifacts/media-types.d.ts +15 -0
- package/dist/artifacts/media-types.js +56 -4
- package/dist/artifacts/parts.d.ts +12 -3
- package/dist/artifacts/parts.js +15 -4
- package/dist/artifacts/workspace.d.ts +4 -4
- package/dist/artifacts/workspace.js +6 -18
- package/dist/core/flow-host.d.ts +1 -1
- package/dist/core/flow-host.js +2 -2
- package/dist/core/sandbox-routes.js +2 -2
- package/dist/core/turn-manifest.d.ts +3 -2
- package/dist/core/turn-manifest.js +29 -5
- package/dist/gates/egress-credentials.js +1 -1
- package/dist/gates/egress.d.ts +13 -19
- package/dist/gates/egress.js +30 -29
- package/dist/gates/http-tool.d.ts +3 -4
- package/dist/gates/http-tool.js +8 -12
- package/dist/gates/journal.js +0 -1
- package/dist/gates/mcp-handler.js +2 -3
- package/dist/gates/policy.js +1 -3
- package/dist/gates/tool-contract.d.ts +1 -1
- package/dist/harness/calls.d.ts +2 -2
- package/dist/harness/calls.js +9 -12
- package/dist/harness/main.js +7 -1
- package/dist/harness/pod.d.ts +6 -1
- package/dist/harness/pod.js +5 -0
- package/dist/harness/service.js +5 -5
- package/dist/harness/setup.d.ts +2 -0
- package/dist/harness/setup.js +25 -1
- package/dist/harness-api/record.d.ts +1 -1
- package/dist/harness-api/record.js +13 -13
- package/dist/harness-api/server.d.ts +27 -4
- package/dist/harness-api/server.js +41 -8
- package/dist/harness-api/tool-journal.d.ts +17 -8
- package/dist/harness-api/tool-journal.js +41 -11
- package/dist/harness-api/workspace.d.ts +7 -5
- package/dist/harness-api/workspace.js +25 -19
- package/dist/host/gates.js +2 -2
- package/dist/host/stack-config.js +1 -1
- package/dist/keys/keys.d.ts +9 -2
- package/dist/keys/keys.js +4 -1
- package/dist/management-openapi.json +366 -61
- package/dist/mcp/connect.d.ts +1 -2
- package/dist/mcp/connect.js +1 -4
- package/dist/mcp/pool.d.ts +1 -4
- package/dist/mcp/pool.js +13 -27
- package/dist/mcp/preview.js +0 -1
- package/dist/mcp/snapshot.d.ts +11 -13
- package/dist/mcp/snapshot.js +27 -38
- package/dist/model/capabilities.d.ts +26 -0
- package/dist/model/capabilities.js +44 -0
- package/dist/model/catalog.d.ts +34 -3
- package/dist/model/catalog.js +38 -2
- package/dist/model/models.d.ts +2 -0
- package/dist/model/models.js +1 -1
- package/dist/model/native-blocks.d.ts +35 -0
- package/dist/model/native-blocks.js +170 -0
- package/dist/model/pi-model.js +106 -94
- package/dist/openapi.json +9554 -5104
- package/dist/record/environment.js +1 -1
- package/dist/sandbox/join.js +4 -0
- package/dist/sandbox/manager.d.ts +32 -14
- package/dist/sandbox/manager.js +132 -93
- package/dist/sandbox/placement.d.ts +1 -1
- package/dist/sandbox/placement.js +2 -2
- package/dist/sandbox/pods/client.d.ts +3 -1
- package/dist/sandbox/pods/lifecycle.d.ts +8 -0
- package/dist/sandbox/pods/lifecycle.js +15 -0
- package/dist/sandbox/pods/spec.js +2 -1
- package/dist/sandbox/resolve.d.ts +5 -3
- package/dist/sandbox/resolve.js +9 -2
- package/dist/sandbox/runtime-tools.d.ts +9 -0
- package/dist/sandbox/runtime-tools.js +16 -0
- package/dist/sandbox/session-sandbox.d.ts +4 -6
- package/dist/sandbox/session-sandbox.js +47 -94
- package/dist/sandbox/setup.d.ts +4 -1
- package/dist/sandbox/setup.js +46 -9
- package/dist/sandbox/share.d.ts +12 -7
- package/dist/sandbox/share.js +27 -25
- package/dist/sandbox/skills.d.ts +8 -6
- package/dist/sandbox/skills.js +24 -23
- package/dist/store/postgres/drizzle/0024_flat_manifest.sql +7 -0
- package/dist/store/postgres/drizzle/0025_environment_manifests.sql +14 -0
- package/dist/store/postgres/drizzle/0026_environment_forks.sql +1 -0
- package/dist/store/postgres/drizzle/0027_environment_image_digest.sql +1 -0
- package/dist/store/postgres/drizzle/meta/_journal.json +28 -0
- package/dist/store/postgres/reads.js +8 -2
- package/dist/store/postgres/schema.d.ts +217 -0
- package/dist/store/postgres/schema.js +36 -2
- package/dist/store/postgres/store.js +79 -4
- package/dist/store/types.d.ts +68 -14
- package/dist/tenant/advance.js +3 -0
- package/dist/tenant/artifact-tool.d.ts +1 -1
- package/dist/tenant/artifact-tool.js +43 -22
- package/dist/tenant/commands.js +24 -4
- package/dist/tenant/context.d.ts +10 -4
- package/dist/tenant/effects.js +7 -9
- package/dist/tenant/environment-manifests.d.ts +57 -0
- package/dist/tenant/environment-manifests.js +200 -0
- package/dist/tenant/environments.d.ts +54 -47
- package/dist/tenant/environments.js +304 -83
- package/dist/tenant/model-setting.d.ts +14 -0
- package/dist/tenant/model-setting.js +51 -0
- package/dist/tenant/sessions.d.ts +5 -1
- package/dist/tenant/sessions.js +45 -12
- package/dist/tenant/skill-tool.d.ts +3 -3
- package/dist/tenant/skill-tool.js +6 -11
- package/dist/tenant/sweep.js +1 -1
- package/dist/tenant/tool-results.js +1 -1
- package/dist/tenant/tool-search.d.ts +7 -11
- package/dist/tenant/tool-search.js +8 -5
- package/dist/tenant/transcript.d.ts +51 -32
- package/dist/tenant/transcript.js +2 -1
- package/dist/traces/ids.d.ts +0 -1
- package/dist/traces/ids.js +0 -4
- package/dist/traces/map.d.ts +2 -2
- package/dist/traces/map.js +1 -29
- package/dist/vault/coverage.js +11 -13
- package/dist/vault/host-model.d.ts +4 -1
- package/dist/vault/host-model.js +10 -2
- package/dist/vault/service.d.ts +49 -4
- package/dist/vault/service.js +153 -6
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/sandbox/capability.d.ts +0 -3
- package/dist/sandbox/capability.js +0 -10
|
@@ -1,43 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* list by label, stop, reset and the lifecycle stream; sessions naming one with `environment`,
|
|
4
|
-
* and the checks every turn start makes on it.
|
|
5
|
-
*
|
|
6
|
-
* - **No scope.** The Runtime decides nothing about who uses an Environment: the app maps its
|
|
7
|
-
* people and agents to ids. It stores the id, kind, recipe, labels and the optional owner
|
|
8
|
-
* guard; the session body names the Environment (`Session.environmentId`), and deleting a
|
|
9
|
-
* session (a sessions reset) only detaches it.
|
|
10
|
-
* - **One sandbox, one vault.** Kind `virtual` (a just-bash workspace in the harness container,
|
|
11
|
-
* keyed by the Environment id and created on the first tool call), `pod` (an agent-sandbox pod
|
|
12
|
-
* on the Tenant's cluster, Host feature `sandbox-pods`, created at once) or `none` (no compute).
|
|
13
|
-
* Each has one vault (`vault/service.ts`), created and deleted with it in one transaction.
|
|
14
|
-
* - **A recipe that changes.** `PUT` on an existing id compares the fields sent: `kind` and
|
|
15
|
-
* `storage` are fixed (`409`), labels replace, and any other change writes the recipe and bumps
|
|
16
|
-
* `version`. A pod runs `applied`: image and resources reach it when it is next asked to run
|
|
17
|
-
* from stopped (`wantRunning`), so nothing swaps them mid-turn; so does `harness`, which picks
|
|
18
|
-
* what the pod runs (R4.4). Network and lifecycle apply at once. A virtual or `none`
|
|
19
|
-
* Environment applies every change at once.
|
|
20
|
-
* - **Access.** An application key reaches every Environment, and so does an application key
|
|
21
|
-
* acting for a subject (`Nylorun-Subject`), which needs `environments:write` to change one. A
|
|
22
|
-
* token caller reaches only the ids its grants match, and changes them only with
|
|
23
|
-
* `environments:write`; any other id is the 404 of a missing one.
|
|
24
|
-
* - **The owner guard.** When `ownerUserId` is set, only that owner's sessions may name the
|
|
25
|
-
* Environment, checked when a session opens and at every turn start (`403
|
|
26
|
-
* environment_owner_mismatch`; the opaque 404 to a caller acting for a person).
|
|
27
|
-
* - **Serial turns.** One turn at a time per Environment with a sandbox: a session whose
|
|
28
|
-
* Environment another session's turn holds is refused (`409 environment_busy`).
|
|
29
|
-
* - **Lifecycle.** `POST .../stop` suspends a pod (the volume is kept; the next turn starts it),
|
|
30
|
-
* `POST .../reset` gives it a new pod on a new volume. A lost pod refuses turns
|
|
31
|
-
* (`environment_lost`) until a reset. `lifecycle.deleteAfter` deletes an Environment unused
|
|
32
|
-
* for that long (the Tenant sweep, `sweepUnusedEnvironments`). Deleting a pod Environment keeps
|
|
33
|
-
* its row (`desired: deleted`, invisible here) until its Sandbox is gone; its vault goes at once.
|
|
34
|
-
* - **Lifecycle events** go to the Environment's own stream in the record (`Tx.environmentEvent`,
|
|
35
|
-
* `record/environment.ts`); the session's log records `environment.attached` too.
|
|
36
|
-
*/
|
|
37
|
-
import { type EnvironmentView, type PutEnvironmentRequest } from "@nylorun/core/contracts";
|
|
38
|
-
import type { Environment, Tx } from "../store/types.js";
|
|
1
|
+
import { type EnvironmentRecipe, type EnvironmentView, type ForkEnvironmentRequest, type ForkEnvironmentResponse, type PutEnvironmentRequest, type PutEnvironmentSecretRequest } from "@nylorun/core/contracts";
|
|
2
|
+
import type { Environment, EnvironmentEventsQuery, Tx } from "../store/types.js";
|
|
39
3
|
import type { SandboxRouteDeps } from "../core/sandbox-routes.js";
|
|
40
4
|
import { type AuthScope, type Session, type TenantContext } from "./context.js";
|
|
5
|
+
import type { SealedSecretCopies } from "../vault/service.js";
|
|
41
6
|
/** The Environment grants that limit `scope`, or undefined when it reaches every Environment. */
|
|
42
7
|
export declare function environmentGrantsOf(scope: AuthScope): readonly string[] | undefined;
|
|
43
8
|
/** Who the vault's audit rows name for a request: the subject, else the application. */
|
|
@@ -48,13 +13,54 @@ export declare function assertReaches(scope: AuthScope, id: string): void;
|
|
|
48
13
|
export declare function liveEnvironment(t: Tx, id: string, options?: {
|
|
49
14
|
lock?: boolean;
|
|
50
15
|
}): Promise<Environment | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Why input files cannot be used: each that is not a version of a Tenant-wide artifact (a
|
|
18
|
+
* session's artifacts go with the session). Pins nothing else: the version is the one named.
|
|
19
|
+
*/
|
|
20
|
+
export declare function fileErrors(t: Tx, files: EnvironmentRecipe["files"]): Promise<string[]>;
|
|
51
21
|
/**
|
|
52
22
|
* `PUT /v1/environments/{id}`: creates the Environment and its vault (within the Tenant's limit
|
|
53
|
-
* on their number)
|
|
54
|
-
*
|
|
55
|
-
*
|
|
23
|
+
* on their number) from an environment manifest's version or from the inline fields, or finds
|
|
24
|
+
* the one with this id, so "get or create" is one call. An existing one never changes what it
|
|
25
|
+
* runs (D63): its labels and owner guard may change, fields that match are accepted, and any
|
|
26
|
+
* other difference is `409 environment_immutable`. Every `PUT` counts as the Environment's use.
|
|
27
|
+
*/
|
|
28
|
+
export declare function putEnvironment(ctx: TenantContext, id: string, body: PutEnvironmentRequest, scope: AuthScope, options?: {
|
|
29
|
+
fork?: Fork;
|
|
30
|
+
}): Promise<EnvironmentView>;
|
|
31
|
+
/**
|
|
32
|
+
* The secret write `raw` asks of Environment `id` (D64). When what it runs declares secret
|
|
33
|
+
* slots, the name must be one (`409 secret_not_in_manifest`), and the body is `{ value }` (or
|
|
34
|
+
* `{ headers }` for a `headers` slot) with the binding from the slot; a full typed body is
|
|
35
|
+
* accepted only when its binding is the slot's. Without slots, today's typed body.
|
|
36
|
+
*/
|
|
37
|
+
export declare function secretRequestFor(ctx: TenantContext, id: string, name: string, raw: unknown): Promise<PutEnvironmentSecretRequest>;
|
|
38
|
+
/** What a create does for a fork (`POST .../fork`); `copied` is filled in by the create. */
|
|
39
|
+
interface Fork {
|
|
40
|
+
source: string;
|
|
41
|
+
setup: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The source's secrets sealed by keys for the new vault `vaultId` (F4.2), before the create's
|
|
44
|
+
* transaction, which inserts them; absent with `secrets: none`.
|
|
45
|
+
*/
|
|
46
|
+
sealed?: {
|
|
47
|
+
vaultId: string;
|
|
48
|
+
copies: SealedSecretCopies;
|
|
49
|
+
};
|
|
50
|
+
copied?: {
|
|
51
|
+
copied: string[];
|
|
52
|
+
dropped: string[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `POST /v1/environments/{id}/fork` (Q15): how an Environment gets a new manifest version. A new
|
|
57
|
+
* Environment `body.id` is made from the manifest version (default the source's manifest at its
|
|
58
|
+
* latest), its disk started from a version of the source's (`latest` takes a snapshot first,
|
|
59
|
+
* refused during a turn), and its secrets copied inside the Runtime. A fork onto other setup
|
|
60
|
+
* runs that setup on the copied disk before its first turn (Q17). The source keeps what it runs,
|
|
61
|
+
* its disk and its sessions. With `dryRun`, the plan only.
|
|
56
62
|
*/
|
|
57
|
-
export declare function
|
|
63
|
+
export declare function forkEnvironment(ctx: TenantContext, sourceId: string, body: ForkEnvironmentRequest, scope: AuthScope): Promise<ForkEnvironmentResponse>;
|
|
58
64
|
/** `GET /v1/environments/{id}`. */
|
|
59
65
|
export declare function getEnvironment(ctx: TenantContext, id: string, scope: AuthScope): Promise<EnvironmentView>;
|
|
60
66
|
/** `GET /v1/environments?label=k=v`: every Environment with all the labels, that the caller reaches. */
|
|
@@ -113,7 +119,7 @@ export declare function newVolume(ctx: TenantContext, t: Tx, environment: Enviro
|
|
|
113
119
|
/** How long a pending seed holds the disk before another process may take it over. */
|
|
114
120
|
export declare const SEED_LEASE_MS: number;
|
|
115
121
|
/** `GET /v1/environments/{id}/events`: the Environment's lifecycle stream. */
|
|
116
|
-
export declare function environmentEventsOf(ctx: TenantContext, id: string, scope: AuthScope,
|
|
122
|
+
export declare function environmentEventsOf(ctx: TenantContext, id: string, scope: AuthScope, query?: EnvironmentEventsQuery): Promise<{
|
|
117
123
|
events: {
|
|
118
124
|
schema: "nylorun.environment-event/1";
|
|
119
125
|
eventId: string;
|
|
@@ -121,7 +127,7 @@ export declare function environmentEventsOf(ctx: TenantContext, id: string, scop
|
|
|
121
127
|
environmentId: string;
|
|
122
128
|
seq: number;
|
|
123
129
|
time: string;
|
|
124
|
-
type: "environment.attached" | "environment.created" | "environment.deleted" | "environment.detached" | "environment.egress" | "environment.failed" | "environment.lost" | "environment.relaunched" | "environment.reset" | "environment.running" | "environment.suspended";
|
|
130
|
+
type: "environment.attached" | "environment.created" | "environment.deleted" | "environment.detached" | "environment.egress" | "environment.failed" | "environment.forked" | "environment.lost" | "environment.relaunched" | "environment.reset" | "environment.running" | "environment.suspended";
|
|
125
131
|
payload: Record<string, unknown>;
|
|
126
132
|
}[];
|
|
127
133
|
}>;
|
|
@@ -140,9 +146,9 @@ export declare function recordAttachment(t: Tx, sessionId: string, environmentId
|
|
|
140
146
|
/**
|
|
141
147
|
* Checks a turn start on a session that names an Environment, in the command's transaction
|
|
142
148
|
* after the session row lock: the Environment still exists, a token caller's grants reach it,
|
|
143
|
-
* its owner guard admits the session's owner, and
|
|
144
|
-
*
|
|
145
|
-
* one Environment are decided one after the other.
|
|
149
|
+
* its owner guard admits the session's owner, and no disk copy holds it. Other sessions' turns
|
|
150
|
+
* do not stop it (D66). Holds the Environment row's lock until the transaction ends, so a turn
|
|
151
|
+
* start and disk work on one Environment are decided one after the other.
|
|
146
152
|
*
|
|
147
153
|
* A pod Environment must also be usable: not lost (`environment_lost`), on a Runtime with
|
|
148
154
|
* sandbox pods (`environment_unavailable`). A stopped or failed pod is asked to run again, with
|
|
@@ -165,3 +171,4 @@ export declare function touchEnvironment(ctx: TenantContext, id: string): Promis
|
|
|
165
171
|
export declare function rearmPodTimers(ctx: TenantContext): Promise<void>;
|
|
166
172
|
/** Session lookups for the sandbox route handlers (`core/sandbox-routes.ts`). */
|
|
167
173
|
export declare function sandboxRouteDeps(ctx: TenantContext): SandboxRouteDeps;
|
|
174
|
+
export {};
|