@atolis-hq/wake 0.4.20 → 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.
@@ -232,16 +232,26 @@ function createSystemApplications(root, now) {
232
232
  provider: instance.provider,
233
233
  ...check,
234
234
  })));
235
+ const failedAdapters = (root.providerFailures ?? []).map((failure) => ({
236
+ adapter: failure.adapter,
237
+ provider: failure.provider,
238
+ scope: 'configuration',
239
+ channel: 'initialization',
240
+ status: 'degraded',
241
+ detail: sanitizeHealthErrorText(failure.error, maximumHealthErrorMessageLength),
242
+ successCount: 0,
243
+ failureCount: 1,
244
+ }));
235
245
  return {
236
246
  data: {
237
247
  status: checks.some((check) => check.status === 'degraded') ||
238
- adapters.some((check) => check.status === 'degraded')
248
+ [...adapters, ...failedAdapters].some((check) => check.status === 'degraded')
239
249
  ? 'degraded'
240
250
  : 'ok',
241
251
  version: wakeVersion,
242
252
  checkedAt,
243
253
  checks,
244
- adapters,
254
+ adapters: [...adapters, ...failedAdapters],
245
255
  },
246
256
  meta: sampledMeta(checkedAt),
247
257
  };
@@ -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_, createSandboxDocker(root)),
467
+ sandbox: async (arguments_) => runSandbox(arguments_, await createSandboxDockerForCommand(root, arguments_)),
454
468
  sandboxEntrypoint: async () => {
455
469
  await runSandboxEntrypoint(createSandboxEntrypointDependencies(root));
456
470
  },
@@ -127,7 +127,10 @@ async function withLeaseLock(path, operation) {
127
127
  while (true) {
128
128
  let lock;
129
129
  try {
130
- lock = await acquireFileLock(lockPath, { staleAfterMs: 60_000 });
130
+ lock = await acquireFileLock(lockPath, {
131
+ staleAfterMs: 60_000,
132
+ staleRequiresDeadProcess: true,
133
+ });
131
134
  }
132
135
  catch (error) {
133
136
  if (error.code !== 'EPERM')
@@ -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.20";
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/wake",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "Local autonomous agent control plane for software development",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {