monoban 1.10.0 → 1.12.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/dist/index.mjs +406 -57
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -5954,6 +5954,8 @@ const LOOP_DEFAULTS = {
5954
5954
  merge: true,
5955
5955
  deliverMaxOpen: 1,
5956
5956
  checksMinutes: 60,
5957
+ /** deliver: a run decides the questions only you can settle on its own, at once (no wait for your answer). */
5958
+ askMinutes: 0,
5957
5959
  /** deliver: agentpipe's own tier for its review step. */
5958
5960
  reviewTier: null,
5959
5961
  scavengeMaxOpen: 5
@@ -5970,15 +5972,10 @@ const CONTINUE_STEPS = [
5970
5972
  "merge"
5971
5973
  ];
5972
5974
  /**
5973
- * Why a deliver run stops before `merge` (plan §1.12): the loop doesn't merge (`mergeOff`); nobody queued its task
5974
- * from a browser (`queuedOutside`); or its title or description was written outside a browser after it was queued
5975
- * (`textChanged`). A loop merges on its own only what a person queued from a browser, and nothing has rewritten since.
5975
+ * Why a deliver run stops before `merge`: the loop doesn't merge (`mergeOff`). The rule that also held back a task
5976
+ * not queued from a browser (plan §1.12) was removed by the owner on 2026-11-16.
5976
5977
  */
5977
- const MERGE_HOLDS = [
5978
- "mergeOff",
5979
- "queuedOutside",
5980
- "textChanged"
5981
- ];
5978
+ const MERGE_HOLDS = ["mergeOff"];
5982
5979
  /**
5983
5980
  * Why a loop is paused: you paused it; `pauseAfter` runs in a row failed or needed you; or a run couldn't start
5984
5981
  * (the folder, agentpipe missing, a refusing precondition: the run says which).
@@ -6370,7 +6367,8 @@ const PROBLEM_CODES = [
6370
6367
  "email_not_sent",
6371
6368
  "loops_off",
6372
6369
  "nothing_to_do",
6373
- "pr_open"
6370
+ "pr_open",
6371
+ "too_late"
6374
6372
  ];
6375
6373
  const CODES = new Set(PROBLEM_CODES);
6376
6374
  const isString = (v) => typeof v === "string";
@@ -6458,7 +6456,8 @@ const RUN_EVENT_KINDS = [
6458
6456
  "question",
6459
6457
  "warning",
6460
6458
  "error",
6461
- "activity"
6459
+ "activity",
6460
+ "answer"
6462
6461
  ];
6463
6462
  /** Where a run works. Only on the runner's machine for now; remote (a fresh clone) comes later. */
6464
6463
  const RUN_MODES = ["local"];
@@ -6474,6 +6473,10 @@ const RUN_LIMITS = {
6474
6473
  eventsPerBatch: 200,
6475
6474
  eventMessage: 2e3,
6476
6475
  reason: 1e3,
6476
+ /** An answer to a run's question (the check on task_run_answers.answer). */
6477
+ answer: 2e3,
6478
+ /** Answers per run (guard_task_run_answer). */
6479
+ answersPerRun: 100,
6477
6480
  workdir: 1024,
6478
6481
  runnerName: 64,
6479
6482
  runnersPerUser: 20
@@ -6490,6 +6493,8 @@ function formatDuration(ms) {
6490
6493
  if (minutes < 60) return `${minutes}m${String(seconds % 60).padStart(2, "0")}`;
6491
6494
  return `${Math.floor(minutes / 60)}h${String(minutes % 60).padStart(2, "0")}`;
6492
6495
  }
6496
+ /** A question's id, as agentpipe names it (`plan-2`): never an option (the check on task_run_answers.question_id). */
6497
+ const QUESTION_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/;
6493
6498
  /** A step's mark in a list: ✓ ok, ● running, ✗ failed, – skipped, ■ cancelled, ? needs you. */
6494
6499
  const STEP_MARKS = {
6495
6500
  running: "●",
@@ -7027,20 +7032,29 @@ const loopCommon = {
7027
7032
  /** Runs in a row that failed or need you before it pauses itself. */
7028
7033
  pauseAfter: wholeBetween(LOOP_LIMITS.pauseAfter)
7029
7034
  };
7035
+ /** ASK_MINUTES, one literal each (`z.literal` of a list keeps only the first in the OpenAPI document). */
7036
+ const ASK_MINUTES_SCHEMA = union([
7037
+ literal(0),
7038
+ literal(5),
7039
+ literal(15),
7040
+ literal(30)
7041
+ ]);
7030
7042
  const deliverFields = {
7031
7043
  ...loopCommon,
7032
7044
  /** The column it takes tasks from. */
7033
7045
  column: IdSchema,
7034
7046
  /** Only tasks with this tag, which it takes off when it takes the task; null: every task in the column. */
7035
7047
  tag: IdSchema.nullable(),
7036
- /** Merge each pull request when its checks pass (only a task queued from the browser, plan §1.12). */
7048
+ /** Merge each pull request when its checks pass. */
7037
7049
  merge: boolean(),
7038
7050
  /** Its pull requests that may wait for you before it stops taking tasks. */
7039
7051
  maxOpen: wholeBetween(LOOP_LIMITS.deliverMaxOpen),
7040
7052
  /** How long `checks` waits for CI, in minutes. */
7041
7053
  checksMinutes: wholeBetween(LOOP_LIMITS.checksMinutes),
7042
7054
  /** The agentpipe tier its review step runs on (`--tier`); null: agentpipe's own. */
7043
- reviewTier: string().regex(TIER_NAME, "A tier's name, like light").nullable()
7055
+ reviewTier: string().regex(TIER_NAME, "A tier's name, like light").nullable(),
7056
+ /** How long a run waits for your answer to a question only you can settle, in minutes; 0: it doesn't wait. */
7057
+ askMinutes: ASK_MINUTES_SCHEMA
7044
7058
  };
7045
7059
  const scavengeFields = {
7046
7060
  ...loopCommon,
@@ -7066,7 +7080,8 @@ const DeliverOptionsSchema = strictObject({
7066
7080
  merge: deliverFields.merge.default(LOOP_DEFAULTS.merge),
7067
7081
  maxOpen: deliverFields.maxOpen.default(LOOP_DEFAULTS.deliverMaxOpen),
7068
7082
  checksMinutes: deliverFields.checksMinutes.default(LOOP_DEFAULTS.checksMinutes),
7069
- reviewTier: deliverFields.reviewTier.default(LOOP_DEFAULTS.reviewTier)
7083
+ reviewTier: deliverFields.reviewTier.default(LOOP_DEFAULTS.reviewTier),
7084
+ askMinutes: deliverFields.askMinutes.default(LOOP_DEFAULTS.askMinutes)
7070
7085
  }).refine(budgetFits, {
7071
7086
  message: BUDGET_FITS,
7072
7087
  path: ["budgetUsd"]
@@ -7122,6 +7137,14 @@ const RunStepSchema = object({
7122
7137
  * its column and tag had, and for a run that continues a pull request, the step it starts at, the pull request and
7123
7138
  * the run that opened it. Only the server writes it.
7124
7139
  */
7140
+ /**
7141
+ * The provisional decisions a person accepted for a continued run's merge: agentpipe's decision ids (`agentpipe
7142
+ * ratify` takes them) and the pull request's head commit they read them at.
7143
+ */
7144
+ const DecisionsAcceptSchema = strictObject({
7145
+ decisions: array(string().regex(/^[0-9a-f]{12}$/, "A decision id is 12 hex characters")).min(1).max(20),
7146
+ headSha: string().regex(/^[0-9a-f]{40}$/, "The full commit the decisions were read at")
7147
+ }).meta({ id: "DecisionsAccept" });
7125
7148
  const LoopRunPlanSchema = object({
7126
7149
  /** The loop's options when the run was made (its recipe's: DeliverOptionsSet or ScavengeOptionsSet). */
7127
7150
  options: union([DeliverOptionsSetSchema, ScavengeOptionsSetSchema]),
@@ -7141,7 +7164,9 @@ const LoopRunPlanSchema = object({
7141
7164
  */
7142
7165
  externalId: string().nullable(),
7143
7166
  /** scavenge: how many tasks it may file (its `maxOpen` less its open tasks); null for deliver. */
7144
- limit: number$1().int().nonnegative().nullable()
7167
+ limit: number$1().int().nonnegative().nullable(),
7168
+ /** A run continued from merge after a person accepted the earlier run's provisional decisions; else null. */
7169
+ accept: DecisionsAcceptSchema.nullable().optional()
7145
7170
  }).meta({ id: "LoopRunPlan" });
7146
7171
  /** A coding agent working on a task, on one of your runners. */
7147
7172
  const TaskRunSchema = object({
@@ -7155,12 +7180,11 @@ const TaskRunSchema = object({
7155
7180
  /** What a loop's run was started with; null for a run started on a task. */
7156
7181
  loopRun: LoopRunPlanSchema.nullable(),
7157
7182
  /**
7158
- * A deliver loop's run: whether it may merge its pull request on its own (its loop merges, a browser queued its
7159
- * task, and nothing but a browser has written the task's text since; docs/PLAN-AGENT-LOOPS.md §1.12), read now.
7160
- * Null for a run that isn't a deliver loop's.
7183
+ * A deliver loop's run: whether it may merge its pull request on its own (its loop merges), read now. Null for a
7184
+ * run that isn't a deliver loop's.
7161
7185
  */
7162
7186
  mayMerge: boolean().nullable(),
7163
- /** Why it may not (`mergeOff`, `queuedOutside`, `textChanged`); null when it may, or isn't a deliver loop's. */
7187
+ /** Why it may not (`mergeOff`); null when it may, or isn't a deliver loop's. */
7164
7188
  mergeHold: _enum(MERGE_HOLDS).nullable(),
7165
7189
  runner: object({
7166
7190
  /** Null once the runner is gone. */
@@ -7206,6 +7230,16 @@ const RunProjectSchema = object({
7206
7230
  repo: string().nullable()
7207
7231
  }).meta({ id: "RunProject" });
7208
7232
  const RunToStartSchema = TaskRunSchema.extend({ project: RunProjectSchema }).meta({ id: "RunToStart" });
7233
+ string().regex(QUESTION_ID, "A question's id, like plan-2").meta({ example: "plan-2" });
7234
+ union([strictObject({ text: text().min(1, "Required").max(RUN_LIMITS.answer).regex(/^[^\u0001-\u0008\u000b\u000c\u000e-\u001f\u007f]*$/, "Lines and tabs only, no other control characters") }), strictObject({ skip: literal(true) })]).meta({ id: "RunAnswerCreate" });
7235
+ /** An answer you sent to a run's question: your words, or null for "you decide". What came of it is the run's events. */
7236
+ const RunAnswerSchema = object({
7237
+ id: IdSchema,
7238
+ runId: IdSchema,
7239
+ questionId: string(),
7240
+ text: string().nullable(),
7241
+ createdAt: Timestamp
7242
+ }).meta({ id: "RunAnswer" });
7209
7243
  /** Run an agent on a task, on one of your runners. */
7210
7244
  /** An absolute path on a runner's machine. */
7211
7245
  const Workdir = string().trim().min(1, "Required").max(RUN_LIMITS.workdir).refine(isAbsolutePath, "An absolute path, like /Users/you/code/project").meta({ pattern: "^/" });
@@ -7289,7 +7323,12 @@ object({
7289
7323
  loopId: IdSchema,
7290
7324
  workdir: string(),
7291
7325
  project: RunProjectSchema
7292
- }).meta({ id: "LoopWaiting" })).optional()
7326
+ }).meta({ id: "LoopWaiting" })).optional(),
7327
+ /**
7328
+ * Answers to its running runs' questions it hasn't said what came of yet (no `answer` event names them), oldest
7329
+ * first: it hands each to agentpipe (`agentpipe answer`) and reports the outcome (MON-259).
7330
+ */
7331
+ answers: array(RunAnswerSchema).optional()
7293
7332
  }).meta({ id: "RunnerWork" });
7294
7333
  /** At least one option, or the patch would change nothing (the refine, for JSON Schema: minProperties). */
7295
7334
  const someOption = (o) => Object.keys(o).length > 0;
@@ -7386,13 +7425,24 @@ strictObject({
7386
7425
  /** The task's number in the loop's project (12 for MON-12). */
7387
7426
  task: number$1().int().min(1).max(2147483647).optional(),
7388
7427
  /** Continue the task's pull request from this step (`merge` only when the loop merges); needs `task`. */
7389
- from: _enum(CONTINUE_STEPS).optional()
7428
+ from: _enum(CONTINUE_STEPS).optional(),
7429
+ /**
7430
+ * With `from: "merge"`, from the browser only: the provisional decisions the last run reported, accepted. The run
7431
+ * ratifies them (`agentpipe ratify`) before it merges.
7432
+ */
7433
+ accept: DecisionsAcceptSchema.optional()
7390
7434
  }).refine((body) => body.from === void 0 || body.task !== void 0, {
7391
7435
  message: "Name the task whose pull request to continue",
7392
7436
  path: ["from"]
7437
+ }).refine((body) => body.accept === void 0 || body.from === "merge", {
7438
+ message: "Decisions are accepted for a merge: continue from merge",
7439
+ path: ["accept"]
7393
7440
  }).meta({
7394
7441
  id: "LoopRunCreate",
7395
- dependentRequired: { from: ["task"] }
7442
+ dependentRequired: {
7443
+ from: ["task"],
7444
+ accept: ["from"]
7445
+ }
7396
7446
  });
7397
7447
  PageQuerySchema.extend({
7398
7448
  from: DaySchema.describe("The first day (the client's today, for Today)"),
@@ -8127,7 +8177,7 @@ function archivedByTime(task, archiveAfterDays, now = Date.now()) {
8127
8177
  }
8128
8178
  // src/version.ts
8129
8179
  /** This CLI's version, from package.json (set at build time by tsdown, and by vitest in tests). */
8130
- const VERSION = "1.10.0";
8180
+ const VERSION = "1.12.0";
8131
8181
  /** Sent as X-Monoban-Client, and shown in Settings › CLI sessions. */
8132
8182
  const CLIENT = `cli/${VERSION}`;
8133
8183
  // src/api.ts
@@ -11672,8 +11722,8 @@ const RELEASES = `https://github.com/thiagodmont/homebrew-tap/releases`;
11672
11722
  * agentpipe comes with a new monoban: change these three lines (from the release's checksums.txt) and release.
11673
11723
  */
11674
11724
  const AGENTPIPE = {
11675
- version: "0.8.0",
11676
- wheelSha256: "e1e92ec985827359abd4fbb71c54ebcbdaf5636e810695b2ef321c64a7e20c26",
11725
+ version: "0.11.0",
11726
+ wheelSha256: "7f6920a517bdd8f45f3943fe975b839b36b5a330a89434f62c8ef074ccaa6d6a",
11677
11727
  requirementsSha256: "41a8d073b0087efb80efafeb6a2b4750340d0f64920159cd4c723ed9167d0a98"
11678
11728
  };
11679
11729
  const agentpipeWheel = (version) => `agentpipe-${version}-py3-none-any.whl`;
@@ -11787,7 +11837,7 @@ async function latestVersion(ctx) {
11787
11837
  async function upgrade(ctx, options, kind = thisInstall()) {
11788
11838
  const latest = await latestVersion(ctx);
11789
11839
  const { how, command } = UPGRADE[kind];
11790
- const outdated = latest !== null && newer(latest, "1.10.0");
11840
+ const outdated = latest !== null && newer(latest, "1.12.0");
11791
11841
  if (options.json) {
11792
11842
  ctx.out(JSON.stringify({
11793
11843
  version: VERSION,
@@ -12372,6 +12422,46 @@ const str = (v) => typeof v === "string" && v.trim() ? v.trim() : null;
12372
12422
  const num = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
12373
12423
  /** A message the API takes: one line or more, at most 2000 characters. */
12374
12424
  const clip$1 = (text) => text.length > 2e3 ? `${text.slice(0, 1999)}…` : text;
12425
+ /** `merge.blocked`'s decisions: each with its id, question id, category and answer; anything else is left out. */
12426
+ function decisionsOf(value) {
12427
+ if (!Array.isArray(value)) return [];
12428
+ return value.flatMap((x) => {
12429
+ if (!x || typeof x !== "object") return [];
12430
+ const o = x;
12431
+ const [decisionId, questionId, category, answer] = [
12432
+ str(o.decision_id),
12433
+ str(o.question_id),
12434
+ str(o.category),
12435
+ str(o.answer)
12436
+ ];
12437
+ if (!decisionId || !/^[0-9a-f]{12}$/.test(decisionId) || !questionId || !category || !answer) return [];
12438
+ return [{
12439
+ decisionId,
12440
+ questionId,
12441
+ category,
12442
+ answer,
12443
+ question: str(o.question)
12444
+ }];
12445
+ });
12446
+ }
12447
+ /** `question.asked`'s questions: each with an id, a category and its text; anything else is left out. */
12448
+ function questionsOf(value) {
12449
+ if (!Array.isArray(value)) return [];
12450
+ return value.flatMap((q) => {
12451
+ if (!q || typeof q !== "object") return [];
12452
+ const { id, category, text } = q;
12453
+ const [i, c, t] = [
12454
+ str(id),
12455
+ str(category),
12456
+ str(text)
12457
+ ];
12458
+ return i && c && t ? [{
12459
+ id: i,
12460
+ category: c,
12461
+ text: t
12462
+ }] : [];
12463
+ });
12464
+ }
12375
12465
  /**
12376
12466
  * Turns agentpipe's events into monoban's, one at a time, remembering what it needs across them. agentpipe ends
12377
12467
  * each step twice: first with what the step decided (a skip says `skipped`, with its reason), then with what it
@@ -12395,6 +12485,20 @@ function agentpipeMapper(report) {
12395
12485
  /** `scout --track`: the tasks its `file` step filed (their refs, else their URLs), and `run.end`'s counts. */
12396
12486
  const filed = [];
12397
12487
  let counts = null;
12488
+ /** A window open for your answers (`run --ask-window`): when it closes, and the questions it still waits on. */
12489
+ let asking = null;
12490
+ /** The run's "now" while the window is open: the time it closes in `data` (each reader says it in their own words). */
12491
+ const waiting = (window, step, at) => report.event({
12492
+ kind: "activity",
12493
+ ...step && { step },
12494
+ message: `Waiting for your answer until ${window.until}`,
12495
+ data: {
12496
+ waitingUntil: window.until,
12497
+ questions: window.open.size,
12498
+ ids: [...window.open].join(",")
12499
+ },
12500
+ ...at && { at }
12501
+ });
12398
12502
  const spent = () => report.update({ costUsd: Math.round((total + shipped) * 1e4) / 1e4 });
12399
12503
  const flush = (cost) => {
12400
12504
  if (!pending) return;
@@ -12609,6 +12713,20 @@ function agentpipeMapper(report) {
12609
12713
  });
12610
12714
  return;
12611
12715
  }
12716
+ const asked = e.kind === "question.asked" ? questionsOf(d.questions) : [];
12717
+ if (asked.length) {
12718
+ for (const q of asked) report.event({
12719
+ kind: "question",
12720
+ ...step && { step },
12721
+ message: clip$1(q.text),
12722
+ data: {
12723
+ questionId: q.id,
12724
+ category: q.category
12725
+ },
12726
+ ...at && { at }
12727
+ });
12728
+ return;
12729
+ }
12612
12730
  const text = str(d.question) ?? str(d.text) ?? str(d.message) ?? str(d.reason) ?? "It needs an answer.";
12613
12731
  report.event({
12614
12732
  kind: "question",
@@ -12618,6 +12736,44 @@ function agentpipeMapper(report) {
12618
12736
  });
12619
12737
  return;
12620
12738
  }
12739
+ case "question.prompted": {
12740
+ const seconds = num(d.timeout_s) ?? 0;
12741
+ const ids = Array.isArray(d.ids) ? d.ids.flatMap((id) => str(id) ? [str(id)] : []) : [];
12742
+ if (seconds <= 0 || !ids.length) return;
12743
+ const from = Date.parse(at ?? "");
12744
+ asking = {
12745
+ until: new Date((Number.isNaN(from) ? Date.now() : from) + seconds * 1e3).toISOString(),
12746
+ open: new Set(ids)
12747
+ };
12748
+ waiting(asking, step, at);
12749
+ return;
12750
+ }
12751
+ case "question.settled": {
12752
+ const id = str(d.id);
12753
+ if (!asking || !id || !asking.open.delete(id)) return;
12754
+ if (asking.open.size) {
12755
+ waiting(asking, step, at);
12756
+ return;
12757
+ }
12758
+ asking = null;
12759
+ report.event({
12760
+ kind: "activity",
12761
+ ...step && { step },
12762
+ message: "Answered: it goes on",
12763
+ ...at && { at }
12764
+ });
12765
+ return;
12766
+ }
12767
+ case "question.timeout":
12768
+ if (!asking) return;
12769
+ asking = null;
12770
+ report.event({
12771
+ kind: "activity",
12772
+ ...step && { step },
12773
+ message: "No answer came: it decides on its own",
12774
+ ...at && { at }
12775
+ });
12776
+ return;
12621
12777
  case "error": {
12622
12778
  const text = str(d.message) ?? str(d.kind) ?? "Something went wrong.";
12623
12779
  report.event({
@@ -12668,6 +12824,20 @@ function agentpipeMapper(report) {
12668
12824
  message: ending.reason ?? "",
12669
12825
  ...at && { at }
12670
12826
  });
12827
+ const headSha = str(d.head_sha);
12828
+ if (headSha && /^[0-9a-f]{40}$/.test(headSha)) for (const decision of decisionsOf(d.decisions)) report.event({
12829
+ kind: "question",
12830
+ ...step && { step },
12831
+ message: clip$1(decision.question ?? decision.answer),
12832
+ data: {
12833
+ decisionId: decision.decisionId,
12834
+ questionId: decision.questionId,
12835
+ category: decision.category,
12836
+ answer: decision.answer.slice(0, 2e3),
12837
+ headSha
12838
+ },
12839
+ ...at && { at }
12840
+ });
12671
12841
  return;
12672
12842
  }
12673
12843
  case "ship.end": {
@@ -12715,7 +12885,12 @@ function agentpipeMapper(report) {
12715
12885
  /** What `scout --track` filed (refs, in order), and the numbers behind how it ended (`run.end`'s counts). */
12716
12886
  filed: () => [...filed],
12717
12887
  counts: () => counts,
12718
- flush: () => flush()
12888
+ flush: () => flush(),
12889
+ /**
12890
+ * Whether the run waits for an answer to this question now, with a moment to spare: agentpipe 0.10.0's `answer`
12891
+ * doesn't check, and settles it whenever it comes, over what the run decided once its window closed.
12892
+ */
12893
+ waitsFor: (questionId, now = Date.now()) => Boolean(asking?.open.has(questionId) && Date.parse(asking.until) - now > 3e3)
12719
12894
  };
12720
12895
  }
12721
12896
  /** One stdout line as an event, or null for agentpipe's plain lines ("profile: cached", the step table). */
@@ -12814,6 +12989,42 @@ function agentpipeCommand({ command = "agentpipe", args, cwd, env, monobanBin =
12814
12989
  }
12815
12990
  });
12816
12991
  }
12992
+ /**
12993
+ * Runs a short agentpipe command (`answer`) to its end: how it ended, and what it printed, on one line (its reason
12994
+ * first, then a hint; rich prints to stdout, and wraps it at the terminal's width unless told a wide one).
12995
+ */
12996
+ const execOutput = (command, args, env) => new Promise((resolve) => execFile(command, args, {
12997
+ timeout: 3e4,
12998
+ env: {
12999
+ ...env,
13000
+ COLUMNS: "1000"
13001
+ },
13002
+ maxBuffer: 1048576
13003
+ }, (err, stdout, stderr) => {
13004
+ const said = `${stdout}\n${stderr}`.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
13005
+ resolve({
13006
+ code: err ? typeof err.code === "number" ? err.code : null : 0,
13007
+ said: said || null
13008
+ });
13009
+ }));
13010
+ /**
13011
+ * `agentpipe answer` for an answer you sent from the browser (MON-259): your words after `--`, so nothing in them is
13012
+ * an option (`--agent-answer` is words here), or `--skip` for "you decide". An argv, never a shell.
13013
+ */
13014
+ function answerArgs(runId, questionId, text) {
13015
+ return text === null ? [
13016
+ "answer",
13017
+ runId,
13018
+ questionId,
13019
+ "--skip"
13020
+ ] : [
13021
+ "answer",
13022
+ runId,
13023
+ questionId,
13024
+ "--",
13025
+ text
13026
+ ];
13027
+ }
12817
13028
  /** Runs a short agentpipe command (`cancel`) to its end, whatever it says. */
12818
13029
  const exec = (command, args, env) => new Promise((resolve) => execFile(command, args, {
12819
13030
  timeout: 3e4,
@@ -18043,6 +18254,11 @@ var en_US_default = {
18043
18254
  "delete": {
18044
18255
  "label": "Delete {name}",
18045
18256
  "help": "Delete loop"
18257
+ },
18258
+ "accept": {
18259
+ "label": "Accept {ref}'s {count, plural, one {decision} other {# decisions}} and merge",
18260
+ "help": "Accept the decisions a run's merge waits on",
18261
+ "keywords": "accept ratify decision decisions approve merge provisional"
18046
18262
  }
18047
18263
  },
18048
18264
  archive: {
@@ -18129,9 +18345,9 @@ var en_US_default = {
18129
18345
  "now": "now",
18130
18346
  "task": "task",
18131
18347
  "pr": "PR",
18132
- "hold": "{going, select, yes {Stops before merge} other {Stopped before merge}}: {why, select, mergeOff {merge is off for this loop} queuedOutside {its task was queued outside the browser} other {its text was changed outside the browser after you queued it}}.",
18348
+ "hold": "{going, select, yes {Stops before merge} other {Stopped before merge}}: merge is off for this loop.",
18133
18349
  "waiting": "Waiting for you",
18134
- "waits": "<pr>{ref}'s pull request</pr> is ready for you to merge: {why, select, mergeOff {merge is off for this loop} queuedOutside {its task was queued outside the browser} other {its text was changed outside the browser after you queued it}}.",
18350
+ "waits": "<pr>{ref}'s pull request</pr> is ready for you to merge: merge is off for this loop.",
18135
18351
  "waitsOpen": "<pr>{ref}'s pull request</pr> waits for you.",
18136
18352
  "continue": "Continue {ref}'s pull request",
18137
18353
  "continueHint": "A run picks it up from the step you choose, at the runner's next check-in.{merges, select, yes { Continued from here, it may merge on its own.} other {}}"
@@ -18170,12 +18386,16 @@ var en_US_default = {
18170
18386
  "onlyTagged": "Only tasks tagged",
18171
18387
  "anyTag": "any tag: every task in the column",
18172
18388
  "merge": "Merge each pull request when its checks pass",
18173
- "mergeHint": "Only the tasks you queued from the browser. The others wait for you to merge.",
18389
+ "mergeHint": "Off: each pull request waits for you to merge.",
18174
18390
  "deliverMaxOpen": "Pull requests that may wait for you",
18175
18391
  "checksMinutes": "Wait for checks (minutes)",
18176
18392
  "reviewTier": "Review on",
18177
18393
  "reviewTierHint": "The models agentpipe reviews the pull request with: its tier (--tier).",
18178
18394
  "reviewTierDefault": "agentpipe's own tier",
18395
+ "askMinutes": "Wait for your answers",
18396
+ "askMinutesHint": "A question only you can settle waits this long for your answer before the run decides it on its own. While it waits, the run keeps its worktree and its runner.",
18397
+ "askNever": "Don't wait: it decides on its own",
18398
+ "askFor": "{minutes} minutes",
18179
18399
  "focus": "What to look for",
18180
18400
  "focusPlaceholder": "Tests that fail now and then, and why",
18181
18401
  "filesIn": "Files tasks in",
@@ -18188,7 +18408,7 @@ var en_US_default = {
18188
18408
  "budgetUsdPerDay": "Budget per day (US$)",
18189
18409
  "pauseAfter": "Pause after runs in a row",
18190
18410
  "summary": {
18191
- "deliver": "Every {interval}, on {runner}, it takes {tagged, select, yes {the tasks tagged #{tag} in {column}} other {every task in {column}}}, one at a time, up to {perDay} a day, and opens a pull request for each. {merge, select, yes {It merges each one when its checks pass, for the tasks you queued from the browser; the others wait for you to merge.} other {It leaves each one for you to merge.}} It stops taking tasks while {maxOpen, plural, one {# pull request waits} other {# pull requests wait}} for you, spends at most {budget} a run and {budgetDay} a day, and pauses after {pauseAfter, plural, one {a run that fails or needs you} other {# runs in a row that fail or need you}}.",
18411
+ "deliver": "Every {interval}, on {runner}, it takes {tagged, select, yes {the tasks tagged #{tag} in {column}} other {every task in {column}}}, one at a time, up to {perDay} a day, and opens a pull request for each. {merge, select, yes {It merges each one when its checks pass.} other {It leaves each one for you to merge.}} It stops taking tasks while {maxOpen, plural, one {# pull request waits} other {# pull requests wait}} for you, spends at most {budget} a run and {budgetDay} a day, and pauses after {pauseAfter, plural, one {a run that fails or needs you} other {# runs in a row that fail or need you}}.{askMinutes, plural, =0 {} other { It waits up to # minutes for your answer to a question only you can settle.}}",
18192
18412
  "scavenge": "Every {interval}, on {runner}, it looks for: {focus}. It files what it finds in {column}, tagged #{tag}, and stops filing while {maxOpen, plural, one {# of those tasks is} other {# of those tasks are}} open. It spends at most {budget} a run and {budgetDay} a day, and pauses after {pauseAfter, plural, one {a run that fails or needs you} other {# runs in a row that fail or need you}}.",
18193
18413
  "incomplete": "Fill in the fields above to see what the loop will do."
18194
18414
  },
@@ -18238,7 +18458,17 @@ var en_US_default = {
18238
18458
  "queued": "{name} runs at its runner's next check-in.",
18239
18459
  "deleted": "Deleted {name}.",
18240
18460
  "failed": "That didn't work: try again.",
18241
- "continued": "{ref} continues from {step} at its runner's next check-in."
18461
+ "continued": "{ref} continues from {step} at its runner's next check-in.",
18462
+ "accepted": "{ref} merges at its runner's next check-in, with {count, plural, one {the decision} other {the # decisions}} accepted."
18463
+ },
18464
+ decisions: {
18465
+ "label": "{ref}'s merge waits on {count, plural, one {a decision} other {# decisions}} the agent made on its own",
18466
+ "why": "The agent decided without asking anyone. Read them against the <pr>pull request</pr> at {commit}: accepting them lets it merge that commit, not one pushed after.",
18467
+ "answer": "Its answer:",
18468
+ "accept": "{count, plural, one {Accept it and merge} other {Accept all # and merge}}",
18469
+ "paused": "The loop is paused: resume it, then accept them here.",
18470
+ "hint": "A run continues from merge at the runner's next check-in: it accepts them with agentpipe ratify, then merges. If the branch moved since, it waits for you again.",
18471
+ "accepting": "It accepts {count, plural, one {# decision} other {# decisions}} read at {commit}, then merges."
18242
18472
  }
18243
18473
  },
18244
18474
  notes: {
@@ -18467,7 +18697,8 @@ var en_US_default = {
18467
18697
  pr_open: "This task's pull request may still be open: continue it from a step, or close it first.",
18468
18698
  unreachable: "Couldn't reach monoban. Try again.",
18469
18699
  unreachableShort: "Couldn't reach monoban.",
18470
- cantDeleteAccount: "Couldn't delete your account. Try again."
18700
+ cantDeleteAccount: "Couldn't delete your account. Try again.",
18701
+ too_late: "Too late: the run no longer waits for that answer. It decided on its own; accept or change what it decided."
18471
18702
  },
18472
18703
  projects: {
18473
18704
  empty: {
@@ -18668,6 +18899,7 @@ var en_US_default = {
18668
18899
  "took": "took",
18669
18900
  "pr": "PR",
18670
18901
  "why": "why",
18902
+ "result": "result",
18671
18903
  "queuedOnline": "{runner} starts it when it next checks in, within a minute.",
18672
18904
  "queuedOffline": "{runner} is offline: it starts once <code>monoban runner</code> runs there.",
18673
18905
  "steps": "Steps",
@@ -18676,7 +18908,9 @@ var en_US_default = {
18676
18908
  "noneYet": "none yet",
18677
18909
  "none": "none",
18678
18910
  "now": "now",
18911
+ "waitingForAnswer": "Waiting for your {count, plural, one {answer} other {answers to # questions}} until {time}",
18679
18912
  "reported": "What it reported",
18913
+ "yoursToDecide": "only you can decide this",
18680
18914
  "latest": "latest",
18681
18915
  "event": {
18682
18916
  "pr_opened": "PR",
@@ -18851,11 +19085,7 @@ var en_US_default = {
18851
19085
  "due": "starting",
18852
19086
  "next": "next at {time}"
18853
19087
  },
18854
- "hold": {
18855
- "mergeOff": "merge is off for this loop",
18856
- "queuedOutside": "its task was queued outside the browser",
18857
- "textChanged": "its text was changed outside the browser after you queued it"
18858
- }
19088
+ "hold": { "mergeOff": "merge is off for this loop" }
18859
19089
  },
18860
19090
  history: {
18861
19091
  "verb": {
@@ -19734,8 +19964,8 @@ function describeLoopState({ state, nextAt, why }, words, now = Date.now()) {
19734
19964
  }
19735
19965
  }
19736
19966
  /**
19737
- * Why a deliver run won't merge on its own (contract's `mergeHoldOf`, plan §1.12), in a few words: "its task was
19738
- * queued outside the browser". The loops tab says the same in its own sentences (loops.json `detail.waits`).
19967
+ * Why a deliver run won't merge on its own (contract's `mergeHoldOf`), in a few words: "merge is off for this loop".
19968
+ * The loops tab says the same in its own sentences (loops.json `detail.waits`).
19739
19969
  */
19740
19970
  function describeMergeHold(hold, { t }) {
19741
19971
  return t(`loop.hold.${hold}`);
@@ -21492,16 +21722,16 @@ codexSpec();
21492
21722
  /**
21493
21723
  * `deliver` (docs/PLAN-AGENT-LOOPS.md §1.6): takes a task and delivers it as a pull request: `implement` opens it
21494
21724
  * (a draft), `review` reviews and fixes it, `checks` sees CI green (repairing it) and marks it ready, `feedback`
21495
- * answers its review comments, and `merge` merges it when the run may (plan §1.12: the loop merges, a browser queued
21496
- * the task, nothing but a browser rewrote it since, and this machine allows it). Otherwise the run ends with its pull
21497
- * request ready for you to merge, saying why.
21725
+ * answers its review comments, and `merge` merges it when the run may (the loop merges, and this machine allows it).
21726
+ * Otherwise the run ends with its pull request ready for you to merge, saying why.
21498
21727
  */
21499
21728
  /** A deliver loop's options this recipe reads (the run's plan has them as the loop had them). */
21500
21729
  function options(run) {
21501
21730
  const o = run.plan.options;
21502
21731
  return {
21503
21732
  checksMinutes: o.checksMinutes ?? LOOP_DEFAULTS.checksMinutes,
21504
- reviewTier: o.reviewTier ?? null
21733
+ reviewTier: o.reviewTier ?? null,
21734
+ askMinutes: o.askMinutes ?? LOOP_DEFAULTS.askMinutes
21505
21735
  };
21506
21736
  }
21507
21737
  /** The loop's review tier, if it names one: the preflight checks the folder's agentpipe has it. */
@@ -21509,11 +21739,14 @@ const reviewTierOf = (run) => options(run).reviewTier;
21509
21739
  /** Money as agentpipe takes it: dollars, to the cent. */
21510
21740
  const usd = (n) => (Math.floor(n * 100) / 100).toFixed(2);
21511
21741
  /**
21512
- * `agentpipe run` on the run's task: always `--autonomous` (nobody is there to answer), from an up-to-date base
21513
- * (`--fresh-base`), opening a draft pull request (`checks` marks it ready once it's green), on what is left of the
21514
- * budget. The dry run is the same command with `--dry-run`, so it checks what the run will do.
21742
+ * `agentpipe run` on the run's task: always `--autonomous` (it never stops to ask in a terminal nobody reads), from
21743
+ * an up-to-date base (`--fresh-base`), opening a draft pull request (`checks` marks it ready once it's green), on
21744
+ * what is left of the budget. A loop that waits for your answers (`askMinutes`) holds the questions only you can
21745
+ * settle open that long first (`--ask-window`, AGE-202); otherwise agentpipe decides them at once. The dry run is the
21746
+ * same command with `--dry-run`, so it checks what the run will do.
21515
21747
  */
21516
21748
  function implementArgs(run, budgetUsd) {
21749
+ const { askMinutes } = options(run);
21517
21750
  return [
21518
21751
  "run",
21519
21752
  run.workdir,
@@ -21524,9 +21757,12 @@ function implementArgs(run, budgetUsd) {
21524
21757
  "--fresh-base",
21525
21758
  "--draft",
21526
21759
  "--budget",
21527
- usd(budgetUsd)
21760
+ usd(budgetUsd),
21761
+ ...askMinutes > 0 ? ["--ask-window", String(askMinutes * 60)] : []
21528
21762
  ];
21529
21763
  }
21764
+ /** Whether the run's preview is implement's dry run: a run with its task that doesn't only merge. */
21765
+ const previewed = (run) => Boolean(run.ref) && run.plan.from !== "merge";
21530
21766
  /** `agentpipe review` on the pull request, fixing what it finds, on the loop's tier when it names one. */
21531
21767
  function reviewArgs(run, pr, budgetUsd) {
21532
21768
  const tier = options(run).reviewTier;
@@ -21589,6 +21825,35 @@ function mergeArgs(run, pr, runId) {
21589
21825
  "--json"
21590
21826
  ];
21591
21827
  }
21828
+ /** `agentpipe ratify`: accepts one provisional decision of the run that opened the pull request, at a commit. */
21829
+ function ratifyArgs(decision, runId, headSha) {
21830
+ return [
21831
+ "ratify",
21832
+ decision,
21833
+ runId,
21834
+ "--at",
21835
+ headSha,
21836
+ "--by",
21837
+ "monoban (accepted in the browser)"
21838
+ ];
21839
+ }
21840
+ /**
21841
+ * Continued after a person accepted the last run's decisions in the browser: each ratified at the commit they read,
21842
+ * so a merge of anything newer still refuses (agentpipe binds a ratification to its commit). How it stopped, or
21843
+ * null when agentpipe took them all.
21844
+ */
21845
+ async function ratify(ctx, runId, accept) {
21846
+ for (const decision of accept.decisions) {
21847
+ const ratified = await ctx.agentpipe(ratifyArgs(decision, runId, accept.headSha));
21848
+ if (ratified.ending?.status === "cancelled") return endOf(ratified, "agentpipe ratify");
21849
+ const { exit } = ratified;
21850
+ if (exit.code !== 0) return {
21851
+ status: "needs_human",
21852
+ message: `agentpipe didn't accept decision ${decision}: ${exit.spawnError ?? exit.lastError ?? `\`agentpipe ratify ${decision} ${runId}\` says why`}.`
21853
+ };
21854
+ }
21855
+ return null;
21856
+ }
21592
21857
  /** A step on the run's pull request, skipped when it has none (`implement` found nothing to change). */
21593
21858
  const onPr = (fn) => (ctx) => ctx.pr ? fn(ctx, ctx.pr) : Promise.resolve(skipped("There's no pull request."));
21594
21859
  /** A step's ending from how its command ended: agentpipe's word, else why it stopped without one. */
@@ -21667,6 +21932,8 @@ const deliver = {
21667
21932
  if (!ctx.runId) return skipped("Ready for you to merge: agentpipe didn't say which run opened it.");
21668
21933
  const why = await ctx.mayMerge();
21669
21934
  if (why) return skipped(`Ready for you to merge: ${why}.`);
21935
+ const refused = ctx.run.plan.accept ? await ratify(ctx, ctx.runId, ctx.run.plan.accept) : null;
21936
+ if (refused) return refused;
21670
21937
  const end = endOf(await ctx.agentpipe(mergeArgs(ctx.run, pr, ctx.runId)), "agentpipe merge");
21671
21938
  return end.status === "needs_human" ? {
21672
21939
  ...end,
@@ -21675,8 +21942,9 @@ const deliver = {
21675
21942
  })
21676
21943
  }
21677
21944
  },
21678
- dryRun: (run) => run.ref && run.plan.from !== "merge" ? [...implementArgs(run, run.budgetUsd), "--dry-run"] : null,
21945
+ dryRun: (run) => previewed(run) ? [...implementArgs(run, run.budgetUsd), "--dry-run"] : null,
21679
21946
  tier: (run) => run.plan.from ? null : reviewTierOf(run),
21947
+ needs: (run) => previewed(run) && options(run).askMinutes > 0 ? ["run.ask_window"] : [],
21680
21948
  finished: ({ pr, last }) => {
21681
21949
  if (!pr) return null;
21682
21950
  if (last?.step === "merge" && last.status === "ok") return last.message ?? "Merged.";
@@ -21874,6 +22142,7 @@ function runRecipe(name, run, report, deps) {
21874
22142
  const feed = agentpipeMapper({
21875
22143
  event: (e) => {
21876
22144
  if (e.kind === "pr_opened" && known(e.data?.url)) return;
22145
+ if (e.kind === "activity") deps.onWaiting?.(Boolean(e.data?.waitingUntil));
21877
22146
  report.event({
21878
22147
  ...e,
21879
22148
  ...e.step !== void 0 && e.step !== null && { step: innerStep(outer, e.step) },
@@ -21936,7 +22205,8 @@ function runRecipe(name, run, report, deps) {
21936
22205
  process: started,
21937
22206
  externalId: null,
21938
22207
  shipping,
21939
- finishes: finishing
22208
+ finishes: finishing,
22209
+ waitsFor: feed.waitsFor
21940
22210
  };
21941
22211
  if (cancelled && !finishing) (shipping() ? started.terminate : started.interrupt)();
21942
22212
  const exit = await started.done;
@@ -22035,6 +22305,27 @@ function runRecipe(name, run, report, deps) {
22035
22305
  status: "failed",
22036
22306
  reason: clip(`The run stopped: ${err.message}`, 1e3)
22037
22307
  })),
22308
+ /**
22309
+ * Hands an answer you sent from the browser to agentpipe, while the command running now waits for it (MON-259),
22310
+ * and says what came of it. Not once it stopped waiting: agentpipe would take it over what it decided.
22311
+ */
22312
+ answer: async (a) => {
22313
+ const now = current;
22314
+ if (!now?.externalId || !now.waitsFor(a.questionId)) return {
22315
+ outcome: "too_late",
22316
+ message: `Too late: the run no longer waited for an answer to ${a.questionId}.`
22317
+ };
22318
+ const env = agentpipeEnv(deps.env, deps.monobanBin);
22319
+ const { code, said } = await (deps.execOutput ?? execOutput)(deps.command, answerArgs(now.externalId, a.questionId, a.text), env);
22320
+ if (code === 0) return {
22321
+ outcome: "reached",
22322
+ message: a.text === null ? `It decides ${a.questionId} on its own, as you asked.` : `Your answer to ${a.questionId} reached the run.`
22323
+ };
22324
+ return {
22325
+ outcome: "refused",
22326
+ message: clip(`agentpipe didn't take your answer to ${a.questionId}: ${said ?? `exit code ${code ?? "none"}`}`, 1e3)
22327
+ };
22328
+ },
22038
22329
  cancel: async () => {
22039
22330
  cancelled = true;
22040
22331
  const now = current;
@@ -22193,9 +22484,27 @@ function runBoard(api) {
22193
22484
  * A loop's run goes on with nobody watching, so the preview must also say agentpipe's sandbox is on: for each model
22194
22485
  * step (its `boundary`) and for the repository's own commands (`commands.sandbox`, `[commands] sandbox`), spike S9,
22195
22486
  * AGE-157. A preview that doesn't say refuses it too. And a tier the recipe names (`--tier`) must be one the folder's
22196
- * agentpipe has (`capabilities <folder> --json`, AGE-127).
22487
+ * agentpipe has (`capabilities <folder> --json`, AGE-127), as must every flag the loop's options need (before the
22488
+ * dry run, which would only say it has no such option).
22197
22489
  */
22198
22490
  async function preflight(run, recipe, deps) {
22491
+ let asked = null;
22492
+ const capabilities = () => {
22493
+ asked ??= (deps.capabilities ?? ((folder) => agentpipeCapabilities(deps.command, deps.env, folder)))(run.workdir);
22494
+ return asked;
22495
+ };
22496
+ const needs = recipe.needs?.(run) ?? [];
22497
+ if (needs.length) {
22498
+ const said = await capabilities();
22499
+ const missing = needs.filter((need) => {
22500
+ const [command = "", flag = ""] = need.split(".");
22501
+ return said?.commands?.[command]?.[flag] !== true;
22502
+ });
22503
+ if (missing.length) return clip(`The agentpipe here has no ${missing.map((need) => {
22504
+ const [command = "", flag = ""] = need.split(".");
22505
+ return `\`${command} --${flag.replaceAll("_", "-")}\``;
22506
+ }).join(" or ")}, which the loop's settings need: update it (\`monoban agentpipe update\`), or change the loop.`, 1e3);
22507
+ }
22199
22508
  const args = recipe.dryRun(run);
22200
22509
  if (args) {
22201
22510
  const refused = await dryRun(run, args, recipe.sandboxed ?? null, deps);
@@ -22203,7 +22512,7 @@ async function preflight(run, recipe, deps) {
22203
22512
  }
22204
22513
  const tier = recipe.tier?.(run) ?? null;
22205
22514
  if (tier) {
22206
- const said = await (deps.capabilities ?? ((folder) => agentpipeCapabilities(deps.command, deps.env, folder)))(run.workdir);
22515
+ const said = await capabilities();
22207
22516
  if (!said?.tiers) return `agentpipe couldn't say which tiers ${run.workdir} has, so the review tier ${tier} can't be checked.`;
22208
22517
  if (!said.tiers.includes(tier)) return clip(`agentpipe has no tier ${tier} in ${run.workdir} (it has ${said.tiers.join(", ") || "none"}).`, 1e3);
22209
22518
  }
@@ -22427,6 +22736,7 @@ async function runRunner(ctx, settings, deps, options = {}) {
22427
22736
  ctx.err(`Cancelling ${active.ref}: asked from the board.`);
22428
22737
  active.cancel();
22429
22738
  }
22739
+ for (const a of work.answers ?? []) if (a.runId === run.id) active.answer(a);
22430
22740
  } else if (first) {
22431
22741
  const status = run.recipe ? "cancelled" : "failed";
22432
22742
  await patch(api, run.id, {
@@ -22470,6 +22780,14 @@ async function runRunner(ctx, settings, deps, options = {}) {
22470
22780
  const outbox = new Outbox(api, run.id, now);
22471
22781
  let cancel = async () => {};
22472
22782
  let cancelled = false;
22783
+ /** Answers handed on (or being), so a check-in before the outcome is reported doesn't hand one on twice. */
22784
+ const answered = /* @__PURE__ */ new Set();
22785
+ /** Hands an answer to the run (a loop's run): none until it started. One at a time, in order. */
22786
+ let relay = null;
22787
+ let relaying = Promise.resolve();
22788
+ let reportOf = null;
22789
+ /** Its step's check-in rate (a window open for your answers makes it faster for a while). */
22790
+ let stepSeconds = 5;
22473
22791
  const self = {
22474
22792
  id: run.id,
22475
22793
  ref: ref ?? "a deleted task",
@@ -22479,6 +22797,27 @@ async function runRunner(ctx, settings, deps, options = {}) {
22479
22797
  await cancel();
22480
22798
  },
22481
22799
  flush: () => outbox.flush(),
22800
+ answer: (a) => {
22801
+ if (answered.has(a.id) || !relay || !reportOf) return;
22802
+ answered.add(a.id);
22803
+ const [hand, report] = [relay, reportOf];
22804
+ relaying = relaying.then(async () => {
22805
+ const said = await hand(a).catch((err) => ({
22806
+ outcome: "refused",
22807
+ message: `Couldn't hand on your answer: ${err.message}`
22808
+ }));
22809
+ report.event({
22810
+ kind: "answer",
22811
+ message: said.message,
22812
+ data: {
22813
+ answerId: a.id,
22814
+ questionId: a.questionId,
22815
+ outcome: said.outcome
22816
+ }
22817
+ });
22818
+ wake.abort();
22819
+ });
22820
+ },
22482
22821
  pollSeconds: 5
22483
22822
  };
22484
22823
  return {
@@ -22541,19 +22880,28 @@ async function runRunner(ctx, settings, deps, options = {}) {
22541
22880
  },
22542
22881
  update: (u) => outbox.update(u)
22543
22882
  };
22544
- const started = loopRun && deps.agentpipe ? runRecipe(run.recipe, loopRun, report, {
22883
+ const recipeRun = loopRun && deps.agentpipe ? runRecipe(run.recipe, loopRun, report, {
22545
22884
  ...deps.agentpipe,
22546
22885
  recheck: () => recheck(run.id),
22547
22886
  mayMerge: () => mayMerge(run.id),
22548
22887
  onStep: (seconds) => {
22549
- self.pollSeconds = seconds ?? settings.pollSeconds;
22888
+ stepSeconds = seconds ?? settings.pollSeconds;
22889
+ self.pollSeconds = stepSeconds;
22890
+ },
22891
+ onWaiting: (waiting) => {
22892
+ self.pollSeconds = waiting ? Math.min(stepSeconds, 5) : stepSeconds;
22550
22893
  }
22551
- }) : adapter.start({
22894
+ }) : null;
22895
+ const started = recipeRun ?? adapter.start({
22552
22896
  ref,
22553
22897
  workdir: run.workdir,
22554
22898
  options: run.options
22555
22899
  }, report);
22556
22900
  cancel = started.cancel;
22901
+ if (recipeRun) {
22902
+ relay = recipeRun.answer;
22903
+ reportOf = report;
22904
+ }
22557
22905
  if (cancelled) started.cancel();
22558
22906
  const ending = await started.done;
22559
22907
  await outbox.flush();
@@ -22585,7 +22933,7 @@ async function runRunner(ctx, settings, deps, options = {}) {
22585
22933
  }
22586
22934
  }
22587
22935
  /**
22588
- * Right before a loop's run merges (plan §1.12): null when it may, else why not. This machine's `loops.merge:
22936
+ * Right before a loop's run merges: null when it may, else why not. This machine's `loops.merge:
22589
22937
  * false` says no; otherwise the server, reading the run now (`mayMerge`). Anything but its yes is a no.
22590
22938
  */
22591
22939
  async function mayMerge(runId) {
@@ -22647,6 +22995,7 @@ function describe$1(e) {
22647
22995
  }
22648
22996
  case "pr_opened": return `pull request ${e.message}`;
22649
22997
  case "question": return `? ${e.message}`;
22998
+ case "answer": return `↳ ${e.message}`;
22650
22999
  case "error": return `✗ ${e.message}`;
22651
23000
  default: return null;
22652
23001
  }
@@ -23159,7 +23508,7 @@ function describe({ state, running }, board, now) {
23159
23508
  const seenAgo = `checked in ${since(board.lastSeenAt, now)} ago (every ${board.pollSeconds}s)`;
23160
23509
  row("board", `${board.online ? "online" : "offline"} · ${seenAgo}`);
23161
23510
  } else if (!state.runnerId) row("board", "not on the board yet: it's starting");
23162
- if (state.version !== "1.10.0") {
23511
+ if (state.version !== "1.12.0") {
23163
23512
  const again = state.background ? "`monoban runner restart`" : "start it again in its terminal";
23164
23513
  row("update", `it runs monoban ${state.version}, this is ${VERSION}: ${again}`);
23165
23514
  }
@@ -23597,7 +23946,7 @@ async function checks(ctx, deps = {}) {
23597
23946
  const found = [];
23598
23947
  const latest = await (deps.latest ?? latestVersion)(ctx);
23599
23948
  const upgrade = UPGRADE[thisInstall()].command;
23600
- found.push(latest && newer(latest, "1.10.0") ? {
23949
+ found.push(latest && newer(latest, "1.12.0") ? {
23601
23950
  name: "monoban",
23602
23951
  status: "warn",
23603
23952
  detail: `${VERSION}; ${latest} is out`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoban",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Your monoban.dev kanban board in the terminal: add, move and start tasks, and hand them to coding agents.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://monoban.dev",