aglio-worker 0.63.2 → 0.64.0

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 +126 -7
  2. package/package.json +1 -1
package/agent.js CHANGED
@@ -70132,13 +70132,32 @@ var repoConnectionReportSchema = external_exports.object({
70132
70132
  });
70133
70133
 
70134
70134
  // ../../packages/shared/src/notifications.ts
70135
+ var DEFAULT_IN_APP_NOTIFICATION_TYPES = {
70136
+ question: true,
70137
+ run_finished: false,
70138
+ planning_ready: true,
70139
+ run_failed: true,
70140
+ review_feedback: true,
70141
+ pr_ready: true,
70142
+ pr_merged: false,
70143
+ mention: true,
70144
+ comment: true
70145
+ };
70146
+ var inAppNotificationTypesSchema = external_exports.object({
70147
+ question: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.question),
70148
+ run_finished: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.run_finished),
70149
+ planning_ready: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.planning_ready),
70150
+ run_failed: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.run_failed),
70151
+ review_feedback: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.review_feedback),
70152
+ pr_ready: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.pr_ready),
70153
+ pr_merged: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.pr_merged),
70154
+ mention: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.mention),
70155
+ comment: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.comment)
70156
+ });
70135
70157
  var DIGEST_FREQUENCIES = ["1h", "4h", "12h", "24h"];
70136
70158
  var DEFAULT_DIGEST_FREQUENCY = "4h";
70137
70159
  var DEFAULT_NOTIFICATION_PREFERENCES = {
70138
70160
  emailDigest: true,
70139
- emailQuestions: true,
70140
- emailFailures: true,
70141
- emailPrReady: true,
70142
70161
  digestFrequency: DEFAULT_DIGEST_FREQUENCY,
70143
70162
  telegramEnabled: false,
70144
70163
  telegramChatId: "",
@@ -70152,9 +70171,6 @@ var DEFAULT_NOTIFICATION_PREFERENCES = {
70152
70171
  var TELEGRAM_LINK_CODE_TTL_MS = 10 * 60 * 1e3;
70153
70172
  var notificationPreferencesSchema = external_exports.object({
70154
70173
  emailDigest: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.emailDigest),
70155
- emailQuestions: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.emailQuestions),
70156
- emailFailures: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.emailFailures),
70157
- emailPrReady: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.emailPrReady),
70158
70174
  digestFrequency: external_exports.enum(DIGEST_FREQUENCIES).catch(DEFAULT_NOTIFICATION_PREFERENCES.digestFrequency),
70159
70175
  telegramEnabled: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramEnabled),
70160
70176
  telegramChatId: external_exports.string().trim().max(64).catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramChatId),
