spur-board 0.78.0 → 0.79.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.
@@ -2080,7 +2080,9 @@ const eventPayloadSchemas = {
2080
2080
  turn: S.optional(),
2081
2081
  block: S.optional(),
2082
2082
  reason: z.enum(MOVE_REASONS).optional(),
2083
- gate: z.array(z.enum(GATE_REASONS)).optional()
2083
+ gate: z.array(z.enum(GATE_REASONS)).optional(),
2084
+ /** Number of review findings a return sent, when the returner gave it. */
2085
+ findings: z.int().min(0).optional()
2084
2086
  }),
2085
2087
  task_shadow_moved: z.looseObject({
2086
2088
  from: z.enum(COLUMN_IDS),
@@ -2575,6 +2577,22 @@ const taskTurnSchema = turnViewSchema.pick({
2575
2577
  at: z.iso.datetime().describe("When the turn closed, ISO 8601 UTC."),
2576
2578
  outcome: z.enum(TURN_OUTCOMES).describe("How the turn closed; turns closed by a return or a mode switch before those were recorded read moved.")
2577
2579
  }).nullable().describe("How and when the turn closed; null while it is open.") }).describe("A task's turn: the executor of a column is asked to act on it.");
2580
+ const omittedTurnDetail = "Always omitted by status.get, even with detail=true; use task.get --why or inbox.get for details.";
2581
+ /** A turn as a `status.get` row shows it: no feedback, return context or threads. */
2582
+ const statusTurnSchema = turnViewSchema.omit({ handed: true }).extend({
2583
+ returned: turnViewSchema.shape.returned.describe(omittedTurnDetail),
2584
+ threads: turnViewSchema.shape.threads.describe(omittedTurnDetail),
2585
+ addressedTo: z.string().nullable().describe("Newest assigned recipient session of an untaken turn; null when taken or unassigned."),
2586
+ stalledSince: z.iso.datetime().nullable().describe("When the executor stall on this turn began, ISO 8601 UTC, while its stall block is open; null otherwise.")
2587
+ }).describe("Unclosed turn without feedback, return context or thread details.");
2588
+ /** The return a `status.get` task row shows while the task stays in Dev after it. */
2589
+ const statusReturnedSchema = z.strictObject({
2590
+ from: z.enum(COLUMN_IDS).describe("Column the task was returned from."),
2591
+ at: z.iso.datetime().describe("When the task was returned, ISO 8601 UTC."),
2592
+ by: actorIdSchema.describe("Who returned the task to Dev."),
2593
+ block: blockIdSchema.describe("The code block the return opened."),
2594
+ findings: z.int().min(0).nullable().describe("Number of review findings the return sent; null when not given.")
2595
+ });
2578
2596
  //#endregion
2579
2597
  //#region ../contracts/src/ops/schemas.ts
