@runuai/host 0.9.152 → 0.9.154
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/0029_task_shared_files_mode.sql +5 -0
- package/db/migrations/meta/_journal.json +7 -0
- package/db/schema.ts +10 -0
- package/lib/agent.ts +4 -0
- package/lib/browser-testing.ts +8 -3
- package/lib/cloud-credential-leases.ts +24 -4
- package/lib/cloud-credential-runtime.ts +322 -17
- package/lib/credential-cleanup-inventory.ts +2 -0
- package/lib/credential-consumers/files.ts +934 -0
- package/lib/credential-consumers/github.ts +140 -32
- package/lib/credential-consumers/mcp.ts +6 -1
- package/lib/mcp-gateway.ts +576 -122
- package/lib/orchestrator.ts +91 -9
- package/lib/runtime-state.ts +88 -0
- package/lib/shared-files-s3.ts +743 -3
- package/lib/sidecar-resume.ts +9 -0
- package/lib/task-credential-cleanup.ts +36 -5
- package/lib/task-environment/machine-task-up.ts +35 -19
- package/lib/task-files-machine-retirement.ts +88 -0
- package/lib/task-files-readiness.ts +127 -0
- package/lib/task-person-credentials.ts +76 -0
- package/package.json +1 -1
- package/src/cloud-credentials.ts +10 -0
- package/src/index.ts +40 -7
- package/src/main.ts +49 -2
package/src/main.ts
CHANGED
|
@@ -28,7 +28,9 @@ import {
|
|
|
28
28
|
closeTaskRunAssignment,
|
|
29
29
|
getHostTask,
|
|
30
30
|
hasInFlightHostTaskLifecycle,
|
|
31
|
+
hostTaskSharedFilesMode,
|
|
31
32
|
readTaskRunEpochState,
|
|
33
|
+
taskFilesRecoveryBinding,
|
|
32
34
|
upsertHostTask,
|
|
33
35
|
} from "../lib/runtime-state";
|
|
34
36
|
import {
|
|
@@ -112,6 +114,7 @@ import {
|
|
|
112
114
|
parseLeaseGrantV1Frame,
|
|
113
115
|
parseLeaseStaleFrame,
|
|
114
116
|
parseLeaseUnavailableFrame,
|
|
117
|
+
HOST_TASK_FILES_LEASE_FEATURE,
|
|
115
118
|
} from "./cloud-credentials";
|
|
116
119
|
import { captureEngineAccount } from "../lib/capture-flow";
|
|
117
120
|
import { registerTaskGatewayTlsHandler, setMcpGatewayLeaseOnly, startMcpGateway } from "../lib/mcp-gateway";
|
|
@@ -175,6 +178,7 @@ import {
|
|
|
175
178
|
reprobeContainerRuntimeMachineIdentity,
|
|
176
179
|
} from "../lib/container-runtime";
|
|
177
180
|
import { persistedTaskEnvironmentsMatchMachine, reconstructPersistedTaskEnvironment } from "../lib/task-environment";
|
|
181
|
+
import { reconcileRunningTaskPersonCredentials } from "../lib/task-person-credentials";
|
|
178
182
|
import { logVnodePressure } from "../lib/vnode-pressure";
|
|
179
183
|
import { resolveAppleTunnelRoute } from "./apple-tunnel-route";
|
|
180
184
|
import {
|
|
@@ -408,6 +412,12 @@ import {
|
|
|
408
412
|
} from "../lib/legacy-runtime-retirement";
|
|
409
413
|
import { taskContainerBackend, taskContainerCli } from "../lib/task-container-cli";
|
|
410
414
|
import { CloudCredentialRuntime } from "../lib/cloud-credential-runtime";
|
|
415
|
+
import { createTaskFilesV1Consumer } from "../lib/credential-consumers/files";
|
|
416
|
+
import { taskFilesV1Readiness } from "../lib/task-files-readiness";
|
|
417
|
+
import {
|
|
418
|
+
requestTaskFilesMachineRetirement,
|
|
419
|
+
taskFilesMachineRetirementReady,
|
|
420
|
+
} from "../lib/task-files-machine-retirement";
|
|
411
421
|
import { ProjectEnvTaskReplicaManager } from "../lib/project-env-task-replica";
|
|
412
422
|
import {
|
|
413
423
|
purgeDefaultEngineSlots,
|
|
@@ -908,15 +918,30 @@ if (signInBoxMode()) {
|
|
|
908
918
|
// ADR-154: the composer for tasks on cloud credentials. Nothing runs on it
|
|
909
919
|
// until the runner's activation authority makes cloud credentials its
|
|
910
920
|
// tasks' only ones (lib/cloud-credential-host.ts).
|
|
921
|
+
const taskFilesReadiness = taskFilesV1Readiness(sidecarMode());
|
|
922
|
+
const taskFiles = sidecarMode()
|
|
923
|
+
? createTaskFilesV1Consumer({
|
|
924
|
+
recoveredBinding: (assignment) => {
|
|
925
|
+
return taskFilesRecoveryBinding(getHostTask(assignment.taskId), assignment);
|
|
926
|
+
},
|
|
927
|
+
ready: () =>
|
|
928
|
+
taskFilesV1Readiness(true).ready &&
|
|
929
|
+
taskFilesMachineRetirementReady(),
|
|
930
|
+
retireMachine: requestTaskFilesMachineRetirement,
|
|
931
|
+
})
|
|
932
|
+
: null;
|
|
911
933
|
const cloudCredentials = new CloudCredentialRuntime({
|
|
912
934
|
runnerKind: sidecarMode() ? "task-machine" : "owned",
|
|
913
935
|
send: sendCredentialFrame,
|
|
914
936
|
quiesceProcesses: (request) => getOrchestrator().quiesceLeasedEngineAgents(request),
|
|
937
|
+
mcpServedChanged: (taskId) => getOrchestrator().mcpServedChanged(taskId),
|
|
915
938
|
// The task-keyed env replica the cloud streams for each run. A change to
|
|
916
939
|
// it, or to what the composer serves from it, makes the proxy's trust
|
|
917
940
|
// delivery look again; /env reads it afresh on every command.
|
|
918
941
|
envReplica: new ProjectEnvTaskReplicaManager({ onChange: () => noteProjectEnvViewChange() }),
|
|
919
942
|
envServedChanged: () => noteProjectEnvViewChange(),
|
|
943
|
+
personCredentialsReady: reconcileRunningTaskPersonCredentials,
|
|
944
|
+
files: taskFiles,
|
|
920
945
|
});
|
|
921
946
|
// Leaving its own credentials ends every task's env from the runner's
|
|
922
947
|
// stores at once, and makes the proxy's trust delivery look again.
|
|
@@ -926,8 +951,25 @@ followLeavingLegacy();
|
|
|
926
951
|
// from its own run's Files session, never the runner's v0 lease); and the
|
|
927
952
|
// proxy's upkeep from activation on, with no v0 first grant to start it.
|
|
928
953
|
if (sidecarMode()) {
|
|
929
|
-
setRecoveredRuntimeSetup(async (
|
|
930
|
-
const
|
|
954
|
+
setRecoveredRuntimeSetup(async (run, signal) => {
|
|
955
|
+
const task = getHostTask(run.taskId);
|
|
956
|
+
let mode: ReturnType<typeof hostTaskSharedFilesMode>;
|
|
957
|
+
try {
|
|
958
|
+
mode = task ? hostTaskSharedFilesMode(task) : null;
|
|
959
|
+
if (mode === null) {
|
|
960
|
+
throw new Error("the recovered task has no trusted Files-v1 mode");
|
|
961
|
+
}
|
|
962
|
+
} catch (error) {
|
|
963
|
+
if (signal.aborted) throw signal.reason;
|
|
964
|
+
cloudCredentials.failTaskFilesSetup(run, error);
|
|
965
|
+
throw error;
|
|
966
|
+
}
|
|
967
|
+
const resumed = await resumeSidecarTask({
|
|
968
|
+
remountFiles: false,
|
|
969
|
+
signal,
|
|
970
|
+
prepareFiles: (handle) =>
|
|
971
|
+
cloudCredentials.prepareTaskFiles(run, handle, mode, signal),
|
|
972
|
+
});
|
|
931
973
|
if (resumed.outcome === "resumed") {
|
|
932
974
|
console.log(
|
|
933
975
|
`[sidecar] task ${sidecarTaskId()} resumed on cloud credentials: loader, proxy and editor re-asserted` +
|
|
@@ -1365,6 +1407,11 @@ function buildCapabilities(): HostCapabilities {
|
|
|
1365
1407
|
...(projectEnvBindings === null ? [] : [projectEnvBindings.feature]),
|
|
1366
1408
|
// ADR-154 §13: the runner reads cloud credentials, its stores purged.
|
|
1367
1409
|
...(credentialsMode() === "active" ? [HOST_CLOUD_CREDENTIALS_FEATURE] : []),
|
|
1410
|
+
...(taskFiles !== null &&
|
|
1411
|
+
taskFilesReadiness.ready &&
|
|
1412
|
+
taskFilesMachineRetirementReady()
|
|
1413
|
+
? [HOST_TASK_FILES_LEASE_FEATURE]
|
|
1414
|
+
: []),
|
|
1368
1415
|
// ADR-154: only the sign-in box writes cloud credentials.
|
|
1369
1416
|
...(signInBoxMode()
|
|
1370
1417
|
? [
|