spur-board 0.44.3 → 0.45.1
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.
- package/dist/cli.mjs +3 -3
- package/dist/{client-BODC7qTT.mjs → client-DXseLMUK.mjs} +1 -1
- package/dist/client.mjs +1 -1
- package/dist/{config-M7jQfUT9.mjs → config-DEL1XWGj.mjs} +2 -2
- package/dist/daemon.mjs +36 -18
- package/dist/mcp.mjs +3 -3
- package/dist/{src-HVASmsVd.mjs → src-CfmtTvPO.mjs} +10 -0
- package/package.json +1 -1
- package/skills/spur-board/references/errors.md +1 -0
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Q as requiredSecretKeys, X as configSchema, l as roleCanUseOperation, r as SYSTEMD_SERVICE_SETTINGS, tt as SLACK_BOT_SCOPES, u as OPERATIONS, z as ERRORS } from "./src-
|
|
2
|
-
import { a as CliError, c as escapeTerminalControls, i as requestTokenEnrollment, n as fetchTokenStatus, o as errorExitCode, r as requestOperation, s as renderCliError } from "./client-
|
|
3
|
-
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 "./config-
|
|
1
|
+
import { Q as requiredSecretKeys, X as configSchema, l as roleCanUseOperation, r as SYSTEMD_SERVICE_SETTINGS, tt as SLACK_BOT_SCOPES, u as OPERATIONS, z as ERRORS } from "./src-CfmtTvPO.mjs";
|
|
2
|
+
import { a as CliError, c as escapeTerminalControls, i as requestTokenEnrollment, n as fetchTokenStatus, o as errorExitCode, r as requestOperation, s as renderCliError } from "./client-DXseLMUK.mjs";
|
|
3
|
+
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 "./config-DEL1XWGj.mjs";
|
|
4
4
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
5
5
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
6
6
|
import { homedir, hostname, userInfo } from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as errorEnvelopeSchema, V as errorContextSchema, W as successEnvelopeSchema, p as renderJsonError, z as ERRORS } from "./src-
|
|
1
|
+
import { H as errorEnvelopeSchema, V as errorContextSchema, W as successEnvelopeSchema, p as renderJsonError, z as ERRORS } from "./src-CfmtTvPO.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as requestTokenEnrollment, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { i as requestTokenEnrollment, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./client-DXseLMUK.mjs";
|
|
2
2
|
export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestTokenEnrollment };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { X as configSchema, Z as plainHttpAllowed, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-
|
|
2
|
-
import { a as CliError, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { X as configSchema, Z as plainHttpAllowed, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-CfmtTvPO.mjs";
|
|
2
|
+
import { a as CliError, t as fetchCatalogVersion } from "./client-DXseLMUK.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/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as COLUMN_IDS, A as ringMarker, B as err, C as REVIEW_STATES, D as parseRingMarker, E as isExternalAuthor, F as errorCodeOf, I as parseActorId, J as DEFAULT_SLACK_COMMAND, K as DEFAULT_LINK, L as parseRef$1, M as ticketFactsSchema, N as actorIdSchema, O as prFactsSchema, P as encodeActorId, Q as requiredSecretKeys, R as taskKeySchema, S as eventPayloadSchemas, T as SESSION_STATUSES, U as ok, W as successEnvelopeSchema, X as configSchema, Y as RESERVED_PROJECT, Z as plainHttpAllowed, _ as inboundEventSchema, a as batchSchema, b as userIdSchema, c as buildCatalogSnapshot, d as turnHandedSchema, et as DISPATCHER_MODES, f as renderHttpProblem, g as conversationRefSchema, h as SPACE_IDS, i as AdapterError, j as sessionFactsSchema, k as prRefSchema, l as roleCanUseOperation, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, tt as SLACK_BOT_SCOPES, u as OPERATIONS, v as interactionRefSchema, w as SESSION_HEALTH_STATES, x as EVENT_KINDS, y as messageRefSchema, z as ERRORS } from "./src-
|
|
1
|
+
import { $ as COLUMN_IDS, A as ringMarker, B as err, C as REVIEW_STATES, D as parseRingMarker, E as isExternalAuthor, F as errorCodeOf, I as parseActorId, J as DEFAULT_SLACK_COMMAND, K as DEFAULT_LINK, L as parseRef$1, M as ticketFactsSchema, N as actorIdSchema, O as prFactsSchema, P as encodeActorId, Q as requiredSecretKeys, R as taskKeySchema, S as eventPayloadSchemas, T as SESSION_STATUSES, U as ok, W as successEnvelopeSchema, X as configSchema, Y as RESERVED_PROJECT, Z as plainHttpAllowed, _ as inboundEventSchema, a as batchSchema, b as userIdSchema, c as buildCatalogSnapshot, d as turnHandedSchema, et as DISPATCHER_MODES, f as renderHttpProblem, g as conversationRefSchema, h as SPACE_IDS, i as AdapterError, j as sessionFactsSchema, k as prRefSchema, l as roleCanUseOperation, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, tt as SLACK_BOT_SCOPES, u as OPERATIONS, v as interactionRefSchema, w as SESSION_HEALTH_STATES, x as EVENT_KINDS, y as messageRefSchema, z as ERRORS } from "./src-CfmtTvPO.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { chmodSync, closeSync, existsSync, fchmodSync, fstatSync, fsyncSync, ftruncateSync, linkSync, mkdirSync, openSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeSync } from "node:fs";
|
|
@@ -9459,6 +9459,7 @@ async function createApiServer(options) {
|
|
|
9459
9459
|
let doctorInFlight = null;
|
|
9460
9460
|
let doctorCached = null;
|
|
9461
9461
|
let doctorNextProbeAt = 0;
|
|
9462
|
+
const notReady = () => options.stopping?.() === true ? new CommandError("stopping", "Wait until the daemon is running again.") : new CommandError("starting", "Wait until the daemon is ready.");
|
|
9462
9463
|
app.addHook("onRequest", async (request, reply) => {
|
|
9463
9464
|
reply.header("x-request-id", request.id);
|
|
9464
9465
|
reply.header("x-board-instance", instance);
|
|
@@ -9508,11 +9509,11 @@ async function createApiServer(options) {
|
|
|
9508
9509
|
throw new CommandError("not_found", "This API route is not available.");
|
|
9509
9510
|
});
|
|
9510
9511
|
app.get("/v1/schema", async (_request, reply) => {
|
|
9511
|
-
if (!options.ready()) throw
|
|
9512
|
+
if (!options.ready()) throw notReady();
|
|
9512
9513
|
return reply.send(snapshot);
|
|
9513
9514
|
});
|
|
9514
9515
|
app.get("/v1/doctor", async (_request, reply) => {
|
|
9515
|
-
if (!options.ready()) throw
|
|
9516
|
+
if (!options.ready()) throw notReady();
|
|
9516
9517
|
if (options.doctor === void 0) throw new CommandError("not_found", "Doctor is unavailable.");
|
|
9517
9518
|
if (doctorInFlight !== null) return reply.send(await doctorInFlight);
|
|
9518
9519
|
if (options.clock.now() < doctorNextProbeAt) {
|
|
@@ -9529,12 +9530,12 @@ async function createApiServer(options) {
|
|
|
9529
9530
|
}
|
|
9530
9531
|
});
|
|
9531
9532
|
app.get("/v1/health", async (_request, reply) => {
|
|
9532
|
-
if (!options.ready()) throw
|
|
9533
|
+
if (!options.ready()) throw notReady();
|
|
9533
9534
|
if (options.firstPollDone === void 0) throw new CommandError("not_found", "Health is unavailable.");
|
|
9534
9535
|
return reply.send({ firstPollDone: await options.firstPollDone() });
|
|
9535
9536
|
});
|
|
9536
9537
|
app.post("/v1/tokens/requests", async (request, reply) => {
|
|
9537
|
-
if (!options.ready()) throw
|
|
9538
|
+
if (!options.ready()) throw notReady();
|
|
9538
9539
|
const parsed = tokenRequestSchema.safeParse(request.body);
|
|
9539
9540
|
if (!parsed.success) throw new CommandError("usage", "Provide a name, folder, host and token hash.");
|
|
9540
9541
|
const result = await requestToken(options.store, options.config, parsed.data, new Date(options.clock.now()));
|
|
@@ -9546,7 +9547,7 @@ async function createApiServer(options) {
|
|
|
9546
9547
|
});
|
|
9547
9548
|
/** The hash travels in the body because request logs record the URL. */
|
|
9548
9549
|
app.post("/v1/tokens/status", async (request, reply) => {
|
|
9549
|
-
if (!options.ready()) throw
|
|
9550
|
+
if (!options.ready()) throw notReady();
|
|
9550
9551
|
const parsed = tokenStatusSchema.safeParse(request.body);
|
|
9551
9552
|
if (!parsed.success) throw new CommandError("usage", "Provide a SHA-256 token hash.");
|
|
9552
9553
|
const status = await tokenStatusByHash(options.store, parsed.data.hash, new Date(options.clock.now()));
|
|
@@ -9557,7 +9558,7 @@ async function createApiServer(options) {
|
|
|
9557
9558
|
}));
|
|
9558
9559
|
});
|
|
9559
9560
|
app.post("/v1/ops/:id", { onRequest: async (request) => {
|
|
9560
|
-
if (!options.ready()) throw
|
|
9561
|
+
if (!options.ready()) throw notReady();
|
|
9561
9562
|
const sessionHeader = request.headers["x-board-session"];
|
|
9562
9563
|
if (Array.isArray(sessionHeader)) throw new CommandError("forbidden", "Use one session identity header.");
|
|
9563
9564
|
callers.set(request, await identifyCaller(options, {
|
|
@@ -10083,7 +10084,7 @@ async function reconcileDoorbells(trx, at, config) {
|
|
|
10083
10084
|
}).where("id", "=", n.id).execute();
|
|
10084
10085
|
continue;
|
|
10085
10086
|
}
|
|
10086
|
-
if (session
|
|
10087
|
+
if (recipientBusy(session) && !await spurBlind$1(trx)) continue;
|
|
10087
10088
|
let rings = n.rings;
|
|
10088
10089
|
let lastOutbox = n.last_outbox_id;
|
|
10089
10090
|
if (session.id !== n.recipient_session) {
|
|
@@ -10150,19 +10151,30 @@ function ringPauses(config) {
|
|
|
10150
10151
|
config.doorbells.unansweredAfterMs
|
|
10151
10152
|
];
|
|
10152
10153
|
}
|
|
10153
|
-
/**
|
|
10154
|
-
|
|
10155
|
-
* A detail that does not parse, or one without a queue, holds nothing.
|
|
10156
|
-
*/
|
|
10157
|
-
function earlierRingQueued(session, notificationId, rings) {
|
|
10154
|
+
/** The session's last observed Spur facts, or null when its detail does not parse. */
|
|
10155
|
+
function observedFacts(session) {
|
|
10158
10156
|
let detail;
|
|
10159
10157
|
try {
|
|
10160
10158
|
detail = JSON.parse(session.detail);
|
|
10161
10159
|
} catch {
|
|
10162
|
-
return
|
|
10160
|
+
return null;
|
|
10163
10161
|
}
|
|
10164
10162
|
const fact = sessionFactsSchema.safeParse(detail);
|
|
10165
|
-
return fact.success
|
|
10163
|
+
return fact.success ? fact.data : null;
|
|
10164
|
+
}
|
|
10165
|
+
/**
|
|
10166
|
+
* Whether the session was last observed mid-turn. Only an observed `working` health counts: any
|
|
10167
|
+
* other health, or a detail that does not parse, is rung.
|
|
10168
|
+
*/
|
|
10169
|
+
function recipientBusy(session) {
|
|
10170
|
+
return observedFacts(session)?.health === "working";
|
|
10171
|
+
}
|
|
10172
|
+
/**
|
|
10173
|
+
* Whether the session's facts list a ring of this series, up to `rings`, still in its Spur queue.
|
|
10174
|
+
* A detail that does not parse, or one without a queue, holds nothing.
|
|
10175
|
+
*/
|
|
10176
|
+
function earlierRingQueued(session, notificationId, rings) {
|
|
10177
|
+
return (observedFacts(session)?.queuedRings ?? []).some((queued) => queued.notification === notificationId && queued.ring <= rings);
|
|
10166
10178
|
}
|
|
10167
10179
|
/** Count one confirmed Spur send, regardless of transport attempts for its outbox row. */
|
|
10168
10180
|
async function recordRingDelivery(trx, notificationId, ring, session, at, config) {
|
|
@@ -10191,7 +10203,7 @@ async function ringStillCurrent(trx, notificationId, sessionId, config) {
|
|
|
10191
10203
|
if (n === void 0 || n.acked_at !== null || n.exhausted_at !== null || n.recipient_session !== sessionId) return "dead";
|
|
10192
10204
|
const session = await selectNotificationRecipient(trx, n, config);
|
|
10193
10205
|
if (session?.id !== sessionId) return "dead";
|
|
10194
|
-
return session
|
|
10206
|
+
return recipientBusy(session) && !await spurBlind$1(trx) ? "defer" : "send";
|
|
10195
10207
|
}
|
|
10196
10208
|
/**
|
|
10197
10209
|
* The task of a ring: through its notification, or for an inbound author ring (no notification)
|
|
@@ -12249,7 +12261,8 @@ async function getStatus(deps, options = {}) {
|
|
|
12249
12261
|
if (snapshot !== void 0) sessions.push(parseJson(sessionFactsSchema, snapshot.detail));
|
|
12250
12262
|
}
|
|
12251
12263
|
const ticketFacts = ticket === void 0 ? null : parseJson(ticketFactsSchema, ticket.detail);
|
|
12252
|
-
const
|
|
12264
|
+
const project = config.projects.find((entry) => entry.id === task.project);
|
|
12265
|
+
const trackerRepo = issuesRepo(project);
|
|
12253
12266
|
const linkHints = [];
|
|
12254
12267
|
for (const session of sessions) {
|
|
12255
12268
|
const pr = session.pr;
|
|
@@ -12265,6 +12278,10 @@ async function getStatus(deps, options = {}) {
|
|
|
12265
12278
|
project: task.project,
|
|
12266
12279
|
column: task.column,
|
|
12267
12280
|
membership: task.membership,
|
|
12281
|
+
...project?.dispatcher.mode === "shadow" ? {
|
|
12282
|
+
shadowColumn: task.shadow_column ?? task.column,
|
|
12283
|
+
shadowDiffers: (task.shadow_column ?? task.column) !== task.column
|
|
12284
|
+
} : {},
|
|
12268
12285
|
state: taskState(ticketFacts, prs, sessions),
|
|
12269
12286
|
prCount: links.filter((link) => link.entity === "pr").length,
|
|
12270
12287
|
sessionCount: links.filter((link) => link.entity === "session").length,
|
|
@@ -15441,7 +15458,7 @@ function commandReply(id, value, input) {
|
|
|
15441
15458
|
body: [
|
|
15442
15459
|
line(`Board status: ${String(status.tasks.length)} tasks, ${String(status.items.length)} items needing attention.`),
|
|
15443
15460
|
...status.items.map((item) => line(`${item.key}: ${item.summary}`)),
|
|
15444
|
-
...status.tasks.map((task) => line(`${task.key}: ${task.column} (${task.membership})`)),
|
|
15461
|
+
...status.tasks.map((task) => line(`${task.key}: ${task.column}${task.shadowDiffers === true ? `, shadow ${String(task.shadowColumn)}` : ""} (${task.membership})`)),
|
|
15445
15462
|
line(`Unlinked: ${String(status.unlinkedPrs.length)} pull requests, ${String(status.unlinkedSessions.length)} sessions${status.hiddenUnlinkedPrs + status.hiddenUnlinkedSessions === 0 ? "" : `; ${String(status.hiddenUnlinkedPrs)} pull requests and ${String(status.hiddenUnlinkedSessions)} sessions finished over 7 days ago are hidden`}.`),
|
|
15446
15463
|
...status.sources.map((source) => line(`${source.source}: ${source.blindReason !== null ? `blind (${source.blindReason})` : source.warmingUp ? "warming up" : source.stale ? "stale" : "current"}`)),
|
|
15447
15464
|
...status.warmingUp ? [line("Sources are warming up.")] : [],
|
|
@@ -20760,6 +20777,7 @@ function createHttpModule(ctx, options = {}) {
|
|
|
20760
20777
|
config: ctx.config,
|
|
20761
20778
|
port: ctx.config.http.port,
|
|
20762
20779
|
ready: () => ctx.state() === "ready",
|
|
20780
|
+
stopping: () => ctx.state() === "stopping",
|
|
20763
20781
|
clock: ctx.clock,
|
|
20764
20782
|
lookupSession: (id) => ctx.logCall("spur.session.lookup", () => lookupLiveSession(ctx.config.adapters.spur.baseUrl, id, options.fetcher)),
|
|
20765
20783
|
verifyToken: (token) => verifyOperatorToken(ctx.store, token),
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as renderMcpError, u as OPERATIONS, z as ERRORS } from "./src-
|
|
2
|
-
import { a as CliError, r as requestOperation } from "./client-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./config-
|
|
1
|
+
import { m as renderMcpError, u as OPERATIONS, z as ERRORS } from "./src-CfmtTvPO.mjs";
|
|
2
|
+
import { a as CliError, r as requestOperation } from "./client-DXseLMUK.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./config-DEL1XWGj.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -728,6 +728,13 @@ const ERRORS = {
|
|
|
728
728
|
hint: "Wait until the daemon is ready, then retry the command with its existing idempotency key if it has one.",
|
|
729
729
|
recovery: retry("Wait until the daemon is ready, then retry the command with its existing idempotency key if it has one.", "After the daemon is ready; wait briefly between retries.")
|
|
730
730
|
}),
|
|
731
|
+
stopping: spec("stopping", {
|
|
732
|
+
status: 503,
|
|
733
|
+
exit: EXIT_CODES.notApplied,
|
|
734
|
+
message: "The daemon is stopping; nothing was applied.",
|
|
735
|
+
hint: "Wait until the daemon is running again, then retry the command with its existing idempotency key if it has one; if it stays stopped, ask in your own session.",
|
|
736
|
+
recovery: retry("Wait until the daemon is running again, then retry the command with its existing idempotency key if it has one; if it stays stopped, ask in your own session.", "After the daemon is running again; wait briefly between retries.")
|
|
737
|
+
}),
|
|
731
738
|
github_unavailable: spec("github_unavailable", {
|
|
732
739
|
status: 503,
|
|
733
740
|
exit: EXIT_CODES.notApplied,
|
|
@@ -1736,6 +1743,7 @@ const COMMON_ERRORS = [
|
|
|
1736
1743
|
"forbidden",
|
|
1737
1744
|
"identity_unavailable",
|
|
1738
1745
|
"starting",
|
|
1746
|
+
"stopping",
|
|
1739
1747
|
"not_implemented"
|
|
1740
1748
|
];
|
|
1741
1749
|
const MUTATION_ERRORS = ["idempotency_key_mismatch"];
|
|
@@ -1897,6 +1905,8 @@ const linkViewSchema = z.strictObject({
|
|
|
1897
1905
|
const detailOnly = "Present only with detail.";
|
|
1898
1906
|
const count = (what) => z.int().min(0).describe(what);
|
|
1899
1907
|
const statusTaskSchema = taskViewSchema.extend({
|
|
1908
|
+
shadowColumn: z.enum(COLUMN_IDS).optional().describe("Column the dispatcher works from in shadow mode: where the board would have the task. Present only while the project dispatcher is in shadow mode."),
|
|
1909
|
+
shadowDiffers: z.boolean().optional().describe("Whether shadowColumn differs from column. Present only while the project dispatcher is in shadow mode."),
|
|
1900
1910
|
state: z.string().min(1).describe("One line: ticket status, pull request states and session health counts, joined by \"; \"."),
|
|
1901
1911
|
prCount: count("Number of effective pull request links."),
|
|
1902
1912
|
sessionCount: count("Number of effective session links."),
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
- `not_implemented`: Ask the operator to update the daemon to a build with this operation.
|
|
8
8
|
- `identity_unavailable`: Ask in your own session, then retry the same command later with its existing idempotency key if it has one.
|
|
9
9
|
- `starting`: Wait until the daemon is ready, then retry the command with its existing idempotency key if it has one.
|
|
10
|
+
- `stopping`: Wait until the daemon is running again, then retry the command with its existing idempotency key if it has one; if it stays stopped, ask in your own session.
|
|
10
11
|
|
|
11
12
|
## Other error hints
|
|
12
13
|
|