@atolis-hq/wake 0.4.21 → 0.4.22
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.
|
@@ -9,7 +9,7 @@ import { BuiltInActivityName, agentActivityDefinition } from '../activities/inde
|
|
|
9
9
|
import { IntakeHost, ResidentHost, TickHost, } from '../control-plane/index.js';
|
|
10
10
|
import { ExecutionCancellationReason, ExecutionFailureCode, RunStatus, isActiveRunStatus, loadPromptTemplate, } from '../execution/index.js';
|
|
11
11
|
import { ResourceCorrelationRole, resourceId } from '../resources/index.js';
|
|
12
|
-
import { DockerProcessError, createApiDispatcher, createLoggedDockerCli, createPackagedAssetSource, createPairingGrant, createProcessLogSink, createSandboxDockerPort, createSurfaceHttpServer, drainProcessOutput, loadOrCreateCredentials, redeemPairingGrant, replaceAccessKey, runDoctor, runSandbox, runSandboxEntrypoint, runSandboxSetup, runSelfUpdateLatestLoop, runTargetSmoke, verifyResidentStart, waitForActiveRuns, waitForever, } from '../surfaces/index.js';
|
|
12
|
+
import { DockerProcessError, createApiDispatcher, createLoggedDockerCli, createPackagedAssetSource, createPairingGrant, createProcessLogSink, createSandboxDockerPort, createSurfaceHttpServer, drainProcessOutput, loadOrCreateCredentials, promoteSandboxImage, redeemPairingGrant, replaceAccessKey, runDoctor, runSandbox, runSandboxEntrypoint, runSandboxSetup, runSelfUpdateLatestLoop, runTargetSmoke, verifyResidentStart, waitForActiveRuns, waitForever, } from '../surfaces/index.js';
|
|
13
13
|
import { WorkStreamKind, workItemId } from '../work/index.js';
|
|
14
14
|
import { loadConfig } from './config/load-config.js';
|
|
15
15
|
import { createNpmUpdatePort } from './npm-update-port.js';
|
|
@@ -333,6 +333,18 @@ function sandboxDockerOptions(root, overrides) {
|
|
|
333
333
|
function createSandboxDocker(root, overrides) {
|
|
334
334
|
return createSandboxDockerPort(createDockerCliForRoot(root), sandboxDockerOptions(root, overrides));
|
|
335
335
|
}
|
|
336
|
+
async function createSandboxDockerForCommand(root, arguments_) {
|
|
337
|
+
if (arguments_[0] !== 'build' || root.config.host.development.mode === 'source')
|
|
338
|
+
return createSandboxDocker(root);
|
|
339
|
+
const buildVersion = await createNpmUpdatePort({
|
|
340
|
+
packageName: root.config.host.selfUpdate.npm.package,
|
|
341
|
+
distTag: root.config.host.selfUpdate.npm.distTag,
|
|
342
|
+
...(root.config.host.selfUpdate.npm.registry === undefined
|
|
343
|
+
? {}
|
|
344
|
+
: { registry: root.config.host.selfUpdate.npm.registry }),
|
|
345
|
+
}).latestTag();
|
|
346
|
+
return createSandboxDocker(root, { buildVersion });
|
|
347
|
+
}
|
|
336
348
|
async function resolveSandboxBuildVersion(root) {
|
|
337
349
|
const development = root.config.host.development;
|
|
338
350
|
return development.mode === 'source' && development.repoRoot !== undefined
|
|
@@ -422,6 +434,7 @@ async function deploySandboxTag(root, docker, tag, image, overrides) {
|
|
|
422
434
|
await verifyResidentStart(docker, root.config.host.sandbox.containerName, [...wakeInvocation, 'start', '--wake-root', '/wake'].join(' '));
|
|
423
435
|
await port.exec([...wakeInvocation, 'init', healthcheckRoot]);
|
|
424
436
|
await port.exec([...wakeInvocation, 'tick', '--wake-root', healthcheckRoot, '--no-sandbox']);
|
|
437
|
+
await promoteSandboxImage(docker, image, root.config.host.sandbox.image);
|
|
425
438
|
}
|
|
426
439
|
async function rollbackSandboxTag(root, docker, image, development) {
|
|
427
440
|
const port = createSandboxDockerPort(docker, sandboxDockerOptions(root, { image }));
|
|
@@ -430,6 +443,7 @@ async function rollbackSandboxTag(root, docker, image, development) {
|
|
|
430
443
|
? ['node', '/app/dist/src/main.js']
|
|
431
444
|
: sandboxWakeInvocation(root);
|
|
432
445
|
await verifyResidentStart(docker, root.config.host.sandbox.containerName, [...wakeInvocation, 'start', '--wake-root', '/wake'].join(' '));
|
|
446
|
+
await promoteSandboxImage(docker, image, root.config.host.sandbox.image);
|
|
433
447
|
}
|
|
434
448
|
function createOperationalApplications(root) {
|
|
435
449
|
return {
|
|
@@ -450,7 +464,7 @@ function createOperationalApplications(root) {
|
|
|
450
464
|
throw new Error('wake sandbox-setup accepts no arguments');
|
|
451
465
|
await runSandboxSetup(createSandboxSetupDependencies(root.config.host.sandbox.containerHomeMountPath));
|
|
452
466
|
},
|
|
453
|
-
sandbox: async (arguments_) => runSandbox(arguments_,
|
|
467
|
+
sandbox: async (arguments_) => runSandbox(arguments_, await createSandboxDockerForCommand(root, arguments_)),
|
|
454
468
|
sandboxEntrypoint: async () => {
|
|
455
469
|
await runSandboxEntrypoint(createSandboxEntrypointDependencies(root));
|
|
456
470
|
},
|
|
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
|
|
|
124
124
|
return `g${headHash.slice(0, 7)}`;
|
|
125
125
|
return '0.1.0-dev';
|
|
126
126
|
}
|
|
127
|
-
export const wakeVersion = "v0.4.
|
|
127
|
+
export const wakeVersion = "v0.4.22";
|
|
128
128
|
/** The registry-installable version used by packaged sandbox images. */
|
|
129
129
|
export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
|
|
@@ -59,6 +59,8 @@ export declare function createSandboxDockerPort(docker: DockerCli, options: Sand
|
|
|
59
59
|
setup: () => Promise<DockerInvocationResult>;
|
|
60
60
|
resume: ({ sessionId, cwd, cli }: SandboxResumeTarget) => Promise<DockerInvocationResult>;
|
|
61
61
|
};
|
|
62
|
+
/** Promotes a verified versioned sandbox image to the configured default image. */
|
|
63
|
+
export declare function promoteSandboxImage(docker: DockerCli, sourceImage: string, defaultImage: string): Promise<void>;
|
|
62
64
|
export interface SandboxResumeTarget {
|
|
63
65
|
readonly sessionId: string;
|
|
64
66
|
readonly cwd: string;
|
|
@@ -138,6 +138,12 @@ export function createSandboxDockerPort(docker, options) {
|
|
|
138
138
|
},
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
+
/** Promotes a verified versioned sandbox image to the configured default image. */
|
|
142
|
+
export async function promoteSandboxImage(docker, sourceImage, defaultImage) {
|
|
143
|
+
if (sourceImage === defaultImage)
|
|
144
|
+
return;
|
|
145
|
+
await docker.invoke(['tag', sourceImage, defaultImage]);
|
|
146
|
+
}
|
|
141
147
|
function shellQuote(value) {
|
|
142
148
|
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
143
149
|
}
|