spur-board 0.158.0 → 0.160.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.
@@ -3313,11 +3313,20 @@ const statusUnlinkedPrSchema = prFactsSchema.partial({
3313
3313
  const statusUnlinkedSessionSchema = statusSessionFactsSchema.partial({
3314
3314
  pr: true,
3315
3315
  links: true,
3316
+ lifecycle: true,
3317
+ health: true,
3316
3318
  healthSince: true,
3317
3319
  lastActivityAt: true,
3318
3320
  endedAt: true,
3319
3321
  endReason: true
3320
- }).describe("A session without a task link; fields beyond its identity need detail.");
3322
+ }).extend({
3323
+ state: z.enum([
3324
+ "live",
3325
+ "ended",
3326
+ "absent"
3327
+ ]).describe("live while listed by Spur; ended once it ended, vanished, or Spur lists it completed, killed or errored; absent once a complete Spur poll left it out of the list."),
3328
+ since: z.iso.datetime().nullable().describe("When the session ended or left the list, ISO 8601 UTC; null while live.")
3329
+ }).describe("A session without a task link. Compact rows carry id, spurProject, branch, state and since, plus lifecycle and health while live. Detail rows add the other session facts; ended and absent rows keep a completed, killed or errored lifecycle but leave out health, healthSince and rateLimitResetAt.");
3321
3330
  const statusItemSchema = itemViewSchema.extend({
3322
3331
  key: z.string().min(1).describe("Stable key of this actionable item."),
3323
3332
  unconfirmed: z.boolean().describe("Whether a supporting fact is stale or its source is blind."),
@@ -3736,7 +3745,7 @@ const statusOutputSchema = z.strictObject({
3736
3745
  openBlocks: z.int().min(0).describe("Open project-level blocks, without a task.")
3737
3746
  }).describe("Open project-level blocks of one project.")).describe("Open project-level blocks of each requested project."),
3738
3747
  unlinkedPrs: z.array(statusUnlinkedPrSchema).describe("Observed pull requests without a task link; merged or closed ones with no change for over 7 days are left out."),
3739
- unlinkedSessions: z.array(statusUnlinkedSessionSchema).describe("Observed sessions without a task link; ones ended, or gone from Spur's session list, for over 7 days are left out."),
3748
+ unlinkedSessions: z.array(statusUnlinkedSessionSchema).describe("Observed sessions without a task link, each with its state (live, ended or absent) and since when; ones ended, or gone from Spur's session list, for over 7 days are left out, but not an errored session Spur still lists."),
3740
3749
  hiddenUnlinkedPrs: z.int().min(0).describe("Unlinked pull requests not listed: merged or closed, with no change for over 7 days. Counted within the requested projects; detail does not list them."),
3741
3750
  hiddenUnlinkedSessions: z.int().min(0).describe("Unlinked sessions not listed: ended, or gone from Spur's session list, for over 7 days. Counted within the requested projects; detail does not list them."),
3742
3751
  bindings: statusBindingsSchema,
@@ -6022,6 +6031,11 @@ const tokenRequestStatusSchema = z.strictObject({ status: z.enum([...TOKEN_STATU
6022
6031
  function requestHashOf(hash) {
6023
6032
  return hash.slice(0, 10);
6024
6033
  }
6034
+ /**
6035
+ * The oldest Spur release with every Spur API the Board calls: transition polling
6036
+ * (`GET /sessions/transitions`, Spur #1447). Bump it with the feature that needs a newer Spur.
6037
+ */
6038
+ const SPUR_MIN_VERSION = "1.53.0";
6025
6039
  const checkShape = {
6026
6040
  id: z.string(),
6027
6041
  status: z.enum([
@@ -6055,4 +6069,4 @@ const remoteDoctorReportSchema = z.object({
6055
6069
  function assertNever(value) {
6056
6070
  throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
6057
6071
  }
6058
- export { prReviewRuleSchema as $, GATE_REASONS as A, readyMirrorOf as At, sessionTransitionSchema as B, TASK_HOLDS as Bt, interactionRefSchema as C, boardWideSpurProject as Ct, skillReloadFilesSchema as D, defaultAddressee as Dt, skillReloadFileSchema as E, configSchema as Et, batchSchema as F, COLUMN_GROUPS as Ft, REVIEW_STATES as G, trackerSourceId as H, VIAS as Ht, defaultBranchFactSchema as I, COLUMN_IDS as It, isExternalAuthor as J, SESSION_HEALTH_STATES as K, entityRefSchema as L, DISPATCHER_MODES as Lt, AdapterError as M, resolveWebOrigin as Mt, MIRROR_FAILURES as N, BLOCK_TYPES as Nt, sortSkillFiles as O, externalQuietAfterMs as Ot, MIRROR_FAILURE_CODES as P, COLUMNS as Pt, prRefSchema as Q, mirrorSourceId as R, ITEM_KINDS as Rt, inboundEventSchema as S, approvalRuleOf as St, userIdSchema as T, configBindings as Tt, PR_STATES as U, isTodoGroupColumn as Ut, sourceCursorSchema as V, TODO_GROUP_COLUMN_IDS as Vt, REVIEW_DECISIONS as W, prApprovalPairSchema as X, parseRingMarker as Y, prFactsSchema as Z, renderHttpProblem as _, DEFAULT_LINK as _t, requestHashOf as a, actorIdSchema as at, SPACE_IDS as b, DEFAULT_STAND_PORT_RANGE as bt, tokenRequestStatusSchema as c, parseActorId as ct, buildCatalogSnapshot as d, err as dt, ringMarker as et, roleCanUseOperation as f, errorContextSchema as ft, turnHandedSchema as g, DEFAULT_HTTP_PORT as gt, inboxNoSessionSchema as h, successEnvelopeSchema as ht, TOKEN_REQUEST_LIMITS as i, REF_NUMBER as it, eventPayloadSchemas as j, requiredSecretKeys as jt, EVENT_KINDS as k, plainHttpAllowed as kt, BOARD_TICK_MS as l, parseRef as lt, defaultBranchViewSchema as m, ok as mt, doctorReportSchema as n, ticketFactsSchema as nt, tokenRequestResultSchema as o, encodeActorId as ot, OPERATIONS as p, errorEnvelopeSchema as pt, SESSION_STATUSES as q, remoteDoctorReportSchema as r, JIRA_PROJECT_KEY as rt, tokenRequestSchema as s, errorCodeOf as st, assertNever as t, sessionFactsSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, ERRORS as ut, renderJsonError as v, DEFAULT_SLACK_APP_NAME as vt, messageRefSchema as w, columnTurnTimings as wt, conversationRefSchema as x, RESERVED_PROJECT as xt, renderMcpError as y, DEFAULT_SLACK_COMMAND as yt, prSourceId as z, SLACK_BOT_SCOPES as zt };
6072
+ 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,4 +1,4 @@
1
- import { c as tokenRequestStatusSchema, ft as errorContextSchema, ht as successEnvelopeSchema, o as tokenRequestResultSchema, pt as errorEnvelopeSchema, ut as ERRORS, v as renderJsonError } from "./chunk-Cly2ejBA.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-CV__xxV8.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
@@ -1,5 +1,5 @@
1
- import { Et as configSchema, d as buildCatalogSnapshot, kt as plainHttpAllowed, p as OPERATIONS } from "./chunk-Cly2ejBA.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-PSohvh-P.mjs";
1
+ import { At as plainHttpAllowed, Dt as configSchema, f as buildCatalogSnapshot, m as OPERATIONS } from "./chunk-CV__xxV8.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-DpR7gxfh.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 { E as skillReloadFileSchema, Et as configSchema, Mt as resolveWebOrigin, O as sortSkillFiles, a as requestHashOf, at as actorIdSchema, bt as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ht as successEnvelopeSchema, jt as requiredSecretKeys, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as ERRORS, zt as SLACK_BOT_SCOPES } from "./chunk-Cly2ejBA.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-CV__xxV8.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-PSohvh-P.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-Bhv5wzSj.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-DpR7gxfh.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-bxssICzu.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-PSohvh-P.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-DpR7gxfh.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as prReviewRuleSchema, A as GATE_REASONS, At as readyMirrorOf, B as sessionTransitionSchema, Bt as TASK_HOLDS, C as interactionRefSchema, Ct as boardWideSpurProject, D as skillReloadFilesSchema, Dt as defaultAddressee, Et as configSchema, F as batchSchema, Ft as COLUMN_GROUPS, G as REVIEW_STATES, H as trackerSourceId, Ht as VIAS, I as defaultBranchFactSchema, It as COLUMN_IDS, J as isExternalAuthor, K as SESSION_HEALTH_STATES, L as entityRefSchema, Lt as DISPATCHER_MODES, M as AdapterError, Mt as resolveWebOrigin, N as MIRROR_FAILURES, Nt as BLOCK_TYPES, O as sortSkillFiles, Ot as externalQuietAfterMs, P as MIRROR_FAILURE_CODES, Pt as COLUMNS, Q as prRefSchema, R as mirrorSourceId, Rt as ITEM_KINDS, S as inboundEventSchema, St as approvalRuleOf, T as userIdSchema, Tt as configBindings, U as PR_STATES, Ut as isTodoGroupColumn, V as sourceCursorSchema, Vt as TODO_GROUP_COLUMN_IDS, W as REVIEW_DECISIONS, X as prApprovalPairSchema, Y as parseRingMarker, Z as prFactsSchema, _ as renderHttpProblem, _t as DEFAULT_LINK, a as requestHashOf, at as actorIdSchema, b as SPACE_IDS, c as tokenRequestStatusSchema, ct as parseActorId, d as buildCatalogSnapshot, dt as err, et as ringMarker, f as roleCanUseOperation, g as turnHandedSchema, h as inboxNoSessionSchema, ht as successEnvelopeSchema, i as TOKEN_REQUEST_LIMITS, it as REF_NUMBER, j as eventPayloadSchemas, jt as requiredSecretKeys, k as EVENT_KINDS, kt as plainHttpAllowed, l as BOARD_TICK_MS, lt as parseRef$1, m as defaultBranchViewSchema, mt as ok, n as doctorReportSchema, nt as ticketFactsSchema, o as tokenRequestResultSchema, ot as encodeActorId, p as OPERATIONS, q as SESSION_STATUSES, rt as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as errorCodeOf, t as assertNever, tt as sessionFactsSchema, ut as ERRORS, w as messageRefSchema, wt as columnTurnTimings, x as conversationRefSchema, xt as RESERVED_PROJECT, yt as DEFAULT_SLACK_COMMAND, z as prSourceId, zt as SLACK_BOT_SCOPES } from "./chunk-Cly2ejBA.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-CV__xxV8.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";
@@ -14537,6 +14537,82 @@ function sessionView(fact) {
14537
14537
  }))
14538
14538
  };
14539
14539
  }
14540
+ /** Lifecycles after which Spur's session is over, even while Spur still lists it. */
14541
+ const TERMINAL_LIFECYCLES = [
14542
+ "completed",
14543
+ "killed",
14544
+ "errored"
14545
+ ];
14546
+ /**
14547
+ * Whether an unlinked session is live, ended or gone from Spur's list, and since when. Ended wins
14548
+ * over absent; a session ended at the earlier of its finish and end times, and a listed completed,
14549
+ * killed or errored session ended when it finished.
14550
+ */
14551
+ function unlinkedSessionState(session) {
14552
+ if (session.ended_at !== null) return {
14553
+ state: "ended",
14554
+ since: earliestTime([session.finished_at, session.ended_at]) ?? session.ended_at
14555
+ };
14556
+ if (TERMINAL_LIFECYCLES.includes(session.state)) return {
14557
+ state: "ended",
14558
+ since: session.finished_at ?? session.last_seen
14559
+ };
14560
+ if (session.absent_since !== null) return {
14561
+ state: "absent",
14562
+ since: session.absent_since
14563
+ };
14564
+ return {
14565
+ state: "live",
14566
+ since: null
14567
+ };
14568
+ }
14569
+ /**
14570
+ * An unlinked session row: ended and absent ones leave out health and their last live lifecycle;
14571
+ * in detail they keep a terminal lifecycle, which tells completion from kill or error.
14572
+ */
14573
+ function unlinkedSessionView(session, facts, detail) {
14574
+ const shown = unlinkedSessionState(session);
14575
+ const live = shown.state === "live";
14576
+ if (detail) {
14577
+ const view = sessionView(facts);
14578
+ if (live) return {
14579
+ ...view,
14580
+ ...shown
14581
+ };
14582
+ const { id, spurProject, branch, pr, links, lastActivityAt } = view;
14583
+ const rings = view.queuedRings === void 0 ? {} : { queuedRings: view.queuedRings };
14584
+ const terminal = TERMINAL_LIFECYCLES.includes(session.state) ? { lifecycle: view.lifecycle } : {};
14585
+ const finished = session.state === "completed" || session.state === "killed";
14586
+ const { endedAt, endReason } = view.endReason === null && finished ? {
14587
+ endedAt: shown.since,
14588
+ endReason: session.state === "completed" ? "complete" : "kill"
14589
+ } : view;
14590
+ return {
14591
+ id,
14592
+ spurProject,
14593
+ branch,
14594
+ pr,
14595
+ links,
14596
+ ...terminal,
14597
+ lastActivityAt,
14598
+ endedAt,
14599
+ endReason,
14600
+ ...rings,
14601
+ ...shown
14602
+ };
14603
+ }
14604
+ const { id, spurProject, branch, lifecycle, health } = facts;
14605
+ return {
14606
+ id,
14607
+ spurProject,
14608
+ branch,
14609
+ ...shown,
14610
+ ...live ? {
14611
+ lifecycle,
14612
+ health
14613
+ } : {}
14614
+ };
14615
+ }
14540
14616
  /** Order group visits in their own slots, preserving non-group relative ordering. */
14541
14617
  function orderTodoGroupRows(rows, entries, projects) {
14542
14618
  const columnEntries = new Map(entries.map((entry) => [entry.task_id, entry.at]));
@@ -18729,18 +18805,7 @@ async function getStatus(deps, options = {}) {
18729
18805
  const hiddenSession = (session) => {
18730
18806
  return (session.ended_at !== null || session.state === "completed" || session.state === "killed" || session.absent_since !== null) && pastWindow(session.ended_at ?? session.absent_since ?? session.last_seen);
18731
18807
  };
18732
- const unlinkedSessions = sessionRows.filter((session) => !hiddenSession(session)).map((session) => {
18733
- const facts = parseJson(sessionFactsSchema, session.detail);
18734
- if (detail) return sessionView(facts);
18735
- const { id, spurProject, branch, lifecycle, health } = facts;
18736
- return {
18737
- id,
18738
- spurProject,
18739
- branch,
18740
- lifecycle,
18741
- health
18742
- };
18743
- });
18808
+ const unlinkedSessions = sessionRows.filter((session) => !hiddenSession(session)).map((session) => unlinkedSessionView(session, parseJson(sessionFactsSchema, session.detail), detail));
18744
18809
  const sourceIds = (scope, mirrors) => /* @__PURE__ */ new Set(["spur", ...scope.flatMap((project) => {
18745
18810
  const mirror = mirrors ? mirrorSourceId(project) : void 0;
18746
18811
  return [
@@ -29485,6 +29550,9 @@ const DEADLINE_MS = 5e3;
29485
29550
  const SPUR_PROBE_SESSION = "spur-board-doctor-probe";
29486
29551
  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.";
29487
29552
  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.";
29553
+ 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.`;
29554
+ const SPUR_VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-\d+-g[0-9a-f]+)?$/;
29555
+ const spurInfoWire = z.object({ version: z.string().max(64) });
29488
29556
  const GITHUB_FIX = "Check the GitHub token and repository access.";
29489
29557
  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.";
29490
29558
  const GITHUB_TEAMS_FIX = "Use a classic GitHub personal access token with the repo and read:org scopes to read requested review teams.";
@@ -29960,6 +30028,32 @@ async function operatorTokensCheck(ctx, config) {
29960
30028
  fix: null
29961
30029
  } : warning("operator.tokens", line);
29962
30030
  }
30031
+ function spurVersionParts(version) {
30032
+ const parts = SPUR_VERSION.exec(version);
30033
+ return parts === null ? null : parts.slice(1, 4).map(Number);
30034
+ }
30035
+ /** `spur.version` from the version the running Spur daemon reports, or null when unread. */
30036
+ function spurVersionCheck(version) {
30037
+ const id = "spur.version";
30038
+ const parts = version === null ? null : spurVersionParts(version);
30039
+ const min = spurVersionParts(SPUR_MIN_VERSION);
30040
+ if (version === null || parts === null || min === null) return warning(id, SPUR_VERSION_UNREAD_FIX);
30041
+ 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.`);
30042
+ }
30043
+ function readSpurVersion(ctx, fetcher, deadlineMs, baseUrl) {
30044
+ return deadlineCall(ctx, deadlineMs, "doctor.spur.version", "Spur version read failed", async (signal) => {
30045
+ const response = await fetcher(new URL("info", apiBaseUrl(baseUrl)), {
30046
+ method: "GET",
30047
+ signal
30048
+ });
30049
+ if (!response.ok) {
30050
+ await response.body?.cancel().catch(() => void 0);
30051
+ return null;
30052
+ }
30053
+ const parsed = spurInfoWire.safeParse(await response.json());
30054
+ return parsed.success ? parsed.data.version : null;
30055
+ });
30056
+ }
29963
30057
  async function request(ctx, fetcher, deadlineMs, id, url, init = {}) {
29964
30058
  try {
29965
30059
  return await ctx.logCall(`doctor.${id}`, () => fetcher(url, {
@@ -30060,6 +30154,7 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
30060
30154
  const { config, secrets } = ctx;
30061
30155
  const checks = [];
30062
30156
  const spurUi = spurUiCheck(ctx, fetcher, deadlineMs);
30157
+ const spurVersion = readSpurVersion(ctx, fetcher, deadlineMs, config.adapters.spur.baseUrl);
30063
30158
  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."));
30064
30159
  const jiraTrackers = config.projects.flatMap((project) => project.tracker.type === "jira" ? [project.tracker] : []);
30065
30160
  const slackConfigured = Boolean(config.slack.channels.feed || config.slack.channels.orchestrators);
@@ -30092,11 +30187,26 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
30092
30187
  if (ruled) checks.push(reviewRuleCheck(reviewRules === null ? null : await reviewRules));
30093
30188
  if (mirrored) checks.push(mirrorCheck(mirrors === null ? null : await mirrors));
30094
30189
  const probe = spurSendRequest(config.adapters.spur.baseUrl, SPUR_PROBE_SESSION, "spur-board doctor probe");
30095
- 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)]);
30096
- checks.push(check("spur.api", spur?.ok === true, "Start or correct the configured Spur API."));
30097
- const spurSendOk = spurSend?.status === 404 && ((await spurErrorText(spurSend))?.startsWith("Session not found") ?? false);
30098
- if (spurSend !== null && spurSend.status !== 404) await spurSend.body?.cancel().catch(() => void 0);
30099
- checks.push(check("spur.send", spurSendOk, spurSend === null ? SPUR_SEND_UNREACHABLE_FIX : SPUR_SEND_FIX));
30190
+ 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) => {
30191
+ if (response === null) return {
30192
+ reachable: false,
30193
+ ok: false
30194
+ };
30195
+ if (response.status !== 404) {
30196
+ await response.body?.cancel().catch(() => void 0);
30197
+ return {
30198
+ reachable: true,
30199
+ ok: false
30200
+ };
30201
+ }
30202
+ return {
30203
+ reachable: true,
30204
+ ok: (await spurErrorText(response))?.startsWith("Session not found") ?? false
30205
+ };
30206
+ })]);
30207
+ checks.push(check("spur.api", spurOk, "Start or correct the configured Spur API."));
30208
+ checks.push(check("spur.send", spurSend.ok, spurSend.reachable ? SPUR_SEND_FIX : SPUR_SEND_UNREACHABLE_FIX));
30209
+ const spurVersionAt = checks.length;
30100
30210
  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."));
30101
30211
  else {
30102
30212
  const botToken = secrets["SLACK_BOT_TOKEN"];
@@ -30144,6 +30254,7 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
30144
30254
  checks.push(curatorSessionsCheck(await curatorSessions(ctx.store.db, config)));
30145
30255
  checks.push(orchestratorSessionsCheck(await orchestratorSessions(ctx.store.db, config)));
30146
30256
  checks.push(await spurUi);
30257
+ checks.splice(spurVersionAt, 0, spurVersionCheck(await spurVersion));
30147
30258
  return {
30148
30259
  version: productVersion,
30149
30260
  checks
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { p as OPERATIONS, ut as ERRORS, y as renderMcpError } from "./chunk-Cly2ejBA.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-PSohvh-P.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-Bhv5wzSj.mjs";
1
+ import { b as renderMcpError, dt as ERRORS, m as OPERATIONS } from "./chunk-CV__xxV8.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-DpR7gxfh.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-bxssICzu.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";