@runuai/host 0.9.149 → 0.9.151
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/db/migrations/0027_cloud_credential_foundation.sql +51 -0
- package/db/migrations/0028_leased_engine_runtimes.sql +11 -0
- package/db/migrations/meta/_journal.json +14 -0
- package/db/schema.ts +188 -0
- package/lib/agent-cli.ts +11 -13
- package/lib/agent.ts +177 -7
- package/lib/agents/durable-proc.ts +56 -44
- package/lib/agents/registry.ts +19 -3
- package/lib/agents/session-state.ts +23 -10
- package/lib/agents/transport.ts +101 -69
- package/lib/apple-one-off.ts +277 -0
- package/lib/apple-runtime-recycle.ts +4 -3
- package/lib/attachments.ts +19 -17
- package/lib/capture-flow.ts +319 -0
- package/lib/cloud-credential-cleanup-adapter.ts +123 -0
- package/lib/cloud-credential-host.ts +512 -0
- package/lib/cloud-credential-leases.ts +2544 -0
- package/lib/cloud-credential-runtime.ts +1035 -0
- package/lib/codex-auth.ts +21 -1
- package/lib/container-runtime.ts +76 -0
- package/lib/credential-cleanup-inventory.ts +405 -0
- package/lib/credential-consumers/engine-anchor.ts +1876 -0
- package/lib/credential-consumers/engines.ts +773 -0
- package/lib/credential-consumers/github.ts +594 -0
- package/lib/credential-consumers/mcp.ts +384 -0
- package/lib/credential-consumers/task-files.ts +127 -0
- package/lib/credential-store-pickup.ts +15 -2
- package/lib/credential-store.ts +361 -33
- package/lib/credentials-activation-authority.ts +546 -0
- package/lib/credentials-purge.ts +1006 -0
- package/lib/db.ts +11 -0
- package/lib/docker-exec.ts +3 -1
- package/lib/engine-accounts.ts +42 -32
- package/lib/engine-connect.ts +47 -2
- package/lib/engine-credential-env.ts +50 -0
- package/lib/engine-login.ts +83 -1
- package/lib/env-file.ts +62 -8
- package/lib/env.ts +5 -0
- package/lib/fs-aliases.ts +49 -0
- package/lib/git-clone-credentials.ts +334 -0
- package/lib/git-diff.ts +219 -177
- package/lib/git-identity.ts +59 -14
- package/lib/github-origin.ts +28 -0
- package/lib/github-tokens.ts +56 -21
- package/lib/host-env.ts +17 -4
- package/lib/launch-mode.ts +25 -0
- package/lib/legacy-runtime-retirement.ts +388 -0
- package/lib/machine-exec.ts +14 -3
- package/lib/machine-provider-aws.ts +50 -8
- package/lib/machine-provider-local.ts +4 -0
- package/lib/machine-provider.ts +4 -0
- package/lib/managed-operation-drain.ts +8 -0
- package/lib/managed-runtime.ts +371 -7
- package/lib/mcp-capture.ts +860 -0
- package/lib/mcp-connections.ts +8 -1
- package/lib/mcp-gateway.ts +168 -10
- package/lib/obs.ts +2 -6
- package/lib/orchestrator.ts +1847 -236
- package/lib/person-capture.ts +327 -0
- package/lib/project-env-legacy-tags.ts +130 -0
- package/lib/project-env-task-replica.ts +1752 -0
- package/lib/runner-boot.ts +10 -0
- package/lib/runtime-activation-tail.ts +50 -3
- package/lib/runtime-archive.ts +68 -1
- package/lib/runtime-reconnect.ts +86 -0
- package/lib/runtime-state.ts +429 -13
- package/lib/safe-http.ts +364 -0
- package/lib/secrets-proxy/task-trust.ts +34 -3
- package/lib/sidecar-resume.ts +18 -5
- package/lib/skills.ts +47 -8
- package/lib/standard-image.ts +157 -103
- package/lib/stopped-task-status-queue.ts +68 -10
- package/lib/task-credential-cleanup.ts +525 -0
- package/lib/task-diff-sandbox.ts +464 -0
- package/lib/task-diff.ts +66 -163
- package/lib/task-env-source.ts +68 -14
- package/lib/task-environment/anchor.ts +31 -0
- package/lib/task-environment/apple-container.ts +69 -28
- package/lib/task-environment/docker.ts +101 -20
- package/lib/task-environment/machine-environment.ts +61 -0
- package/lib/task-environment/machine-task-up.ts +459 -96
- package/lib/task-environment/machine.ts +101 -11
- package/lib/task-environment/self.ts +108 -50
- package/lib/task-environment/types.ts +89 -5
- package/lib/task-environment/workspace-files.ts +623 -25
- package/lib/task-environment/workspace-runtime.fixture.ts +50 -0
- package/lib/task-gateway-recovery.ts +4 -1
- package/lib/task-gateway-state.ts +15 -0
- package/lib/task-machine-swap-safety.ts +729 -0
- package/lib/token-broker-adopt.ts +344 -0
- package/lib/token-broker-lambda.ts +56 -2
- package/lib/token-broker-local.ts +28 -4
- package/lib/token-broker-revision.ts +310 -0
- package/lib/token-broker-ssm.ts +368 -28
- package/lib/token-lanes/openai-oauth.ts +7 -3
- package/lib/token-lanes/xai-oauth.ts +7 -3
- package/lib/transcript.ts +9 -5
- package/package.json +6 -2
- package/scripts/agent/task-up.sh +242 -100
- package/src/cloud-credentials.ts +2399 -0
- package/src/event-outbox.ts +8 -6
- package/src/index.ts +1386 -875
- package/src/main.ts +1062 -140
- package/src/outbound-frame.ts +31 -0
- package/src/project-env-policy.ts +125 -10
- package/src/protocol.ts +699 -23
- package/src/ui/server.ts +48 -10
|
@@ -53,6 +53,15 @@ export interface TaskEnvironmentExecRequest {
|
|
|
53
53
|
* default capabilities); every other provider refuses it.
|
|
54
54
|
*/
|
|
55
55
|
privileged?: true;
|
|
56
|
+
/**
|
|
57
|
+
* ADR-154 §6: start the process under the engine supervisor, admitted by
|
|
58
|
+
* the runner and owned until a cleanup kills it. The provider runs, as
|
|
59
|
+
* root, the anchor's prefix, the task user the process would have run as
|
|
60
|
+
* (or "-" when the provider drops to it itself), "--", then the process
|
|
61
|
+
* as it would have run it; the supervisor drops to that user. A request
|
|
62
|
+
* that must run as root is never anchored.
|
|
63
|
+
*/
|
|
64
|
+
anchor?: TaskEnvironmentAnchor;
|
|
56
65
|
/**
|
|
57
66
|
* Called by the provider at the last moment before the process starts,
|
|
58
67
|
* after anything it awaits first (a machine looks up its address);
|
|
@@ -82,6 +91,27 @@ export interface TaskEnvironmentSpawnRequest {
|
|
|
82
91
|
projectEnvProfile: ProjectEnvProfile;
|
|
83
92
|
timeoutMs: number;
|
|
84
93
|
maxOutputBytes: number;
|
|
94
|
+
/** ADR-154 §6: see `TaskEnvironmentExecRequest.anchor`. */
|
|
95
|
+
anchor?: TaskEnvironmentAnchor;
|
|
96
|
+
/** See `TaskEnvironmentExecRequest.admit`. */
|
|
97
|
+
admit?: () => void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* ADR-154 §6: the engine supervisor a process starts under
|
|
102
|
+
* (credential-consumers/engine-anchor.ts): its argv up to the user it drops
|
|
103
|
+
* to.
|
|
104
|
+
*/
|
|
105
|
+
export interface TaskEnvironmentAnchor {
|
|
106
|
+
readonly prefix: readonly [string, ...string[]];
|
|
107
|
+
/**
|
|
108
|
+
* When the launch carries engine credentials in its admission: what a
|
|
109
|
+
* provider that drops to the task user itself (anchor user "-") runs
|
|
110
|
+
* right after that drop, before the process; it reads them from the
|
|
111
|
+
* supervisor's hand-off. A provider whose supervisor drops (a named user)
|
|
112
|
+
* ignores it: the supervisor hands them to the engine itself.
|
|
113
|
+
*/
|
|
114
|
+
readonly injector?: readonly [string, ...string[]];
|
|
85
115
|
}
|
|
86
116
|
|
|
87
117
|
/**
|
|
@@ -97,6 +127,10 @@ export interface TaskEnvironmentSessionRequest {
|
|
|
97
127
|
env?: Readonly<Record<string, string>>;
|
|
98
128
|
projectEnvProfile: ProjectEnvProfile;
|
|
99
129
|
maxOutputBytes: number;
|
|
130
|
+
/** ADR-154 §6: see `TaskEnvironmentExecRequest.anchor`. */
|
|
131
|
+
anchor?: TaskEnvironmentAnchor;
|
|
132
|
+
/** See `TaskEnvironmentExecRequest.admit`. */
|
|
133
|
+
admit?: () => void;
|
|
100
134
|
}
|
|
101
135
|
|
|
102
136
|
/** A bounded control-plane launch of a detached durable-session runner. */
|
|
@@ -132,6 +166,14 @@ export interface TaskEnvironmentProcess {
|
|
|
132
166
|
export interface TaskEnvironmentAgentSessionSurface {
|
|
133
167
|
readonly descriptor: TaskEnvironmentDescriptor;
|
|
134
168
|
readonly durableIdentity: string;
|
|
169
|
+
/** ADR-154 §6: whether the provider starts a request's `anchor`. One that
|
|
170
|
+
* does not never runs a leased engine. */
|
|
171
|
+
readonly anchors?: boolean;
|
|
172
|
+
/** ADR-154 §6: "admission" when a request's environment would reach a
|
|
173
|
+
* command line (a machine's ssh command, a local shell line), so a leased
|
|
174
|
+
* launch's engine credentials travel in its admission instead; absent
|
|
175
|
+
* when the provider passes them by name (`--env NAME`). */
|
|
176
|
+
readonly credentialDelivery?: "admission";
|
|
135
177
|
spawnSession(
|
|
136
178
|
request: TaskEnvironmentSessionRequest,
|
|
137
179
|
): Promise<TaskEnvironmentProcess>;
|
|
@@ -140,7 +182,7 @@ export interface TaskEnvironmentAgentSessionSurface {
|
|
|
140
182
|
): Promise<TaskEnvironmentExecResult>;
|
|
141
183
|
}
|
|
142
184
|
|
|
143
|
-
export type TaskEnvironmentCopyRequest =
|
|
185
|
+
export type TaskEnvironmentCopyRequest = (
|
|
144
186
|
| {
|
|
145
187
|
direction: "into";
|
|
146
188
|
/** Absolute host path. */
|
|
@@ -154,7 +196,31 @@ export type TaskEnvironmentCopyRequest =
|
|
|
154
196
|
source: string;
|
|
155
197
|
/** Absolute host path. */
|
|
156
198
|
destination: string;
|
|
157
|
-
}
|
|
199
|
+
}
|
|
200
|
+
) &
|
|
201
|
+
TaskEnvironmentCallOptions;
|
|
202
|
+
|
|
203
|
+
/** What every call into an environment may carry. */
|
|
204
|
+
export interface TaskEnvironmentCallOptions {
|
|
205
|
+
/** See `TaskEnvironmentExecRequest.admit`: the provider's last word before
|
|
206
|
+
* its process or transport starts, after anything it awaits first. */
|
|
207
|
+
admit?: () => void;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** How much of a workspace file a read takes. The task controls its
|
|
211
|
+
* workspace, so every read of it is bounded. */
|
|
212
|
+
export interface TaskEnvironmentReadOptions extends TaskEnvironmentCallOptions {
|
|
213
|
+
/** At most this many bytes (default `WORKSPACE_READ_MAX_BYTES`). */
|
|
214
|
+
maxBytes?: number;
|
|
215
|
+
/** Which end of a longer file is read: its start (the default) or its
|
|
216
|
+
* end. */
|
|
217
|
+
from?: "start" | "end";
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** The most a workspace read takes, unless it asks for less. */
|
|
221
|
+
export const WORKSPACE_READ_MAX_BYTES = 64 * 1024 * 1024;
|
|
222
|
+
/** How long a workspace read may take before it is given up. */
|
|
223
|
+
export const WORKSPACE_READ_TIMEOUT_MS = 60_000;
|
|
158
224
|
|
|
159
225
|
export interface TaskEnvironmentPort {
|
|
160
226
|
name?: string;
|
|
@@ -170,6 +236,9 @@ export type TaskEnvironmentStatus =
|
|
|
170
236
|
* `containers` field while that protocol remains in service. */
|
|
171
237
|
instances: string[];
|
|
172
238
|
workspacePresent: boolean;
|
|
239
|
+
/** Not running, yet its processes still exist (a paused or
|
|
240
|
+
* restarting container): they run again without a new start. */
|
|
241
|
+
frozen?: true;
|
|
173
242
|
}
|
|
174
243
|
| { state: "unknown"; detail: string };
|
|
175
244
|
|
|
@@ -221,9 +290,12 @@ export interface TaskEnvironmentHandle<TTeardownResult = void>
|
|
|
221
290
|
* (docker, apple) implement these as direct filesystem access — zero
|
|
222
291
|
* behavior change; machine providers reach over their transport. Read
|
|
223
292
|
* resolves null for a missing file and rejects for any other failure —
|
|
224
|
-
* absence and error are different facts.
|
|
225
|
-
|
|
226
|
-
|
|
293
|
+
* absence and error are different facts. A read takes only a regular
|
|
294
|
+
* file, never waits on one it opens (a FIFO or device is refused), takes
|
|
295
|
+
* at most `maxBytes`, and is given up past its bound: what the task puts
|
|
296
|
+
* in its workspace never stalls the runner. */
|
|
297
|
+
readWorkspaceFile(path: string, options?: TaskEnvironmentReadOptions): Promise<Uint8Array | null>;
|
|
298
|
+
writeWorkspaceFile(path: string, bytes: Uint8Array, options?: TaskEnvironmentCallOptions): Promise<void>;
|
|
227
299
|
exec(request: TaskEnvironmentExecRequest): Promise<TaskEnvironmentExecResult>;
|
|
228
300
|
spawn(request: TaskEnvironmentSpawnRequest): Promise<TaskEnvironmentProcess>;
|
|
229
301
|
copy(request: TaskEnvironmentCopyRequest): Promise<void>;
|
|
@@ -255,6 +327,7 @@ export interface TaskEnvironmentHandle<TTeardownResult = void>
|
|
|
255
327
|
gatewayTunnelSshArgs?(
|
|
256
328
|
machinePort: number,
|
|
257
329
|
hostPort: number,
|
|
330
|
+
options?: TaskEnvironmentCallOptions,
|
|
258
331
|
): Promise<string[]>;
|
|
259
332
|
}
|
|
260
333
|
|
|
@@ -388,6 +461,17 @@ export function assertTaskEnvironmentSessionRequest(
|
|
|
388
461
|
) {
|
|
389
462
|
throw new Error("task environment user must be a nonempty NUL-free value");
|
|
390
463
|
}
|
|
464
|
+
if (
|
|
465
|
+
request.anchor !== undefined &&
|
|
466
|
+
(request.user === "root" ||
|
|
467
|
+
!Array.isArray(request.anchor.prefix) ||
|
|
468
|
+
request.anchor.prefix.length === 0 ||
|
|
469
|
+
request.anchor.prefix.some(
|
|
470
|
+
(part) => typeof part !== "string" || part.length === 0 || part.includes("\0"),
|
|
471
|
+
))
|
|
472
|
+
) {
|
|
473
|
+
throw new Error("a task environment anchor must be a NUL-free argv for a task user's process");
|
|
474
|
+
}
|
|
391
475
|
if (
|
|
392
476
|
request.inheritEnv !== undefined &&
|
|
393
477
|
(!Array.isArray(request.inheritEnv) ||
|