spur-board 0.157.3 → 0.159.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.
@@ -3323,6 +3323,39 @@ const statusItemSchema = itemViewSchema.extend({
3323
3323
  unconfirmed: z.boolean().describe("Whether a supporting fact is stale or its source is blind."),
3324
3324
  factAt: z.iso.datetime().nullable().describe("Time of the supporting fact, when known.")
3325
3325
  }).describe("An actionable item with its freshness mark.");
3326
+ // ../contracts/src/ops/inbox-schemas.ts
3327
+ /** What a `no-session:` board observation is about, read from the store when the inbox is read. */
3328
+ const inboxNoSessionSchema = z.strictObject({
3329
+ project: z.string().min(1).describe("Board project of the column."),
3330
+ column: z.enum(COLUMN_IDS).describe("Column whose orchestrator turns have no session to ring."),
3331
+ spurProject: z.string().min(1).optional().describe("Spur project of the column orchestrator the observation recorded, else the current binding; absent when neither is known."),
3332
+ oldestTask: taskKeySchema.describe("Task of the oldest waiting turn when the item was raised."),
3333
+ since: z.iso.datetime().describe("Since when the column has had no live session, ISO 8601 UTC."),
3334
+ waiting: z.number().int().min(0).optional().describe("Open entries only: untaken orchestrator turns waiting in the column now."),
3335
+ oldestTurn: turnIdSchema.optional().describe("The oldest waiting turn the observation recorded; on an open entry whose record cannot be read, the waiting turn of its task."),
3336
+ oldestAt: z.iso.datetime().optional().describe("Open entries only: when that turn rang, ISO 8601 UTC, while it still waits untaken.")
3337
+ }).describe("On a board_observation no-session item only: the column with no live session to ring; absent when the board cannot read it.");
3338
+ /** One entry of the operator inbox: an operator item, a block addressed to the operator or a turn. */
3339
+ const inboxEntrySchema = z.strictObject({
3340
+ id: z.union([
3341
+ itemIdSchema,
3342
+ blockIdSchema,
3343
+ turnIdSchema
3344
+ ]).describe("Item (I), block (B) or turn (T) ID; stable while the entry exists."),
3345
+ project: z.string().min(1).describe("Board project the entry belongs to; _board for a board-wide one."),
3346
+ kind: z.enum(INBOX_KINDS).describe("block for a block addressed to the operator, turn for a turn, else the item kind."),
3347
+ severity: z.enum(INBOX_SEVERITIES).describe("failure: the board or a connection broke; attention: a decision, answer or other operator action is wanted."),
3348
+ text: z.string().describe("What needs the operator, in one line."),
3349
+ url: z.url({ protocol: /^https?$/ }).and(z.string().regex(/^[hH][tT][tT][pP][sS]?:\/\//)).optional().describe("Meaningful external destination for this entry, when known; HTTP(S) only. Task navigation takes precedence in the web inbox."),
3350
+ action: z.string().min(1).optional().describe("What the operator does about an item entry; the text ends with it. Absent on block and turn entries."),
3351
+ at: z.iso.datetime().describe("When the entry was raised or opened, ISO 8601 UTC."),
3352
+ task: taskKeySchema.nullable().describe("Task the entry is about; null when it has none."),
3353
+ column: z.enum(COLUMN_IDS).optional().describe("Column of a turn; absent on other entries."),
3354
+ answeredVia: z.enum(VIAS).nullable().optional().describe("On a block: web, slack, cli or mcp when the closing write arrived that way (cli and mcp as the board client reported it), else null; absent on other entries."),
3355
+ noSession: inboxNoSessionSchema.optional()
3356
+ }).describe("One entry of the operator inbox.");
3357
+ /** An operator inbox entry cleared, answered or closed in the last 24 hours. */
3358
+ const inboxHandledSchema = inboxEntrySchema.extend({ handledAt: z.iso.datetime().describe("When it was cleared, answered or closed, ISO 8601 UTC.") }).describe("An operator inbox entry handled in the last 24 hours.");
3326
3359
  // ../contracts/src/ops/source-view-schema.ts
3327
3360
  /** The stored colour of a repository's default-branch head, as status.get shows it. */
3328
3361
  const defaultBranchViewSchema = z.strictObject({
@@ -3621,27 +3654,6 @@ const columnsDescribeOutputSchema = z.strictObject({ projects: z.array(z.strictO
3621
3654
  }).describe("Column placement policy.")
3622
3655
  })).describe("Enabled columns only, in canonical order.")
3623
3656
  })).describe("Effective configured projects visible to the caller; bounded by config and built-in columns.") });
