spur-board 0.26.0 → 0.28.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-7fzumMWU.mjs";
2
- import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-DEwzucXx.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-B8ZBFd_9.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-29M9Njzi.mjs";
2
+ import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-vurSc69V.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-BGn6LSvV.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";
@@ -1,4 +1,4 @@
1
- import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-7fzumMWU.mjs";
1
+ import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-29M9Njzi.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-DEwzucXx.mjs";
1
+ import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-vurSc69V.mjs";
2
2
  export { fetchCatalogVersion, requestOperation, requestTokenEnrollment };
@@ -1,5 +1,5 @@
1
- import { U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-7fzumMWU.mjs";
2
- import { i as CliError, t as fetchCatalogVersion } from "./client-DEwzucXx.mjs";
1
+ import { U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-29M9Njzi.mjs";
2
+ import { i as CliError, t as fetchCatalogVersion } from "./client-vurSc69V.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-7fzumMWU.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-29M9Njzi.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,
@@ -9807,7 +9825,14 @@ function holdsBlock(config, actor, target) {
9807
9825
  target
9808
9826
  }).status === "allowed";
9809
9827
  }
9810
- 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;
9811
9836
  const row = await trx.insertInto("comment").values({
9812
9837
  task_id: task.id,
9813
9838
  block_id: block?.id ?? null,
@@ -9824,7 +9849,7 @@ async function addComment(trx, task, block, text, ctx, addressee, config, source
9824
9849
  comment: commentId(row.id),
9825
9850
  addressee
9826
9851
  });
9827
- await applyDoorbellPolicy(trx, block === void 0 ? { kind: "task_comment" } : {
9852
+ if (ringsAuthor) await applyDoorbellPolicy(trx, block === void 0 ? { kind: "task_comment" } : {
9828
9853
  kind: "answer",
9829
9854
  block,
9830
9855
  commentId: row.id,
@@ -9912,10 +9937,10 @@ async function recordInboundBlockMessage(trx, input) {
9912
9937
  });
9913
9938
  }
9914
9939
  return {
9915
- 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: {
9916
9941
  conversationRef: input.conversationRef,
9917
9942
  messageRef: input.messageRef
9918
- }),
9943
+ } }),
9919
9944
  block: answered ? await closeOpenBlock(trx, task, block, ctx, "done", null) : block,
9920
9945
  task,
9921
9946
  answered,
@@ -9940,7 +9965,8 @@ async function editInboundComment(trx, input) {
9940
9965
  revision: next.revision,
9941
9966
  clarification: next.clarification
9942
9967
  });
