spur-board 0.104.1 → 0.104.2

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 { _ as renderJsonError, at as successEnvelopeSchema, c as tokenRequestStatusSchema, et as ERRORS, nt as errorContextSchema, o as tokenRequestResultSchema, rt as errorEnvelopeSchema } from "./chunk-C34hsfqb.mjs";
1
+ import { _ as renderJsonError, at as successEnvelopeSchema, c as tokenRequestStatusSchema, et as ERRORS, nt as errorContextSchema, o as tokenRequestResultSchema, rt as errorEnvelopeSchema } from "./chunk-DGsDK61k.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 { d as buildCatalogSnapshot, gt as plainHttpAllowed, mt as configSchema, p as OPERATIONS } from "./chunk-C34hsfqb.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-Dz9IMhY5.mjs";
1
+ import { d as buildCatalogSnapshot, gt as plainHttpAllowed, mt as configSchema, p as OPERATIONS } from "./chunk-DGsDK61k.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-2UOGIWN_.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";
@@ -126,7 +126,8 @@ const DISPATCHER_MODES = ["shadow", "on"];
126
126
  * How a turn closed: `submitted` by the executor's submit, `returned` by `task.return`, `moved`
127
127
  * when the task moved on (it also covers returns and mode switches recorded by older versions),
128
128
  * `corrected` by the operator's column correction, `rerouted` to another executor,
129
- * `mode_changed` by a dispatcher mode switch, `archived` with the task.
129
+ * `mode_changed` by a dispatcher mode switch, `archived` with the task. `moved` also closes a
130
+ * Done wrap-up turn whose holder session ended.
130
131
  */
131
132
  const TURN_OUTCOMES = [
132
133
  "submitted",
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { St as SLACK_BOT_SCOPES, Y as actorIdSchema, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, et as ERRORS, f as roleCanUseOperation, mt as configSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as DEFAULT_STAND_PORT_RANGE, vt as resolveWebOrigin } from "./chunk-C34hsfqb.mjs";
1
+ import { St as SLACK_BOT_SCOPES, Y as actorIdSchema, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, et as ERRORS, f as roleCanUseOperation, mt as configSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as DEFAULT_STAND_PORT_RANGE, vt as resolveWebOrigin } from "./chunk-DGsDK61k.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-Dz9IMhY5.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-4C7tYXYO.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-2UOGIWN_.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-BTkdnlO3.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-Dz9IMhY5.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-2UOGIWN_.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as parseRef$1, A as defaultBranchFactSchema, B as isExternalAuthor, C as messageRefSchema, Ct as TASK_HOLDS, D as eventPayloadSchemas, E as GATE_REASONS, F as trackerSourceId, G as sessionFactsSchema, H as prFactsSchema, I as PR_STATES, J as REF_NUMBER, K as ticketFactsSchema, L as REVIEW_STATES, M as prSourceId, N as sessionTransitionSchema, O as AdapterError, P as sourceCursorSchema, Q as parseActorId, R as SESSION_HEALTH_STATES, S as interactionRefSchema, St as SLACK_BOT_SCOPES, T as EVENT_KINDS, U as prRefSchema, V as parseRingMarker, W as ringMarker, X as encodeActorId, Y as actorIdSchema, Z as errorCodeOf, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, b as conversationRefSchema, bt as DISPATCHER_MODES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as RESERVED_PROJECT, et as ERRORS, f as roleCanUseOperation, ft as boardWideSpurProject, g as renderHttpProblem, gt as plainHttpAllowed, h as turnHandedSchema, ht as defaultAddressee, i as TOKEN_REQUEST_LIMITS, it as ok, j as entityRefSchema, k as batchSchema, l as BOARD_TICK_MS, lt as DEFAULT_SLACK_COMMAND, m as defaultBranchViewSchema, mt as configSchema, n as doctorReportSchema, o as tokenRequestResultSchema, p as OPERATIONS, pt as configBindings, q as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as DEFAULT_LINK, t as assertNever, tt as err, vt as resolveWebOrigin, w as userIdSchema, wt as VIAS, x as inboundEventSchema, xt as ITEM_KINDS, y as SPACE_IDS, yt as COLUMN_IDS, z as SESSION_STATUSES } from "./chunk-C34hsfqb.mjs";
1
+ import { $ as parseRef$1, A as defaultBranchFactSchema, B as isExternalAuthor, C as messageRefSchema, Ct as TASK_HOLDS, D as eventPayloadSchemas, E as GATE_REASONS, F as trackerSourceId, G as sessionFactsSchema, H as prFactsSchema, I as PR_STATES, J as REF_NUMBER, K as ticketFactsSchema, L as REVIEW_STATES, M as prSourceId, N as sessionTransitionSchema, O as AdapterError, P as sourceCursorSchema, Q as parseActorId, R as SESSION_HEALTH_STATES, S as interactionRefSchema, St as SLACK_BOT_SCOPES, T as EVENT_KINDS, U as prRefSchema, V as parseRingMarker, W as ringMarker, X as encodeActorId, Y as actorIdSchema, Z as errorCodeOf, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, b as conversationRefSchema, bt as DISPATCHER_MODES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as RESERVED_PROJECT, et as ERRORS, f as roleCanUseOperation, ft as boardWideSpurProject, g as renderHttpProblem, gt as plainHttpAllowed, h as turnHandedSchema, ht as defaultAddressee, i as TOKEN_REQUEST_LIMITS, it as ok, j as entityRefSchema, k as batchSchema, l as BOARD_TICK_MS, lt as DEFAULT_SLACK_COMMAND, m as defaultBranchViewSchema, mt as configSchema, n as doctorReportSchema, o as tokenRequestResultSchema, p as OPERATIONS, pt as configBindings, q as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as DEFAULT_LINK, t as assertNever, tt as err, vt as resolveWebOrigin, w as userIdSchema, wt as VIAS, x as inboundEventSchema, xt as ITEM_KINDS, y as SPACE_IDS, yt as COLUMN_IDS, z as SESSION_STATUSES } from "./chunk-DGsDK61k.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";
@@ -15584,8 +15584,13 @@ async function conversationWaiting(trx, config, block, subject) {
15584
15584
  priority: ITEM_POLICY.conversation_waiting.priority
15585
15585
  };
15586
15586
  }
