spur-board 0.107.0 → 0.109.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.
@@ -2760,6 +2760,7 @@ const prSummarySchema = z.strictObject({
2760
2760
  unconfirmed: z.boolean().describe("Observation is stale or its supporting source is blind or missing.")
2761
2761
  }).describe("Compact observed pull request facts.");
2762
2762
  const statusTaskSchema = taskViewSchema.extend({
2763
+ columnEnteredAt: z.iso.datetime().nullable().describe("Time the task entered its current real column, ISO 8601 UTC; latest real move or correction, falling back to the original add time, or null if neither is known."),
2763
2764
  shadowColumn: z.enum(COLUMN_IDS).optional().describe("Column the dispatcher works from in shadow mode: where the board would have the task. Present only while the project dispatcher is in shadow mode."),
2764
2765
  shadowDiffers: z.boolean().optional().describe("Whether shadowColumn differs from column. Present only while the project dispatcher is in shadow mode."),
2765
2766
  state: z.string().min(1).describe("One line: ticket status, pull request states and session counts by health, an ended session counted as `ended (<reason>)`, joined by \"; \"."),
@@ -3051,7 +3052,7 @@ const taskGetOutputSchema = z.strictObject({
3051
3052
  links: z.array(linkViewSchema).describe("Effective pull request, session, and ticket links."),
3052
3053
  sessions: z.array(statusSessionFactsSchema).optional().describe("Current facts of effective linked sessions."),
3053
3054
  blocks: z.array(taskBlockViewSchema).describe("Blocks on the task, open and unblocked."),
3054
- comments: z.array(commentSchema).describe("Comments on the task, oldest first."),
3055
+ comments: z.array(commentSchema).describe("Comments on the task, oldest first; a block's opening comment, by its author with its reason as text, is left out."),
3055
3056
  why: taskWhySchema.optional().describe("Present only with why.")
3056
3057
  });
3057
3058
  const taskHistoryInputSchema = z.strictObject({ task: taskKeyInputSchema });
@@ -3326,7 +3327,7 @@ const OPERATIONS = [
3326
3327
  id: "status.get",
3327
3328
  web: true,
3328
3329
  kind: "query",
3329
- description: "List items, freshness, service health, host metrics, tasks with turns and PRs; detail adds facts.",
3330
+ description: "List items, freshness, service health, host metrics, tasks with columnEnteredAt, turns and PRs; detail adds facts.",
3330
3331
  mcp: {
3331
3332
  whenToUse: "Get a board overview.",
3332
3333
  whenNotToUse: "Use task_get for one task."
@@ -3370,6 +3371,7 @@ const OPERATIONS = [
3370
3371
  sources: [],
3371
3372
  tasks: [{
3372
3373
  ...task,
3374
+ columnEnteredAt: at,
3373
3375
  state: "ticket not observed",
3374
3376
  prCount: 0,
3375
3377
  sessionCount: 0,
@@ -3424,6 +3426,7 @@ const OPERATIONS = [
3424
3426
  sources: [],
3425
3427
  tasks: [{
3426
3428
  ...task,
3429
+ columnEnteredAt: at,
3427
3430
  state: "ticket not observed",
3428
3431
  prCount: 0,
3429
3432
  sessionCount: 0,
@@ -1,4 +1,4 @@
1
- import { _ as renderJsonError, at as successEnvelopeSchema, c as tokenRequestStatusSchema, et as ERRORS, nt as errorContextSchema, o as tokenRequestResultSchema, rt as errorEnvelopeSchema } from "./chunk-s-s7C2yY.mjs";
1
+ import { _ as renderJsonError, at as successEnvelopeSchema, c as tokenRequestStatusSchema, et as ERRORS, nt as errorContextSchema, o as tokenRequestResultSchema, rt as errorEnvelopeSchema } from "./chunk-5l4Msgb0.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 { d as buildCatalogSnapshot, gt as plainHttpAllowed, mt as configSchema, p as OPERATIONS } from "./chunk-s-s7C2yY.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-CY7zsZXv.mjs";
1
+ import { d as buildCatalogSnapshot, gt as plainHttpAllowed, mt as configSchema, p as OPERATIONS } from "./chunk-5l4Msgb0.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-Bw_gFKmQ.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 { St as SLACK_BOT_SCOPES, Y as actorIdSchema, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, et as ERRORS, f as roleCanUseOperation, mt as configSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as DEFAULT_STAND_PORT_RANGE, vt as resolveWebOrigin } from "./chunk-s-s7C2yY.mjs";
1
+ import { St as SLACK_BOT_SCOPES, Y as actorIdSchema, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, et as ERRORS, f as roleCanUseOperation, mt as configSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as DEFAULT_STAND_PORT_RANGE, vt as resolveWebOrigin } from "./chunk-5l4Msgb0.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-CY7zsZXv.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-YxOIpPtc.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-Bw_gFKmQ.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-DFqvm5hQ.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";
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-CY7zsZXv.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-Bw_gFKmQ.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as parseRef$1, A as defaultBranchFactSchema, B as isExternalAuthor, C as messageRefSchema, Ct as TASK_HOLDS, D as eventPayloadSchemas, E as GATE_REASONS, F as trackerSourceId, G as sessionFactsSchema, H as prFactsSchema, I as PR_STATES, J as REF_NUMBER, K as ticketFactsSchema, L as REVIEW_STATES, M as prSourceId, N as sessionTransitionSchema, O as AdapterError, P as sourceCursorSchema, Q as parseActorId, R as SESSION_HEALTH_STATES, S as interactionRefSchema, St as SLACK_BOT_SCOPES, T as EVENT_KINDS, U as prRefSchema, V as parseRingMarker, W as ringMarker, X as encodeActorId, Y as actorIdSchema, Z as errorCodeOf, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, b as conversationRefSchema, bt as DISPATCHER_MODES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as RESERVED_PROJECT, et as ERRORS, f as roleCanUseOperation, ft as boardWideSpurProject, g as renderHttpProblem, gt as plainHttpAllowed, h as turnHandedSchema, ht as defaultAddressee, i as TOKEN_REQUEST_LIMITS, it as ok, j as entityRefSchema, k as batchSchema, l as BOARD_TICK_MS, lt as DEFAULT_SLACK_COMMAND, m as defaultBranchViewSchema, mt as configSchema, n as doctorReportSchema, o as tokenRequestResultSchema, p as OPERATIONS, pt as configBindings, q as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as DEFAULT_LINK, t as assertNever, tt as err, vt as resolveWebOrigin, w as userIdSchema, wt as VIAS, x as inboundEventSchema, xt as ITEM_KINDS, y as SPACE_IDS, yt as COLUMN_IDS, z as SESSION_STATUSES } from "./chunk-s-s7C2yY.mjs";
1
+ import { $ as parseRef$1, A as defaultBranchFactSchema, B as isExternalAuthor, C as messageRefSchema, Ct as TASK_HOLDS, D as eventPayloadSchemas, E as GATE_REASONS, F as trackerSourceId, G as sessionFactsSchema, H as prFactsSchema, I as PR_STATES, J as REF_NUMBER, K as ticketFactsSchema, L as REVIEW_STATES, M as prSourceId, N as sessionTransitionSchema, O as AdapterError, P as sourceCursorSchema, Q as parseActorId, R as SESSION_HEALTH_STATES, S as interactionRefSchema, St as SLACK_BOT_SCOPES, T as EVENT_KINDS, U as prRefSchema, V as parseRingMarker, W as ringMarker, X as encodeActorId, Y as actorIdSchema, Z as errorCodeOf, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, b as conversationRefSchema, bt as DISPATCHER_MODES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as RESERVED_PROJECT, et as ERRORS, f as roleCanUseOperation, ft as boardWideSpurProject, g as renderHttpProblem, gt as plainHttpAllowed, h as turnHandedSchema, ht as defaultAddressee, i as TOKEN_REQUEST_LIMITS, it as ok, j as entityRefSchema, k as batchSchema, l as BOARD_TICK_MS, lt as DEFAULT_SLACK_COMMAND, m as defaultBranchViewSchema, mt as configSchema, n as doctorReportSchema, o as tokenRequestResultSchema, p as OPERATIONS, pt as configBindings, q as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as DEFAULT_LINK, t as assertNever, tt as err, vt as resolveWebOrigin, w as userIdSchema, wt as VIAS, x as inboundEventSchema, xt as ITEM_KINDS, y as SPACE_IDS, yt as COLUMN_IDS, z as SESSION_STATUSES } from "./chunk-5l4Msgb0.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";
@@ -14549,6 +14549,16 @@ async function readStatusBlocks(db, projectIds) {
14549
14549
  }
14550
14550
  return blocks;
14551
14551
  }
14552
+ /** Latest real entry into each visible task's current column, ordered by journal position. */
14553
+ async function readStatusColumnEntries(db, projectIds) {
14554
+ return await db.selectFrom("event").innerJoin((eb) => eb.selectFrom("event as entry").innerJoin("task", "task.id", "entry.task_id").select((eb) => eb.fn.max("entry.id").as("id")).where("task.membership", "!=", "archived").where("task.project", "in", [...projectIds]).where(sql`json_extract(entry.payload, '$.to') = task.column`).where(sql`(entry.kind = 'task_moved' or (entry.kind = 'task_corrected' and json_extract(entry.payload, '$.shadow') = 0))`).groupBy("entry.task_id").as("latest"), (join) => join.onRef("latest.id", "=", "event.id")).select(["event.task_id", "event.at"]).execute();
14555
+ }
14556
+ function sourceInterval(config, source) {
14557
+ if (source === "spur") return config.adapters.spur.intervalMs;
14558
+ if (source.startsWith("jira:")) return config.adapters.jira.intervalMs;
14559
+ if (source.startsWith("github-issues:")) return config.adapters.githubIssues.intervalMs;
14560
+ return config.adapters.github.intervalMs;
14561
+ }
14552
14562
  // ../core/src/app/status.ts
14553
14563
  function sessionView(fact) {
14554
14564
  return {
@@ -14601,12 +14611,6 @@ function issuesRepo(project) {
14601
14611
  }
14602
14612
  /** Unlinked PRs and sessions finished longer ago than this are counted, not listed. */
14603
14613
  const UNLINKED_WINDOW_MS = 6048e5;
14604
- function interval(config, source) {
14605
- if (source === "spur") return config.adapters.spur.intervalMs;
14606
- if (source.startsWith("jira:")) return config.adapters.jira.intervalMs;
14607
- if (source.startsWith("github-issues:")) return config.adapters.githubIssues.intervalMs;
14608
- return config.adapters.github.intervalMs;
14609
- }
14610
14614
  /** Reads the board's latest facts, items and source availability. */
14611
14615
  async function getStatus(deps, options = {}) {
14612
14616
  const { store, config, clock, completeSince, gateways = [] } = deps;
@@ -14633,6 +14637,8 @@ async function getStatus(deps, options = {}) {
14633
14637
  const sourceById = new Map(sourceRows.map((row) => [row.source, row]));
14634
14638
  const turns = await readStatusTurns(store.db, projectIds);
14635
14639
  const returns = await readStatusReturns(store.db, projectIds);
14640
+ const entries = await readStatusColumnEntries(store.db, projectIds);
14641
+ const columnEntries = new Map(entries.map((entry) => [entry.task_id, entry.at]));
14636
14642
  const tasks = [];
14637
14643
  for (const task of rows) {
14638
14644
  if (!projectIds.has(task.project)) continue;
@@ -14653,7 +14659,7 @@ async function getStatus(deps, options = {}) {
14653
14659
  const fact = parseJson(prFactsSchema, snapshot.detail);
14654
14660
  prs.push(fact);
14655
14661
  const source = sourceById.get(snapshot.source);
14656
- const unconfirmed = source === void 0 || source.blind_reason !== null || clock.now() - Date.parse(snapshot.observed_at) > config.thresholds.staleMultiplier * interval(config, snapshot.source);
14662
+ const unconfirmed = source === void 0 || source.blind_reason !== null || clock.now() - Date.parse(snapshot.observed_at) > config.thresholds.staleMultiplier * sourceInterval(config, snapshot.source);
14657
14663
  summaries.push(summarizePr(fact, snapshot.observed_at, unconfirmed));
14658
14664
  }
14659
14665
  } else if (link.entity === "session" && link.session_id !== null) {
@@ -14686,6 +14692,7 @@ async function getStatus(deps, options = {}) {
14686
14692
  key: task.key,
14687
14693
  project: task.project,
14688
14694
  column: task.column,
14695
+ columnEnteredAt: columnEntries.get(task.id) ?? task.created_at,
14689
14696
  membership: task.membership,
14690
14697
  ...project?.dispatcher.mode === "shadow" ? {
14691
14698
  shadowColumn: task.shadow_column ?? task.column,
@@ -14793,7 +14800,7 @@ async function getStatus(deps, options = {}) {
14793
14800
  limit: row.budget_limit,
14794
14801
  resetAt: row.budget_reset_at
14795
14802
  } : null,
14796
- stale: last === null || clock.now() - Date.parse(last) > config.thresholds.staleMultiplier * interval(config, source),
14803
+ stale: last === null || clock.now() - Date.parse(last) > config.thresholds.staleMultiplier * sourceInterval(config, source),
14797
14804
  healthySince: deps.healthySince?.get(source) ?? null,
14798
14805
  warmingUp: !completeSince.has(source)
14799
14806
  };
@@ -14812,7 +14819,7 @@ async function getStatus(deps, options = {}) {
14812
14819
  };
14813
14820
  const items = itemRows.filter((item) => item.task_id !== null ? projectIds.has(itemTasks.get(item.task_id)?.project ?? "") : item.source !== null ? required.has(item.source) : includeBoardItems || ownedBy(item)).map((item) => {
14814
14821
  const source = item.source === null ? null : sourceById.get(item.source);
14815
- const unconfirmed = item.fact_at !== null && item.source !== null && clock.now() - Date.parse(item.fact_at) > config.thresholds.staleMultiplier * interval(config, item.source) || item.text.includes("no_access") || source !== null && source !== void 0 && source.blind_reason !== null;
14822
+ const unconfirmed = item.fact_at !== null && item.source !== null && clock.now() - Date.parse(item.fact_at) > config.thresholds.staleMultiplier * sourceInterval(config, item.source) || item.text.includes("no_access") || source !== null && source !== void 0 && source.blind_reason !== null;
14816
14823
  const time = item.fact_at === null ? null : new Date(item.fact_at).toISOString().slice(11, 16);
14817
14824
  return {
14818
14825
  id: `I${String(item.id)}`,
@@ -17395,6 +17402,21 @@ function projectTargets(config, project, actor) {
17395
17402
  const projects = config.projects.filter((entry) => visible.has(entry.id));
17396
17403
  return projects.length === 0 ? [{ kind: "missing" }] : projects.map((entry) => projectTarget(entry.id));
17397
17404
  }
17405
+ /**
17406
+ * Drops each block's opening comment: its earliest comment when author, text and time equal the
17407
+ * block's author, reason and creation time. `block.ask` writes it as the Slack thread root, so the
17408
+ * reply list would repeat the question. Order is kept.
17409
+ */
17410
+ function withoutBlockOpenings(comments, blocks) {
17411
+ const byId = new Map(blocks.map((block) => [block.id, block]));
17412
+ const seen = /* @__PURE__ */ new Set();
17413
+ return comments.filter((comment) => {
17414
+ if (comment.block_id === null || seen.has(comment.block_id)) return true;
17415
+ seen.add(comment.block_id);
17416
+ const block = byId.get(`B${String(comment.block_id)}`);
17417
+ return !(block !== void 0 && comment.author === block.author && comment.text === block.reason && comment.created_at === block.at);
17418
+ });
17419
+ }
17398
17420
  async function taskByKey(trx, key) {
17399
17421
  const task = await trx.selectFrom("task").selectAll().where("key", "=", key).executeTakeFirst();
17400
17422
  if (task === void 0) throw new CommandError("not_found", "Check the task key.");
@@ -17506,7 +17528,7 @@ function createTaskQueries(deps) {
17506
17528
  };
17507
17529
  }),
17508
17530
  blocks,
17509
- comments: comments.map((comment) => commentView(comment, subject)),
17531
+ comments: withoutBlockOpenings(comments, blocks).map((comment) => commentView(comment, subject)),
17510
17532
  ...input.why === true ? { why: await why(trx, task) } : {}
17511
17533
  };
17512
17534
  }
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { et as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-s-s7C2yY.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-CY7zsZXv.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-YxOIpPtc.mjs";
1
+ import { et as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-5l4Msgb0.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-Bw_gFKmQ.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DFqvm5hQ.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";