@@ -70545,6 +70561,10 @@ var projectSettingsSchema = external_exports.object({
70545
70561
  runRetryBackoffSeconds: external_exports.number().int().min(10).max(600).default(60),
70546
70562
  runRetryMaxBackoffSeconds: external_exports.number().int().min(60).max(3600).default(600),
70547
70563
  notificationSound: external_exports.boolean().default(true),
70564
+ /** In-app inbox rows this project generates. Disabled types never hit the database. */
70565
+ inAppNotifications: inAppNotificationTypesSchema.default(() => ({
70566
+ ...DEFAULT_IN_APP_NOTIFICATION_TYPES
70567
+ })),
70548
70568
  /**
70549
70569
  * Deprecated: kept for backward compatibility. Prompts and the MCP gate read
70550
70570
  * `buildSpeed` instead. Only consulted when `buildSpeed` is missing.
@@ -70564,6 +70584,16 @@ var projectSettingsSchema = external_exports.object({
70564
70584
  planningRequiredWorkerLabels: routingLabelsSchema.default([]),
70565
70585
  /** Post the agent's final build message as a card comment. */
70566
70586
  postBuildReply: external_exports.boolean().default(true),
70587
+ /** Start a fix run when a human comments on or requests changes in a linked PR. */
70588
+ followPrComments: external_exports.boolean().default(true),
70589
+ /** Start a fix run when checks fail on the linked PR head. */
70590
+ followPrChecks: external_exports.boolean().default(true),
70591
+ /** Failing-check fix runs before Aglio asks a human. */
70592
+ maxCheckFixAttempts: external_exports.number().int().min(1).max(10).default(3),
70593
+ /** Attach PRs the agent created but did not link, and move the card to review. */
70594
+ autoLinkPullRequests: external_exports.boolean().default(true),
70595
+ /** Move the card to done when every linked pull request is merged. */
70596
+ autoCloseMergedCards: external_exports.boolean().default(true),
70567
70597
  /**
70568
70598
  * Default pool size for cloud runs started from this project. Projects saved while
70569
70599
  * auto was selectable still carry "auto", so retired values fall back to the default.
@@ -70571,6 +70601,42 @@ var projectSettingsSchema = external_exports.object({
70571
70601
  cloudRunnerSize: external_exports.enum(POOL_SIZES).catch("small").default("small")
70572
70602
  });
70573
70603
  var jobTargetSchema = external_exports.enum(JOB_TARGETS);
70604
+ var defaultProjectSettings = {
70605
+ demoMode: false,
70606
+ autoClaim: true,
70607
+ autoClaimSchedule: {
70608
+ enabled: false,
70609
+ timezone: "UTC",
70610
+ days: [0, 1, 2, 3, 4, 5, 6],
70611
+ start: "00:00",
70612
+ end: "00:00"
70613
+ },
70614
+ maxParallelRuns: 2,
70615
+ maxPlanningRuns: 2,
70616
+ autoMode: defaultAutoMode,
70617
+ defaultAgentConfigId: null,
70618
+ defaultReviewerAgentConfigId: null,
70619
+ defaultRepoId: null,
70620
+ githubPollSeconds: 60,
70621
+ dailyCostCapUsd: 25,
70622
+ maxRunAttempts: 3,
70623
+ runRetryBackoffSeconds: 60,
70624
+ runRetryMaxBackoffSeconds: 600,
70625
+ notificationSound: true,
70626
+ inAppNotifications: { ...DEFAULT_IN_APP_NOTIFICATION_TYPES },
70627
+ requireVerificationEvidence: true,
70628
+ buildSpeed: DEFAULT_BUILD_SPEED,
70629
+ postBuildReply: true,
70630
+ followPrComments: true,
70631
+ followPrChecks: true,
70632
+ maxCheckFixAttempts: 3,
70633
+ autoLinkPullRequests: true,
70634
+ autoCloseMergedCards: true,
70635
+ slackWebhookUrl: null,
70636
+ requiredWorkerLabels: [],
70637
+ planningRequiredWorkerLabels: [],
70638
+ cloudRunnerSize: "small"
70639
+ };
70574
70640
  var repoConfigSchema = external_exports.object({
70575
70641
  id: external_exports.string(),
70576
70642
  name: external_exports.string(),
@@ -73067,10 +73133,15 @@ function parsePiLine(raw) {
73067
73133
  const usage = raw.usage;
73068
73134
  const event = raw.assistantMessageEvent;
73069
73135
  const delta = event?.type === "text_delta" ? event.delta : void 0;
73136
+ const thinkingDelta = event?.type === "thinking_delta" ? event.delta : void 0;
73137
+ const thinkingEnd = event?.type === "thinking_end" ? event.content ?? event.delta : void 0;
73070
73138
  return {
73071
73139
  type,
73072
73140
  assistantText: delta,
73073
73141
  assistantDelta: delta !== void 0,
73142
+ thinkingText: thinkingDelta ?? thinkingEnd,
73143
+ thinkingDelta: thinkingDelta !== void 0,
73144
+ thinkingEnd: event?.type === "thinking_end",
73074
73145
  at: timestampOf(partial2?.timestamp) ?? timestampOf(raw.timestamp),
73075
73146
  usage: usage ? {
73076
73147
  input: usage.input,
@@ -73132,8 +73203,16 @@ function parseClaudeLine(raw) {
73132
73203
  if (type === "assistant") {
73133
73204
  const message = raw.message;
73134
73205
  const text = message?.content?.filter((item) => item.type === "text").map((item) => item.text ?? "").join("\n");
73206
+ const thinking = message?.content?.filter((item) => item.type === "thinking").map((item) => item.thinking ?? "").join("\n\n");
73135
73207
  const tool = message?.content?.find((item) => item.type === "tool_use");
73136
- return { type, assistantText: text || void 0, toolName: tool?.name, toolArgs: tool?.input };
73208
+ return {
73209
+ type,
73210
+ assistantText: text || void 0,
73211
+ thinkingText: thinking || void 0,
73212
+ thinkingEnd: Boolean(thinking),
73213
+ toolName: tool?.name,
73214
+ toolArgs: tool?.input
73215
+ };
73137
73216
  }
73138
73217
  if (type === "result") {
73139
73218
  const usage = raw.usage;
@@ -85530,8 +85609,11 @@ async function runRemoteCardJob(deps) {
85530
85609
  let lastUsageAt = 0;
85531
85610
  let pendingText = "";
85532
85611
  let messageText = "";
85612
+ let pendingThinking = "";
85613
+ let thinkingText = "";
85533
85614
  let messageSeq = 0;
85534
85615
  let lastFlushAt = 0;
85616
+ let lastThinkingFlushAt = 0;
85535
85617
  let chatMessageId = null;
85536
85618
  let finalMessage = "";
85537
85619
  let toolCalls = 0;
@@ -85569,6 +85651,14 @@ async function runRemoteCardJob(deps) {
85569
85651
  await emitLive([{ eventType: "assistant", text, messageId: messageSeq }]);
85570
85652
  await appendChat(text);
85571
85653
  };
85654
+ const flushThinking = async (force = false) => {
85655
+ if (!pendingThinking) return;
85656
+ if (!force && pendingThinking.length < 320 && Date.now() - lastThinkingFlushAt < 400) return;
85657
+ const text = pendingThinking;
85658
+ pendingThinking = "";
85659
+ lastThinkingFlushAt = Date.now();
85660
+ await emitLive([{ eventType: "thinking", text, messageId: messageSeq }]);
85661
+ };
85572
85662
  const consume = async (chunk) => {
85573
85663
  buffer3 += chunk;
85574
85664
  const lines2 = buffer3.split("\n");
@@ -85602,7 +85692,29 @@ async function runRemoteCardJob(deps) {
85602
85692
  agentAbort.abort();
85603
85693
  }
85604
85694
  }
85695
+ if (parsed.thinkingText) {
85696
+ const text = parsed.thinkingText;
85697
+ if (parsed.thinkingDelta) {
85698
+ thinkingText += text;
85699
+ pendingThinking += text;
85700
+ await flushThinking();
85701
+ } else {
85702
+ await flushThinking(true);
85703
+ const duplicate = Boolean(
85704
+ thinkingText && (thinkingText === text || thinkingText.endsWith(text))
85705
+ );
85706
+ const appendText = duplicate ? "" : thinkingText && text.startsWith(thinkingText) ? text.slice(thinkingText.length) : text;
85707
+ if (appendText) {
85708
+ await emitLive([{ eventType: "thinking", text: appendText, messageId: messageSeq }]);
85709
+ }
85710
+ thinkingText = appendText;
85711
+ }
85712
+ } else if (parsed.thinkingEnd) {
85713
+ await flushThinking(true);
85714
+ thinkingText = "";
85715
+ }
85605
85716
  if (parsed.assistantText) {
85717
+ await flushThinking(true);
85606
85718
  const text = parsed.assistantText;
85607
85719
  const duplicateFinal = Boolean(messageText && text && messageText.endsWith(text));
85608
85720
  if (!duplicateFinal) {
@@ -85619,17 +85731,23 @@ async function runRemoteCardJob(deps) {
85619
85731
  }
85620
85732
  if (parsed.messageEnd) {
85621
85733
  await flushAssistant(true);
85734
+ await flushThinking(true);
85622
85735
  finalMessage = text || messageText;
85623
85736
  messageText = "";
85737
+ thinkingText = "";
85738
+ pendingThinking = "";
85624
85739
  messageSeq += 1;
85625
85740
  chatMessageId = null;
85626
85741
  } else if (!parsed.assistantDelta) {
85627
85742
  finalMessage = text;
85743
+ thinkingText = "";
85744
+ pendingThinking = "";
85628
85745
  messageSeq += 1;
85629
85746
  chatMessageId = null;
85630
85747
  }
85631
85748
  }
85632
85749
  if (parsed.toolName) {
85750
+ await flushThinking(true);
85633
85751
  await flushAssistant(true);
85634
85752
  chatMessageId = null;
85635
85753
  if (parsed.detail === void 0) toolCalls += 1;
@@ -85688,6 +85806,7 @@ async function runRemoteCardJob(deps) {
85688
85806
  }
85689
85807
  });
85690
85808
  await consumeQueue;
85809
+ await flushThinking(true);
85691
85810
  await flushAssistant(true);
85692
85811
  if (!finalMessage && messageText) finalMessage = messageText;
85693
85812
  clearTimeout(timeout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aglio-worker",
3
- "version": "0.63.2",
3
+ "version": "0.64.0",
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": {