spur-board 0.30.0 → 0.31.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.
Files changed (2) hide show
  1. package/dist/daemon.mjs +55 -2
  2. package/package.json +1 -1
package/dist/daemon.mjs CHANGED
@@ -8571,6 +8571,36 @@ async function enqueueLiveFeedLine(trx, input) {
8571
8571
  at: input.at
8572
8572
  })).id;
8573
8573
  }
8574
+ const QUESTION_CHARS = 120;
8575
+ const ANSWER_CHARS = 200;
8576
+ /** Collapses whitespace and cuts by code points to `limit`, ending a cut text with `…`. */
8577
+ function shorten(text, limit) {
8578
+ const points = Array.from(text.replace(/\s+/g, " ").trim());
8579
+ return points.length <= limit ? points.join("") : `${points.slice(0, limit - 1).join("")}…`;
8580
+ }
8581
+ /** One line per curator answer; the key names the answer comment, so a retry adds none. */
8582
+ async function enqueueCuratorAnswerLine(trx, input) {
8583
+ const block = `B${String(input.blockId)}`;
8584
+ const itemKey = `curator-answer:comment:${String(input.commentId)}`;
8585
+ await insertOutbox(trx, {
8586
+ kind: "feed.line",
8587
+ dedupeKey: `feed.line:${itemKey}`,
8588
+ payload: {
8589
+ key: input.key,
8590
+ text: `${block} · ${input.asker} asked: ${shorten(input.question, QUESTION_CHARS)} → curator answered: ${shorten(input.answer, ANSWER_CHARS)}`,
8591
+ title: `${input.key} ${block} answered by curator`,
8592
+ persona: {
8593
+ name: input.curator,
8594
+ role: "curator"
8595
+ },
8596
+ itemKey,
8597
+ taskId: input.taskId,
8598
+ ...input.url === "" ? {} : { url: input.url }
8599
+ },
8600
+ parent: null,
8601
+ at: input.at
8602
+ });
8603
+ }
8574
8604
  async function enqueueFeedEdit(trx, input) {
8575
8605
  return (await insertOutbox(trx, {
8576
8606
  kind: "feed.line.edit",
@@ -9284,7 +9314,7 @@ function personaRole(role) {
9284
9314
  switch (addressee.kind) {
9285
9315
  case "operator": return "board";
9286
9316
  case "worker": return "worker";
9287
- case "curator":
9317
+ case "curator": return "curator";
9288
9318
  case "orchestrator": return "orchestrator";
9289
9319
  default: return assertNever(addressee);
9290
9320
  }
@@ -10085,6 +10115,27 @@ async function editInboundComment(trx, input) {
10085
10115
  }
10086
10116
  return updated;
10087
10117
  }
10118
+ /** Posts a curator's answer to the feed; an operator answer is already on the board. */
10119
+ async function queueCuratorAnswerLine(trx, task, block, answer, ctx, config) {
10120
+ if (parseAddressee(block.addressee_role).kind !== "curator") return;
10121
+ if (authorRole(config, task, ctx.actor) === "operator") return;
10122
+ const curator = parseActorId(ctx.actor);
10123
+ if (curator?.actor !== "agent") return;
10124
+ const asker = parseActorId(block.author);
10125
+ const question = await trx.selectFrom("comment").select("text").where("block_id", "=", block.id).where("id", "<", answer.id).orderBy("id").executeTakeFirst();
10126
+ await enqueueCuratorAnswerLine(trx, {
10127
+ taskId: task.id,
10128
+ key: task.key,
10129
+ url: taskUrl(task, config),
10130
+ blockId: block.id,
10131
+ commentId: answer.id,
10132
+ asker: asker?.actor === "agent" ? `${asker.actorRef.project}/${asker.actorRef.session}` : block.author,
10133
+ question: question?.text ?? block.reason,
10134
+ answer: answer.text,
10135
+ curator: curator.actorRef.project,
10136
+ at: new Date(ctx.at)
10137
+ });
10138
+ }
10088
10139
  /** Concrete block and comment mutations for the generic apply boundary. */
10089
10140
  function createBlockMutations(config) {
10090
10141
  return {
@@ -10171,8 +10222,10 @@ function createBlockMutations(config) {
10171
10222
  answerBlock(current(block));
10172
10223
  });
10173
10224
  const comment = await addComment(trx, task, block, input.text, ctx, authorRole(config, task, block.author), config);
10225
+ const updated = await closeOpenBlock(trx, task, block, ctx, "done", null);
10226
+ await queueCuratorAnswerLine(trx, task, block, comment, ctx, config);
10174
10227
  return {
10175
- block: blockView(await closeOpenBlock(trx, task, block, ctx, "done", null), task),
10228
+ block: blockView(updated, task),
10176
10229
  comment: commentView(comment, task)
10177
10230
  };
10178
10231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"