spur-board 0.162.0 → 0.163.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.
@@ -1,4 +1,4 @@
1
- import { d as tokenRequestStatusSchema, gt as errorEnvelopeSchema, ht as errorContextSchema, l as tokenRequestResultSchema, pt as ERRORS, vt as successEnvelopeSchema, x as renderJsonError } from "./chunk-Bc7i_dwR.mjs";
1
+ import { d as tokenRequestStatusSchema, gt as errorEnvelopeSchema, ht as errorContextSchema, l as tokenRequestResultSchema, pt as ERRORS, vt as successEnvelopeSchema, x as renderJsonError } from "./chunk-D4SFZF-6.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 { Mt as plainHttpAllowed, g as OPERATIONS, kt as configSchema, m as buildCatalogSnapshot } from "./chunk-Bc7i_dwR.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-BFzKesDt.mjs";
1
+ import { Mt as plainHttpAllowed, g as OPERATIONS, kt as configSchema, m as buildCatalogSnapshot } from "./chunk-D4SFZF-6.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-BMb9UmCB.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";
@@ -4639,9 +4639,9 @@ const OPERATIONS = [
4639
4639
  defineOperation({
4640
4640
  id: "inbox.ack",
4641
4641
  kind: "mutation",
4642
- description: "Mark comments, agent-addressed blocks, turns or doorbell rings as read; acking a turn makes the caller its taker.",
4642
+ description: "Mark comments, blocks addressed to the caller, turns or doorbell rings as read; acking a turn makes the caller its taker.",
4643
4643
  mcp: {
4644
- whenToUse: "Mark handled inbox items or a ring ID like N18-1 read; an item handled before comes back under alreadyHandled. The operator acks a turn ID to take a turn addressed to the operator, or to take over an open orchestrator turn, taken or not.",
4644
+ whenToUse: "Mark handled inbox items or a ring ID like N18-1 read; an item handled before comes back under alreadyHandled. The operator acks a turn ID, with or without Slack, to take a turn addressed to the operator or to take over an open orchestrator turn, taken or not. Without Slack and with an operator Spur project, it also acks a block ID addressed to the operator, whether or not its ring was sent yet.",
4645
4645
  whenNotToUse: "Use inbox_get to inspect them first; the operator finds the turns addressed to it with inbox_operator."
4646
4646
  },
4647
4647
  input: inboxAckInputSchema,
@@ -4668,7 +4668,7 @@ const OPERATIONS = [
4668
4668
  output: { acked: ["C3"] }
4669
4669
  },
4670
4670
  {
4671
- summary: "Acknowledge an agent-addressed block",
4671
+ summary: "Acknowledge a block addressed to the caller",
4672
4672
  input: { entries: [{ id: "B13" }] },
4673
4673
  output: { acked: ["B13"] }
4674
4674
  },
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { Ct as DEFAULT_STAND_PORT_RANGE, Ft as resolveWebOrigin, It as slackConfigured, Pt as requiredSecretKeys, Ut as SLACK_BOT_SCOPES, c as requestHashOf, ct as actorIdSchema, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, kt as configSchema, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, pt as ERRORS, r as SLACK_PARTLY_FIX, vt as successEnvelopeSchema } from "./chunk-Bc7i_dwR.mjs";
1
+ import { Ct as DEFAULT_STAND_PORT_RANGE, Ft as resolveWebOrigin, It as slackConfigured, Pt as requiredSecretKeys, Ut as SLACK_BOT_SCOPES, c as requestHashOf, ct as actorIdSchema, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, kt as configSchema, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, pt as ERRORS, r as SLACK_PARTLY_FIX, vt as successEnvelopeSchema } from "./chunk-D4SFZF-6.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-BFzKesDt.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-ChF7zDxN.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-BMb9UmCB.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-BWHlpLkT.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-BFzKesDt.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-BMb9UmCB.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as prApprovalPairSchema, A as skillReloadFilesSchema, At as defaultAddressee, B as entityRefSchema, Bt as COLUMN_IDS, C as SPACE_IDS, D as messageRefSchema, Dt as columnTurnTimings, E as interactionRefSchema, Et as boardWideSpurProject, F as AdapterError, Ft as resolveWebOrigin, G as trackerSourceId, Gt as TODO_GROUP_COLUMN_IDS, H as prSourceId, Ht as ITEM_KINDS, I as MIRROR_FAILURES, It as slackConfigured, J as REVIEW_STATES, K as PR_STATES, Kt as VIAS, L as MIRROR_FAILURE_CODES, Lt as BLOCK_TYPES, M as EVENT_KINDS, Mt as plainHttpAllowed, N as GATE_REASONS, Nt as readyMirrorOf, O as userIdSchema, Ot as configBindings, P as eventPayloadSchemas, Pt as requiredSecretKeys, Q as parseRingMarker, R as batchSchema, Rt as COLUMNS, St as DEFAULT_SLACK_COMMAND, T as inboundEventSchema, Tt as approvalRuleOf, U as sessionTransitionSchema, Ut as SLACK_BOT_SCOPES, V as mirrorSourceId, Vt as DISPATCHER_MODES, W as sourceCursorSchema, Wt as TASK_HOLDS, X as SESSION_STATUSES, Y as SESSION_HEALTH_STATES, Z as isExternalAuthor, _ as defaultBranchViewSchema, _t as ok, a as doctorReportSchema, at as ticketFactsSchema, b as renderHttpProblem, bt as DEFAULT_LINK, c as requestHashOf, ct as actorIdSchema, d as tokenRequestStatusSchema, dt as parseActorId, et as prFactsSchema, f as BOARD_TICK_MS, ft as parseRef$1, g as OPERATIONS, h as roleCanUseOperation, i as SPUR_MIN_VERSION, it as sessionFactsSchema, j as sortSkillFiles, jt as externalQuietAfterMs, kt as configSchema, l as tokenRequestResultSchema, lt as encodeActorId, m as buildCatalogSnapshot, mt as err, n as SLACK_OFF_FIX, nt as prReviewRuleSchema, ot as JIRA_PROJECT_KEY, pt as ERRORS, q as REVIEW_DECISIONS, qt as isTodoGroupColumn, r as SLACK_PARTLY_FIX, rt as ringMarker, s as TOKEN_REQUEST_LIMITS, st as REF_NUMBER, t as assertNever, tt as prRefSchema, u as tokenRequestSchema, ut as errorCodeOf, v as inboxNoSessionSchema, vt as successEnvelopeSchema, w as conversationRefSchema, wt as RESERVED_PROJECT, y as turnHandedSchema, z as defaultBranchFactSchema, zt as COLUMN_GROUPS } from "./chunk-Bc7i_dwR.mjs";
1
+ import { $ as prApprovalPairSchema, A as skillReloadFilesSchema, At as defaultAddressee, B as entityRefSchema, Bt as COLUMN_IDS, C as SPACE_IDS, D as messageRefSchema, Dt as columnTurnTimings, E as interactionRefSchema, Et as boardWideSpurProject, F as AdapterError, Ft as resolveWebOrigin, G as trackerSourceId, Gt as TODO_GROUP_COLUMN_IDS, H as prSourceId, Ht as ITEM_KINDS, I as MIRROR_FAILURES, It as slackConfigured, J as REVIEW_STATES, K as PR_STATES, Kt as VIAS, L as MIRROR_FAILURE_CODES, Lt as BLOCK_TYPES, M as EVENT_KINDS, Mt as plainHttpAllowed, N as GATE_REASONS, Nt as readyMirrorOf, O as userIdSchema, Ot as configBindings, P as eventPayloadSchemas, Pt as requiredSecretKeys, Q as parseRingMarker, R as batchSchema, Rt as COLUMNS, St as DEFAULT_SLACK_COMMAND, T as inboundEventSchema, Tt as approvalRuleOf, U as sessionTransitionSchema, Ut as SLACK_BOT_SCOPES, V as mirrorSourceId, Vt as DISPATCHER_MODES, W as sourceCursorSchema, Wt as TASK_HOLDS, X as SESSION_STATUSES, Y as SESSION_HEALTH_STATES, Z as isExternalAuthor, _ as defaultBranchViewSchema, _t as ok, a as doctorReportSchema, at as ticketFactsSchema, b as renderHttpProblem, bt as DEFAULT_LINK, c as requestHashOf, ct as actorIdSchema, d as tokenRequestStatusSchema, dt as parseActorId, et as prFactsSchema, f as BOARD_TICK_MS, ft as parseRef$1, g as OPERATIONS, h as roleCanUseOperation, i as SPUR_MIN_VERSION, it as sessionFactsSchema, j as sortSkillFiles, jt as externalQuietAfterMs, kt as configSchema, l as tokenRequestResultSchema, lt as encodeActorId, m as buildCatalogSnapshot, mt as err, n as SLACK_OFF_FIX, nt as prReviewRuleSchema, ot as JIRA_PROJECT_KEY, pt as ERRORS, q as REVIEW_DECISIONS, qt as isTodoGroupColumn, r as SLACK_PARTLY_FIX, rt as ringMarker, s as TOKEN_REQUEST_LIMITS, st as REF_NUMBER, t as assertNever, tt as prRefSchema, u as tokenRequestSchema, ut as errorCodeOf, v as inboxNoSessionSchema, vt as successEnvelopeSchema, w as conversationRefSchema, wt as RESERVED_PROJECT, y as turnHandedSchema, z as defaultBranchFactSchema, zt as COLUMN_GROUPS } from "./chunk-D4SFZF-6.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";
@@ -8510,7 +8510,10 @@ function emptyAllowed(entry) {
8510
8510
  return true;
8511
8511
  }
8512
8512
  function operatorAckRefused(entry, actor, target) {
8513
- return entry.id === "inbox.ack" && actor === "operator" && target.kind === "found" && target.id?.startsWith("T") !== true;
8513
+ if (entry.id !== "inbox.ack" || actor !== "operator" || target.kind !== "found") return false;
8514
+ if (target.id?.startsWith("T") === true) return false;
8515
+ const block = target.value.block;
8516
+ return !(target.id?.startsWith("B") === true && block?.addressee_role === "operator" && (block.addressee_spur_project ?? null) === null);
8514
8517
  }
8515
8518
  /** Parse, replay, authorize, then apply one catalog mutation in one transaction. */
8516
8519
  function createApply(deps) {
@@ -8553,7 +8556,7 @@ function createApply(deps) {
8553
8556
  for (const target of targets) {
8554
8557
  const decision = operatorAckRefused(entry, actor, target) ? {
8555
8558
  status: "denied",
8556
- hint: "The operator token acks only turns: board inbox ack T<number>."
8559
+ hint: "The operator token acks turns (board inbox ack T<number>) and, without Slack, blocks addressed to the operator (B<number>)."
8557
8560
  } : authorize(entry.grants, actor, {
8558
8561
  config,
8559
8562
  target,
@@ -10120,11 +10123,11 @@ async function journal$2(trx, notification, kind, payload, at) {
10120
10123
  async function applyDoorbellPolicy(trx, event, at) {
10121
10124
  switch (event.kind) {
10122
10125
  case "block_opened":
10123
- if (!(parseActorId(event.block.author)?.actor === "agent" && event.block.addressee_role === event.authorRole)) await registerBlockNotification(trx, event.block, at);
10126
+ if (!(event.block.addressee_role === event.authorRole && (event.authorRole === "operator" || parseActorId(event.block.author)?.actor === "agent"))) await registerBlockNotification(trx, event.block, at, event.config);
10124
10127
  return;
10125
10128
  case "block_escalated":
10126
10129
  await closeBlockNotification(trx, event.block.id, at, "system");
10127
- await registerBlockNotification(trx, event.block, at);
10130
+ await registerBlockNotification(trx, event.block, at, event.config);
10128
10131
  return;
10129
10132
  case "answer":
10130
10133
  await registerAnswerNotification(trx, event, at);
@@ -10140,9 +10143,12 @@ async function applyDoorbellPolicy(trx, event, at) {
10140
10143
  default: assertNever(event);
10141
10144
  }
10142
10145
  }
10143
- /** Register a block for its agent addressee; the Slack thread carries an operator's. */
10144
- async function registerBlockNotification(trx, block, at) {
10145
- if (block.addressee_role === "operator") return;
10146
+ /**
10147
+ * Register a block for its addressee. With Slack the thread carries an operator's block; without
10148
+ * it the operator Spur project's session is rung (`ringsOperatorSession`).
10149
+ */
10150
+ async function registerBlockNotification(trx, block, at, config) {
10151
+ if (block.addressee_role === "operator" && !ringsOperatorSession(config, (await blockSubject(trx, block)).project)) return;
10146
10152
  await trx.insertInto("notification").values({
10147
10153
  source_key: `block:${String(block.id)}:${block.addressee_role}`,
10148
10154
  kind: "block",
@@ -10161,12 +10167,16 @@ async function registerBlockNotification(trx, block, at) {
10161
10167
  }).onConflict((oc) => oc.column("source_key").doNothing()).execute();
10162
10168
  }
10163
10169
  /**
10164
- * Register an agent executor's turn. Core opens a turn, so no session authored it: the worker
10165
- * or column orchestrator the board selects is rung. A turn opened by the operation of the
10166
- * session it would ring first rings only after `doorbells.firstRetryMs`, so an ack in that time
10167
- * sends nothing.
10170
+ * Register a turn's ring. Core opens a turn, so no session authored it: the worker, column
10171
+ * orchestrator or, without Slack, operator session the board selects is rung; with Slack an
10172
+ * operator turn gets no row. A turn opened by the operation of the session it would ring first
10173
+ * rings only after `doorbells.firstRetryMs`, so an ack in that time sends nothing.
10168
10174
  */
10169
10175
  async function registerTurnNotification(trx, turn, at, opts) {
10176
+ if (turn.role === "operator" && !ringsOperatorSession(opts.config, (await rowSubject(trx, {
10177
+ task_id: turn.task_id,
10178
+ block_id: null
10179
+ })).project)) return;
10170
10180
  const nextAt = await heldForOpener(trx, turn, opts) ? new Date(at.getTime() + opts.config.doorbells.firstRetryMs) : at;
10171
10181
  await trx.insertInto("notification").values({
10172
10182
  source_key: `turn:${String(turn.id)}:${turn.role}`,
@@ -10411,7 +10421,8 @@ async function moveBlockToAddressee(trx, input) {
10411
10421
  }, ctx.actor);
10412
10422
  await applyDoorbellPolicy(trx, {
10413
10423
  kind: "block_escalated",
10414
- block: updated
10424
+ block: updated,
10425
+ config
10415
10426
  }, new Date(ctx.at));
10416
10427
  await queueBlockOpen(trx, taskSubject(task), updated, ctx, config);
10417
10428
  return updated;
@@ -10507,6 +10518,21 @@ function columnOrchestratorProject(config, projectId, column) {
10507
10518
  return name === void 0 || name === "none" || name === "operator" ? null : name;
10508
10519
  }
10509
10520
  /**
10521
+ * The Spur project acting as operator on a board project: its own, else the board-wide one, else
10522
+ * null.
10523
+ */
10524
+ function operatorSpurProject(config, projectId) {
10525
+ return (config.projects.find((project) => project.id === projectId)?.spurProjects.find((spur) => spur.role === "operator"))?.name ?? config.spurProjects.find((spur) => spur.role === "operator")?.name ?? null;
10526
+ }
10527
+ /** Whether a block or turn to the operator rings a Spur session: no Slack, and an operator project. */
10528
+ function ringsOperatorSession(config, projectId) {
10529
+ return !slackConfigured(config) && operatorSpurProject(config, projectId) !== null;
10530
+ }
10531
+ /** Whether a notification is a block or turn ring to the operator's Spur session. */
10532
+ function operatorRing(n) {
10533
+ return n.role === "operator" && (n.kind === "block" || n.kind === "turn");
10534
+ }
10535
+ /**
10510
10536
  * Select the current live recipient for a semantic notification. A turn reminder reaches only
10511
10537
  * the session it names, while that session lives.
10512
10538
  */
@@ -10524,6 +10550,7 @@ async function selectNotificationRecipient(trx, n, config) {
10524
10550
  }
10525
10551
  case "worker":
10526
10552
  case "operator": {
10553
+ if (addressee.kind === "operator" && (n.kind === "block" || n.kind === "turn")) return bestProjectSession(trx, operatorSpurProject(config, await noticeProject(trx, n)));
10527
10554
  const author = n.author_session === null ? void 0 : await liveSession(trx, n.author_session);
10528
10555
  if (author !== void 0 || addressee.kind === "operator") return author;
10529
10556
  return linkedSession(trx, n.task_id, "worker");
@@ -10573,7 +10600,7 @@ async function endNotification(trx, n, subject, end) {
10573
10600
  },
10574
10601
  config
10575
10602
  });
10576
- else if (n.kind !== "removed" && n.kind !== "turn_reminder" && session !== null) {
10603
+ else if (n.kind !== "removed" && n.kind !== "turn_reminder" && !operatorRing(n) && session !== null) {
10577
10604
  const blockRef = noticeRef(n, subject);
10578
10605
  const answer = `Answer to ${blockRef} was not`;
10579
10606
  const holder = `${addressee.kind} ${session}`;
@@ -10647,7 +10674,8 @@ async function noRecipientEnd(trx, n) {
10647
10674
  */
10648
10675
  async function ringText(trx, n, { key }, ring) {
10649
10676
  const suffix = ringMarker(n.id, ring);
10650
- if (n.kind === "turn") return `${key} turn T${String(n.turn_id)}: check board inbox ${suffix}`;
10677
+ const inbox = operatorRing(n) ? "board inbox operator" : "board inbox";
10678
+ if (n.kind === "turn") return `${key} turn T${String(n.turn_id)}: check ${inbox} ${suffix}`;
10651
10679
  if (n.kind === "turn_reminder" && n.turn_id !== null && isTurnWakeKey(n.source_key)) {
10652
10680
  const reason = ((await trx.selectFrom("turn").select("wait_reason").where("id", "=", n.turn_id).executeTakeFirst())?.wait_reason ?? "").replace(/\s+/g, " ").trim();
10653
10681
  const by = n.source_key.includes(":ended:") ? " by the operator" : "";
@@ -10655,7 +10683,7 @@ async function ringText(trx, n, { key }, ring) {
10655
10683
  }
10656
10684
  if (n.kind === "turn_reminder") return `${key} turn T${String(n.turn_id)} is still open: check board inbox ${suffix}`;
10657
10685
  const blockId = noticeBlockId(n);
10658
- if (n.kind !== "removed") return `${key} block B${String(blockId)}: check board inbox ${suffix}`;
10686
+ if (n.kind !== "removed") return `${key} block B${String(blockId)}: check ${inbox} ${suffix}`;
10659
10687
  const block = await trx.selectFrom("block").select("unblocked_by").where("id", "=", blockId).executeTakeFirstOrThrow();
10660
10688
  return `${key} block B${String(blockId)} was removed by ${block.unblocked_by ?? "system"}; see board task ${key} ${suffix}`;
10661
10689
  }
@@ -10680,7 +10708,7 @@ async function reconcileDoorbells(trx, at, config) {
10680
10708
  const due = await dueNotifications(trx, at).selectAll("notification").orderBy("notification.id").execute();
10681
10709
  for (const n of due) {
10682
10710
  const session = await selectNotificationRecipient(trx, n, config);
10683
- const keepsRings = resolvedByProject(n.role) || await conversationTarget(trx, n) !== null;
10711
+ const keepsRings = resolvedByProject(n.role) || operatorRing(n) || await conversationTarget(trx, n) !== null;
10684
10712
  if (session === void 0) {
10685
10713
  const reason = await noRecipientEnd(trx, n);
10686
10714
  if (reason !== null) await endNotification(trx, n, await rowSubject(trx, n), {
@@ -10865,6 +10893,7 @@ async function acknowledgeNotification(trx, input) {
10865
10893
  }
10866
10894
  /** Decides who may list and acknowledge an inbox notice, by the role it is addressed to. */
10867
10895
  async function notificationAddressedTo(trx, n, actor, config) {
10896
+ if (operatorRing(n)) return isOperator(actor, config, await noticeProject(trx, n));
10868
10897
  const parsed = parseActorId(actor);
10869
10898
  if (parsed?.actor !== "agent") return false;
10870
10899
  const { project, session } = parsed.actorRef;
@@ -12541,14 +12570,15 @@ const taskProject = async (trx, id) => (await trx.selectFrom("task").select("pro
12541
12570
  function turnHanded(turn) {
12542
12571
  return parseJson(handedSchema, turn.handed);
12543
12572
  }
12544
- /** The newest notification of a turn; an operator turn has none. */
12573
+ /** The newest notification of a turn; an operator turn has one only without Slack. */
12545
12574
  async function turnNotification(trx, turnId) {
12546
12575
  return trx.selectFrom("notification").selectAll().where("turn_id", "=", turnId).where("kind", "=", "turn").orderBy("id", "desc").executeTakeFirst();
12547
12576
  }
12548
12577
  /**
12549
12578
  * Opens a turn for the executor of the task's current column. The unclosed turn of the same
12550
12579
  * visit is returned unchanged; an unclosed turn of an earlier visit is closed as moved first.
12551
- * An agent executor gets a ringing notification, the operator one `turn` item.
12580
+ * An agent executor gets a ringing notification, the operator one `turn` item and, without
12581
+ * Slack, a ring to its Spur session.
12552
12582
  */
12553
12583
  async function openTurn(trx, input) {
12554
12584
  const { task, reason, handed, at, config, opener } = input;
@@ -12595,7 +12625,7 @@ async function openTurn(trx, input) {
12595
12625
  blockId: null,
12596
12626
  at
12597
12627
  });
12598
- else await registerTurnNotification(trx, turn, at, {
12628
+ await registerTurnNotification(trx, turn, at, {
12599
12629
  config,
12600
12630
  opener
12601
12631
  });
@@ -12606,7 +12636,7 @@ async function openTurn(trx, input) {
12606
12636
  * needs its unread notification addressed to the actor; a taken orchestrator turn may be taken
12607
12637
  * over by whoever its notification is now addressed to. An operator on the task's project may
12608
12638
  * take any open orchestrator turn, taken or not, and any turn addressed to the operator, taken or
12609
- * not, with no notification step; anyone else gets false for an operator turn. Others get
12639
+ * not, as a takeover of its ring; anyone else gets false for an operator turn. Others get
12610
12640
  * `forbidden`.
12611
12641
  * Every take starts a new ownership episode: an unsent reminder of an earlier one is acked, so
12612
12642
  * `ringStillCurrent` drops its ring, and an active wait ends `closed`.
@@ -12620,6 +12650,10 @@ async function takeTurn(trx, input) {
12620
12650
  const takeover = orchestrated && isOperator(actor, config, project);
12621
12651
  if (turn.role === "operator") {
12622
12652
  if (!isOperator(actor, config, project)) return false;
12653
+ await acknowledgeNotification(trx, {
12654
+ ...input,
12655
+ takeover: true
12656
+ });
12623
12657
  } else if (turn.acked_at === null) {
12624
12658
  if (!await acknowledgeNotification(trx, {
12625
12659
  ...input,
@@ -13138,7 +13172,8 @@ async function openBlock(trx, subject, type, reason, ctx, config, addressee, add
13138
13172
  await applyDoorbellPolicy(trx, {
13139
13173
  kind: "block_opened",
13140
13174
  block: row,
13141
- authorRole: authorRole(config, subject, ctx.actor)
13175
+ authorRole: authorRole(config, subject, ctx.actor),
13176
+ config
13142
13177
  }, new Date(ctx.at));
13143
13178
  return row;
13144
13179
  }
@@ -13663,10 +13698,14 @@ function createBlockMutations(config) {
13663
13698
  }
13664
13699
  throw new CommandError("not_found", "No open turn to take for this ID.");
13665
13700
  }
13666
- /** Acks the item a ring `N<notification>[-<ring>]` was sent for. */
13701
+ /**
13702
+ * Acks the item a ring `N<notification>[-<ring>]` was sent for. An operator turn ring read
13703
+ * already (its turn was taken) is handled; only `T<number>` takes that turn over.
13704
+ */
13667
13705
  async function ackRing(trx, id, ctx) {
13668
13706
  const notice = found(await notificationByRingId(trx, id));
13669
13707
  if (notice.kind === "block" && notice.block_id !== null) return ackBlock(trx, notice.block_id, ctx);
13708
+ if (notice.kind === "turn" && notice.role === "operator" && notice.acked_at !== null && await notificationAddressedTo(trx, notice, ctx.actor, config)) return "handled";
13670
13709
  if (notice.kind === "turn" && notice.turn_id !== null) return ackTurn(trx, notice.turn_id, ctx);
13671
13710
  if (!await notificationAddressedTo(trx, notice, ctx.actor, config)) throw new CommandError("forbidden", "Only the addressed task role can acknowledge.");
13672
13711
  if (notice.kind === "answer" && notice.acked_at === null && notice.comment_id !== null) {
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { S as renderMcpError, g as OPERATIONS, pt as ERRORS } from "./chunk-Bc7i_dwR.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-BFzKesDt.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-ChF7zDxN.mjs";
1
+ import { S as renderMcpError, g as OPERATIONS, pt as ERRORS } from "./chunk-D4SFZF-6.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-BMb9UmCB.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-BWHlpLkT.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.162.0",
3
+ "version": "0.163.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -14,6 +14,9 @@ Taskless: all roles, operator only:
14
14
  `board project ask <project> <text> --to operator --key <key>`.
15
15
  Project `needs_input` blocks get Slack threads except operator-agent asks;
16
16
  operator: `board inbox`, keyed `board answer`. Answers reach a current curator session; other roles use the asking session.
17
+ Without Slack, a block or turn to `operator` rings the operator Spur project's live session (the
18
+ project's own operator, else the board-wide one), which reads `board inbox operator`; with Slack
19
+ the block's thread or the turn's feed line carries it.
17
20
  On an unblocked block, the operator's keyed `board followup <block> <text>`
18
21
  rings the author like an answer and posts to the block's thread; the block
19
22
  stays closed, and the column and turn do not change.
@@ -62,7 +62,7 @@ An operator takes a turn addressed to it, or takes over an open orchestrator
62
62
  turn, taken or not, with keyed
63
63
  `board inbox ack <entries>`, then submits or returns it, or does both from the web
64
64
  [Turn](web-ui-task-turn.md) section. The earlier holder gets
65
- `not_turn_taker`, then `turn_closed`. The takeover is not sticky: the addressed
65
+ `not_turn_taker`, then `turn_closed`. The addressed
66
66
  orchestrator can ack the turn back.
67
67
 
68
68
  Open-turn executors in `needs_input`, `error`, `rate_limited` or `stopped` raise
@@ -99,7 +99,7 @@ queue defer repeats. Queues can exhaust their waiting window.
99
99
  Most notices await recipients; taskless worker, orchestrator and operator-agent
100
100
  answers end without a live asking session. Curator and course-check orchestrator
101
101
  questions fall back to operator. Operator conversations await their project.
102
- Exhaustion alerts the operator, except removals and quiet-turn reminders;
102
+ Exhaustion alerts the operator, except removals, quiet-turn reminders and operator rings;
103
103
  curator questions move to operator.
104
104
 
105
105
  A taken turn is reminded, then flagged stuck, after `health.idleInDevAfterMs` of quiet;
@@ -55,10 +55,10 @@ Other errors: `not_found`.
55
55
 
56
56
  ### `board inbox ack`
57
57
 
58
- Purpose: Mark comments, agent-addressed blocks, turns or doorbell rings as read; acking a turn makes the caller its taker.
58
+ Purpose: Mark comments, blocks addressed to the caller, turns or doorbell rings as read; acking a turn makes the caller its taker.
59
59
  Arguments: `<entries>`.
60
60
  Flags: `--key <key>`, `--json`.
61
- Use when: Mark handled inbox items or a ring ID like N18-1 read; an item handled before comes back under alreadyHandled. The operator acks a turn ID to take a turn addressed to the operator, or to take over an open orchestrator turn, taken or not.
61
+ Use when: Mark handled inbox items or a ring ID like N18-1 read; an item handled before comes back under alreadyHandled. The operator acks a turn ID, with or without Slack, to take a turn addressed to the operator or to take over an open orchestrator turn, taken or not. Without Slack and with an operator Spur project, it also acks a block ID addressed to the operator, whether or not its ring was sent yet.
62
62
  Avoid when: Use `board inbox` to inspect them first; the operator finds the turns addressed to it with `board inbox operator`.
63
63
  Example: `board inbox ack C3@1 --key inbox-ack-PROJ-123-comment-revision-1432` — Acknowledge a comment revision.
64
64
  Other errors: `wrong_id_kind`, `not_found`, `stale_comment_revision`, `idempotency_key_mismatch`.