aglio-worker 0.112.0 → 0.115.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 +918 -359
  2. package/package.json +1 -1
package/agent.js CHANGED
@@ -45098,8 +45098,8 @@ var require_resolve = __commonJS({
45098
45098
  }
45099
45099
  return count2;
45100
45100
  }
45101
- function getFullPath(resolver, id = "", normalize2) {
45102
- if (normalize2 !== false)
45101
+ function getFullPath(resolver, id = "", normalize3) {
45102
+ if (normalize3 !== false)
45103
45103
  id = normalizeId(id);
45104
45104
  const p2 = resolver.parse(id);
45105
45105
  return _getFullPath(resolver, p2);
@@ -46694,7 +46694,7 @@ var require_fast_uri = __commonJS({
46694
46694
  }
46695
46695
  return decodedScheme;
46696
46696
  }
46697
- function normalize2(uri, options) {
46697
+ function normalize3(uri, options) {
46698
46698
  if (typeof uri === "string") {
46699
46699
  uri = /** @type {T} */
46700
46700
  normalizeString(uri, options);
@@ -47072,7 +47072,7 @@ var require_fast_uri = __commonJS({
47072
47072
  }
47073
47073
  var fastUri = {
47074
47074
  SCHEMES,
47075
- normalize: normalize2,
47075
+ normalize: normalize3,
47076
47076
  resolve: resolve7,
47077
47077
  resolveComponent,
47078
47078
  equal,
@@ -50193,7 +50193,7 @@ var RUN_KINDS = [
50193
50193
  "workspace_consult",
50194
50194
  "job"
50195
50195
  ];
50196
- var AGENT_DRIVERS = ["pi", "claude", "codex", "cursor", "opencode", "antigravity", "hermes"];
50196
+ var AGENT_DRIVERS = ["pi", "claude", "codex", "cursor", "opencode", "antigravity"];
50197
50197
  var QUESTION_TYPES = ["single", "multi", "text"];
50198
50198
  var VERIFICATION_KINDS = ["test_output", "screenshot", "recording", "not_applicable"];
50199
50199
  var ARTIFACT_KINDS = ["image", "log", "file", "recording", "canvas", "context"];
@@ -50218,7 +50218,8 @@ var RUN_TRIGGERS = [
50218
50218
  "auto_mode",
50219
50219
  "followup",
50220
50220
  "workspace_chat",
50221
- "schedule"
50221
+ "schedule",
50222
+ "dependency"
50222
50223
  ];
50223
50224
  var NOTIFICATION_TYPES = [
50224
50225
  "question",
@@ -70174,37 +70175,12 @@ var inAppNotificationTypesSchema = external_exports.object({
70174
70175
  comment: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.comment),
70175
70176
  invite: external_exports.boolean().default(DEFAULT_IN_APP_NOTIFICATION_TYPES.invite)
70176
70177
  });
70177
- var DIGEST_FREQUENCIES = ["1h", "4h", "12h", "24h"];
70178
- var DEFAULT_DIGEST_FREQUENCY = "4h";
70178
+ var DIGEST_INTERVAL_MS = 24 * 60 * 60 * 1e3;
70179
70179
  var DEFAULT_NOTIFICATION_PREFERENCES = {
70180
- emailDigest: true,
70181
- digestFrequency: DEFAULT_DIGEST_FREQUENCY,
70182
- telegramEnabled: false,
70183
- telegramChatId: "",
70184
- telegramBotConfigured: false,
70185
- telegramBotUsername: "",
70186
- telegramLinked: false,
70187
- telegramChatLabel: "",
70188
- telegramLinkCode: "",
70189
- telegramLinkCodeExpiresAt: ""
70180
+ emailDigest: true
70190
70181
  };
70191
- var TELEGRAM_LINK_CODE_TTL_MS = 10 * 60 * 1e3;
70192
70182
  var notificationPreferencesSchema = external_exports.object({
70193
- emailDigest: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.emailDigest),
70194
- digestFrequency: external_exports.enum(DIGEST_FREQUENCIES).catch(DEFAULT_NOTIFICATION_PREFERENCES.digestFrequency),
70195
- telegramEnabled: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramEnabled),
70196
- telegramChatId: external_exports.string().trim().max(64).catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramChatId),
70197
- telegramBotConfigured: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramBotConfigured),
70198
- telegramBotUsername: external_exports.string().trim().max(64).catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramBotUsername),
70199
- telegramLinked: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramLinked),
70200
- telegramChatLabel: external_exports.string().trim().max(64).catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramChatLabel),
70201
- telegramLinkCode: external_exports.string().trim().max(64).catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramLinkCode),
70202
- telegramLinkCodeExpiresAt: external_exports.string().trim().max(64).catch(DEFAULT_NOTIFICATION_PREFERENCES.telegramLinkCodeExpiresAt)
70203
- });
70204
- var storedNotificationPreferencesSchema = notificationPreferencesSchema.extend({
70205
- telegramBotToken: external_exports.string().trim().max(4096).catch(""),
70206
- telegramUpdateOffset: external_exports.number().int().nonnegative().catch(0),
70207
- telegramLinkedAt: external_exports.string().trim().max(64).catch("")
70183
+ emailDigest: external_exports.boolean().catch(DEFAULT_NOTIFICATION_PREFERENCES.emailDigest)
70208
70184
  });
