spur-board 0.69.0 → 0.71.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.
@@ -1,4 +1,4 @@
1
- import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-a_l5UPaU.mjs";
1
+ import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-BPwdLTBv.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
@@ -1464,6 +1464,20 @@ const checkSchema = z.strictObject({
1464
1464
  state: z.enum(CHECK_STATES).describe("State of the latest run of this check on the head commit."),
1465
1465
  completedAt: at$2.nullable().describe("When the latest run finished; null while it runs.")
1466
1466
  });
1467
+ /**
1468
+ * Link and edit fields a feedback entry and a handed entry share: the direct URL, the newest edit
1469
+ * and a review's inline comments.
1470
+ */
1471
+ const feedbackLinkShape = {
1472
+ url: webUrl.optional().describe("Web URL of the comment or review; missing in snapshots and handed entries written before it."),
1473
+ editedAt: at$2.optional().describe("When it was last edited; for a review the newest edit of its body or its inline comments. Missing when never edited or not yet read."),
1474
+ comments: z.array(z.strictObject({
1475
+ id: z.string().min(1).describe("Stable id of the inline review comment in the source."),
1476
+ url: webUrl.optional().describe("Web URL that opens the inline comment, a thread reply included, in its thread."),
1477
+ threadId: z.string().min(1).optional().describe("Id of the review thread the inline comment belongs to."),
1478
+ editedAt: at$2.optional().describe("When the inline comment was last edited; missing when never edited.")
1479
+ })).optional().describe("A review's inline comments, thread replies included, oldest first within each thread; missing for a comment and a review without inline comments.")
1480
+ };
1467
1481
  const feedbackSchema = z.strictObject({
1468
1482
  kind: z.enum(FEEDBACK_KINDS).describe("Whether this is a comment or a submitted review."),
1469
1483
  id: z.string().min(1).describe("Stable id of the comment or review in the source."),
@@ -1473,7 +1487,8 @@ const feedbackSchema = z.strictObject({
1473
1487
  }).nullable().describe("Who posted it; null for a deleted account."),
1474
1488
  postedAt: at$2.describe("When the comment was posted or the review submitted."),
1475
1489
  state: z.enum(REVIEW_STATES).optional().describe("State of this review; missing for a comment and in snapshots written before it."),
1476
- statusComment: z.literal(true).optional().describe("True for a status comment of a reviewer service, marked by its last line; it is not external feedback. Missing otherwise.")
1490
+ statusComment: z.literal(true).optional().describe("True for a status comment of a reviewer service, marked by its last line; it is not external feedback. Missing otherwise."),
1491
+ ...feedbackLinkShape
1477
1492
  });
