monoban 1.12.0 → 1.13.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 +89 -9
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -6495,6 +6495,15 @@ function formatDuration(ms) {
6495
6495
  }
6496
6496
  /** A question's id, as agentpipe names it (`plan-2`): never an option (the check on task_run_answers.question_id). */
6497
6497
  const QUESTION_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/;
6498
+ /**
6499
+ * What came of an answer you sent (an `answer` event, MON-259): it reached the run; it came after the run stopped
6500
+ * waiting for it (agentpipe decided it on its own); or agentpipe refused it.
6501
+ */
6502
+ const ANSWER_OUTCOMES = [
6503
+ "reached",
6504
+ "too_late",
6505
+ "refused"
6506
+ ];
6498
6507
  /** A step's mark in a list: ✓ ok, ● running, ✗ failed, – skipped, ■ cancelled, ? needs you. */
6499
6508
  const STEP_MARKS = {
6500
6509
  running: "●",
@@ -7216,13 +7225,19 @@ const TaskRunSchema = object({
7216
7225
  costUsd: number$1().nullable(),
7217
7226
  /** Someone asked it to stop; it will at its next checkpoint. */
7218
7227
  cancelRequested: boolean(),
7228
+ /**
7229
+ * While it waits for your answer to a question only you can settle (its loop's `askMinutes`, MON-258): until when.
7230
+ * Null when it doesn't wait (its last word is something else, it's not running, or its runner went quiet); it
7231
+ * stops waiting at that time even if this still says it does. `POST …/questions/{questionId}/answer` takes an
7232
+ * answer only while this is in the future.
7233
+ */
7234
+ waitingUntil: Timestamp.nullable(),
7219
7235
  version: Version,
7220
7236
  createdAt: Timestamp,
7221
7237
  startedAt: Timestamp.nullable(),
7222
7238
  finishedAt: Timestamp.nullable(),
7223
7239
  updatedAt: Timestamp
7224
7240
  }).meta({ id: "TaskRun" });
7225
- TaskRunSchema.extend({ steps: array(RunStepSchema) }).meta({ id: "TaskRunDetail" });
7226
7241
  /** A run for a runner to start: with what it needs to check the folder (the project's key and repo). */
7227
7242
  /** A run's project, for the runner to check the folder against (its key, and the repository it's linked to). */
7228
7243
  const RunProjectSchema = object({
@@ -7240,6 +7255,19 @@ const RunAnswerSchema = object({
7240
7255
  text: string().nullable(),
7241
7256
  createdAt: Timestamp
7242
7257
  }).meta({ id: "RunAnswer" });
7258
+ /**
7259
+ * An answer you sent, as the run shows it: with what its runner said came of it (its `answer` event): `reached` the
7260
+ * run, `too_late`, or `refused` (with agentpipe's words, in `said`); null until the runner has handed it on.
7261
+ */
7262
+ const RunAnswerOnRunSchema = RunAnswerSchema.extend({
7263
+ outcome: _enum(ANSWER_OUTCOMES).nullable(),
7264
+ /** The runner's words for it (English), or null. */
7265
+ said: string().nullable()
7266
+ }).meta({ id: "RunAnswerOnRun" });
7267
+ TaskRunSchema.extend({
7268
+ steps: array(RunStepSchema),
7269
+ answers: array(RunAnswerOnRunSchema).max(RUN_LIMITS.answersPerRun)
7270
+ }).meta({ id: "TaskRunDetail" });
7243
7271
  /** Run an agent on a task, on one of your runners. */
7244
7272
  /** An absolute path on a runner's machine. */
7245
7273
  const Workdir = string().trim().min(1, "Required").max(RUN_LIMITS.workdir).refine(isAbsolutePath, "An absolute path, like /Users/you/code/project").meta({ pattern: "^/" });
@@ -8177,7 +8205,7 @@ function archivedByTime(task, archiveAfterDays, now = Date.now()) {
8177
8205
  }
8178
8206
  // src/version.ts
8179
8207
  /** This CLI's version, from package.json (set at build time by tsdown, and by vitest in tests). */
8180
- const VERSION = "1.12.0";
8208
+ const VERSION = "1.13.0";
8181
8209
  /** Sent as X-Monoban-Client, and shown in Settings › CLI sessions. */
8182
8210
  const CLIENT = `cli/${VERSION}`;
8183
8211
  // src/api.ts
@@ -11837,7 +11865,7 @@ async function latestVersion(ctx) {
11837
11865
  async function upgrade(ctx, options, kind = thisInstall()) {
11838
11866
  const latest = await latestVersion(ctx);
11839
11867
  const { how, command } = UPGRADE[kind];
11840
- const outdated = latest !== null && newer(latest, "1.12.0");
11868
+ const outdated = latest !== null && newer(latest, "1.13.0");
11841
11869
  if (options.json) {
11842
11870
  ctx.out(JSON.stringify({
11843
11871
  version: VERSION,
@@ -12422,7 +12450,10 @@ const str = (v) => typeof v === "string" && v.trim() ? v.trim() : null;
12422
12450
  const num = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
12423
12451
  /** A message the API takes: one line or more, at most 2000 characters. */
12424
12452
  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. */
12453
+ /**
12454
+ * `merge.blocked`'s decisions (and `merge.completed`'s `accepted`): each with its id, question id, category and answer;
12455
+ * anything else is left out.
12456
+ */
12426
12457
  function decisionsOf(value) {
12427
12458
  if (!Array.isArray(value)) return [];
12428
12459
  return value.flatMap((x) => {
@@ -12809,6 +12840,19 @@ function agentpipeMapper(report) {
12809
12840
  status: "succeeded",
12810
12841
  reason: sha ? `Merged (${sha.slice(0, 7)}).` : "Merged."
12811
12842
  };
12843
+ for (const decision of decisionsOf(d.accepted)) report.event({
12844
+ kind: "question",
12845
+ ...step && { step },
12846
+ message: clip$1(decision.question ?? decision.answer),
12847
+ data: {
12848
+ decisionId: decision.decisionId,
12849
+ questionId: decision.questionId,
12850
+ category: decision.category,
12851
+ answer: decision.answer.slice(0, 2e3),
12852
+ accepted: "setting"
12853
+ },
12854
+ ...at && { at }
12855
+ });
12812
12856
  return;
12813
12857
  }
12814
12858
  case "merge.blocked": {
@@ -18036,6 +18080,11 @@ var en_US_default = {
18036
18080
  "help": "Back to task",
18037
18081
  "keywords": "run runs orchestrator agent progress steps watch"
18038
18082
  },
18083
+ "answer": {
18084
+ "label": "Answer the question {id}'s run asks",
18085
+ "help": "Answer the question task's run asks",
18086
+ "keywords": "answer question run agent loop decide reply"
18087
+ },
18039
18088
  "undo": { "label": "Undo" }
18040
18089
  },
18041
18090
  move: {
@@ -18917,7 +18966,8 @@ var en_US_default = {
18917
18966
  "board": "board",
18918
18967
  "question": "question",
18919
18968
  "warning": "warning",
18920
- "error": "error"
18969
+ "error": "error",
18970
+ "accepted": "accepted"
18921
18971
  },
18922
18972
  "earlierRuns": "earlier runs",
18923
18973
  "earlierRun": "{date} · {status}",
@@ -18929,7 +18979,35 @@ var en_US_default = {
18929
18979
  "cancelled": "cancelled:",
18930
18980
  "needs_human": "needs human:"
18931
18981
  },
18932
- "attempt": "(attempt {n})"
18982
+ "attempt": "(attempt {n})",
18983
+ "questions": {
18984
+ "label": "Questions waiting for you",
18985
+ "heading": "your answers",
18986
+ "closes": "It waits for you until {time}, then decides on its own.",
18987
+ "unknown": "Question {id} (its text isn't among the latest events)",
18988
+ "field": "Your answer to {id}",
18989
+ "placeholder": "Your answer: it reaches the agent as you write it",
18990
+ "send": "Send",
18991
+ "sending": "Sending…",
18992
+ "skip": "You decide",
18993
+ "skipHint": "“You decide” tells it to decide this one on its own, as if no answer came.",
18994
+ "yours": "You answered: {text}",
18995
+ "yoursSkip": "You left it to the run.",
18996
+ "sent": "Sent: its runner hands it on at its next check-in.",
18997
+ "reached": "It reached the run.",
18998
+ "tooLate": "Too late: the run had stopped waiting, so it decided on its own. If a decision only you can make holds its merge, accept it on the run.",
18999
+ "refused": "agentpipe didn't take it: {said}",
19000
+ "unsent": "The run ended before its runner handed this on.",
19001
+ "tooLateNow": "Too late: the run no longer waits for this answer, so it decides on its own. If a decision only you can make holds its merge, accept it on the run.",
19002
+ "answeredAlready": "It was answered already.",
19003
+ "failed": "Couldn't send it."
19004
+ },
19005
+ "accepted": {
19006
+ "label": "{count, plural, one {# decision} other {# decisions}} the repository's setting accepted",
19007
+ "why": "The agent decided on its own, and the merge went ahead without anyone reading what it decided: agentpipe's setting for this repository (<code>ship.accept_provisional</code>, on the runner's machine, not in monoban or in the repository) accepts decisions of these kinds. Read them against the <pr>pull request</pr>.",
19008
+ "answer": "Its answer:",
19009
+ "authority": "only you could decide this, and nobody read it"
19010
+ }
18933
19011
  },
18934
19012
  runners: {
18935
19013
  "title": "Runners",
@@ -19053,6 +19131,7 @@ var en_US_default = {
19053
19131
  "status": {
19054
19132
  "queued": "waiting for the runner",
19055
19133
  "running": "running",
19134
+ "waiting": "waiting for your answer",
19056
19135
  "cancelling": "cancelling",
19057
19136
  "succeeded": "done",
19058
19137
  "failed": "failed",
@@ -19914,8 +19993,9 @@ function eventAge(iso, words, now = Date.now()) {
19914
19993
  }
19915
19994
  // ../../packages/i18n/src/runs.ts
19916
19995
  /** A run's status in a few words. */
19917
- function describeRunStatus(run, { t }) {
19996
+ function describeRunStatus(run, { t }, now = Date.now()) {
19918
19997
  if (run.status === "running" && run.cancelRequested) return t("run.status.cancelling");
19998
+ if (run.status === "running" && run.waitingUntil && Date.parse(run.waitingUntil) > now) return t("run.status.waiting");
19919
19999
  return t(`run.status.${run.status}`);
19920
20000
  }
19921
20001
  /** "$0.31", "$0.004": what a run or step cost, in US dollars, to a cent once it's a cent or more. */
@@ -23508,7 +23588,7 @@ function describe({ state, running }, board, now) {
23508
23588
  const seenAgo = `checked in ${since(board.lastSeenAt, now)} ago (every ${board.pollSeconds}s)`;
23509
23589
  row("board", `${board.online ? "online" : "offline"} · ${seenAgo}`);
23510
23590
  } else if (!state.runnerId) row("board", "not on the board yet: it's starting");
23511
- if (state.version !== "1.12.0") {
23591
+ if (state.version !== "1.13.0") {
23512
23592
  const again = state.background ? "`monoban runner restart`" : "start it again in its terminal";
23513
23593
  row("update", `it runs monoban ${state.version}, this is ${VERSION}: ${again}`);
23514
23594
  }
@@ -23946,7 +24026,7 @@ async function checks(ctx, deps = {}) {
23946
24026
  const found = [];
23947
24027
  const latest = await (deps.latest ?? latestVersion)(ctx);
23948
24028
  const upgrade = UPGRADE[thisInstall()].command;
23949
- found.push(latest && newer(latest, "1.12.0") ? {
24029
+ found.push(latest && newer(latest, "1.13.0") ? {
23950
24030
  name: "monoban",
23951
24031
  status: "warn",
23952
24032
  detail: `${VERSION}; ${latest} is out`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoban",
3
- "version": "1.12.0",
3
+ "version": "1.13.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",