spur-board 0.133.0 → 0.134.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 { Ct as plainHttpAllowed, d as buildCatalogSnapshot, p as OPERATIONS, xt as configSchema } from "./chunk-CcqlB4rN.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-BC8T5XHO.mjs";
1
+ import { Ct as plainHttpAllowed, d as buildCatalogSnapshot, p as OPERATIONS, xt as configSchema } from "./chunk-EIGSWJA9.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-DPzFY26V.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";
@@ -1,4 +1,4 @@
1
- import { _ as renderJsonError, at as ERRORS, c as tokenRequestStatusSchema, ct as errorEnvelopeSchema, o as tokenRequestResultSchema, st as errorContextSchema, ut as successEnvelopeSchema } from "./chunk-CcqlB4rN.mjs";
1
+ import { _ as renderJsonError, at as ERRORS, c as tokenRequestStatusSchema, ct as errorEnvelopeSchema, o as tokenRequestResultSchema, st as errorContextSchema, ut as successEnvelopeSchema } from "./chunk-EIGSWJA9.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
@@ -3140,6 +3140,75 @@ const taskMoveOutputSchema = z.strictObject({
3140
3140
  column: z.enum(COLUMN_IDS).describe("Resulting position; correction uses the shadow position in shadow mode."),
3141
3141
  settled: z.array(moveViewSchema).describe("Dispatcher moves after a correction, oldest first; empty for manual placement.")
3142
3142
  });
3143
+ const inboxAckInputSchema = z.strictObject({ entries: z.array(z.union([
3144
+ z.strictObject({
3145
+ id: commentIdSchema,
3146
+ revision: z.int().positive().describe("Revision the caller read.")
3147
+ }),
3148
+ z.strictObject({ id: blockIdSchema }),
3149
+ z.strictObject({ id: turnIdSchema }),
3150
+ z.strictObject({ id: ringIdSchema })
3151
+ ])).min(1).max(100).describe("Comment revisions, blocks, turns and ring IDs to acknowledge.") });
3152
+ const inboxAckOutputSchema = z.strictObject({
3153
+ acked: z.array(z.union([
3154
+ commentIdSchema,
3155
+ blockIdSchema,
3156
+ turnIdSchema,
3157
+ ringIdSchema
3158
+ ])).describe("Entries now acknowledged."),
3159
+ alreadyHandled: z.array(z.union([
3160
+ commentIdSchema,
3161
+ blockIdSchema,
3162
+ turnIdSchema,
3163
+ ringIdSchema
3164
+ ])).optional().describe("Entries that were already handled; nothing new was acknowledged for them.")
3165
+ });
3166
+ const taskSubmitInputSchema = z.strictObject({
3167
+ turn: z.union([turnIdSchema, taskKeyInputSchema]).describe("Turn ID you took (T4); while the project dispatcher is in shadow mode, the task key instead."),
3168
+ sha: commitShaSchema.max(64).describe("Full commit SHA at the head of the pull request, lowercase."),
3169
+ basis: z.enum(SUBMISSION_BASES).optional().describe("Testing provenance: tested (default), carried from a tested origin on this task, or skipped with a reason."),
3170
+ from: commitShaSchema.max(64).optional().describe("Full lowercase source SHA on this task; required only for carried."),
3171
+ reason: z.string().max(2e3).optional().describe("Literal nonblank explanation, up to 2000 UTF-16 units; required for carried and skipped.")
3172
+ });
3173
+ const taskSubmitOutputSchema = z.strictObject({
3174
+ task: taskViewSchema,
3175
+ turn: turnIdSchema.nullable().describe("The closed turn; null for a submit by task key in shadow mode."),
3176
+ sha: commitShaSchema.describe("The submitted commit SHA."),
3177
+ status: z.enum(["confirmed", "pending"]).default("confirmed").describe("confirmed: the board saw the PR head at sha. pending: accepted, pending confirmation - the board confirms the head on its next polls and hands the turn back with the reason if it cannot; do not resubmit or raise a block.")
3178
+ });
3179
+ const taskReturnInputSchema = z.strictObject({
3180
+ turn: turnIdSchema,
3181
+ reason: z.string().min(1).max(2e4).describe("What the worker must change, sent to the worker as a code block."),
3182
+ findings: z.int().min(0).optional().describe("Number of review findings the return sends; shown on the task's status row.")
3183
+ });
3184
+ const taskReturnOutputSchema = z.strictObject({
3185
+ task: taskViewSchema,
3186
+ block: blockViewSchema
3187
+ });
3188
+ /**
3189
+ * The three writes as `browserOperations` entries (`../browser.ts`), kept beside their schemas: the
3190
+ * web Turn section calls them, and the catalog shares the same schema objects.
3191
+ */
3192
+ const turnWriteOperations = {
3193
+ "inbox.ack": {
3194
+ id: "inbox.ack",
3195
+ kind: "mutation",
3196
+ input: inboxAckInputSchema,
3197
+ output: inboxAckOutputSchema
3198
+ },
3199
+ "task.submit": {
3200
+ id: "task.submit",
3201
+ kind: "mutation",
3202
+ input: taskSubmitInputSchema,
3203
+ output: taskSubmitOutputSchema
3204
+ },
3205
+ "task.return": {
3206
+ id: "task.return",
3207
+ kind: "mutation",
3208
+ input: taskReturnInputSchema,
3209
+ output: taskReturnOutputSchema
3210
+ }
3211
+ };
3143
3212
  // ../contracts/src/ops/config-view-schema.ts