2580
2598
  /**
@@ -2695,12 +2713,6 @@ const linkViewSchema = z.strictObject({
2695
2713
  }).describe("An effective link to a task.");
2696
2714
  const detailOnly = "Present only with detail.";
2697
2715
  const count = (what) => z.int().min(0).describe(what);
2698
- const omittedTurnDetail = "Always omitted by status.get, even with detail=true; use task.get --why or inbox.get for details.";
2699
- const statusTurnSchema = turnViewSchema.omit({ handed: true }).extend({
2700
- returned: turnViewSchema.shape.returned.describe(omittedTurnDetail),
2701
- threads: turnViewSchema.shape.threads.describe(omittedTurnDetail),
2702
- addressedTo: z.string().nullable().describe("Newest assigned recipient session of an untaken turn; null when taken or unassigned.")
2703
- }).describe("Unclosed turn without feedback, return context or thread details.");
2704
2716
  const prSummarySchema = z.strictObject({
2705
2717
  repo: prFactsSchema.shape.repo,
2706
2718
  number: prFactsSchema.shape.number,
@@ -2729,6 +2741,12 @@ const statusTaskSchema = taskViewSchema.extend({
2729
2741
  prCount: count("Number of effective pull request links."),
2730
2742
  sessionCount: count("Number of effective session links."),
2731
2743
  openBlocks: count("Number of open blocks on the task."),
2744
+ blocks: z.array(z.strictObject({
2745
+ id: blockIdSchema,
2746
+ addressee: blockViewSchema.shape.addressee,
2747
+ session: z.string().min(1).nullable().describe("Session the newest block notification for the addressee went to; null for the operator or before assignment.")
2748
+ }).describe("One open block.")).describe("Open blocks on the task, oldest first, without their text."),
2749
+ returned: statusReturnedSchema.optional().describe("The return that put the task in Dev. Present only while the task stays in Dev after the return and before its next submit."),
2732
2750
  ticket: ticketFactsSchema.nullable().optional().describe(`Latest ticket facts, or null before observation. ${detailOnly}`),
2733
2751
  prs: z.array(prFactsSchema).optional().describe(`Latest facts for linked pull requests. ${detailOnly}`),
2734
2752
  sessions: z.array(statusSessionFactsSchema).optional().describe(`Latest facts for linked sessions. ${detailOnly}`),
@@ -2877,7 +2895,12 @@ const statusOutputSchema = z.strictObject({
2877
2895
  unlinkedSessions: z.array(statusUnlinkedSessionSchema).describe("Observed sessions without a task link; ones ended, or gone from Spur's session list, for over 7 days are left out."),
2878
2896
  hiddenUnlinkedPrs: z.int().min(0).describe("Unlinked pull requests not listed: merged or closed, with no change for over 7 days. Counted within the requested projects; detail does not list them."),
2879
2897
  hiddenUnlinkedSessions: z.int().min(0).describe("Unlinked sessions not listed: ended, or gone from Spur's session list, for over 7 days. Counted within the requested projects; detail does not list them."),
2880
- bindings: statusBindingsSchema
2898
+ bindings: statusBindingsSchema,
2899
+ daemon: z.strictObject({
2900
+ version: z.string().min(1).describe("Product version of the running daemon."),
2901
+ startedAt: z.iso.datetime().describe("When the daemon started, ISO 8601 UTC."),
2902
+ lastDispatchAt: z.iso.datetime().nullable().describe("When the last completed board tick (dispatch pass) ended, ISO 8601 UTC; null until the first tick after start.")
2903
+ }).describe("The running daemon: version, start time and last completed tick.")
2881
2904
  });
2882
2905
  const commentAddInputSchema = z.strictObject({
2883
2906
  task: taskKeyInputSchema,
@@ -2896,28 +2919,34 @@ const blockAnswerOutputSchema = z.strictObject({
2896
2919
  });
2897
2920
  //#endregion
2898
2921
  //#region ../contracts/src/ops/config-view-schema.ts
2899
- const configViewSchema = z.strictObject({ projects: z.array(z.strictObject({
2900
- id: z.string().min(1).describe("Board project ID."),
2901
- columns: z.array(z.strictObject({
2902
- id: z.enum(COLUMN_IDS).describe("Enabled column in canonical order."),
2903
- executor: z.strictObject({
2904
- kind: z.enum([
2905
- "dispatcher",
2906
- "worker",
2907
- "orchestrator",
2908
- "curator",
2909
- "operator"
2910
- ]).describe("Configured executor; worker falls back to operator without a live worker."),
2911
- name: z.string().nullable().describe("Named Spur project, or null for automatic routing.")
2912
- }).describe("Effective column executor.")
2913
- })).describe("Enabled board columns."),
2914
- dispatcher: z.strictObject({ mode: z.enum(DISPATCHER_MODES).describe("Effective dispatcher mode.") }).describe("Dispatcher configuration."),
2915
- spurProjects: z.array(z.strictObject({
2916
- name: z.string().min(1).describe("Spur project name."),
2917
- role: configSchema.shape.projects.element.shape.spurProjects.unwrap().element.shape.role,
2918
- displayName: z.string().min(1).describe("Configured display name, falling back to project name.")
2919
- })).describe("Effective Spur project bindings.")
2920
- })).describe("Effective projects visible to this caller.") }).describe("Allowlisted effective configuration without credentials or adapter settings.");
2922
+ const configViewSchema = z.strictObject({
2923
+ projects: z.array(z.strictObject({
2924
+ id: z.string().min(1).describe("Board project ID."),
2925
+ columns: z.array(z.strictObject({
2926
+ id: z.enum(COLUMN_IDS).describe("Enabled column in canonical order."),
2927
+ executor: z.strictObject({
2928
+ kind: z.enum([
2929
+ "dispatcher",
2930
+ "worker",
2931
+ "orchestrator",
2932
+ "curator",
2933
+ "operator"
2934
+ ]).describe("Configured executor; worker falls back to operator without a live worker."),
2935
+ name: z.string().nullable().describe("Named Spur project, or null for automatic routing.")
2936
+ }).describe("Effective column executor.")
2937
+ })).describe("Enabled board columns."),
2938
+ dispatcher: z.strictObject({ mode: z.enum(DISPATCHER_MODES).describe("Effective dispatcher mode.") }).describe("Dispatcher configuration."),
2939
+ spurProjects: z.array(z.strictObject({
2940
+ name: z.string().min(1).describe("Spur project name."),
2941
+ role: configSchema.shape.projects.element.shape.spurProjects.unwrap().element.shape.role,
2942
+ displayName: z.string().min(1).describe("Configured display name, falling back to project name.")
2943
+ })).describe("Effective Spur project bindings.")
2944
+ })).describe("Effective projects visible to this caller."),
2945
+ web: z.strictObject({
2946
+ publicOrigin: z.url({ protocol: /^https?$/ }).nullable().describe("Origin the board web listener answers on; null when the listener is off or not bound yet."),
2947
+ spurUiOrigin: z.url({ protocol: /^https?$/ }).nullable().describe("Origin of the Spur web UI clients link sessions to; null when not configured.")
2948
+ }).describe("Web origins of the board listener and the Spur UI.")
2949
+ }).describe("Allowlisted effective configuration without credentials or adapter settings.");
2921
2950
  //#endregion
2922
2951
  //#region ../contracts/src/ops/inbox-schemas.ts
2923
2952
  /** One entry of the operator inbox: an operator item, a block addressed to the operator or a turn. */