15587
- /** Reconciles every item in the caller's observation or tick transaction. */
15587
+ /**
15588
+ * Reconciles every item in the caller's observation or tick transaction. It first closes each
15589
+ * Done wrap-up turn whose holder session ended (`closeEndedDoneTurns`), so no stall item is
15590
+ * raised for it.
15591
+ */
15588
15592
  async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurContinuityStartAt) {
15593
+ await closeEndedDoneTurns(trx, new Date(now));
15589
15594
  const candidates = [];
15590
15595
  const sources = await trx.selectFrom("source_state").selectAll().execute();
15591
15596
  const sourceById = new Map(sources.map((state) => [state.source, state]));
@@ -16105,17 +16110,49 @@ async function raiseAnomaly(trx, config, task, input, executorId) {
16105
16110
  });
16106
16111
  }
16107
16112
  /** Clears a reconciled item; a ledger item's open block is withdrawn by the board first. */
16108
- async function clearReconciled(trx, item, at) {
16113
+ async function clearReconciled(trx, item, at, reason = "condition ended") {
16109
16114
  if (item.block_id !== null) {
16110
16115
  const ctx = {
16111
16116
  actor: "system",
16112
16117
  at: at.toISOString()
16113
16118
  };
16114
- await closeBlockIfOpen(trx, item.block_id, ctx, "withdrawn", "condition ended");
16119
+ await closeBlockIfOpen(trx, item.block_id, ctx, "withdrawn", reason);
16115
16120
  }
16116
16121
  await clearItem(trx, item.id, at);
16117
16122
  }
16118
16123
  /**
16124
+ * Closes, as `moved`, each taken Done wrap-up turn of an unarchived Done task whose agent holder
16125
+ * session ended, and withdraws the stall items of that turn and holder with a reason naming both.
16126
+ * The holder can no longer submit, so a stall block on its turn would never clear.
16127
+ */
16128
+ async function closeEndedDoneTurns(trx, at) {
16129
+ const turns = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").select([
16130
+ "turn.id",
16131
+ "turn.task_id",
16132
+ "turn.acked_by"
16133
+ ]).where("turn.closed_at", "is", null).where("turn.acked_at", "is not", null).where("turn.role", "!=", "operator").where("turn.column", "=", "done").where("task.column", "=", "done").where("task.membership", "!=", "archived").orderBy("turn.id").execute();
16134
+ for (const turn of turns) {
16135
+ const holder = turn.acked_by === null ? void 0 : parseActorId(turn.acked_by);
16136
+ if (holder?.actor !== "agent") continue;
16137
+ const sessionId = holder.actorRef.session;
16138
+ const session = await trx.selectFrom("session_snapshot").select("ended_at").where("id", "=", sessionId).executeTakeFirst();
16139
+ if (session === void 0 || session.ended_at === null) continue;
16140
+ await closeTurns(trx, {
16141
+ taskId: turn.task_id,
16142
+ reason: "moved",
16143
+ at
16144
+ });
16145
+ const keys = [`stuck-turn:${String(turn.id)}`, healthKey(turn.task_id, {
16146
+ taskId: String(turn.task_id),
16147
+ sessionId,
16148
+ kind: "worker_lost"
16149
+ })];
16150
+ const items = await trx.selectFrom("operator_item").selectAll().where("item_key", "in", keys).where("cleared_at", "is", null).execute();
16151
+ const reason = `turn T${String(turn.id)} closed: its holder ${sessionId} ended in Done`;
16152
+ for (const item of items) await clearReconciled(trx, item, at, reason);
16153
+ }
16154
+ }
16155
+ /**
16119
16156
  * Raises the cycle-limit block of a task's column, once while it is open. The operator's close
16120
16157
  * of the block or its item is the reset: a later call opens a new block.
16121
16158
  */
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { et as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-C34hsfqb.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-Dz9IMhY5.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-4C7tYXYO.mjs";
1
+ import { et as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-DGsDK61k.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-2UOGIWN_.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-BTkdnlO3.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.104.1",
3
+ "version": "0.104.2",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -4,3 +4,12 @@
4
4
 
5
5
  One linked PR merging does not by itself finish the task. Done: `projects[].tracker.doneStatuses` for Jira; for GitHub, the Issue must be
6
6
  closed. If still open, link another PR.
7
+
8
+ ## Done wrap-up
9
+
10
+ Entering Done opens one wrap-up turn (`done: wrap up`) for the live worker, or for the Done
11
+ column's orchestrator (`projects[].columns[].orchestrator`); none for an operator Done or when no
12
+ live worker is seen. It closes like any turn (submit, the task leaving Done, archive), and
13
+ also when its holder session ends: that close shows `turn_closed` outcome `moved`, and the
14
+ holder's end raises no stall block on it. After an end, a live worker still linked to the task,
15
+ or the Done orchestrator, gets a new one.