spur-board 0.95.0 → 0.97.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.
@@ -192,7 +192,10 @@ const ITEM_KINDS = [
192
192
  ];
193
193
  /** What an `inbox.operator` entry is: a block addressed to the operator, else an item kind. */
194
194
  const INBOX_KINDS = ["block", ...ITEM_KINDS];
195
- /** `failure`: something the board or a connection broke; `attention`: a decision or answer. */
195
+ /**
196
+ * `failure`: the board or a connection broke; `attention`: a decision, answer or other operator
197
+ * action is wanted.
198
+ */
196
199
  const INBOX_SEVERITIES = ["attention", "failure"];
197
200
  /** Who caused a journal event. */
198
201
  const ACTORS = [
@@ -2850,8 +2853,9 @@ const inboxEntrySchema = z.strictObject({
2850
2853
  ]).describe("Item (I), block (B) or turn (T) ID; stable while the entry exists."),
2851
2854
  project: z.string().min(1).describe("Board project the entry belongs to; _board for a board-wide one."),
2852
2855
  kind: z.enum(INBOX_KINDS).describe("block for a block addressed to the operator, turn for a turn, else the item kind."),
2853
- severity: z.enum(INBOX_SEVERITIES).describe("failure: something broke and the text says what to check; attention: a decision or answer is wanted."),
2856
+ severity: z.enum(INBOX_SEVERITIES).describe("failure: the board or a connection broke; attention: a decision, answer or other operator action is wanted."),
2854
2857
  text: z.string().describe("What needs the operator, in one line."),
2858
+ 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."),
2855
2859
  at: z.iso.datetime().describe("When the entry was raised or opened, ISO 8601 UTC."),
2856
2860
  task: taskKeySchema.nullable().describe("Task the entry is about; null when it has none."),
2857
2861
  column: z.enum(COLUMN_IDS).optional().describe("Column of a turn; absent on other entries."),
@@ -3696,6 +3700,7 @@ const OPERATIONS = [
3696
3700
  kind: "transport_health",
3697
3701
  severity: "failure",
3698
3702
  text: `slack delivery down since ${at} (connection lost): check the Slack app tokens`,
3703
+ action: "check the Slack app tokens",
3699
3704
  at,
3700
3705
  task: null
3701
3706
  },
@@ -1,5 +1,5 @@
1
- import { d as buildCatalogSnapshot, ft as configSchema, mt as plainHttpAllowed, p as OPERATIONS } from "./chunk-U_xhOGUV.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-CIPjiog7.mjs";
1
+ import { d as buildCatalogSnapshot, ft as configSchema, mt as plainHttpAllowed, p as OPERATIONS } from "./chunk-CE0uEQ8x.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-gLlzvviO.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 { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-U_xhOGUV.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-CE0uEQ8x.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 { Q as ERRORS, a as requestHashOf, bt as SLACK_BOT_SCOPES, ct as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, ht as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-U_xhOGUV.mjs";
1
+ import { Q as ERRORS, a as requestHashOf, bt as SLACK_BOT_SCOPES, ct as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, ht as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-CE0uEQ8x.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-CIPjiog7.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-D557y4-h.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-gLlzvviO.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-WRtnPk5Z.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 +1 @@
1
- export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-CIPjiog7.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-gLlzvviO.mjs";
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, St as VIAS, 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 COLUMN_IDS, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, bt as SLACK_BOT_SCOPES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as configBindings, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, h as renderHttpProblem, ht as requiredSecretKeys, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as RESERVED_PROJECT, m as turnHandedSchema, mt as plainHttpAllowed, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as defaultAddressee, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as boardWideSpurProject, v as SPACE_IDS, vt as DISPATCHER_MODES, w as EVENT_KINDS, x as interactionRefSchema, xt as TASK_HOLDS, y as conversationRefSchema, yt as ITEM_KINDS, z as parseRingMarker } from "./chunk-U_xhOGUV.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, St as VIAS, 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 COLUMN_IDS, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, bt as SLACK_BOT_SCOPES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as configBindings, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, h as renderHttpProblem, ht as requiredSecretKeys, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as RESERVED_PROJECT, m as turnHandedSchema, mt as plainHttpAllowed, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as defaultAddressee, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as boardWideSpurProject, v as SPACE_IDS, vt as DISPATCHER_MODES, w as EVENT_KINDS, x as interactionRefSchema, xt as TASK_HOLDS, y as conversationRefSchema, yt as ITEM_KINDS, z as parseRingMarker } from "./chunk-CE0uEQ8x.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";
@@ -13997,14 +13997,52 @@ function createLinkMutations(config, deps = {}) {
13997
13997
  /** How far back `handled` reaches, and how many entries it keeps. */
13998
13998
  const HANDLED_WINDOW_MS = 864e5;
13999
13999
  const HANDLED_MAX = 20;
14000
- /** What a failure item asks the operator to check; a `source:` item gets its own text. */
14001
- const CHECK_HINTS = {
14002
- transport_health: (item) => `the ${capitalized(item.item_key.slice(10))} app tokens`,
14003
- post_failed: () => "the chat gateway, then retry the item",
14004
- inbound_failure: () => "the daemon log, then retry the item",
14005
- inbound_gap: () => "the conversation for missed messages",
14006
- answer_undelivered: () => "the asking session, then retry the item",
14007
- worker_not_reading: () => "the worker session, then retry the item"
14000
+ /** `B<n>` of the block an item refers to, else "its block". */
14001
+ function blockName(item) {
14002
+ const ref = itemBlockRef(item);
14003
+ return ref === void 0 ? "its block" : `B${String(ref)}`;
14004
+ }
14005
+ const HEALTH_KEY = "health:";
14006
+ const WORKER_ENDED = "start a new worker for the task, or archive the task";
14007
+ const OBSERVATION_FALLBACK = "check the task, then close the item";
14008
+ /** The action of a `board_observation` item, chosen by its key prefix. */
14009
+ function observationAction(item) {
14010
+ const key = item.item_key;
14011
+ if (key.startsWith("pr-outcome:")) return "check the pull request, then close the item or archive the task";
14012
+ if (key.startsWith("lookup:")) return "check the ticket in the tracker, then close the item or archive the task";
14013
+ if (key.startsWith("operator-block:")) return `answer ${blockName(item)}`;
14014
+ if (key.startsWith("block:")) return `answer ${blockName(item)} if it is a question, or close it with a reason`;
14015
+ if (key.startsWith("filter:")) return "return the ticket to the tracker filter, or finish or unlink the linked work";
14016
+ if (key.startsWith(HEALTH_KEY)) {
14017
+ const rest = key.slice(7);
14018
+ const first = rest.indexOf(":");
14019
+ const last = rest.lastIndexOf(":");
14020
+ const session = first < 0 || first === last ? "" : rest.slice(first + 1, last);
14021
+ if (session === "") return OBSERVATION_FALLBACK;
14022
+ return rest.slice(last + 1) === "worker_vanished" ? WORKER_ENDED : `check session ${session} in Spur`;
14023
+ }
14024
+ return OBSERVATION_FALLBACK;
14025
+ }
14026
+ /**
14027
+ * What the operator does about an item, the end of its text. A failure says what to check; a
14028
+ * `source:` item gets its action from `sourceText`.
14029
+ */
14030
+ const ACTIONS = {
14031
+ transport_health: (item) => `check the ${capitalized(item.item_key.slice(10))} app tokens`,
14032
+ post_failed: () => "check the chat gateway, then retry the item",
14033
+ inbound_failure: () => "check the daemon log, then retry the item",
14034
+ inbound_gap: () => "check the conversation for missed messages",
14035
+ answer_undelivered: () => "check the asking session, then retry the item",
14036
+ worker_not_reading: () => "check the worker session, then retry the item",
14037
+ token_request: () => "approve or deny it in Slack within 15 minutes of the request",
14038
+ post_blocked: () => "close the item once you have read it",
14039
+ answer_author_unavailable: (_item, { task }) => task === null ? "pass the answer to the asking session yourself, then close the item" : "comment on the task so a live session reads the answer, then close the item",
14040
+ board_observation: observationAction,
14041
+ worker_ended: () => WORKER_ENDED,
14042
+ anomaly: (item) => `wait for the answer to ${blockName(item)}, or answer it yourself`,
14043
+ course_check: (item) => `wait for the answer to ${blockName(item)}, or answer it yourself`,
14044
+ cycle_limit: (item) => `answer or close ${blockName(item)} to reset the cycle count`,
14045
+ conversation_waiting: (item, { block }) => `start a session in ${block?.addressee_spur_project ?? "its Spur project"}, or close ${blockName(item)} with a reason`
14008
14046
  };
14009
14047
  const PROBLEMS = {
14010
14048
  auth: "auth failed",
@@ -14025,7 +14063,10 @@ function serviceOf(source) {
14025
14063
  */
14026
14064
  function sourceText(item, state) {
14027
14065
  const source = item.item_key.slice(7);
14028
- const stored = `${item.text}: check the ${source} source`;
14066
+ const stored = {
14067
+ condition: item.text,
14068
+ action: `check the ${source} source`
14069
+ };
14029
14070
  const reason = state?.blind_reason ?? null;
14030
14071
  const service = serviceOf(source);
14031
14072
  if (item.cleared_at !== null || reason === null || service === void 0) return stored;
@@ -14033,7 +14074,10 @@ function sourceText(item, state) {
14033
14074
  const thing = reason === "auth" ? `the ${service} token` : reason === "config" ? `the ${source} settings in the board config` : reason === "stale" && source === "spur" ? "the Spur daemon" : void 0;
14034
14075
  if (problem === void 0 || thing === void 0) return stored;
14035
14076
  const message = state?.blind_message ?? null;
14036
- return `${service} ${problem}${message === null ? "" : ` (${message})`}: check ${thing}`;
14077
+ return {
14078
+ condition: `${service} ${problem}${message === null ? "" : ` (${message})`}`,
14079
+ action: `check ${thing}`
14080
+ };
14037
14081
  }
14038
14082
  /** Newest first by `at`, ties by id as text. */
14039
14083
  function newestFirst(at) {
@@ -14096,6 +14140,7 @@ function createOperatorInbox(deps) {
14096
14140
  "block.id",
14097
14141
  "block.addressee_role",
14098
14142
  "block.project",
14143
+ "block.addressee_spur_project",
14099
14144
  ...taskColumns
14100
14145
  ]).where("block.id", "in", blockIds).execute(),
14101
14146
  deliveryOwners(trx, items),
@@ -14115,13 +14160,20 @@ function createOperatorInbox(deps) {
14115
14160
  if (block?.addressee_role === "operator" && (ITEM_POLICY[kind].block || item.item_key.startsWith("operator-block:") || item.item_key.startsWith("block:"))) return void 0;
14116
14161
  const task = owner(item) ?? owners.get(item.id) ?? (block === void 0 ? null : owner(block));
14117
14162
  if (task?.membership === "archived") return void 0;
14118
- const hint = CHECK_HINTS[kind];
14163
+ const { condition, action } = item.item_key.startsWith("source:") ? sourceText(item, sourceById.get(item.item_key.slice(7))) : {
14164
+ condition: item.text,
14165
+ action: ACTIONS[kind](item, {
14166
+ block,
14167
+ task
14168
+ })
14169
+ };
14119
14170
  return {
14120
14171
  id: `I${String(item.id)}`,
14121
14172
  project: task?.project ?? (block === void 0 ? "_board" : blockProject(block.project)),
14122
14173
  kind,
14123
14174
  severity: itemSeverity(kind, item.item_key),
14124
- text: item.item_key.startsWith("source:") ? sourceText(item, sourceById.get(item.item_key.slice(7))) : hint === void 0 ? item.text : `${item.text}: check ${hint(item)}`,
14175
+ text: `${condition}: ${action}`,
14176
+ action,
14125
14177
  at: item.raised_at,
14126
14178
  task: task?.key ?? null,
14127
14179
  ...item.cleared_at === null ? {} : { handledAt: item.cleared_at }
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-U_xhOGUV.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-CIPjiog7.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-D557y4-h.mjs";
1
+ import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-CE0uEQ8x.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-gLlzvviO.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-WRtnPk5Z.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";