@@ -2991,6 +3020,11 @@ const linkModes = [
2991
3020
  }
2992
3021
  ];
2993
3022
  const at = "2026-01-05T09:30:00.000Z";
3023
+ const daemon = {
3024
+ version: "0.4.0",
3025
+ startedAt: "2026-01-05T08:00:00.000Z",
3026
+ lastDispatchAt: at
3027
+ };
2994
3028
  const task = {
2995
3029
  key: "PROJ-123",
2996
3030
  project: "web",
@@ -3216,6 +3250,7 @@ const OPERATIONS = [
3216
3250
  prCount: 0,
3217
3251
  sessionCount: 0,
3218
3252
  openBlocks: 0,
3253
+ blocks: [],
3219
3254
  turn: null,
3220
3255
  prSummary: null,
3221
3256
  links: {
@@ -3248,7 +3283,8 @@ const OPERATIONS = [
3248
3283
  spurProject: "hq",
3249
3284
  source: "board-wide"
3250
3285
  }
3251
- }
3286
+ },
3287
+ daemon
3252
3288
  }
3253
3289
  }, {
3254
3290
  summary: "Show the board with full facts and links",
@@ -3266,6 +3302,7 @@ const OPERATIONS = [
3266
3302
  prCount: 0,
3267
3303
  sessionCount: 0,
3268
3304
  openBlocks: 0,
3305
+ blocks: [],
3269
3306
  turn: null,
3270
3307
  prSummary: null,
3271
3308
  links: {
@@ -3289,7 +3326,8 @@ const OPERATIONS = [
3289
3326
  columns: [],
3290
3327
  operators: [],
3291
3328
  defaultAddressee: null
3292
- }
3329
+ },
3330
+ daemon
3293
3331
  }
3294
3332
  }]
3295
3333
  }),
@@ -4484,14 +4522,15 @@ const OPERATIONS = [
4484
4522
  defineOperation({
4485
4523
  id: "task.return",
4486
4524
  kind: "mutation",
4487
- description: "Return the task of a turn this session took to Dev, opening a code block on the worker with the reason.",
4525
+ description: "Return the task of a turn this session took to Dev; the reason opens a worker code block.",
4488
4526
  mcp: {
4489
- whenToUse: "Send the task back to Dev because the work needs code changes.",
4527
+ whenToUse: "Send the task back to Dev when the work needs code changes.",
4490
4528
  whenNotToUse: "Use task_submit to hand in the work instead."
4491
4529
  },
4492
4530
  input: z.strictObject({
4493
4531
  turn: turnIdSchema,
4494
- reason: text("What the worker must change, sent to the worker as a code block.", TEXT_MAX)
4532
+ reason: text("What the worker must change, sent to the worker as a code block.", TEXT_MAX),
4533
+ findings: z.int().min(0).optional().describe("Number of review findings the return sends; shown on the task's status row.")
4495
4534
  }),
4496
4535
  output: z.strictObject({
4497
4536
  task: taskViewSchema,
@@ -4526,6 +4565,22 @@ const OPERATIONS = [
4526
4565
  reason: "Handle the empty list in the parser."
4527
4566
  }
4528
4567
  }
4568
+ }, {
4569
+ summary: "Return a reviewed task to Dev with the number of findings",
4570
+ input: {
4571
+ turn: "T4",
4572
+ reason: "Fix the two review findings.",
4573
+ findings: 2
4574
+ },
4575
+ output: {
4576
+ task,
4577
+ block: {
4578
+ ...codeBlock,
4579
+ id: "B14",
4580
+ author: "agent:rev/rev-1",
4581
+ reason: "Fix the two review findings."
4582
+ }
4583
+ }
4529
4584
  }]
4530
4585
  }),
