monoban 1.10.0 → 1.11.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 +148 -37
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -5970,15 +5970,10 @@ const CONTINUE_STEPS = [
5970
5970
  "merge"
5971
5971
  ];
5972
5972
  /**
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.
5973
+ * Why a deliver run stops before `merge`: the loop doesn't merge (`mergeOff`). The rule that also held back a task
5974
+ * not queued from a browser (plan §1.12) was removed by the owner on 2026-11-16.
5976
5975
  */
5977
- const MERGE_HOLDS = [
5978
- "mergeOff",
5979
- "queuedOutside",
5980
- "textChanged"
5981
- ];
5976
+ const MERGE_HOLDS = ["mergeOff"];
5982
5977
  /**
5983
5978
  * Why a loop is paused: you paused it; `pauseAfter` runs in a row failed or needed you; or a run couldn't start
5984
5979
  * (the folder, agentpipe missing, a refusing precondition: the run says which).
@@ -7033,7 +7028,7 @@ const deliverFields = {
7033
7028
  column: IdSchema,
7034
7029
  /** Only tasks with this tag, which it takes off when it takes the task; null: every task in the column. */
7035
7030
  tag: IdSchema.nullable(),
7036
- /** Merge each pull request when its checks pass (only a task queued from the browser, plan §1.12). */
7031
+ /** Merge each pull request when its checks pass. */
7037
7032
  merge: boolean(),
7038
7033
  /** Its pull requests that may wait for you before it stops taking tasks. */
7039
7034
  maxOpen: wholeBetween(LOOP_LIMITS.deliverMaxOpen),
