aglio-worker 0.101.0 → 0.101.2

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.
Files changed (2) hide show
  1. package/agent.js +16 -11
  2. package/package.json +1 -1
package/agent.js CHANGED
@@ -50183,7 +50183,7 @@ var RUN_STATUSES_FOR_SCHEMA = [
50183
50183
  "cancelled",
50184
50184
  "skipped"
50185
50185
  ];
50186
- var RUN_KINDS = ["planning", "build", "consult", "review", "workspace_consult", "job"];
50186
+ var RUN_KINDS = ["planning", "agent", "build", "consult", "review", "workspace_consult", "job"];
50187
50187
  var AGENT_DRIVERS = ["pi", "claude", "codex", "cursor", "opencode", "antigravity", "hermes"];
50188
50188
  var QUESTION_TYPES = ["single", "multi", "text"];
50189
50189
  var VERIFICATION_KINDS = ["test_output", "screenshot", "recording", "not_applicable"];
@@ -50205,6 +50205,7 @@ var RUN_TRIGGERS = [
50205
50205
  "mention",
50206
50206
  "review_poll",
50207
50207
  "planning_chat",
50208
+ "agent_chat",
50208
50209
  "followup",
50209
50210
  "workspace_chat",
50210
50211
  "schedule"
@@ -86065,7 +86066,8 @@ async function runRemoteCardJob(deps) {
86065
86066
  log: (message) => deps.log?.(message)
86066
86067
  });
86067
86068
  const repoPaths = await cloneRepos();
86068
- await restoreRunContext(repoPaths, context);
86069
+ const restoredSessionId = await restoreRunContext(repoPaths, context);
86070
+ if (restoredSessionId && !context.run.sessionId) context.run.sessionId = restoredSessionId;
86069
86071
  if (context.run.kind === "workspace_consult") {
86070
86072
  await rm3(gitConfigPath, { force: true }).catch(() => void 0);
86071
86073
  }
@@ -86089,7 +86091,7 @@ async function runRemoteCardJob(deps) {
86089
86091
  systemPromptAppend: context.systemPromptAppend
86090
86092
  });
86091
86093
  const exit = await runAgent(command, env);
86092
- await uploadRunContext(repoPaths, context).catch((error63) => {
86094
+ await uploadRunContext(repoPaths, context, exit.sessionId).catch((error63) => {
86093
86095
  write(`[aglio] context snapshot failed: ${errorText2(error63)}
86094
86096
  `);
86095
86097
  });
@@ -86452,7 +86454,7 @@ async function runRemoteCardJob(deps) {
86452
86454
  if (driver === "hermes") return ["sessions"];
86453
86455
  return [];
86454
86456
  }
86455
- async function uploadRunContext(repoPaths, current) {
86457
+ async function uploadRunContext(repoPaths, current, sessionId) {
86456
86458
  if (!current.card || current.run.kind === "workspace_consult") return;
86457
86459
  const staging = join5(workspace, ".aglio", "context");
86458
86460
  const archivePath = join5(workspace, ".aglio", `run-context-${current.run.id}.tar.gz`);
@@ -86463,7 +86465,7 @@ async function runRemoteCardJob(deps) {
86463
86465
  version: 1,
86464
86466
  runId: current.run.id,
86465
86467
  driver: current.agent.driver,
86466
- sessionId: current.run.sessionId,
86468
+ sessionId: sessionId ?? current.run.sessionId,
86467
86469
  sessionDirs: [],
86468
86470
  repos: [],
86469
86471
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -86561,7 +86563,7 @@ async function runRemoteCardJob(deps) {
86561
86563
  }
86562
86564
  async function restoreRunContext(repoPaths, current) {
86563
86565
  const artifactId = current.run.restoreContextArtifactId;
86564
- if (!artifactId) return;
86566
+ if (!artifactId) return null;
86565
86567
  const restoreDir = join5(workspace, ".aglio", "context-restore");
86566
86568
  const archivePath = join5(restoreDir, "context.tar.gz");
86567
86569
  await rm3(restoreDir, { recursive: true, force: true }).catch(() => void 0);
@@ -86572,7 +86574,7 @@ async function runRemoteCardJob(deps) {
86572
86574
  } catch (error63) {
86573
86575
  write(`[aglio] context restore download failed: ${errorText2(error63)}
86574
86576
  `);
86575
- return;
86577
+ return null;
86576
86578
  }
86577
86579
  await writeFile(archivePath, data);
86578
86580
  const unpacked = await deps.runCommand({
@@ -86584,12 +86586,12 @@ async function runRemoteCardJob(deps) {
86584
86586
  });
86585
86587
  if (unpacked !== 0) {
86586
86588
  write("[aglio] context restore unpack failed\n");
86587
- return;
86589
+ return null;
86588
86590
  }
86589
86591
  const manifest = await readFile2(join5(restoreDir, "manifest.json"), "utf8").then((text) => JSON.parse(text)).catch(() => null);
86590
86592
  if (!manifest) {
86591
86593
  write("[aglio] context restore manifest missing\n");
86592
- return;
86594
+ return null;
86593
86595
  }
86594
86596
  for (const [index3, repo] of (manifest.repos ?? []).entries()) {
86595
86597
  if (!repo.patch) continue;
@@ -86629,6 +86631,7 @@ async function runRemoteCardJob(deps) {
86629
86631
  `);
86630
86632
  }
86631
86633
  await rm3(restoreDir, { recursive: true, force: true }).catch(() => void 0);
86634
+ return manifest.sessionId ?? null;
86632
86635
  }
86633
86636
  async function gitOutput(args) {
86634
86637
  let output2 = "";
@@ -86688,6 +86691,8 @@ async function runRemoteCardJob(deps) {
86688
86691
  const lastToolUpdateAt = /* @__PURE__ */ new Map();
86689
86692
  let consumeQueue = Promise.resolve();
86690
86693
  const isPlanning = context.run.kind === "planning";
86694
+ const isAgent = context.run.kind === "agent";
86695
+ const isChat = isPlanning || isAgent;
86691
86696
  const isConsult = context.run.kind === "workspace_consult";
86692
86697
  const emitLive = async (events) => {
86693
86698
  if (events.length === 0) return;
@@ -86696,9 +86701,9 @@ async function runRemoteCardJob(deps) {
86696
86701
  });
86697
86702
  };
86698
86703
  const appendChat = async (text, kind = "text", toolName, toolArgs) => {
86699
- if (!isPlanning && !isConsult) return;
86704
+ if (!isChat && !isConsult) return;
86700
86705
  try {
86701
- const messageId = await (isPlanning ? deps.api.appendPlanningMessage : deps.api.appendConsultMessage)({
86706
+ const messageId = await (isChat ? deps.api.appendPlanningMessage : deps.api.appendConsultMessage)({
86702
86707
  ...lease,
86703
86708
  messageId: kind === "text" ? chatMessageId : null,
86704
86709
  text,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aglio-worker",
3
- "version": "0.101.0",
3
+ "version": "0.101.2",
4
4
  "description": "Host machine agent for Aglio: claims jobs over the API and starts aglio-runner containers.",
5
5
  "type": "module",
6
6
  "bin": {