4531
4586
  defineOperation({
@@ -4611,7 +4666,7 @@ const OPERATIONS = [
4611
4666
  id: "config.get",
4612
4667
  web: true,
4613
4668
  kind: "query",
4614
- description: "Show effective project columns, executors and Spur bindings.",
4669
+ description: "Show effective project columns, executors, Spur bindings and web origins.",
4615
4670
  mcp: {
4616
4671
  whenToUse: "Read configuration before rendering the Board overview.",
4617
4672
  whenNotToUse: "Use status_get for task state and freshness."
@@ -4628,22 +4683,28 @@ const OPERATIONS = [
4628
4683
  examples: [{
4629
4684
  summary: "Show effective configuration",
4630
4685
  input: {},
4631
- output: { projects: [{
4632
- id: "web",
4633
- columns: [{
4634
- id: "dev",
4635
- executor: {
4636
- kind: "worker",
4637
- name: null
4638
- }
4686
+ output: {
4687
+ projects: [{
4688
+ id: "web",
4689
+ columns: [{
4690
+ id: "dev",
4691
+ executor: {
4692
+ kind: "worker",
4693
+ name: null
4694
+ }
4695
+ }],
4696
+ dispatcher: { mode: "on" },
4697
+ spurProjects: [{
4698
+ name: "web-worker",
4699
+ role: "worker",
4700
+ displayName: "web-worker"
4701
+ }]
4639
4702
  }],
4640
- dispatcher: { mode: "on" },
4641
- spurProjects: [{
4642
- name: "web-worker",
4643
- role: "worker",
4644
- displayName: "web-worker"
4645
- }]
4646
- }] }
4703
+ web: {
4704
+ publicOrigin: "http://127.0.0.1:4778",
4705
+ spurUiOrigin: null
4706
+ }
4707
+ }
4647
4708
  }]
4648
4709
  })
4649
4710
  ];
@@ -1,4 +1,4 @@
1
- import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-7XUx0JWq.mjs";
1
+ import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-BN-Cz4Ql.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, ft as configSchema, mt as plainHttpAllowed, p as OPERATIONS } from "./chunk-7XUx0JWq.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-C06XgrL3.mjs";
1
+ import { d as buildCatalogSnapshot, ft as configSchema, mt as plainHttpAllowed, p as OPERATIONS } from "./chunk-BN-Cz4Ql.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-D9dHqOgX.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/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { Q as ERRORS, a as requestHashOf, bt as SLACK_BOT_SCOPES, ct as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, ht as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-7XUx0JWq.mjs";
1
+ import { Q as ERRORS, a as requestHashOf, bt as SLACK_BOT_SCOPES, ct as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, ht as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-BN-Cz4Ql.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-DAMwWWmT.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-C06XgrL3.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-Ck64u-eo.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-D9dHqOgX.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-DncwJ_X0.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,2 +1,2 @@
1
- import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-C06XgrL3.mjs";
1
+ import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-D9dHqOgX.mjs";
2
2
  export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, St as VIAS, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as COLUMN_IDS, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, bt as SLACK_BOT_SCOPES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as configBindings, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, h as renderHttpProblem, ht as requiredSecretKeys, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as RESERVED_PROJECT, m as turnHandedSchema, mt as plainHttpAllowed, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as defaultAddressee, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as boardWideSpurProject, v as SPACE_IDS, vt as DISPATCHER_MODES, w as EVENT_KINDS, x as interactionRefSchema, xt as TASK_HOLDS, y as conversationRefSchema, yt as ITEM_KINDS, z as parseRingMarker } from "./chunk-7XUx0JWq.mjs";
1
+ import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, St as VIAS, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as COLUMN_IDS, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, bt as SLACK_BOT_SCOPES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as configBindings, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, h as renderHttpProblem, ht as requiredSecretKeys, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as RESERVED_PROJECT, m as turnHandedSchema, mt as plainHttpAllowed, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as defaultAddressee, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as boardWideSpurProject, v as SPACE_IDS, vt as DISPATCHER_MODES, w as EVENT_KINDS, x as interactionRefSchema, xt as TASK_HOLDS, y as conversationRefSchema, yt as ITEM_KINDS, z as parseRingMarker } from "./chunk-BN-Cz4Ql.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -14284,7 +14284,7 @@ async function readStatusTurns(db, projectIds) {
14284
14284
  "turn.created_at",
14285
14285
  "turn.acked_by",
14286
14286
  "turn.acked_at"
14287
- ]).select(["task.key as task_key", "notification.recipient_session"]).where("turn.closed_at", "is", null).where("task.membership", "!=", "archived").where("task.project", "in", [...projectIds]).execute();
14287
+ ]).select(["task.key as task_key", "notification.recipient_session"]).select((eb) => eb.selectFrom("operator_item").select((eb) => eb.fn.min("operator_item.fact_at").as("fact_at")).where("operator_item.cleared_at", "is", null).where("operator_item.item_key", ">=", sql`'turn-stall:' || ${sql.ref("turn.id")} || ':'`).where("operator_item.item_key", "<", sql`'turn-stall:' || ${sql.ref("turn.id")} || ';'`).as("stalled_since")).where("turn.closed_at", "is", null).where("task.membership", "!=", "archived").where("task.project", "in", [...projectIds]).execute();
14288
14288
  return new Map(turnRows.map((turn) => [turn.task_id, {
14289
14289
  id: `T${String(turn.id)}`,
14290
14290
  task: turn.task_key,
@@ -14297,9 +14297,65 @@ async function readStatusTurns(db, projectIds) {
14297
14297
  by: turn.acked_by,
14298
14298
  at: turn.acked_at
14299
14299
  },
14300
- addressedTo: turn.acked_at === null ? turn.recipient_session : null
14300
+ addressedTo: turn.acked_at === null ? turn.recipient_session : null,
14301
+ stalledSince: turn.stalled_since
14301
14302
  }]));