3144
3213
  const configViewSchema = z.strictObject({
3145
3214
  projects: z.array(z.strictObject({
@@ -3414,6 +3483,7 @@ taskHistoryOutputSchema.extend({ events: z.array(taskHistoryEventSchema.extend({
3414
3483
  kind: z.string().min(1),
3415
3484
  via: z.string().min(1).optional()
3416
3485
  })) });
3486
+ ({ ...turnWriteOperations });
3417
3487
  // ../contracts/src/ops/catalog.ts
3418
3488
  /** Longest free text an input takes: comments, questions, answers and reasons. */
3419
3489
  const TEXT_MAX = 2e4;
@@ -3423,8 +3493,6 @@ const NAME_MAX = 256;
3423
3493
  const LEGACY_TOKEN_NAME_MAX = 1048576;
3424
3494
  /** Longest pull request URL or unblock reference an input takes. */
3425
3495
  const REF_MAX = 2048;
3426
- /** Most entries one `inbox.ack` call acknowledges. */
3427
- const ACK_ENTRIES_MAX = 100;
3428
3496
  const project = z.string().min(1).max(NAME_MAX).optional().describe("Project to limit the answer to; absent means every project the caller may see.");
3429
3497
  const text = (what, max) => z.string().min(1).max(max).describe(what);
3430
3498
  const target = z.string().min(1).describe("Pull request, session, or ticket linked to the task.");
@@ -4175,29 +4243,9 @@ const OPERATIONS = [
4175
4243
  whenToUse: "Mark handled inbox items or a ring ID like N18-1 read; an item handled before comes back under alreadyHandled. The operator acks a turn ID to take over an open orchestrator turn, taken or not.",
4176
4244
  whenNotToUse: "Use inbox_get to inspect them first."
4177
4245
  },
4178
- input: z.strictObject({ entries: z.array(z.union([
4179
- z.strictObject({
4180
- id: commentIdSchema,
4181
- revision: z.int().positive().describe("Revision the caller read.")
4182
- }),
4183
- z.strictObject({ id: blockIdSchema }),
4184
- z.strictObject({ id: turnIdSchema }),
4185
- z.strictObject({ id: ringIdSchema })
4186
- ])).min(1).max(ACK_ENTRIES_MAX).describe("Comment revisions, blocks, turns and ring IDs to acknowledge.") }),
4187
- output: z.strictObject({
4188
- acked: z.array(z.union([
4189
- commentIdSchema,
4190
- blockIdSchema,
4191
- turnIdSchema,
4192
- ringIdSchema
4193
- ])).describe("Entries now acknowledged."),
4194
- alreadyHandled: z.array(z.union([
4195
- commentIdSchema,
4196
- blockIdSchema,
4197
- turnIdSchema,
4198
- ringIdSchema
4199
- ])).optional().describe("Entries that were already handled; nothing new was acknowledged for them.")
4200
- }),
4246
+ input: inboxAckInputSchema,
4247
+ output: inboxAckOutputSchema,
4248
+ web: true,
4201
4249
  grants: [{ grant: "project-agent" }, { grant: "operator" }],
4202
4250
  errors: [
4203
4251
  "wrong_id_kind",
@@ -4966,19 +5014,9 @@ const OPERATIONS = [
4966
5014
  whenToUse: "Hand in the work of a turn you took, at the pull request head. Declare tested (default), carried from a tested origin on this task, or skipped; carried requires from and reason, skipped requires reason. While the project dispatcher is in shadow mode no turn opens: the column executor submits with the task key.",
4967
5015
  whenNotToUse: "Use task_return to send the task back to Dev instead."
4968
5016
  },
4969
- input: z.strictObject({
4970
- turn: z.union([turnIdSchema, taskKeyInputSchema]).describe("Turn ID you took (T4); while the project dispatcher is in shadow mode, the task key instead."),
4971
- sha: commitShaSchema.max(64).describe("Full commit SHA at the head of the pull request, lowercase."),
4972
- basis: z.enum(SUBMISSION_BASES).optional().describe("Testing provenance: tested (default), carried from a tested origin on this task, or skipped with a reason."),
4973
- from: commitShaSchema.max(64).optional().describe("Full lowercase source SHA on this task; required only for carried."),
4974
- reason: z.string().max(2e3).optional().describe("Literal nonblank explanation, up to 2000 UTF-16 units; required for carried and skipped.")
4975
- }),
4976
- output: z.strictObject({
4977
- task: taskViewSchema,
4978
- turn: turnIdSchema.nullable().describe("The closed turn; null for a submit by task key in shadow mode."),
4979
- sha: commitShaSchema.describe("The submitted commit SHA."),
4980
- status: z.enum(["confirmed", "pending"]).default("confirmed").describe("confirmed: the board saw the PR head at sha. pending: accepted, pending confirmation - the board confirms the head on its next polls and hands the turn back with the reason if it cannot; do not resubmit or raise a block.")
4981
- }),
5017
+ input: taskSubmitInputSchema,
5018
+ output: taskSubmitOutputSchema,
5019
+ web: true,
4982
5020
  grants: [
4983
5021
  { grant: "task-worker" },
4984
5022
  { grant: "column-orchestrator" },
@@ -5075,15 +5113,9 @@ const OPERATIONS = [
5075
5113
  whenToUse: "Send the task back to Dev when the work needs code changes.",
5076
5114
  whenNotToUse: "Use task_submit to hand in the work instead."
5077
5115
  },
5078
- input: z.strictObject({
5079
- turn: turnIdSchema,
5080
- reason: text("What the worker must change, sent to the worker as a code block.", TEXT_MAX),
5081
- findings: z.int().min(0).optional().describe("Number of review findings the return sends; shown on the task's status row.")
5082
- }),
5083
- output: z.strictObject({
5084
- task: taskViewSchema,
5085
- block: blockViewSchema
5086
- }),
5116
+ input: taskReturnInputSchema,
5117
+ output: taskReturnOutputSchema,
5118
+ web: true,
5087
5119
  grants: [
5088
5120
  { grant: "task-worker" },
5089
5121
  { grant: "column-orchestrator" },
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { D as sortSkillFiles, T as skillReloadFileSchema, Tt as resolveWebOrigin, a as requestHashOf, at as ERRORS, et as actorIdSchema, f as roleCanUseOperation, ht as DEFAULT_STAND_PORT_RANGE, jt as SLACK_BOT_SCOPES, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as successEnvelopeSchema, wt as requiredSecretKeys, xt as configSchema } from "./chunk-CcqlB4rN.mjs";
1
+ import { D as sortSkillFiles, T as skillReloadFileSchema, Tt as resolveWebOrigin, a as requestHashOf, at as ERRORS, et as actorIdSchema, f as roleCanUseOperation, ht as DEFAULT_STAND_PORT_RANGE, jt as SLACK_BOT_SCOPES, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as successEnvelopeSchema, wt as requiredSecretKeys, xt as configSchema } from "./chunk-EIGSWJA9.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-BC8T5XHO.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-CjHIyoJR.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-DPzFY26V.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-CtrQ6KMg.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-BC8T5XHO.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-DPzFY26V.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as REF_NUMBER, A as eventPayloadSchemas, At as ITEM_KINDS, B as REVIEW_DECISIONS, C as messageRefSchema, Ct as plainHttpAllowed, D as sortSkillFiles, Dt as COLUMN_GROUPS, E as skillReloadFilesSchema, Et as COLUMNS, F as prSourceId, Ft as isTodoGroupColumn, G as parseRingMarker, H as SESSION_HEALTH_STATES, I as sessionTransitionSchema, J as prReviewRuleSchema, K as prFactsSchema, L as sourceCursorSchema, M as batchSchema, Mt as TASK_HOLDS, N as defaultBranchFactSchema, Nt as TODO_GROUP_COLUMN_IDS, O as EVENT_KINDS, Ot as COLUMN_IDS, P as entityRefSchema, Pt as VIAS, Q as JIRA_PROJECT_KEY, R as trackerSourceId, S as interactionRefSchema, St as defaultAddressee, Tt as resolveWebOrigin, U as SESSION_STATUSES, V as REVIEW_STATES, W as isExternalAuthor, X as sessionFactsSchema, Y as ringMarker, Z as ticketFactsSchema, _t as approvalRuleOf, a as requestHashOf, at as ERRORS, b as conversationRefSchema, bt as configBindings, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, et as actorIdSchema, f as roleCanUseOperation, ft as DEFAULT_LINK, g as renderHttpProblem, gt as RESERVED_PROJECT, h as turnHandedSchema, i as TOKEN_REQUEST_LIMITS, it as parseRef$1, j as AdapterError, jt as SLACK_BOT_SCOPES, k as GATE_REASONS, kt as DISPATCHER_MODES, l as BOARD_TICK_MS, lt as ok, m as defaultBranchViewSchema, mt as DEFAULT_SLACK_COMMAND, n as doctorReportSchema, nt as errorCodeOf, o as tokenRequestResultSchema, ot as err, p as OPERATIONS, q as prRefSchema, rt as parseActorId, s as tokenRequestSchema, t as assertNever, tt as encodeActorId, ut as successEnvelopeSchema, vt as boardWideSpurProject, w as userIdSchema, wt as requiredSecretKeys, x as inboundEventSchema, xt as configSchema, y as SPACE_IDS, yt as columnTurnTimings, z as PR_STATES } from "./chunk-CcqlB4rN.mjs";
1
+ import { $ as REF_NUMBER, A as eventPayloadSchemas, At as ITEM_KINDS, B as REVIEW_DECISIONS, C as messageRefSchema, Ct as plainHttpAllowed, D as sortSkillFiles, Dt as COLUMN_GROUPS, E as skillReloadFilesSchema, Et as COLUMNS, F as prSourceId, Ft as isTodoGroupColumn, G as parseRingMarker, H as SESSION_HEALTH_STATES, I as sessionTransitionSchema, J as prReviewRuleSchema, K as prFactsSchema, L as sourceCursorSchema, M as batchSchema, Mt as TASK_HOLDS, N as defaultBranchFactSchema, Nt as TODO_GROUP_COLUMN_IDS, O as EVENT_KINDS, Ot as COLUMN_IDS, P as entityRefSchema, Pt as VIAS, Q as JIRA_PROJECT_KEY, R as trackerSourceId, S as interactionRefSchema, St as defaultAddressee, Tt as resolveWebOrigin, U as SESSION_STATUSES, V as REVIEW_STATES, W as isExternalAuthor, X as sessionFactsSchema, Y as ringMarker, Z as ticketFactsSchema, _t as approvalRuleOf, a as requestHashOf, at as ERRORS, b as conversationRefSchema, bt as configBindings, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, et as actorIdSchema, f as roleCanUseOperation, ft as DEFAULT_LINK, g as renderHttpProblem, gt as RESERVED_PROJECT, h as turnHandedSchema, i as TOKEN_REQUEST_LIMITS, it as parseRef$1, j as AdapterError, jt as SLACK_BOT_SCOPES, k as GATE_REASONS, kt as DISPATCHER_MODES, l as BOARD_TICK_MS, lt as ok, m as defaultBranchViewSchema, mt as DEFAULT_SLACK_COMMAND, n as doctorReportSchema, nt as errorCodeOf, o as tokenRequestResultSchema, ot as err, p as OPERATIONS, q as prRefSchema, rt as parseActorId, s as tokenRequestSchema, t as assertNever, tt as encodeActorId, ut as successEnvelopeSchema, vt as boardWideSpurProject, w as userIdSchema, wt as requiredSecretKeys, x as inboundEventSchema, xt as configSchema, y as SPACE_IDS, yt as columnTurnTimings, z as PR_STATES } from "./chunk-EIGSWJA9.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";
@@ -11278,6 +11278,7 @@ function createOpsRoute(app, options, callers = /* @__PURE__ */ new WeakMap()) {
11278
11278
  if (operation === void 0) throw new CommandError("version_mismatch", "This daemon does not know the operation. Run `board service restart` to update the daemon, then retry.");
11279
11279
  if (options.allow?.(operation) === false) throw new CommandError("forbidden", "This operation is not available on the web.");
11280
11280
  const body = inputBody(request.body);
11281
+ if (options.requireKey?.(operation) === true && (body.key ?? "").trim() === "") throw new CommandError("usage", "Send a non-blank idempotency key with this write; a retry sends the same key.");
11281
11282
  const parsed = operation.input.safeParse(body.input);
11282
11283
  if (!parsed.success) throw new CommandError(errorCodeOf(parsed.error), "Fix the operation input.");
11283
11284
  const run = () => dispatchOperation(options, operation.id, parsed.data, caller.actor, body.key);
@@ -21715,6 +21716,15 @@ function installEventStream(app, options) {
21715
21716
  });
21716
21717
  }
21717
21718
  // ../core/src/api/web-server.ts
21719
+ /**
21720
+ * The Turn section's writes take and close a turn; the operator caller would otherwise get a
21721
+ * fresh key per request, so a keyless retry could take or close a turn again.
21722
+ */
21723
+ const KEYED_WEB_WRITES = /* @__PURE__ */ new Set([
21724
+ "inbox.ack",
21725
+ "task.submit",
21726
+ "task.return"
21727
+ ]);
21718
21728
  const mime = {
21719
21729
  ".html": "text/html; charset=utf-8",
21720
21730
  ".js": "text/javascript; charset=utf-8",
@@ -21837,6 +21847,7 @@ async function createWebServer(options) {
21837
21847
  ...options,
21838
21848
  identify: () => Promise.resolve({ actor: "operator" }),
21839
21849
  allow: (operation) => operation.web !== null,
21850
+ requireKey: (operation) => KEYED_WEB_WRITES.has(operation.id),
21840
21851
  runOperation: (id, input, run) => withVia("web", () => options.runOperation === void 0 ? run() : options.runOperation(id, input, run))
21841
21852
  });
21842
21853
  app.get("/v1/health", async () => {
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { at as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-CcqlB4rN.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-BC8T5XHO.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-CjHIyoJR.mjs";
1
+ import { at as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-EIGSWJA9.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-DPzFY26V.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-CtrQ6KMg.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";