spur-board 0.157.2 → 0.158.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,5 +1,5 @@
1
- import { Ot as plainHttpAllowed, Tt as configSchema, d as buildCatalogSnapshot, p as OPERATIONS } from "./chunk-DlNdkguO.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-BHROPjEZ.mjs";
1
+ import { Et as configSchema, d as buildCatalogSnapshot, kt as plainHttpAllowed, p as OPERATIONS } from "./chunk-Cly2ejBA.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-PSohvh-P.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";
@@ -3323,6 +3323,39 @@ const statusItemSchema = itemViewSchema.extend({
3323
3323
  unconfirmed: z.boolean().describe("Whether a supporting fact is stale or its source is blind."),
3324
3324
  factAt: z.iso.datetime().nullable().describe("Time of the supporting fact, when known.")
3325
3325
  }).describe("An actionable item with its freshness mark.");
3326
+ // ../contracts/src/ops/inbox-schemas.ts
3327
+ /** What a `no-session:` board observation is about, read from the store when the inbox is read. */
3328
+ const inboxNoSessionSchema = z.strictObject({
3329
+ project: z.string().min(1).describe("Board project of the column."),
3330
+ column: z.enum(COLUMN_IDS).describe("Column whose orchestrator turns have no session to ring."),
3331
+ spurProject: z.string().min(1).optional().describe("Spur project of the column orchestrator the observation recorded, else the current binding; absent when neither is known."),
3332
+ oldestTask: taskKeySchema.describe("Task of the oldest waiting turn when the item was raised."),
3333
+ since: z.iso.datetime().describe("Since when the column has had no live session, ISO 8601 UTC."),
3334
+ waiting: z.number().int().min(0).optional().describe("Open entries only: untaken orchestrator turns waiting in the column now."),
3335
+ oldestTurn: turnIdSchema.optional().describe("The oldest waiting turn the observation recorded; on an open entry whose record cannot be read, the waiting turn of its task."),
3336
+ oldestAt: z.iso.datetime().optional().describe("Open entries only: when that turn rang, ISO 8601 UTC, while it still waits untaken.")
3337
+ }).describe("On a board_observation no-session item only: the column with no live session to ring; absent when the board cannot read it.");
3338
+ /** One entry of the operator inbox: an operator item, a block addressed to the operator or a turn. */
3339
+ const inboxEntrySchema = z.strictObject({
3340
+ id: z.union([
3341
+ itemIdSchema,
3342
+ blockIdSchema,
3343
+ turnIdSchema
3344
+ ]).describe("Item (I), block (B) or turn (T) ID; stable while the entry exists."),
3345
+ project: z.string().min(1).describe("Board project the entry belongs to; _board for a board-wide one."),
3346
+ kind: z.enum(INBOX_KINDS).describe("block for a block addressed to the operator, turn for a turn, else the item kind."),
3347
+ severity: z.enum(INBOX_SEVERITIES).describe("failure: the board or a connection broke; attention: a decision, answer or other operator action is wanted."),
3348
+ text: z.string().describe("What needs the operator, in one line."),
3349
+ url: z.url({ protocol: /^https?$/ }).and(z.string().regex(/^[hH][tT][tT][pP][sS]?:\/\//)).optional().describe("Meaningful external destination for this entry, when known; HTTP(S) only. Task navigation takes precedence in the web inbox."),
3350
+ action: z.string().min(1).optional().describe("What the operator does about an item entry; the text ends with it. Absent on block and turn entries."),
3351
+ at: z.iso.datetime().describe("When the entry was raised or opened, ISO 8601 UTC."),
3352
+ task: taskKeySchema.nullable().describe("Task the entry is about; null when it has none."),
3353
+ column: z.enum(COLUMN_IDS).optional().describe("Column of a turn; absent on other entries."),
3354
+ answeredVia: z.enum(VIAS).nullable().optional().describe("On a block: web, slack, cli or mcp when the closing write arrived that way (cli and mcp as the board client reported it), else null; absent on other entries."),
3355
+ noSession: inboxNoSessionSchema.optional()
3356
+ }).describe("One entry of the operator inbox.");
3357
+ /** An operator inbox entry cleared, answered or closed in the last 24 hours. */
3358
+ const inboxHandledSchema = inboxEntrySchema.extend({ handledAt: z.iso.datetime().describe("When it was cleared, answered or closed, ISO 8601 UTC.") }).describe("An operator inbox entry handled in the last 24 hours.");
3326
3359
  // ../contracts/src/ops/source-view-schema.ts
3327
3360
  /** The stored colour of a repository's default-branch head, as status.get shows it. */
3328
3361
  const defaultBranchViewSchema = z.strictObject({
@@ -3621,27 +3654,6 @@ const columnsDescribeOutputSchema = z.strictObject({ projects: z.array(z.strictO
3621
3654
  }).describe("Column placement policy.")
3622
3655
  })).describe("Enabled columns only, in canonical order.")
3623
3656
  })).describe("Effective configured projects visible to the caller; bounded by config and built-in columns.") });