14302
14303
  }
14304
+ /**
14305
+ * Load the return marker of each visible Dev task once for the page: set while the newest column
14306
+ * change of the task (a move, a non-shadow correction, a submit or an add) is the `task.return`
14307
+ * move into Dev, which journals its turn and block.
14308
+ */
14309
+ async function readStatusReturns(db, projectIds) {
14310
+ const rows = await db.selectFrom("task").innerJoin("event", (join) => join.onRef("event.task_id", "=", "task.id").on("event.id", "=", (eb) => eb.selectFrom("event as newest").select("newest.id").whereRef("newest.task_id", "=", "task.id").where((eb) => eb.or([eb("newest.kind", "in", [
14311
+ "task_moved",
14312
+ "task_submitted",
14313
+ "task_added"
14314
+ ]), eb.and([eb("newest.kind", "=", "task_corrected"), eb(sql`coalesce(json_extract(newest.payload, '$.shadow'), 0)`, "=", 0)])])).orderBy("newest.id", "desc").limit(1))).select([
14315
+ "task.id as task_id",
14316
+ "event.at",
14317
+ "event.actor",
14318
+ "event.actor_ref",
14319
+ "event.payload"
14320
+ ]).where("task.column", "=", "dev").where("task.membership", "!=", "archived").where("task.project", "in", [...projectIds]).where("event.kind", "=", "task_moved").execute();
14321
+ const returns = /* @__PURE__ */ new Map();
14322
+ for (const row of rows) {
14323
+ const parsed = eventPayloadSchemas.task_moved.safeParse(JSON.parse(row.payload));
14324
+ if (!parsed.success) continue;
14325
+ const { from, to, turn, block, findings } = parsed.data;
14326
+ if (turn === void 0 || block === void 0 || to !== "dev") continue;
14327
+ returns.set(row.task_id, {
14328
+ from,
14329
+ at: row.at,
14330
+ by: eventActor(row),
14331
+ block,
14332
+ findings: findings ?? null
14333
+ });
14334
+ }
14335
+ return returns;
14336
+ }
14337
+ /**
14338
+ * Load the open blocks of visible tasks once for the page, oldest first, each with the session
14339
+ * the newest block notification for its current addressee role went to.
14340
+ */
14341
+ async function readStatusBlocks(db, projectIds) {
14342
+ const rows = await db.selectFrom("block").innerJoin("task", "task.id", "block.task_id").leftJoin("notification", (join) => join.onRef("notification.block_id", "=", "block.id").on("notification.kind", "=", "block").onRef("notification.role", "=", "block.addressee_role").on("notification.id", "=", (eb) => eb.selectFrom("notification as newest").select((eb) => eb.fn.max("newest.id").as("id")).whereRef("newest.block_id", "=", "block.id").where("newest.kind", "=", "block").whereRef("newest.role", "=", "block.addressee_role"))).select([
14343
+ "block.id",
14344
+ "task.id as task_id",
14345
+ "block.addressee_role"
14346
+ ]).select("notification.recipient_session").where("block.state", "=", "open").where("task.membership", "!=", "archived").where("task.project", "in", [...projectIds]).orderBy("block.id").execute();
14347
+ const blocks = /* @__PURE__ */ new Map();
14348
+ for (const row of rows) {
14349
+ const list = blocks.get(row.task_id) ?? [];
14350
+ list.push({
14351
+ id: `B${String(row.id)}`,
14352
+ addressee: row.addressee_role,
14353
+ session: row.addressee_role === "operator" ? null : row.recipient_session
14354
+ });
14355
+ blocks.set(row.task_id, list);
14356
+ }
14357
+ return blocks;
14358
+ }
14303
14359
  //#endregion
14304
14360
  //#region ../core/src/app/status.ts