70209
70185
  function isSlackWebhookUrl(value) {
70210
70186
  if (typeof value !== "string" || !value.trim()) return false;
@@ -70219,7 +70195,29 @@ function isSlackWebhookUrl(value) {
70219
70195
  // ../../packages/shared/src/runner-images.ts
70220
70196
  var RUNNER_IMAGE_DEFAULT_TAG = "latest";
70221
70197
  var RUNNER_VARIANT_LABEL_PREFIX = "runner:";
70222
- var RUNNER_VARIANT_IDS = ["general", "node", "python", "rust", "go"];
70198
+ var RUNNER_IMAGE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._/:@-]*$/;
70199
+ function normalizeRunnerImage(value) {
70200
+ if (typeof value !== "string") return null;
70201
+ const image = value.trim();
70202
+ if (!image || image.length > 500) return null;
70203
+ if (!RUNNER_IMAGE_PATTERN.test(image)) return null;
70204
+ if (image.includes("://")) return null;
70205
+ return image;
70206
+ }
70207
+ function isValidRunnerImage(value) {
70208
+ return normalizeRunnerImage(value) === value;
70209
+ }
70210
+ var RUNNER_VARIANT_IDS = [
70211
+ "general",
70212
+ "node",
70213
+ "python",
70214
+ "rust",
70215
+ "go",
70216
+ "java",
70217
+ "ruby",
70218
+ "php",
70219
+ "dotnet"
70220
+ ];
70223
70221
  var RUNNER_VARIANTS = [
70224
70222
  {
70225
70223
  id: "general",
@@ -70229,8 +70227,8 @@ var RUNNER_VARIANTS = [
70229
70227
  },
70230
70228
  {
70231
70229
  id: "node",
70232
- label: "Node.js",
70233
- description: "Node, pnpm, TypeScript and browser tooling for web apps.",
70230
+ label: "Node.js + Bun",
70231
+ description: "Node, Bun, pnpm, TypeScript and browser tooling for web apps.",
70234
70232
  imageSuffix: "node"
70235
70233
  },
70236
70234
  {
@@ -70250,6 +70248,30 @@ var RUNNER_VARIANTS = [
70250
70248
  label: "Go",
70251
70249
  description: "The Go toolchain and common CGO build dependencies.",
70252
70250
  imageSuffix: "go"
70251
+ },
70252
+ {
70253
+ id: "java",
70254
+ label: "Java",
70255
+ description: "OpenJDK, Maven and the Gradle wrapper for JVM projects.",
70256
+ imageSuffix: "java"
70257
+ },
70258
+ {
70259
+ id: "ruby",
70260
+ label: "Ruby",
70261
+ description: "Ruby, Bundler and the native build headers for gems.",
70262
+ imageSuffix: "ruby"
70263
+ },
70264
+ {
70265
+ id: "php",
70266
+ label: "PHP",
70267
+ description: "PHP CLI, Composer and the common extension packages.",
70268
+ imageSuffix: "php"
70269
+ },
70270
+ {
70271
+ id: "dotnet",
70272
+ label: ".NET",
70273
+ description: "The .NET 8 SDK for C#, F# and ASP.NET projects.",
70274
+ imageSuffix: "dotnet"
70253
70275
  }
70254
70276
  ];
70255
70277
  var DEFAULT_RUNNER_VARIANT = "general";
@@ -70317,6 +70339,8 @@ function resolveRunnerImage(input2) {
70317
70339
  }
70318
70340
 
70319
70341
  // ../../packages/shared/src/routing.ts
70342
+ var ROUTING_TARGET_LABEL_KEYS = ["os", "mode", "tools"];
70343
+ var TARGET_OWNED_KEYS = new Set(ROUTING_TARGET_LABEL_KEYS);
70320
70344
  var ROUTING_OS_VALUES = ["linux", "macos"];
70321
70345
  var ROUTING_MODE_VALUES = ["docker", "host"];
70322
70346
  var ROUTING_TOOL_VALUES = ["ios", "xcode", "android", "gpu"];
@@ -70472,36 +70496,36 @@ var POOL_SIZE_CONFIG = {
70472
70496
  capacity: 1,
70473
70497
  cpuLimit: 2,
70474
70498
  memoryLimit: "2560m",
70475
- instanceType: "c7i.large",
70499
+ instanceType: "c7g.large",
70476
70500
  vcpu: 2,
70477
- hourlyUsd: 0.0893,
70501
+ hourlyUsd: 0.0725,
70478
70502
  maxInstances: 8
70479
70503
  },
70480
70504
  medium: {
70481
70505
  capacity: 2,
70482
70506
  cpuLimit: 2,
70483
70507
  memoryLimit: "2560m",
70484
- instanceType: "c7i.xlarge",
70508
+ instanceType: "c7g.xlarge",
70485
70509
  vcpu: 4,
70486
- hourlyUsd: 0.1786,
70510
+ hourlyUsd: 0.145,
70487
70511
  maxInstances: 4
70488
70512
  },
70489
70513
  large: {
70490
70514
  capacity: 4,
70491
70515
  cpuLimit: 2,
70492
70516
  memoryLimit: "2560m",
70493
- instanceType: "c7i.2xlarge",
70517
+ instanceType: "c7g.2xlarge",
70494
70518
  vcpu: 8,
70495
- hourlyUsd: 0.3572,
70519
+ hourlyUsd: 0.29,
70496
70520
  maxInstances: 2
70497
70521
  },
70498
70522
  xlarge: {
70499
70523
  capacity: 8,
70500
70524
  cpuLimit: 2,
70501
70525
  memoryLimit: "2560m",
70502
- instanceType: "c7i.4xlarge",
70526
+ instanceType: "c7g.4xlarge",
70503
70527
  vcpu: 16,
70504
- hourlyUsd: 0.7144,
70528
+ hourlyUsd: 0.58,
70505
70529
  // Documented only: the controller provisions small, medium and large hosts.
70506
70530
  maxInstances: 0
70507
70531
  }
@@ -70690,6 +70714,52 @@ var defaultAutoMode = {
70690
70714
  state: defaultAutoModeState
70691
70715
  };
70692
70716
 
70717
+ // ../../packages/shared/src/review-overseer.ts
70718
+ var reviewOverseerStateSchema = external_exports.object({
70719
+ /** Ticket/PR digest seen by the last review overseer wake. */
70720
+ signature: external_exports.string().nullable().default(null),
70721
+ /** When the review overseer last woke, so the board can show it is watching. */
70722
+ lastOverseerAt: external_exports.string().datetime().nullable().default(null)
70723
+ });
70724
+ var defaultReviewOverseerState = {
70725
+ signature: null,
70726
+ lastOverseerAt: null
70727
+ };
70728
+ var reviewOverseerSettingsSchema = external_exports.object({
70729
+ enabled: external_exports.boolean().default(false),
70730
+ /** Reviewer agent. Null uses the project default agent. */
70731
+ agentConfigId: external_exports.string().uuid().nullable().default(null),
70732
+ /** Worker labels for the review overseer. Null inherits the project build labels. */
70733
+ requiredWorkerLabels: external_exports.array(external_exports.string().trim().min(1).max(100)).max(20).nullable().default(null),
70734
+ /** Where the review overseer runs. Null follows the project runner target. */
70735
+ runnerTarget: external_exports.enum(JOB_TARGETS).nullable().default(null),
70736
+ /** Cloud size for the review overseer. Null follows the project cloud size. */
70737
+ poolSize: external_exports.enum(POOL_SIZES).nullable().default(null),
70738
+ /** Runtime wake state. Never edited by the settings form. */
70739
+ state: reviewOverseerStateSchema.default(defaultReviewOverseerState)
70740
+ });
70741
+ var defaultReviewOverseer = {
70742
+ enabled: false,
70743
+ agentConfigId: null,
70744
+ requiredWorkerLabels: null,
70745
+ runnerTarget: null,
70746
+ poolSize: null,
70747
+ state: defaultReviewOverseerState
70748
+ };
70749
+
70750
+ // ../../packages/shared/src/job-artifacts.ts
70751
+ var JOB_LOG_ARTIFACT_MODES = ["off", "failures", "all"];
70752
+ var jobLogArtifactModeSchema = external_exports.enum(JOB_LOG_ARTIFACT_MODES);
70753
+ var DEFAULT_JOB_LOG_ARTIFACTS = "off";
70754
+ var DEFAULT_ARTIFACT_RETENTION_DAYS = 0;
70755
+ var MAX_ARTIFACT_RETENTION_DAYS = 3650;
70756
+ var artifactRetentionDaysSchema = external_exports.number().int().min(0).max(MAX_ARTIFACT_RETENTION_DAYS);
70757
+
70758
+ // ../../packages/shared/src/image-upload-quality.ts
70759
+ var IMAGE_UPLOAD_QUALITY_LEVELS = ["lowest", "low", "medium", "high"];
70760
+ var imageUploadQualitySchema = external_exports.enum(IMAGE_UPLOAD_QUALITY_LEVELS);
70761
+ var DEFAULT_IMAGE_UPLOAD_QUALITY = "medium";
70762
+
70693
70763
  // ../../packages/shared/src/schemas.ts
70694
70764
  var cardColumnSchema = external_exports.enum(CARD_COLUMNS);
70695
70765
  var runStatusSchema = external_exports.enum(RUN_STATUSES_FOR_SCHEMA);
@@ -70755,6 +70825,8 @@ var projectSettingsSchema = external_exports.object({
70755
70825
  autoClaimSchedule: autoClaimScheduleSchema,
70756
70826
  /** Goal-driven project automation. Off by default for every existing project. */
70757
70827
  autoMode: autoModeSettingsSchema.default(defaultAutoMode),
70828
+ /** Review column overseer: review, merge or send back cards in Review. */
70829
+ reviewOverseer: reviewOverseerSettingsSchema.default(defaultReviewOverseer),
70758
70830
  /**
70759
70831
  * Hidden project AI metadata. `initializedAt` is set once the agent has
70760
70832
  * assessed the repository and classified the project. Jobs are optional, so
@@ -70765,13 +70837,13 @@ var projectSettingsSchema = external_exports.object({
70765
70837
  projectAi: external_exports.object({
70766
70838
  initializedAt: external_exports.string().nullable().default(null),
70767
70839
  /**
70768
- * Force-inject a suggestion prompt into build and overseer runs so agents
70840
+ * Inject a suggestion prompt into build and overseer runs so agents
70769
70841
  * propose cards for gaps and stale dependencies. On by default.
70770
70842
  */
70771
70843
  suggestedCardsEnabled: external_exports.boolean().default(true),
70772
70844
  /**
70773
- * Force-inject a job suggestion prompt into build and overseer runs so
70774
- * agents propose recurring jobs for gaps they notice. On by default.
70845
+ * Inject a job suggestion prompt into build and overseer runs so agents
70846
+ * propose recurring jobs for gaps they notice. On by default.
70775
70847
  */
70776
70848
  suggestedJobsEnabled: external_exports.boolean().default(true)
70777
70849
  }).default(() => ({ initializedAt: null, suggestedCardsEnabled: true, suggestedJobsEnabled: true })),
@@ -70819,12 +70891,36 @@ var projectSettingsSchema = external_exports.object({
70819
70891
  repoConnection: repoConnectionReportSchema.nullish(),
70820
70892
  /** Build, consult and review job labels. Empty means any worker. */
70821
70893
  requiredWorkerLabels: routingLabelsSchema.default([]),
70894
+ /**
70895
+ * Project-level runner image. The worker pulls and runs this repository plus
70896
+ * tag or digest for this project's jobs, instead of its stock variant image.
70897
+ * Null keeps the worker image, so old projects behave exactly as before.
70898
+ */
70899
+ runnerImage: external_exports.string().trim().max(500).nullable().default(null).superRefine((value, ctx) => {
70900
+ if (value === null) return;
70901
+ if (!isValidRunnerImage(value)) {
70902
+ ctx.addIssue({
70903
+ code: "custom",
70904
+ message: "Use a container image reference such as ghcr.io/acme/runner-web:2026-06."
70905
+ });
70906
+ }
70907
+ }).transform((value) => value === null ? null : normalizeRunnerImage(value)),
70908
+ /** When the image reference last changed. Older than the last green run is a warning. */
70909
+ runnerImageUpdatedAt: external_exports.string().nullable().default(null),
70910
+ /** A human dismissed the repeated-install hint for this project. */
70911
+ runnerImageHintDismissedAt: external_exports.string().nullable().default(null),
70822
70912
  /** Planning job labels. Empty means any online worker, so planning never waits on a build machine. */
70823
70913
  planningRequiredWorkerLabels: routingLabelsSchema.default([]),
70824
70914
  /** Post the agent's final build message as a card comment. */
70825
70915
  postBuildReply: external_exports.boolean().default(true),
70826
70916
  /** Require screenshot evidence, or an explicit N/A reason, before a pull request opens. */
70827
70917
  requireScreenshots: external_exports.boolean().default(false),
70918
+ /** Days this project keeps uploaded run files. 0 keeps them forever. */
70919
+ artifactRetentionDays: artifactRetentionDaysSchema.default(DEFAULT_ARTIFACT_RETENTION_DAYS),
70920
+ /** Store a log archive for every run, only failed runs, or never. */
70921
+ jobLogArtifacts: jobLogArtifactModeSchema.default(DEFAULT_JOB_LOG_ARTIFACTS),
70922
+ /** Pictures uploaded to this project are re-encoded at this preset. */
70923
+ imageUploadQuality: imageUploadQualitySchema.default(DEFAULT_IMAGE_UPLOAD_QUALITY),
70828
70924
  /** Start a fix run when a human comments on or requests changes in a linked PR. */
70829
70925
  followPrComments: external_exports.boolean().default(true),
70830
70926
  /** Start a fix run when checks fail on the linked PR head. */
@@ -70861,6 +70957,7 @@ var defaultProjectSettings = {
70861
70957
  maxParallelRuns: 2,
70862
70958
  maxPlanningRuns: 2,
70863
70959
  autoMode: defaultAutoMode,
70960
+ reviewOverseer: defaultReviewOverseer,
70864
70961
  projectAi: { initializedAt: null, suggestedCardsEnabled: true, suggestedJobsEnabled: true },
70865
70962
  defaultAgentConfigId: null,
70866
70963
  defaultReviewerAgentConfigId: null,
@@ -70879,6 +70976,9 @@ var defaultProjectSettings = {
70879
70976
  roles: {},
70880
70977
  postBuildReply: true,
70881
70978
  requireScreenshots: false,
70979
+ artifactRetentionDays: DEFAULT_ARTIFACT_RETENTION_DAYS,
70980
+ jobLogArtifacts: DEFAULT_JOB_LOG_ARTIFACTS,
70981
+ imageUploadQuality: DEFAULT_IMAGE_UPLOAD_QUALITY,
70882
70982
  followPrComments: true,
70883
70983
  followPrChecks: true,
70884
70984
  maxCheckFixAttempts: 3,
@@ -70887,6 +70987,9 @@ var defaultProjectSettings = {
70887
70987
  slackWebhookUrl: null,
70888
70988
  requiredWorkerLabels: [],
70889
70989
  planningRequiredWorkerLabels: [],
70990
+ runnerImage: null,
70991
+ runnerImageUpdatedAt: null,
70992
+ runnerImageHintDismissedAt: null,
70890
70993
  cloudRunnerSize: "small",
70891
70994
  promptSets: {}
70892
70995
  };
@@ -71264,6 +71367,7 @@ function isHostLocalSigningArtifact(name2) {
71264
71367
  return HOST_LOCAL_SIGNING_EXTENSIONS.some((extension) => base.endsWith(extension));
71265
71368
  }
71266
71369
  var REMOTE_CONSULT_READ_TOOLS = [
71370
+ "conversation_history",
71267
71371
  "project_list",
71268
71372
  "board_overview",
71269
71373
  "card_list",
@@ -71274,11 +71378,11 @@ var REMOTE_CONSULT_READ_TOOLS = [
71274
71378
  "agent_list",
71275
71379
  "member_list",
71276
71380
  "job_list",
71381
+ "proposal_list",
71277
71382
  "repo_list",
71278
71383
  "pr_get"
71279
71384
  ];
71280
- var REMOTE_CONSULT_TOOLS = [
71281
- ...REMOTE_CONSULT_READ_TOOLS,
71385
+ var REMOTE_CONSULT_WRITE_TOOLS = [
71282
71386
  "card_create",
71283
71387
  "card_bulk_create",
71284
71388
  "card_update",
@@ -71299,6 +71403,22 @@ var REMOTE_CONSULT_TOOLS = [
71299
71403
  "card_delete",
71300
71404
  "job_run"
71301
71405
  ];
71406
+ var REMOTE_CONSULT_TOOLS = [
71407
+ ...REMOTE_CONSULT_READ_TOOLS,
71408
+ ...REMOTE_CONSULT_WRITE_TOOLS
71409
+ ];
71410
+ var REMOTE_CONSULT_REFUSED_TOOLS = [
71411
+ {
71412
+ name: "pr_open",
71413
+ label: "open pull request",
71414
+ reason: "Workspace consultant runs cannot push code or open pull requests. Use run_start."
71415
+ },
71416
+ {
71417
+ name: "pr_merge",
71418
+ label: "merge pull request",
71419
+ reason: "Workspace consultant runs cannot merge pull requests."
71420
+ }
71421
+ ];
71302
71422
 
71303
71423
  // ../../packages/shared/src/workers.ts
71304
71424
  var WORKER_HEARTBEAT_SECONDS = 15;
@@ -71353,53 +71473,6 @@ function parseWorkerLabels(input2) {
71353
71473
  }
71354
71474
  }
71355
71475
 
71356
- // ../../packages/shared/src/agent-presets.ts
71357
- var AGENT_PRESETS = ["yolo", "quick", "balanced", "careful"];
71358
- var PRESET_DIALS = {
71359
- quick: { buildSpeed: "fast", thinking: "low", verbosity: "concise" },
71360
- balanced: {
71361
- buildSpeed: DEFAULT_BUILD_SPEED,
71362
- thinking: DEFAULT_THINKING_LEVEL,
71363
- verbosity: DEFAULT_VERBOSITY
71364
- },
71365
- careful: { buildSpeed: "detailed", thinking: "high", verbosity: "verbose" },
71366
- yolo: { buildSpeed: "yolo", thinking: "off", verbosity: "caveman" }
71367
- };
71368
- var AGENT_PRESET_BUILD_SPEEDS = AGENT_PRESETS.reduce(
71369
- (all2, preset) => {
71370
- all2[preset] = PRESET_DIALS[preset].buildSpeed;
71371
- return all2;
71372
- },
71373
- {}
71374
- );
71375
- var AGENT_PRESET_ROLE_VALUES = AGENT_PRESETS.reduce(
71376
- (all2, preset) => {
71377
- const { thinking, verbosity } = PRESET_DIALS[preset];
71378
- all2[preset] = PROJECT_AGENT_ROLES.reduce((roles, role) => {
71379
- roles[role] = { thinking, verbosity };
71380
- return roles;
71381
- }, {});
71382
- return all2;
71383
- },
71384
- {}
71385
- );
71386
- var AGENT_PRESET_VALUES = AGENT_PRESETS.reduce(
71387
- (all2, preset) => {
71388
- const { buildSpeed, thinking, verbosity } = PRESET_DIALS[preset];
71389
- all2[preset] = {
71390
- buildSpeed,
71391
- thinking,
71392
- verbosity,
71393
- roles: PROJECT_AGENT_ROLES.reduce((roles, role) => {
71394
- roles[role] = { ...AGENT_PRESET_ROLE_VALUES[preset][role] };
71395
- return roles;
71396
- }, {})
71397
- };
71398
- return all2;
71399
- },
71400
- {}
71401
- );
71402
-
71403
71476
  // ../../packages/shared/src/events.ts
71404
71477
  var appEventSchema = external_exports.object({
71405
71478
  id: external_exports.number(),
@@ -71459,11 +71532,11 @@ var PROVIDERS = [
71459
71532
  {
71460
71533
  id: "anthropic",
71461
71534
  label: "Anthropic Claude",
71462
- drivers: ["claude", "pi", "hermes"],
71535
+ drivers: ["claude", "pi"],
71463
71536
  models: ["claude-sonnet-4-5", "claude-opus-4-1", "claude-haiku-4-5", "claude-sonnet-4", "claude-3-7-sonnet-latest"],
71464
71537
  connection: { baseUrl: "https://api.anthropic.com/v1" },
71465
71538
  authOptions: [
71466
- apiKey("ANTHROPIC_API_KEY", ["claude", "pi", "hermes"]),
71539
+ apiKey("ANTHROPIC_API_KEY", ["claude", "pi"]),
71467
71540
  {
71468
71541
  type: "oauth_token",
71469
71542
  label: "Claude subscription token",
@@ -71476,11 +71549,11 @@ var PROVIDERS = [
71476
71549
  {
71477
71550
  id: "openai",
71478
71551
  label: "OpenAI / Codex",
71479
- drivers: ["codex", "pi", "hermes"],
71552
+ drivers: ["codex", "pi"],
71480
71553
  models: ["gpt-5", "gpt-5-codex", "gpt-5-mini", "gpt-4.1", "o3", "o4-mini"],
71481
71554
  connection: { baseUrl: "https://api.openai.com/v1" },
71482
71555
  authOptions: [
71483
- apiKey("OPENAI_API_KEY", ["codex", "pi", "hermes"]),
71556
+ apiKey("OPENAI_API_KEY", ["codex", "pi"]),
71484
71557
  sessionBundle(
71485
71558
  ".codex/auth.json",
71486
71559
  "Requires a ChatGPT subscription.",
@@ -71498,10 +71571,10 @@ var PROVIDERS = [
71498
71571
  {
71499
71572
  id: "google",
71500
71573
  label: "Google Gemini",
71501
- drivers: ["pi", "hermes"],
71574
+ drivers: ["pi"],
71502
71575
  models: ["gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.0-flash"],
71503
71576
  connection: { baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai" },
71504
- authOptions: [apiKey("GEMINI_API_KEY", ["pi", "hermes"])]
71577
+ authOptions: [apiKey("GEMINI_API_KEY", ["pi"])]
71505
71578
  },
71506
71579
  {
71507
71580
  id: "cursor",
@@ -71610,26 +71683,26 @@ var PROVIDERS = [
71610
71683
  {
71611
71684
  id: "deepseek",
71612
71685
  label: "DeepSeek",
71613
- drivers: ["pi", "hermes"],
71686
+ drivers: ["pi"],
71614
71687
  models: ["deepseek-flash", "deepseek-chat", "deepseek-reasoner"],
71615
71688
  connection: { baseUrl: "https://api.deepseek.com/v1" },
71616
- authOptions: [apiKey("DEEPSEEK_API_KEY", ["pi", "hermes"])]
71689
+ authOptions: [apiKey("DEEPSEEK_API_KEY", ["pi"])]
71617
71690
  },
71618
71691
  {
71619
71692
  id: "openrouter",
71620
71693
  label: "OpenRouter",
71621
- drivers: ["pi", "hermes"],
71694
+ drivers: ["pi"],
71622
71695
  models: ["openrouter/auto", "anthropic/claude-sonnet-4.5", "openai/gpt-5", "google/gemini-2.5-pro", "deepseek/deepseek-chat-v3.1"],
71623
71696
  connection: { baseUrl: "https://openrouter.ai/api/v1" },
71624
- authOptions: [apiKey("OPENROUTER_API_KEY", ["pi", "hermes"])]
71697
+ authOptions: [apiKey("OPENROUTER_API_KEY", ["pi"])]
71625
71698
  },
71626
71699
  {
71627
71700
  id: "xai",
71628
71701
  label: "xAI",
71629
- drivers: ["pi", "hermes"],
71702
+ drivers: ["pi"],
71630
71703
  models: ["grok-4", "grok-3", "grok-3-mini"],
71631
71704
  connection: { baseUrl: "https://api.x.ai/v1" },
71632
- authOptions: [apiKey("XAI_API_KEY", ["pi", "hermes"])]
71705
+ authOptions: [apiKey("XAI_API_KEY", ["pi"])]
71633
71706
  },
71634
71707
  {
71635
71708
  id: "groq",
@@ -71682,10 +71755,10 @@ var PROVIDERS = [
71682
71755
  {
71683
71756
  id: "zai",
71684
71757
  label: "Z.ai",
71685
- drivers: ["pi", "hermes"],
71758
+ drivers: ["pi"],
71686
71759
  models: ["glm-4.6", "glm-4.5", "glm-4.5-air"],
71687
71760
  connection: { baseUrl: "https://api.z.ai/api/paas/v4" },
71688
- authOptions: [apiKey("ZAI_API_KEY", ["pi", "hermes"])]
71761
+ authOptions: [apiKey("ZAI_API_KEY", ["pi"])]
71689
71762
  }
71690
71763
  ];
71691
71764
 
@@ -71928,21 +72001,10 @@ var INVITE_TTL_MS = INVITE_TTL_DAYS * 24 * 60 * 60 * 1e3;
71928
72001
  var DEFAULT_INVITE_EXPIRY_DAYS = INVITE_TTL_DAYS;
71929
72002
  var MAX_INVITE_EXPIRY_DAYS = 90;
71930
72003
 
71931
- // ../../packages/shared/src/image-upload-quality.ts
71932
- var IMAGE_UPLOAD_QUALITY_LEVELS = ["lowest", "low", "medium", "high"];
71933
- var imageUploadQualitySchema = external_exports.enum(IMAGE_UPLOAD_QUALITY_LEVELS);
71934
- var DEFAULT_IMAGE_UPLOAD_QUALITY = "medium";
71935
-
71936
72004
  // ../../packages/shared/src/workspace-settings.ts
71937
72005
  var WORKSPACE_SETTINGS_DEFAULTS = {
71938
72006
  allowMemberInvites: true,
71939
72007
  defaultAgentConfigId: null,
71940
- /** 0 means keep artifacts forever. */
71941
- artifactRetentionDays: 0,
71942
- /** Job logs are infra noise. Only write an artifact when a workspace opts in. */
71943
- jobLogArtifacts: "off",
71944
- /** Uploaded pictures are always re-encoded. Everyone starts at Medium. */
71945
- imageUploadQuality: DEFAULT_IMAGE_UPLOAD_QUALITY,
71946
72008
  /** The shared workspace consultant is opt-out. Disabled hides every entry point. */
71947
72009
  consultantEnabled: true,
71948
72010
  /** Workspace consultant reasoning budget. Independent of every project. */
@@ -71952,14 +72014,9 @@ var WORKSPACE_SETTINGS_DEFAULTS = {
71952
72014
  /** How long new invite links stay valid. Existing invites keep their own date. */
71953
72015
  inviteExpiryDays: DEFAULT_INVITE_EXPIRY_DAYS
71954
72016
  };
71955
- var JOB_LOG_ARTIFACT_MODES = ["off", "failures", "all"];
71956
- var jobLogArtifactModeSchema = external_exports.enum(JOB_LOG_ARTIFACT_MODES);
71957
72017
  var workspaceSettingsSchema = external_exports.object({
71958
72018
  allowMemberInvites: external_exports.boolean().catch(WORKSPACE_SETTINGS_DEFAULTS.allowMemberInvites),
71959
72019
  defaultAgentConfigId: external_exports.string().trim().min(1).nullable().catch(null),
71960
- artifactRetentionDays: external_exports.number().int().min(0).max(3650).catch(WORKSPACE_SETTINGS_DEFAULTS.artifactRetentionDays),
71961
- jobLogArtifacts: jobLogArtifactModeSchema.catch(WORKSPACE_SETTINGS_DEFAULTS.jobLogArtifacts),
71962
- imageUploadQuality: imageUploadQualitySchema.catch(WORKSPACE_SETTINGS_DEFAULTS.imageUploadQuality),
71963
72020
  consultantEnabled: external_exports.boolean().catch(WORKSPACE_SETTINGS_DEFAULTS.consultantEnabled),
71964
72021
  consultantThinking: thinkingLevelSchema.catch(WORKSPACE_SETTINGS_DEFAULTS.consultantThinking),
71965
72022
  consultantVerbosity: verbositySchema.catch(WORKSPACE_SETTINGS_DEFAULTS.consultantVerbosity),
@@ -71967,6 +72024,7 @@ var workspaceSettingsSchema = external_exports.object({
71967
72024
  }).passthrough();
71968
72025
 
71969
72026
  // ../../packages/shared/src/prompt-chunks.ts
72027
+ var CONTEXT_LOOKUP_RULE = `Use the board MCP tools when the prompt is missing detail: conversation_history for earlier messages in this planning, agent chat or consultant thread; card_get for this card's comments, work log, attempts, runs and attachments; pr_get for linked PR reviews and checks; job_list for recurring jobs; and repo_list for repository settings. Never guess about data a tool can read.`;
71970
72028
  var BUILD_RULES_DEFAULT = `You are an autonomous engineering teammate working on one card in a project board.
71971
72029
 
71972
72030
  Rules:
@@ -71985,6 +72043,8 @@ Rules:
71985
72043
  - Mark a question required only when you cannot continue. Optional questions never block the resume.
71986
72044
  - Do not ask for permission, for facts you can check yourself, or for a decision the card already makes.
71987
72045
  - Read the repo before editing. Follow existing patterns and style.
72046
+ - ${CONTEXT_LOOKUP_RULE}
72047
+ - Aglio product docs are available through the aglio_docs tool. Call it without a topic for the index, or with a topic id for workers and custom runner images, prompts, jobs, auto mode and releases.
71988
72048
  - Attach screenshots, recordings, logs and files as evidence.
71989
72049
  - When done, verified and pushed, open the pull request. That moves the card to review.
71990
72050
  - If the card says no code change or no pull request, skip verification and stop after the work log. Do not run installs, tests or builds.
@@ -72026,16 +72086,20 @@ var VERBOSITY_RULES_DEFAULTS = {
72026
72086
  verbose: `- Agent verbosity is Verbose. Explain the reasoning and the steps behind the change.
72027
72087
  - Cover tradeoffs and anything a reviewer should check. Keep work log summaries short and put detail in details.`
72028
72088
  };
72029
- var AGENT_RULES_DEFAULT = `You are a general-purpose agent with this card as context. The card, its repositories and its pull requests are the topic you can talk about; they are not a task you have to advance.
72089
+ var AGENT_RULES_DEFAULT = `You are a discussion partner for this card. A human opened the Agent tab to talk the card through, not to advance it.
72030
72090
 
72031
- - Answer the human's latest message first. A greeting, thanks or short question gets a short answer with no tools and no card work.
72032
- - Never resume, continue or finish the card's work on your own initiative. Do not move cards, propose specs or start runs.
72033
- - Use board and repository tools only when they help answer what the human asked, and keep it to a few targeted calls before you reply.
72034
- - If the human asks for a change, do it and report the result. Do not commit, push or open a pull request unless they ask for it.
72035
- - If the request is ambiguous, ask one short clarifying question instead of guessing.`;
72091
+ - Reply to the human's latest message and stop. A greeting, thanks or short question gets a short answer with no tools.
72092
+ - The card, its repositories and its pull requests are the topic. They are not a task to advance, so never edit files, run commands, commit, push, open or merge pull requests, or write to the board.
72093
+ - Read only when the reply needs it, with a few read-only calls: conversation_history for earlier messages, card_get for the card, pr_get for pull requests, repo_list for repositories, aglio_docs for how Aglio works. Do not use more than a few tools per message.
72094
+ - If the human asks for a change, say to use Planning or a build run instead of starting it here.
72095
+ - If the request is ambiguous, ask one short question in the chat. Never suspend this chat with question_ask or spec_propose, and never create human blocker cards.`;
72036
72096
  var PLANNING_RULES_DEFAULT = `You are planning a card. You are NOT building it. Do not edit code, commit or push. You may read the repositories and pull requests.
72037
72097
 
72038
- Your job: turn the card into a clear, testable spec. Ask the human short, specific questions only when the answer changes the plan. Keep answers grilling style: numbered, concrete, with one recommended option marked. Do not ask what the card or repo already answers.`;
72098
+ - ${CONTEXT_LOOKUP_RULE}
72099
+
72100
+ Your job: turn the card into a clear, testable spec. Ask the human short, specific questions only when the answer changes the plan. Keep answers grilling style: numbered, concrete, with one recommended option marked. Do not ask what the card or repo already answers.
72101
+
72102
+ Aglio product context: call the aglio_docs tool when the plan touches workers, custom runner images, prompts, jobs or releases. No topic returns the index.`;
72039
72103
  var PLANNING_LIMITS_DEFAULT = `Planning limits:
72040
72104
  - Use at most 8 tool calls before you answer.
72041
72105
  - Read the smallest useful set of files. Use read and rg. Do not install packages, run the app, run tests, start servers, or run long commands.
@@ -72049,9 +72113,33 @@ Dependencies:
72049
72113
  - When a later split entry needs an earlier one, set blockedBy on the later entry to that entry's 1-based split ref, for example "split:1". split refs point at entries in the same proposal.
72050
72114
  - When a split entry must land before a later one, set blocks on the earlier entry to the later entry's split ref, for example "split:3".
72051
72115
  - Keep the current card's blocks honest: blockedBy cards must finish before this card, and blocks cards wait for this card. Do not plan work that contradicts them.`;
72052
- var REVIEW_RULES_DEFAULT = `You are reviewing a pull request for this card. Read the diff and the review feedback. Do not push, commit, or merge. You may run tests locally. Post review findings in the card comments and work log. Be specific about defects, risks and missing verification. If the change is acceptable, say so plainly.`;
72116
+ var REVIEW_RULES_DEFAULT = `You are reviewing a pull request for this card. Read the diff and the review feedback. Do not push, commit, or merge. You may run tests locally. Post review findings in the card comments and work log. Be specific about defects, risks and missing verification. If the change is acceptable, say so plainly.
72117
+
72118
+ - ${CONTEXT_LOOKUP_RULE}`;
72119
+ var REVIEW_OVERSEER_RULES_DEFAULT = `You are the review column overseer. You watch every card in the Review column and decide whether its pull request is ready to merge, needs a fix on the same card, or needs a separate follow-up card.
72120
+
72121
+ How you work:
72122
+ - Read before you decide. Use card_get with cardId or cardNumber to read the card body, comments, work log and linked PRs. Use pr_get with repoId and number to read the diff, reviews, comments and checks. Run repository commands and tests when a decision needs proof.
72123
+ - Act with the board tools instead of describing what you would do. Add one short worklog_add line for every action, and comment on the card you decided about with comment_add.
72124
+ - Never push a base branch and never open a pull request from this run. Builders own branches and pull requests.
72125
+
72126
+ Decisions:
72127
+ - Pull request is green, matches the card and has no real defect: call pr_merge with the cardId. Do not ask a human for a normal merge.
72128
+ - Pull request has a real defect, missing verification or work outside the card: do not merge. Comment the concrete defect with comment_add, then call card_retry when the latest run failed or was cancelled and another attempt can fix it.
72129
+ - The change is acceptable but the gap belongs in separate work: call card_propose with a precise title, body and reason. Do not create the card directly.
72130
+ - Card has an open human question, an active run or a merge that is still pending: leave it alone. Do not comment to fill space.
72131
+ - A card whose already-linked pull request was merged: leave it for the normal board close; do not reopen or duplicate work.
72132
+
72133
+ Scope:
72134
+ - Only touch cards in this project's Review column. Never merge or retry a card outside Review.
72135
+ - Do not close the project, plan a goal or start unrelated work.
72136
+ - If nothing needs action, answer in one short line naming what you checked and stop.
72137
+
72138
+ - ${CONTEXT_LOOKUP_RULE}`;
72053
72139
  var CONSULT_RULES_DEFAULT = `You are consulting on this card. You may read code, run tests, and comment. You may edit and push the existing card branch when the human explicitly asks you to fix the PR, resolve conflicts, or change code. A clear human indication that they want it is enough, even when indirect. Never merge or push a base branch. Do not move the card unless you open or update the PR.
72054
72140
 
72141
+ - ${CONTEXT_LOOKUP_RULE}
72142
+
72055
72143
  Stay in the comments. Do not use the Questions section for a consult; ask any follow-up in your comment reply. Post your final answer as a comment in the thread; the final run message is only a fallback.`;
72056
72144
  var JOB_RULES_DEFAULT = `You are running one pass of a recurring job card. The card body is the instruction for this run.
72057
72145
 
@@ -72059,12 +72147,13 @@ Rules:
72059
72147
  - This is a job run: never create a branch, commit, push, or open a pull request.
72060
72148
  - Work on the checked-out base branch and leave the worktree clean.
72061
72149
  - Do not ask questions. If something is ambiguous, make the safest call and explain it in your final message.
72150
+ - ${CONTEXT_LOOKUP_RULE}
72062
72151
  - Do not move the card, mark it done, or post a build reply.
72063
72152
  - Put the run result in your final message; it is kept on the run.`;
72064
72153
  var OVERSEER_RULES_DEFAULT = `You are the auto mode overseer for this goal epic. You are a senior delivery lead with the full workspace: the repositories are checked out, you have shell and file tools, and you have the board tools. You own delivery end to end without waiting for a human.
72065
72154
 
72066
72155
  How you work:
72067
- - Read before you decide. card_get with cardId (or cardNumber) reads any ticket in this goal: body, comments, work log and linked PRs. pr_get with repoId and number reads that PR, its reviews, comments and checks. Run repository commands and tests when a decision needs proof.
72156
+ - Read before you decide. card_get with cardId (or cardNumber) reads any ticket in this goal: body, comments, work log and linked PRs. pr_get with repoId and number reads that PR, its reviews, comments and checks. job_list lists recurring jobs and repo_list lists repository settings. Run repository commands and tests when a decision needs proof.
72068
72157
  - Act with the board tools instead of describing what you would do. Put a comment on the ticket you decided about with comment_add and its cardId, and add one short worklog_add line per action.
72069
72158
  - Never push a base branch and never open a pull request from this run. Delivery happens through ticket build runs; your decisions are plan, retry, merge, comment and close.
72070
72159
 
@@ -72085,27 +72174,19 @@ Autonomy:
72085
72174
  - Do not create human blocker cards and do not pause auto mode. Decide with the safest default and record the assumption in the ticket body.
72086
72175
  - Ask a question only when a real secret or external access blocks progress. Use question_ask on this epic; it appears in the auto mode live window. Do not ask what the card, repo or tools can answer.
72087
72176
  - Keep questions in one small batch, with concrete options and one recommendation.`;
72088
- var WORKSPACE_CONSULT_RULES_DEFAULT = `You are the workspace consultant for {{workspaceName}}: a full board operator and overseer. You help people use the product end to end, with read and write access to every project and ticket in this workspace.
72089
-
72090
- Your job:
72091
- - Answer questions about any project and ticket. Use project_list, board_overview, card_list, card_get, card_search, project_history and card_history to read the board. Never guess about a ticket or activity you have not read.
72092
- - Read code when it helps. The project's repositories are cloned below the workspace; use your file and search tools to inspect them. Use repo_list to find a project's repositories and pr_get to read linked pull requests or one PR with its reviews, comments and checks.
72093
- - Create cards with card_create or card_bulk_create, in any column you need. Propose a new top-level card with card_propose when it needs human approval. Add and update subtickets with subtask_create and subtask_update.
72094
- - Update any card with card_update: title, body, priority or column (backlog, todo, doing, review, done).
72095
- - Assign cards with assign_card to an agent (agent_list) or a workspace member (member_list), or release them back to the queue.
72096
- - Comment on any ticket, add work log entries with worklog_add, answer pending questions, and archive cards with card_delete when asked.
72097
- - Attach a file or screenshot to any card with artifact_attach, then reference its artifactId from worklog_add when it is evidence.
72098
- - Read and change dependencies with card_block_list, card_block_add and card_block_remove.
72099
- - Ask for a human secret, access or decision with request_human_action on the card that is blocked.
72100
- - Propose a spec for any card with spec_propose. A human still approves it.
72101
- - Start work with run_start: build for code changes, consult for a card discussion, review for a pull request. Pick the agent from agent_list, or let it default to the card assignee, the consultant agent, or the first active agent.
72102
- - Read recurring job cards with job_list and trigger one with job_run on request. Job runs open no pull request; the result is kept on the job card.
72103
- - Keep answers short and concrete. Use card numbers and project keys.
72177
+ var WORKSPACE_CONSULT_RULES_DEFAULT = `You are the workspace consultant: a full board operator and overseer with read and write access to every project and ticket in this workspace.
72178
+
72179
+ How you work:
72180
+ - Read before you answer. Use project_list, board_overview, card_list, card_get, card_search, project_history and card_history. Never guess about a ticket or activity you have not read.
72181
+ - Act with the board tools instead of describing what you would do. Create, update, assign, comment, log work, manage blocks and attach evidence with the matching tool, then say what changed.
72182
+ - Read code when it helps. The repositories of the card discussed in this thread are cloned under the workspace; repo_list, pr_get and your file tools cover the rest.
72183
+ - Use aglio_docs for how Aglio works instead of guessing. job_list lists recurring jobs and job_run triggers one; a job run opens no pull request.
72184
+ - Ask a human with request_human_action only for a secret, access or decision you cannot get yourself.
72104
72185
 
72105
72186
  Limits:
72106
- - Pushing code, opening pull requests and merging pull requests stay in build runs. Start one with run_start instead of trying to do that work here.
72187
+ - Pushing code, opening pull requests and merging pull requests belong to build runs. Start one with run_start instead of trying to do that work here.
72107
72188
  - Deleting a card archives it and its subtickets. Confirm the intent before archiving many cards at once.
72108
- - Do not dump every ticket into the prompt. Read what you need with the tools.`;
72189
+ - Keep answers short and concrete, with card numbers and project keys.`;
72109
72190
  var PROMPT_KINDS = [
72110
72191
  {
72111
72192
  id: "build",
@@ -72130,7 +72211,7 @@ var PROMPT_KINDS = [
72130
72211
  {
72131
72212
  id: "agent",
72132
72213
  label: "Agent chat",
72133
- description: "A general card chat that answers questions and helps when asked. It does not take over the card's work on its own."
72214
+ description: "A discussion-only card chat. It answers questions and briefs the human on the card without taking over the work."
72134
72215
  },
72135
72216
  {
72136
72217
  id: "job",
@@ -72142,6 +72223,11 @@ var PROMPT_KINDS = [
72142
72223
  label: "Auto mode",
72143
72224
  description: "Oversees a goal end to end: plans tickets, merges ready pull requests, retries failures and closes the goal when it is delivered."
72144
72225
  },
72226
+ {
72227
+ id: "review_overseer",
72228
+ label: "Review overseer",
72229
+ description: "Watches the Review column: reviews each pull request, merges ready work, sends defects back to the card and proposes separate follow-ups."
72230
+ },
72145
72231
  {
72146
72232
  id: "workspace_consult",
72147
72233
  label: "Workspace consultant",
@@ -72169,93 +72255,87 @@ function isVerificationKind(kind) {
72169
72255
  function isScreenshotKind(kind) {
72170
72256
  return SCREENSHOT_KINDS.includes(kind);
72171
72257
  }
72172
- var CARD_CONTEXT_TEMPLATE = `{{environmentSection}}Project: {{projectName}} ({{projectKey}})
72173
- Card: #{{cardNumber}} {{cardTitle}} [{{cardColumn}}]
72258
+ var PROJECT_CONTEXT_TEMPLATE = `Project: {{projectName}} ({{projectKey}})
72259
+ {{repositoriesSection}}{{projectConventionsSection}}`;
72260
+ var CARD_CONTEXT_TEMPLATE = `Card: #{{cardNumber}} {{cardTitle}} [{{cardColumn}}]
72174
72261
 
72175
72262
  Card content:
72176
72263
  {{cardBody}}
72177
72264
 
72178
- {{repositoriesSection}}{{projectConventionsSection}}{{subtasksSection}}{{blocksSection}}{{autoManagedSection}}{{pullRequestsSection}}{{feedbackSection}}{{answersSection}}{{attachmentsSection}}`;
72179
- var BUILD_TEMPLATE_DEFAULT = `${BUILD_RULES_DEFAULT}
72180
- {{verificationRules}}
72265
+ {{subtasksSection}}{{blocksSection}}{{autoManagedSection}}`;
72266
+ var RUN_CONTEXT_TEMPLATE = `{{verificationRules}}
72181
72267
  {{screenshotRules}}
72182
72268
  {{replyStyleRules}}
72183
- ${CARD_CONTEXT_TEMPLATE}{{projectAiSetupSection}}{{suggestedCardsSection}}{{suggestedJobsSection}}
72269
+ {{projectAiSetupSection}}{{suggestedCardsSection}}{{suggestedJobsSection}}{{pullRequestsSection}}{{feedbackSection}}{{answersSection}}{{attachmentsSection}}{{environmentSection}}`;
72270
+ var BUILD_TEMPLATE_DEFAULT = `${BUILD_RULES_DEFAULT}
72271
+ ${PROJECT_CONTEXT_TEMPLATE}${CARD_CONTEXT_TEMPLATE}
72272
+ ${RUN_CONTEXT_TEMPLATE}
72184
72273
  Your task for this run:
72185
72274
  {{instruction}}`;
72186
72275
  var PLANNING_TEMPLATE_DEFAULT = `${PLANNING_RULES_DEFAULT}
72187
- {{replyStyleRules}}
72188
72276
  ${PLANNING_LIMITS_DEFAULT}
72189
72277
 
72190
72278
  ${PLANNING_SPEC_DEFAULT}
72191
72279
 
72280
+ Project: {{projectName}}
72281
+ {{projectConventionsSection}}Repositories:
72282
+ {{repositories}}
72283
+
72192
72284
  Card:
72193
72285
  #{{cardNumber}} {{cardTitle}}
72194
72286
  {{cardBody}}
72195
72287
 
72196
72288
  {{blocksSectionWithNone}}
72197
- Project: {{projectName}}
72198
- {{projectConventionsSection}}Repositories:
72199
- {{repositories}}
72200
-
72201
72289
  Attached files:
72202
72290
  {{attachmentsList}}
72203
72291
 
72204
- Conversation so far:
72205
- {{conversationHistory}}
72206
-
72292
+ {{replyStyleRules}}
72207
72293
  Human message:
72208
72294
  {{instruction}}`;
72209
72295
  var REVIEW_TEMPLATE_DEFAULT = `${REVIEW_RULES_DEFAULT}
72210
- {{verificationRules}}
72211
- {{replyStyleRules}}
72212
- ${CARD_CONTEXT_TEMPLATE}
72296
+ ${PROJECT_CONTEXT_TEMPLATE}${CARD_CONTEXT_TEMPLATE}
72297
+ ${RUN_CONTEXT_TEMPLATE}
72213
72298
  Review request:
72214
72299
  {{instruction}}`;
72215
72300
  var CONSULT_TEMPLATE_DEFAULT = `${CONSULT_RULES_DEFAULT}
72216
- {{verificationRules}}
72217
- {{replyStyleRules}}
72218
- {{screenshotRules}}
72219
- ${CARD_CONTEXT_TEMPLATE}
72301
+ ${PROJECT_CONTEXT_TEMPLATE}${CARD_CONTEXT_TEMPLATE}
72302
+ ${RUN_CONTEXT_TEMPLATE}
72220
72303
  Human message:
72221
72304
  {{instruction}}`;
72222
72305
  var AGENT_TEMPLATE_DEFAULT = `${AGENT_RULES_DEFAULT}
72223
72306
 
72224
- {{replyStyleRules}}
72225
- ${CARD_CONTEXT_TEMPLATE}
72226
- Conversation so far:
72227
- {{conversationHistory}}
72228
-
72307
+ ${PROJECT_CONTEXT_TEMPLATE}${CARD_CONTEXT_TEMPLATE}
72308
+ ${RUN_CONTEXT_TEMPLATE}
72229
72309
  Human message:
72230
72310
  {{instruction}}`;
72231
72311
  var JOB_TEMPLATE_DEFAULT = `${JOB_RULES_DEFAULT}
72232
- {{verificationRules}}
72233
- {{replyStyleRules}}
72234
- ${CARD_CONTEXT_TEMPLATE}
72312
+ ${PROJECT_CONTEXT_TEMPLATE}${CARD_CONTEXT_TEMPLATE}
72313
+ ${RUN_CONTEXT_TEMPLATE}
72235
72314
  Run this job now:
72236
72315
  {{instruction}}`;
72237
72316
  var OVERSEER_TEMPLATE_DEFAULT = `${OVERSEER_RULES_DEFAULT}
72238
- {{replyStyleRules}}
72239
- ${CARD_CONTEXT_TEMPLATE}{{projectAiSetupSection}}{{suggestedCardsSection}}{{suggestedJobsSection}}
72317
+ ${PROJECT_CONTEXT_TEMPLATE}${CARD_CONTEXT_TEMPLATE}
72318
+ ${RUN_CONTEXT_TEMPLATE}
72240
72319
  Goal instruction:
72241
72320
  {{instruction}}`;
72321
+ var REVIEW_OVERSEER_TEMPLATE_DEFAULT = `${REVIEW_OVERSEER_RULES_DEFAULT}
72322
+ ${PROJECT_CONTEXT_TEMPLATE}${CARD_CONTEXT_TEMPLATE}
72323
+ ${RUN_CONTEXT_TEMPLATE}
72324
+ Review pass instruction:
72325
+ {{instruction}}`;
72242
72326
  var WORKSPACE_CONSULT_TEMPLATE_DEFAULT = `${WORKSPACE_CONSULT_RULES_DEFAULT}
72243
- {{replyStyleRules}}
72244
72327
  Workspace: {{workspaceName}}
72245
72328
  Projects:
72246
72329
  {{workspaceProjects}}
72247
72330
 
72248
- Code repositories (read-only, from the latest card mentioned in this thread):
72249
- {{repositories}}
72250
-
72251
72331
  {{selectedCard}}
72252
72332
 
72333
+ Code repositories (read-only, scoped to the selected card):
72334
+ {{repositories}}
72335
+
72253
72336
  Attached files for this thread:
72254
72337
  {{attachmentsList}}
72255
72338
 
72256
- Conversation so far:
72257
- {{conversationHistory}}
72258
-
72259
72339
  Human message:
72260
72340
  {{instruction}}`;
72261
72341
  function fillTemplate(text, vars) {
@@ -72277,6 +72357,7 @@ var TEMPLATE_DEFAULTS = {
72277
72357
  agent: AGENT_TEMPLATE_DEFAULT,
72278
72358
  job: JOB_TEMPLATE_DEFAULT,
72279
72359
  overseer: OVERSEER_TEMPLATE_DEFAULT,
72360
+ review_overseer: REVIEW_OVERSEER_TEMPLATE_DEFAULT,
72280
72361
  workspace_consult: WORKSPACE_CONSULT_TEMPLATE_DEFAULT
72281
72362
  };
72282
72363
  var TEMPLATE_DESCRIPTIONS = {
@@ -72287,6 +72368,7 @@ var TEMPLATE_DESCRIPTIONS = {
72287
72368
  agent: "The full card-chat prompt, including the conversation and card context.",
72288
72369
  job: "The full recurring job prompt, including the job limits and card context.",
72289
72370
  overseer: "The full auto mode prompt, including planning, delivery and autonomy rules.",
72371
+ review_overseer: "The full review column prompt: review each pull request, merge ready work and send defects back.",
72290
72372
  workspace_consult: "The full workspace consultant prompt, including projects, code access and the selected card."
72291
72373
  };
72292
72374
  function chunksForKind(kind) {
@@ -72345,6 +72427,10 @@ var PROJECT_PROMPT_KINDS = PROMPT_KINDS.map((kind) => kind.id).filter(
72345
72427
  (kind) => kind !== "workspace_consult"
72346
72428
  );
72347
72429
  var PROMPT_CHUNK_BY_ID = new Map(PROMPT_CHUNKS.map((chunk) => [chunk.id, chunk]));
72430
+ var SHARED_RUN_CONTEXT_TOKENS = Array.from(
72431
+ RUN_CONTEXT_TEMPLATE.matchAll(/\{\{\w+\}\}/g),
72432
+ (match) => match[0]
72433
+ );
72348
72434
 
72349
72435
  // ../../packages/shared/src/theme.ts
72350
72436
  var THEME_ACCENT_IDS = ["default", "violet", "emerald", "amber", "rose"];
@@ -72408,6 +72494,7 @@ var PROJECT_AI_SETUP_TOOLS = [
72408
72494
  ];
72409
72495
  var REMOTE_RUN_TOOLS = [
72410
72496
  "card_get",
72497
+ "conversation_history",
72411
72498
  "repo_list",
72412
72499
  "pr_get",
72413
72500
  "comment_add",
@@ -72421,6 +72508,7 @@ var REMOTE_RUN_TOOLS = [
72421
72508
  "card_block_remove",
72422
72509
  "job_list",
72423
72510
  "job_run",
72511
+ "proposal_list",
72424
72512
  "card_propose",
72425
72513
  "job_propose",
72426
72514
  "spec_propose",
@@ -72429,7 +72517,8 @@ var REMOTE_RUN_TOOLS = [
72429
72517
  "pr_open",
72430
72518
  "pr_merge",
72431
72519
  "card_retry",
72432
- "request_human_action"
72520
+ "request_human_action",
72521
+ "project_runner_image_set"
72433
72522
  ];
72434
72523
 
72435
72524
  // ../../packages/shared/src/retention.ts
@@ -72615,7 +72704,59 @@ var inFlight = /* @__PURE__ */ new Map();
72615
72704
  async function waitForImagePulls() {
72616
72705
  await Promise.allSettled([...inFlight.values()]);
72617
72706
  }
72618
- async function pullDockerImage(client, image) {
72707
+ var PLATFORM_MISMATCH = /no matching manifest|does not match the specified platform|no matching entries in manifest/i;
72708
+ function pullStreamError(line) {
72709
+ try {
72710
+ const parsed = JSON.parse(line);
72711
+ if (typeof parsed.errorDetail?.message === "string" && parsed.errorDetail.message) {
72712
+ return parsed.errorDetail.message;
72713
+ }
72714
+ if (typeof parsed.error === "string" && parsed.error) return parsed.error;
72715
+ } catch {
72716
+ }
72717
+ return null;
72718
+ }
72719
+ function readPullStream(stream) {
72720
+ return new Promise((resolve7, reject) => {
72721
+ let settled = false;
72722
+ let buffer3 = "";
72723
+ const fail2 = (error63) => {
72724
+ if (settled) return;
72725
+ settled = true;
72726
+ reject(error63);
72727
+ };
72728
+ const readLine = (line) => {
72729
+ if (settled || !line.trim()) return;
72730
+ const message = pullStreamError(line);
72731
+ if (message) fail2(new Error(message));
72732
+ };
72733
+ stream.on("data", (chunk) => {
72734
+ buffer3 += chunk.toString();
72735
+ let newline = buffer3.indexOf("\n");
72736
+ while (!settled && newline >= 0) {
72737
+ readLine(buffer3.slice(0, newline));
72738
+ buffer3 = buffer3.slice(newline + 1);
72739
+ newline = buffer3.indexOf("\n");
72740
+ }
72741
+ });
72742
+ stream.on("end", () => {
72743
+ readLine(buffer3);
72744
+ if (!settled) {
72745
+ settled = true;
72746
+ resolve7();
72747
+ }
72748
+ });
72749
+ stream.on("error", (error63) => fail2(error63));
72750
+ });
72751
+ }
72752
+ async function pullOnce(client, image, platform2) {
72753
+ const stream = await client.pull(image, {
72754
+ authconfig: dockerAuthFor(image),
72755
+ ...platform2 ? { platform: platform2 } : {}
72756
+ });
72757
+ await readPullStream(stream);
72758
+ }
72759
+ async function pullDockerImage(client, image, options = {}) {
72619
72760
  if (!isRegistryImage(image)) {
72620
72761
  throw new Error(
72621
72762
  `Runner image ${image} is not registry-qualified. Build it with: pnpm runner:build`
@@ -72624,12 +72765,17 @@ async function pullDockerImage(client, image) {
72624
72765
  const existing = inFlight.get(image);
72625
72766
  if (existing) return existing;
72626
72767
  const pull = (async () => {
72627
- const stream = await client.pull(image, { authconfig: dockerAuthFor(image) });
72628
- await new Promise((resolve7, reject) => {
72629
- stream.on("data", () => void 0);
72630
- stream.on("end", () => resolve7());
72631
- stream.on("error", (error63) => reject(error63));
72632
- });
72768
+ try {
72769
+ await pullOnce(client, image);
72770
+ } catch (error63) {
72771
+ const reason = error63 instanceof Error ? error63.message : String(error63);
72772
+ if (!PLATFORM_MISMATCH.test(reason)) throw error63;
72773
+ options.log?.("runner image has no native build, retrying as amd64", {
72774
+ image,
72775
+ reason
72776
+ });
72777
+ await pullOnce(client, image, "linux/amd64");
72778
+ }
72633
72779
  })();
72634
72780
  inFlight.set(image, pull);
72635
72781
  try {
@@ -72651,7 +72797,7 @@ async function ensureDockerImage(input2) {
72651
72797
  }
72652
72798
  input2.log?.("runner image missing, pulling", { image: input2.image });
72653
72799
  try {
72654
- await pullDockerImage(input2.client, input2.image);
72800
+ await pullDockerImage(input2.client, input2.image, { log: input2.log });
72655
72801
  } catch (error63) {
72656
72802
  const reason = error63 instanceof Error ? error63.message : String(error63);
72657
72803
  throw new Error(
@@ -72769,6 +72915,44 @@ function agentHostResources(resources) {
72769
72915
  return { Memory: resources.memoryBytes, NanoCpus: resources.nanoCpus };
72770
72916
  }
72771
72917
 
72918
+ // src/runner-cache.ts
72919
+ var RUNNER_CACHE_ENTRIES = [
72920
+ { id: "npm", containerPath: "/root/.npm", description: "npm and Yarn classic metadata" },
72921
+ { id: "pnpm", containerPath: "/root/.local/share/pnpm/store", description: "pnpm content-addressable store" },
72922
+ { id: "yarn", containerPath: "/root/.yarn/berry/cache", description: "Yarn Berry cache" },
72923
+ { id: "bun", containerPath: "/root/.bun/install/cache", description: "Bun install cache" },
72924
+ { id: "pip", containerPath: "/root/.cache/pip", description: "pip wheel and HTTP cache" },
72925
+ { id: "uv", containerPath: "/root/.cache/uv", description: "uv cache" },
72926
+ { id: "cargo-registry", containerPath: "/root/.cargo/registry", description: "Cargo crate registry" },
72927
+ { id: "cargo-git", containerPath: "/root/.cargo/git", description: "Cargo git checkouts" },
72928
+ { id: "go-mod", containerPath: "/root/go/pkg/mod", description: "Go module cache" },
72929
+ { id: "go-build", containerPath: "/root/.cache/go-build", description: "Go build cache" },
72930
+ { id: "composer", containerPath: "/root/.cache/composer", description: "Composer package cache" },
72931
+ { id: "maven", containerPath: "/root/.m2/repository", description: "Maven local repository" },
72932
+ { id: "gradle", containerPath: "/root/.gradle/caches", description: "Gradle dependency cache" },
72933
+ // Only the .deb archive, not /var/lib/apt/lists: package lists are locked per
72934
+ // directory, and two concurrent jobs sharing that lock would make one fail.
72935
+ { id: "apt", containerPath: "/var/cache/apt/archives", description: "apt .deb download cache" }
72936
+ ];
72937
+ var RUNNER_CACHE_VOLUME_PREFIX = "aglio-runner-cache-";
72938
+ function runnerCacheEnabled(env = process.env) {
72939
+ const raw = env.AGLIO_WORKER_CACHE?.trim().toLowerCase();
72940
+ if (!raw) return true;
72941
+ return !["0", "false", "off", "no", "disabled"].includes(raw);
72942
+ }
72943
+ function runnerCacheVolumeName(id) {
72944
+ return `${RUNNER_CACHE_VOLUME_PREFIX}${id}`;
72945
+ }
72946
+ function runnerCacheBinds(env = process.env) {
72947
+ if (!runnerCacheEnabled(env)) return [];
72948
+ return RUNNER_CACHE_ENTRIES.map(
72949
+ (entry) => `${runnerCacheVolumeName(entry.id)}:${entry.containerPath}`
72950
+ );
72951
+ }
72952
+ function describeRunnerCache(binds) {
72953
+ return binds.length > 0 ? `${binds.length} shared package caches (disable with AGLIO_WORKER_CACHE=off)` : "off (AGLIO_WORKER_CACHE)";
72954
+ }
72955
+
72772
72956
  // src/remote-docker.ts
72773
72957
  async function resolveRemoteAgentResources(client, log, overrides = readAgentResourceOverrides()) {
72774
72958
  const needsDetection = overrides.cpu == null || overrides.memory == null;
@@ -72879,8 +73063,9 @@ async function createDockerJobExecutor(input2) {
72879
73063
  }
72880
73064
  const networkMode = input2.networkMode?.trim() || "bridge";
72881
73065
  const resources = input2.resources ?? await resolveRemoteAgentResources(client, input2.log);
73066
+ const cacheBinds = input2.cacheBinds ?? runnerCacheBinds();
72882
73067
  const hostConfig = {
72883
- Binds: [`${hostPath}:${CONTAINER_WORKSPACE}`],
73068
+ Binds: [`${hostPath}:${CONTAINER_WORKSPACE}`, ...cacheBinds],
72884
73069
  NetworkMode: networkMode,
72885
73070
  ...agentHostResources(resources),
72886
73071
  PidsLimit: 1024,
@@ -72907,7 +73092,8 @@ async function createDockerJobExecutor(input2) {
72907
73092
  jobId: input2.jobId,
72908
73093
  image: input2.image,
72909
73094
  name: name2,
72910
- networkMode
73095
+ networkMode,
73096
+ cacheVolumes: cacheBinds.length
72911
73097
  });
72912
73098
  const runCommand = async (command) => {
72913
73099
  if (command.signal?.aborted) return 130;
@@ -72973,7 +73159,7 @@ async function prefetchRunnerImage(input2) {
72973
73159
  const client = input2.client ?? remoteDockerClient(input2.socketPath ?? "/var/run/docker.sock");
72974
73160
  try {
72975
73161
  if (isRegistryImage(input2.image) && input2.refresh !== false) {
72976
- await pullDockerImage(client, input2.image);
73162
+ await pullDockerImage(client, input2.image, { log: input2.log });
72977
73163
  input2.log?.("runner image refreshed", { image: input2.image });
72978
73164
  return true;
72979
73165
  }
@@ -73720,6 +73906,12 @@ async function executeRemoteJob(job, deps) {
73720
73906
  try {
73721
73907
  write(`[aglio] job ${job.type} ${job.id} attempt ${job.attempts}
73722
73908
  `);
73909
+ if (job.runnerImage) {
73910
+ write(
73911
+ `[aglio] runner image: ${job.runnerImage} (${job.runnerImageCustom ? "custom" : "stock"})
73912
+ `
73913
+ );
73914
+ }
73723
73915
  if (job.instructions?.trim()) {
73724
73916
  write(`[aglio] worker instructions:
73725
73917
  ${job.instructions.trim()}
@@ -74013,7 +74205,6 @@ var CLAUDE_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
74013
74205
  var CODEX_EFFORTS = ["minimal", "low", "medium", "high", "xhigh", "max"];
74014
74206
  var OPENCODE_VARIANTS = ["minimal", "low", "medium", "high", "max"];
74015
74207
  var ANTIGRAVITY_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
74016
- var HERMES_EFFORTS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
74017
74208
  function driverThinkingArgs(driver, thinking) {
74018
74209
  if (!thinking) return [];
74019
74210
  if (driver === "pi") return ["--thinking", thinking];
@@ -74029,21 +74220,12 @@ function driverThinkingArgs(driver, thinking) {
74029
74220
  if (driver === "antigravity") {
74030
74221
  return ANTIGRAVITY_EFFORTS.includes(thinking) ? ["--effort", thinking] : [];
74031
74222
  }
74032
- if (driver === "hermes") {
74033
- return HERMES_EFFORTS.includes(thinking) ? ["--reasoning", thinking === "off" ? "none" : thinking] : [];
74034
- }
74035
74223
  return [];
74036
74224
  }
74037
- function hermesProvider(provider) {
74038
- const normalized = provider.toLowerCase();
74039
- if (normalized === "openai") return "openai-api";
74040
- if (normalized === "google") return "gemini";
74041
- return normalized;
74042
- }
74043
74225
  function buildDriverCommand(input2) {
74044
74226
  const prompt = withSystemPrompt(input2.prompt, input2.systemPromptAppend);
74045
74227
  if (input2.driver === "pi") {
74046
- const args2 = [
74228
+ const args = [
74047
74229
  "pi",
74048
74230
  "--print",
74049
74231
  "--mode",
@@ -74054,19 +74236,19 @@ function buildDriverCommand(input2) {
74054
74236
  "--model",
74055
74237
  input2.model
74056
74238
  ];
74057
- args2.push(...driverThinkingArgs("pi", input2.thinking));
74058
- if (input2.tools && input2.tools.length > 0) args2.push("--tools", input2.tools.join(","));
74059
- if (input2.systemPromptAppend) args2.push("--append-system-prompt", input2.systemPromptAppend);
74239
+ args.push(...driverThinkingArgs("pi", input2.thinking));
74240
+ if (input2.tools && input2.tools.length > 0) args.push("--tools", input2.tools.join(","));
74241
+ if (input2.systemPromptAppend) args.push("--append-system-prompt", input2.systemPromptAppend);
74060
74242
  if (input2.resume && input2.sessionId) {
74061
- args2.push("--session", input2.sessionId);
74243
+ args.push("--session", input2.sessionId);
74062
74244
  } else if (input2.sessionId) {
74063
- args2.push("--session-id", input2.sessionId);
74245
+ args.push("--session-id", input2.sessionId);
74064
74246
  }
74065
- args2.push(input2.prompt);
74066
- return args2;
74247
+ args.push(input2.prompt);
74248
+ return args;
74067
74249
  }
74068
74250
  if (input2.driver === "claude") {
74069
- const args2 = [
74251
+ const args = [
74070
74252
  "claude",
74071
74253
  "-p",
74072
74254
  "--output-format",
@@ -74079,28 +74261,28 @@ function buildDriverCommand(input2) {
74079
74261
  input2.mcpConfigPath,
74080
74262
  "--strict-mcp-config"
74081
74263
  ];
74082
- args2.push(...driverThinkingArgs("claude", input2.thinking));
74083
- if (input2.systemPromptAppend) args2.push("--append-system-prompt", input2.systemPromptAppend);
74264
+ args.push(...driverThinkingArgs("claude", input2.thinking));
74265
+ if (input2.systemPromptAppend) args.push("--append-system-prompt", input2.systemPromptAppend);
74084
74266
  if (input2.resume && input2.sessionId) {
74085
- args2.push("--resume", input2.sessionId);
74267
+ args.push("--resume", input2.sessionId);
74086
74268
  } else if (input2.sessionId) {
74087
- args2.push("--session-id", input2.sessionId);
74269
+ args.push("--session-id", input2.sessionId);
74088
74270
  }
74089
- args2.push(input2.prompt);
74090
- return args2;
74271
+ args.push(input2.prompt);
74272
+ return args;
74091
74273
  }
74092
74274
  if (input2.driver === "codex") {
74093
- const args2 = ["codex", "exec"];
74094
- if (input2.resume && input2.sessionId) args2.push("resume", input2.sessionId);
74095
- args2.push("--json", "--dangerously-bypass-approvals-and-sandbox", "--skip-git-repo-check");
74096
- args2.push(...driverThinkingArgs("codex", input2.thinking));
74097
- if (input2.workingDirectory) args2.push("-C", input2.workingDirectory);
74098
- args2.push("-m", input2.model);
74099
- args2.push(prompt);
74100
- return args2;
74275
+ const args = ["codex", "exec"];
74276
+ if (input2.resume && input2.sessionId) args.push("resume", input2.sessionId);
74277
+ args.push("--json", "--dangerously-bypass-approvals-and-sandbox", "--skip-git-repo-check");
74278
+ args.push(...driverThinkingArgs("codex", input2.thinking));
74279
+ if (input2.workingDirectory) args.push("-C", input2.workingDirectory);
74280
+ args.push("-m", input2.model);
74281
+ args.push(prompt);
74282
+ return args;
74101
74283
  }
74102
74284
  if (input2.driver === "cursor") {
74103
- const args2 = [
74285
+ const args = [
74104
74286
  "cursor-agent",
74105
74287
  "-p",
74106
74288
  prompt,
@@ -74112,12 +74294,12 @@ function buildDriverCommand(input2) {
74112
74294
  "--model",
74113
74295
  input2.model
74114
74296
  ];
74115
- if (input2.workingDirectory) args2.push("--workspace", input2.workingDirectory);
74116
- if (input2.resume && input2.sessionId) args2.push("--resume", input2.sessionId);
74117
- return args2;
74297
+ if (input2.workingDirectory) args.push("--workspace", input2.workingDirectory);
74298
+ if (input2.resume && input2.sessionId) args.push("--resume", input2.sessionId);
74299
+ return args;
74118
74300
  }
74119
74301
  if (input2.driver === "antigravity") {
74120
- const args2 = [
74302
+ const args = [
74121
74303
  "agy",
74122
74304
  "-p",
74123
74305
  prompt,
@@ -74131,37 +74313,20 @@ function buildDriverCommand(input2) {
74131
74313
  JSON.stringify({ modelProvider: "gemini" })
74132
74314
  ];
74133
74315
  if (!/-(low|medium|high|xhigh|max)$/.test(input2.model)) {
74134
- args2.push(...driverThinkingArgs("antigravity", input2.thinking));
74135
- }
74136
- if (input2.workingDirectory) args2.push("--add-dir", input2.workingDirectory);
74137
- if (input2.resume && input2.sessionId) args2.push("--conversation", input2.sessionId);
74138
- return args2;
74139
- }
74140
- if (input2.driver === "hermes") {
74141
- const args2 = [
74142
- "hermes",
74143
- "chat",
74144
- "--oneshot",
74145
- "-q",
74146
- prompt,
74147
- "--format",
74148
- "stream-json",
74149
- "--yolo",
74150
- "--provider",
74151
- hermesProvider(input2.provider),
74152
- "--model",
74153
- input2.model
74154
- ];
74155
- args2.push(...driverThinkingArgs("hermes", input2.thinking));
74156
- if (input2.workingDirectory) args2.push("--in", input2.workingDirectory);
74157
- if (input2.resume && input2.sessionId) args2.push("--resume", input2.sessionId);
74158
- return args2;
74159
- }
74160
- const args = ["opencode", "run", prompt, "--format", "json", "--auto", "-m", input2.model];
74161
- args.push(...driverThinkingArgs("opencode", input2.thinking));
74162
- if (input2.workingDirectory) args.push("--dir", input2.workingDirectory);
74163
- if (input2.resume && input2.sessionId) args.push("--session", input2.sessionId);
74164
- return args;
74316
+ args.push(...driverThinkingArgs("antigravity", input2.thinking));
74317
+ }
74318
+ if (input2.workingDirectory) args.push("--add-dir", input2.workingDirectory);
74319
+ if (input2.resume && input2.sessionId) args.push("--conversation", input2.sessionId);
74320
+ return args;
74321
+ }
74322
+ if (input2.driver === "opencode") {
74323
+ const args = ["opencode", "run", prompt, "--format", "json", "--auto", "-m", input2.model];
74324
+ args.push(...driverThinkingArgs("opencode", input2.thinking));
74325
+ if (input2.workingDirectory) args.push("--dir", input2.workingDirectory);
74326
+ if (input2.resume && input2.sessionId) args.push("--session", input2.sessionId);
74327
+ return args;
74328
+ }
74329
+ throw new Error(`Unsupported agent driver: ${input2.driver}`);
74165
74330
  }
74166
74331
  function agentHomeEnv(driver, toolDir) {
74167
74332
  const home = `${toolDir}/home`;
@@ -74179,9 +74344,6 @@ function agentHomeEnv(driver, toolDir) {
74179
74344
  if (driver === "antigravity") {
74180
74345
  return { HOME: home, AGY_CLI_DISABLE_AUTO_UPDATE: "true" };
74181
74346
  }
74182
- if (driver === "hermes") {
74183
- return { HOME: home, HERMES_HOME: toolDir, HERMES_CONFIG_BACKEND: "file" };
74184
- }
74185
74347
  return { HOME: home };
74186
74348
  }
74187
74349
  function mcpConfigRelativePath(driver) {
@@ -74189,7 +74351,6 @@ function mcpConfigRelativePath(driver) {
74189
74351
  if (driver === "cursor") return "home/.cursor/mcp.json";
74190
74352
  if (driver === "opencode") return "home/.config/opencode/opencode.json";
74191
74353
  if (driver === "antigravity") return "home/.gemini/config/mcp_config.json";
74192
- if (driver === "hermes") return "config.yaml";
74193
74354
  return null;
74194
74355
  }
74195
74356
  function mcpConfigFor(driver, url2, token3, extraServers = []) {
@@ -74227,18 +74388,6 @@ function mcpConfigFor(driver, url2, token3, extraServers = []) {
74227
74388
  for (const server of extraServers) servers[server.name] = extraMcpConfig(driver, server);
74228
74389
  return JSON.stringify({ mcpServers: servers }, null, 2);
74229
74390
  }
74230
- if (driver === "hermes") {
74231
- const servers = {
74232
- aglio: {
74233
- url: url2,
74234
- headers: { Authorization: `Bearer ${token3}` },
74235
- timeout: 300,
74236
- trust: "full"
74237
- }
74238
- };
74239
- for (const server of extraServers) servers[server.name] = extraMcpConfig(driver, server);
74240
- return JSON.stringify({ mcp_servers: servers }, null, 2);
74241
- }
74242
74391
  if (driver === "opencode") {
74243
74392
  const servers = {
74244
74393
  aglio: {
@@ -74269,7 +74418,6 @@ function extraMcpConfig(driver, server) {
74269
74418
  if (driver === "antigravity") {
74270
74419
  return { serverUrl: server.url, headers, timeoutSeconds: 300 };
74271
74420
  }
74272
- if (driver === "hermes") return { url: server.url, headers, timeout: 300, trust: "full" };
74273
74421
  return { type: "remote", url: server.url, headers, enabled: true };
74274
74422
  }
74275
74423
  function codexBearerToken(server) {
@@ -74888,64 +75036,6 @@ function parseAntigravityLine(raw) {
74888
75036
  }
74889
75037
  return { type: event, at: at3 };
74890
75038
  }
74891
- function parseHermesLine(raw) {
74892
- const type = String(raw.type ?? "");
74893
- const at3 = timestampOf(raw.timestamp);
74894
- if (type === "system") {
74895
- return { type, sessionId: raw.session_id ? String(raw.session_id) : void 0, at: at3 };
74896
- }
74897
- if (type === "text") {
74898
- const text = typeof raw.text === "string" ? raw.text : void 0;
74899
- return { type, assistantText: text || void 0, assistantDelta: true, at: at3 };
74900
- }
74901
- if (type === "tool_use") {
74902
- return {
74903
- type,
74904
- toolName: typeof raw.name === "string" ? raw.name : "tool",
74905
- toolArgs: raw.input,
74906
- toolCallId: toolCallIdOf(raw),
74907
- toolStart: true,
74908
- toolPartial: false,
74909
- at: at3
74910
- };
74911
- }
74912
- if (type === "tool_result") {
74913
- return {
74914
- type,
74915
- toolName: typeof raw.name === "string" ? raw.name : void 0,
74916
- toolResult: raw,
74917
- detail: toolDetailText(raw.output),
74918
- toolCallId: toolCallIdOf(raw),
74919
- toolStart: false,
74920
- toolPartial: false,
74921
- at: at3
74922
- };
74923
- }
74924
- if (type === "result") {
74925
- const tokens3 = asRecord(raw.tokens);
74926
- const number4 = (value) => {
74927
- const parsed = Number(value);
74928
- return Number.isFinite(parsed) && parsed > 0 ? parsed : void 0;
74929
- };
74930
- const input2 = number4(tokens3?.input);
74931
- const output2 = number4(tokens3?.output);
74932
- const cacheRead = number4(tokens3?.cache_read);
74933
- const cacheWrite = number4(tokens3?.cache_write);
74934
- const exitCode = typeof raw.exit_code === "number" ? raw.exit_code : void 0;
74935
- const failure2 = typeof raw.error === "string" && raw.error ? raw.error : exitCode !== void 0 && exitCode !== 0 ? `Hermes run ended with exit code ${exitCode}` : void 0;
74936
- return {
74937
- type,
74938
- sessionId: raw.session_id ? String(raw.session_id) : void 0,
74939
- resultText: typeof raw.text === "string" ? raw.text : void 0,
74940
- error: failure2,
74941
- usage: input2 || output2 || cacheRead || cacheWrite ? { input: input2, output: output2, cacheRead, cacheWrite } : void 0,
74942
- done: true,
74943
- final: !failure2,
74944
- at: at3
74945
- };
74946
- }
74947
- return { type, at: at3 };
74948
- }
74949
75039
  function parseStructuredLine(raw) {
74950
75040
  const type = String(raw.type ?? raw.event ?? raw.kind ?? "");
74951
75041
  const tool = extractTool(raw);
@@ -74974,7 +75064,6 @@ function parseDriverLine(driver, line) {
74974
75064
  if (driver === "codex") return parseCodexLine(raw);
74975
75065
  if (driver === "opencode") return parseOpencodeLine(raw);
74976
75066
  if (driver === "antigravity") return parseAntigravityLine(raw);
74977
- if (driver === "hermes") return parseHermesLine(raw);
74978
75067
  return parseStructuredLine(raw);
74979
75068
  }
74980
75069
 
@@ -87268,7 +87357,6 @@ async function runRemoteCardJob(deps) {
87268
87357
  if (driver === "cursor") return ["home/.cursor/chats"];
87269
87358
  if (driver === "opencode") return ["home/.local/share/opencode/storage"];
87270
87359
  if (driver === "antigravity") return ["home/.gemini/tmp"];
87271
- if (driver === "hermes") return ["sessions"];
87272
87360
  return [];
87273
87361
  }
87274
87362
  async function uploadRunContext(repoPaths, current, sessionId, baseHeads) {
@@ -88604,6 +88692,13 @@ async function runRemoteWorker(config2, deps = {}) {
88604
88692
  activeJobIds.add(activeJob.id);
88605
88693
  activeWorkspaceIds.add(activeJob.runId ?? activeJob.id);
88606
88694
  log("job claimed", { jobId: activeJob.id, type: activeJob.type, attempt: activeJob.attempts });
88695
+ const projectRunnerImage = normalizeRunnerImage(activeJob.projectRunnerImage);
88696
+ activeJob.runnerImage = projectRunnerImage ?? resolveRunnerImage({
88697
+ requiredLabels: activeJob.requiredLabels,
88698
+ images: config2.runnerImages,
88699
+ fallback: config2.runnerImage ?? "ghcr.io/h4kbas/aglio-runner:latest"
88700
+ });
88701
+ activeJob.runnerImageCustom = Boolean(projectRunnerImage);
88607
88702
  try {
88608
88703
  const cardApi = deps.cardApi ?? workerCardApi(config2, fetchImpl, controller.signal);
88609
88704
  const state2 = await executeRemoteJob(result.job, {
@@ -88624,7 +88719,7 @@ async function runRemoteWorker(config2, deps = {}) {
88624
88719
  ...input2,
88625
88720
  workspaceRoot: config2.workspaceRoot ?? input2.workspace,
88626
88721
  hostWorkspaceRoot: config2.hostWorkspaceRoot ?? config2.workspaceRoot ?? input2.workspace,
88627
- image: resolveRunnerImage({
88722
+ image: result.job.runnerImage ?? resolveRunnerImage({
88628
88723
  requiredLabels: result.job.requiredLabels,
88629
88724
  images: config2.runnerImages,
88630
88725
  fallback: config2.runnerImage ?? "ghcr.io/h4kbas/aglio-runner:latest"
@@ -100390,6 +100485,404 @@ var StreamableHTTPServerTransport = class {
100390
100485
  }
100391
100486
  };
100392
100487
 
100488
+ // ../../packages/shared/src/agent-docs.ts
100489
+ var AGLIO_AGENT_DOCS = [
100490
+ {
100491
+ id: "overview",
100492
+ title: "How Aglio works",
100493
+ summary: "Product model, components, run lifecycle and repository map.",
100494
+ tags: ["architecture", "board", "runs", "repo", "meta"],
100495
+ body: `# How Aglio works
100496
+
100497
+ Aglio is an AI-first project board. A card is the contract: humans plan and
100498
+ review, agents build in isolated containers, and a linked pull request moves the
100499
+ card to review. One workspace per deployment, many projects, one board per
100500
+ project.
100501
+
100502
+ ## Components
100503
+
100504
+ - apps/web: Next.js UI, API routes and the control-plane MCP endpoint.
100505
+ - apps/worker: the machine agent. It claims jobs, starts runner containers,
100506
+ hosts the per-run MCP server, polls GitHub and uploads artifacts.
100507
+ - runner/Dockerfile: the agent container image (pi, Claude Code, Codex, Cursor,
100508
+ OpenCode, Antigravity, Node, Python).
100509
+ - packages/core: domain rules (claims, transitions, runs, specs, jobs).
100510
+ - packages/db: Drizzle schema and migrations.
100511
+ - packages/agents: driver interface, prompts and context builder.
100512
+ - packages/mcp: board MCP tools served by the control plane.
100513
+ - packages/shared: Zod schemas, shared types, prompt chunks and this registry.
100514
+ - packages/cli: the aglio terminal client.
100515
+ - docs/: canonical operator documentation.
100516
+
100517
+ ## Card lifecycle
100518
+
100519
+ backlog -> todo -> doing -> review -> done
100520
+
100521
+ - backlog: human only, never claimed.
100522
+ - todo: unassigned cards are the agent queue.
100523
+ - doing: a run is queued or active.
100524
+ - review: at least one pull request is open.
100525
+ - done: every linked pull request is merged.
100526
+
100527
+ Blocked and waiting states are flags (awaiting_input, run_failed,
100528
+ checks_failing), not columns. Subtickets live under a parent card and are not
100529
+ claimed independently.
100530
+
100531
+ ## Run lifecycle
100532
+
100533
+ 1. The control plane creates a run, snapshots build speed, prompt set and
100534
+ routing labels, and queues a job.
100535
+ 2. An enrolled worker claims the job and fetches the run context over the lease.
100536
+ 3. The worker prepares the branch, starts the runner container and the agent CLI.
100537
+ 4. The agent reads and writes the board only through MCP tools. Files and
100538
+ commits go through the workspace and the git remote.
100539
+ 5. Verification evidence is recorded, then pr_open pushes the branch and opens
100540
+ one pull request. Job runs never open a pull request.
100541
+ 6. A human merges. GitHub webhooks or polling update checks, feedback and the
100542
+ card column.
100543
+
100544
+ ## Working in the Aglio repository
100545
+
100546
+ - Follow AGENTS.md. There is no test suite; do not add one.
100547
+ - Verify with pnpm typecheck, pnpm --filter @aglio/web build, or a manual run.
100548
+ - Read PLAN.md for locked decisions before changing architecture.
100549
+ - Keep docs/ current when a user-visible flow changes.
100550
+ - A worker image or npm package publish is a separate release step. Say in the
100551
+ PR body when a merged change needs pnpm "Publish NPM package" or the runner /
100552
+ worker image workflow to run.
100553
+
100554
+ Canonical detail: README.md and PLAN.md at the repository root.`
100555
+ },
100556
+ {
100557
+ id: "workers",
100558
+ title: "Workers, runner images and custom runners",
100559
+ summary: "Enroll a machine, route jobs by labels, serve stock or custom images.",
100560
+ tags: ["worker", "byow", "runner", "docker", "labels", "custom", "macos"],
100561
+ body: `# Workers, runner images and custom runners
100562
+
100563
+ A worker is an enrolled machine that claims jobs. The web app never starts
100564
+ containers itself. Settings -> Workers -> Add worker creates the enrollment
100565
+ token and the command once; Run again rotates the token and rebuilds it.
100566
+
100567
+ ## Modes
100568
+
100569
+ - Docker mode: one runner container per job. The agent container holds the
100570
+ Docker socket; the runner gets only the job workspace bind and no socket.
100571
+ On Linux the runner joins the agent network namespace and reaches the MCP
100572
+ server at http://127.0.0.1:4310, so no host port is published.
100573
+ - Host mode: job steps run directly as the enrolled user. Use it for macOS and
100574
+ iOS jobs that need Xcode, simulators, Keychain and provisioning profiles.
100575
+
100576
+ The agent never connects to Postgres and never holds DATABASE_URL or
100577
+ AGLIO_SECRET_KEY. It talks to the control plane over outbound HTTPS.
100578
+
100579
+ ## Labels, capacity and priority
100580
+
100581
+ - Labels are exact-match key:value pairs such as runner:node or size:medium.
100582
+ There are no wildcards or hierarchies; size:large does not satisfy size:medium.
100583
+ - os:linux and mode:docker are added from the mode unless declared.
100584
+ - A project sets requiredWorkerLabels. A card can override the project set:
100585
+ empty means any worker, non-empty is the exact requirement.
100586
+ - Capacity is how many tasks a machine runs at once. Priority is a workspace
100587
+ order: priority 1 takes matching work first while it is online with a free
100588
+ slot; lower priorities take over when it is busy, offline or paused.
100589
+ - Planning can use a separate label set so builds wait for a special machine
100590
+ while planning still runs anywhere.
100591
+
100592
+ ## Stock runner images
100593
+
100594
+ The runner Dockerfile builds one general image and the node, python, rust, go,
100595
+ java, ruby, php and dotnet variants. The node variant includes both Node.js and Bun; \`runner:node\` is still
100596
+ the label for that image, so existing worker and project labels need no change.
100597
+ A worker advertises one runner:<type> label per image it serves. The agent pulls
100598
+ the configured image automatically; the default is
100599
+ ghcr.io/h4kbas/aglio-runner:latest. A local build is pnpm runner:build. The
100600
+ stock images do not include a browser; a browser-dependent job installs
100601
+ Playwright and Chromium itself, for example with
100602
+ \`pnpm exec playwright install --with-deps chromium\`.
100603
+
100604
+ ## Custom runner image
100605
+
100606
+ Extend the official image, do not fork the agent contract:
100607
+
100608
+ 1. In the target repository add docker/runner/Dockerfile starting from
100609
+ ARG BASE_IMAGE=ghcr.io/h4kbas/aglio-runner:latest, keep USER root,
100610
+ WORKDIR /workspace and CMD ["sleep", "infinity"].
100611
+ 2. Install only tools the stock image lacks, pin versions where possible, and
100612
+ never bake registry tokens or API keys into the image.
100613
+ 3. Publish to a registry the worker can pull from, with an immutable tag such as
100614
+ a date or commit SHA.
100615
+ 4. Save it on the project: Project settings -> Workers -> Runner image, or call
100616
+ project_runner_image_set with the full reference after publishing. The worker
100617
+ pulls it for that project only; another project on the same worker keeps its
100618
+ own image. Clearing the field returns to the worker's stock image.
100619
+ 5. The Create custom runner image action opens a card that adds
100620
+ docker/runner/Dockerfile, publishes the image, verifies it and writes the
100621
+ reference back with project_runner_image_set.
100622
+ 6. Keep the advertised runner:<type> label aligned with the image that actually
100623
+ runs. Project images are not reset by Run again; an AGLIO_WORKER_RUNNER_IMAGE
100624
+ fallback is.
100625
+
100626
+ A cloud run ignores a project image and keeps the pool image. Private registries
100627
+ need docker login on the worker host for the user that runs the agent. The agent
100628
+ reads the host Docker config through the socket.
100629
+
100630
+ Put system packages, pinned runtimes, browser binaries and internal CAs in the
100631
+ image. Keep lockfile installs and application dependencies in the repository.
100632
+
100633
+ ## Troubleshooting
100634
+
100635
+ - Runner image not found and could not be pulled: docker pull on the worker host,
100636
+ check registry login and the tag.
100637
+ - A project never reaches a worker: compare required labels with worker labels.
100638
+ - Job reaches 4310 connection errors: check the startup line for
100639
+ network=container:<agent-id> mcp=http://127.0.0.1:4310. An old
100640
+ AGLIO_WORKER_MCP_URL or AGLIO_WORKER_RUNNER_NETWORK can force bridge.
100641
+ - A tool is missing: docker run --rm <image> command -v <tool>.
100642
+ - Old job workspaces, stale aglio-remote-* containers and docker residue are
100643
+ cleaned hourly; see docs/disk-cleanup.md.
100644
+
100645
+ Canonical detail: docs/byow-worker.md, docs/byow-custom-runner.md,
100646
+ docs/byow-macos.md, docs/runner-pool.md and docs/disk-cleanup.md.
100647
+
100648
+ An agent can write the Dockerfile, workflow and project docs, but a human still
100649
+ has to enroll the machine, set the image on it and confirm the first job.`
100650
+ },
100651
+ {
100652
+ id: "prompts",
100653
+ title: "Agent prompts and build speed",
100654
+ summary: "Prompt sets, placeholders, build speed and evidence gates.",
100655
+ tags: ["prompt", "build speed", "thinking", "verbosity", "verification"],
100656
+ body: `# Agent prompts and build speed
100657
+
100658
+ ## Prompt composition
100659
+
100660
+ A run prompt is a static template plus dynamic card, project, run and workspace
100661
+ values. Templates live in packages/shared/src/prompt-chunks.ts. Projects own
100662
+ prompt sets, one per kind: Build, Planning, Review, Consult, Agent chat, Jobs and
100663
+ Auto mode. Each project has an undeletable Default set; named variants copy it
100664
+ and later edits to the default do not rewrite them.
100665
+
100666
+ Dynamic values use placeholders such as {{cardTitle}}, {{projectName}},
100667
+ {{repositoriesSection}}, {{workspaceName}}, {{conversationHistory}} and
100668
+ {{instruction}}. The editor lists every supported placeholder and MCP tool, and
100669
+ unknown tokens stay visible so a typo is obvious.
100670
+
100671
+ The default prompt is deliberately lean and cache-friendly: static rules come
100672
+ first, then project and card facts, then run state and the instruction. It
100673
+ carries the card spec, blocks, repositories, conventions, linked pull request
100674
+ lines, the newest review feedback, this run's answers and a capped attachment
100675
+ list. Comments, work log, attempts and earlier thread messages are not injected
100676
+ by default; call card_get for the wider card view and conversation_history for
100677
+ an earlier planning, agent chat or consultant message. Optional
100678
+ {{commentsSection}}, {{workLogSection}}, {{agentAttemptsSection}} and
100679
+ {{conversationHistory}} placeholders remain available in prompt sets. Prompt
100680
+ set chunks are stored in project_prompt_sets.chunks; an empty value or the
100681
+ current bundled default is not stored, so a reset follows upgrades.
100682
+
100683
+ ## Agent dials
100684
+
100685
+ Project settings show the build and planning dials directly. Build has build
100686
+ speed, thinking level and verbosity; planning has thinking level and verbosity.
100687
+ Each role without its own value inherits the project default. A card can
100688
+ override the speed, thinking and verbosity it inherits, and Reset to defaults
100689
+ returns both roles and build speed to Standard. The workspace consultant dial
100690
+ lives on Settings -> Agents because it is workspace-wide.
100691
+
100692
+ ## Build speed
100693
+
100694
+ One project setting with an optional card override, resolved when the run is
100695
+ claimed and stored on runs.build_speed:
100696
+
100697
+ | Tier | Tests | Typecheck / build | Evidence |
100698
+ | --- | --- | --- | --- |
100699
+ | yolo | none | never | optional, state checks skipped |
100700
+ | ultra fast | none | only if types or build are at risk | optional |
100701
+ | fast | one scoped pass on touched files | one pass before PR | optional |
100702
+ | standard | two scoped passes, then one full suite | one pass before PR | required |
100703
+ | detailed | full suite after meaningful changes | one pass | required, artifact for non-N/A |
100704
+
100705
+ pr_open is hard-blocked without verification only on detailed. Standard and
100706
+ detailed require an artifact for test, screenshot or recording evidence. A
100707
+ project can require screenshots at every speed; then pr_open needs screenshot
100708
+ evidence or not_applicable with a reason.
100709
+
100710
+ Build speed reaches build, fix, review, card consult and job runs. Planning keeps
100711
+ its own card dial; the workspace consultant has no build speed.
100712
+
100713
+ Canonical detail: docs/prompt-context.md, docs/build-speed-dial.md
100714
+ and docs/thinking-levels.md.`
100715
+ },
100716
+ {
100717
+ id: "jobs",
100718
+ title: "Recurring jobs, setup and auto mode",
100719
+ summary: "Job cards, templates, the one-time setup run and the auto-mode overseer.",
100720
+ tags: ["job", "cron", "template", "auto mode", "overseer", "setup", "proposal"],
100721
+ body: `# Recurring jobs, setup and auto mode
100722
+
100723
+ ## Job cards
100724
+
100725
+ A recurring job is a card with kind=job on a project board. A run works on the
100726
+ checked-out base branch, never creates a branch, never pushes and never opens a
100727
+ pull request. Its result stays on the job card. Humans and the auto-mode
100728
+ overseer can trigger a job with job_run. Use list schedules as a 5-field cron
100729
+ expression with a timezone; a paused job keeps its schedule.
100730
+
100731
+ ## Template catalogue
100732
+
100733
+ packages/shared/src/job-templates.ts owns the catalogue: security audit,
100734
+ outdated dependencies, typecheck, test health, lint and format, build check and
100735
+ release readiness. Each template carries a stable id, body, default cron,
100736
+ category and stack tags. The catalogue is a menu, not a required baseline; a
100737
+ project may get no job when nothing fits.
100738
+
100739
+ The setup tools job_templates_list, job_create_from_template and
100740
+ project_ai_initialize exist only on the one-time project setup run. The control
100741
+ plane adds them to allowedTools while projects.settings.projectAi.initializedAt
100742
+ is empty. After the agent assesses the repository and calls
100743
+ project_ai_initialize, later runs see the normal board tools only. Empty and
100744
+ docs-only repositories must not be initialized, so a later run can try again.
100745
+
100746
+ An uncertain check is proposed with job_propose for human approval instead of
100747
+ being enforced. A proposal is not a job and never runs until a human approves it.
100748
+
100749
+ ## Suggested work
100750
+
100751
+ Build and overseer runs also get short sections asking for missing cards
100752
+ (card_propose) and missing recurring checks (job_propose). Suggestions go to
100753
+ the Todo or Jobs proposal tiles, never onto the source card. Proposals never
100754
+ block the current card and must not be executed in the same run. Read earlier
100755
+ suggestions, including approved and rejected ones, with proposal_list before
100756
+ proposing; re-proposing an earlier title is refused. Project settings -> AI
100757
+ features -> Suggested work turns either section off.
100758
+
100759
+ ## Auto mode
100760
+
100761
+ Auto mode runs a goal epic through one overseer agent. The overseer plans 3 to 8
100762
+ tickets with spec_propose, chains dependencies with blockedBy split refs, and
100763
+ then decides on every delivery state change: merge a green matching PR, retry a
100764
+ failed run, plan the next batch, ask one blocking question or close the goal.
100765
+ Completion is refused while a ticket is not done or a linked PR is open.
100766
+
100767
+ The overseer runs with the build role dials and build routing. It never pushes
100768
+ code itself and never opens a PR; ticket builds own branches and PRs. It wakes
100769
+ on card, PR, check, run and answer events, and at least every 15 minutes.
100770
+
100771
+ Canonical detail: docs/job-templates.md, docs/auto-mode-overseer.md and
100772
+ docs/build-speed-dial.md.`
100773
+ },
100774
+ {
100775
+ id: "release",
100776
+ title: "Releases, images, packages and self-hosting",
100777
+ summary: "Version tags, published images and npm packages, migrations and self-host notes.",
100778
+ tags: ["release", "version", "docker", "npm", "self-host", "migration", "changelog"],
100779
+ body: `# Releases, images, packages and self-hosting
100780
+
100781
+ ## Version and changelog
100782
+
100783
+ CHANGELOG.md at the repository root is canonical. The web app serves a copy at
100784
+ apps/web/public/changelog.md. Run pnpm changelog:sync after a changelog edit;
100785
+ pnpm changelog:check fails on drift.
100786
+ Release tags match vX.Y.Z on master.
100787
+
100788
+ docs/self-host.md is canonical for the self-host guide. The web app serves a
100789
+ copy at apps/web/public/self-host.md. Run pnpm selfhost:sync after a guide edit;
100790
+ pnpm selfhost:check fails on drift.
100791
+
100792
+ ## Published images
100793
+
100794
+ CI builds and publishes these to GHCR for every v* tag:
100795
+
100796
+ - ghcr.io/h4kbas/aglio-web
100797
+ - ghcr.io/h4kbas/aglio-migrate
100798
+ - ghcr.io/h4kbas/aglio-worker
100799
+ - ghcr.io/h4kbas/aglio-runner
100800
+ - ghcr.io/h4kbas/aglio-runner-node
100801
+ - ghcr.io/h4kbas/aglio-runner-python
100802
+ - ghcr.io/h4kbas/aglio-runner-rust
100803
+ - ghcr.io/h4kbas/aglio-runner-go
100804
+ - ghcr.io/h4kbas/aglio-runner-java
100805
+ - ghcr.io/h4kbas/aglio-runner-ruby
100806
+ - ghcr.io/h4kbas/aglio-runner-php
100807
+ - ghcr.io/h4kbas/aglio-runner-dotnet
100808
+
100809
+ Self-hosters pin vX.Y.Z or an immutable digest. Do not document the internal
100810
+ master, sha-, latest or input-hash tags for outside use. scripts/docker-image-hash.mjs
100811
+ hashes each image's inputs, so unchanged images are retagged instead of rebuilt.
100812
+ Every web and worker image carries AGLIO_VERSION from the release tag.
100813
+
100814
+ ## Worker and npm publishes
100815
+
100816
+ A merged PR does not publish anything by itself. If a change touches the worker
100817
+ agent, the runner image or an npm package, say so in the PR body and comment on
100818
+ the card: the project's Publish NPM package and runner release jobs have to run
100819
+ after the merge. Otherwise self-hosters and BYOW machines keep the old build.
100820
+
100821
+ ## Database
100822
+
100823
+ packages/db owns the Drizzle schema and migrations. Generate with pnpm db:generate
100824
+ and apply with pnpm db:migrate. A fresh database migration must reproduce the
100825
+ schema; enum values added in one transaction need their own migration step.
100826
+ Never edit an applied migration.
100827
+
100828
+ ## Self-host
100829
+
100830
+ The self-host bundle installs the web, migrate and Postgres images plus a compose
100831
+ file. BETTER_AUTH_URL and NEXT_PUBLIC_APP_URL must match the public origin;
100832
+ NEXT_PUBLIC_APP_URL is also a web build arg because it is baked into canonical
100833
+ links, sitemap.xml, robots.txt and Open Graph URLs. Postgres is not published.
100834
+ Artifacts use local disk unless AGLIO_STORAGE_DRIVER=s3 is set.
100835
+
100836
+ Canonical detail: README.md, docs/self-host.md and docs/deploy-digitalocean.md.`
100837
+ }
100838
+ ];
100839
+ function normalize2(value) {
100840
+ return value.trim().toLowerCase();
100841
+ }
100842
+ function renderIndex() {
100843
+ const topics = AGLIO_AGENT_DOCS.map(
100844
+ (doc) => `- ${doc.id}: ${doc.title} \u2014 ${doc.summary}`
100845
+ ).join("\n");
100846
+ return `# Aglio docs for agents
100847
+
100848
+ These are Aglio's own operator notes, embedded in the worker because a runner
100849
+ has no Aglio checkout. Use them to answer product questions and to plan changes
100850
+ to Aglio itself, for example a custom worker, a prompt set or a recurring job.
100851
+
100852
+ Call aglio_docs with a topic id to read the full note.
100853
+
100854
+ ${topics}
100855
+
100856
+ Canonical long-form docs live in the Aglio repository under docs/ and are
100857
+ linked from each topic. Commands and paths in these notes describe the Aglio
100858
+ repository, not the repository the current card belongs to.`;
100859
+ }
100860
+ function agentDocsResponse(topic) {
100861
+ const query = topic ? normalize2(topic) : "";
100862
+ if (!query || query === "index" || query === "list" || query === "all") {
100863
+ return renderIndex();
100864
+ }
100865
+ const exact = AGLIO_AGENT_DOCS.find((doc) => doc.id === query);
100866
+ const fuzzy = exact ?? AGLIO_AGENT_DOCS.find(
100867
+ (doc) => normalize2(doc.title) === query || doc.tags.some((tag) => normalize2(tag) === query)
100868
+ ) ?? AGLIO_AGENT_DOCS.find(
100869
+ (doc) => normalize2(doc.title).includes(query) || doc.tags.some((tag) => normalize2(tag).includes(query)) || normalize2(doc.summary).includes(query)
100870
+ );
100871
+ if (!fuzzy) {
100872
+ return `Unknown topic "${topic}".
100873
+
100874
+ ${renderIndex()}`;
100875
+ }
100876
+ const body = fuzzy.body.trim();
100877
+ const heading = body.startsWith("# ") ? "" : `# ${fuzzy.title}
100878
+
100879
+ `;
100880
+ return `${heading}${body}
100881
+
100882
+ ---
100883
+ Topic id: ${fuzzy.id}. Call aglio_docs with another id or no topic for the index.`;
100884
+ }
100885
+
100393
100886
  // src/remote-mcp.ts
100394
100887
  function toolText(value) {
100395
100888
  return {
@@ -100404,6 +100897,16 @@ function toolText(value) {
100404
100897
  function fail(message) {
100405
100898
  return { isError: true, content: [{ type: "text", text: message }] };
100406
100899
  }
100900
+ function registerAgentDocsTool(server) {
100901
+ server.registerTool(
100902
+ "aglio_docs",
100903
+ {
100904
+ description: "Read Aglio operator docs embedded for agents: workers and custom runner images, prompts, jobs, auto mode and releases. Call without a topic for the index.",
100905
+ inputSchema: { topic: external_exports.string().min(1).max(100).optional() }
100906
+ },
100907
+ async ({ topic }) => toolText(agentDocsResponse(topic))
100908
+ );
100909
+ }
100407
100910
  function workspaceHostPath(workspace, input2) {
100408
100911
  const root = resolve6(workspace);
100409
100912
  const trimmed = input2.trim();
@@ -100421,6 +100924,7 @@ function artifactKind(mime) {
100421
100924
  }
100422
100925
  function createConsultServer(run) {
100423
100926
  const server = new McpServer({ name: "aglio-workspace-consultant", version: "1.0.0" });
100927
+ registerAgentDocsTool(server);
100424
100928
  const forward = async (tool, input2) => {
100425
100929
  try {
100426
100930
  return toolText(await run.callTool({ tool, input: input2 }));
@@ -100470,6 +100974,14 @@ function createConsultServer(run) {
100470
100974
  },
100471
100975
  async (input2) => forward("card_get", input2)
100472
100976
  );
100977
+ server.registerTool(
100978
+ "conversation_history",
100979
+ {
100980
+ description: "Read earlier messages in this consultant thread, oldest first. Read-only. Use it instead of expecting the thread to be replayed in the prompt.",
100981
+ inputSchema: { limit: external_exports.number().int().min(1).max(200).optional() }
100982
+ },
100983
+ async (input2) => forward("conversation_history", input2)
100984
+ );
100473
100985
  server.registerTool(
100474
100986
  "card_search",
100475
100987
  {
@@ -100539,6 +101051,19 @@ function createConsultServer(run) {
100539
101051
  },
100540
101052
  async (input2) => forward("job_list", input2)
100541
101053
  );
101054
+ server.registerTool(
101055
+ "proposal_list",
101056
+ {
101057
+ description: "List earlier card and job suggestions in every state, including approved and rejected ones. Read-only.",
101058
+ inputSchema: {
101059
+ projectId: external_exports.string().optional(),
101060
+ kind: external_exports.enum(["card", "job"]).optional(),
101061
+ status: external_exports.enum(["pending", "approved", "separated", "rejected"]).optional(),
101062
+ limit: external_exports.number().int().min(1).max(200).optional()
101063
+ }
101064
+ },
101065
+ async (input2) => forward("proposal_list", input2)
101066
+ );
100542
101067
  server.registerTool(
100543
101068
  "repo_list",
100544
101069
  {
@@ -100733,6 +101258,16 @@ function createConsultServer(run) {
100733
101258
  },
100734
101259
  async (input2) => forward("card_propose", input2)
100735
101260
  );
101261
+ server.registerTool(
101262
+ "project_runner_image_set",
101263
+ {
101264
+ description: "Save the published custom runner image on this project. The worker pulls and runs this image for the project's jobs instead of its stock image. Pass null to clear it. Use after the image is published and verified.",
101265
+ inputSchema: {
101266
+ image: external_exports.string().trim().min(1).max(500).nullable().describe("Full image reference, for example ghcr.io/acme/aglio-runner-web:2026-06.")
101267
+ }
101268
+ },
101269
+ async (input2) => forward("project_runner_image_set", input2)
101270
+ );
100736
101271
  server.registerTool(
100737
101272
  "request_human_action",
100738
101273
  {
@@ -100819,17 +101354,19 @@ function createConsultServer(run) {
100819
101354
  },
100820
101355
  async (input2) => forward("job_run", input2)
100821
101356
  );
100822
- for (const [name2, description] of [
100823
- ["pr_open", "Workspace consultant runs cannot push code or open pull requests. Use run_start."],
100824
- ["pr_merge", "Workspace consultant runs cannot merge pull requests."]
100825
- ]) {
100826
- server.registerTool(name2, { description, inputSchema: {} }, async () => fail(description));
101357
+ for (const refused of REMOTE_CONSULT_REFUSED_TOOLS) {
101358
+ server.registerTool(
101359
+ refused.name,
101360
+ { description: refused.reason, inputSchema: {} },
101361
+ async () => fail(refused.reason)
101362
+ );
100827
101363
  }
100828
101364
  return server;
100829
101365
  }
100830
101366
  function createServerForRun(run) {
100831
101367
  if (run.kind === "workspace_consult") return createConsultServer(run);
100832
101368
  const server = new McpServer({ name: "aglio-board", version: "1.0.0" });
101369
+ registerAgentDocsTool(server);
100833
101370
  const forward = async (tool, input2) => {
100834
101371
  try {
100835
101372
  const result = await run.callTool({ tool, input: input2 });
@@ -100854,6 +101391,14 @@ function createServerForRun(run) {
100854
101391
  },
100855
101392
  async (input2) => forward("card_get", input2)
100856
101393
  );
101394
+ server.registerTool(
101395
+ "conversation_history",
101396
+ {
101397
+ description: "Read earlier messages in this planning or agent chat session, oldest first. Read-only. Build, review, consult and job runs have no chat session; use card_get for their comments and work log.",
101398
+ inputSchema: { limit: external_exports.number().int().min(1).max(200).optional() }
101399
+ },
101400
+ async (input2) => forward("conversation_history", input2)
101401
+ );
100857
101402
  server.registerTool(
100858
101403
  "repo_list",
100859
101404
  { description: "List configured repositories, base branches and verification commands.", inputSchema: {} },
@@ -101000,6 +101545,18 @@ function createServerForRun(run) {
101000
101545
  },
101001
101546
  async (input2) => forward("job_list", input2)
101002
101547
  );
101548
+ server.registerTool(
101549
+ "proposal_list",
101550
+ {
101551
+ description: "List earlier card and job suggestions for this project in every state, including approved and rejected ones. Read-only.",
101552
+ inputSchema: {
101553
+ kind: external_exports.enum(["card", "job"]).optional(),
101554
+ status: external_exports.enum(["pending", "approved", "separated", "rejected"]).optional(),
101555
+ limit: external_exports.number().int().min(1).max(200).optional()
101556
+ }
101557
+ },
101558
+ async (input2) => forward("proposal_list", input2)
101559
+ );
101003
101560
  server.registerTool(
101004
101561
  "job_run",
101005
101562
  {
@@ -101341,6 +101898,7 @@ async function main() {
101341
101898
  override: process.env.AGLIO_WORKER_MCP_URL
101342
101899
  });
101343
101900
  const runnerExtraHosts = sharesAgentNetwork(runnerNetwork) ? [] : process.platform === "linux" ? ["host.docker.internal:host-gateway"] : [];
101901
+ const cacheBinds = mode === "docker" ? runnerCacheBinds() : [];
101344
101902
  let mcpHost = null;
101345
101903
  try {
101346
101904
  mcpHost = createRemoteMcpHost({ port: mcpPort, baseUrl: containerMcpUrl });
@@ -101374,7 +101932,7 @@ async function main() {
101374
101932
  process.on("SIGINT", stop);
101375
101933
  process.on("SIGTERM", stop);
101376
101934
  console.log(
101377
- `[worker-agent] executor ${mode}${mode === "docker" ? ` image=${runnerImage} socket=${dockerSocket}` : ""} network=${runnerNetwork} workspace=${workspaceRoot} hostWorkspace=${hostWorkspaceRoot} capacity=${config2.capacity} mcp=${containerMcpUrl}`
101935
+ `[worker-agent] executor ${mode}${mode === "docker" ? ` image=${runnerImage} socket=${dockerSocket}` : ""} network=${runnerNetwork} workspace=${workspaceRoot} hostWorkspace=${hostWorkspaceRoot} capacity=${config2.capacity} mcp=${containerMcpUrl} cache=${describeRunnerCache(cacheBinds)}`
101378
101936
  );
101379
101937
  const hostTools = await verifyHostRuntime({ mode, labels, platform: process.platform });
101380
101938
  if (hostTools.length > 0) console.log(`[worker-agent] host tools ${hostTools.join(" | ")}`);
@@ -101410,7 +101968,7 @@ async function main() {
101410
101968
  workspace,
101411
101969
  workspaceRoot,
101412
101970
  hostWorkspaceRoot,
101413
- image: resolveRunnerImage({
101971
+ image: job.runnerImage ?? resolveRunnerImage({
101414
101972
  requiredLabels: job.requiredLabels,
101415
101973
  images: runnerImages,
101416
101974
  fallback: runnerImage
@@ -101421,6 +101979,7 @@ async function main() {
101421
101979
  // resolves host.docker.internal already; Linux needs the entry.
101422
101980
  extraHosts: runnerExtraHosts,
101423
101981
  resources: agentResources,
101982
+ cacheBinds,
101424
101983
  log: (message, extra) => console.log(`[worker-agent] ${message}`, extra ?? "")
101425
101984
  }) : void 0
101426
101985
  });