spur-board 0.62.2 → 0.63.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 { _ as buildCatalogSnapshot, ct as plainHttpAllowed, st as configSchema, y as OPERATIONS } from "./chunk-C2Q6FYcu.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-OVqHRmrz.mjs";
1
+ import { ct as configSchema, d as buildCatalogSnapshot, lt as plainHttpAllowed, p as OPERATIONS } from "./chunk-BONq7Qxa.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-CDacbdk2.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";
@@ -297,8 +297,8 @@ const spurProject = z.strictObject({
297
297
  "orchestrator"
298
298
  ]).describe("worker: sessions of this Spur project may link to this project's tasks through their PR or branch. operator: sessions act as the operator. orchestrator: sessions execute named columns and never become task workers. curator: sessions answer the questions no column orchestrator takes and escalate the rest to the operator; a board project has at most one."),
299
299
  shortName: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,31}$/, "Expected a short name of lowercase letters, digits, _ and -, starting with a letter or digit, at most 32 characters").optional().describe("The name the operator types as @<shortName> at the start of a new message in the orchestrators channel to start a conversation with this Spur project's live session. Unique across the board."),
300
- displayName: nonEmpty.max(80).optional().describe("The name a curator's answer lines in the feed are posted under. Defaults to the Spur project name. Only for a curator."),
301
- icon: z.string().regex(/^:[a-z0-9_+'-]+:$/, "Expected an emoji shortcode such as :owl:").optional().describe("The emoji shortcode, such as :owl:, shown on a curator's answer lines in the feed instead of the curator icon. Only for a curator.")
300
+ displayName: nonEmpty.max(80).optional().describe("The name Slack messages this Spur project's sessions write are posted under: block threads and replies, and a curator's answer lines in the feed. Defaults to the Spur project name."),
301
+ icon: z.string().regex(/^:[a-z0-9_+'-]+:$/, "Expected an emoji shortcode such as :owl:").optional().describe("The emoji shortcode, such as :owl:, shown on those messages instead of the role icon.")
302
302
  });
303
303
  const DEFAULT_CYCLE_LIMIT = 10;
304
304
  const DEFAULT_COURSE_CHECK = 3;
@@ -363,17 +363,7 @@ const projectSchema = z.strictObject({
363
363
  rejectDuplicates(items, "name", "spur project name", ctx);
364
364
  let curator;
365
365
  items.forEach((item, i) => {
366
- if (item.role !== "curator") {
367
- for (const field of ["displayName", "icon"]) {
368
- if (item[field] === void 0) continue;
369
- ctx.addIssue({
370
- code: "custom",
371
- path: [i, field],
372
- message: "displayName and icon apply only to a curator"
373
- });
374
- }
375
- return;
376
- }
366
+ if (item.role !== "curator") return;
377
367
  if (curator !== void 0) ctx.addIssue({
378
368
  code: "custom",
379
369
  path: [i, "role"],
@@ -1295,11 +1285,17 @@ const sessionFactsSchema = z.strictObject({
1295
1285
  lifecycle: z.union([knownStatus, unknownSessionStatusSchema]).describe("Lifecycle status: a known value or an unknown one kept as is."),
1296
1286
  health: z.union([knownHealth, unknownSessionHealthSchema]).describe("Health state after smoothing: a known value or an unknown one kept as is."),
1297
1287
  healthSince: at$2.describe("When the current health value began to hold, as the adapter observed it; health durations count from here."),
1288
+ rateLimitResetAt: at$2.optional().describe("Known reset time while the session is rate limited; omitted otherwise."),
1298
1289
  lastActivityAt: at$2.nullable().describe("When the session last showed activity, or null."),
1299
1290
  endedAt: at$2.nullable().describe("When the session ended, or null while it is live. The adapter supplies it: Spur keeps no end time."),
1300
1291
  endReason: z.enum(SESSION_END_REASONS).nullable().describe("Why the session ended, or null while it is live. Set together with endedAt."),
1301
1292
  queuedRings: z.array(queuedRingSchema).min(1).optional().describe("Board rings still waiting in the session queue, undelivered. Only board rings are listed, never other queued text; absent when none.")
1302
1293
  }).superRefine((session, ctx) => {
1294
+ if (session.rateLimitResetAt !== void 0 && session.health !== "rate_limited") ctx.addIssue({
1295
+ code: "custom",
1296
+ path: ["rateLimitResetAt"],
1297
+ message: "Reset time requires rate_limited health"
1298
+ });
1303
1299
  if (session.endedAt === null !== (session.endReason === null)) ctx.addIssue({
1304
1300
  code: "custom",
1305
1301
  path: [session.endedAt === null ? "endedAt" : "endReason"],
@@ -1312,6 +1308,197 @@ const sessionFactsSchema = z.strictObject({
1312
1308
  ...sessionFactsSchema.keyof().options.map((field) => `session.${field}`)
1313
1309
  ];
1314
1310
  //#endregion
1311
+ //#region ../contracts/src/adapters.ts
1312
+ /** What the source answered for one requested entity. */
1313
+ const ENTITY_STATUSES = [
1314
+ "ok",
1315
+ "not_found",
1316
+ "no_access"
1317
+ ];
1318
+ /** Opaque, adapter-issued position in a source. Core stores it and never parses it. */
1319
+ const sourceCursorSchema = z.string().min(1).brand();
1320
+ /** An ordered historical edge, separate from current session snapshots. */
1321
+ const sessionTransitionSchema = z.strictObject({
1322
+ position: sourceCursorSchema.describe("Opaque position of this edge."),
1323
+ session: actorPartSchema.describe("Session identity."),
1324
+ spurProject: actorPartSchema.describe("Source project at event time."),
1325
+ at: z.iso.datetime().describe("When the producer recorded the edge."),
1326
+ links: z.record(z.string().min(1), z.url()).describe("Published links at event time."),
1327
+ dimension: z.enum(["lifecycle", "health"]).describe("Which session fact changed."),
1328
+ from: z.string().min(1).nullable().describe("Previous value, null on first observation."),
1329
+ to: z.string().min(1).describe("Observed value."),
1330
+ rateLimitResetAt: z.iso.datetime().optional().describe("Known rate limit reset at event time.")
1331
+ });
1332
+ /** A requested entity: a pull request, a ticket or a session. */
1333
+ const entityRefSchema = z.discriminatedUnion("kind", [
1334
+ prRefSchema.extend({ kind: z.literal("pr").describe("A pull request.") }),
1335
+ z.strictObject({
1336
+ kind: z.literal("ticket").describe("A tracker ticket."),
1337
+ trackerId: z.string().min(1).describe("Stable id of the tracker the ticket lives in."),
1338
+ id: z.string().min(1).optional().describe("Known stable ticket id; omitted for a pending manual include."),
1339
+ key: taskKeySchema.describe("Ticket key; matches a pending request before its stable id is known.")
1340
+ }),
1341
+ z.strictObject({
1342
+ kind: z.literal("session").describe("A Spur session."),
1343
+ id: actorPartSchema.describe("Spur session name.")
1344
+ })
1345
+ ]);
1346
+ /** The facts of one entity, tagged with their kind. */
1347
+ const batchItemSchema = z.discriminatedUnion("kind", [
1348
+ z.strictObject({
1349
+ kind: z.literal("pr").describe("Pull request facts."),
1350
+ facts: prFactsSchema,
1351
+ continuation: z.strictObject({ resume: sourceCursorSchema.nullable().describe("Opaque position to read further back from; null at the start of the PR.") }).nullable().optional().describe("Comment history core holds for the next poll (A10): omitted says nothing, null drops it, an object holds facts.feedback with resume.")
1352
+ }),
1353
+ z.strictObject({
1354
+ kind: z.literal("ticket").describe("Ticket facts."),
1355
+ facts: ticketFactsSchema
1356
+ }),
1357
+ z.strictObject({
1358
+ kind: z.literal("session").describe("Session facts."),
1359
+ facts: sessionFactsSchema
1360
+ })
1361
+ ]);
1362
+ /** The identity a requested entity and its item share. */
1363
+ function refIdentity(ref) {
1364
+ switch (ref.kind) {
1365
+ case "pr": return JSON.stringify([
1366
+ ref.kind,
1367
+ ref.repo,
1368
+ ref.number
1369
+ ]);
1370
+ case "ticket": return JSON.stringify([
1371
+ ref.kind,
1372
+ ref.trackerId,
1373
+ ref.id ?? `key:${ref.key}`
1374
+ ]);
1375
+ case "session": return JSON.stringify([ref.kind, ref.id]);
1376
+ }
1377
+ }
1378
+ function itemIdentity(item) {
1379
+ switch (item.kind) {
1380
+ case "pr": return refIdentity({
1381
+ kind: "pr",
1382
+ repo: item.facts.repo,
1383
+ number: item.facts.number
1384
+ });
1385
+ case "ticket": return refIdentity({
1386
+ kind: "ticket",
1387
+ trackerId: item.facts.trackerId,
1388
+ id: item.facts.id,
1389
+ key: item.facts.key
1390
+ });
1391
+ case "session": return refIdentity({
1392
+ kind: "session",
1393
+ id: item.facts.id
1394
+ });
1395
+ }
1396
+ }
1397
+ function itemAnswersRef(item, ref) {
1398
+ if (item.kind !== ref.kind) return false;
1399
+ if (ref.kind === "ticket" && item.kind === "ticket") return item.facts.trackerId === ref.trackerId && (ref.id === void 0 ? item.facts.key === ref.key : item.facts.id === ref.id);
1400
+ return itemIdentity(item) === refIdentity(ref);
1401
+ }
1402
+ const batchSchema = z.strictObject({
1403
+ source: z.string().min(1).describe("Id of the adapter that produced the batch."),
1404
+ observedAt: z.iso.datetime().describe("When the poll started (A2)."),
1405
+ complete: z.boolean().describe("Whether everything was listed without errors (A3); per-entity outcomes aside."),
1406
+ items: z.array(batchItemSchema).describe("Facts observed in this poll."),
1407
+ sessionTransitions: z.array(sessionTransitionSchema).optional().describe("Ordered historical edges; presence makes the feed authoritative for session lifecycle events."),
1408
+ cursor: sourceCursorSchema.optional().describe("Where the next poll continues; omitted when the source has none (A5)."),
1409
+ entities: z.array(z.strictObject({
1410
+ ref: entityRefSchema.describe("The requested entity."),
1411
+ status: z.enum(ENTITY_STATUSES).describe("What the source answered for it.")
1412
+ })).describe("One entry per entity core asked for (A4)."),
1413
+ prProbes: z.array(z.strictObject({
1414
+ ref: prRefSchema.extend({ kind: z.literal("pr").describe("A pull request.") }).describe("The rechecked PR."),
1415
+ status: z.enum([
1416
+ "closed",
1417
+ "refreshed",
1418
+ "not_found",
1419
+ "no_access"
1420
+ ]).describe("Unchanged closed state, full refresh, or failed lookup.")
1421
+ })).optional().describe("State-only PR rechecks, separate from normal entity coverage."),
1422
+ usage: z.strictObject({ points: z.int().nonnegative().describe("Reported points consumed.") }).optional().describe("Reported source points consumed by this attempt."),
1423
+ budget: z.strictObject({
1424
+ remaining: z.int().min(0).describe("Requests or points the source still allows."),
1425
+ resetAt: z.iso.datetime().describe("When the source restores the full budget.")
1426
+ }).optional().describe("Request budget the source reported on this poll; omitted when it reports none.")
1427
+ }).superRefine((batch, ctx) => {
1428
+ const positions = /* @__PURE__ */ new Set();
1429
+ batch.sessionTransitions?.forEach((edge, index) => {
1430
+ if (positions.has(edge.position)) ctx.addIssue({
1431
+ code: "custom",
1432
+ path: [
1433
+ "sessionTransitions",
1434
+ index,
1435
+ "position"
1436
+ ],
1437
+ message: "Report each transition position once"
1438
+ });
1439
+ positions.add(edge.position);
1440
+ });
1441
+ const items = /* @__PURE__ */ new Set();
1442
+ batch.items.forEach((item, index) => {
1443
+ const identity = itemIdentity(item);
1444
+ if (items.has(identity)) ctx.addIssue({
1445
+ code: "custom",
1446
+ path: ["items", index],
1447
+ message: "Report each entity in one item"
1448
+ });
1449
+ items.add(identity);
1450
+ });
1451
+ const requested = /* @__PURE__ */ new Set();
1452
+ batch.entities.forEach((entity, index) => {
1453
+ const identity = refIdentity(entity.ref);
1454
+ if (requested.has(identity)) {
1455
+ ctx.addIssue({
1456
+ code: "custom",
1457
+ path: [
1458
+ "entities",
1459
+ index,
1460
+ "ref"
1461
+ ],
1462
+ message: "List each requested entity once"
1463
+ });
1464
+ return;
1465
+ }
1466
+ requested.add(identity);
1467
+ if (entity.status === "ok" !== batch.items.some((item) => itemAnswersRef(item, entity.ref))) ctx.addIssue({
1468
+ code: "custom",
1469
+ path: [
1470
+ "entities",
1471
+ index,
1472
+ "status"
1473
+ ],
1474
+ message: entity.status === "ok" ? "An ok entity needs its item" : `A ${entity.status} entity has no item`
1475
+ });
1476
+ });
1477
+ }).describe("The result of one poll.");
1478
+ /** Source id of the PR poll of one project repo: `github:<project>:<repo lowercased>`. */
1479
+ function prSourceId(projectId, repo) {
1480
+ return `github:${projectId}:${repo.toLowerCase()}`;
1481
+ }
1482
+ /**
1483
+ * Source id of a project's tracker poll: `jira:<project>`, or
1484
+ * `github-issues:<project>:<tracker repo lowercased>`.
1485
+ */
1486
+ function trackerSourceId(project) {
1487
+ return project.tracker.type === "jira" ? `jira:${project.id}` : `github-issues:${project.id}:${project.tracker.repo.toLowerCase()}`;
1488
+ }
1489
+ /** A whole-poll failure (A6). `retryAt` is when the source allows the next attempt. */
1490
+ var AdapterError = class extends Error {
1491
+ kind;
1492
+ retryAt;
1493
+ usage;
1494
+ constructor(kind, message, options = {}) {
1495
+ super(message, "cause" in options ? { cause: options.cause } : void 0);
1496
+ this.name = "AdapterError";
1497
+ this.kind = kind;
1498
+ this.retryAt = options.retryAt;
1499
+ }
1500
+ };
1501
+ //#endregion
1315
1502
  //#region ../contracts/src/events.ts
1316
1503
  const EVENT_KINDS = [
1317
1504
  "head_moved",
@@ -1415,7 +1602,8 @@ const eventPayloadSchemas = {
1415
1602
  session: S,
1416
1603
  from,
1417
1604
  to: S,
1418
- endReason: z.enum(SESSION_END_REASONS).optional()
1605
+ endReason: z.enum(SESSION_END_REASONS).optional(),
1606
+ transition: sessionTransitionSchema.optional()
1419
1607
  }),
1420
1608
  session_facts_changed: z.looseObject({ facts: sessionFactsSchema }),
1421
1609
  spur_unknown_state: z.looseObject({
@@ -2495,6 +2683,7 @@ const OPERATIONS = [
2495
2683
  turn: taskTurnSchema.nullable().describe("The task's unclosed turn; null when none is open."),
2496
2684
  turns: z.array(taskTurnSchema).optional().describe("Present only with detail: the last 5 closed turns, newest first."),
2497
2685
  links: z.array(linkViewSchema).describe("Effective pull request, session, and ticket links."),
2686
+ sessions: z.array(statusSessionFactsSchema).optional().describe("Current facts of effective linked sessions."),
2498
2687
  blocks: z.array(blockViewSchema).describe("Blocks on the task, open and unblocked."),
2499
2688
  comments: z.array(commentSchema).describe("Comments on the task, oldest first."),
2500
2689
  why: taskWhySchema.optional().describe("Present only with why.")
@@ -3790,171 +3979,6 @@ async function buildCatalogSnapshot(operations) {
3790
3979
  };
3791
3980
  }
3792
3981
  //#endregion
3793
- //#region ../contracts/src/adapters.ts
3794
- /** What the source answered for one requested entity. */
3795
- const ENTITY_STATUSES = [
3796
- "ok",
3797
- "not_found",
3798
- "no_access"
3799
- ];
3800
- /** Opaque, adapter-issued position in a source. Core stores it and never parses it. */
3801
- const sourceCursorSchema = z.string().min(1).brand();
3802
- /** A requested entity: a pull request, a ticket or a session. */
3803
- const entityRefSchema = z.discriminatedUnion("kind", [
3804
- prRefSchema.extend({ kind: z.literal("pr").describe("A pull request.") }),
3805
- z.strictObject({
3806
- kind: z.literal("ticket").describe("A tracker ticket."),
3807
- trackerId: z.string().min(1).describe("Stable id of the tracker the ticket lives in."),
3808
- id: z.string().min(1).optional().describe("Known stable ticket id; omitted for a pending manual include."),
3809
- key: taskKeySchema.describe("Ticket key; matches a pending request before its stable id is known.")
3810
- }),
3811
- z.strictObject({
3812
- kind: z.literal("session").describe("A Spur session."),
3813
- id: actorPartSchema.describe("Spur session name.")
3814
- })
3815
- ]);
3816
- /** The facts of one entity, tagged with their kind. */
3817
- const batchItemSchema = z.discriminatedUnion("kind", [
3818
- z.strictObject({
3819
- kind: z.literal("pr").describe("Pull request facts."),
3820
- facts: prFactsSchema,
3821
- continuation: z.strictObject({ resume: sourceCursorSchema.nullable().describe("Opaque position to read further back from; null at the start of the PR.") }).nullable().optional().describe("Comment history core holds for the next poll (A10): omitted says nothing, null drops it, an object holds facts.feedback with resume.")
3822
- }),
3823
- z.strictObject({
3824
- kind: z.literal("ticket").describe("Ticket facts."),
3825
- facts: ticketFactsSchema
3826
- }),
3827
- z.strictObject({
3828
- kind: z.literal("session").describe("Session facts."),
3829
- facts: sessionFactsSchema
3830
- })
3831
- ]);
3832
- /** The identity a requested entity and its item share. */
3833
- function refIdentity(ref) {
3834
- switch (ref.kind) {
3835
- case "pr": return JSON.stringify([
3836
- ref.kind,
3837
- ref.repo,
3838
- ref.number
3839
- ]);
3840
- case "ticket": return JSON.stringify([
3841
- ref.kind,
3842
- ref.trackerId,
3843
- ref.id ?? `key:${ref.key}`
3844
- ]);
3845
- case "session": return JSON.stringify([ref.kind, ref.id]);
3846
- }
3847
- }
3848
- function itemIdentity(item) {
3849
- switch (item.kind) {
3850
- case "pr": return refIdentity({
3851
- kind: "pr",
3852
- repo: item.facts.repo,
3853
- number: item.facts.number
3854
- });
3855
- case "ticket": return refIdentity({
3856
- kind: "ticket",
3857
- trackerId: item.facts.trackerId,
3858
- id: item.facts.id,
3859
- key: item.facts.key
3860
- });
3861
- case "session": return refIdentity({
3862
- kind: "session",
3863
- id: item.facts.id
3864
- });
3865
- }
3866
- }
3867
- function itemAnswersRef(item, ref) {
3868
- if (item.kind !== ref.kind) return false;
3869
- if (ref.kind === "ticket" && item.kind === "ticket") return item.facts.trackerId === ref.trackerId && (ref.id === void 0 ? item.facts.key === ref.key : item.facts.id === ref.id);
3870
- return itemIdentity(item) === refIdentity(ref);
3871
- }
3872
- const batchSchema = z.strictObject({
3873
- source: z.string().min(1).describe("Id of the adapter that produced the batch."),
3874
- observedAt: z.iso.datetime().describe("When the poll started (A2)."),
3875
- complete: z.boolean().describe("Whether everything was listed without errors (A3); per-entity outcomes aside."),
3876
- items: z.array(batchItemSchema).describe("Facts observed in this poll."),
3877
- cursor: sourceCursorSchema.optional().describe("Where the next poll continues; omitted when the source has none (A5)."),
3878
- entities: z.array(z.strictObject({
3879
- ref: entityRefSchema.describe("The requested entity."),
3880
- status: z.enum(ENTITY_STATUSES).describe("What the source answered for it.")
3881
- })).describe("One entry per entity core asked for (A4)."),
3882
- prProbes: z.array(z.strictObject({
3883
- ref: prRefSchema.extend({ kind: z.literal("pr").describe("A pull request.") }).describe("The rechecked PR."),
3884
- status: z.enum([
3885
- "closed",
3886
- "refreshed",
3887
- "not_found",
3888
- "no_access"
3889
- ]).describe("Unchanged closed state, full refresh, or failed lookup.")
3890
- })).optional().describe("State-only PR rechecks, separate from normal entity coverage."),
3891
- usage: z.strictObject({ points: z.int().nonnegative().describe("Reported points consumed.") }).optional().describe("Reported source points consumed by this attempt."),
3892
- budget: z.strictObject({
3893
- remaining: z.int().min(0).describe("Requests or points the source still allows."),
3894
- resetAt: z.iso.datetime().describe("When the source restores the full budget.")
3895
- }).optional().describe("Request budget the source reported on this poll; omitted when it reports none.")
3896
- }).superRefine((batch, ctx) => {
3897
- const items = /* @__PURE__ */ new Set();
3898
- batch.items.forEach((item, index) => {
3899
- const identity = itemIdentity(item);
3900
- if (items.has(identity)) ctx.addIssue({
3901
- code: "custom",
3902
- path: ["items", index],
3903
- message: "Report each entity in one item"
3904
- });
3905
- items.add(identity);
3906
- });
3907
- const requested = /* @__PURE__ */ new Set();
3908
- batch.entities.forEach((entity, index) => {
3909
- const identity = refIdentity(entity.ref);
3910
- if (requested.has(identity)) {
3911
- ctx.addIssue({
3912
- code: "custom",
3913
- path: [
3914
- "entities",
3915
- index,
3916
- "ref"
3917
- ],
3918
- message: "List each requested entity once"
3919
- });
3920
- return;
3921
- }
3922
- requested.add(identity);
3923
- if (entity.status === "ok" !== batch.items.some((item) => itemAnswersRef(item, entity.ref))) ctx.addIssue({
3924
- code: "custom",
3925
- path: [
3926
- "entities",
3927
- index,
3928
- "status"
3929
- ],
3930
- message: entity.status === "ok" ? "An ok entity needs its item" : `A ${entity.status} entity has no item`
3931
- });
3932
- });
3933
- }).describe("The result of one poll.");
3934
- /** Source id of the PR poll of one project repo: `github:<project>:<repo lowercased>`. */
3935
- function prSourceId(projectId, repo) {
3936
- return `github:${projectId}:${repo.toLowerCase()}`;
3937
- }
3938
- /**
3939
- * Source id of a project's tracker poll: `jira:<project>`, or
3940
- * `github-issues:<project>:<tracker repo lowercased>`.
3941
- */
3942
- function trackerSourceId(project) {
3943
- return project.tracker.type === "jira" ? `jira:${project.id}` : `github-issues:${project.id}:${project.tracker.repo.toLowerCase()}`;
3944
- }
3945
- /** A whole-poll failure (A6). `retryAt` is when the source allows the next attempt. */
3946
- var AdapterError = class extends Error {
3947
- kind;
3948
- retryAt;
3949
- usage;
3950
- constructor(kind, message, options = {}) {
3951
- super(message, "cause" in options ? { cause: options.cause } : void 0);
3952
- this.name = "AdapterError";
3953
- this.kind = kind;
3954
- this.retryAt = options.retryAt;
3955
- }
3956
- };
3957
- //#endregion
3958
3982
  //#region ../contracts/src/systemd.ts
3959
3983
  /**
3960
3984
  * systemd user-unit policy shared by the CLI unit writer and the daemon's board tick.
@@ -4041,4 +4065,4 @@ function assertNever(value) {
4041
4065
  throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
4042
4066
  }
4043
4067
  //#endregion
4044
- export { errorEnvelopeSchema as $, EVENT_KINDS as A, ringMarker as B, renderMcpError as C, interactionRefSchema as D, inboundEventSchema as E, SESSION_STATUSES as F, actorIdSchema as G, ticketFactsSchema as H, isExternalAuthor as I, parseActorId as J, encodeActorId as K, parseRingMarker as L, PR_STATES as M, REVIEW_STATES as N, messageRefSchema as O, SESSION_HEALTH_STATES as P, errorContextSchema as Q, prFactsSchema as R, renderJsonError as S, conversationRefSchema as T, JIRA_PROJECT_KEY as U, sessionFactsSchema as V, REF_NUMBER as W, ERRORS as X, parseRef as Y, err as Z, buildCatalogSnapshot as _, requestHashOf as a, DEFAULT_SLACK_COMMAND as at, turnHandedSchema as b, tokenRequestStatusSchema as c, plainHttpAllowed as ct, AdapterError as d, DISPATCHER_MODES as dt, ok as et, batchSchema as f, SLACK_BOT_SCOPES as ft, trackerSourceId as g, sourceCursorSchema as h, TOKEN_REQUEST_LIMITS as i, DEFAULT_SLACK_APP_NAME as it, eventPayloadSchemas as j, userIdSchema as k, BOARD_TICK_MS as l, requiredSecretKeys as lt, prSourceId as m, doctorReportSchema as n, DEFAULT_HTTP_PORT as nt, tokenRequestResultSchema as o, RESERVED_PROJECT as ot, entityRefSchema as p, TASK_HOLDS as pt, errorCodeOf as q, remoteDoctorReportSchema as r, DEFAULT_LINK as rt, tokenRequestSchema as s, configSchema as st, assertNever as t, successEnvelopeSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, COLUMN_IDS as ut, roleCanUseOperation as v, SPACE_IDS as w, renderHttpProblem as x, OPERATIONS as y, prRefSchema as z };
4068
+ export { errorContextSchema as $, sessionTransitionSchema as A, prRefSchema as B, userIdSchema as C, batchSchema as D, AdapterError as E, SESSION_HEALTH_STATES as F, REF_NUMBER as G, sessionFactsSchema as H, SESSION_STATUSES as I, errorCodeOf as J, actorIdSchema as K, isExternalAuthor as L, trackerSourceId as M, PR_STATES as N, entityRefSchema as O, REVIEW_STATES as P, err as Q, parseRingMarker as R, messageRefSchema as S, eventPayloadSchemas as T, ticketFactsSchema as U, ringMarker as V, JIRA_PROJECT_KEY as W, parseRef as X, parseActorId as Y, ERRORS as Z, renderMcpError as _, requestHashOf as a, DEFAULT_SLACK_APP_NAME as at, inboundEventSchema as b, tokenRequestStatusSchema as c, configSchema as ct, buildCatalogSnapshot as d, COLUMN_IDS as dt, errorEnvelopeSchema as et, roleCanUseOperation as f, DISPATCHER_MODES as ft, renderJsonError as g, renderHttpProblem as h, TOKEN_REQUEST_LIMITS as i, DEFAULT_LINK as it, sourceCursorSchema as j, prSourceId as k, BOARD_TICK_MS as l, plainHttpAllowed as lt, turnHandedSchema as m, TASK_HOLDS as mt, doctorReportSchema as n, successEnvelopeSchema as nt, tokenRequestResultSchema as o, DEFAULT_SLACK_COMMAND as ot, OPERATIONS as p, SLACK_BOT_SCOPES as pt, encodeActorId as q, remoteDoctorReportSchema as r, DEFAULT_HTTP_PORT as rt, tokenRequestSchema as s, RESERVED_PROJECT as st, assertNever as t, ok as tt, SYSTEMD_SERVICE_SETTINGS as u, requiredSecretKeys as ut, SPACE_IDS as v, EVENT_KINDS as w, interactionRefSchema as x, conversationRefSchema as y, prFactsSchema as z };
@@ -1,4 +1,4 @@
1
- import { $ as errorEnvelopeSchema, Q as errorContextSchema, S as renderJsonError, X as ERRORS, c as tokenRequestStatusSchema, o as tokenRequestResultSchema, tt as successEnvelopeSchema } from "./chunk-C2Q6FYcu.mjs";
1
+ import { $ as errorContextSchema, Z as ERRORS, c as tokenRequestStatusSchema, et as errorEnvelopeSchema, g as renderJsonError, nt as successEnvelopeSchema, o as tokenRequestResultSchema } from "./chunk-BONq7Qxa.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { G as actorIdSchema, X as ERRORS, a as requestHashOf, ft as SLACK_BOT_SCOPES, lt as requiredSecretKeys, r as remoteDoctorReportSchema, st as configSchema, tt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-C2Q6FYcu.mjs";
1
+ import { K as actorIdSchema, Z as ERRORS, a as requestHashOf, ct as configSchema, f as roleCanUseOperation, nt as successEnvelopeSchema, p as OPERATIONS, pt as SLACK_BOT_SCOPES, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as requiredSecretKeys } from "./chunk-BONq7Qxa.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-OVqHRmrz.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-TFUh3jZ2.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-CDacbdk2.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-B1XoUsys.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-OVqHRmrz.mjs";
1
+ import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-CDacbdk2.mjs";
2
2
  export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as EVENT_KINDS, B as ringMarker, D as interactionRefSchema, E as inboundEventSchema, F as SESSION_STATUSES, G as actorIdSchema, H as ticketFactsSchema, I as isExternalAuthor, J as parseActorId, K as encodeActorId, L as parseRingMarker, M as PR_STATES, N as REVIEW_STATES, O as messageRefSchema, P as SESSION_HEALTH_STATES, R as prFactsSchema, T as conversationRefSchema, U as JIRA_PROJECT_KEY, V as sessionFactsSchema, W as REF_NUMBER, X as ERRORS, Y as parseRef$1, Z as err, _ as buildCatalogSnapshot, a as requestHashOf, at as DEFAULT_SLACK_COMMAND, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as plainHttpAllowed, d as AdapterError, dt as DISPATCHER_MODES, et as ok, f as batchSchema, ft as SLACK_BOT_SCOPES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as requiredSecretKeys, m as prSourceId, n as doctorReportSchema, o as tokenRequestResultSchema, ot as RESERVED_PROJECT, p as entityRefSchema, pt as TASK_HOLDS, q as errorCodeOf, rt as DEFAULT_LINK, s as tokenRequestSchema, st as configSchema, t as assertNever, tt as successEnvelopeSchema, ut as COLUMN_IDS, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as prRefSchema } from "./chunk-C2Q6FYcu.mjs";
1
+ import { A as sessionTransitionSchema, B as prRefSchema, C as userIdSchema, D as batchSchema, E as AdapterError, F as SESSION_HEALTH_STATES, G as REF_NUMBER, H as sessionFactsSchema, I as SESSION_STATUSES, J as errorCodeOf, K as actorIdSchema, L as isExternalAuthor, M as trackerSourceId, N as PR_STATES, O as entityRefSchema, P as REVIEW_STATES, Q as err, R as parseRingMarker, S as messageRefSchema, T as eventPayloadSchemas, U as ticketFactsSchema, V as ringMarker, W as JIRA_PROJECT_KEY, X as parseRef$1, Y as parseActorId, Z as ERRORS, a as requestHashOf, b as inboundEventSchema, c as tokenRequestStatusSchema, ct as configSchema, d as buildCatalogSnapshot, dt as COLUMN_IDS, f as roleCanUseOperation, ft as DISPATCHER_MODES, h as renderHttpProblem, i as TOKEN_REQUEST_LIMITS, it as DEFAULT_LINK, j as sourceCursorSchema, k as prSourceId, l as BOARD_TICK_MS, lt as plainHttpAllowed, m as turnHandedSchema, mt as TASK_HOLDS, n as doctorReportSchema, nt as successEnvelopeSchema, o as tokenRequestResultSchema, ot as DEFAULT_SLACK_COMMAND, p as OPERATIONS, pt as SLACK_BOT_SCOPES, q as encodeActorId, s as tokenRequestSchema, st as RESERVED_PROJECT, t as assertNever, tt as ok, ut as requiredSecretKeys, v as SPACE_IDS, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, z as prFactsSchema } from "./chunk-BONq7Qxa.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";
@@ -9558,9 +9558,12 @@ function personaFor(config, subject, actor) {
9558
9558
  };
9559
9559
  const parsed = parseActorId(actor);
9560
9560
  if (parsed?.actor !== "agent") throw new Error("Invalid actor");
9561
+ const { project } = parsed.actorRef;
9562
+ const entry = config.projects.flatMap((p) => p.spurProjects).find((spur) => spur.name === project);
9561
9563
  return {
9562
- name: parsed.actorRef.project,
9563
- role: personaRole(authorRole(config, subject, actor))
9564
+ name: entry?.displayName ?? project,
9565
+ role: personaRole(authorRole(config, subject, actor)),
9566
+ ...entry?.icon === void 0 ? {} : { icon: entry.icon }
9564
9567
  };
9565
9568
  }
9566
9569
  async function queueBlockOpen(trx, subject, block, ctx, config) {
@@ -14624,7 +14627,8 @@ function evaluateSessionHealth(input) {
14624
14627
  statuses.push({
14625
14628
  taskId: session.taskId,
14626
14629
  sessionId: session.id,
14627
- kind: "rate_limited"
14630
+ kind: "rate_limited",
14631
+ ...session.rateLimitResetAt === void 0 ? {} : { rateLimitResetAt: session.rateLimitResetAt }
14628
14632
  });
14629
14633
  continue;
14630
14634
  }
@@ -15834,6 +15838,21 @@ async function taskTurns(trx, task, detail) {
15834
15838
  };
15835
15839
  }
15836
15840
  //#endregion
15841
+ //#region ../core/src/app/task-sessions.ts
15842
+ /** Current facts of the effective session links that task.get exposes. */
15843
+ async function taskSessions(trx, taskId) {
15844
+ return (await trx.selectFrom("link").innerJoin("session_snapshot", "session_snapshot.id", "link.session_id").select("session_snapshot.detail").where("link.task_id", "=", taskId).where("link.entity", "=", "session").where("link.banned", "=", 0).orderBy("link.id").execute()).map((row) => {
15845
+ const facts = parseJson(sessionFactsSchema, row.detail);
15846
+ return {
15847
+ ...facts,
15848
+ links: Object.entries(facts.links).map(([label, url]) => ({
15849
+ label,
15850
+ url
15851
+ }))
15852
+ };
15853
+ });
15854
+ }
15855
+ //#endregion
15837
15856
  //#region ../core/src/app/task-queries.ts
15838
15857
  /** How many of the last moves `task.get --why` shows. */
15839
15858
  const WHY_MOVES = 5;
@@ -16053,6 +16072,7 @@ function createTaskQueries(deps) {
16053
16072
  ]);
16054
16073
  const subject = taskSubject(task);
16055
16074
  return {
16075
+ sessions: await taskSessions(trx, task.id),
16056
16076
  task: taskView(task),
16057
16077
  ...await taskTurns(trx, task, input.detail === true),
16058
16078
  links: links.map(({ state, ...link }) => {
@@ -17081,7 +17101,47 @@ function branchHasKey(branch, key) {
17081
17101
  }
17082
17102
  /** The Jira task key at the end of a session's `/browse/` link. */
17083
17103
  const BROWSE_KEY = new RegExp(`/browse/(${JIRA_PROJECT_KEY}-${REF_NUMBER})$`);
17084
- async function session(trx, config, fact, at, source, ambiguousBranches) {
17104
+ /** Parse a published task URL without deciding whether that task is currently known. */
17105
+ function sessionTaskKey(url) {
17106
+ const candidate = BROWSE_KEY.exec(url)?.[1] ?? /\/issues\/([1-9]\d*)$/.exec(url)?.[1];
17107
+ return candidate === void 0 ? void 0 : url.includes("/issues/") ? `${new URL(url).pathname.split("/").slice(1, 3).join("/")}#${candidate}` : candidate;
17108
+ }
17109
+ /** Select one explicit label before resolving its task; unknown selections never fall through. */
17110
+ async function resolveSessionLabels(trx, config, links) {
17111
+ let key;
17112
+ let role;
17113
+ for (const label of ["board-worker", "board-other"]) {
17114
+ const url = links[label];
17115
+ if (url === void 0) continue;
17116
+ key = sessionTaskKey(url);
17117
+ role = label === "board-worker" ? "worker" : "other";
17118
+ if (key !== void 0) break;
17119
+ }
17120
+ const task = key === void 0 || projectForKey(config, key) === null ? void 0 : await trx.selectFrom("task").selectAll().where("key", "=", key).executeTakeFirst();
17121
+ return {
17122
+ key,
17123
+ role,
17124
+ task
17125
+ };
17126
+ }
17127
+ /** History is journaled without changing snapshots, links or task change times. */
17128
+ async function sessionTransition(trx, config, edge) {
17129
+ const projects = config.projects.filter((project) => project.spurProjects.some((spur) => spur.name === edge.spurProject));
17130
+ const { task } = await resolveSessionLabels(trx, config, edge.links);
17131
+ if (task !== void 0) await emit(trx, "session_state_changed", task.project, task.id, edge.at, {
17132
+ session: edge.session,
17133
+ from: edge.from,
17134
+ to: edge.to,
17135
+ transition: edge
17136
+ });
17137
+ else for (const project of projects) await emit(trx, "session_state_changed", project.id, null, edge.at, {
17138
+ session: edge.session,
17139
+ from: edge.from,
17140
+ to: edge.to,
17141
+ transition: edge
17142
+ });
17143
+ }
17144
+ async function session(trx, config, fact, at, source, ambiguousBranches, feedEnabled) {
17085
17145
  const old = await trx.selectFrom("session_snapshot").selectAll().where("id", "=", fact.id).executeTakeFirst();
17086
17146
  const previous = old === void 0 ? null : parseJson(sessionFactsSchema, old.detail);
17087
17147
  const changed = previous === null || JSON.stringify(previous) !== JSON.stringify(fact);
@@ -17134,16 +17194,9 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
17134
17194
  });
17135
17195
  }
17136
17196
  }
17137
- let key;
17138
- let role;
17139
- for (const label of ["board-worker", "board-other"]) {
17140
- const url = fact.links[label];
17141
- if (url === void 0) continue;
17142
- const candidate = BROWSE_KEY.exec(url)?.[1] ?? /\/issues\/([1-9]\d*)$/.exec(url)?.[1];
17143
- key = candidate === void 0 ? void 0 : url.includes("/issues/") ? `${new URL(url).pathname.split("/").slice(1, 3).join("/")}#${candidate}` : candidate;
17144
- role = label === "board-worker" && !orchestrator ? "worker" : "other";
17145
- if (key !== void 0) break;
17146
- }
17197
+ const explicit = await resolveSessionLabels(trx, config, fact.links);
17198
+ let key = explicit.key;
17199
+ let role = orchestrator && explicit.role === "worker" ? "other" : explicit.role;
17147
17200
  let prOnlyKey;
17148
17201
  if (key === void 0 && fact.pr !== null) {
17149
17202
  const linked = await trx.selectFrom("link").innerJoin("task", "task.id", "link.task_id").leftJoin("pr_snapshot", (join) => join.on(sql`lower(pr_snapshot.repo) = lower(link.repo)`).onRef("pr_snapshot.number", "=", "link.number")).select([
@@ -17172,8 +17225,8 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
17172
17225
  key = prOnlyKey;
17173
17226
  role = "other";
17174
17227
  }
17175
- if (key !== void 0 && projectForKey(config, key) !== null) {
17176
- const task = await trx.selectFrom("task").selectAll().where("key", "=", key).executeTakeFirst();
17228
+ if (key !== void 0) {
17229
+ const task = explicit.key !== void 0 ? explicit.task : projectForKey(config, key) === null ? void 0 : await trx.selectFrom("task").selectAll().where("key", "=", key).executeTakeFirst();
17177
17230
  if (task !== void 0) {
17178
17231
  if (await trx.selectFrom("link").selectAll().where("entity", "=", "session").where("session_id", "=", fact.id).where("task_id", "=", task.id).executeTakeFirst() === void 0) {
17179
17232
  const worker = await trx.selectFrom("link").selectAll().where("task_id", "=", task.id).where("entity", "=", "session").where("role", "=", "worker").where("banned", "=", 0).executeTakeFirst();
@@ -17206,7 +17259,7 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
17206
17259
  const links = await trx.selectFrom("link").select(["task_id"]).where("entity", "=", "session").where("session_id", "=", fact.id).execute();
17207
17260
  for (const link of links) {
17208
17261
  const task = await trx.selectFrom("task").selectAll().where("id", "=", link.task_id).executeTakeFirstOrThrow();
17209
- if (previous?.lifecycle !== fact.lifecycle && previous !== null) await emit(trx, "session_state_changed", task.project, task.id, at, {
17262
+ if (!feedEnabled && previous?.lifecycle !== fact.lifecycle && previous !== null) await emit(trx, "session_state_changed", task.project, task.id, at, {
17210
17263
  session: fact.id,
17211
17264
  from: previous.lifecycle,
17212
17265
  to: fact.lifecycle
@@ -17432,7 +17485,8 @@ function createObservationCore(deps) {
17432
17485
  else if (item.kind === "pr") {
17433
17486
  await pr(trx, config, item.facts, batch.observedAt, source);
17434
17487
  await holdContinuation(trx, source, item);
17435
- } else await session(trx, config, item.facts, batch.observedAt, source, ambiguous);
17488
+ } else await session(trx, config, item.facts, batch.observedAt, source, ambiguous, batch.sessionTransitions !== void 0);
17489
+ for (const edge of batch.sessionTransitions ?? []) await sessionTransition(trx, config, edge);
17436
17490
  const linked = (await linkedPrs(trx, source)).map(refKey);
17437
17491
  await trx.deleteFrom("pr_continuation").where("source", "=", source).$if(linked.length > 0, (query) => query.where("ref_key", "not in", linked)).execute();
17438
17492
  for (const entity of batch.entities) {
@@ -21593,6 +21647,7 @@ const sessionWire = z.object({
21593
21647
  branch: z.string().nullable().optional(),
21594
21648
  status: z.string().min(1),
21595
21649
  state: z.string().min(1),
21650
+ rateLimitResetAt: z.iso.datetime().optional(),
21596
21651
  lastActivityAt: z.iso.datetime().nullable().optional(),
21597
21652
  slots: z.object({ links: z.array(z.object({
21598
21653
  label: z.string().min(1),
@@ -21600,6 +21655,26 @@ const sessionWire = z.object({
21600
21655
  })).optional() }).optional(),
21601
21656
  queuedMessages: z.object({ messages: z.array(z.string()) }).optional()
21602
21657
  });
21658
+ const transitionWire = z.object({
21659
+ cursor: z.string().min(1),
21660
+ sessionId: z.string().min(1),
21661
+ project: z.string().min(1),
21662
+ at: z.iso.datetime(),
21663
+ links: z.array(z.object({
21664
+ label: z.string().min(1),
21665
+ url: z.url()
21666
+ })),
21667
+ kind: z.enum(["status", "state"]),
21668
+ from: z.string().min(1).nullable(),
21669
+ to: z.string().min(1),
21670
+ rateLimitResetAt: z.iso.datetime().optional()
21671
+ });
21672
+ const transitionsWire = z.object({
21673
+ entries: z.array(transitionWire).max(1e3),
21674
+ nextCursor: sourceCursorSchema,
21675
+ hasMore: z.boolean()
21676
+ });
21677
+ const foreignCursorWire = z.object({ error: z.literal("Invalid or foreign transitions cursor") });
21603
21678
  /** The board rings a session's queue still holds, sorted and deduped; other queued text is dropped. */
21604
21679
  function queuedBoardRings(wire) {
21605
21680
  const rings = /* @__PURE__ */ new Map();
@@ -21635,7 +21710,7 @@ function createSpurAdapter(options) {
21635
21710
  }, REQUEST_TIMEOUT_MS);
21636
21711
  try {
21637
21712
  const response = await fetchImpl(new URL(path, base), { signal: controller.signal });
21638
- if (!response.ok) return { response };
21713
+ if (!response.ok && response.status !== 410 && response.status !== 400) return { response };
21639
21714
  try {
21640
21715
  return {
21641
21716
  response,
@@ -21706,6 +21781,7 @@ function createSpurAdapter(options) {
21706
21781
  lifecycle: wire.status,
21707
21782
  health: state.stable,
21708
21783
  healthSince: state.since,
21784
+ ...wire.state === "rate_limited" && state.stable === "rate_limited" && wire.rateLimitResetAt !== void 0 ? { rateLimitResetAt: wire.rateLimitResetAt } : {},
21709
21785
  lastActivityAt: wire.lastActivityAt ?? null,
21710
21786
  endedAt: endReason === null ? null : observedAt,
21711
21787
  endReason,
@@ -21717,6 +21793,49 @@ function createSpurAdapter(options) {
21717
21793
  intervalMs: options.intervalMs,
21718
21794
  async poll(ctx) {
21719
21795
  const observedAt = new Date(options.now()).toISOString();
21796
+ let cursor = ctx.cursor;
21797
+ const sessionTransitions = [];
21798
+ const positions = /* @__PURE__ */ new Set();
21799
+ for (let page = 0; page < 4; page++) {
21800
+ const query = new URLSearchParams({
21801
+ limit: "1000",
21802
+ kinds: "status,state"
21803
+ });
21804
+ if (cursor !== void 0) query.set("since", cursor);
21805
+ const { response, body } = await request(`sessions/transitions?${query.toString()}`, ctx.signal);
21806
+ if (page === 0 && cursor !== void 0 && response.status === 400 && foreignCursorWire.safeParse(body).success) {
21807
+ cursor = void 0;
21808
+ continue;
21809
+ }
21810
+ if (response.status === 410) {
21811
+ cursor = parseWire(z.object({ latestCursor: sourceCursorSchema }), body, "Invalid Spur expired cursor").latestCursor;
21812
+ sessionTransitions.length = 0;
21813
+ break;
21814
+ }
21815
+ if (!response.ok) throw classifyHttpFailure({
21816
+ status: response.status,
21817
+ headers: response.headers
21818
+ }, options.now());
21819
+ const feed = parseWire(transitionsWire, body, "Invalid Spur transitions");
21820
+ for (const entry of feed.entries) {
21821
+ if (positions.has(entry.cursor) || entry.cursor === cursor) throw new AdapterError("transient", "Repeated Spur transition position");
21822
+ positions.add(entry.cursor);
21823
+ sessionTransitions.push(sessionTransitionSchema.parse({
21824
+ position: entry.cursor,
21825
+ session: entry.sessionId,
21826
+ spurProject: entry.project,
21827
+ at: entry.at,
21828
+ links: Object.fromEntries(entry.links.map(({ label, url }) => [label, url])),
21829
+ dimension: entry.kind === "status" ? "lifecycle" : "health",
21830
+ from: entry.from,
21831
+ to: entry.to,
21832
+ ...entry.rateLimitResetAt === void 0 ? {} : { rateLimitResetAt: entry.rateLimitResetAt }
21833
+ }));
21834
+ }
21835
+ if (feed.hasMore && (feed.nextCursor === cursor || feed.entries.length === 0)) throw new AdapterError("transient", "Spur transitions made no progress");
21836
+ cursor = feed.nextCursor;
21837
+ if (!feed.hasMore) break;
21838
+ }
21720
21839
  const { response: listResponse, body: listBody } = await request("sessions", ctx.signal);
21721
21840
  if (!listResponse.ok) throw classifyHttpFailure({
21722
21841
  status: listResponse.status,
@@ -21779,7 +21898,9 @@ function createSpurAdapter(options) {
21779
21898
  entities: ctx.observe.sessions.map((ref) => ({
21780
21899
  ref,
21781
21900
  status: byId.has(ref.id) || detail.get(ref.id) !== null ? "ok" : "not_found"
21782
- }))
21901
+ })),
21902
+ sessionTransitions,
21903
+ ...cursor === void 0 ? {} : { cursor }
21783
21904
  };
21784
21905
  if (restartNotice) await options.onNotice?.(restartNotice);
21785
21906
  for (const wire of [...listed, ...detail.values()]) {
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { C as renderMcpError, X as ERRORS, y as OPERATIONS } from "./chunk-C2Q6FYcu.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-OVqHRmrz.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-TFUh3jZ2.mjs";
1
+ import { Z as ERRORS, _ as renderMcpError, p as OPERATIONS } from "./chunk-BONq7Qxa.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-CDacbdk2.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-B1XoUsys.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.62.2",
3
+ "version": "0.63.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -123,19 +123,20 @@ someone else. Answer in the existing block thread to preserve its task context.
123
123
 
124
124
  Once a `projects[].spurProjects[].shortName` is set, a new operator message in
125
125
  `slack.channels.orchestrators` starts a conversation. A leading registered
126
- `@shortName` selects that Spur project and is stripped from the text. With an
126
+ `@shortName` selects that Spur project and is stripped. With an
127
127
  absent or unknown leading name, `slack.defaultAddressee` receives the complete
128
128
  text, retaining any unknown prefix; without it the Board replies once with the
129
129
  valid prefixes. A mention in the middle, or a Slack `<@U…>` mention, addresses
130
130
  nobody; an unknown name causes no lookup error. The operator checks short-name
131
- collisions with workspace names. A task key right after the prefix attaches the
132
- conversation to that task.
133
-
134
- The addressee is rung with the block ID, reads the text in `board inbox` and
135
- replies in the thread with `board answer`. An operator-role addressee posts as
136
- `board`, a column orchestrator on its column's task as orchestrator. Each
137
- operator thread message rings it again; `close` or ✅ in the thread closes it.
138
- While no live session can take it, `board status` lists it as waiting.
131
+ collisions with workspace names. A task key right after the prefix attaches
132
+ that task.
133
+
134
+ The addressee is rung with the block ID, reads it in `board inbox` and replies
135
+ in the thread with `board answer`. Each operator thread message rings it again;
136
+ `close` or ✅ in the thread closes it. Replies use
137
+ `projects[].spurProjects[].displayName` and `icon`, else the project name and
138
+ role icon (`board` for operator roles). With no live session,
139
+ `board status` lists it as waiting.
139
140
 
140
141
  ## Done follows the ticket
141
142