spur-board 0.165.1 → 0.165.3

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/README.md CHANGED
@@ -1,12 +1,37 @@
1
1
  # spur-board
2
2
 
3
- A kanban board for agent-driven development on top of [Spur](https://github.com/ashugaev/spur):
4
- a local daemon that tracks tasks across GitHub, Jira and agent sessions, a `board` CLI and MCP
3
+ A kanban for agent-driven development on top of [Spur](https://github.com/ashugaev/spur): a
4
+ local daemon that tracks tasks across GitHub, Jira and agent sessions, a `board` CLI and MCP
5
5
  server for agents, and optionally Slack for the human operator.
6
6
 
7
7
  **Status:** early development. Work is tracked in
8
8
  [GitHub Issues](https://github.com/AnDeVerin/spur-board/issues).
9
9
 
10
+ ## What it needs
11
+
12
+ Linux with systemd user services and `flock` (util-linux), Node 24.12+ (24.x) or 26.x, a running
13
+ [Spur](https://github.com/ashugaev/spur) 1.53.0 or newer, a GitHub token (a classic personal
14
+ access token with the scopes listed in
15
+ [SETUP.md](https://github.com/AnDeVerin/spur-board/blob/main/SETUP.md#configuration-and-secrets)),
16
+ Jira credentials for Jira projects, and optionally a Slack app. The optional web console has no
17
+ login of its own and needs an authenticating reverse proxy or an SSH tunnel to reach it from
18
+ another machine.
19
+
20
+ ## Start here
21
+
22
+ 1. [Overview](https://github.com/AnDeVerin/spur-board/blob/main/docs/overview.md): what the
23
+ Board does and how tasks move through its columns.
24
+ 2. [Quickstart](https://github.com/AnDeVerin/spur-board/blob/main/docs/quickstart.md): from zero
25
+ to a first task in Done with the minimal example.
26
+ 3. [SETUP.md](https://github.com/AnDeVerin/spur-board/blob/main/SETUP.md): every install step,
27
+ file location and command.
28
+ 4. [Configuration reference](https://github.com/AnDeVerin/spur-board/blob/main/docs/configuration.md):
29
+ every `config.yaml` field and secret.
30
+ 5. [TROUBLESHOOTING.md](https://github.com/AnDeVerin/spur-board/blob/main/TROUBLESHOOTING.md):
31
+ doctor checks and their fixes.
32
+ 6. [Docs index](https://github.com/AnDeVerin/spur-board/blob/main/docs/README.md): the guides for
33
+ users and contributors.
34
+
10
35
  ## Setup with an agent
11
36
 
12
37
  Ask your agent to check whether `spur-board-setup` is already installed. If it is missing, the
@@ -21,4 +46,4 @@ never paste tokens into chat.
21
46
 
22
47
  ## License
23
48
 
24
- [MIT](LICENSE)
49
+ [MIT](https://github.com/AnDeVerin/spur-board/blob/main/LICENSE)
package/dist/daemon.mjs CHANGED
@@ -30517,7 +30517,7 @@ function nextDelay(input) {
30517
30517
  };
30518
30518
  }
30519
30519
  const next = failures + 1;
30520
- const cap = Math.max(MAX_BACKOFF_MS, intervalMs);
30520
+ const cap = Math.max(input.maxBackoffMs ?? MAX_BACKOFF_MS, intervalMs);
30521
30521
  return {
30522
30522
  delayMs: jitter(Math.min(intervalMs * 2 ** next, cap)),
30523
30523
  failures: next,
@@ -30912,6 +30912,7 @@ function runSource(entry, options, runnerStartMs, budgetWaits) {
30912
30912
  failures,
30913
30913
  authRetryMs: config.sources.authRetryMs,
30914
30914
  reserveRemaining,
30915
+ maxBackoffMs: entry.maxBackoffMs,
30915
30916
  now: now()
30916
30917
  });
30917
30918
  failures = delay.failures;
@@ -31159,7 +31160,29 @@ function iso$1(ms) {
31159
31160
  return new Date(ms).toISOString();
31160
31161
  }
31161
31162
  // ../adapters/src/spur/spur.ts
31163
+ /** The timeout of `GET sessions` and `GET sessions/<id>`. */
31162
31164
  const REQUEST_TIMEOUT_MS = 5e3;
31165
+ /** The timeout of one `GET sessions/transitions` page: Spur refreshes every session on each one. */
31166
+ const TRANSITIONS_TIMEOUT_MS = 15e3;
31167
+ /** The longest wait between two failed Spur polls, so Spur load episodes blind the board briefly. */
31168
+ const SPUR_MAX_BACKOFF_MS = 6e4;
31169
+ /**
31170
+ * A failed Spur request with its place. It never carries `code`: the runner would report it as a
31171
+ * source failure.
31172
+ */
31173
+ var SpurRequestError = class extends AdapterError {
31174
+ path;
31175
+ durationMs;
31176
+ constructor(kind, base, place, options = {}) {
31177
+ super(kind, `${base} on ${describePlace(place)} after ${String(place.durationMs)} ms`, options);
31178
+ this.path = place.path;
31179
+ if (place.page !== void 0) this.page = place.page;
31180
+ this.durationMs = place.durationMs;
31181
+ }
31182
+ };
31183
+ function describePlace(place) {
31184
+ return place.page === void 0 ? place.path : `${place.path} page ${String(place.page)}`;
31185
+ }
31163
31186
  const sessionWire = z.object({
31164
31187
  id: z.string().min(1),
31165
31188
  project: z.string().min(1),
@@ -31213,8 +31236,26 @@ function createSpurAdapter(options) {
31213
31236
  const unknownStatusValues = /* @__PURE__ */ new Set();
31214
31237
  const isKnownHealth = (value) => SESSION_HEALTH_STATES.some((state) => state === value);
31215
31238
  const isKnownStatus = (value) => SESSION_STATUSES.some((status) => status === value);
31216
- async function request(path, signal) {
31239
+ /** The HTTP-status failure of a finished request, with its place. */
31240
+ function httpFailure({ response, place }) {
31241
+ const failure = classifyHttpFailure({
31242
+ status: response.status,
31243
+ headers: response.headers
31244
+ }, options.now());
31245
+ return new SpurRequestError(failure.kind, failure.message, place, {
31246
+ retryAt: failure.retryAt,
31247
+ cause: failure
31248
+ });
31249
+ }
31250
+ async function request(path, signal, timeoutMs, page) {
31217
31251
  if (signal.aborted) throw new Error("Spur poll aborted");
31252
+ const started = options.now();
31253
+ const placeName = path.split("?")[0] ?? path;
31254
+ const place = () => ({
31255
+ path: placeName,
31256
+ ...page === void 0 ? {} : { page },
31257
+ durationMs: options.now() - started
31258
+ });
31218
31259
  const controller = new AbortController();
31219
31260
  let timedOut = false;
31220
31261
  const callerAborted = () => signal.aborted;
@@ -31226,24 +31267,32 @@ function createSpurAdapter(options) {
31226
31267
  const timer = setTimeout(() => {
31227
31268
  timedOut = true;
31228
31269
  controller.abort();
31229
- }, REQUEST_TIMEOUT_MS);
31270
+ }, timeoutMs);
31230
31271
  try {
31231
31272
  const response = await fetchImpl(new URL(path, base), { signal: controller.signal });
31232
- if (!response.ok && response.status !== 410 && response.status !== 400) return { response };
31273
+ if (!response.ok && response.status !== 410 && response.status !== 400) return {
31274
+ response,
31275
+ place: place()
31276
+ };
31277
+ let body;
31233
31278
  try {
31234
- return {
31235
- response,
31236
- body: await response.json()
31237
- };
31279
+ body = await response.json();
31238
31280
  } catch (error) {
31239
31281
  if (controller.signal.aborted) throw error;
31240
- throw new AdapterError("transient", "Invalid Spur response JSON", { cause: error });
31282
+ throw new SpurRequestError("transient", "Invalid Spur response JSON", place(), { cause: error });
31241
31283
  }
31284
+ const done = place();
31285
+ if (response.ok && done.durationMs > timeoutMs / 2) options.warn?.(`Slow Spur request: ${describePlace(done)} took ${String(done.durationMs)} ms of a ${String(timeoutMs)} ms timeout`);
31286
+ return {
31287
+ response,
31288
+ body,
31289
+ place: done
31290
+ };
31242
31291
  } catch (error) {
31243
31292
  if (callerAborted()) throw new Error("Spur poll aborted", { cause: error });
31244
- if (didTimeOut()) throw new AdapterError("transient", "Spur request timed out", { cause: error });
31293
+ if (didTimeOut()) throw new SpurRequestError("transient", "Spur request timed out", place(), { cause: error });
31245
31294
  if (error instanceof AdapterError) throw error;
31246
- throw new AdapterError("transient", "Spur request failed", { cause: error });
31295
+ throw new SpurRequestError("transient", "Spur request failed", place(), { cause: error });
31247
31296
  } finally {
31248
31297
  clearTimeout(timer);
31249
31298
  signal.removeEventListener("abort", onAbort);
@@ -31321,7 +31370,8 @@ function createSpurAdapter(options) {
31321
31370
  kinds: "status,state"
31322
31371
  });
31323
31372
  if (cursor !== void 0) query.set("since", cursor);
31324
- const { response, body } = await request(`sessions/transitions?${query.toString()}`, ctx.signal);
31373
+ const transitions = await request(`sessions/transitions?${query.toString()}`, ctx.signal, TRANSITIONS_TIMEOUT_MS, page + 1);
31374
+ const { response, body } = transitions;
31325
31375
  if (page === 0 && cursor !== void 0 && response.status === 400 && foreignCursorWire.safeParse(body).success) {
31326
31376
  cursor = void 0;
31327
31377
  continue;
@@ -31331,10 +31381,7 @@ function createSpurAdapter(options) {
31331
31381
  sessionTransitions.length = 0;
31332
31382
  break;
31333
31383
  }
31334
- if (!response.ok) throw classifyHttpFailure({
31335
- status: response.status,
31336
- headers: response.headers
31337
- }, options.now());
31384
+ if (!response.ok) throw httpFailure(transitions);
31338
31385
  const feed = parseWire(transitionsWire, body, "Invalid Spur transitions");
31339
31386
  for (const entry of feed.entries) {
31340
31387
  if (positions.has(entry.cursor) || entry.cursor === cursor) throw new AdapterError("transient", "Repeated Spur transition position");
@@ -31355,25 +31402,21 @@ function createSpurAdapter(options) {
31355
31402
  cursor = feed.nextCursor;
31356
31403
  if (!feed.hasMore) break;
31357
31404
  }
31358
- const { response: listResponse, body: listBody } = await request("sessions", ctx.signal);
31359
- if (!listResponse.ok) throw classifyHttpFailure({
31360
- status: listResponse.status,
31361
- headers: listResponse.headers
31362
- }, options.now());
31405
+ const list = await request("sessions", ctx.signal, REQUEST_TIMEOUT_MS);
31406
+ const { response: listResponse, body: listBody } = list;
31407
+ if (!listResponse.ok) throw httpFailure(list);
31363
31408
  const listed = parseWire(z.array(sessionWire), listBody, "Invalid Spur response");
31364
31409
  const byId = new Map(listed.map((wire) => [wire.id, wire]));
31365
31410
  const detail = /* @__PURE__ */ new Map();
31366
31411
  for (const ref of ctx.observe.sessions) {
31367
31412
  if (byId.has(ref.id)) continue;
31368
- const { response, body } = await request(`sessions/${encodeURIComponent(ref.id)}`, ctx.signal);
31413
+ const read = await request(`sessions/${encodeURIComponent(ref.id)}`, ctx.signal, REQUEST_TIMEOUT_MS);
31414
+ const { response, body } = read;
31369
31415
  if (response.status === 404) {
31370
31416
  detail.set(ref.id, null);
31371
31417
  continue;
31372
31418
  }
31373
- if (!response.ok) throw classifyHttpFailure({
31374
- status: response.status,
31375
- headers: response.headers
31376
- }, options.now());
31419
+ if (!response.ok) throw httpFailure(read);
31377
31420
  const wire = parseWire(sessionWire, body, "Invalid Spur response");
31378
31421
  if (wire.id !== ref.id) throw new AdapterError("transient", "Unresolved Spur session detail");
31379
31422
  detail.set(ref.id, wire);
@@ -31561,19 +31604,23 @@ function startAdapters(config, core, options) {
31561
31604
  else for (const project of config.projects) for (const repo of project.repos) entries.push({ adapter: blindSource(prSourceId(project.id, repo), config.adapters.github.intervalMs, "GitHub credential is missing") });
31562
31605
  const notices = /* @__PURE__ */ new Set();
31563
31606
  const runner = startRunner({
31564
- entries: [...entries, { adapter: createSpurAdapter({
31565
- baseUrl: config.adapters.spur.baseUrl,
31566
- intervalMs: config.adapters.spur.intervalMs,
31567
- flipSmoothingMs: config.health.flipSmoothingMs,
31568
- now: options.now,
31569
- ...options.fetch === void 0 ? {} : { fetch: options.fetch },
31570
- onNotice: (notice) => {
31571
- const pending = Promise.resolve().then(() => options.onSpurNotice?.(notice));
31572
- notices.add(pending);
31573
- pending.then(() => notices.delete(pending), () => notices.delete(pending));
31574
- return pending;
31575
- }
31576
- }) }],
31607
+ entries: [...entries, {
31608
+ adapter: createSpurAdapter({
31609
+ baseUrl: config.adapters.spur.baseUrl,
31610
+ intervalMs: config.adapters.spur.intervalMs,
31611
+ flipSmoothingMs: config.health.flipSmoothingMs,
31612
+ now: options.now,
31613
+ ...options.fetch === void 0 ? {} : { fetch: options.fetch },
31614
+ warn: options.warn,
31615
+ onNotice: (notice) => {
31616
+ const pending = Promise.resolve().then(() => options.onSpurNotice?.(notice));
31617
+ notices.add(pending);
31618
+ pending.then(() => notices.delete(pending), () => notices.delete(pending));
31619
+ return pending;
31620
+ }
31621
+ }),
31622
+ maxBackoffMs: SPUR_MAX_BACKOFF_MS
31623
+ }],
31577
31624
  core,
31578
31625
  config,
31579
31626
  now: options.now,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.165.1",
3
+ "version": "0.165.3",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"