autopilot-ai 1.19.2 → 1.19.3

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/dist/index.js CHANGED
@@ -16748,6 +16748,7 @@ data: ${JSON.stringify(event.data)}
16748
16748
 
16749
16749
  // src/server/aster-cell-runtime.ts
16750
16750
  import { execFile as execFile5 } from "child_process";
16751
+ import { readFile as readFile21 } from "fs/promises";
16751
16752
  import { promisify as promisify4 } from "util";
16752
16753
  import { randomUUID as randomUUID8 } from "crypto";
16753
16754
  async function writeCellFileChunked(cell, path, content) {
@@ -16774,6 +16775,15 @@ async function writeCellFileChunked(cell, path, content) {
16774
16775
  });
16775
16776
  }
16776
16777
  }
16778
+ async function readBundledCellSdkBundle() {
16779
+ for (const url of [new URL("./sdk/index.js", import.meta.url), new URL("../sdk/index.js", import.meta.url)]) {
16780
+ try {
16781
+ return await readFile21(url, "utf8");
16782
+ } catch {
16783
+ }
16784
+ }
16785
+ throw new Error("cell_runtime_bundle_unavailable");
16786
+ }
16777
16787
  async function defaultArchiveWorkspace(workspaceRoot) {
16778
16788
  const { stdout } = await execFileAsync3("git", ["-C", workspaceRoot, "archive", "--format=tar", "HEAD"], {
16779
16789
  encoding: "buffer",
@@ -16823,7 +16833,7 @@ ${redacted.slice(-half)}`;
16823
16833
  function sleep4(ms) {
16824
16834
  return new Promise((resolve15) => setTimeout(resolve15, ms));
16825
16835
  }
16826
- var execFileAsync3, CELL_WORKSPACE, CELL_STATE_DIR, CHECKPOINT_MESSAGE_FILE, INSTALLED_RUNTIME_PACKAGE, NOTES_FILE, MEMORY_FILE, MEMORY_EXTRACTION_TIMEOUT_MS, LIVENESS_CHECK_MS, ARTIFACTS_DIR, MAX_ARTIFACTS, MAX_ARTIFACT_BYTES, BRANCH_RE, REPOSITORY_RE, GIT, COMMIT_SHA_RE, MAX_TOOL_OUTPUT_CHARS, MAX_TOOL_INPUT_CHARS, MAX_CHECKPOINTS, CELL_CONTROL_DIR, BRIDGE_MARKER, CONTROL_RUNNER, BRIDGE_RUNNER, HEALTH_TIMEOUT_MS, EVENT_POLL_MS, AsterHotcellRuntime, CELL_FILE_WRITE_CHUNK_CHARS, ARTIFACT_MIME_TYPES;
16836
+ var execFileAsync3, CELL_WORKSPACE, CELL_STATE_DIR, CHECKPOINT_MESSAGE_FILE, CELL_RUNTIME_DIR, INSTALLED_RUNTIME_PACKAGE, CELL_RUNTIME_SDK_ENTRY, NOTES_FILE, MEMORY_FILE, MEMORY_EXTRACTION_TIMEOUT_MS, LIVENESS_CHECK_MS, ARTIFACTS_DIR, MAX_ARTIFACTS, MAX_ARTIFACT_BYTES, BRANCH_RE, REPOSITORY_RE, GIT, COMMIT_SHA_RE, MAX_TOOL_OUTPUT_CHARS, MAX_TOOL_INPUT_CHARS, MAX_CHECKPOINTS, CELL_CONTROL_DIR, BRIDGE_MARKER, CONTROL_RUNNER, BRIDGE_RUNNER, HEALTH_TIMEOUT_MS, EVENT_POLL_MS, AsterHotcellRuntime, CELL_FILE_WRITE_CHUNK_CHARS, ARTIFACT_MIME_TYPES;
16827
16837
  var init_aster_cell_runtime = __esm({
16828
16838
  "src/server/aster-cell-runtime.ts"() {
16829
16839
  "use strict";
@@ -16833,7 +16843,9 @@ var init_aster_cell_runtime = __esm({
16833
16843
  CELL_WORKSPACE = "/workspace";
16834
16844
  CELL_STATE_DIR = "/workspace/.aster";
16835
16845
  CHECKPOINT_MESSAGE_FILE = `${CELL_STATE_DIR}/checkpoint-message`;
16836
- INSTALLED_RUNTIME_PACKAGE = "/opt/autopilot/node_modules/autopilot-ai/package.json";
16846
+ CELL_RUNTIME_DIR = "/opt/autopilot/node_modules/autopilot-ai";
16847
+ INSTALLED_RUNTIME_PACKAGE = `${CELL_RUNTIME_DIR}/package.json`;
16848
+ CELL_RUNTIME_SDK_ENTRY = `${CELL_RUNTIME_DIR}/dist/sdk/index.js`;
16837
16849
  NOTES_FILE = `${CELL_STATE_DIR}/pending-notes`;
16838
16850
  MEMORY_FILE = `${CELL_STATE_DIR}/memory.md`;
16839
16851
  MEMORY_EXTRACTION_TIMEOUT_MS = 15e3;
@@ -16858,6 +16870,7 @@ var init_aster_cell_runtime = __esm({
16858
16870
  constructor(provider, options = {}) {
16859
16871
  this.provider = provider;
16860
16872
  this.packageSpec = options.autopilotPackageSpec ?? `autopilot-ai@${getAppVersion()}`;
16873
+ this.cellRuntimeSdkBundle = options.cellRuntimeSdkBundle;
16861
16874
  this.archiveWorkspace = options.archiveWorkspace ?? defaultArchiveWorkspace;
16862
16875
  this.pollIntervalMs = options.pollIntervalMs ?? EVENT_POLL_MS;
16863
16876
  this.healthTimeoutMs = options.healthTimeoutMs ?? HEALTH_TIMEOUT_MS;
@@ -16872,6 +16885,7 @@ var init_aster_cell_runtime = __esm({
16872
16885
  }
16873
16886
  provider;
16874
16887
  packageSpec;
16888
+ cellRuntimeSdkBundle;
16875
16889
  archiveWorkspace;
16876
16890
  pollIntervalMs;
16877
16891
  healthTimeoutMs;
@@ -17268,11 +17282,38 @@ ${text}` : text, { mode: "0600" });
17268
17282
  }
17269
17283
  async installRuntime(cell) {
17270
17284
  const expectedVersion = /@(\d[^@/]*)$/.exec(this.packageSpec)?.[1];
17285
+ let installed;
17271
17286
  try {
17272
- const installed = JSON.parse(await cell.readFile(INSTALLED_RUNTIME_PACKAGE));
17273
- if (!expectedVersion || installed.version === expectedVersion) return;
17287
+ installed = JSON.parse(await cell.readFile(INSTALLED_RUNTIME_PACKAGE));
17288
+ if (!expectedVersion || installed?.version === expectedVersion) return;
17274
17289
  } catch {
17275
17290
  }
17291
+ if (installed && expectedVersion) {
17292
+ const sdkBundle = this.cellRuntimeSdkBundle ?? await readBundledCellSdkBundle();
17293
+ await cell.mkdir(`${CELL_RUNTIME_DIR}/dist/sdk`, { parents: true });
17294
+ await writeCellFileChunked(cell, CELL_RUNTIME_SDK_ENTRY, sdkBundle);
17295
+ const bridge = (await cell.listProcesses()).find(
17296
+ (process3) => process3.status === "running" && process3.command.includes(BRIDGE_MARKER)
17297
+ );
17298
+ if (bridge) {
17299
+ await cell.killProcess(bridge.procId);
17300
+ const deadline = Date.now() + 5e3;
17301
+ for (; ; ) {
17302
+ const stillRunning = (await cell.listProcesses()).some(
17303
+ (process3) => process3.procId === bridge.procId && process3.status === "running"
17304
+ );
17305
+ if (!stillRunning) break;
17306
+ if (Date.now() >= deadline) throw new Error("cell_runtime_restart_failed");
17307
+ await sleep4(50);
17308
+ }
17309
+ }
17310
+ await cell.writeFile(
17311
+ INSTALLED_RUNTIME_PACKAGE,
17312
+ JSON.stringify({ ...installed, version: expectedVersion }),
17313
+ { mode: "0600" }
17314
+ );
17315
+ return;
17316
+ }
17276
17317
  const install = await cell.exec(`mkdir -p /opt/autopilot && npm install --prefix /opt/autopilot --no-audit --no-fund ${this.packageSpec}`);
17277
17318
  if (install.exitCode !== 0) throw new Error("cell_runtime_install_failed");
17278
17319
  }
@@ -17513,7 +17554,7 @@ var init_hotcell_provider = __esm({
17513
17554
  // src/server/routes.ts
17514
17555
  import { randomUUID as randomUUID9 } from "crypto";
17515
17556
  import { URL as URL2 } from "url";
17516
- import { readFile as readFile21, unlink as unlink3 } from "fs/promises";
17557
+ import { readFile as readFile22, unlink as unlink3 } from "fs/promises";
17517
17558
  import { resolve as resolve9, basename as basename5 } from "path";
17518
17559
  function createHotcellAsterRuntime() {
17519
17560
  try {
@@ -17606,7 +17647,7 @@ async function buildUserMessage2(prompt, files, cwd) {
17606
17647
  }
17607
17648
  } else {
17608
17649
  try {
17609
- const content = await readFile21(filePath, "utf8");
17650
+ const content = await readFile22(filePath, "utf8");
17610
17651
  const relPath = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
17611
17652
  fileContents.push(`
17612
17653
  --- ${relPath} ---
@@ -20568,7 +20609,7 @@ __export(requesty_catalog_exports, {
20568
20609
  loadRequestyCatalog: () => loadRequestyCatalog,
20569
20610
  mapRequestyModel: () => mapRequestyModel
20570
20611
  });
20571
- import { readFile as readFile22, writeFile as writeFile13, mkdir as mkdir14 } from "fs/promises";
20612
+ import { readFile as readFile23, writeFile as writeFile13, mkdir as mkdir14 } from "fs/promises";
20572
20613
  import { homedir as homedir23 } from "os";
20573
20614
  import { join as join32, dirname as dirname18 } from "path";
20574
20615
  function catalogCachePath2() {
@@ -20629,7 +20670,7 @@ async function fetchRequestyCatalog(fetchImpl2 = fetch) {
20629
20670
  }
20630
20671
  async function readCache4() {
20631
20672
  try {
20632
- const raw = await readFile22(catalogCachePath2(), "utf8");
20673
+ const raw = await readFile23(catalogCachePath2(), "utf8");
20633
20674
  const parsed = JSON.parse(raw);
20634
20675
  if (parsed.version !== CACHE_VERSION2) return null;
20635
20676
  return {
@@ -20961,8 +21002,8 @@ var init_session = __esm({
20961
21002
  const parts = [{ type: "text", text }];
20962
21003
  for (const img of options.images) {
20963
21004
  if ("path" in img) {
20964
- const { readFile: readFile31 } = await import("fs/promises");
20965
- const data = await readFile31(img.path, "base64");
21005
+ const { readFile: readFile32 } = await import("fs/promises");
21006
+ const data = await readFile32(img.path, "base64");
20966
21007
  const mimeType = img.path.endsWith(".png") ? "image/png" : img.path.endsWith(".jpg") || img.path.endsWith(".jpeg") ? "image/jpeg" : "image/webp";
20967
21008
  parts.push({ type: "image_url", image_url: { url: `data:${mimeType};base64,${data}` } });
20968
21009
  } else {
@@ -21248,7 +21289,7 @@ var init_session = __esm({
21248
21289
  this.lspManager?.notifyChange(path, content);
21249
21290
  } else {
21250
21291
  void import("fs/promises").then(
21251
- ({ readFile: readFile31 }) => readFile31(path, "utf8").then((c) => this.lspManager?.notifyChange(path, c)).catch(() => {
21292
+ ({ readFile: readFile32 }) => readFile32(path, "utf8").then((c) => this.lspManager?.notifyChange(path, c)).catch(() => {
21252
21293
  })
21253
21294
  ).catch(() => {
21254
21295
  });
@@ -22979,7 +23020,7 @@ var init_app_helpers = __esm({
22979
23020
 
22980
23021
  // src/ui/bang-command.ts
22981
23022
  import { spawn as spawn7 } from "child_process";
22982
- import { mkdtemp as mkdtemp2, readFile as readFile23, rm as rm3 } from "fs/promises";
23023
+ import { mkdtemp as mkdtemp2, readFile as readFile24, rm as rm3 } from "fs/promises";
22983
23024
  import { tmpdir as tmpdir4, platform as platform4 } from "os";
22984
23025
  import { join as join35 } from "path";
22985
23026
  function registerInkInstance(instance) {
@@ -23127,7 +23168,7 @@ $ ${command}
23127
23168
  }
23128
23169
  let output = spawnError ? `failed to start: ${spawnError}` : null;
23129
23170
  if (captured && logPath) {
23130
- output = cleanTerminalOutput(await readFile23(logPath, "utf8").catch(() => ""));
23171
+ output = cleanTerminalOutput(await readFile24(logPath, "utf8").catch(() => ""));
23131
23172
  }
23132
23173
  if (logDir2) await rm3(logDir2, { recursive: true, force: true }).catch(() => {
23133
23174
  });
@@ -28847,7 +28888,7 @@ var init_queue_plan_picker = __esm({
28847
28888
 
28848
28889
  // src/agent/jev-context.ts
28849
28890
  import { execFileSync as execFileSync3 } from "child_process";
28850
- import { readFile as readFile24 } from "fs/promises";
28891
+ import { readFile as readFile25 } from "fs/promises";
28851
28892
  import { basename as basename6, join as join37, resolve as resolve12 } from "path";
28852
28893
  function messageText(message2) {
28853
28894
  if (typeof message2.content === "string") return message2.content.trim();
@@ -28870,7 +28911,7 @@ function projectRoot(cwd) {
28870
28911
  }
28871
28912
  async function readPackageMetadata(root) {
28872
28913
  try {
28873
- const parsed = JSON.parse(await readFile24(join37(root, "package.json"), "utf8"));
28914
+ const parsed = JSON.parse(await readFile25(join37(root, "package.json"), "utf8"));
28874
28915
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
28875
28916
  const pkg = parsed;
28876
28917
  const metadata = {};
@@ -28887,7 +28928,7 @@ async function readPackageMetadata(root) {
28887
28928
  async function readLicenseEvidence(root) {
28888
28929
  for (const name of ["LICENSE", "LICENSE.md", "LICENSE.txt", "LICENCE", "COPYING"]) {
28889
28930
  try {
28890
- const content = (await readFile24(join37(root, name), "utf8")).trim();
28931
+ const content = (await readFile25(join37(root, name), "utf8")).trim();
28891
28932
  if (content) return { source: `project license (${name})`, content: content.slice(0, 700) };
28892
28933
  } catch {
28893
28934
  }
@@ -29969,7 +30010,7 @@ var init_frontmatter = __esm({
29969
30010
  });
29970
30011
 
29971
30012
  // src/skills/loader.ts
29972
- import { readFile as readFile25, readdir as readdir6, stat as stat7 } from "fs/promises";
30013
+ import { readFile as readFile26, readdir as readdir6, stat as stat7 } from "fs/promises";
29973
30014
  import { join as join38, extname } from "path";
29974
30015
  function normalizeManifest(raw, filePath) {
29975
30016
  const name = typeof raw.name === "string" ? raw.name : "";
@@ -29984,7 +30025,7 @@ function normalizeManifest(raw, filePath) {
29984
30025
  return { name, description, match, scope, priority, enabled: enabled2 };
29985
30026
  }
29986
30027
  async function loadSkillFile(filePath) {
29987
- const raw = await readFile25(filePath, "utf-8");
30028
+ const raw = await readFile26(filePath, "utf-8");
29988
30029
  const parsed = parseFrontmatter(raw);
29989
30030
  const manifest = normalizeManifest(parsed.data, filePath);
29990
30031
  const body = parsed.content.trim();
@@ -30034,7 +30075,7 @@ var init_loader = __esm({
30034
30075
  });
30035
30076
 
30036
30077
  // src/skills/manager.ts
30037
- import { mkdir as mkdir15, writeFile as writeFile14, unlink as unlink4, readFile as readFile26 } from "fs/promises";
30078
+ import { mkdir as mkdir15, writeFile as writeFile14, unlink as unlink4, readFile as readFile27 } from "fs/promises";
30038
30079
  import { join as join39 } from "path";
30039
30080
  function getSkillDirs(cwd) {
30040
30081
  return {
@@ -30089,7 +30130,7 @@ async function setSkillEnabled(name, enabled2, cwd) {
30089
30130
  const all = await listAllSkills(cwd);
30090
30131
  const skill = all.project.find((s) => s.name === name) ?? all.global.find((s) => s.name === name);
30091
30132
  if (!skill) throw new Error(`skill "${name}" not found`);
30092
- const raw = await readFile26(skill.filePath, "utf-8");
30133
+ const raw = await readFile27(skill.filePath, "utf-8");
30093
30134
  const parsed = parseFrontmatter(raw);
30094
30135
  parsed.data.enabled = enabled2;
30095
30136
  const yaml = Object.entries(parsed.data).map(([k, v]) => {
@@ -30361,7 +30402,7 @@ var tui_report_exports = {};
30361
30402
  __export(tui_report_exports, {
30362
30403
  getCategoryReportText: () => getCategoryReportText
30363
30404
  });
30364
- import { readFile as readFile27 } from "fs/promises";
30405
+ import { readFile as readFile28 } from "fs/promises";
30365
30406
  import { join as join40 } from "path";
30366
30407
  import { homedir as homedir26 } from "os";
30367
30408
  function usageDir3() {
@@ -30381,7 +30422,7 @@ function daysAgo2(n) {
30381
30422
  }
30382
30423
  async function loadLog3() {
30383
30424
  try {
30384
- const raw = await readFile27(usagePath4(), "utf8");
30425
+ const raw = await readFile28(usagePath4(), "utf8");
30385
30426
  return JSON.parse(raw);
30386
30427
  } catch {
30387
30428
  return { version: 1, days: [], sessions: [] };
@@ -33247,7 +33288,7 @@ var init_wcag = __esm({
33247
33288
  });
33248
33289
 
33249
33290
  // src/ui/theme-loader.ts
33250
- import { readFile as readFile28, readdir as readdir7 } from "fs/promises";
33291
+ import { readFile as readFile29, readdir as readdir7 } from "fs/promises";
33251
33292
  import { join as join43 } from "path";
33252
33293
  import { homedir as homedir28 } from "os";
33253
33294
  function projectThemesDir(cwd = process.cwd()) {
@@ -33343,7 +33384,7 @@ async function loadThemesFromDir(dir, source) {
33343
33384
  const path = join43(dir, file);
33344
33385
  let raw;
33345
33386
  try {
33346
- raw = await readFile28(path, "utf-8");
33387
+ raw = await readFile29(path, "utf-8");
33347
33388
  } catch (e) {
33348
33389
  errors.push(`${path}: ${e instanceof Error ? e.message : String(e)}`);
33349
33390
  continue;
@@ -35945,7 +35986,7 @@ var init_resume_progress = __esm({
35945
35986
  });
35946
35987
 
35947
35988
  // src/agent/supervisor.ts
35948
- import { readdir as readdir8, readFile as readFile29, stat as stat8 } from "fs/promises";
35989
+ import { readdir as readdir8, readFile as readFile30, stat as stat8 } from "fs/promises";
35949
35990
  import { createHash as createHash5 } from "crypto";
35950
35991
  import { resolve as resolve13, join as join44 } from "path";
35951
35992
  var TurnSupervisor;
@@ -36860,7 +36901,7 @@ async function runInit(deps) {
36860
36901
  lspManagerRef.current.notifyChange(path, content);
36861
36902
  } else {
36862
36903
  void import("fs/promises").then(
36863
- ({ readFile: readFile31 }) => readFile31(path, "utf8").then((c) => lspManagerRef.current.notifyChange(path, c)).catch(() => {
36904
+ ({ readFile: readFile32 }) => readFile32(path, "utf8").then((c) => lspManagerRef.current.notifyChange(path, c)).catch(() => {
36864
36905
  })
36865
36906
  );
36866
36907
  }
@@ -37057,7 +37098,7 @@ var init_run_init = __esm({
37057
37098
  });
37058
37099
 
37059
37100
  // src/skills/discovery.ts
37060
- import { readdir as readdir9, stat as stat9, readFile as readFile30 } from "fs/promises";
37101
+ import { readdir as readdir9, stat as stat9, readFile as readFile31 } from "fs/promises";
37061
37102
  import { join as join47, extname as extname2 } from "path";
37062
37103
  async function dirExists(path) {
37063
37104
  try {
@@ -37095,7 +37136,7 @@ async function discoverSkills(cwd) {
37095
37136
  return ordered;
37096
37137
  }
37097
37138
  async function readSkillFile(filePath) {
37098
- const bytes = await readFile30(filePath);
37139
+ const bytes = await readFile31(filePath);
37099
37140
  return { bytes, text: bytes.toString("utf-8") };
37100
37141
  }
37101
37142
  var SKILL_EXTENSIONS;
@@ -39473,7 +39514,7 @@ ${result2.output ?? "(output not captured)"}`,
39473
39514
  lspManagerRef.current.notifyChange(path, content2);
39474
39515
  } else {
39475
39516
  void import("fs/promises").then(
39476
- ({ readFile: readFile31 }) => readFile31(path, "utf8").then((c) => lspManagerRef.current.notifyChange(path, c)).catch(() => {
39517
+ ({ readFile: readFile32 }) => readFile32(path, "utf8").then((c) => lspManagerRef.current.notifyChange(path, c)).catch(() => {
39477
39518
  })
39478
39519
  );
39479
39520
  }