14305
14361
  function sessionView(fact) {
@@ -14362,6 +14418,11 @@ function interval(config, source) {
14362
14418
  /** Reads the board's latest facts, items and source availability. */
14363
14419
  async function getStatus(deps, options = {}) {
14364
14420
  const { store, config, clock, completeSince, gateways = [] } = deps;
14421
+ const daemon = deps.daemon ?? {
14422
+ version: "unknown",
14423
+ startedAt: new Date(clock.now()).toISOString(),
14424
+ lastDispatchAt: null
14425
+ };
14365
14426
  const { project: projectId, visibleProjects, detail = false } = options;
14366
14427
  const includeBoardItems = options.includeBoardItems ?? visibleProjects === void 0;
14367
14428
  const operatorProjects = options.operatorProjects ?? /* @__PURE__ */ new Set();
@@ -14369,8 +14430,7 @@ async function getStatus(deps, options = {}) {
14369
14430
  if (projects.length === 0) throw new CommandError("not_found", "Check the project ID.");
14370
14431
  const projectIds = new Set(projects.map((project) => project.id));
14371
14432
  const rows = await store.db.selectFrom("task").selectAll().where("membership", "!=", "archived").execute();
14372
- const blockRows = await store.db.selectFrom("block").select(["task_id", (eb) => eb.fn.countAll().as("open")]).where("state", "=", "open").groupBy("task_id").execute();
14373
- const openBlocks = new Map(blockRows.map((row) => [row.task_id, row.open]));
14433
+ const openBlocks = await readStatusBlocks(store.db, projectIds);
14374
14434
  const projectBlockRows = await store.db.selectFrom("block").select(["project", (eb) => eb.fn.countAll().as("open")]).where("state", "=", "open").where("task_id", "is", null).groupBy("project").execute();
14375
14435
  const openProjectBlocks = new Map(projectBlockRows.map((row) => [row.project, row.open]));
14376
14436
  const projectBlocks = projects.map((project) => ({
@@ -14380,6 +14440,7 @@ async function getStatus(deps, options = {}) {
14380
14440
  const sourceRows = await store.db.selectFrom("source_state").selectAll().execute();
14381
14441
  const sourceById = new Map(sourceRows.map((row) => [row.source, row]));
14382
14442
  const turns = await readStatusTurns(store.db, projectIds);
14443
+ const returns = await readStatusReturns(store.db, projectIds);
14383
14444
  const tasks = [];
14384
14445
  for (const task of rows) {
14385
14446
  if (!projectIds.has(task.project)) continue;
@@ -14427,6 +14488,8 @@ async function getStatus(deps, options = {}) {
14427
14488
  if (parseJson(prFactsSchema, snapshot.detail).ticketKeys.some((key) => key.toLowerCase() === task.key.toLowerCase())) continue;
14428
14489
  linkHints.push(`Session ${session.id} has PR ${pr.repo}#${String(pr.number)}, but the link rules give it no link to this task; check projects[].link in config.yaml.`);
14429
14490
  }
14491
+ const blocks = openBlocks.get(task.id) ?? [];
14492
+ const returned = returns.get(task.id);
14430
14493
  tasks.push({
14431
14494
  key: task.key,
14432
14495
  project: task.project,
@@ -14439,7 +14502,9 @@ async function getStatus(deps, options = {}) {
14439
14502
  state: taskState(ticketFacts, prs, sessionStates),
14440
14503
  prCount: links.filter((link) => link.entity === "pr").length,
14441
14504
  sessionCount: links.filter((link) => link.entity === "session").length,
14442
- openBlocks: openBlocks.get(task.id) ?? 0,
14505
+ openBlocks: blocks.length,
14506
+ blocks,
14507
+ ...returned === void 0 ? {} : { returned },
14443
14508
  turn: turns.get(task.id) ?? null,
14444
14509
  prSummary: summaries.length === 0 ? null : summaries,
14445
14510
  links: {
@@ -14598,7 +14663,8 @@ async function getStatus(deps, options = {}) {
14598
14663
  unlinkedSessions,
14599
14664
  hiddenUnlinkedPrs: prRows.length - unlinkedPrs.length,
14600
14665
  hiddenUnlinkedSessions: sessionRows.length - unlinkedSessions.length,
14601
- bindings: configBindings(config, projectIds)
14666
+ bindings: configBindings(config, projectIds),
14667
+ daemon
14602
14668
  };
14603
14669
  }
14604
14670
  const HOLD_ONLY = /* @__PURE__ */ new Set([
@@ -15973,7 +16039,7 @@ async function voidSubmits(trx, taskId, to, at) {
15973
16039
  * `limitReached` tells the dispatcher to stop the cascade.
15974
16040
  */
15975
16041
  async function moveLeft(trx, input) {
15976
- const { task, to, at, actor, config, turn, block, reason, gate } = input;
16042
+ const { task, to, at, actor, config, turn, block, reason, gate, findings } = input;
15977
16043
  const moved = await trx.updateTable("task").set({
15978
16044
  column: to,
15979
16045
  column_epoch: task.column_epoch + 1,
@@ -15992,7 +16058,8 @@ async function moveLeft(trx, input) {
15992
16058
  ...turn === void 0 ? {} : { turn },
15993
16059
  ...block === void 0 ? {} : { block },
15994
16060
  ...reason === void 0 ? {} : { reason },
15995
- ...gate === void 0 ? {} : { gate: [...gate] }
16061
+ ...gate === void 0 ? {} : { gate: [...gate] },
16062
+ ...findings === void 0 ? {} : { findings }
15996
16063
  }, actor);
15997
16064
  const project = config.projects.find((entry) => entry.id === task.project);
15998
16065
  const column = project?.columns.find((entry) => entry.id === task.column);
@@ -17402,7 +17469,8 @@ function createTurnMutations(deps) {
17402
17469
  actor: ctx.actor,
17403
17470
  config,
17404
17471
  turn: turnLabel(turn.id),
17405
- block: `B${String(block.id)}`
17472
+ block: `B${String(block.id)}`,
17473
+ findings: input.findings
17406
17474
  });
17407
17475
  const moved = await dispatched(trx, task.id, ctx.at, ctx.actor);
17408
17476
  return {
@@ -17452,6 +17520,10 @@ const catalog = await buildCatalogSnapshot(OPERATIONS);
17452
17520
  /** Concrete handlers shared by the daemon's HTTP and inbound transports. */
17453
17521
  function createOperationRegistry(deps) {
17454
17522
  const { config, clock, completeSince, gateways } = deps;
17523
+ const startedAt = new Date(clock.now()).toISOString();
17524
+ const productVersion = deps.productVersion ?? "unknown";
17525
+ const lastDispatchAt = deps.lastDispatchAt ?? (() => null);
17526
+ const webOrigin = deps.webOrigin ?? (() => config.web.port === 0 ? void 0 : resolveWebOrigin(config.web));
17455
17527
  const items = createItemMutations(deps);
17456
17528
  const membership = createMembershipMutations(config);
17457
17529
  const links = createLinkMutations(config, { prPoller: deps.prPoller });
@@ -17510,7 +17582,12 @@ function createOperationRegistry(deps) {
17510
17582
  config,
17511
17583
  clock,
17512
17584
  completeSince,
17513
- gateways
17585
+ gateways,
17586
+ daemon: {
17587
+ version: productVersion,
17588
+ startedAt,
17589
+ lastDispatchAt: lastDispatchAt()
17590
+ }
17514
17591
  }, {
17515
17592
  project: input.project,
17516
17593
  visibleProjects: visibleProjects(config, actor),
@@ -17533,25 +17610,31 @@ function createOperationRegistry(deps) {
17533
17610
  },
17534
17611
  run(_trx, input, actor) {
17535
17612
  const visible = visibleProjects(config, actor);
17536
- return Promise.resolve({ projects: config.projects.filter((project) => visible.has(project.id) && (input.project === void 0 || input.project === project.id)).map((project) => ({
17537
- id: project.id,
17538
- columns: project.columns.filter((column) => column.enabled).map((column) => {
17539
- const named = column.orchestrator === "none" || column.orchestrator === "operator" ? void 0 : project.spurProjects.find((spur) => spur.name === column.orchestrator);
17540
- return {
17541
- id: column.id,
17542
- executor: {
17543
- kind: column.orchestrator === "operator" ? "operator" : named?.role === "curator" ? "curator" : named !== void 0 ? "orchestrator" : column.id === "external-review" ? "dispatcher" : "worker",
17544
- name: named?.name ?? null
17545
- }
17546
- };
17547
- }),
17548
- dispatcher: { mode: project.dispatcher.mode },
17549
- spurProjects: project.spurProjects.map((spur) => ({
17550
- name: spur.name,
17551
- role: spur.role,
17552
- displayName: spur.displayName ?? spur.name
17553
- }))
17554
- })) });
17613
+ return Promise.resolve({
17614
+ projects: config.projects.filter((project) => visible.has(project.id) && (input.project === void 0 || input.project === project.id)).map((project) => ({
17615
+ id: project.id,
17616
+ columns: project.columns.filter((column) => column.enabled).map((column) => {
17617
+ const named = column.orchestrator === "none" || column.orchestrator === "operator" ? void 0 : project.spurProjects.find((spur) => spur.name === column.orchestrator);
17618
+ return {
17619
+ id: column.id,
17620
+ executor: {
17621
+ kind: column.orchestrator === "operator" ? "operator" : named?.role === "curator" ? "curator" : named !== void 0 ? "orchestrator" : column.id === "external-review" ? "dispatcher" : "worker",
17622
+ name: named?.name ?? null
17623
+ }
17624
+ };
17625
+ }),
17626
+ dispatcher: { mode: project.dispatcher.mode },
17627
+ spurProjects: project.spurProjects.map((spur) => ({
17628
+ name: spur.name,
17629
+ role: spur.role,
17630
+ displayName: spur.displayName ?? spur.name
17631
+ }))
17632
+ })),
17633
+ web: {
17634
+ publicOrigin: webOrigin() ?? null,
17635
+ spurUiOrigin: config.web.spurUiOrigin ?? null
17636
+ }
17637
+ });
17555
17638
  }
17556
17639
  },
17557
17640
  "task.get": taskQueries.get,
@@ -25076,6 +25159,10 @@ const sessionDetailWire = z.object({
25076
25159
  project: z.string().min(1),
25077
25160
  status: z.enum(SESSION_STATUSES)
25078
25161
  });
25162
+ /** Port of an http listener address; URL parsing drops the default port 80, so restore it. */
25163
+ function listenerPort(address) {
25164
+ return Number(new URL(address).port || 80);
25165
+ }
25079
25166
  /** Fetch one session after a snapshot miss; 404 is a confirmed unknown session. */
25080
25167
  async function lookupLiveSession(baseUrl, id, fetcher = fetch) {
25081
25168
  const response = await fetcher(new URL(`sessions/${encodeURIComponent(id)}`, apiBaseUrl(baseUrl)), { signal: AbortSignal.timeout(SESSION_TIMEOUT_MS) });
@@ -25135,7 +25222,7 @@ function createHttpModule(ctx, options = {}) {
25135
25222
  if (aborted()) return;
25136
25223
  options.onListening?.(address);
25137
25224
  app = server;
25138
- ctx.log.info({ port: Number(new URL(address).port) }, "http listening");
25225
+ ctx.log.info({ port: listenerPort(address) }, "http listening");
25139
25226
  } finally {
25140
25227
  if (app !== server) await server.close();
25141
25228
  }
@@ -25186,7 +25273,7 @@ function createWebModule(ctx, options) {
25186
25273
  if (aborted()) return;
25187
25274
  options.onListening?.(address);
25188
25275
  app = server;
25189
- ctx.log.info({ port: Number(new URL(address).port) }, "web listening");
25276
+ ctx.log.info({ port: listenerPort(address) }, "web listening");
25190
25277
  } catch (err) {
25191
25278
  ctx.log.error({
25192
25279
  err,
@@ -25474,13 +25561,18 @@ function createDaemonModules(ctxFor, ports = {}) {
25474
25561
  ctx.log.error({ err }, work === "connection" ? "slack connection event failed" : "slack envelope failed");
25475
25562
  }
25476
25563
  }));
25564
+ let webPort;
25565
+ let lastDispatchAt = null;
25477
25566
  const registry = createOperationRegistry({
25478
25567
  config: board.config,
25479
25568
  clock: board.clock,
25480
25569
  completeSince: core.completeSince,
25481
25570
  gateways: gateway === void 0 ? [] : [gateway.kind],
25482
25571
  reapplyInbound: () => inbound?.reapply,
25483
- prPoller: () => boardModules.pollPr
25572
+ prPoller: () => boardModules.pollPr,
25573
+ ...ports.productVersion === void 0 ? {} : { productVersion: ports.productVersion },
25574
+ lastDispatchAt: () => lastDispatchAt,
25575
+ webOrigin: () => webPort === void 0 ? void 0 : resolveWebOrigin(board.config.web, webPort)
25484
25576
  });
25485
25577
  const notifier = createSystemdNotifier({
25486
25578
  log: ctxFor("systemd").log,
@@ -25519,6 +25611,7 @@ function createDaemonModules(ctxFor, ports = {}) {
25519
25611
  ...ports.startAdapters === void 0 ? {} : { startAdapters: ports.startAdapters },
25520
25612
  ...ports.tick === void 0 ? {} : { tick: ports.tick },
25521
25613
  onTick: () => {
25614
+ lastDispatchAt = new Date(board.clock.now()).toISOString();
25522
25615
  notifier.watchdog();
25523
25616
  }
25524
25617
  });
@@ -25559,7 +25652,10 @@ function createDaemonModules(ctxFor, ports = {}) {
25559
25652
  firstPollDone: () => firstPollDone(board.store.db, board.config, core.completeSince),
25560
25653
  ...ports.afterOperation === void 0 ? {} : { afterOperation: ports.afterOperation },
25561
25654
  ...ports.webRoot === void 0 ? {} : { webRoot: ports.webRoot },
25562
- ...ports.onWebListening === void 0 ? {} : { onListening: ports.onWebListening }
25655
+ onListening: (address) => {
25656
+ webPort = listenerPort(address);
25657
+ ports.onWebListening?.(address);
25658
+ }
25563
25659
  });
25564
25660
  if (web !== void 0) entries.push({
25565
25661
  name: "web",
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-7XUx0JWq.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-C06XgrL3.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-Ck64u-eo.mjs";
1
+ import { Q as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-BN-Cz4Ql.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-D9dHqOgX.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DncwJ_X0.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";