3624
- // ../contracts/src/ops/inbox-schemas.ts
3625
- /** One entry of the operator inbox: an operator item, a block addressed to the operator or a turn. */
3626
- const inboxEntrySchema = z.strictObject({
3627
- id: z.union([
3628
- itemIdSchema,
3629
- blockIdSchema,
3630
- turnIdSchema
3631
- ]).describe("Item (I), block (B) or turn (T) ID; stable while the entry exists."),
3632
- project: z.string().min(1).describe("Board project the entry belongs to; _board for a board-wide one."),
3633
- kind: z.enum(INBOX_KINDS).describe("block for a block addressed to the operator, turn for a turn, else the item kind."),
3634
- severity: z.enum(INBOX_SEVERITIES).describe("failure: the board or a connection broke; attention: a decision, answer or other operator action is wanted."),
3635
- text: z.string().describe("What needs the operator, in one line."),
3636
- url: z.url({ protocol: /^https?$/ }).and(z.string().regex(/^[hH][tT][tT][pP][sS]?:\/\//)).optional().describe("Meaningful external destination for this entry, when known; HTTP(S) only. Task navigation takes precedence in the web inbox."),
3637
- action: z.string().min(1).optional().describe("What the operator does about an item entry; the text ends with it. Absent on block and turn entries."),
3638
- at: z.iso.datetime().describe("When the entry was raised or opened, ISO 8601 UTC."),
3639
- task: taskKeySchema.nullable().describe("Task the entry is about; null when it has none."),
3640
- column: z.enum(COLUMN_IDS).optional().describe("Column of a turn; absent on other entries."),
3641
- answeredVia: z.enum(VIAS).nullable().optional().describe("On a block: web, slack, cli or mcp when the closing write arrived that way (cli and mcp as the board client reported it), else null; absent on other entries.")
3642
- }).describe("One entry of the operator inbox.");
3643
- /** An operator inbox entry cleared, answered or closed in the last 24 hours. */
3644
- const inboxHandledSchema = inboxEntrySchema.extend({ handledAt: z.iso.datetime().describe("When it was cleared, answered or closed, ISO 8601 UTC.") }).describe("An operator inbox entry handled in the last 24 hours.");
3645
3657
  errorDetailSchema.extend({
3646
3658
  type: z.url(),
3647
3659
  title: z.string(),
@@ -4558,6 +4570,26 @@ const OPERATIONS = [
4558
4570
  at,
4559
4571
  task: null
4560
4572
  },
4573
+ {
4574
+ id: "I10",
4575
+ project: "web",
4576
+ kind: "board_observation",
4577
+ severity: "attention",
4578
+ text: "web review: turns wait for a live session of Spur project web-orch; oldest T4 since 2026-01-05T09:00:00.000Z; 2 waiting, no live session for 30 min: start a session in Spur project web-orch, or take over its turns with board inbox ack",
4579
+ action: "start a session in Spur project web-orch, or take over its turns with board inbox ack",
4580
+ at,
4581
+ task: "PROJ-125",
4582
+ noSession: {
4583
+ project: "web",
4584
+ column: "review",
4585
+ spurProject: "web-orch",
4586
+ oldestTask: "PROJ-125",
4587
+ since: "2026-01-05T09:15:00.000Z",
4588
+ waiting: 2,
4589
+ oldestTurn: "T4",
4590
+ oldestAt: "2026-01-05T09:00:00.000Z"
4591
+ }
4592
+ },
4561
4593
  {
4562
4594
  id: "T5",
4563
4595
  project: "web",
@@ -5990,6 +6022,11 @@ const tokenRequestStatusSchema = z.strictObject({ status: z.enum([...TOKEN_STATU
5990
6022
  function requestHashOf(hash) {
5991
6023
  return hash.slice(0, 10);
5992
6024
  }
6025
+ /**
6026
+ * The oldest Spur release with every Spur API the Board calls: transition polling
6027
+ * (`GET /sessions/transitions`, Spur #1447). Bump it with the feature that needs a newer Spur.
6028
+ */
6029
+ const SPUR_MIN_VERSION = "1.53.0";
5993
6030
  const checkShape = {
5994
6031
  id: z.string(),
5995
6032
  status: z.enum([
@@ -6023,4 +6060,4 @@ const remoteDoctorReportSchema = z.object({
6023
6060
  function assertNever(value) {
6024
6061
  throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
6025
6062
  }
6026
- export { ringMarker as $, eventPayloadSchemas as A, requiredSecretKeys as At, sourceCursorSchema as B, TODO_GROUP_COLUMN_IDS as Bt, messageRefSchema as C, columnTurnTimings as Ct, sortSkillFiles as D, externalQuietAfterMs as Dt, skillReloadFilesSchema as E, defaultAddressee as Et, defaultBranchFactSchema as F, COLUMN_IDS as Ft, SESSION_HEALTH_STATES as G, PR_STATES as H, isTodoGroupColumn as Ht, entityRefSchema as I, DISPATCHER_MODES as It, parseRingMarker as J, SESSION_STATUSES as K, mirrorSourceId as L, ITEM_KINDS as Lt, MIRROR_FAILURES as M, BLOCK_TYPES as Mt, MIRROR_FAILURE_CODES as N, COLUMNS as Nt, EVENT_KINDS as O, plainHttpAllowed as Ot, batchSchema as P, COLUMN_GROUPS as Pt, prReviewRuleSchema as Q, prSourceId as R, SLACK_BOT_SCOPES as Rt, interactionRefSchema as S, boardWideSpurProject as St, skillReloadFileSchema as T, configSchema as Tt, REVIEW_DECISIONS as U, trackerSourceId as V, VIAS as Vt, REVIEW_STATES as W, prFactsSchema as X, prApprovalPairSchema as Y, prRefSchema as Z, renderJsonError as _, DEFAULT_SLACK_APP_NAME as _t, requestHashOf as a, encodeActorId as at, conversationRefSchema as b, RESERVED_PROJECT as bt, tokenRequestStatusSchema as c, parseRef as ct, buildCatalogSnapshot as d, errorContextSchema as dt, sessionFactsSchema as et, roleCanUseOperation as f, errorEnvelopeSchema as ft, renderHttpProblem as g, DEFAULT_LINK as gt, turnHandedSchema as h, DEFAULT_HTTP_PORT as ht, TOKEN_REQUEST_LIMITS as i, actorIdSchema as it, AdapterError as j, resolveWebOrigin as jt, GATE_REASONS as k, readyMirrorOf as kt, BOARD_TICK_MS as l, ERRORS as lt, defaultBranchViewSchema as m, successEnvelopeSchema as mt, doctorReportSchema as n, JIRA_PROJECT_KEY as nt, tokenRequestResultSchema as o, errorCodeOf as ot, OPERATIONS as p, ok as pt, isExternalAuthor as q, remoteDoctorReportSchema as r, REF_NUMBER as rt, tokenRequestSchema as s, parseActorId as st, assertNever as t, ticketFactsSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, err as ut, renderMcpError as v, DEFAULT_SLACK_COMMAND as vt, userIdSchema as w, configBindings as wt, inboundEventSchema as x, approvalRuleOf as xt, SPACE_IDS as y, DEFAULT_STAND_PORT_RANGE as yt, sessionTransitionSchema as z, TASK_HOLDS as zt };
6063
+ export { prRefSchema as $, EVENT_KINDS as A, plainHttpAllowed as At, prSourceId as B, SLACK_BOT_SCOPES as Bt, inboundEventSchema as C, approvalRuleOf as Ct, skillReloadFileSchema as D, configSchema as Dt, userIdSchema as E, configBindings as Et, MIRROR_FAILURE_CODES as F, COLUMNS as Ft, REVIEW_DECISIONS as G, sourceCursorSchema as H, TODO_GROUP_COLUMN_IDS as Ht, batchSchema as I, COLUMN_GROUPS as It, SESSION_STATUSES as J, REVIEW_STATES as K, defaultBranchFactSchema as L, COLUMN_IDS as Lt, eventPayloadSchemas as M, requiredSecretKeys as Mt, AdapterError as N, resolveWebOrigin as Nt, skillReloadFilesSchema as O, defaultAddressee as Ot, MIRROR_FAILURES as P, BLOCK_TYPES as Pt, prFactsSchema as Q, entityRefSchema as R, DISPATCHER_MODES as Rt, conversationRefSchema as S, RESERVED_PROJECT as St, messageRefSchema as T, columnTurnTimings as Tt, trackerSourceId as U, VIAS as Ut, sessionTransitionSchema as V, TASK_HOLDS as Vt, PR_STATES as W, isTodoGroupColumn as Wt, parseRingMarker as X, isExternalAuthor as Y, prApprovalPairSchema as Z, turnHandedSchema as _, DEFAULT_HTTP_PORT as _t, TOKEN_REQUEST_LIMITS as a, REF_NUMBER as at, renderMcpError as b, DEFAULT_SLACK_COMMAND as bt, tokenRequestSchema as c, errorCodeOf as ct, SYSTEMD_SERVICE_SETTINGS as d, ERRORS as dt, prReviewRuleSchema as et, buildCatalogSnapshot as f, err as ft, inboxNoSessionSchema as g, successEnvelopeSchema as gt, defaultBranchViewSchema as h, ok as ht, remoteDoctorReportSchema as i, JIRA_PROJECT_KEY as it, GATE_REASONS as j, readyMirrorOf as jt, sortSkillFiles as k, externalQuietAfterMs as kt, tokenRequestStatusSchema as l, parseActorId as lt, OPERATIONS as m, errorEnvelopeSchema as mt, SPUR_MIN_VERSION as n, sessionFactsSchema as nt, requestHashOf as o, actorIdSchema as ot, roleCanUseOperation as p, errorContextSchema as pt, SESSION_HEALTH_STATES as q, doctorReportSchema as r, ticketFactsSchema as rt, tokenRequestResultSchema as s, encodeActorId as st, assertNever as t, ringMarker as tt, BOARD_TICK_MS as u, parseRef as ut, renderHttpProblem as v, DEFAULT_LINK as vt, interactionRefSchema as w, boardWideSpurProject as wt, SPACE_IDS as x, DEFAULT_STAND_PORT_RANGE as xt, renderJsonError as y, DEFAULT_SLACK_APP_NAME as yt, mirrorSourceId as z, ITEM_KINDS as zt };
@@ -1,5 +1,5 @@
1
- import { Ot as plainHttpAllowed, Tt as configSchema, d as buildCatalogSnapshot, p as OPERATIONS } from "./chunk-DlNdkguO.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-BHROPjEZ.mjs";
1
+ import { At as plainHttpAllowed, Dt as configSchema, f as buildCatalogSnapshot, m as OPERATIONS } from "./chunk-BUxxW9le.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-f54aP3OF.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";
@@ -1,4 +1,4 @@
1
- import { _ as renderJsonError, c as tokenRequestStatusSchema, dt as errorContextSchema, ft as errorEnvelopeSchema, lt as ERRORS, mt as successEnvelopeSchema, o as tokenRequestResultSchema } from "./chunk-DlNdkguO.mjs";
1
+ import { dt as ERRORS, gt as successEnvelopeSchema, l as tokenRequestStatusSchema, mt as errorEnvelopeSchema, pt as errorContextSchema, s as tokenRequestResultSchema, y as renderJsonError } from "./chunk-BUxxW9le.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { At as requiredSecretKeys, D as sortSkillFiles, Rt as SLACK_BOT_SCOPES, T as skillReloadFileSchema, Tt as configSchema, a as requestHashOf, f as roleCanUseOperation, it as actorIdSchema, jt as resolveWebOrigin, lt as ERRORS, mt as successEnvelopeSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, yt as DEFAULT_STAND_PORT_RANGE } from "./chunk-DlNdkguO.mjs";
1
+ import { Bt as SLACK_BOT_SCOPES, D as skillReloadFileSchema, Dt as configSchema, Mt as requiredSecretKeys, Nt as resolveWebOrigin, d as SYSTEMD_SERVICE_SETTINGS, dt as ERRORS, gt as successEnvelopeSchema, i as remoteDoctorReportSchema, k as sortSkillFiles, m as OPERATIONS, o as requestHashOf, ot as actorIdSchema, p as roleCanUseOperation, xt as DEFAULT_STAND_PORT_RANGE } from "./chunk-BUxxW9le.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.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-BHROPjEZ.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-C7H6hp1r.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-f54aP3OF.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-BVb6nX0w.mjs";
5
5
  import { createHash, randomBytes, randomUUID } from "node:crypto";
6
6
  import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
7
7
  import { homedir, hostname, tmpdir, userInfo } from "node:os";
@@ -689,6 +689,7 @@ const remoteBaseIds = [
689
689
  "link.rules",
690
690
  "spur.api",
691
691
  "spur.send",
692
+ "spur.version",
692
693
  "operator.path",
693
694
  "operator.tokens",
694
695
  "curator.sessions",
package/dist/client.mjs CHANGED
@@ -1 +1 @@
1
- export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-BHROPjEZ.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-f54aP3OF.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as ringMarker, A as eventPayloadSchemas, At as requiredSecretKeys, B as sourceCursorSchema, Bt as TODO_GROUP_COLUMN_IDS, C as messageRefSchema, Ct as columnTurnTimings, D as sortSkillFiles, Dt as externalQuietAfterMs, E as skillReloadFilesSchema, Et as defaultAddressee, F as defaultBranchFactSchema, Ft as COLUMN_IDS, G as SESSION_HEALTH_STATES, H as PR_STATES, Ht as isTodoGroupColumn, I as entityRefSchema, It as DISPATCHER_MODES, J as parseRingMarker, K as SESSION_STATUSES, L as mirrorSourceId, Lt as ITEM_KINDS, M as MIRROR_FAILURES, Mt as BLOCK_TYPES, N as MIRROR_FAILURE_CODES, Nt as COLUMNS, O as EVENT_KINDS, Ot as plainHttpAllowed, P as batchSchema, Pt as COLUMN_GROUPS, Q as prReviewRuleSchema, R as prSourceId, Rt as SLACK_BOT_SCOPES, S as interactionRefSchema, St as boardWideSpurProject, Tt as configSchema, U as REVIEW_DECISIONS, V as trackerSourceId, Vt as VIAS, W as REVIEW_STATES, X as prFactsSchema, Y as prApprovalPairSchema, Z as prRefSchema, a as requestHashOf, at as encodeActorId, b as conversationRefSchema, bt as RESERVED_PROJECT, c as tokenRequestStatusSchema, ct as parseRef$1, d as buildCatalogSnapshot, et as sessionFactsSchema, f as roleCanUseOperation, g as renderHttpProblem, gt as DEFAULT_LINK, h as turnHandedSchema, i as TOKEN_REQUEST_LIMITS, it as actorIdSchema, j as AdapterError, jt as resolveWebOrigin, k as GATE_REASONS, kt as readyMirrorOf, l as BOARD_TICK_MS, lt as ERRORS, m as defaultBranchViewSchema, mt as successEnvelopeSchema, n as doctorReportSchema, nt as JIRA_PROJECT_KEY, o as tokenRequestResultSchema, ot as errorCodeOf, p as OPERATIONS, pt as ok, q as isExternalAuthor, rt as REF_NUMBER, s as tokenRequestSchema, st as parseActorId, t as assertNever, tt as ticketFactsSchema, ut as err, vt as DEFAULT_SLACK_COMMAND, w as userIdSchema, wt as configBindings, x as inboundEventSchema, xt as approvalRuleOf, y as SPACE_IDS, z as sessionTransitionSchema, zt as TASK_HOLDS } from "./chunk-DlNdkguO.mjs";
1
+ import { $ as prRefSchema, A as EVENT_KINDS, At as plainHttpAllowed, B as prSourceId, Bt as SLACK_BOT_SCOPES, C as inboundEventSchema, Ct as approvalRuleOf, Dt as configSchema, E as userIdSchema, Et as configBindings, F as MIRROR_FAILURE_CODES, Ft as COLUMNS, G as REVIEW_DECISIONS, H as sourceCursorSchema, Ht as TODO_GROUP_COLUMN_IDS, I as batchSchema, It as COLUMN_GROUPS, J as SESSION_STATUSES, K as REVIEW_STATES, L as defaultBranchFactSchema, Lt as COLUMN_IDS, M as eventPayloadSchemas, Mt as requiredSecretKeys, N as AdapterError, Nt as resolveWebOrigin, O as skillReloadFilesSchema, Ot as defaultAddressee, P as MIRROR_FAILURES, Pt as BLOCK_TYPES, Q as prFactsSchema, R as entityRefSchema, Rt as DISPATCHER_MODES, S as conversationRefSchema, St as RESERVED_PROJECT, T as messageRefSchema, Tt as columnTurnTimings, U as trackerSourceId, Ut as VIAS, V as sessionTransitionSchema, Vt as TASK_HOLDS, W as PR_STATES, Wt as isTodoGroupColumn, X as parseRingMarker, Y as isExternalAuthor, Z as prApprovalPairSchema, _ as turnHandedSchema, a as TOKEN_REQUEST_LIMITS, at as REF_NUMBER, bt as DEFAULT_SLACK_COMMAND, c as tokenRequestSchema, ct as errorCodeOf, dt as ERRORS, et as prReviewRuleSchema, f as buildCatalogSnapshot, ft as err, g as inboxNoSessionSchema, gt as successEnvelopeSchema, h as defaultBranchViewSchema, ht as ok, it as JIRA_PROJECT_KEY, j as GATE_REASONS, jt as readyMirrorOf, k as sortSkillFiles, kt as externalQuietAfterMs, l as tokenRequestStatusSchema, lt as parseActorId, m as OPERATIONS, n as SPUR_MIN_VERSION, nt as sessionFactsSchema, o as requestHashOf, ot as actorIdSchema, p as roleCanUseOperation, q as SESSION_HEALTH_STATES, r as doctorReportSchema, rt as ticketFactsSchema, s as tokenRequestResultSchema, st as encodeActorId, t as assertNever, tt as ringMarker, u as BOARD_TICK_MS, ut as parseRef$1, v as renderHttpProblem, vt as DEFAULT_LINK, w as interactionRefSchema, wt as boardWideSpurProject, x as SPACE_IDS, z as mirrorSourceId, zt as ITEM_KINDS } from "./chunk-BUxxW9le.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -8854,6 +8854,25 @@ const BLOCK_KEY = "block:";
8854
8854
  const CONVERSATION_KEY = "conversation:";
8855
8855
  /** The item of a named-orchestrator column whose untaken turns have no live session to ring. */
8856
8856
  const NO_SESSION_KEY = "no-session:";
8857
+ /** The stored summary of a no-session item; `parseNoSessionSummary` reads it back. */
8858
+ function noSessionSummary(summary) {
8859
+ return `${summary.project} ${summary.column}: turns wait for a live session of Spur project ${summary.spur}; oldest T${String(summary.turn)} since ${summary.ringAt}`;
8860
+ }
8861
+ const NO_SESSION_SUMMARY = /^(\S+) (\S+): turns wait for a live session of Spur project (.+); oldest T(\d+) since (\S+)$/;
8862
+ /** The fields `noSessionSummary` wrote, or undefined for other text or an unreadable ring time. */
8863
+ function parseNoSessionSummary(text) {
8864
+ const match = NO_SESSION_SUMMARY.exec(text);
8865
+ if (!match) return void 0;
8866
+ const [, project = "", column = "", spur = "", turn = "", ringAt = ""] = match;
8867
+ if (Number.isNaN(Date.parse(ringAt))) return void 0;
8868
+ return {
8869
+ project,
8870
+ column,
8871
+ spur,
8872
+ turn: Number(turn),
8873
+ ringAt
8874
+ };
8875
+ }
8857
8876
  /** The item of a github-rules task whose PR head GitHub has left undecided in External Review. */
8858
8877
  const REVIEW_RULE_KEY = "review-rule:";
8859
8878
  /** The item of a task waiting in External Review with no new external review round for its quietAfterMs. */
@@ -15509,7 +15528,13 @@ async function turnsWithoutSession(trx, config, now, taskById) {
15509
15528
  key,
15510
15529
  kind: "board_observation",
15511
15530
  taskId: task.id,
15512
- summary: `${task.project} ${oldest.column}: turns wait for a live session of Spur project ${spur}; oldest T${String(oldest.turn_id)} since ${oldest.created_at}`,
15531
+ summary: noSessionSummary({
15532
+ project: task.project,
15533
+ column: oldest.column,
15534
+ spur,
15535
+ turn: oldest.turn_id,
15536
+ ringAt: oldest.created_at
15537
+ }),
15513
15538
  factAt: new Date(earliest).toISOString(),
15514
15539
  source: null,
15515
15540
  priority: 4
@@ -20031,6 +20056,95 @@ function createOrderMutations(config) {
20031
20056
  }
20032
20057
  } };
20033
20058
  }
20059
+ // ../core/src/app/operator-inbox-no-session.ts
20060
+ /** The board project and column a `no-session:<project>:<column>` key names. */
20061
+ function noSessionColumn(key) {
20062
+ const rest = key.slice(11);
20063
+ const last = rest.lastIndexOf(":");
20064
+ return {
20065
+ project: rest.slice(0, last),
20066
+ column: rest.slice(last + 1)
20067
+ };
20068
+ }
20069
+ /**
20070
+ * Untaken orchestrator turns of non-archived tasks with a ringing turn notification, as the
20071
+ * reconcile counts them: one batched read, run only when an open `no-session:` item is listed.
20072
+ */
20073
+ async function waitingTurns(trx, items) {
20074
+ const waiting = {
20075
+ count: /* @__PURE__ */ new Map(),
20076
+ turnOf: /* @__PURE__ */ new Map(),
20077
+ ids: /* @__PURE__ */ new Set()
20078
+ };
20079
+ if (!items.some((item) => item.item_key.startsWith("no-session:"))) return waiting;
20080
+ const rows = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").innerJoin("notification", "notification.turn_id", "turn.id").select([
20081
+ "task.project",
20082
+ "turn.column",
20083
+ "turn.task_id",
20084
+ "turn.id",
20085
+ (eb) => eb.fn.min("notification.created_at").as("rang_at")
20086
+ ]).where("task.membership", "!=", "archived").where("turn.closed_at", "is", null).where("turn.acked_at", "is", null).where(sql`turn.role = 'orchestrator:' || turn."column"`).where("notification.kind", "=", "turn").where("notification.acked_at", "is", null).where("notification.exhausted_at", "is", null).groupBy("turn.id").execute();
20087
+ for (const row of rows) {
20088
+ const key = `${row.project}:${row.column}`;
20089
+ waiting.count.set(key, (waiting.count.get(key) ?? 0) + 1);
20090
+ waiting.ids.add(row.id);
20091
+ waiting.turnOf.set(`${String(row.task_id)}:${row.column}`, {
20092
+ turn: row.id,
20093
+ rangAt: row.rang_at
20094
+ });
20095
+ }
20096
+ return waiting;
20097
+ }
20098
+ /**
20099
+ * The text of a `no-session:` item: while open, its stored text with the waiting turns and the
20100
+ * whole minutes since `fact_at` read now; a cleared one keeps its stored text. The action names
20101
+ * the column's Spur project.
20102
+ */
20103
+ function noSessionText(item, config, waiting, now) {
20104
+ const { project, column } = noSessionColumn(item.item_key);
20105
+ const spur = columnTurnTimings(config, project, column)?.orchestrator;
20106
+ const action = `start a session in ${spur === void 0 ? "its Spur project" : `Spur project ${spur}`}, or take over its turns with board inbox ack`;
20107
+ const since = item.fact_at === null ? NaN : Date.parse(item.fact_at);
20108
+ if (item.cleared_at !== null || Number.isNaN(since)) return {
20109
+ condition: item.text,
20110
+ action
20111
+ };
20112
+ const minutes = Math.max(0, Math.floor((now - since) / 6e4));
20113
+ const count = waiting.count.get(`${project}:${column}`) ?? 0;
20114
+ return {
20115
+ condition: `${item.text}; ${String(count)} waiting, no live session for ${String(minutes)} min`,
20116
+ action
20117
+ };
20118
+ }
20119
+ /**
20120
+ * The fields of a `no-session:` item: the Spur project and oldest turn its summary recorded, else
20121
+ * the column's binding and, while open, the task's waiting turn; while open also the waiting count
20122
+ * and the turn's ring time while that turn still waits. Undefined when the key, task or `fact_at`
20123
+ * cannot be read.
20124
+ */
20125
+ function noSessionFields(item, task, config, waiting) {
20126
+ const { project, column } = noSessionColumn(item.item_key);
20127
+ const since = item.fact_at === null ? NaN : Date.parse(item.fact_at);
20128
+ if (task === void 0 || Number.isNaN(since)) return void 0;
20129
+ const parsed = parseNoSessionSummary(item.text);
20130
+ const recorded = parsed?.project === project && parsed.column === column ? parsed : void 0;
20131
+ const spurProject = recorded?.spur ?? columnTurnTimings(config, project, column)?.orchestrator;
20132
+ const open = item.cleared_at === null;
20133
+ const ringing = open && recorded === void 0 && item.task_id !== null ? waiting.turnOf.get(`${String(item.task_id)}:${column}`) : void 0;
20134
+ const turn = recorded?.turn ?? ringing?.turn;
20135
+ const rangAt = !open ? NaN : recorded === void 0 ? Date.parse(ringing?.rangAt ?? "") : waiting.ids.has(recorded.turn) ? Date.parse(recorded.ringAt) : NaN;
20136
+ const fields = inboxNoSessionSchema.safeParse({
20137
+ project,
20138
+ column,
20139
+ ...spurProject === void 0 ? {} : { spurProject },
20140
+ oldestTask: task,
20141
+ since: new Date(since).toISOString(),
20142
+ ...open ? { waiting: waiting.count.get(`${project}:${column}`) ?? 0 } : {},
20143
+ ...turn === void 0 ? {} : { oldestTurn: `T${String(turn)}` },
20144
+ ...Number.isNaN(rangAt) ? {} : { oldestAt: new Date(rangAt).toISOString() }
20145
+ });
20146
+ return fields.success ? fields.data : void 0;
20147
+ }
20034
20148
  // ../core/src/app/operator-inbox.ts
20035
20149
  /** How far back `handled` reaches, and how many entries it keeps. */
20036
20150
  const HANDLED_WINDOW_MS = 864e5;
@@ -20165,50 +20279,6 @@ function sourceText(item, state) {
20165
20279
  action: `check ${thing}`
20166
20280
  };
20167
20281
  }
20168
- /** The board project and column a `no-session:<project>:<column>` key names. */
20169
- function noSessionColumn(key) {
20170
- const rest = key.slice(11);
20171
- const last = rest.lastIndexOf(":");
20172
- return {
20173
- project: rest.slice(0, last),
20174
- column: rest.slice(last + 1)
20175
- };
20176
- }
20177
- /**
20178
- * Untaken orchestrator turns of non-archived tasks with a ringing turn notification, as the
20179
- * reconcile counts them, by `<project>:<column>`: one batched read, run only when an open
20180
- * `no-session:` item is listed.
20181
- */
20182
- async function waitingTurns(trx, items) {
20183
- if (!items.some((item) => item.item_key.startsWith("no-session:"))) return /* @__PURE__ */ new Map();
20184
- const rows = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").select([
20185
- "task.project",
20186
- "turn.column",
20187
- (eb) => eb.fn.count("turn.id").as("waiting")
20188
- ]).where("task.membership", "!=", "archived").where("turn.closed_at", "is", null).where("turn.acked_at", "is", null).where(sql`turn.role = 'orchestrator:' || turn."column"`).where((eb) => eb.exists(eb.selectFrom("notification").select("notification.id").whereRef("notification.turn_id", "=", "turn.id").where("notification.kind", "=", "turn").where("notification.acked_at", "is", null).where("notification.exhausted_at", "is", null))).groupBy(["task.project", "turn.column"]).execute();
20189
- return new Map(rows.map((row) => [`${row.project}:${row.column}`, row.waiting]));
20190
- }
20191
- /**
20192
- * The text of a `no-session:` item: while open, its stored text with the waiting turns and the
20193
- * whole minutes since `fact_at` read now; a cleared one keeps its stored text. The action names
20194
- * the column's Spur project.
20195
- */
20196
- function noSessionText(item, config, waiting, now) {
20197
- const { project, column } = noSessionColumn(item.item_key);
20198
- const spur = columnTurnTimings(config, project, column)?.orchestrator;
20199
- const action = `start a session in ${spur === void 0 ? "its Spur project" : `Spur project ${spur}`}, or take over its turns with board inbox ack`;
20200
- const since = item.fact_at === null ? NaN : Date.parse(item.fact_at);
20201
- if (item.cleared_at !== null || Number.isNaN(since)) return {
20202
- condition: item.text,
20203
- action
20204
- };
20205
- const minutes = Math.max(0, Math.floor((now - since) / 6e4));
20206
- const count = waiting.get(`${project}:${column}`) ?? 0;
20207
- return {
20208
- condition: `${item.text}; ${String(count)} waiting, no live session for ${String(minutes)} min`,
20209
- action
20210
- };
20211
- }
20212
20282
  const ENDED_TURN_KEY = "ended-turn:";
20213
20283
  /** The turn id an `ended-turn:<turnId>:<session>` key names. */
20214
20284
  const endedTurnId = (key) => Number(key.slice(11).split(":")[0]);
@@ -20309,7 +20379,8 @@ function createOperatorInbox(deps) {
20309
20379
  const subject = subjects.get(item.id);
20310
20380
  const task = subject?.task ?? null;
20311
20381
  if (task?.membership === "archived") return void 0;
20312
- const { condition, action } = item.item_key.startsWith("source:") ? sourceText(item, sourceById.get(item.item_key.slice(7))) : kind === "board_observation" && item.item_key.startsWith("no-session:") ? noSessionText(item, config, waiting, clock.now()) : {
20382
+ const noSession = kind === "board_observation" && item.item_key.startsWith("no-session:");
20383
+ const { condition, action } = item.item_key.startsWith("source:") ? sourceText(item, sourceById.get(item.item_key.slice(7))) : noSession ? noSessionText(item, config, waiting, clock.now()) : {
20313
20384
  condition: item.text,
20314
20385
  action: ACTIONS[kind](item, {
20315
20386
  block,
@@ -20318,6 +20389,7 @@ function createOperatorInbox(deps) {
20318
20389
  })
20319
20390
  };
20320
20391
  const url = itemUrl(item, deliveries);
20392
+ const fields = noSession ? noSessionFields(item, task?.key, config, waiting) : void 0;
20321
20393
  return {
20322
20394
  id: `I${String(item.id)}`,
20323
20395
  project: subject?.project ?? "_board",
@@ -20328,6 +20400,7 @@ function createOperatorInbox(deps) {
20328
20400
  at: item.raised_at,
20329
20401
  task: task?.key ?? null,
20330
20402
  ...url === void 0 ? {} : { url },
20403
+ ...fields === void 0 ? {} : { noSession: fields },
20331
20404
  ...item.cleared_at === null ? {} : { handledAt: item.cleared_at }
20332
20405
  };
20333
20406
  };
@@ -29412,6 +29485,9 @@ const DEADLINE_MS = 5e3;
29412
29485
  const SPUR_PROBE_SESSION = "spur-board-doctor-probe";
29413
29486
  const SPUR_SEND_UNREACHABLE_FIX = "Start Spur or correct adapters.spur.baseUrl in config.yaml, then restart the service; the daemon sends doorbells to that Spur API.";
29414
29487
  const SPUR_SEND_FIX = "The Spur API at adapters.spur.baseUrl did not accept a doorbell send; update Spur or point adapters.spur.baseUrl at the Spur daemon.";
29488
+ const SPUR_VERSION_UNREAD_FIX = `Could not read a Spur release version from GET /info at adapters.spur.baseUrl. Start Spur, or make sure the running Spur daemon is ${SPUR_MIN_VERSION} or newer: upgrade Spur if needed, restart the Spur daemon, then rerun board doctor.`;
29489
+ const SPUR_VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-\d+-g[0-9a-f]+)?$/;
29490
+ const spurInfoWire = z.object({ version: z.string().max(64) });
29415
29491
  const GITHUB_FIX = "Check the GitHub token and repository access.";
29416
29492
  const GITHUB_CHECKS_FIX = "Use a classic GitHub personal access token with the repo scope, authorized for organization SSO where required, to read check runs.";
29417
29493
  const GITHUB_TEAMS_FIX = "Use a classic GitHub personal access token with the repo and read:org scopes to read requested review teams.";
@@ -29887,6 +29963,32 @@ async function operatorTokensCheck(ctx, config) {
29887
29963
  fix: null
29888
29964
  } : warning("operator.tokens", line);
29889
29965
  }
29966
+ function spurVersionParts(version) {
29967
+ const parts = SPUR_VERSION.exec(version);
29968
+ return parts === null ? null : parts.slice(1, 4).map(Number);
29969
+ }
29970
+ /** `spur.version` from the version the running Spur daemon reports, or null when unread. */
29971
+ function spurVersionCheck(version) {
29972
+ const id = "spur.version";
29973
+ const parts = version === null ? null : spurVersionParts(version);
29974
+ const min = spurVersionParts(SPUR_MIN_VERSION);
29975
+ if (version === null || parts === null || min === null) return warning(id, SPUR_VERSION_UNREAD_FIX);
29976
+ return check(id, (parts.map((part, index) => part - (min[index] ?? 0)).find((diff) => diff !== 0) ?? 0) >= 0, `Spur ${version} is running, older than ${SPUR_MIN_VERSION}, the oldest Spur the Board supports; upgrade Spur to ${SPUR_MIN_VERSION} or newer, restart the Spur daemon, then rerun board doctor.`);
29977
+ }
29978
+ function readSpurVersion(ctx, fetcher, deadlineMs, baseUrl) {
29979
+ return deadlineCall(ctx, deadlineMs, "doctor.spur.version", "Spur version read failed", async (signal) => {
29980
+ const response = await fetcher(new URL("info", apiBaseUrl(baseUrl)), {
29981
+ method: "GET",
29982
+ signal
29983
+ });
29984
+ if (!response.ok) {
29985
+ await response.body?.cancel().catch(() => void 0);
29986
+ return null;
29987
+ }
29988
+ const parsed = spurInfoWire.safeParse(await response.json());
29989
+ return parsed.success ? parsed.data.version : null;
29990
+ });
29991
+ }
29890
29992
  async function request(ctx, fetcher, deadlineMs, id, url, init = {}) {
29891
29993
  try {
29892
29994
  return await ctx.logCall(`doctor.${id}`, () => fetcher(url, {
@@ -29987,6 +30089,7 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
29987
30089
  const { config, secrets } = ctx;
29988
30090
  const checks = [];
29989
30091
  const spurUi = spurUiCheck(ctx, fetcher, deadlineMs);
30092
+ const spurVersion = readSpurVersion(ctx, fetcher, deadlineMs, config.adapters.spur.baseUrl);
29990
30093
  if (config.web.port !== void 0) checks.push(webListening?.() === true ? check("web.listening", true, "") : warning("web.listening", "Free the configured web port and restart the daemon."));
29991
30094
  const jiraTrackers = config.projects.flatMap((project) => project.tracker.type === "jira" ? [project.tracker] : []);
29992
30095
  const slackConfigured = Boolean(config.slack.channels.feed || config.slack.channels.orchestrators);
@@ -30019,11 +30122,26 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
30019
30122
  if (ruled) checks.push(reviewRuleCheck(reviewRules === null ? null : await reviewRules));
30020
30123
  if (mirrored) checks.push(mirrorCheck(mirrors === null ? null : await mirrors));
30021
30124
  const probe = spurSendRequest(config.adapters.spur.baseUrl, SPUR_PROBE_SESSION, "spur-board doctor probe");
30022
- const [spur, spurSend] = await Promise.all([request(ctx, fetcher, deadlineMs, "spur", new URL("sessions", apiBaseUrl(config.adapters.spur.baseUrl))), request(ctx, fetcher, deadlineMs, "spur.send", probe.url, probe.init)]);
30023
- checks.push(check("spur.api", spur?.ok === true, "Start or correct the configured Spur API."));
30024
- const spurSendOk = spurSend?.status === 404 && ((await spurErrorText(spurSend))?.startsWith("Session not found") ?? false);
30025
- if (spurSend !== null && spurSend.status !== 404) await spurSend.body?.cancel().catch(() => void 0);
30026
- checks.push(check("spur.send", spurSendOk, spurSend === null ? SPUR_SEND_UNREACHABLE_FIX : SPUR_SEND_FIX));
30125
+ const [spurOk, spurSend] = await Promise.all([request(ctx, fetcher, deadlineMs, "spur", new URL("sessions", apiBaseUrl(config.adapters.spur.baseUrl))).then((response) => response?.ok === true), request(ctx, fetcher, deadlineMs, "spur.send", probe.url, probe.init).then(async (response) => {
30126
+ if (response === null) return {
30127
+ reachable: false,
30128
+ ok: false
30129
+ };
30130
+ if (response.status !== 404) {
30131
+ await response.body?.cancel().catch(() => void 0);
30132
+ return {
30133
+ reachable: true,
30134
+ ok: false
30135
+ };
30136
+ }
30137
+ return {
30138
+ reachable: true,
30139
+ ok: (await spurErrorText(response))?.startsWith("Session not found") ?? false
30140
+ };
30141
+ })]);
30142
+ checks.push(check("spur.api", spurOk, "Start or correct the configured Spur API."));
30143
+ checks.push(check("spur.send", spurSend.ok, spurSend.reachable ? SPUR_SEND_FIX : SPUR_SEND_UNREACHABLE_FIX));
30144
+ const spurVersionAt = checks.length;
30027
30145
  if (!slackConfigured) checks.push(warning("slack.configured", "Slack is not configured: questions addressed to you are only visible through board inbox. Run the spur-board-setup skill to configure slack.channels."));
30028
30146
  else {
30029
30147
  const botToken = secrets["SLACK_BOT_TOKEN"];
@@ -30071,6 +30189,7 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
30071
30189
  checks.push(curatorSessionsCheck(await curatorSessions(ctx.store.db, config)));
30072
30190
  checks.push(orchestratorSessionsCheck(await orchestratorSessions(ctx.store.db, config)));
30073
30191
  checks.push(await spurUi);
30192
+ checks.splice(spurVersionAt, 0, spurVersionCheck(await spurVersion));
30074
30193
  return {
30075
30194
  version: productVersion,
30076
30195
  checks
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { lt as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-DlNdkguO.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-BHROPjEZ.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-C7H6hp1r.mjs";
1
+ import { b as renderMcpError, dt as ERRORS, m as OPERATIONS } from "./chunk-BUxxW9le.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-f54aP3OF.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-BVb6nX0w.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";