9943
- 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) {
9944
9970
  const block = await trx.selectFrom("block").selectAll().where("id", "=", updated.block_id).executeTakeFirstOrThrow();
9945
9971
  await applyDoorbellPolicy(trx, {
9946
9972
  kind: "answer",
@@ -10010,16 +10036,22 @@ function createBlockMutations(config) {
10010
10036
  active(task);
10011
10037
  const hasCurator = curatorProject(config, task.project) !== null;
10012
10038
  const next = rule(() => escalateBlock(current(block), hasCurator));
10013
- 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();
10014
10044
  const target = await authorizationTarget(trx, task, block);
10015
- if (!holdsBlock(config, ctx.actor, target)) return { block: blockView(block, task) };
10016
- return { block: blockView(await moveBlockToAddressee(trx, {
10045
+ if (!holdsBlock(config, ctx.actor, target)) return unchanged();
10046
+ const updated = await moveBlockToAddressee(trx, {
10017
10047
  task,
10018
10048
  block,
10019
10049
  to: next.addressee,
10020
10050
  ctx,
10021
10051
  config
10022
- }), 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) };
10023
10055
  }
10024
10056
  },
10025
10057
  answer: {
@@ -10046,6 +10078,7 @@ function createBlockMutations(config) {
10046
10078
  const block = found(await blockById(trx, input.block));
10047
10079
  const task = await taskById(trx, block.task_id);
10048
10080
  active(task);
10081
+ const target = await authorizationTarget(trx, task, block);
10049
10082
  const decision = rule(() => input.mode === "done" ? closeBlock(current(block), {
10050
10083
  mode: "done",
10051
10084
  ...input.ref === void 0 ? {} : { ref: input.ref }
@@ -10054,11 +10087,12 @@ function createBlockMutations(config) {
10054
10087
  reason: input.reason
10055
10088
  }) : closeBlock(current(block), {
10056
10089
  mode: "withdraw",
10057
- actor: ctx.actor
10090
+ isAuthor: wroteBlock(config, ctx.actor, target),
10091
+ reason: input.answer
10058
10092
  }));
10059
- 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 });
10060
10094
  const updated = await closeOpenBlock(trx, task, block, ctx, decision.outcome, decision.outcomeReason);
10061
- 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" } : {
10062
10096
  kind: "block_removed",
10063
10097
  block: updated
10064
10098
  }, new Date(ctx.at));
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-7fzumMWU.mjs";
2
- import { i as CliError, n as requestOperation } from "./client-DEwzucXx.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./config-B8ZBFd_9.mjs";
1
+ import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-29M9Njzi.mjs";
2
+ import { i as CliError, n as requestOperation } from "./client-vurSc69V.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./config-BGn6LSvV.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";
@@ -25,6 +25,16 @@ const COLUMNS = [
25
25
  name: "Review",
26
26
  required: false
27
27
  },
28
+ {
29
+ id: "product-review",
30
+ name: "Product Review",
31
+ required: false
32
+ },
33
+ {
34
+ id: "external-review",
35
+ name: "External Review",
36
+ required: false
37
+ },
28
38
  {
29
39
  id: "qa",
30
40
  name: "QA",
@@ -2499,7 +2509,10 @@ const OPERATIONS = [
2499
2509
  whenToUse: "Escalate an open block.",
2500
2510
  whenNotToUse: "Use block_answer to answer a question."
2501
2511
  },
2502
- input: z.strictObject({ block: blockIdSchema }),
2512
+ input: z.strictObject({
2513
+ block: blockIdSchema,
2514
+ note: z.string().min(1).optional().describe("Context for the next addressee, posted after the original text.")
2515
+ }),
2503
2516
  output: blockOutput,
2504
2517
  grants: [{ grant: "block-addressee" }],
2505
2518
  errors: [
@@ -2520,6 +2533,16 @@ const OPERATIONS = [
2520
2533
  ...codeBlock,
2521
2534
  addressee: "operator"
2522
2535
  } }
2536
+ }, {
2537
+ summary: "Escalate a question with a note",
2538
+ input: {
2539
+ block: "B12",
2540
+ note: "The API owner is away until Monday."
2541
+ },
2542
+ output: { block: {
2543
+ ...question,
2544
+ addressee: "operator"
2545
+ } }
2523
2546
  }]
2524
2547
  }),
2525
2548
  defineOperation({
@@ -2592,7 +2615,7 @@ const OPERATIONS = [
2592
2615
  z.strictObject({
2593
2616
  mode: z.literal("withdraw").describe("The author takes their own question back (needs_input only)."),
2594
2617
  block: blockIdSchema,
2595
- answer: text("Answer received outside the board.")
2618
+ answer: text("Why it is withdrawn, e.g. the answer received outside the board.")
2596
2619
  }).describe("Withdraw the block.")
2597
2620
  ]),
2598
2621
  output: blockOutput,
@@ -2693,6 +2716,7 @@ const OPERATIONS = [
2693
2716
  ...question,
2694
2717
  state: "unblocked",
2695
2718
  outcome: "withdrawn",
2719
+ outcomeReason: "Answered outside the board.",
2696
2720
  unblockedBy: "agent:web/web-7",
2697
2721
  unblockedAt: at
2698
2722
  } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.26.0",
3
+ "version": "0.28.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.