1478
1493
  const prFactsSchema = z.strictObject({
1479
1494
  repo: repoSlugSchema.describe("Repository as owner/name."),
@@ -1809,6 +1824,9 @@ const EVENT_KINDS = [
1809
1824
  "task_shadow_moved",
1810
1825
  "task_corrected",
1811
1826
  "dispatcher_mode_changed",
1827
+ "turn_opened",
1828
+ "turn_taken",
1829
+ "turn_closed",
1812
1830
  "block_opened",
1813
1831
  "block_escalated",
1814
1832
  "block_unblocked",
@@ -1980,6 +1998,21 @@ const eventPayloadSchemas = {
1980
1998
  from: z.enum(DISPATCHER_MODES),
1981
1999
  to: z.enum(DISPATCHER_MODES)
1982
2000
  }),
2001
+ /** `addressee` is the turn's executor; an empty `reason` is kept rather than refused. */
2002
+ turn_opened: z.looseObject({
2003
+ turn: S,
2004
+ column: z.enum(COLUMN_IDS),
2005
+ addressee: role,
2006
+ reason: z.string()
2007
+ }),
2008
+ turn_taken: z.looseObject({
2009
+ turn: S,
2010
+ taker: actorIdSchema
2011
+ }),
2012
+ turn_closed: z.looseObject({
2013
+ turn: S,
2014
+ outcome: z.enum(TURN_OUTCOMES)
2015
+ }),
1983
2016
  block_opened: z.looseObject({
1984
2017
  block: S,
1985
2018
  type: z.enum(BLOCK_TYPES),
@@ -2390,6 +2423,57 @@ function defineOperation(spec) {
2390
2423
  };
2391
2424
  }
2392
2425
  //#endregion
2426
+ //#region ../contracts/src/ops/turn-schemas.ts
2427
+ /** One pull request comment or review a turn handed to its executor. */
2428
+ const turnHandedSchema = z.strictObject({
2429
+ ...prRefSchema.shape,
2430
+ kind: z.enum(FEEDBACK_KINDS).describe("Whether this is a comment or a submitted review."),
2431
+ id: z.string().min(1).describe("Stable id of the comment or review in the source."),
2432
+ postedAt: z.iso.datetime().describe("When the comment was posted or the review submitted, ISO 8601 UTC."),
2433
+ ...feedbackLinkShape
2434
+ }).describe("Pull request feedback a turn handed; an edit after the hand hands it again.");
2435
+ /** The return that opened the Dev visit a turn belongs to. */
2436
+ const turnReturnSchema = z.strictObject({
2437
+ by: actorIdSchema.describe("Who returned the task to Dev."),
2438
+ from: z.enum(COLUMN_IDS).describe("Column the task was returned from."),
2439
+ turn: turnIdSchema.describe("The turn the return closed."),
2440
+ block: blockIdSchema.describe("The code block the return opened."),
2441
+ reason: z.string().describe("Reason of the return, verbatim from its code block.")
2442
+ }).describe("The return that sent the task back to Dev and opened this visit.");
2443
+ const turnViewSchema = z.strictObject({
2444
+ id: turnIdSchema,
2445
+ task: taskKeySchema,
2446
+ column: z.enum(COLUMN_IDS).describe("Board column the turn belongs to."),
2447
+ addressee: z.enum(ADDRESSEE_ROLES).describe("Who executes the turn."),
2448
+ reason: z.string().describe("Why the turn was handed to the executor."),
2449
+ handed: z.array(turnHandedSchema).describe("Pull request feedback handed over with the turn."),
2450
+ returned: turnReturnSchema.optional().describe("The return that opened this Dev visit: who returned it, from which column, the closed turn, the code block and its reason. Missing when the visit did not start with a return."),
2451
+ head: commitShaSchema.nullable().describe("Head commit of the task's pull request when the turn was opened; null when the task had no pull request."),
2452
+ at: z.iso.datetime().describe("When the turn was opened, ISO 8601 UTC."),
2453
+ taken: z.strictObject({
2454
+ by: actorIdSchema,
2455
+ at: z.iso.datetime().describe("When the turn was taken, ISO 8601 UTC.")
2456
+ }).nullable().describe("Who took the turn and when; null until it is taken."),
2457
+ threads: z.array(z.strictObject({
2458
+ id: z.string().min(1).describe("Node ID of the review thread."),
2459
+ url: z.url({ protocol: /^https?$/ }).describe("Web URL of the thread's first comment."),
2460
+ outdated: z.boolean().describe("Whether the thread is on a diff line the head no longer has.")
2461
+ }).describe("One unresolved review thread.")).min(1).optional().describe("The unresolved review threads on the task's open pull request, read live, in a Dev turn of a project requiring resolved threads; absent when none, or when the pull request is closed, merged or missing. Fix or answer each thread, then resolve it.")
2462
+ }).describe("A turn: the executor of a column is asked to act on a task.");
2463
+ /** A turn as `task.get` shows it: who executes it, whether it was taken, and how it closed. */
2464
+ const taskTurnSchema = turnViewSchema.pick({
2465
+ id: true,
2466
+ column: true,
2467
+ addressee: true,
2468
+ at: true,
2469
+ taken: true,
2470
+ handed: true,
2471
+ returned: true
2472
+ }).extend({ closed: z.strictObject({
2473
+ at: z.iso.datetime().describe("When the turn closed, ISO 8601 UTC."),
2474
+ outcome: z.enum(TURN_OUTCOMES).describe("How the turn closed; turns closed by a return or a mode switch before those were recorded read moved.")
2475
+ }).nullable().describe("How and when the turn closed; null while it is open.") }).describe("A task's turn: the executor of a column is asked to act on it.");
2476
+ //#endregion
2393
2477
  //#region ../contracts/src/ops/schemas.ts
2394
2478
  /**
2395
2479
  * A comment as every output returns it. `untrusted` is always `true`: the text comes from a
@@ -2427,43 +2511,6 @@ const blockViewSchema = z.strictObject({
2427
2511
  unblockedBy: actorIdSchema.nullable().describe("Actor that unblocked the block; null while open."),
2428
2512
  unblockedAt: z.iso.datetime().nullable().describe("When the block was unblocked; null while open.")
2429
2513
  }).describe("A block on a task.");
2430
- /** One pull request comment or review a turn handed to its executor. */
2431
- const turnHandedSchema = z.strictObject({
2432
- ...prRefSchema.shape,
2433
- kind: z.enum(FEEDBACK_KINDS).describe("Whether this is a comment or a submitted review."),
2434
- id: z.string().min(1).describe("Stable id of the comment or review in the source."),
2435
- postedAt: z.iso.datetime().describe("When the comment was posted or the review submitted, ISO 8601 UTC.")
2436
- }).describe("Pull request feedback handed over with a turn.");
2437
- const turnViewSchema = z.strictObject({
2438
- id: turnIdSchema,
2439
- task: taskKeySchema,
2440
- column: z.enum(COLUMN_IDS).describe("Board column the turn belongs to."),
2441
- addressee: z.enum(ADDRESSEE_ROLES).describe("Who executes the turn."),
2442
- reason: z.string().describe("Why the turn was handed to the executor."),
2443
- handed: z.array(turnHandedSchema).describe("Pull request feedback handed over with the turn."),
2444
- head: commitShaSchema.nullable().describe("Head commit of the task's pull request when the turn was opened; null when the task had no pull request."),
2445
- at: z.iso.datetime().describe("When the turn was opened, ISO 8601 UTC."),
2446
- taken: z.strictObject({
2447
- by: actorIdSchema,
2448
- at: z.iso.datetime().describe("When the turn was taken, ISO 8601 UTC.")
2449
- }).nullable().describe("Who took the turn and when; null until it is taken."),
2450
- threads: z.array(z.strictObject({
2451
- id: z.string().min(1).describe("Node ID of the review thread."),
2452
- url: z.url({ protocol: /^https?$/ }).describe("Web URL of the thread's first comment."),
2453
- outdated: z.boolean().describe("Whether the thread is on a diff line the head no longer has.")
2454
- }).describe("One unresolved review thread.")).min(1).optional().describe("The unresolved review threads on the task's open pull request, read live, in a Dev turn of a project requiring resolved threads; absent when none, or when the pull request is closed, merged or missing. Fix or answer each thread, then resolve it.")
2455
- }).describe("A turn: the executor of a column is asked to act on a task.");
2456
- /** A turn as `task.get` shows it: who executes it, whether it was taken, and how it closed. */
2457
- const taskTurnSchema = turnViewSchema.pick({
2458
- id: true,
2459
- column: true,
2460
- addressee: true,
2461
- at: true,
2462
- taken: true
2463
- }).extend({ closed: z.strictObject({
2464
- at: z.iso.datetime().describe("When the turn closed, ISO 8601 UTC."),
2465
- outcome: z.enum(TURN_OUTCOMES).describe("How the turn closed; turns closed by a return or a mode switch before those were recorded read moved.")
2466
- }).nullable().describe("How and when the turn closed; null while it is open.") }).describe("A task's turn: the executor of a column is asked to act on it.");
2467
2514
  /** One column move from the journal: a dispatcher move, a return to Dev or a correction. */
2468
2515
  const moveViewSchema = z.strictObject({
2469
2516
  at: z.iso.datetime().describe("When the task moved, ISO 8601 UTC."),
@@ -2746,7 +2793,21 @@ const handedReview = {
2746
2793
  number: 42,
2747
2794
  kind: "review",
2748
2795
  id: "PRR_kwDOA1",
2749
- postedAt: at
2796
+ postedAt: at,
2797
+ url: "https://github.com/acme/web/pull/42#pullrequestreview-2001",
2798
+ comments: [{
2799
+ id: "PRRC_kwDOA2",
2800
+ url: "https://github.com/acme/web/pull/42#discussion_r3001",
2801
+ threadId: "PRRT_kwDOA3"
2802
+ }]
2803
+ };
2804
+ /** The return from Review that opened the Dev visit, with its code block. */
2805
+ const returnFromReview = {
2806
+ by: "agent:rev/rev-1",
2807
+ from: "review",
2808
+ turn: "T2",
2809
+ block: codeBlock.id,
2810
+ reason: codeBlock.reason
2750
2811
  };
2751
2812
  const submittedSha = "9f2c4e1b7a3d5c8e0f1a2b3c4d5e6f708192a3b4";
2752
2813
  const item = {
@@ -3045,9 +3106,13 @@ const OPERATIONS = [
3045
3106
  input: { task: "PROJ-123" },
3046
3107
  output: {
3047
3108
  task,
3048
- turn: devTurn,
3109
+ turn: {
3110
+ ...devTurn,
3111
+ handed: [handedReview],
3112
+ returned: returnFromReview
3113
+ },
3049
3114
  links: [],
3050
- blocks: [question],
3115
+ blocks: [question, codeBlock],
3051
3116
  comments: [comment]
3052
3117
  }
3053
3118
  },
@@ -3071,6 +3136,7 @@ const OPERATIONS = [
3071
3136
  by: "agent:rev/rev-1",
3072
3137
  at
3073
3138
  },
3139
+ handed: [],
3074
3140
  closed: null
3075
3141
  },
3076
3142
  links: [],
@@ -3118,10 +3184,12 @@ const OPERATIONS = [
3118
3184
  taken: {
3119
3185
  by: "agent:web/web-7",
3120
3186
  at: later
3121
- }
3187
+ },
3188
+ handed: []
3122
3189
  },
3123
3190
  turns: [{
3124
3191
  ...devTurn,
3192
+ handed: [],
3125
3193
  closed: {
3126
3194
  at: later,
3127
3195
  outcome: "submitted"
@@ -1,5 +1,5 @@
1
- import { d as buildCatalogSnapshot, dt as configSchema, p as OPERATIONS, pt as plainHttpAllowed } from "./chunk-a_l5UPaU.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-eiqYso44.mjs";
1
+ import { d as buildCatalogSnapshot, dt as configSchema, p as OPERATIONS, pt as plainHttpAllowed } from "./chunk-BPwdLTBv.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-B1u_eWSX.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { homedir } from "node:os";
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { Q as ERRORS, _t as SLACK_BOT_SCOPES, a as requestHashOf, dt as configSchema, f as roleCanUseOperation, mt as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-a_l5UPaU.mjs";
1
+ import { Q as ERRORS, _t as SLACK_BOT_SCOPES, a as requestHashOf, dt as configSchema, f as roleCanUseOperation, mt as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-BPwdLTBv.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
3
- import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-eiqYso44.mjs";
4
- import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-CxD6ZAl9.mjs";
3
+ import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-B1u_eWSX.mjs";
4
+ import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-DlDngVbH.mjs";
5
5
  import { createHash, randomBytes, randomUUID } from "node:crypto";
6
6
  import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
7
7
  import { homedir, hostname, userInfo } from "node:os";
package/dist/client.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-eiqYso44.mjs";
1
+ import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-B1u_eWSX.mjs";
2
2
  export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as SLACK_BOT_SCOPES, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, c as tokenRequestStatusSchema, ct as RESERVED_PROJECT, d as buildCatalogSnapshot, dt as configSchema, f as roleCanUseOperation, ft as defaultAddressee, gt as DISPATCHER_MODES, h as renderHttpProblem, ht as COLUMN_IDS, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as boardWideSpurProject, m as turnHandedSchema, mt as requiredSecretKeys, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as plainHttpAllowed, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as configBindings, v as SPACE_IDS, vt as TASK_HOLDS, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, z as parseRingMarker } from "./chunk-a_l5UPaU.mjs";
1
+ import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as SLACK_BOT_SCOPES, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, c as tokenRequestStatusSchema, ct as RESERVED_PROJECT, d as buildCatalogSnapshot, dt as configSchema, f as roleCanUseOperation, ft as defaultAddressee, gt as DISPATCHER_MODES, h as renderHttpProblem, ht as COLUMN_IDS, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as boardWideSpurProject, m as turnHandedSchema, mt as requiredSecretKeys, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as plainHttpAllowed, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as configBindings, v as SPACE_IDS, vt as TASK_HOLDS, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, z as parseRingMarker } from "./chunk-BPwdLTBv.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -8231,6 +8231,38 @@ async function moveViews(db, taskId, options) {
8231
8231
  const query = db.selectFrom("event").selectAll().where("task_id", "=", taskId).where("kind", "in", MOVE_KINDS);
8232
8232
  return ("after" in options ? await query.where("id", ">", options.after).orderBy("id").execute() : (await query.orderBy("id", "desc").limit(options.limit).execute()).reverse()).flatMap((row) => moveView(row) ?? []);
8233
8233
  }
8234
+ /**
8235
+ * The return that opened the visit `turn` belongs to, or undefined. A `task.return` closes the
8236
+ * returned turn of the current visit and bumps the column epoch, so the visit it opens is the one
8237
+ * at the next epoch in the column it moved to. Read from ids and epochs, never from `at`: a later
8238
+ * move cannot add or remove it. The reason is the code block's current reason.
8239
+ */
8240
+ async function turnReturn(db, turn) {
8241
+ const previous = await db.selectFrom("turn").select("id").where("task_id", "=", turn.task_id).where("epoch", "=", turn.epoch - 1).execute();
8242
+ if (previous.length === 0) return void 0;
8243
+ const labels = new Set(previous.map((row) => `T${String(row.id)}`));
8244
+ const moves = await db.selectFrom("event").select([
8245
+ "actor",
8246
+ "actor_ref",
8247
+ "payload"
8248
+ ]).where("task_id", "=", turn.task_id).where("kind", "=", "task_moved").orderBy("id", "desc").execute();
8249
+ for (const row of moves) {
8250
+ const parsed = eventPayloadSchemas.task_moved.safeParse(JSON.parse(row.payload));
8251
+ if (!parsed.success) continue;
8252
+ const { from, to, turn: returned, block } = parsed.data;
8253
+ if (returned === void 0 || block === void 0 || to !== turn.column) continue;
8254
+ if (!labels.has(returned) || !/^B\d+$/.test(block)) continue;
8255
+ const opened = await db.selectFrom("block").select("reason").where("id", "=", Number(block.slice(1))).where("task_id", "=", turn.task_id).executeTakeFirst();
8256
+ if (opened === void 0) return void 0;
8257
+ return {
8258
+ by: eventActor(row),
8259
+ from,
8260
+ turn: returned,
8261
+ block,
8262
+ reason: opened.reason
8263
+ };
8264
+ }
8265
+ }
8234
8266
  function taskView(task) {
8235
8267
  return {
8236
8268
  key: task.key,
@@ -11285,6 +11317,7 @@ function listenApiServer(app, port) {
11285
11317
  //#region ../core/src/app/turns.ts
11286
11318
  const handedSchema = z.array(turnHandedSchema);
11287
11319
  const turnItemKey = (turnId) => `turn:${String(turnId)}`;
11320
+ const turnRef = (turnId) => `T${String(turnId)}`;
11288
11321
  /**
11289
11322
  * Who executes a column's turn: its orchestrator project, the operator, or for a column with
11290
11323
  * no orchestrator the live worker, else the operator.
@@ -11337,6 +11370,12 @@ async function openTurn(trx, input) {
11337
11370
  created_at: at.toISOString(),
11338
11371
  head_sha: snapshot?.head_sha.toLowerCase() ?? null
11339
11372
  }).returningAll().executeTakeFirstOrThrow();
11373
+ await emit(trx, "turn_opened", task.project, task.id, turn.created_at, {
11374
+ turn: turnRef(turn.id),
11375
+ column: turn.column,
11376
+ addressee: turn.role,
11377
+ reason: turn.reason
11378
+ });
11340
11379
  if (role === "operator") await raiseItem(trx, {
11341
11380
  itemKey: turnItemKey(turn.id),
11342
11381
  kind: "turn",
@@ -11380,6 +11419,10 @@ async function takeTurn(trx, input) {
11380
11419
  acked_at: at.toISOString()
11381
11420
  }).where("id", "=", turnId).execute();
11382
11421
  await trx.updateTable("notification").set({ acked_at: at.toISOString() }).where("turn_id", "=", turnId).where("kind", "=", "turn_reminder").where("acked_at", "is", null).where("exhausted_at", "is", null).execute();
11422
+ await emit(trx, "turn_taken", (await trx.selectFrom("task").select("project").where("id", "=", turn.task_id).executeTakeFirstOrThrow()).project, turn.task_id, at.toISOString(), {
11423
+ turn: turnRef(turnId),
11424
+ taker: actor
11425
+ }, actor);
11383
11426
  return true;
11384
11427
  }
11385
11428
  /**
@@ -11392,7 +11435,13 @@ async function closeTurns(trx, input) {
11392
11435
  closed_at: at.toISOString(),
11393
11436
  closed_reason: reason
11394
11437
  }).where("task_id", "=", taskId).where("closed_at", "is", null).returning("id").execute();
11438
+ if (closed.length === 0) return;
11439
+ const task = await trx.selectFrom("task").select("project").where("id", "=", taskId).executeTakeFirstOrThrow();
11395
11440
  for (const { id } of closed) {
11441
+ await emit(trx, "turn_closed", task.project, taskId, at.toISOString(), {
11442
+ turn: turnRef(id),
11443
+ outcome: reason
11444
+ });
11396
11445
  await closeTurnNotification(trx, id, at);
11397
11446
  const item = await trx.selectFrom("operator_item").select("id").where("item_key", "=", turnItemKey(id)).where("cleared_at", "is", null).executeTakeFirst();
11398
11447
  if (item !== void 0) await clearItem(trx, item.id, at);
@@ -11562,14 +11611,19 @@ async function turnFeedbackCursors(db, prs, count) {
11562
11611
  }
11563
11612
  /**
11564
11613
  * The feedback on `ref` that the turns `turnFeedbackCursors` leaves out of `handled` handed over,
11565
- * oldest first and once each. A later poll may have dropped these entries from the PR snapshot,
11566
- * and the poll cursor, which still counts those turns, never pages back to them.
11614
+ * oldest first and once each, as the copy with the newest edit. A later poll may have dropped
11615
+ * these entries from the PR snapshot, and the poll cursor, which still counts those turns, never
11616
+ * pages back to them.
11567
11617
  */
11568
11618
  async function recalledFeedback(db, ref) {
11569
11619
  const entries = [];
11570
11620
  for (const row of await prTurns(db, [ref])) {
11571
11621
  if (!isRecalled(row)) continue;
11572
- for (const entry of handedOn(row, ref)) if (!entries.some((old) => sameHanded(old, entry))) entries.push(entry);
11622
+ for (const entry of handedOn(row, ref)) {
11623
+ const index = entries.findIndex((old) => sameHanded(old, entry));
11624
+ if (index === -1) entries.push(entry);
11625
+ else if (isNewerEdit(entry, entries[index])) entries[index] = entry;
11626
+ }
11573
11627
  }
11574
11628
  return (await withoutStatusComments(db, entries)).sort((left, right) => isNewer(left, right) ? 1 : -1);
11575
11629
  }
@@ -11600,6 +11654,35 @@ async function withoutStatusComments(db, entries) {
11600
11654
  }
11601
11655
  return entries.filter((entry) => !flagged.some((old) => sameHanded(old, entry)));
11602
11656
  }
11657
+ /** Whether `left` carries a newer edit than `right`. */
11658
+ function isNewerEdit(left, right) {
11659
+ if (left.editedAt === void 0) return false;
11660
+ return right.editedAt === void 0 || Date.parse(left.editedAt) > Date.parse(right.editedAt);
11661
+ }
11662
+ /**
11663
+ * The edit baseline of feedback on `ref`: an entry edited after it counts as unhandled again.
11664
+ * Over the turns `turnFeedbackCursors` counts as `handled`, each copy of the entry gives its
11665
+ * `editedAt`; else, with a `url`, no bound (this version handed it unedited, so any edit counts);
11666
+ * else its turn's `created_at` (handed before entries had either). The newest copy wins. An entry
11667
+ * no turn handed gets the earliest `created_at` of the turns that handed a newer entry, or none.
11668
+ */
11669
+ async function editBaselines(db, ref) {
11670
+ const turns = (await prTurns(db, [ref])).filter((row) => !isRecalled(row)).map((row) => ({
11671
+ at: Date.parse(row.created_at),
11672
+ entries: handedOn(row, ref)
11673
+ }));
11674
+ return (entry) => {
11675
+ let base;
11676
+ for (const { at, entries } of turns) for (const copy of entries) {
11677
+ if (!sameHanded(copy, entry)) continue;
11678
+ const own = copy.editedAt !== void 0 ? Date.parse(copy.editedAt) : copy.url !== void 0 ? -Infinity : at;
11679
+ base = base === void 0 ? own : Math.max(base, own);
11680
+ }
11681
+ if (base !== void 0) return base;
11682
+ const newer = turns.filter(({ entries }) => entries.some((copy) => isNewer(copy, entry)));
11683
+ return Math.min(Infinity, ...newer.map(({ at }) => at));
11684
+ };
11685
+ }
11603
11686
  /** Whether two handed entries are the same feedback on the same PR. */
11604
11687
  function sameHanded(left, right) {
11605
11688
  return left.repo.toLowerCase() === right.repo.toLowerCase() && left.number === right.number && left.kind === right.kind && left.id === right.id;
@@ -11611,7 +11694,8 @@ function prTurns(db, prs) {
11611
11694
  "link.number",
11612
11695
  "turn.handed",
11613
11696
  "turn.acked_at",
11614
- "turn.closed_reason"
11697
+ "turn.closed_reason",
11698
+ "turn.created_at"
11615
11699
  ]).where("link.entity", "=", "pr").where("link.banned", "=", 0).where(sql`lower(link.repo)`, "in", prs.map((pr) => pr.repo.toLowerCase())).execute();
11616
11700
  }
11617
11701
  /** Whether a correction or a reroute closed the turn before anyone took it. */
@@ -15656,8 +15740,10 @@ function externalApproval(pr, agentLogin) {
15656
15740
  * by its own state, or, in a snapshot written before entries had one, when it matches the
15657
15741
  * reviewer's latest approval. An entry is handled once a turn handed it over, or an older one,
15658
15742
  * unless a correction or a reroute closed that turn untaken, or once a handling submission
15659
- * (`handlingSubmits`) on this PR was made at or after it. The entries such an untaken turn handed
15660
- * over come from the turn when a later poll dropped them from the snapshot (`recalledFeedback`).
15743
+ * (`handlingSubmits`) on this PR was made at or after it and its last edit. An edit after the
15744
+ * entry's baseline (`editBaselines`) makes it unhandled again, so it is handed once per edit.
15745
+ * The entries such an untaken turn handed over come from the turn when a later poll dropped them
15746
+ * from the snapshot (`recalledFeedback`).
15661
15747
  * A reviewer service's status comment (`statusComment`) never counts, and neither a recall nor a
15662
15748
  * reroute hands one over again (`withoutStatusComments` in `turns.ts`).
15663
15749
  */
@@ -15672,11 +15758,20 @@ async function unhandledFeedback(trx, task, project, pr) {
15672
15758
  number: pr.number
15673
15759
  }], "handled");
15674
15760
  const fromSnapshot = entries.map((entry) => handedOf(pr, entry));
15675
- return [...(await recalledFeedback(trx, {
15761
+ const recalled = (await recalledFeedback(trx, {
15676
15762
  kind: "pr",
15677
15763
  repo: pr.repo,
15678
15764
  number: pr.number
15679
- })).filter((entry) => !fromSnapshot.some((old) => sameHanded(old, entry))), ...fromSnapshot].filter((entry) => !(Date.parse(entry.postedAt) <= newest) && (cursor === void 0 || isNewer(entry, cursor)));
15765
+ })).filter((entry) => !fromSnapshot.some((old) => sameHanded(old, entry)));
15766
+ const baseline = await editBaselines(trx, {
15767
+ kind: "pr",
15768
+ repo: pr.repo,
15769
+ number: pr.number
15770
+ });
15771
+ return [...recalled, ...fromSnapshot].filter((entry) => {
15772
+ const edited = entry.editedAt === void 0 ? -Infinity : Date.parse(entry.editedAt);
15773
+ return !(Math.max(Date.parse(entry.postedAt), edited) <= newest) && (cursor === void 0 || isNewer(entry, cursor) || edited > baseline(entry));
15774
+ });
15680
15775
  }
15681
15776
  /**
15682
15777
  * The submissions of `taskIds` that handle the external feedback posted before them on the PR
@@ -15749,7 +15844,10 @@ function handedOf(pr, entry) {
15749
15844
  number: pr.number,
15750
15845
  kind: entry.kind,
15751
15846
  id: entry.id,
15752
- postedAt: entry.postedAt
15847
+ postedAt: entry.postedAt,
15848
+ ...entry.url === void 0 ? {} : { url: entry.url },
15849
+ ...entry.editedAt === void 0 ? {} : { editedAt: entry.editedAt },
15850
+ ...entry.comments === void 0 ? {} : { comments: entry.comments }
15753
15851
  };
15754
15852
  }
15755
15853
  /** The clock passed `until` and a complete poll of each of `repos` started at or after it. */
@@ -16027,7 +16125,10 @@ async function applyOn(trx, task, read, result, ctx) {
16027
16125
  at
16028
16126
  });
16029
16127
  const carried = replaced === void 0 ? [] : await carriedFeedback(trx, replaced);
16030
- const handed = [...carried, ...read.handed.filter((entry) => !carried.some((old) => sameHanded(old, entry)))];
16128
+ const handed = [...carried.map((old) => {
16129
+ const fresh = read.handed.find((entry) => sameHanded(old, entry));
16130
+ return fresh !== void 0 && isNewerEdit(fresh, old) ? fresh : old;
16131
+ }), ...read.handed.filter((entry) => !carried.some((old) => sameHanded(old, entry)))];
16031
16132
  const reason = read.mergedOpen === void 0 || turn.kind === "reroute" ? turnReason(turn, replaced?.reason) : `${turnReason(turn)} (PR ${read.mergedOpen.repo}#${String(read.mergedOpen.number)} merged, ticket still open)`;
16032
16133
  await openTurn(trx, {
16033
16134
  task: current,
@@ -16135,7 +16236,8 @@ async function dispatchMergedTickets(trx, source, ctx) {
16135
16236
  //#region ../core/src/app/task-turns.ts
16136
16237
  /** How many closed turns `task.get --detail` shows. */
16137
16238
  const DETAIL_TURNS = 5;
16138
- function taskTurnView(turn) {
16239
+ async function taskTurnView(trx, turn) {
16240
+ const returned = await turnReturn(trx, turn);
16139
16241
  return {
16140
16242
  id: `T${String(turn.id)}`,
16141
16243
  column: turn.column,
@@ -16145,6 +16247,8 @@ function taskTurnView(turn) {
16145
16247
  by: turn.acked_by,
16146
16248
  at: turn.acked_at
16147
16249
  },
16250
+ handed: turnHanded(turn),
16251
+ ...returned === void 0 ? {} : { returned },
16148
16252
  closed: turn.closed_at === null || turn.closed_reason === null ? null : {
16149
16253
  at: turn.closed_at,
16150
16254
  outcome: turn.closed_reason
@@ -16157,13 +16261,39 @@ function taskTurnView(turn) {
16157
16261
  */
16158
16262
  async function taskTurns(trx, task, detail) {
16159
16263
  const open = await trx.selectFrom("turn").selectAll().where("task_id", "=", task.id).where("closed_at", "is", null).orderBy("id", "desc").executeTakeFirst();
16160
- const turn = open === void 0 ? null : taskTurnView(open);
16264
+ const turn = open === void 0 ? null : await taskTurnView(trx, open);
16161
16265
  if (!detail) return { turn };
16266
+ const closed = await trx.selectFrom("turn").selectAll().where("task_id", "=", task.id).where("closed_at", "is not", null).orderBy("id", "desc").limit(DETAIL_TURNS).execute();
16267
+ const turns = [];
16268
+ for (const row of closed) turns.push(await taskTurnView(trx, row));
16162
16269
  return {
16163
16270
  turn,
16164
- turns: (await trx.selectFrom("turn").selectAll().where("task_id", "=", task.id).where("closed_at", "is not", null).orderBy("id", "desc").limit(DETAIL_TURNS).execute()).map(taskTurnView)
16271
+ turns
16165
16272
  };
16166
16273
  }
16274
+ /** The summary of a turn open, take or close: the turn, its executor, taker or outcome. */
16275
+ function turnSummary(kind, payloadText) {
16276
+ try {
16277
+ if (kind === "turn_opened") {
16278
+ const payload = eventPayloadSchemas[kind].safeParse(JSON.parse(payloadText));
16279
+ if (!payload.success) return null;
16280
+ const { turn, column, addressee } = payload.data;
16281
+ const reason = payload.data.reason.replace(/\s+/g, " ").trim();
16282
+ return `Turn ${turn} opened in ${column} for ${addressee}${reason === "" ? "" : `: ${reason}`}`;
16283
+ }
16284
+ if (kind === "turn_taken") {
16285
+ const payload = eventPayloadSchemas[kind].safeParse(JSON.parse(payloadText));
16286
+ return payload.success ? `Turn ${payload.data.turn} taken by ${payload.data.taker}` : null;
16287
+ }
16288
+ if (kind === "turn_closed") {
16289
+ const payload = eventPayloadSchemas[kind].safeParse(JSON.parse(payloadText));
16290
+ return payload.success ? `Turn ${payload.data.turn} closed: ${payload.data.outcome}` : null;
16291
+ }
16292
+ return null;
16293
+ } catch {
16294
+ return null;
16295
+ }
16296
+ }
16167
16297
  //#endregion
16168
16298
  //#region ../core/src/app/task-sessions.ts
16169
16299
  /** Current facts of the effective session links that task.get exposes. */
@@ -16197,9 +16327,13 @@ async function turnThreads(trx, taskId, project, turn) {
16197
16327
  }]);
16198
16328
  return threads.length === 0 ? void 0 : threads;
16199
16329
  }
16200
- /** A turn as the worker and `task.get --why` read it, with the threads of a Dev turn. */
16330
+ /**
16331
+ * A turn as the worker and `task.get --why` read it, with the return that opened its visit and the
16332
+ * threads of a Dev turn.
16333
+ */
16201
16334
  async function turnView(trx, turn, task, project) {
16202
16335
  const threads = await turnThreads(trx, task.id, project, turn);
16336
+ const returned = await turnReturn(trx, turn);
16203
16337
  return {
16204
16338
  id: `T${String(turn.id)}`,
16205
16339
  task: task.key,
@@ -16207,6 +16341,7 @@ async function turnView(trx, turn, task, project) {
16207
16341
  addressee: turn.role,
16208
16342
  reason: turn.reason,
16209
16343
  handed: turnHanded(turn),
16344
+ ...returned === void 0 ? {} : { returned },
16210
16345
  head: turn.head_sha,
16211
16346
  at: turn.created_at,
16212
16347
  taken: turn.acked_by === null || turn.acked_at === null ? null : {
@@ -16247,6 +16382,9 @@ const EVENT_SUMMARIES = {
16247
16382
  task_shadow_moved: "Shadow move",
16248
16383
  task_corrected: "Column corrected by the operator",
16249
16384
  dispatcher_mode_changed: "Dispatcher mode changed",
16385
+ turn_opened: "Turn opened",
16386
+ turn_taken: "Turn taken",
16387
+ turn_closed: "Turn closed",
16250
16388
  block_opened: "Block opened",
16251
16389
  block_escalated: "Block escalated",
16252
16390
  block_unblocked: "Block unblocked",
@@ -16453,7 +16591,7 @@ function createTaskQueries(deps) {
16453
16591
  at: row.at,
16454
16592
  kind,
16455
16593
  actor: eventActor(row),
16456
- summary: linkOrEscalationSummary(kind, row.payload) ?? shadowSummary(kind, row.payload) ?? submitSummary(kind, row.payload) ?? EVENT_SUMMARIES[kind]
16594
+ summary: linkOrEscalationSummary(kind, row.payload) ?? shadowSummary(kind, row.payload) ?? submitSummary(kind, row.payload) ?? turnSummary(kind, row.payload) ?? EVENT_SUMMARIES[kind]
16457
16595
  }];
16458
16596
  });
16459
16597
  return {
@@ -19515,9 +19653,9 @@ function teamScopeDenied(error, query) {
19515
19653
  return /\b(?:slug|name)\b/i.test(error.message) && /\bread:(?:org|discussion)\b/i.test(error.message);
19516
19654
  }
19517
19655
  const REVIEWER_FIELDS = "requestedReviewer { __typename ... on Bot { login } ... on Mannequin { login } ... on User { login } ... on Team { slug } ... on EnterpriseTeam { slug } } asCodeOwner";
19518
- const REVIEW_FIELDS = "id author { __typename login } state commit { oid } submittedAt";
19519
- const COMMENT_FIELDS = "nodes { id author { __typename login } createdAt body } pageInfo { hasPreviousPage startCursor }";
19520
- const THREAD_FIELDS = "id isResolved isOutdated comments(first: 1) { nodes { url } }";
19656
+ const REVIEW_FIELDS = "id author { __typename login } state commit { oid } submittedAt url lastEditedAt";
19657
+ const COMMENT_FIELDS = "nodes { id author { __typename login } createdAt body url lastEditedAt } pageInfo { hasPreviousPage startCursor }";
19658
+ const THREAD_FIELDS = "id isResolved isOutdated comments(last: 100) { nodes { id url lastEditedAt pullRequestReview { id } } }";
19521
19659
  const CLOSING_FIELDS = "nodes { number repository { nameWithOwner } } pageInfo { hasNextPage endCursor }";
19522
19660
  const prFields = (number, closing = false) => `id number url title updatedAt mergedAt closedAt state isDraft mergeable mergeStateStatus
19523
19661
  author { login } headRefName headRefOid
@@ -19530,7 +19668,7 @@ const prFields = (number, closing = false) => `id number url title updatedAt mer
19530
19668
  reviewThreads(first: 100) { nodes { ${THREAD_FIELDS} } pageInfo { hasNextPage endCursor } }
19531
19669
  reviewRequests(first: 100) { nodes { ${REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }${closing ? `\n closingIssuesReferences(first: 100) { ${CLOSING_FIELDS} }` : ""}`;
19532
19670
  const DISCOVERY_FIELDS = `nodes { number updatedAt author { login } state } pageInfo { hasNextPage endCursor }`;
19533
- const INDEX_FIELDS = `number updatedAt state isDraft mergeable mergeStateStatus headRefOid statusCheckRollup { state contexts(first: 100) { totalCount nodes { ... on CheckRun { __typename name status conclusion completedAt } ... on StatusContext { __typename context state } } } } reviews(first: 100) { totalCount nodes { id state } } reviewThreads(first: 100) { totalCount nodes { isResolved } } reviewRequests(first: 100) { totalCount nodes { ${REVIEWER_FIELDS} } } comments(last: 1) { totalCount nodes { id } }`;
19671
+ const INDEX_FIELDS = `number updatedAt state isDraft mergeable mergeStateStatus headRefOid statusCheckRollup { state contexts(first: 100) { totalCount nodes { ... on CheckRun { __typename name status conclusion completedAt } ... on StatusContext { __typename context state } } } } reviews(first: 100) { totalCount nodes { id state lastEditedAt } } reviewThreads(first: 100) { totalCount nodes { isResolved } } reviewRequests(first: 100) { totalCount nodes { ${REVIEWER_FIELDS} } } comments(last: 1) { totalCount nodes { id } } edited: comments(first: 1, orderBy: {field: UPDATED_AT, direction: DESC}) { nodes { id updatedAt } }`;
19534
19672
  function aliases(numbers, fields) {
19535
19673
  return numbers.map((number, i) => `pr${String(i)}: repository(owner: $owner, name: $repo) { pullRequest(number: ${String(number)}) { ${fields(number)} } }`).join("\n");
19536
19674
  }
@@ -19686,6 +19824,47 @@ function nextPage(connection) {
19686
19824
  return endCursor;
19687
19825
  }
19688
19826
  //#endregion
19827
+ //#region ../adapters/src/github/feedbackLinks.ts
19828
+ const threadCommentWire = z.object({
19829
+ id: z.string().min(1),
19830
+ url: z.string().optional(),
19831
+ lastEditedAt: z.string().nullish(),
19832
+ pullRequestReview: z.object({ id: z.string().min(1) }).nullish()
19833
+ });
19834
+ const threadWire = z.object({
19835
+ id: z.string().min(1).optional(),
19836
+ isResolved: z.boolean(),
19837
+ isOutdated: z.boolean().optional(),
19838
+ comments: z.object({ nodes: z.array(threadCommentWire) }).optional()
19839
+ });
19840
+ /** The newest of the given edit times; undefined when none was edited. */
19841
+ function newestEdit(times) {
19842
+ return times.reduce((newest, time) => time == null || newest !== void 0 && Date.parse(newest) >= Date.parse(time) ? newest : time, void 0);
19843
+ }
19844
+ /** The link fields of a fact: each only when GitHub gave it, never guessed. */
19845
+ function linkOf(url, editedAt) {
19846
+ return {
19847
+ ...url === void 0 ? {} : { url },
19848
+ ...editedAt == null ? {} : { editedAt }
19849
+ };
19850
+ }
19851
+ /** Each review's inline comments by review id, in thread order and oldest first in a thread. */
19852
+ function inlineComments(threads) {
19853
+ const byReview = /* @__PURE__ */ new Map();
19854
+ for (const thread of threads) for (const node of thread.comments?.nodes ?? []) {
19855
+ const review = node.pullRequestReview?.id;
19856
+ if (review === void 0) continue;
19857
+ const list = byReview.get(review) ?? [];
19858
+ list.push({
19859
+ id: node.id,
19860
+ ...linkOf(node.url, node.lastEditedAt),
19861
+ ...thread.id === void 0 ? {} : { threadId: thread.id }
19862
+ });
19863
+ byReview.set(review, list);
19864
+ }
19865
+ return byReview;
19866
+ }
19867
+ //#endregion
19689
19868
  //#region ../adapters/src/github/prBatch.ts
19690
19869
  const KEPT_REVIEWS = [
19691
19870
  "approved",
@@ -19720,14 +19899,18 @@ const reviewWire = z.object({
19720
19899
  author: typedActor,
19721
19900
  state: z.string(),
19722
19901
  commit: z.object({ oid: z.string() }).nullable(),
19723
- submittedAt: z.string().nullish()
19902
+ submittedAt: z.string().nullish(),
19903
+ url: z.string().optional(),
19904
+ lastEditedAt: z.string().nullish()
19724
19905
  }).refine((review) => review.commit !== null || !review.author?.login || review.submittedAt == null || !KEPT_REVIEWS.includes(review.state.toLowerCase()), { path: ["commit"] });
19725
19906
  const nodes = (node) => z.object({ nodes: z.array(node) });
19726
19907
  const commentWire = z.object({
19727
19908
  id: z.string().min(1),
19728
19909
  author: typedActor,
19729
19910
  createdAt: z.iso.datetime(),
19730
- body: z.string().optional()
19911
+ body: z.string().optional(),
19912
+ url: z.string().optional(),
19913
+ lastEditedAt: z.iso.datetime().nullish()
19731
19914
  });
19732
19915
  const loginReviewer = (type) => z.object({
19733
19916
  __typename: z.literal(type),
@@ -19765,12 +19948,7 @@ const prWire = z.object({
19765
19948
  statusCheckRollup: z.object({ contexts: nodes(contextWire) }).nullish(),
19766
19949
  reviews: nodes(reviewWire),
19767
19950
  comments: nodes(commentWire),
19768
- reviewThreads: nodes(z.object({
19769
- id: z.string().optional(),
19770
- isResolved: z.boolean(),
19771
- isOutdated: z.boolean().optional(),
19772
- comments: nodes(z.object({ url: z.string() })).optional()
19773
- })),
19951
+ reviewThreads: nodes(threadWire),
19774
19952
  reviewRequests: nodes(z.object({
19775
19953
  requestedReviewer: reviewerWire,
19776
19954
  asCodeOwner: z.boolean()
@@ -19901,7 +20079,8 @@ function isStatusComment(body) {
19901
20079
  const last = body?.trimEnd().split("\n").at(-1);
19902
20080
  return last !== void 0 && STATUS_LINE.test(last);
19903
20081
  }
19904
- function feedbackOf(reviews, comments, held) {
20082
+ function feedbackOf(reviews, comments, threads, held) {
20083
+ const inline = inlineComments(threads);
19905
20084
  const entries = /* @__PURE__ */ new Map();
19906
20085
  const add = (entry) => {
19907
20086
  entries.set(`${entry.kind}:${entry.id}`, entry);
@@ -19912,17 +20091,22 @@ function feedbackOf(reviews, comments, held) {
19912
20091
  id: node.id,
19913
20092
  author: feedbackAuthor(node.author),
19914
20093
  postedAt: node.createdAt,
19915
- ...isStatusComment(node.body) ? { statusComment: true } : {}
20094
+ ...isStatusComment(node.body) ? { statusComment: true } : {},
20095
+ ...linkOf(node.url, node.lastEditedAt)
19916
20096
  });
19917
20097
  for (const node of reviews) {
19918
20098
  if (node.submittedAt == null) continue;
19919
20099
  const state = REVIEW_STATES.find((known) => known === node.state.toLowerCase());
20100
+ const own = inline.get(node.id) ?? [];
20101
+ const editedAt = newestEdit([node.lastEditedAt, ...own.map((entry) => entry.editedAt)]);
19920
20102
  add({
19921
20103
  kind: "review",
19922
20104
  id: node.id,
19923
20105
  author: feedbackAuthor(node.author),
19924
20106
  postedAt: node.submittedAt,
19925
- ...state === void 0 ? {} : { state }
20107
+ ...state === void 0 ? {} : { state },
20108
+ ...linkOf(node.url, editedAt),
20109
+ ...own.length === 0 ? {} : { comments: own }
19926
20110
  });
19927
20111
  }
19928
20112
  const tie = (entry) => `${entry.id}\u0000${entry.kind}`;
@@ -20061,7 +20245,7 @@ function normalizePr(repo, value, rule, feedbackComplete, held = []) {
20061
20245
  updatedAt: wire.updatedAt,
20062
20246
  ...state === "merged" && wire.mergedAt !== null ? { mergedAt: wire.mergedAt } : {},
20063
20247
  ...state === "closed" && wire.closedAt !== null ? { closedAt: wire.closedAt } : {},
20064
- feedback: feedbackOf(wire.reviews.nodes, wire.comments.nodes, held),
20248
+ feedback: feedbackOf(wire.reviews.nodes, wire.comments.nodes, wire.reviewThreads.nodes, held),
20065
20249
  feedbackComplete
20066
20250
  };
20067
20251
  const parsed = prFactsSchema.safeParse(facts);
@@ -20096,7 +20280,8 @@ const indexAliasWire = z.object({ pullRequest: z.object({
20096
20280
  }).nullable(),
20097
20281
  reviews: counted(z.object({
20098
20282
  id: z.string(),
20099
- state: z.string()
20283
+ state: z.string(),
20284
+ lastEditedAt: z.string().nullable()
20100
20285
  })),
20101
20286
  reviewThreads: counted(z.object({ isResolved: z.boolean() })),
20102
20287
  reviewRequests: counted(z.object({
@@ -20107,7 +20292,11 @@ const indexAliasWire = z.object({ pullRequest: z.object({
20107
20292
  }).nullable(),
20108
20293
  asCodeOwner: z.boolean()
20109
20294
  })),
20110
- comments: counted(z.object({ id: z.string() }))
20295
+ comments: counted(z.object({ id: z.string() })),
20296
+ edited: z.object({ nodes: z.array(z.object({
20297
+ id: z.string(),
20298
+ updatedAt: z.string()
20299
+ })) })
20111
20300
  }) });
20112
20301
  /** Reads one index alias; a shape that does not parse means the PR is read in full. */
20113
20302
  function indexEntry(alias) {
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-a_l5UPaU.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-eiqYso44.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-CxD6ZAl9.mjs";
1
+ import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-BPwdLTBv.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-B1u_eWSX.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DlDngVbH.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.69.0",
3
+ "version": "0.71.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -0,0 +1,19 @@
1
+ # Blocks and escalation
2
+
3
+ ## Blocks and escalation
4
+
5
+ A question (`needs_input`): column orchestrator, else curator, else
6
+ operator. Routing avoids asking yourself; curators ask the operator.
7
+
8
+ A `code` block goes to the worker; `dependency` or `external` block stays with
9
+ its author's role. Escalation: column orchestrator to curator to
10
+ operator; other blocks escalate straight to the operator. Keyed
11
+ `board escalate <block>` if its addressee cannot resolve it.
12
+
13
+ Taskless: all roles, operator only:
14
+ `board project ask <project> <text> --to operator --key <key>`.
15
+ Project `needs_input` blocks get Slack threads except operator-agent asks;
16
+ operator: `board inbox`, keyed `board answer`. Answers reach a current curator session; other roles use the asking session.
17
+
18
+ `projects[].columns[].orchestrator`, `projects[].spurProjects[].role`,
19
+ `operator.slack`.
@@ -0,0 +1,66 @@
1
+ # Columns and executors
2
+
3
+ ## Columns and executors
4
+
5
+ `todo`, `ready-for-dev`, `dev`, `review`, `product-review`,
6
+ `external-review`, `qa`, `ready-to-merge`, `done`.
7
+ `projects[].columns[].enabled`: disabled/omitted columns skip gates;
8
+ To Do, Dev, Done stay enabled.
9
+
10
+ Each column has one executor: `projects[].columns[].orchestrator`:
11
+ `none` (live worker, else operator), `operator`, or project with role
12
+ `orchestrator` or `curator`. The worker owns the code and branch; others inspect/return, never push.
13
+
14
+ `projects[].spurProjects[].role` accepts `worker`, `operator`, `curator` and
15
+ `orchestrator`.
16
+
17
+ Top-level `spurProjects[].columns` fills `none` columns board-wide;
18
+ `role: operator` there serves operatorless projects, one session acting in
19
+ each. A project-level binding wins.
20
+
21
+ ## Gates and placement
22
+
23
+ Facts (head, checks, reviews, comments, ticket, sessions) feed gates; two actions: move the task and open an executor turn (at most one
24
+ per evaluation). Turns follow unmet entry gates, actionable post-submit failures,
25
+ rerouting or Done wrap-up. Holds and existing turns can yield neither action.
26
+
27
+ Moves, turns and course checks need `projects[].dispatcher.mode: on`;
28
+ default is `shadow`: no doorbells or blocks.
29
+
30
+ Gates are cumulative: each column checks its enabled gate and those to its left. At a turn boundary, failed gates return to the leftmost failing
31
+ column. Taken turns hold until submit, return or a new head. Pending CI, unknown
32
+ mergeability and incomplete comment history are waits. Downstream handoff waits
33
+ for settled prerequisites; Dev can receive a repair turn.
34
+
35
+ Dev needs an open non-draft PR, passing checks, no conflict, handled
36
+ feedback, comment history and current-head submit. Feedback excludes
37
+ bots, approvals and `projects[].operatorGithubLogin` (agents' account), so worker
38
+ thread replies never count; others' posts do.
39
+ The repo owner's and the human operator's own accounts count too, unless one is
40
+ that login: a PR comment is a change request; talk to agents in Slack
41
+ (`@shortName`) or the Board. A review-thread reply is a new review. An approval
42
+ hides its inline comments; thread resolution and the head a comment was left on
43
+ change nothing for feedback. Bots (GitHub Apps) neither return a task, approve it nor block
44
+ an approval; their threads still count. Handled means handed by ID to a Dev turn, not answered; in shadow
45
+ mode, a later submit in Dev or an executor `none` column handles it.
46
+ An edit after the hand makes it unhandled again, returning a task right of Dev.
47
+ A status comment whose last line is a hidden `board-reviewer-progress` or
48
+ `board-reviewer-unavailable` marker is not external feedback. No required checks: non-skipped count. `projects[].reposWithoutCi` waives absent checks
49
+ for listed repos; never failed/skipped required ones.
50
+
51
+ Review and Product Review need current-head internal review marks, separate from
52
+ External Review's external approval. QA: current-head submit; Ready to Merge awaits merge. Executor `none` may reuse same-head submits of other worker columns. Fixed gate rules have no configuration switch
53
+ except enabled columns, no-CI and resolved threads.
54
+
55
+ `projects[].columns[].requireResolvedThreads` (default: `ready-to-merge` only)
56
+ gates that column and those right of it: an unresolved review thread, outdated
57
+ or by anyone, returns the task to Dev, whose turn lists each thread link. The
58
+ worker fixes or answers, then resolves each; reviewers never do. A
59
+ Dev submit on the same head moves right, keeping marks and approval. An
60
+ approval's inline notes are threads; it still passes External Review.
61
+
62
+ Review/Product Review mark lasts across visits on the current head. A visit
63
+ submission belongs to one column visit; moving left clears it and those to the right. New heads invalidate internal Review and Product Review marks.
64
+
65
+ PR closed without merge with no open PR, or closed
66
+ ticket with live work and no merged PR. `board status` lists them as operator block threads.
@@ -0,0 +1,6 @@
1
+ # Done follows the ticket
2
+
3
+ ## Done follows the ticket
4
+
5
+ One linked PR merging does not by itself finish the task. Done: `projects[].tracker.doneStatuses` for Jira; for GitHub, the Issue must be
6
+ closed. If still open, link another PR.
@@ -0,0 +1,26 @@
1
+ # Slack now
2
+
3
+ ## Slack now
4
+
5
+ `slack.channels.feed`: curator answers and operator items,
6
+ except delivery/health/ended-worker items and blocks.
7
+ `slack.channels.orchestrators`: block threads addressed to the operator by
8
+ others. Answer in the existing block thread.
9
+
10
+ ## Slack addressing
11
+
12
+ With a `projects[].spurProjects[].shortName`, `spurProjects[].shortName` or
13
+ board-wide operator, a new operator message in
14
+ `slack.channels.orchestrators` starts a conversation. A leading registered
15
+ `@shortName` selects that Spur project and is stripped. With absent or unknown
16
+ leading name, complete text, retaining any
17
+ unknown prefix, goes to `slack.defaultAddressee`, else board-wide operator, else
18
+ first project with an operator; else Board replies once with the valid prefixes.
19
+ Middle mentions or Slack `<@U…>` address nobody; unknown names cause no lookup
20
+ error. The operator checks short-name collisions with workspace names.
21
+ A task key after the prefix attaches it.
22
+
23
+ Read `board inbox`; reply via `board answer`. Each operator thread message rings again; `close` or ✅ in the
24
+ thread closes it. Replies use `projects[].spurProjects[].displayName` and `icon`, top-level ones too,
25
+ else project name and role icon (`board` for operator). No session:
26
+ `board status` lists it as waiting.
@@ -0,0 +1,67 @@
1
+ # Turns and delivery
2
+
3
+ ## Turns and delivery
4
+
5
+ A turn `T<number>`: keyed `board inbox ack <entries>`.
6
+ Only the acknowledging session may submit or return: keyed
7
+ `board submit <turn> <sha>` accepts the head; keyed
8
+ `board return <turn> <reason>` sends findings to Dev. In
9
+ shadow mode, use keyed `board submit <task> <sha>`.
10
+ Unseen heads answer `pending`: that submit is final; do not resubmit or raise a
11
+ block. Confirm timeout: `projects[].dispatcher.submitConfirmMs`.
12
+
13
+ A new head closes taken turns outside Dev; taken Dev turns survive pushes.
14
+ Right of Dev, red CI, a draft, a conflict, an external comment or an unresolved
15
+ thread where required returns the task to Dev at once, unless a turn is taken; then after its submit or return.
16
+ The Dev turn hands the comments, beside a return's `code` block.
17
+ Each handed entry has its `url`, `editedAt` once edited, and a review's inline
18
+ `comments` with `url` and `threadId`. Turns of a Dev visit opened by a return
19
+ show `returned`: who, from, the turn, the `code` block and the verbatim reason.
20
+
21
+ Closed turns receive no further Board sends; Obsolete queued rings are dropped;
22
+ a message already accepted by Spur cannot be retracted. Check `board inbox` and
23
+ act only on a current turn; reread after `turn_closed`.
24
+ Task history (`board task history <task>`) shows journal events `turn_opened`,
25
+ `turn_taken` and `turn_closed`: executor, taker, outcome.
26
+
27
+ Open-turn executors in `needs_input`, `error`, `rate_limited` or `stopped` raise
28
+ one question after `health.turnStallAfterMs` (default 600000): curator unless self, else
29
+ operator. Time starts at the later turn/state start; taking never resets it.
30
+ One frozen explanation/dismissal per turn/session/state episode. Recovery,
31
+ replacement, removal, archive or turn closure withdraws it. Blind Spur opens none,
32
+ holds existing; gaps restart timing for new questions.
33
+
34
+ ## Doorbells
35
+
36
+ A turn opened for you by your own confirmed submit or return is first rung only after `doorbells.firstRetryMs`; a turn opened for you any other way rings at once.
37
+
38
+ A doorbell expects action: read `board inbox` for the turn, addressed
39
+ block, answer or follow-up. Ordinary task comments do not ring; nor does a block
40
+ tracked by its author role ring itself.
41
+
42
+ Repeat up to three delivered rings;
43
+ acknowledgement stops them. Removal notices and quiet-turn reminders ring once.
44
+ Busy recipients defer delivery; pending delivery or earlier rings in the Spur
45
+ queue defer repeats. Queues can exhaust their waiting window.
46
+
47
+ Most notices await recipients; taskless worker, orchestrator and operator-agent
48
+ answers end without a live asking session. Curator and course-check orchestrator
49
+ questions fall back to operator. Operator conversations await their project.
50
+ Exhaustion alerts the operator, except removals and quiet-turn reminders;
51
+ curator questions move to operator.
52
+
53
+ ## Course checks and cycle limits
54
+
55
+ `projects[].columns[].courseCheck` defaults to 3 returns to Dev;
56
+ `courseCheck: 0` disables it. `projects[].columns[].cycleLimit` defaults to 10 and
57
+ takes priority. Executor returns and external comments (a changes-requested
58
+ review is one) count, as do thread returns; CI failures, conflicts and drafts alone do not count, nor
59
+ reopened tickets or mode switches.
60
+
61
+ If returns keep hitting the same mechanism, fix the bug class once; cover its variants with one table test. Put remaining edges with no user-visible effect under Risk in the PR description. Still fix P0/P1 and user-visible findings in this PR.
62
+ `projects[].columns[].courseCheckTo`: `operator`, curator or column orchestrator.
63
+ Default: curator (`projects[].spurProjects[].role`), else operator. An answer
64
+ resets the course count and reaches the worker as a task comment. Only the
65
+ operator can resolve the separate cycle limit and reset its count. With no live
66
+ session it falls back to the operator; a live conductor that does not
67
+ answer keeps the question.
@@ -1,174 +1,9 @@
1
1
  # How the Board works
2
2
 
3
- ## Columns and executors
3
+ Choose the topic for the decision or action in front of you:
4
4
 
5
- `todo`, `ready-for-dev`, `dev`, `review`, `product-review`,
6
- `external-review`, `qa`, `ready-to-merge`, `done`.
7
- `projects[].columns[].enabled`: disabled/omitted columns skip gates;
8
- To Do, Dev, Done stay enabled.
9
-
10
- Each column has one executor: `projects[].columns[].orchestrator`:
11
- `none` (live worker, else operator), `operator`, or project with role
12
- `orchestrator` or `curator`. The worker owns the code and branch; others inspect/return, never push.
13
-
14
- `projects[].spurProjects[].role` accepts `worker`, `operator`, `curator` and
15
- `orchestrator`.
16
-
17
- Top-level `spurProjects[].columns` fills `none` columns board-wide;
18
- `role: operator` there serves operatorless projects, one session acting in
19
- each. A project-level binding wins.
20
-
21
- ## Gates and placement
22
-
23
- Facts (head, checks, reviews, comments, ticket, sessions) feed gates; two actions: move the task and open an executor turn (at most one
24
- per evaluation). Turns follow unmet entry gates, actionable post-submit failures,
25
- rerouting or Done wrap-up. Holds and existing turns can yield neither action.
26
-
27
- Moves, turns and course checks need `projects[].dispatcher.mode: on`;
28
- default is `shadow`: no doorbells or blocks.
29
-
30
- Gates are cumulative: each column checks its enabled gate and those to its left. At a turn boundary, failed gates return to the leftmost failing
31
- column. Taken turns hold until submit, return or a new head. Pending CI, unknown
32
- mergeability and incomplete comment history are waits. Downstream handoff waits
33
- for settled prerequisites; Dev can receive a repair turn.
34
-
35
- Dev needs an open non-draft PR, passing checks, no conflict, handled
36
- feedback, comment history and current-head submit. Feedback excludes
37
- bots, approvals and `projects[].operatorGithubLogin` (agents' account), so worker
38
- thread replies never count; others' posts do.
39
- The repo owner's and the human operator's own accounts count too, unless one is
40
- that login: a PR comment is a change request; talk to agents in Slack
41
- (`@shortName`) or the Board. A review-thread reply is a new review. An approval
42
- hides its inline comments; thread resolution and the head a comment was left on
43
- change nothing for feedback. Bots (GitHub Apps) neither return a task, approve it nor block
44
- an approval; their threads still count. Handled means handed by ID to a Dev turn, not answered; in shadow
45
- mode, a later submit in Dev or an executor `none` column handles it.
46
- A status comment whose last line is a hidden `board-reviewer-progress` or
47
- `board-reviewer-unavailable` marker is not external feedback. No required checks: non-skipped count. `projects[].reposWithoutCi` waives absent checks
48
- for listed repos; never failed/skipped required ones.
49
-
50
- Review and Product Review need current-head internal review marks, separate from
51
- External Review's external approval. QA: current-head submit; Ready to Merge awaits merge. Executor `none` may reuse same-head submits of other worker columns. Fixed gate rules have no configuration switch
52
- except enabled columns, no-CI and resolved threads.
53
-
54
- `projects[].columns[].requireResolvedThreads` (default: `ready-to-merge` only)
55
- gates that column and those right of it: an unresolved review thread, outdated
56
- or by anyone, returns the task to Dev, whose turn lists each thread link. The
57
- worker fixes or answers, then resolves each; reviewers never do. A
58
- Dev submit on the same head moves right, keeping marks and approval. An
59
- approval's inline notes are threads; it still passes External Review.
60
-
61
- Review/Product Review mark lasts across visits on the current head. A visit
62
- submission belongs to one column visit; moving left clears it and those to the right. New heads invalidate internal Review and Product Review marks.
63
-
64
- PR closed without merge with no open PR, or closed
65
- ticket with live work and no merged PR. `board status` lists them as operator block threads.
66
-
67
- ## Turns and delivery
68
-
69
- A turn `T<number>`: keyed `board inbox ack <entries>`.
70
- Only the acknowledging session may submit or return: keyed
71
- `board submit <turn> <sha>` accepts the head; keyed
72
- `board return <turn> <reason>` sends findings to Dev. In
73
- shadow mode, use keyed `board submit <task> <sha>`.
74
- Unseen heads answer `pending`: that submit is final; do not resubmit or raise a
75
- block. Confirm timeout: `projects[].dispatcher.submitConfirmMs`.
76
-
77
- A new head closes taken turns outside Dev; taken Dev turns survive pushes.
78
- Right of Dev, red CI, a draft, a conflict, an external comment or an unresolved
79
- thread where required returns the task to Dev at once, unless a turn is taken; then after its submit or return.
80
- The Dev turn hands the comments, beside a return's `code` block.
81
-
82
- Closed turns receive no further Board sends; Obsolete queued rings are dropped;
83
- a message already accepted by Spur cannot be retracted. Check `board inbox` and
84
- act only on a current turn; reread after `turn_closed`.
85
-
86
- Open-turn executors in `needs_input`, `error`, `rate_limited` or `stopped` raise
87
- one question after `health.turnStallAfterMs` (default 600000): curator unless self, else
88
- operator. Time starts at the later turn/state start; taking never resets it.
89
- One frozen explanation/dismissal per turn/session/state episode. Recovery,
90
- replacement, removal, archive or turn closure withdraws it. Blind Spur opens none,
91
- holds existing; gaps restart timing for new questions.
92
-
93
- ## Doorbells
94
-
95
- A turn opened for you by your own confirmed submit or return is first rung only after `doorbells.firstRetryMs`; a turn opened for you any other way rings at once.
96
-
97
- A doorbell expects action: read `board inbox` for the turn, addressed
98
- block, answer or follow-up. Ordinary task comments do not ring; nor does a block
99
- tracked by its author role ring itself.
100
-
101
- Repeat up to three delivered rings;
102
- acknowledgement stops them. Removal notices and quiet-turn reminders ring once.
103
- Busy recipients defer delivery; pending delivery or earlier rings in the Spur
104
- queue defer repeats. Queues can exhaust their waiting window.
105
-
106
- Most notices await recipients; taskless worker, orchestrator and operator-agent
107
- answers end without a live asking session. Curator and course-check orchestrator
108
- questions fall back to operator. Operator conversations await their project.
109
- Exhaustion alerts the operator, except removals and quiet-turn reminders;
110
- curator questions move to operator.
111
-
112
- ## Course checks and cycle limits
113
-
114
- `projects[].columns[].courseCheck` defaults to 3 returns to Dev;
115
- `courseCheck: 0` disables it. `projects[].columns[].cycleLimit` defaults to 10 and
116
- takes priority. Executor returns and external comments (a changes-requested
117
- review is one) count, as do thread returns; CI failures, conflicts and drafts alone do not count, nor
118
- reopened tickets or mode switches.
119
-
120
- If returns keep hitting the same mechanism, fix the bug class once; cover its variants with one table test. Put remaining edges with no user-visible effect under Risk in the PR description. Still fix P0/P1 and user-visible findings in this PR.
121
- `projects[].columns[].courseCheckTo`: `operator`, curator or column orchestrator.
122
- Default: curator (`projects[].spurProjects[].role`), else operator. An answer
123
- resets the course count and reaches the worker as a task comment. Only the
124
- operator can resolve the separate cycle limit and reset its count. With no live
125
- session it falls back to the operator; a live conductor that does not
126
- answer keeps the question.
127
-
128
- ## Blocks and escalation
129
-
130
- A question (`needs_input`): column orchestrator, else curator, else
131
- operator. Routing avoids asking yourself; curators ask the operator.
132
-
133
- A `code` block goes to the worker; `dependency` or `external` block stays with
134
- its author's role. Escalation: column orchestrator to curator to
135
- operator; other blocks escalate straight to the operator. Keyed
136
- `board escalate <block>` if its addressee cannot resolve it.
137
-
138
- Taskless: all roles, operator only:
139
- `board project ask <project> <text> --to operator --key <key>`.
140
- Project `needs_input` blocks get Slack threads except operator-agent asks;
141
- operator: `board inbox`, keyed `board answer`. Answers reach a current curator session; other roles use the asking session.
142
-
143
- `projects[].columns[].orchestrator`, `projects[].spurProjects[].role`,
144
- `operator.slack`.
145
-
146
- ## Slack now
147
-
148
- `slack.channels.feed`: curator answers and operator items,
149
- except delivery/health/ended-worker items and blocks.
150
- `slack.channels.orchestrators`: block threads addressed to the operator by
151
- others. Answer in the existing block thread.
152
-
153
- ## Slack addressing
154
-
155
- With a `projects[].spurProjects[].shortName`, `spurProjects[].shortName` or
156
- board-wide operator, a new operator message in
157
- `slack.channels.orchestrators` starts a conversation. A leading registered
158
- `@shortName` selects that Spur project and is stripped. With absent or unknown
159
- leading name, complete text, retaining any
160
- unknown prefix, goes to `slack.defaultAddressee`, else board-wide operator, else
161
- first project with an operator; else Board replies once with the valid prefixes.
162
- Middle mentions or Slack `<@U…>` address nobody; unknown names cause no lookup
163
- error. The operator checks short-name collisions with workspace names.
164
- A task key after the prefix attaches it.
165
-
166
- Read `board inbox`; reply via `board answer`. Each operator thread message rings again; `close` or ✅ in the
167
- thread closes it. Replies use `projects[].spurProjects[].displayName` and `icon`, top-level ones too,
168
- else project name and role icon (`board` for operator). No session:
169
- `board status` lists it as waiting.
170
-
171
- ## Done follows the ticket
172
-
173
- One linked PR merging does not by itself finish the task. Done: `projects[].tracker.doneStatuses` for Jira; for GitHub, the Issue must be
174
- closed. If still open, link another PR.
5
+ - [Columns and gates](how-board-works-columns.md): find the executor, placement rules and gate requirements.
6
+ - [Turns and delivery](how-board-works-turns.md): acknowledge work, submit or return, handle doorbells and repeated returns.
7
+ - [Blocks and escalation](how-board-works-blocks.md): route a question or escalate a block.
8
+ - [Slack conversations](how-board-works-slack.md): choose a channel, address an agent and answer in a thread.
9
+ - [Done follows the ticket](how-board-works-done.md): check when a task is finished.