3624
- // ../contracts/src/ops/inbox-schemas.ts
3625
- /** One entry of the operator inbox: an operator item, a block addressed to the operator or a turn. */
3626
- const inboxEntrySchema = z.strictObject({
3627
- id: z.union([
3628
- itemIdSchema,
3629
- blockIdSchema,
3630
- turnIdSchema
3631
- ]).describe("Item (I), block (B) or turn (T) ID; stable while the entry exists."),
3632
- project: z.string().min(1).describe("Board project the entry belongs to; _board for a board-wide one."),
3633
- kind: z.enum(INBOX_KINDS).describe("block for a block addressed to the operator, turn for a turn, else the item kind."),
3634
- severity: z.enum(INBOX_SEVERITIES).describe("failure: the board or a connection broke; attention: a decision, answer or other operator action is wanted."),
3635
- text: z.string().describe("What needs the operator, in one line."),
3636
- url: z.url({ protocol: /^https?$/ }).and(z.string().regex(/^[hH][tT][tT][pP][sS]?:\/\//)).optional().describe("Meaningful external destination for this entry, when known; HTTP(S) only. Task navigation takes precedence in the web inbox."),
3637
- action: z.string().min(1).optional().describe("What the operator does about an item entry; the text ends with it. Absent on block and turn entries."),
3638
- at: z.iso.datetime().describe("When the entry was raised or opened, ISO 8601 UTC."),
3639
- task: taskKeySchema.nullable().describe("Task the entry is about; null when it has none."),
3640
- column: z.enum(COLUMN_IDS).optional().describe("Column of a turn; absent on other entries."),
3641
- answeredVia: z.enum(VIAS).nullable().optional().describe("On a block: web, slack, cli or mcp when the closing write arrived that way (cli and mcp as the board client reported it), else null; absent on other entries.")
3642
- }).describe("One entry of the operator inbox.");
3643
- /** An operator inbox entry cleared, answered or closed in the last 24 hours. */
3644
- const inboxHandledSchema = inboxEntrySchema.extend({ handledAt: z.iso.datetime().describe("When it was cleared, answered or closed, ISO 8601 UTC.") }).describe("An operator inbox entry handled in the last 24 hours.");
3645
3657
  errorDetailSchema.extend({
3646
3658
  type: z.url(),
3647
3659
  title: z.string(),
@@ -4558,6 +4570,26 @@ const OPERATIONS = [
4558
4570
  at,
4559
4571
  task: null
4560
4572
  },
4573
+ {
4574
+ id: "I10",
4575
+ project: "web",
4576
+ kind: "board_observation",
4577
+ severity: "attention",
4578
+ text: "web review: turns wait for a live session of Spur project web-orch; oldest T4 since 2026-01-05T09:00:00.000Z; 2 waiting, no live session for 30 min: start a session in Spur project web-orch, or take over its turns with board inbox ack",
4579
+ action: "start a session in Spur project web-orch, or take over its turns with board inbox ack",
4580
+ at,
4581
+ task: "PROJ-125",
4582
+ noSession: {
4583
+ project: "web",
4584
+ column: "review",
4585
+ spurProject: "web-orch",
4586
+ oldestTask: "PROJ-125",
4587
+ since: "2026-01-05T09:15:00.000Z",
4588
+ waiting: 2,
4589
+ oldestTurn: "T4",
4590
+ oldestAt: "2026-01-05T09:00:00.000Z"
4591
+ }
4592
+ },
4561
4593
  {
4562
4594
  id: "T5",
4563
4595
  project: "web",
@@ -6023,4 +6055,4 @@ const remoteDoctorReportSchema = z.object({
6023
6055
  function assertNever(value) {
6024
6056
  throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
6025
6057
  }
6026
- export { ringMarker as $, eventPayloadSchemas as A, requiredSecretKeys as At, sourceCursorSchema as B, TODO_GROUP_COLUMN_IDS as Bt, messageRefSchema as C, columnTurnTimings as Ct, sortSkillFiles as D, externalQuietAfterMs as Dt, skillReloadFilesSchema as E, defaultAddressee as Et, defaultBranchFactSchema as F, COLUMN_IDS as Ft, SESSION_HEALTH_STATES as G, PR_STATES as H, isTodoGroupColumn as Ht, entityRefSchema as I, DISPATCHER_MODES as It, parseRingMarker as J, SESSION_STATUSES as K, mirrorSourceId as L, ITEM_KINDS as Lt, MIRROR_FAILURES as M, BLOCK_TYPES as Mt, MIRROR_FAILURE_CODES as N, COLUMNS as Nt, EVENT_KINDS as O, plainHttpAllowed as Ot, batchSchema as P, COLUMN_GROUPS as Pt, prReviewRuleSchema as Q, prSourceId as R, SLACK_BOT_SCOPES as Rt, interactionRefSchema as S, boardWideSpurProject as St, skillReloadFileSchema as T, configSchema as Tt, REVIEW_DECISIONS as U, trackerSourceId as V, VIAS as Vt, REVIEW_STATES as W, prFactsSchema as X, prApprovalPairSchema as Y, prRefSchema as Z, renderJsonError as _, DEFAULT_SLACK_APP_NAME as _t, requestHashOf as a, encodeActorId as at, conversationRefSchema as b, RESERVED_PROJECT as bt, tokenRequestStatusSchema as c, parseRef as ct, buildCatalogSnapshot as d, errorContextSchema as dt, sessionFactsSchema as et, roleCanUseOperation as f, errorEnvelopeSchema as ft, renderHttpProblem as g, DEFAULT_LINK as gt, turnHandedSchema as h, DEFAULT_HTTP_PORT as ht, TOKEN_REQUEST_LIMITS as i, actorIdSchema as it, AdapterError as j, resolveWebOrigin as jt, GATE_REASONS as k, readyMirrorOf as kt, BOARD_TICK_MS as l, ERRORS as lt, defaultBranchViewSchema as m, successEnvelopeSchema as mt, doctorReportSchema as n, JIRA_PROJECT_KEY as nt, tokenRequestResultSchema as o, errorCodeOf as ot, OPERATIONS as p, ok as pt, isExternalAuthor as q, remoteDoctorReportSchema as r, REF_NUMBER as rt, tokenRequestSchema as s, parseActorId as st, assertNever as t, ticketFactsSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, err as ut, renderMcpError as v, DEFAULT_SLACK_COMMAND as vt, userIdSchema as w, configBindings as wt, inboundEventSchema as x, approvalRuleOf as xt, SPACE_IDS as y, DEFAULT_STAND_PORT_RANGE as yt, sessionTransitionSchema as z, TASK_HOLDS as zt };
6058
+ export { prReviewRuleSchema as $, GATE_REASONS as A, readyMirrorOf as At, sessionTransitionSchema as B, TASK_HOLDS as Bt, interactionRefSchema as C, boardWideSpurProject as Ct, skillReloadFilesSchema as D, defaultAddressee as Dt, skillReloadFileSchema as E, configSchema as Et, batchSchema as F, COLUMN_GROUPS as Ft, REVIEW_STATES as G, trackerSourceId as H, VIAS as Ht, defaultBranchFactSchema as I, COLUMN_IDS as It, isExternalAuthor as J, SESSION_HEALTH_STATES as K, entityRefSchema as L, DISPATCHER_MODES as Lt, AdapterError as M, resolveWebOrigin as Mt, MIRROR_FAILURES as N, BLOCK_TYPES as Nt, sortSkillFiles as O, externalQuietAfterMs as Ot, MIRROR_FAILURE_CODES as P, COLUMNS as Pt, prRefSchema as Q, mirrorSourceId as R, ITEM_KINDS as Rt, inboundEventSchema as S, approvalRuleOf as St, userIdSchema as T, configBindings as Tt, PR_STATES as U, isTodoGroupColumn as Ut, sourceCursorSchema as V, TODO_GROUP_COLUMN_IDS as Vt, REVIEW_DECISIONS as W, prApprovalPairSchema as X, parseRingMarker as Y, prFactsSchema as Z, renderHttpProblem as _, DEFAULT_LINK as _t, requestHashOf as a, actorIdSchema as at, SPACE_IDS as b, DEFAULT_STAND_PORT_RANGE as bt, tokenRequestStatusSchema as c, parseActorId as ct, buildCatalogSnapshot as d, err as dt, ringMarker as et, roleCanUseOperation as f, errorContextSchema as ft, turnHandedSchema as g, DEFAULT_HTTP_PORT as gt, inboxNoSessionSchema as h, successEnvelopeSchema as ht, TOKEN_REQUEST_LIMITS as i, REF_NUMBER as it, eventPayloadSchemas as j, requiredSecretKeys as jt, EVENT_KINDS as k, plainHttpAllowed as kt, BOARD_TICK_MS as l, parseRef as lt, defaultBranchViewSchema as m, ok as mt, doctorReportSchema as n, ticketFactsSchema as nt, tokenRequestResultSchema as o, encodeActorId as ot, OPERATIONS as p, errorEnvelopeSchema as pt, SESSION_STATUSES as q, remoteDoctorReportSchema as r, JIRA_PROJECT_KEY as rt, tokenRequestSchema as s, errorCodeOf as st, assertNever as t, sessionFactsSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, ERRORS as ut, renderJsonError as v, DEFAULT_SLACK_APP_NAME as vt, messageRefSchema as w, columnTurnTimings as wt, conversationRefSchema as x, RESERVED_PROJECT as xt, renderMcpError as y, DEFAULT_SLACK_COMMAND as yt, prSourceId as z, SLACK_BOT_SCOPES as zt };
@@ -1,4 +1,4 @@
1
- import { _ as renderJsonError, c as tokenRequestStatusSchema, dt as errorContextSchema, ft as errorEnvelopeSchema, lt as ERRORS, mt as successEnvelopeSchema, o as tokenRequestResultSchema } from "./chunk-DlNdkguO.mjs";
1
+ import { c as tokenRequestStatusSchema, ft as errorContextSchema, ht as successEnvelopeSchema, o as tokenRequestResultSchema, pt as errorEnvelopeSchema, ut as ERRORS, v as renderJsonError } from "./chunk-Cly2ejBA.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { At as requiredSecretKeys, D as sortSkillFiles, Rt as SLACK_BOT_SCOPES, T as skillReloadFileSchema, Tt as configSchema, a as requestHashOf, f as roleCanUseOperation, it as actorIdSchema, jt as resolveWebOrigin, lt as ERRORS, mt as successEnvelopeSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, yt as DEFAULT_STAND_PORT_RANGE } from "./chunk-DlNdkguO.mjs";
1
+ import { E as skillReloadFileSchema, Et as configSchema, Mt as resolveWebOrigin, O as sortSkillFiles, a as requestHashOf, at as actorIdSchema, bt as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ht as successEnvelopeSchema, jt as requiredSecretKeys, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as ERRORS, zt as SLACK_BOT_SCOPES } from "./chunk-Cly2ejBA.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-BHROPjEZ.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-C7H6hp1r.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-PSohvh-P.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-Bhv5wzSj.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-BHROPjEZ.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-PSohvh-P.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as ringMarker, A as eventPayloadSchemas, At as requiredSecretKeys, B as sourceCursorSchema, Bt as TODO_GROUP_COLUMN_IDS, C as messageRefSchema, Ct as columnTurnTimings, D as sortSkillFiles, Dt as externalQuietAfterMs, E as skillReloadFilesSchema, Et as defaultAddressee, F as defaultBranchFactSchema, Ft as COLUMN_IDS, G as SESSION_HEALTH_STATES, H as PR_STATES, Ht as isTodoGroupColumn, I as entityRefSchema, It as DISPATCHER_MODES, J as parseRingMarker, K as SESSION_STATUSES, L as mirrorSourceId, Lt as ITEM_KINDS, M as MIRROR_FAILURES, Mt as BLOCK_TYPES, N as MIRROR_FAILURE_CODES, Nt as COLUMNS, O as EVENT_KINDS, Ot as plainHttpAllowed, P as batchSchema, Pt as COLUMN_GROUPS, Q as prReviewRuleSchema, R as prSourceId, Rt as SLACK_BOT_SCOPES, S as interactionRefSchema, St as boardWideSpurProject, Tt as configSchema, U as REVIEW_DECISIONS, V as trackerSourceId, Vt as VIAS, W as REVIEW_STATES, X as prFactsSchema, Y as prApprovalPairSchema, Z as prRefSchema, a as requestHashOf, at as encodeActorId, b as conversationRefSchema, bt as RESERVED_PROJECT, c as tokenRequestStatusSchema, ct as parseRef$1, d as buildCatalogSnapshot, et as sessionFactsSchema, f as roleCanUseOperation, g as renderHttpProblem, gt as DEFAULT_LINK, h as turnHandedSchema, i as TOKEN_REQUEST_LIMITS, it as actorIdSchema, j as AdapterError, jt as resolveWebOrigin, k as GATE_REASONS, kt as readyMirrorOf, l as BOARD_TICK_MS, lt as ERRORS, m as defaultBranchViewSchema, mt as successEnvelopeSchema, n as doctorReportSchema, nt as JIRA_PROJECT_KEY, o as tokenRequestResultSchema, ot as errorCodeOf, p as OPERATIONS, pt as ok, q as isExternalAuthor, rt as REF_NUMBER, s as tokenRequestSchema, st as parseActorId, t as assertNever, tt as ticketFactsSchema, ut as err, vt as DEFAULT_SLACK_COMMAND, w as userIdSchema, wt as configBindings, x as inboundEventSchema, xt as approvalRuleOf, y as SPACE_IDS, z as sessionTransitionSchema, zt as TASK_HOLDS } from "./chunk-DlNdkguO.mjs";
1
+ import { $ as prReviewRuleSchema, A as GATE_REASONS, At as readyMirrorOf, B as sessionTransitionSchema, Bt as TASK_HOLDS, C as interactionRefSchema, Ct as boardWideSpurProject, D as skillReloadFilesSchema, Dt as defaultAddressee, Et as configSchema, F as batchSchema, Ft as COLUMN_GROUPS, G as REVIEW_STATES, H as trackerSourceId, Ht as VIAS, I as defaultBranchFactSchema, It as COLUMN_IDS, J as isExternalAuthor, K as SESSION_HEALTH_STATES, L as entityRefSchema, Lt as DISPATCHER_MODES, M as AdapterError, Mt as resolveWebOrigin, N as MIRROR_FAILURES, Nt as BLOCK_TYPES, O as sortSkillFiles, Ot as externalQuietAfterMs, P as MIRROR_FAILURE_CODES, Pt as COLUMNS, Q as prRefSchema, R as mirrorSourceId, Rt as ITEM_KINDS, S as inboundEventSchema, St as approvalRuleOf, T as userIdSchema, Tt as configBindings, U as PR_STATES, Ut as isTodoGroupColumn, V as sourceCursorSchema, Vt as TODO_GROUP_COLUMN_IDS, W as REVIEW_DECISIONS, X as prApprovalPairSchema, Y as parseRingMarker, Z as prFactsSchema, _ as renderHttpProblem, _t as DEFAULT_LINK, a as requestHashOf, at as actorIdSchema, b as SPACE_IDS, c as tokenRequestStatusSchema, ct as parseActorId, d as buildCatalogSnapshot, dt as err, et as ringMarker, f as roleCanUseOperation, g as turnHandedSchema, h as inboxNoSessionSchema, ht as successEnvelopeSchema, i as TOKEN_REQUEST_LIMITS, it as REF_NUMBER, j as eventPayloadSchemas, jt as requiredSecretKeys, k as EVENT_KINDS, kt as plainHttpAllowed, l as BOARD_TICK_MS, lt as parseRef$1, m as defaultBranchViewSchema, mt as ok, n as doctorReportSchema, nt as ticketFactsSchema, o as tokenRequestResultSchema, ot as encodeActorId, p as OPERATIONS, q as SESSION_STATUSES, rt as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as errorCodeOf, t as assertNever, tt as sessionFactsSchema, ut as ERRORS, w as messageRefSchema, wt as columnTurnTimings, x as conversationRefSchema, xt as RESERVED_PROJECT, yt as DEFAULT_SLACK_COMMAND, z as prSourceId, zt as SLACK_BOT_SCOPES } from "./chunk-Cly2ejBA.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";
@@ -8854,6 +8854,25 @@ const BLOCK_KEY = "block:";
8854
8854
  const CONVERSATION_KEY = "conversation:";
8855
8855
  /** The item of a named-orchestrator column whose untaken turns have no live session to ring. */
8856
8856
  const NO_SESSION_KEY = "no-session:";
8857
+ /** The stored summary of a no-session item; `parseNoSessionSummary` reads it back. */
8858
+ function noSessionSummary(summary) {
8859
+ return `${summary.project} ${summary.column}: turns wait for a live session of Spur project ${summary.spur}; oldest T${String(summary.turn)} since ${summary.ringAt}`;
8860
+ }
8861
+ const NO_SESSION_SUMMARY = /^(\S+) (\S+): turns wait for a live session of Spur project (.+); oldest T(\d+) since (\S+)$/;
8862
+ /** The fields `noSessionSummary` wrote, or undefined for other text or an unreadable ring time. */
8863
+ function parseNoSessionSummary(text) {
8864
+ const match = NO_SESSION_SUMMARY.exec(text);
8865
+ if (!match) return void 0;
8866
+ const [, project = "", column = "", spur = "", turn = "", ringAt = ""] = match;
8867
+ if (Number.isNaN(Date.parse(ringAt))) return void 0;
8868
+ return {
8869
+ project,
8870
+ column,
8871
+ spur,
8872
+ turn: Number(turn),
8873
+ ringAt
8874
+ };
8875
+ }
8857
8876
  /** The item of a github-rules task whose PR head GitHub has left undecided in External Review. */
8858
8877
  const REVIEW_RULE_KEY = "review-rule:";
8859
8878
  /** The item of a task waiting in External Review with no new external review round for its quietAfterMs. */
@@ -13998,14 +14017,13 @@ function courseCounter(entry, project) {
13998
14017
  }
13999
14018
  const reviewsSchema = prFactsSchema.shape.reviews;
14000
14019
  /**
14001
- * The task's cycle events alone, as `courseRounds` gives them: its moves and limit resets, with
14002
- * no PR history read. Enough for a cycle limit, which counts returns and nothing else.
14020
+ * The task's journal replayed with no PR history read: its moves, resets and external rounds.
14021
+ * `cycle` is exact, enough for a cycle limit. `course` is an upper bound of each counter's count,
14022
+ * exact outside External Review: with no head known, no return is deduplicated against a counted
14023
+ * head. A bound below a course check rules it out; it never goes to `courseSummary`.
14003
14024
  */
14004
- async function cycleEvents(trx, taskId) {
14005
- return (await courseRounds(trx, taskId, {
14006
- columns: [],
14007
- operatorGithubLogin: ""
14008
- }, false)).cycle;
14025
+ function movesReplay(trx, taskId, project) {
14026
+ return courseRounds(trx, taskId, project, false);
14009
14027
  }
14010
14028
  /**
14011
14029
  * The task's journal replayed for its counts, in journal order: the cycle events, and the
@@ -14017,7 +14035,7 @@ async function cycleEvents(trx, taskId) {
14017
14035
  * bounces on is still unhandled and is the return's cause. External Review counts each head of
14018
14036
  * external feedback (rounds and such returns) once, resets ignored; a later one on a counted
14019
14037
  * head adds to the cycle events only. `externalHeads` are those heads. With `history` false it
14020
- * reads no PR history and gives the cycle events alone.
14038
+ * reads no PR history: every return's head is unknown, so only external rounds are deduplicated.
14021
14039
  */
14022
14040
  async function courseRounds(trx, taskId, project, history = true) {
14023
14041
  const prefixes = {
@@ -14047,7 +14065,11 @@ async function courseRounds(trx, taskId, project, history = true) {
14047
14065
  "from_you_cleared",
14048
14066
  "external_round",
14049
14067
  "pr_facts_changed"
14050
- ] : ["task_moved", "from_you_cleared"]).orderBy("id").execute();
14068
+ ] : [
14069
+ "task_moved",
14070
+ "from_you_cleared",
14071
+ "external_round"
14072
+ ]).orderBy("id").execute();
14051
14073
  /** Each PR's latest facts so far, with the id of its first facts row. */
14052
14074
  const prs = /* @__PURE__ */ new Map();
14053
14075
  /** The PR active now: the newest open one by first facts. */
@@ -14078,7 +14100,7 @@ async function courseRounds(trx, taskId, project, history = true) {
14078
14100
  kind: "limit_reset",
14079
14101
  column: reset.column
14080
14102
  });
14081
- else if (history) queue.push({
14103
+ else queue.push({
14082
14104
  entry: {
14083
14105
  kind: "reset",
14084
14106
  counter: reset.column
@@ -14098,7 +14120,7 @@ async function courseRounds(trx, taskId, project, history = true) {
14098
14120
  const event = moved.success ? counted$2(moved.data, moved.data.block !== void 0) : null;
14099
14121
  if (event?.kind !== "return") continue;
14100
14122
  replay.cycle.push(event);
14101
- if (!history || countCycles([event], event.column, Infinity).count === 0) continue;
14123
+ if (countCycles([event], event.column, Infinity).count === 0) continue;
14102
14124
  const counter = courseCounter(event, project);
14103
14125
  const external = counter === "external-review" && externalCause(event.causes);
14104
14126
  const pr = active();
@@ -14175,9 +14197,11 @@ function replayOnce(trx, taskId, project) {
14175
14197
  * open item, or null when nothing is due.
14176
14198
  */
14177
14199
  async function raiseCourseDue(trx, input) {
14178
- const { task, project, config, at, counter } = input;
14200
+ const { task, project, config, at, counter, bound } = input;
14179
14201
  const threshold = project.columns.find((column) => column.id === counter)?.courseCheck ?? 0;
14180
14202
  if (threshold <= 0) return null;
14203
+ const below = bound !== void 0 && roundsSince(bound.course, counter).length < threshold;
14204
+ if (input.replay === void 0 && below) return null;
14181
14205
  const replay = input.replay ?? await courseRounds(trx, task.id, project);
14182
14206
  const count = roundsSince(replay.course, counter).length;
14183
14207
  if (count < threshold) return null;
@@ -15504,7 +15528,13 @@ async function turnsWithoutSession(trx, config, now, taskById) {
15504
15528
  key,
15505
15529
  kind: "board_observation",
15506
15530
  taskId: task.id,
15507
- summary: `${task.project} ${oldest.column}: turns wait for a live session of Spur project ${spur}; oldest T${String(oldest.turn_id)} since ${oldest.created_at}`,
15531
+ summary: noSessionSummary({
15532
+ project: task.project,
15533
+ column: oldest.column,
15534
+ spur,
15535
+ turn: oldest.turn_id,
15536
+ ringAt: oldest.created_at
15537
+ }),
15508
15538
  factAt: new Date(earliest).toISOString(),
15509
15539
  source: null,
15510
15540
  priority: 4
@@ -16337,7 +16367,8 @@ async function moveLeft(trx, input) {
16337
16367
  task: moved,
16338
16368
  limitReached: false
16339
16369
  };
16340
- if (countCycles(await cycleEvents(trx, task.id), task.column, Infinity).count >= column.cycleLimit) {
16370
+ const bound = await movesReplay(trx, task.id, project);
16371
+ if (countCycles(bound.cycle, task.column, Infinity).count >= column.cycleLimit) {
16341
16372
  await raiseCycleLimit(trx, {
16342
16373
  task: moved,
16343
16374
  column: task.column,
@@ -16360,7 +16391,8 @@ async function moveLeft(trx, input) {
16360
16391
  kind: "return",
16361
16392
  column: task.column,
16362
16393
  causes: returnCauses(gate ?? [], block !== void 0)
16363
- }, project)
16394
+ }, project),
16395
+ bound
16364
16396
  }) !== null
16365
16397
  };
16366
16398
  }
@@ -20024,6 +20056,95 @@ function createOrderMutations(config) {
20024
20056
  }
20025
20057
  } };
20026
20058
  }
20059
+ // ../core/src/app/operator-inbox-no-session.ts
20060
+ /** The board project and column a `no-session:<project>:<column>` key names. */
20061
+ function noSessionColumn(key) {
20062
+ const rest = key.slice(11);
20063
+ const last = rest.lastIndexOf(":");
20064
+ return {
20065
+ project: rest.slice(0, last),
20066
+ column: rest.slice(last + 1)
20067
+ };
20068
+ }
20069
+ /**
20070
+ * Untaken orchestrator turns of non-archived tasks with a ringing turn notification, as the
20071
+ * reconcile counts them: one batched read, run only when an open `no-session:` item is listed.
20072
+ */
20073
+ async function waitingTurns(trx, items) {
20074
+ const waiting = {
20075
+ count: /* @__PURE__ */ new Map(),
20076
+ turnOf: /* @__PURE__ */ new Map(),
20077
+ ids: /* @__PURE__ */ new Set()
20078
+ };
20079
+ if (!items.some((item) => item.item_key.startsWith("no-session:"))) return waiting;
20080
+ const rows = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").innerJoin("notification", "notification.turn_id", "turn.id").select([
20081
+ "task.project",
20082
+ "turn.column",
20083
+ "turn.task_id",
20084
+ "turn.id",
20085
+ (eb) => eb.fn.min("notification.created_at").as("rang_at")
20086
+ ]).where("task.membership", "!=", "archived").where("turn.closed_at", "is", null).where("turn.acked_at", "is", null).where(sql`turn.role = 'orchestrator:' || turn."column"`).where("notification.kind", "=", "turn").where("notification.acked_at", "is", null).where("notification.exhausted_at", "is", null).groupBy("turn.id").execute();
20087
+ for (const row of rows) {
20088
+ const key = `${row.project}:${row.column}`;
20089
+ waiting.count.set(key, (waiting.count.get(key) ?? 0) + 1);
20090
+ waiting.ids.add(row.id);
20091
+ waiting.turnOf.set(`${String(row.task_id)}:${row.column}`, {
20092
+ turn: row.id,
20093
+ rangAt: row.rang_at
20094
+ });
20095
+ }
20096
+ return waiting;
20097
+ }
20098
+ /**
20099
+ * The text of a `no-session:` item: while open, its stored text with the waiting turns and the
20100
+ * whole minutes since `fact_at` read now; a cleared one keeps its stored text. The action names
20101
+ * the column's Spur project.
20102
+ */
20103
+ function noSessionText(item, config, waiting, now) {
20104
+ const { project, column } = noSessionColumn(item.item_key);
20105
+ const spur = columnTurnTimings(config, project, column)?.orchestrator;
20106
+ const action = `start a session in ${spur === void 0 ? "its Spur project" : `Spur project ${spur}`}, or take over its turns with board inbox ack`;
20107
+ const since = item.fact_at === null ? NaN : Date.parse(item.fact_at);
20108
+ if (item.cleared_at !== null || Number.isNaN(since)) return {
20109
+ condition: item.text,
20110
+ action
20111
+ };
20112
+ const minutes = Math.max(0, Math.floor((now - since) / 6e4));
20113
+ const count = waiting.count.get(`${project}:${column}`) ?? 0;
20114
+ return {
20115
+ condition: `${item.text}; ${String(count)} waiting, no live session for ${String(minutes)} min`,
20116
+ action
20117
+ };
20118
+ }
20119
+ /**
20120
+ * The fields of a `no-session:` item: the Spur project and oldest turn its summary recorded, else
20121
+ * the column's binding and, while open, the task's waiting turn; while open also the waiting count
20122
+ * and the turn's ring time while that turn still waits. Undefined when the key, task or `fact_at`
20123
+ * cannot be read.
20124
+ */
20125
+ function noSessionFields(item, task, config, waiting) {
20126
+ const { project, column } = noSessionColumn(item.item_key);
20127
+ const since = item.fact_at === null ? NaN : Date.parse(item.fact_at);
20128
+ if (task === void 0 || Number.isNaN(since)) return void 0;
20129
+ const parsed = parseNoSessionSummary(item.text);
20130
+ const recorded = parsed?.project === project && parsed.column === column ? parsed : void 0;
20131
+ const spurProject = recorded?.spur ?? columnTurnTimings(config, project, column)?.orchestrator;
20132
+ const open = item.cleared_at === null;
20133
+ const ringing = open && recorded === void 0 && item.task_id !== null ? waiting.turnOf.get(`${String(item.task_id)}:${column}`) : void 0;
20134
+ const turn = recorded?.turn ?? ringing?.turn;
20135
+ const rangAt = !open ? NaN : recorded === void 0 ? Date.parse(ringing?.rangAt ?? "") : waiting.ids.has(recorded.turn) ? Date.parse(recorded.ringAt) : NaN;
20136
+ const fields = inboxNoSessionSchema.safeParse({
20137
+ project,
20138
+ column,
20139
+ ...spurProject === void 0 ? {} : { spurProject },
20140
+ oldestTask: task,
20141
+ since: new Date(since).toISOString(),
20142
+ ...open ? { waiting: waiting.count.get(`${project}:${column}`) ?? 0 } : {},
20143
+ ...turn === void 0 ? {} : { oldestTurn: `T${String(turn)}` },
20144
+ ...Number.isNaN(rangAt) ? {} : { oldestAt: new Date(rangAt).toISOString() }
20145
+ });
20146
+ return fields.success ? fields.data : void 0;
20147
+ }
20027
20148
  // ../core/src/app/operator-inbox.ts
20028
20149
  /** How far back `handled` reaches, and how many entries it keeps. */
20029
20150
  const HANDLED_WINDOW_MS = 864e5;
@@ -20158,50 +20279,6 @@ function sourceText(item, state) {
20158
20279
  action: `check ${thing}`
20159
20280
  };
20160
20281
  }
20161
- /** The board project and column a `no-session:<project>:<column>` key names. */
20162
- function noSessionColumn(key) {
20163
- const rest = key.slice(11);
20164
- const last = rest.lastIndexOf(":");
20165
- return {
20166
- project: rest.slice(0, last),
20167
- column: rest.slice(last + 1)
20168
- };
20169
- }
20170
- /**
20171
- * Untaken orchestrator turns of non-archived tasks with a ringing turn notification, as the
20172
- * reconcile counts them, by `<project>:<column>`: one batched read, run only when an open
20173
- * `no-session:` item is listed.
20174
- */
20175
- async function waitingTurns(trx, items) {
20176
- if (!items.some((item) => item.item_key.startsWith("no-session:"))) return /* @__PURE__ */ new Map();
20177
- const rows = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").select([
20178
- "task.project",
20179
- "turn.column",
20180
- (eb) => eb.fn.count("turn.id").as("waiting")
20181
- ]).where("task.membership", "!=", "archived").where("turn.closed_at", "is", null).where("turn.acked_at", "is", null).where(sql`turn.role = 'orchestrator:' || turn."column"`).where((eb) => eb.exists(eb.selectFrom("notification").select("notification.id").whereRef("notification.turn_id", "=", "turn.id").where("notification.kind", "=", "turn").where("notification.acked_at", "is", null).where("notification.exhausted_at", "is", null))).groupBy(["task.project", "turn.column"]).execute();
20182
- return new Map(rows.map((row) => [`${row.project}:${row.column}`, row.waiting]));
20183
- }
20184
- /**
20185
- * The text of a `no-session:` item: while open, its stored text with the waiting turns and the
20186
- * whole minutes since `fact_at` read now; a cleared one keeps its stored text. The action names
20187
- * the column's Spur project.
20188
- */
20189
- function noSessionText(item, config, waiting, now) {
20190
- const { project, column } = noSessionColumn(item.item_key);
20191
- const spur = columnTurnTimings(config, project, column)?.orchestrator;
20192
- const action = `start a session in ${spur === void 0 ? "its Spur project" : `Spur project ${spur}`}, or take over its turns with board inbox ack`;
20193
- const since = item.fact_at === null ? NaN : Date.parse(item.fact_at);
20194
- if (item.cleared_at !== null || Number.isNaN(since)) return {
20195
- condition: item.text,
20196
- action
20197
- };
20198
- const minutes = Math.max(0, Math.floor((now - since) / 6e4));
20199
- const count = waiting.get(`${project}:${column}`) ?? 0;
20200
- return {
20201
- condition: `${item.text}; ${String(count)} waiting, no live session for ${String(minutes)} min`,
20202
- action
20203
- };
20204
- }
20205
20282
  const ENDED_TURN_KEY = "ended-turn:";
20206
20283
  /** The turn id an `ended-turn:<turnId>:<session>` key names. */
20207
20284
  const endedTurnId = (key) => Number(key.slice(11).split(":")[0]);
@@ -20302,7 +20379,8 @@ function createOperatorInbox(deps) {
20302
20379
  const subject = subjects.get(item.id);
20303
20380
  const task = subject?.task ?? null;
20304
20381
  if (task?.membership === "archived") return void 0;
20305
- const { condition, action } = item.item_key.startsWith("source:") ? sourceText(item, sourceById.get(item.item_key.slice(7))) : kind === "board_observation" && item.item_key.startsWith("no-session:") ? noSessionText(item, config, waiting, clock.now()) : {
20382
+ const noSession = kind === "board_observation" && item.item_key.startsWith("no-session:");
20383
+ const { condition, action } = item.item_key.startsWith("source:") ? sourceText(item, sourceById.get(item.item_key.slice(7))) : noSession ? noSessionText(item, config, waiting, clock.now()) : {
20306
20384
  condition: item.text,
20307
20385
  action: ACTIONS[kind](item, {
20308
20386
  block,
@@ -20311,6 +20389,7 @@ function createOperatorInbox(deps) {
20311
20389
  })
20312
20390
  };
20313
20391
  const url = itemUrl(item, deliveries);
20392
+ const fields = noSession ? noSessionFields(item, task?.key, config, waiting) : void 0;
20314
20393
  return {
20315
20394
  id: `I${String(item.id)}`,
20316
20395
  project: subject?.project ?? "_board",
@@ -20321,6 +20400,7 @@ function createOperatorInbox(deps) {
20321
20400
  at: item.raised_at,
20322
20401
  task: task?.key ?? null,
20323
20402
  ...url === void 0 ? {} : { url },
20403
+ ...fields === void 0 ? {} : { noSession: fields },
20324
20404
  ...item.cleared_at === null ? {} : { handledAt: item.cleared_at }
20325
20405
  };
20326
20406
  };
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { lt as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-DlNdkguO.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-BHROPjEZ.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-C7H6hp1r.mjs";
1
+ import { p as OPERATIONS, ut as ERRORS, y as renderMcpError } from "./chunk-Cly2ejBA.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-PSohvh-P.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-Bhv5wzSj.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";