@runuai/host 0.9.150 → 0.9.152
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 +1880 -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 +1837 -224
- 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 +650 -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 +1061 -139
- 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
package/src/ui/server.ts
CHANGED
|
@@ -25,6 +25,7 @@ import type { ZodType } from "zod";
|
|
|
25
25
|
|
|
26
26
|
import { agentMode } from "../../lib/agents/mode";
|
|
27
27
|
import { schema, type Db } from "../../lib/db";
|
|
28
|
+
import { whileOnOwnCredentials } from "../../lib/cloud-credential-host";
|
|
28
29
|
import { getOrchestrator } from "../../lib/orchestrator";
|
|
29
30
|
import { parsePreviewPortRuntimes } from "../../lib/preview-ports";
|
|
30
31
|
import { getCloudState } from "../../lib/cloud-state";
|
|
@@ -178,6 +179,38 @@ async function listenWithFallback(
|
|
|
178
179
|
);
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
/** The local UI's writes of an engine credential (a sign-in, a key, an
|
|
183
|
+
* account): refused once the runner is off its own credentials. */
|
|
184
|
+
const ENGINE_CREDENTIAL_ROUTES: ReadonlySet<string> = new Set([
|
|
185
|
+
"/api/engines/connect",
|
|
186
|
+
"/api/engines/disconnect",
|
|
187
|
+
"/api/engines/accounts/connect",
|
|
188
|
+
"/api/engines/accounts/add",
|
|
189
|
+
"/api/engines/accounts/remove",
|
|
190
|
+
]);
|
|
191
|
+
|
|
192
|
+
async function handleEngineCredentialWrite(
|
|
193
|
+
path: string,
|
|
194
|
+
req: IncomingMessage,
|
|
195
|
+
res: ServerResponse,
|
|
196
|
+
opts: UiServerOptions,
|
|
197
|
+
): Promise<void> {
|
|
198
|
+
switch (path) {
|
|
199
|
+
case "/api/engines/connect":
|
|
200
|
+
return handleEngineConnect(req, res, opts);
|
|
201
|
+
case "/api/engines/disconnect":
|
|
202
|
+
return handleEngineDisconnect(req, res, opts);
|
|
203
|
+
case "/api/engines/accounts/connect":
|
|
204
|
+
return handleEngineAccountConnect(req, res, opts);
|
|
205
|
+
case "/api/engines/accounts/add":
|
|
206
|
+
return handleEngineAccountAdd(req, res, opts);
|
|
207
|
+
case "/api/engines/accounts/remove":
|
|
208
|
+
return handleEngineAccountRemove(req, res, opts);
|
|
209
|
+
default:
|
|
210
|
+
return sendError(res, 404, `no such endpoint: ${path}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
181
214
|
async function handle(
|
|
182
215
|
req: IncomingMessage,
|
|
183
216
|
res: ServerResponse,
|
|
@@ -192,19 +225,24 @@ async function handle(
|
|
|
192
225
|
// POST — engine connect/disconnect (the only writes; localhost-bound, so
|
|
193
226
|
// the loopback binding is the perimeter, ADR-028).
|
|
194
227
|
if (method === "POST") {
|
|
228
|
+
// ADR-154 §13: an engine credential is written here only while the
|
|
229
|
+
// runner is on its own credentials, as work on them that leaving them
|
|
230
|
+
// waits for; off them it keeps none, and Connections in Uai Cloud
|
|
231
|
+
// holds them.
|
|
232
|
+
if (ENGINE_CREDENTIAL_ROUTES.has(path)) {
|
|
233
|
+
const write = whileOnOwnCredentials(() => handleEngineCredentialWrite(path, req, res, opts));
|
|
234
|
+
if (write === null) {
|
|
235
|
+
return sendError(
|
|
236
|
+
res,
|
|
237
|
+
409,
|
|
238
|
+
"this runner reads its credentials from Uai Cloud; manage them in Connections",
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
return await write;
|
|
242
|
+
}
|
|
195
243
|
switch (path) {
|
|
196
|
-
case "/api/engines/connect":
|
|
197
|
-
return await handleEngineConnect(req, res, opts);
|
|
198
244
|
case "/api/engines/install":
|
|
199
245
|
return await handleEngineInstall(req, res);
|
|
200
|
-
case "/api/engines/disconnect":
|
|
201
|
-
return await handleEngineDisconnect(req, res, opts);
|
|
202
|
-
case "/api/engines/accounts/connect":
|
|
203
|
-
return await handleEngineAccountConnect(req, res, opts);
|
|
204
|
-
case "/api/engines/accounts/add":
|
|
205
|
-
return await handleEngineAccountAdd(req, res, opts);
|
|
206
|
-
case "/api/engines/accounts/remove":
|
|
207
|
-
return await handleEngineAccountRemove(req, res, opts);
|
|
208
246
|
case "/api/tasks/stop":
|
|
209
247
|
return await handleTaskStop(req, res, opts);
|
|
210
248
|
case "/api/runtime/recheck": {
|