@@ -7122,6 +7117,14 @@ const RunStepSchema = object({
7122
7117
  * its column and tag had, and for a run that continues a pull request, the step it starts at, the pull request and
7123
7118
  * the run that opened it. Only the server writes it.
7124
7119
  */
7120
+ /**
7121
+ * The provisional decisions a person accepted for a continued run's merge: agentpipe's decision ids (`agentpipe
7122
+ * ratify` takes them) and the pull request's head commit they read them at.
7123
+ */
7124
+ const DecisionsAcceptSchema = strictObject({
7125
+ decisions: array(string().regex(/^[0-9a-f]{12}$/, "A decision id is 12 hex characters")).min(1).max(20),
7126
+ headSha: string().regex(/^[0-9a-f]{40}$/, "The full commit the decisions were read at")
7127
+ }).meta({ id: "DecisionsAccept" });
7125
7128
  const LoopRunPlanSchema = object({
7126
7129
  /** The loop's options when the run was made (its recipe's: DeliverOptionsSet or ScavengeOptionsSet). */
7127
7130
  options: union([DeliverOptionsSetSchema, ScavengeOptionsSetSchema]),
@@ -7141,7 +7144,9 @@ const LoopRunPlanSchema = object({
7141
7144
  */
7142
7145
  externalId: string().nullable(),
7143
7146
  /** scavenge: how many tasks it may file (its `maxOpen` less its open tasks); null for deliver. */
7144
- limit: number$1().int().nonnegative().nullable()
7147
+ limit: number$1().int().nonnegative().nullable(),
7148
+ /** A run continued from merge after a person accepted the earlier run's provisional decisions; else null. */
7149
+ accept: DecisionsAcceptSchema.nullable().optional()
7145
7150
  }).meta({ id: "LoopRunPlan" });
7146
7151
  /** A coding agent working on a task, on one of your runners. */
7147
7152
  const TaskRunSchema = object({
@@ -7155,12 +7160,11 @@ const TaskRunSchema = object({
7155
7160
  /** What a loop's run was started with; null for a run started on a task. */
7156
7161
  loopRun: LoopRunPlanSchema.nullable(),
7157
7162
  /**
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.
7163
+ * A deliver loop's run: whether it may merge its pull request on its own (its loop merges), read now. Null for a
7164
+ * run that isn't a deliver loop's.
7161
7165
  */
7162
7166
  mayMerge: boolean().nullable(),
7163
- /** Why it may not (`mergeOff`, `queuedOutside`, `textChanged`); null when it may, or isn't a deliver loop's. */
7167
+ /** Why it may not (`mergeOff`); null when it may, or isn't a deliver loop's. */
7164
7168
  mergeHold: _enum(MERGE_HOLDS).nullable(),
7165
7169
  runner: object({
7166
7170
  /** Null once the runner is gone. */
@@ -7386,13 +7390,24 @@ strictObject({
7386
7390
  /** The task's number in the loop's project (12 for MON-12). */
7387
7391
  task: number$1().int().min(1).max(2147483647).optional(),
7388
7392
  /** Continue the task's pull request from this step (`merge` only when the loop merges); needs `task`. */
7389
- from: _enum(CONTINUE_STEPS).optional()
7393
+ from: _enum(CONTINUE_STEPS).optional(),
7394
+ /**
7395
+ * With `from: "merge"`, from the browser only: the provisional decisions the last run reported, accepted. The run
7396
+ * ratifies them (`agentpipe ratify`) before it merges.
7397
+ */
7398
+ accept: DecisionsAcceptSchema.optional()
7390
7399
  }).refine((body) => body.from === void 0 || body.task !== void 0, {
7391
7400
  message: "Name the task whose pull request to continue",
7392
7401
  path: ["from"]
7402
+ }).refine((body) => body.accept === void 0 || body.from === "merge", {
7403
+ message: "Decisions are accepted for a merge: continue from merge",
7404
+ path: ["accept"]
7393
7405
  }).meta({
7394
7406
  id: "LoopRunCreate",
7395
- dependentRequired: { from: ["task"] }
7407
+ dependentRequired: {
7408
+ from: ["task"],
7409
+ accept: ["from"]
7410
+ }
7396
7411
  });
7397
7412
  PageQuerySchema.extend({
7398
7413
  from: DaySchema.describe("The first day (the client's today, for Today)"),
@@ -8127,7 +8142,7 @@ function archivedByTime(task, archiveAfterDays, now = Date.now()) {
8127
8142
  }
8128
8143
  // src/version.ts
8129
8144
  /** This CLI's version, from package.json (set at build time by tsdown, and by vitest in tests). */
8130
- const VERSION = "1.10.0";
8145
+ const VERSION = "1.11.0";
8131
8146
  /** Sent as X-Monoban-Client, and shown in Settings › CLI sessions. */
8132
8147
  const CLIENT = `cli/${VERSION}`;
8133
8148
  // src/api.ts
@@ -11672,8 +11687,8 @@ const RELEASES = `https://github.com/thiagodmont/homebrew-tap/releases`;
11672
11687
  * agentpipe comes with a new monoban: change these three lines (from the release's checksums.txt) and release.
11673
11688
  */
11674
11689
  const AGENTPIPE = {
11675
- version: "0.8.0",
11676
- wheelSha256: "e1e92ec985827359abd4fbb71c54ebcbdaf5636e810695b2ef321c64a7e20c26",
11690
+ version: "0.10.0",
11691
+ wheelSha256: "19f73117601ab8dabc8caabf63f6777c8eecf114e7e11acea2d6b40b653200d4",
11677
11692
  requirementsSha256: "41a8d073b0087efb80efafeb6a2b4750340d0f64920159cd4c723ed9167d0a98"
11678
11693
  };
11679
11694
  const agentpipeWheel = (version) => `agentpipe-${version}-py3-none-any.whl`;
@@ -11787,7 +11802,7 @@ async function latestVersion(ctx) {
11787
11802
  async function upgrade(ctx, options, kind = thisInstall()) {
11788
11803
  const latest = await latestVersion(ctx);
11789
11804
  const { how, command } = UPGRADE[kind];
11790
- const outdated = latest !== null && newer(latest, "1.10.0");
11805
+ const outdated = latest !== null && newer(latest, "1.11.0");
11791
11806
  if (options.json) {
11792
11807
  ctx.out(JSON.stringify({
11793
11808
  version: VERSION,
@@ -12372,6 +12387,46 @@ const str = (v) => typeof v === "string" && v.trim() ? v.trim() : null;
12372
12387
  const num = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
12373
12388
  /** A message the API takes: one line or more, at most 2000 characters. */
12374
12389
  const clip$1 = (text) => text.length > 2e3 ? `${text.slice(0, 1999)}…` : text;
12390
+ /** `merge.blocked`'s decisions: each with its id, question id, category and answer; anything else is left out. */
12391
+ function decisionsOf(value) {
12392
+ if (!Array.isArray(value)) return [];
12393
+ return value.flatMap((x) => {
12394
+ if (!x || typeof x !== "object") return [];
12395
+ const o = x;
12396
+ const [decisionId, questionId, category, answer] = [
12397
+ str(o.decision_id),
12398
+ str(o.question_id),
12399
+ str(o.category),
12400
+ str(o.answer)
12401
+ ];
12402
+ if (!decisionId || !/^[0-9a-f]{12}$/.test(decisionId) || !questionId || !category || !answer) return [];
12403
+ return [{
12404
+ decisionId,
12405
+ questionId,
12406
+ category,
12407
+ answer,
12408
+ question: str(o.question)
12409
+ }];
12410
+ });
12411
+ }
12412
+ /** `question.asked`'s questions: each with an id, a category and its text; anything else is left out. */
12413
+ function questionsOf(value) {
12414
+ if (!Array.isArray(value)) return [];
12415
+ return value.flatMap((q) => {
12416
+ if (!q || typeof q !== "object") return [];
12417
+ const { id, category, text } = q;
12418
+ const [i, c, t] = [
12419
+ str(id),
12420
+ str(category),
12421
+ str(text)
12422
+ ];
12423
+ return i && c && t ? [{
12424
+ id: i,
12425
+ category: c,
12426
+ text: t
12427
+ }] : [];
12428
+ });
12429
+ }
12375
12430
  /**
12376
12431
  * Turns agentpipe's events into monoban's, one at a time, remembering what it needs across them. agentpipe ends
12377
12432
  * each step twice: first with what the step decided (a skip says `skipped`, with its reason), then with what it
@@ -12609,6 +12664,20 @@ function agentpipeMapper(report) {
12609
12664
  });
12610
12665
  return;
12611
12666
  }
12667
+ const asked = e.kind === "question.asked" ? questionsOf(d.questions) : [];
12668
+ if (asked.length) {
12669
+ for (const q of asked) report.event({
12670
+ kind: "question",
12671
+ ...step && { step },
12672
+ message: clip$1(q.text),
12673
+ data: {
12674
+ questionId: q.id,
12675
+ category: q.category
12676
+ },
12677
+ ...at && { at }
12678
+ });
12679
+ return;
12680
+ }
12612
12681
  const text = str(d.question) ?? str(d.text) ?? str(d.message) ?? str(d.reason) ?? "It needs an answer.";
12613
12682
  report.event({
12614
12683
  kind: "question",
@@ -12668,6 +12737,20 @@ function agentpipeMapper(report) {
12668
12737
  message: ending.reason ?? "",
12669
12738
  ...at && { at }
12670
12739
  });
12740
+ const headSha = str(d.head_sha);
12741
+ if (headSha && /^[0-9a-f]{40}$/.test(headSha)) for (const decision of decisionsOf(d.decisions)) report.event({
12742
+ kind: "question",
12743
+ ...step && { step },
12744
+ message: clip$1(decision.question ?? decision.answer),
12745
+ data: {
12746
+ decisionId: decision.decisionId,
12747
+ questionId: decision.questionId,
12748
+ category: decision.category,
12749
+ answer: decision.answer.slice(0, 2e3),
12750
+ headSha
12751
+ },
12752
+ ...at && { at }
12753
+ });
12671
12754
  return;
12672
12755
  }
12673
12756
  case "ship.end": {
@@ -18129,9 +18212,9 @@ var en_US_default = {
18129
18212
  "now": "now",
18130
18213
  "task": "task",
18131
18214
  "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}}.",
18215
+ "hold": "{going, select, yes {Stops before merge} other {Stopped before merge}}: merge is off for this loop.",
18133
18216
  "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}}.",
18217
+ "waits": "<pr>{ref}'s pull request</pr> is ready for you to merge: merge is off for this loop.",
18135
18218
  "waitsOpen": "<pr>{ref}'s pull request</pr> waits for you.",
18136
18219
  "continue": "Continue {ref}'s pull request",
18137
18220
  "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,7 +18253,7 @@ var en_US_default = {
18170
18253
  "onlyTagged": "Only tasks tagged",
18171
18254
  "anyTag": "any tag: every task in the column",
18172
18255
  "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.",
18256
+ "mergeHint": "Off: each pull request waits for you to merge.",
18174
18257
  "deliverMaxOpen": "Pull requests that may wait for you",
18175
18258
  "checksMinutes": "Wait for checks (minutes)",
18176
18259
  "reviewTier": "Review on",
@@ -18188,7 +18271,7 @@ var en_US_default = {
18188
18271
  "budgetUsdPerDay": "Budget per day (US$)",
18189
18272
  "pauseAfter": "Pause after runs in a row",
18190
18273
  "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}}.",
18274
+ "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}}.",
18192
18275
  "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
18276
  "incomplete": "Fill in the fields above to see what the loop will do."
18194
18277
  },
@@ -18668,6 +18751,7 @@ var en_US_default = {
18668
18751
  "took": "took",
18669
18752
  "pr": "PR",
18670
18753
  "why": "why",
18754
+ "result": "result",
18671
18755
  "queuedOnline": "{runner} starts it when it next checks in, within a minute.",
18672
18756
  "queuedOffline": "{runner} is offline: it starts once <code>monoban runner</code> runs there.",
18673
18757
  "steps": "Steps",
@@ -18677,6 +18761,7 @@ var en_US_default = {
18677
18761
  "none": "none",
18678
18762
  "now": "now",
18679
18763
  "reported": "What it reported",
18764
+ "yoursToDecide": "only you can decide this",
18680
18765
  "latest": "latest",
18681
18766
  "event": {
18682
18767
  "pr_opened": "PR",
@@ -18851,11 +18936,7 @@ var en_US_default = {
18851
18936
  "due": "starting",
18852
18937
  "next": "next at {time}"
18853
18938
  },
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
- }
18939
+ "hold": { "mergeOff": "merge is off for this loop" }
18859
18940
  },
18860
18941
  history: {
18861
18942
  "verb": {
@@ -19734,8 +19815,8 @@ function describeLoopState({ state, nextAt, why }, words, now = Date.now()) {
19734
19815
  }
19735
19816
  }
19736
19817
  /**
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`).
19818
+ * Why a deliver run won't merge on its own (contract's `mergeHoldOf`), in a few words: "merge is off for this loop".
19819
+ * The loops tab says the same in its own sentences (loops.json `detail.waits`).
19739
19820
  */
19740
19821
  function describeMergeHold(hold, { t }) {
19741
19822
  return t(`loop.hold.${hold}`);
@@ -21492,9 +21573,8 @@ codexSpec();
21492
21573
  /**
21493
21574
  * `deliver` (docs/PLAN-AGENT-LOOPS.md §1.6): takes a task and delivers it as a pull request: `implement` opens it
21494
21575
  * (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.
21576
+ * answers its review comments, and `merge` merges it when the run may (the loop merges, and this machine allows it).
21577
+ * Otherwise the run ends with its pull request ready for you to merge, saying why.
21498
21578
  */
21499
21579
  /** A deliver loop's options this recipe reads (the run's plan has them as the loop had them). */
21500
21580
  function options(run) {
@@ -21589,6 +21669,35 @@ function mergeArgs(run, pr, runId) {
21589
21669
  "--json"
21590
21670
  ];
21591
21671
  }
21672
+ /** `agentpipe ratify`: accepts one provisional decision of the run that opened the pull request, at a commit. */
21673
+ function ratifyArgs(decision, runId, headSha) {
21674
+ return [
21675
+ "ratify",
21676
+ decision,
21677
+ runId,
21678
+ "--at",
21679
+ headSha,
21680
+ "--by",
21681
+ "monoban (accepted in the browser)"
21682
+ ];
21683
+ }
21684
+ /**
21685
+ * Continued after a person accepted the last run's decisions in the browser: each ratified at the commit they read,
21686
+ * so a merge of anything newer still refuses (agentpipe binds a ratification to its commit). How it stopped, or
21687
+ * null when agentpipe took them all.
21688
+ */
21689
+ async function ratify(ctx, runId, accept) {
21690
+ for (const decision of accept.decisions) {
21691
+ const ratified = await ctx.agentpipe(ratifyArgs(decision, runId, accept.headSha));
21692
+ if (ratified.ending?.status === "cancelled") return endOf(ratified, "agentpipe ratify");
21693
+ const { exit } = ratified;
21694
+ if (exit.code !== 0) return {
21695
+ status: "needs_human",
21696
+ message: `agentpipe didn't accept decision ${decision}: ${exit.spawnError ?? exit.lastError ?? `\`agentpipe ratify ${decision} ${runId}\` says why`}.`
21697
+ };
21698
+ }
21699
+ return null;
21700
+ }
21592
21701
  /** A step on the run's pull request, skipped when it has none (`implement` found nothing to change). */
21593
21702
  const onPr = (fn) => (ctx) => ctx.pr ? fn(ctx, ctx.pr) : Promise.resolve(skipped("There's no pull request."));
21594
21703
  /** A step's ending from how its command ended: agentpipe's word, else why it stopped without one. */
@@ -21667,6 +21776,8 @@ const deliver = {
21667
21776
  if (!ctx.runId) return skipped("Ready for you to merge: agentpipe didn't say which run opened it.");
21668
21777
  const why = await ctx.mayMerge();
21669
21778
  if (why) return skipped(`Ready for you to merge: ${why}.`);
21779
+ const refused = ctx.run.plan.accept ? await ratify(ctx, ctx.runId, ctx.run.plan.accept) : null;
21780
+ if (refused) return refused;
21670
21781
  const end = endOf(await ctx.agentpipe(mergeArgs(ctx.run, pr, ctx.runId)), "agentpipe merge");
21671
21782
  return end.status === "needs_human" ? {
21672
21783
  ...end,
@@ -22585,7 +22696,7 @@ async function runRunner(ctx, settings, deps, options = {}) {
22585
22696
  }
22586
22697
  }
22587
22698
  /**
22588
- * Right before a loop's run merges (plan §1.12): null when it may, else why not. This machine's `loops.merge:
22699
+ * Right before a loop's run merges: null when it may, else why not. This machine's `loops.merge:
22589
22700
  * false` says no; otherwise the server, reading the run now (`mayMerge`). Anything but its yes is a no.
22590
22701
  */
22591
22702
  async function mayMerge(runId) {
@@ -23159,7 +23270,7 @@ function describe({ state, running }, board, now) {
23159
23270
  const seenAgo = `checked in ${since(board.lastSeenAt, now)} ago (every ${board.pollSeconds}s)`;
23160
23271
  row("board", `${board.online ? "online" : "offline"} · ${seenAgo}`);
23161
23272
  } else if (!state.runnerId) row("board", "not on the board yet: it's starting");
23162
- if (state.version !== "1.10.0") {
23273
+ if (state.version !== "1.11.0") {
23163
23274
  const again = state.background ? "`monoban runner restart`" : "start it again in its terminal";
23164
23275
  row("update", `it runs monoban ${state.version}, this is ${VERSION}: ${again}`);
23165
23276
  }
@@ -23597,7 +23708,7 @@ async function checks(ctx, deps = {}) {
23597
23708
  const found = [];
23598
23709
  const latest = await (deps.latest ?? latestVersion)(ctx);
23599
23710
  const upgrade = UPGRADE[thisInstall()].command;
23600
- found.push(latest && newer(latest, "1.10.0") ? {
23711
+ found.push(latest && newer(latest, "1.11.0") ? {
23601
23712
  name: "monoban",
23602
23713
  status: "warn",
23603
23714
  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.11.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",