spur-board 0.25.0 → 0.27.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.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { G as SLACK_BOT_SCOPES, P as ERRORS, U as configSchema, W as requiredSecretKeys, l as roleCanUseOperation, r as SYSTEMD_SERVICE_SETTINGS, u as OPERATIONS } from "./src-Ron2NABC.mjs";
2
- import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-D3vmFo39.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./config-CYLh25BZ.mjs";
1
+ import { G as SLACK_BOT_SCOPES, P as ERRORS, U as configSchema, W as requiredSecretKeys, l as roleCanUseOperation, r as SYSTEMD_SERVICE_SETTINGS, u as OPERATIONS } from "./src-C356blas.mjs";
2
+ import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-BCurPuLJ.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./config-B1u34Kr8.mjs";
4
4
  import { createHash, randomBytes, randomUUID } from "node:crypto";
5
5
  import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
6
6
  import { homedir, hostname, userInfo } from "node:os";
@@ -308,7 +308,8 @@ const remoteBaseIds = [
308
308
  "link.rules",
309
309
  "spur.api",
310
310
  "spur.send",
311
- "operator.path"
311
+ "operator.path",
312
+ "curator.sessions"
312
313
  ];
313
314
  const remoteSlackIds = [
314
315
  "slack.auth",
@@ -1,4 +1,4 @@
1
- import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-Ron2NABC.mjs";
1
+ import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-C356blas.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
package/dist/client.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-D3vmFo39.mjs";
1
+ import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-BCurPuLJ.mjs";
2
2
  export { fetchCatalogVersion, requestOperation, requestTokenEnrollment };
@@ -1,5 +1,5 @@
1
- import { U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-Ron2NABC.mjs";
2
- import { i as CliError, t as fetchCatalogVersion } from "./client-D3vmFo39.mjs";
1
+ import { U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-C356blas.mjs";
2
+ import { i as CliError, t as fetchCatalogVersion } from "./client-BCurPuLJ.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/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as errorCodeOf, C as SESSION_STATUSES, D as ticketFactsSchema, E as sessionFactsSchema, G as SLACK_BOT_SCOPES, H as RESERVED_PROJECT, L as successEnvelopeSchema, M as parseRef$1, N as taskKeySchema, O as actorIdSchema, P as ERRORS, S as SESSION_HEALTH_STATES, T as prRefSchema, U as configSchema, V as DEFAULT_SLACK_COMMAND, W as requiredSecretKeys, _ as interactionRefSchema, a as batchSchema, b as EVENT_KINDS, c as buildCatalogSnapshot, d as renderHttpProblem, g as inboundEventSchema, h as conversationRefSchema, i as AdapterError, j as parseActorId, k as encodeActorId, l as roleCanUseOperation, m as SPACE_IDS, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, u as OPERATIONS, v as messageRefSchema, w as prFactsSchema, x as eventPayloadSchemas, y as userIdSchema, z as DEFAULT_LINK } from "./src-Ron2NABC.mjs";
1
+ import { A as errorCodeOf, C as SESSION_STATUSES, D as ticketFactsSchema, E as sessionFactsSchema, G as SLACK_BOT_SCOPES, H as RESERVED_PROJECT, L as successEnvelopeSchema, M as parseRef$1, N as taskKeySchema, O as actorIdSchema, P as ERRORS, S as SESSION_HEALTH_STATES, T as prRefSchema, U as configSchema, V as DEFAULT_SLACK_COMMAND, W as requiredSecretKeys, _ as interactionRefSchema, a as batchSchema, b as EVENT_KINDS, c as buildCatalogSnapshot, d as renderHttpProblem, g as inboundEventSchema, h as conversationRefSchema, i as AdapterError, j as parseActorId, k as encodeActorId, l as roleCanUseOperation, m as SPACE_IDS, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, u as OPERATIONS, v as messageRefSchema, w as prFactsSchema, x as eventPayloadSchemas, y as userIdSchema, z as DEFAULT_LINK } from "./src-C356blas.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { closeSync, existsSync, fstatSync, fsyncSync, ftruncateSync, linkSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeSync } from "node:fs";
@@ -357,10 +357,10 @@ function answerBlock(block) {
357
357
  function closeBlock(block, input) {
358
358
  requireOpen(block);
359
359
  if (input.mode === "withdraw") {
360
- if (block.type !== "needs_input" || block.author !== input.actor) throw new BlockRuleError("forbidden", "Only the question author can withdraw it.");
360
+ if (block.type !== "needs_input" || !input.isAuthor) throw new BlockRuleError("forbidden", "Only the question author can withdraw it.");
361
361
  return {
362
362
  outcome: "withdrawn",
363
- outcomeReason: null
363
+ outcomeReason: input.reason
364
364
  };
365
365
  }
366
366
  if (input.mode === "done") {
@@ -406,6 +406,24 @@ function orchestrator$1(actor, target, config, column) {
406
406
  const parsed = parseActorId(actor);
407
407
  return parsed?.actor === "agent" && configured !== "none" && configured === parsed.actorRef.project;
408
408
  }
409
+ /** A curator or orchestrator project of the board project; `none` and `operator` name no project. */
410
+ function roleProject(name, projectId, config) {
411
+ if (name === curatorProject(config, projectId)) return true;
412
+ if (name === "none" || name === "operator") return false;
413
+ return config.projects.find((project) => project.id === projectId)?.columns.some((column) => column.orchestrator === name) === true;
414
+ }
415
+ /** A worker's identity is its session; a role's outlives the session, unless it worked the task. */
416
+ function blockAuthor(actor, target, config) {
417
+ const author = target.block?.author;
418
+ if (author === void 0 || author === "system") return false;
419
+ if (author === actor) return true;
420
+ const by = parseActorId(actor);
421
+ const of = parseActorId(author);
422
+ if (by?.actor !== "agent" || of?.actor !== "agent") return false;
423
+ if (by.actorRef.project !== of.actorRef.project) return false;
424
+ const worked = (session) => target.workers.some((link) => link.session_id === session && (link.role === "worker" || link.role === "other"));
425
+ return roleProject(by.actorRef.project, target.project, config) && !worked(by.actorRef.session) && !worked(of.actorRef.session);
426
+ }
409
427
  function matches(rule, actor, target, config) {
410
428
  const parsed = parseActorId(actor);
411
429
  switch (rule.grant) {
@@ -424,7 +442,7 @@ function matches(rule, actor, target, config) {
424
442
  default: return assertNever(addressee);
425
443
  }
426
444
  }
427
- case "block-author": return target.block?.author === actor;
445
+ case "block-author": return blockAuthor(actor, target, config);
428
446
  }
429
447
  }
430
448
  /** Evaluate catalog grants against a trusted actor and the target's current board state. */
@@ -8079,7 +8097,7 @@ function createApply(deps) {
8079
8097
  const ackIds = entry.id === "inbox.ack" && "entries" in parsed.data ? parsed.data.entries.map((item) => item.id) : void 0;
8080
8098
  const ackMismatch = ackIds !== void 0 && (resolved.length !== ackIds.length || resolved.some((target, index) => target.id !== ackIds[index]));
8081
8099
  const targets = resolved.length === 0 ? [{ kind: "missing" }] : ackMismatch ? [...resolved, { kind: "missing" }] : resolved;
8082
- const mode = "mode" in parsed.data ? String(parsed.data.mode) : void 0;
8100
+ const mode = "mode" in parsed.data ? parsed.data.mode : void 0;
8083
8101
  for (const target of targets) {
8084
8102
  const decision = authorize(entry.grants, actor, {
8085
8103
  config,
@@ -8935,9 +8953,11 @@ const tokenRevokeMutation = {
8935
8953
  //#endregion
8936
8954
  //#region ../core/src/api/identity.ts
8937
8955
  function sessionActor(project, session, config) {
8938
- if (config.projects.filter((entry) => entry.spurProjects.some((spur) => spur.name === project)).length !== 1) throw new CommandError("forbidden", "Unknown session project.");
8939
8956
  const actor = actorIdSchema.safeParse(`agent:${project}/${session}`);
8940
8957
  if (!actor.success) throw new CommandError("forbidden", "Invalid session identity.");
8958
+ const matches = config.projects.filter((entry) => entry.spurProjects.some((spur) => spur.name === project));
8959
+ if (matches.length === 0) throw new CommandError("forbidden", `Spur project "${project}" is not listed in any spurProjects in the Board's config.yaml (not Spur's spur.yaml), and inside a Spur session a token is not used. Ask the operator to add it under projects[].spurProjects there and restart the Board daemon, or run the command outside a Spur session.`);
8960
+ if (matches.length > 1) throw new CommandError("forbidden", `Spur project "${project}" is listed under several Board projects: ${matches.map((entry) => entry.id).join(", ")}. Ask the operator to keep it under one of them in the Board's config.yaml (not Spur's spur.yaml) and restart the Board daemon.`);
8941
8961
  return actor.data;
8942
8962
  }
8943
8963
  /** Resolve the caller at the HTTP boundary; a session header always outranks a token. */
@@ -9331,19 +9351,35 @@ function resolvedByProject(role) {
9331
9351
  const { kind } = parseAddressee(role);
9332
9352
  return kind === "curator" || kind === "orchestrator";
9333
9353
  }
9334
- /** Orders later times first and missing times last. */
9354
+ /**
9355
+ * Milliseconds of a stored time, or null for a missing or unreadable one. `Date.parse`, not text
9356
+ * order: ISO values with different fractions do not sort as text.
9357
+ */
9358
+ function instant(value) {
9359
+ if (typeof value !== "string") return null;
9360
+ const ms = Date.parse(value);
9361
+ return Number.isNaN(ms) ? null : ms;
9362
+ }
9363
+ /** Orders later times first and missing times last. Compared, never subtracted. */
9335
9364
  function laterFirst(left, right) {
9336
- if (left === right) return 0;
9337
- if (left === null) return 1;
9338
- if (right === null) return -1;
9339
- return right - left;
9365
+ const a = left ?? -Infinity;
9366
+ const b = right ?? -Infinity;
9367
+ return a > b ? -1 : a < b ? 1 : 0;
9340
9368
  }
9341
- /** The newest live session of a Spur project, then the most recently active, then by id. */
9369
+ /**
9370
+ * The newest live session of a Spur project, then the most recently active, then by id. A row
9371
+ * with an unreadable time or detail stays eligible and sorts last on that time.
9372
+ */
9342
9373
  async function bestProjectSession(trx, project) {
9343
9374
  if (project === null) return void 0;
9344
- const rows = await trx.selectFrom("session_snapshot").selectAll().select(sql`json_extract(detail, '$.lastActivityAt')`.as("last_activity")).where("spur_project", "=", project).where("ended_at", "is", null).where("absent_since", "is", null).where("state", "not in", FINISHED_STATES).execute();
9345
- const activity = (value) => value === null ? null : Date.parse(value);
9346
- return rows.sort((left, right) => laterFirst(Date.parse(left.first_seen), Date.parse(right.first_seen)) || laterFirst(activity(left.last_activity), activity(right.last_activity)) || (left.id < right.id ? -1 : 1))[0];
9375
+ return (await trx.selectFrom("session_snapshot").selectAll().select(sql`CASE WHEN json_valid(detail) THEN json_extract(detail, '$.lastActivityAt') END`.as("last_activity")).where("spur_project", "=", project).where("ended_at", "is", null).where("absent_since", "is", null).where("state", "not in", FINISHED_STATES).execute()).sort((left, right) => laterFirst(instant(left.first_seen), instant(right.first_seen)) || laterFirst(instant(left.last_activity), instant(right.last_activity)) || (left.id < right.id ? -1 : 1))[0];
9376
+ }
9377
+ /**
9378
+ * The live session that a curator block on a board project rings, or undefined when the project
9379
+ * has no curator or the curator has no live session. `board doctor` reports the same choice.
9380
+ */
9381
+ async function curatorSession(trx, config, projectId) {
9382
+ return bestProjectSession(trx, curatorProject(config, projectId));
9347
9383
  }
9348
9384
  /** The newest live session linked to a task in a role. */
9349
9385
  async function linkedSession(trx, taskId, role) {
@@ -9366,7 +9402,7 @@ function columnOrchestratorProject(config, projectId, column) {
9366
9402
  async function selectNotificationRecipient(trx, n, config) {
9367
9403
  const addressee = parseAddressee(n.role);
9368
9404
  switch (addressee.kind) {
9369
- case "curator": return bestProjectSession(trx, curatorProject(config, await taskProject(trx, n.task_id)));
9405
+ case "curator": return curatorSession(trx, config, await taskProject(trx, n.task_id));
9370
9406
  case "orchestrator": {
9371
9407
  const author = n.author_session === null ? void 0 : await sessionById(trx, n.author_session);
9372
9408
  if (author !== void 0 && liveInProject(author)) return author;
@@ -9789,7 +9825,14 @@ function holdsBlock(config, actor, target) {
9789
9825
  target
9790
9826
  }).status === "allowed";
9791
9827
  }
9792
- async function addComment(trx, task, block, text, ctx, addressee, config, source) {
9828
+ function wroteBlock(config, actor, target) {
9829
+ return authorize([{ grant: "block-author" }], actor, {
9830
+ config,
9831
+ target
9832
+ }).status === "allowed";
9833
+ }
9834
+ async function addComment(trx, task, block, text, ctx, addressee, config, options = {}) {
9835
+ const { source, ringsAuthor = true } = options;
9793
9836
  const row = await trx.insertInto("comment").values({
9794
9837
  task_id: task.id,
9795
9838
  block_id: block?.id ?? null,
@@ -9806,7 +9849,7 @@ async function addComment(trx, task, block, text, ctx, addressee, config, source
9806
9849
  comment: commentId(row.id),
9807
9850
  addressee
9808
9851
  });
9809
- await applyDoorbellPolicy(trx, block === void 0 ? { kind: "task_comment" } : {
9852
+ if (ringsAuthor) await applyDoorbellPolicy(trx, block === void 0 ? { kind: "task_comment" } : {
9810
9853
  kind: "answer",
9811
9854
  block,
9812
9855
  commentId: row.id,
@@ -9894,10 +9937,10 @@ async function recordInboundBlockMessage(trx, input) {
9894
9937
  });
9895
9938
  }
9896
9939
  return {
9897
- comment: await addComment(trx, task, block, input.text, ctx, authorRole(input.config, task, block.author), input.config, {
9940
+ comment: await addComment(trx, task, block, input.text, ctx, authorRole(input.config, task, block.author), input.config, { source: {
9898
9941
  conversationRef: input.conversationRef,
9899
9942
  messageRef: input.messageRef
9900
- }),
9943
+ } }),
9901
9944
  block: answered ? await closeOpenBlock(trx, task, block, ctx, "done", null) : block,
9902
9945
  task,
9903
9946
  answered,
@@ -9922,7 +9965,8 @@ async function editInboundComment(trx, input) {
9922
9965
  revision: next.revision,
9923
9966
  clarification: next.clarification
9924
9967
  });
9925
- if (next.clarification && updated.block_id !== null) {
9968
+ const answered = await trx.selectFrom("notification").select("id").where("kind", "=", "answer").where("comment_id", "=", updated.id).executeTakeFirst();
9969
+ if (next.clarification && updated.block_id !== null && answered !== void 0) {
9926
9970
  const block = await trx.selectFrom("block").selectAll().where("id", "=", updated.block_id).executeTakeFirstOrThrow();
9927
9971
  await applyDoorbellPolicy(trx, {
9928
9972
  kind: "answer",
@@ -9992,16 +10036,22 @@ function createBlockMutations(config) {
9992
10036
  active(task);
9993
10037
  const hasCurator = curatorProject(config, task.project) !== null;
9994
10038
  const next = rule(() => escalateBlock(current(block), hasCurator));
9995
- if (!next.changed) return { block: blockView(block, task) };
10039
+ const unchanged = async () => {
10040
+ if (input.note !== void 0) await addComment(trx, task, block, input.note, ctx, block.addressee_role, config, { ringsAuthor: false });
10041
+ return { block: blockView(block, task) };
10042
+ };
10043
+ if (!next.changed) return unchanged();
9996
10044
  const target = await authorizationTarget(trx, task, block);
9997
- if (!holdsBlock(config, ctx.actor, target)) return { block: blockView(block, task) };
9998
- return { block: blockView(await moveBlockToAddressee(trx, {
10045
+ if (!holdsBlock(config, ctx.actor, target)) return unchanged();
10046
+ const updated = await moveBlockToAddressee(trx, {
9999
10047
  task,
10000
10048
  block,
10001
10049
  to: next.addressee,
10002
10050
  ctx,
10003
10051
  config
10004
- }), task) };
10052
+ });
10053
+ if (input.note !== void 0) await addComment(trx, task, updated, input.note, ctx, next.addressee, config, { ringsAuthor: false });
10054
+ return { block: blockView(updated, task) };
10005
10055
  }
10006
10056
  },
10007
10057
  answer: {
@@ -10028,6 +10078,7 @@ function createBlockMutations(config) {
10028
10078
  const block = found(await blockById(trx, input.block));
10029
10079
  const task = await taskById(trx, block.task_id);
10030
10080
  active(task);
10081
+ const target = await authorizationTarget(trx, task, block);
10031
10082
  const decision = rule(() => input.mode === "done" ? closeBlock(current(block), {
10032
10083
  mode: "done",
10033
10084
  ...input.ref === void 0 ? {} : { ref: input.ref }
@@ -10036,11 +10087,12 @@ function createBlockMutations(config) {
10036
10087
  reason: input.reason
10037
10088
  }) : closeBlock(current(block), {
10038
10089
  mode: "withdraw",
10039
- actor: ctx.actor
10090
+ isAuthor: wroteBlock(config, ctx.actor, target),
10091
+ reason: input.answer
10040
10092
  }));
10041
- if (input.mode === "withdraw") await addComment(trx, task, block, input.answer, ctx, block.addressee_role, config);
10093
+ if (input.mode === "withdraw") await addComment(trx, task, block, input.answer, ctx, block.addressee_role, config, { ringsAuthor: false });
10042
10094
  const updated = await closeOpenBlock(trx, task, block, ctx, decision.outcome, decision.outcomeReason);
10043
- await applyDoorbellPolicy(trx, input.mode === "done" || holdsBlock(config, ctx.actor, await authorizationTarget(trx, task, block)) ? { kind: "block_closed_by_addressee" } : {
10095
+ await applyDoorbellPolicy(trx, input.mode === "done" || holdsBlock(config, ctx.actor, target) ? { kind: "block_closed_by_addressee" } : {
10044
10096
  kind: "block_removed",
10045
10097
  block: updated
10046
10098
  }, new Date(ctx.at));
@@ -11732,6 +11784,20 @@ async function firstPollDone(db, config, completeSince) {
11732
11784
  return [...doctorSources(config)].every((source) => blind.has(source) || completeSince.has(source));
11733
11785
  }
11734
11786
  /**
11787
+ * The curator of each board project and the live session its curator blocks ring, in config
11788
+ * order. It asks the doorbells for their choice rather than keeping a copy, so the doctor cannot
11789
+ * name one session while the rings go to another.
11790
+ */
11791
+ async function curatorSessions(db, config) {
11792
+ const entries = [];
11793
+ for (const project of config.projects) entries.push({
11794
+ project: project.id,
11795
+ curator: curatorProject(config, project.id),
11796
+ session: (await curatorSession(db, config, project.id))?.id ?? null
11797
+ });
11798
+ return entries;
11799
+ }
11800
+ /**
11735
11801
  * Called from an accepted observation's transaction after board and item reconciliation.
11736
11802
  * The version marker and feed row share that transaction with the source-state update.
11737
11803
  */
@@ -17303,6 +17369,24 @@ function linkRulesCheck(outcomes) {
17303
17369
  };
17304
17370
  return warning(id, fitFix(problems, problems.some((segment) => segment.unmatched) ? ` ${LINK_RULES_TAIL}` : "", `link rules miss recent PRs in ${String(problems.length)} projects; change projects[].link to the repo's branch and PR title rules.`));
17305
17371
  }
17372
+ const CURATOR_TAIL = "Start a Spur session of each curator with no live session.";
17373
+ function curatorSessionsCheck(entries) {
17374
+ const id = "curator.sessions";
17375
+ const segment = (text, problem) => ({
17376
+ problem,
17377
+ unmatched: false,
17378
+ text: () => text
17379
+ });
17380
+ const segments = entries.map(({ project, curator, session }) => curator === null ? segment(`${project}: no curator configured`, false) : session === null ? segment(`${project}: curator ${curator}, no live session`, true) : segment(`${project}: curator ${curator}, session ${session}`, false));
17381
+ const missing = segments.filter((entry) => entry.problem).length;
17382
+ if (missing === 0) return {
17383
+ id,
17384
+ status: "pass",
17385
+ blocking: false,
17386
+ fix: fitFix(segments, "", `Every configured curator has a live session in ${String(segments.length)} projects.`)
17387
+ };
17388
+ return warning(id, fitFix([...segments.filter((entry) => entry.problem), ...segments.filter((entry) => !entry.problem)], ` ${CURATOR_TAIL}`, `${String(missing)} curators have no live session. Start a Spur session of each.`));
17389
+ }
17306
17390
  function check(id, ok, fix) {
17307
17391
  return {
17308
17392
  id,
@@ -17447,6 +17531,7 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
17447
17531
  const operatorProject = config.projects.some((project) => project.spurProjects.some((spurProject) => spurProject.role === "operator"));
17448
17532
  const token = operatorProject ? void 0 : await ctx.store.db.selectFrom("operator_token").select("id").where("status", "=", "approved").executeTakeFirst();
17449
17533
  checks.push(check("operator.path", operatorProject || token !== void 0, "Configure a Spur project with the operator role or approve a named operator token."));
17534
+ checks.push(curatorSessionsCheck(await curatorSessions(ctx.store.db, config)));
17450
17535
  return {
17451
17536
  version: productVersion,
17452
17537
  checks
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-Ron2NABC.mjs";
2
- import { i as CliError, n as requestOperation } from "./client-D3vmFo39.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./config-CYLh25BZ.mjs";
1
+ import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-C356blas.mjs";
2
+ import { i as CliError, n as requestOperation } from "./client-BCurPuLJ.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./config-B1u34Kr8.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";
@@ -159,7 +159,7 @@ function createMcpServer(env = process.env, loadConfig = loadClientConfig) {
159
159
  ...error.context,
160
160
  ...key && ERRORS[error.code].exit === 5 ? { idempotencyKey: key } : {}
161
161
  } } : {}
162
- });
162
+ }, error.code === "forbidden" ? error.hint : void 0);
163
163
  }
164
164
  });
165
165
  return server;
@@ -205,7 +205,7 @@ const githubIssuesTracker = z.strictObject({
205
205
  });
206
206
  });
207
207
  const spurProject = z.strictObject({
208
- name: nonEmpty,
208
+ name: nonEmpty.describe("The name of the project in Spur. A Spur project can be listed under only one board project."),
209
209
  role: z.enum([
210
210
  "worker",
211
211
  "operator",
@@ -318,10 +318,31 @@ function isTimeZone(tz) {
318
318
  return false;
319
319
  }
320
320
  }
321
+ /** A session belongs to one board project, so a Spur project can be listed under only one. */
322
+ function rejectSharedSpurProjects(items, ctx) {
323
+ const owners = /* @__PURE__ */ new Map();
324
+ items.forEach((project, i) => {
325
+ project.spurProjects.forEach(({ name }, j) => {
326
+ const owner = owners.get(name);
327
+ if (owner === void 0) owners.set(name, project.id);
328
+ else if (owner !== project.id) ctx.addIssue({
329
+ code: "custom",
330
+ path: [
331
+ i,
332
+ "spurProjects",
333
+ j,
334
+ "name"
335
+ ],
336
+ message: `Spur project ${JSON.stringify(name)} is listed under board projects ${JSON.stringify(owner)} and ${JSON.stringify(project.id)}: list it under only one`
337
+ });
338
+ });
339
+ });
340
+ }
321
341
  /** The board config file. Every object rejects unknown keys; no key holds a secret. */
322
342
  const configSchema = z.strictObject({
323
343
  projects: z.array(projectSchema).min(1).superRefine((items, ctx) => {
324
344
  rejectDuplicates(items, "id", "project id", ctx);
345
+ rejectSharedSpurProjects(items, ctx);
325
346
  }),
326
347
  operator: z.strictObject({ slack: nonEmpty }),
327
348
  slack: z.strictObject({
@@ -1415,8 +1436,13 @@ function renderHttpProblem(input) {
1415
1436
  }
1416
1437
  };
1417
1438
  }
1418
- function renderMcpError(input) {
1419
- const content = fields(input, "mcp");
1439
+ /** `hint` replaces the catalog hint for one call; `errorInputSchema` stays hint-free. */
1440
+ function renderMcpError(input, hint) {
1441
+ const rendered = fields(input, "mcp");
1442
+ const content = hint === void 0 ? rendered : {
1443
+ ...rendered,
1444
+ hint
1445
+ };
1420
1446
  return {
1421
1447
  isError: true,
1422
1448
  content: [{
@@ -2473,7 +2499,10 @@ const OPERATIONS = [
2473
2499
  whenToUse: "Escalate an open block.",
2474
2500
  whenNotToUse: "Use block_answer to answer a question."
2475
2501
  },
2476
- input: z.strictObject({ block: blockIdSchema }),
2502
+ input: z.strictObject({
2503
+ block: blockIdSchema,
2504
+ note: z.string().min(1).optional().describe("Context for the next addressee, posted after the original text.")
2505
+ }),
2477
2506
  output: blockOutput,
2478
2507
  grants: [{ grant: "block-addressee" }],
2479
2508
  errors: [
@@ -2494,6 +2523,16 @@ const OPERATIONS = [
2494
2523
  ...codeBlock,
2495
2524
  addressee: "operator"
2496
2525
  } }
2526
+ }, {
2527
+ summary: "Escalate a question with a note",
2528
+ input: {
2529
+ block: "B12",
2530
+ note: "The API owner is away until Monday."
2531
+ },
2532
+ output: { block: {
2533
+ ...question,
2534
+ addressee: "operator"
2535
+ } }
2497
2536
  }]
2498
2537
  }),
2499
2538
  defineOperation({
@@ -2566,7 +2605,7 @@ const OPERATIONS = [
2566
2605
  z.strictObject({
2567
2606
  mode: z.literal("withdraw").describe("The author takes their own question back (needs_input only)."),
2568
2607
  block: blockIdSchema,
2569
- answer: text("Answer received outside the board.")
2608
+ answer: text("Why it is withdrawn, e.g. the answer received outside the board.")
2570
2609
  }).describe("Withdraw the block.")
2571
2610
  ]),
2572
2611
  output: blockOutput,
@@ -2667,6 +2706,7 @@ const OPERATIONS = [
2667
2706
  ...question,
2668
2707
  state: "unblocked",
2669
2708
  outcome: "withdrawn",
2709
+ outcomeReason: "Answered outside the board.",
2670
2710
  unblockedBy: "agent:web/web-7",
2671
2711
  unblockedAt: at
2672
2712
  } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.25.0",
3
+ "version": "0.27.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -125,7 +125,7 @@ Other errors: `wrong_id_kind`, `not_found`, `task_archived`, `idempotency_key_mi
125
125
 
126
126
  Purpose: Pass a block on to the next addressee up the chain.
127
127
  Arguments: `<block>`.
128
- Flags: `--key <key>`, `--json`.
128
+ Flags: `--note <value>`, `--key <key>`, `--json`.
129
129
  Use when: Escalate an open block.
130
130
  Avoid when: Use `board answer <block> <text>` to answer a question.
131
131
  Example: `board escalate B13 --key escalate-PROJ-123-failing-build-1432` — Escalate a failing build to the operator.