spur-board 0.62.1 → 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.
- package/dist/{chunk-DyPssI65.mjs → chunk-B1XoUsys.mjs} +2 -2
- package/dist/{chunk-CzdGYlBy.mjs → chunk-BONq7Qxa.mjs} +269 -213
- package/dist/{chunk-Czc8fVqW.mjs → chunk-CDacbdk2.mjs} +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +404 -70
- package/dist/mcp.mjs +3 -3
- package/dist/migrations/0021_submission_pending.sql +7 -0
- package/package.json +1 -1
- package/skills/spur-board/references/commands.md +1 -1
- package/skills/spur-board/references/errors.md +2 -2
- package/skills/spur-board/references/how-board-works.md +18 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
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";
|
|
@@ -149,6 +149,7 @@ const TASK_HOLDS = [
|
|
|
149
149
|
"github_blind",
|
|
150
150
|
"spur_blind",
|
|
151
151
|
"ticket_unconfirmed",
|
|
152
|
+
"submit_pending",
|
|
152
153
|
"cycle_limit",
|
|
153
154
|
"work_not_started"
|
|
154
155
|
];
|
|
@@ -296,8 +297,8 @@ const spurProject = z.strictObject({
|
|
|
296
297
|
"orchestrator"
|
|
297
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."),
|
|
298
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."),
|
|
299
|
-
displayName: nonEmpty.max(80).optional().describe("The name a curator's answer lines in the feed
|
|
300
|
-
icon: z.string().regex(/^:[a-z0-9_+'-]+:$/, "Expected an emoji shortcode such as :owl:").optional().describe("The emoji shortcode, such as :owl:, shown on
|
|
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.")
|
|
301
302
|
});
|
|
302
303
|
const DEFAULT_CYCLE_LIMIT = 10;
|
|
303
304
|
const DEFAULT_COURSE_CHECK = 3;
|
|
@@ -362,17 +363,7 @@ const projectSchema = z.strictObject({
|
|
|
362
363
|
rejectDuplicates(items, "name", "spur project name", ctx);
|
|
363
364
|
let curator;
|
|
364
365
|
items.forEach((item, i) => {
|
|
365
|
-
if (item.role !== "curator")
|
|
366
|
-
for (const field of ["displayName", "icon"]) {
|
|
367
|
-
if (item[field] === void 0) continue;
|
|
368
|
-
ctx.addIssue({
|
|
369
|
-
code: "custom",
|
|
370
|
-
path: [i, field],
|
|
371
|
-
message: "displayName and icon apply only to a curator"
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
366
|
+
if (item.role !== "curator") return;
|
|
376
367
|
if (curator !== void 0) ctx.addIssue({
|
|
377
368
|
code: "custom",
|
|
378
369
|
path: [i, "role"],
|
|
@@ -388,7 +379,10 @@ const projectSchema = z.strictObject({
|
|
|
388
379
|
cycleLimit: DEFAULT_CYCLE_LIMIT,
|
|
389
380
|
courseCheck: DEFAULT_COURSE_CHECK
|
|
390
381
|
}))).describe("The project's board columns in canonical order. todo, dev and done must be present and enabled. A column left out or disabled is skipped. Without this key, all nine columns are enabled with orchestrator none."),
|
|
391
|
-
dispatcher: z.strictObject({
|
|
382
|
+
dispatcher: z.strictObject({
|
|
383
|
+
mode: z.enum(DISPATCHER_MODES).default("shadow").describe("shadow: the board evaluates the column gates and records where each task would go in its shadow column, and opens no turn, doorbell or block; the column executor submits with the task key. on: the board moves the task between columns, hands the column executor a turn, and raises the cycle-limit and course-check blocks."),
|
|
384
|
+
submitConfirmMs: durationMs(18e4, "How long the board waits to confirm a turn submit it accepted pending (no PR linked yet, or GitHub not confirming the head) before handing the turn back to its executor with the reason")
|
|
385
|
+
}).prefault({}).describe("How the board moves tasks between columns. The board records the mode it last ran with. The daemon reads the mode at start, so a change takes effect after a restart; a switch from shadow to on copies the shadow column of each task into its column, and a switch back to shadow closes the open turns and starts the shadow column from the column again.")
|
|
392
386
|
}).superRefine((project, ctx) => {
|
|
393
387
|
const repos = new Set(project.repos.map((repo) => repo.toLowerCase()));
|
|
394
388
|
project.reposWithoutCi.forEach((repo, j) => {
|
|
@@ -763,9 +757,9 @@ const ERRORS = {
|
|
|
763
757
|
head_mismatch: spec("head_mismatch", {
|
|
764
758
|
status: 409,
|
|
765
759
|
exit: EXIT_CODES.refused,
|
|
766
|
-
message: "The commit is not the head
|
|
767
|
-
hint: "Push the commit to the task's pull request branch and submit
|
|
768
|
-
recovery: noRetry("Push the commit to the task's pull request branch and submit
|
|
760
|
+
message: "The commit is not the head GitHub reports for the task's pull request, or a submit by task key found no pull request.",
|
|
761
|
+
hint: "Push the commit to the task's pull request branch and submit the head GitHub shows.",
|
|
762
|
+
recovery: noRetry("Push the commit to the task's pull request branch and submit the head GitHub shows.")
|
|
769
763
|
}),
|
|
770
764
|
return_not_allowed: spec("return_not_allowed", {
|
|
771
765
|
status: 409,
|
|
@@ -834,8 +828,8 @@ const ERRORS = {
|
|
|
834
828
|
status: 503,
|
|
835
829
|
exit: EXIT_CODES.notApplied,
|
|
836
830
|
message: "GitHub did not confirm current pull request facts.",
|
|
837
|
-
hint: "
|
|
838
|
-
recovery: retry("
|
|
831
|
+
hint: "Follow the message: ask the operator to fix what it names, or retry a read or link once GitHub answers the board's polls; repeat a submit only by task key in shadow mode.",
|
|
832
|
+
recovery: retry("Ask the operator to fix what the message names; retry a read or link once GitHub answers, and repeat a submit only by task key in shadow mode.", "After GitHub answers the board's polls.")
|
|
839
833
|
}),
|
|
840
834
|
version_mismatch: spec("version_mismatch", {
|
|
841
835
|
status: 409,
|
|
@@ -1291,11 +1285,17 @@ const sessionFactsSchema = z.strictObject({
|
|
|
1291
1285
|
lifecycle: z.union([knownStatus, unknownSessionStatusSchema]).describe("Lifecycle status: a known value or an unknown one kept as is."),
|
|
1292
1286
|
health: z.union([knownHealth, unknownSessionHealthSchema]).describe("Health state after smoothing: a known value or an unknown one kept as is."),
|
|
1293
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."),
|
|
1294
1289
|
lastActivityAt: at$2.nullable().describe("When the session last showed activity, or null."),
|
|
1295
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."),
|
|
1296
1291
|
endReason: z.enum(SESSION_END_REASONS).nullable().describe("Why the session ended, or null while it is live. Set together with endedAt."),
|
|
1297
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.")
|
|
1298
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
|
+
});
|
|
1299
1299
|
if (session.endedAt === null !== (session.endReason === null)) ctx.addIssue({
|
|
1300
1300
|
code: "custom",
|
|
1301
1301
|
path: [session.endedAt === null ? "endedAt" : "endReason"],
|
|
@@ -1308,6 +1308,197 @@ const sessionFactsSchema = z.strictObject({
|
|
|
1308
1308
|
...sessionFactsSchema.keyof().options.map((field) => `session.${field}`)
|
|
1309
1309
|
];
|
|
1310
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
|
|
1311
1502
|
//#region ../contracts/src/events.ts
|
|
1312
1503
|
const EVENT_KINDS = [
|
|
1313
1504
|
"head_moved",
|
|
@@ -1411,7 +1602,8 @@ const eventPayloadSchemas = {
|
|
|
1411
1602
|
session: S,
|
|
1412
1603
|
from,
|
|
1413
1604
|
to: S,
|
|
1414
|
-
endReason: z.enum(SESSION_END_REASONS).optional()
|
|
1605
|
+
endReason: z.enum(SESSION_END_REASONS).optional(),
|
|
1606
|
+
transition: sessionTransitionSchema.optional()
|
|
1415
1607
|
}),
|
|
1416
1608
|
session_facts_changed: z.looseObject({ facts: sessionFactsSchema }),
|
|
1417
1609
|
spur_unknown_state: z.looseObject({
|
|
@@ -1468,7 +1660,11 @@ const eventPayloadSchemas = {
|
|
|
1468
1660
|
column: z.enum(COLUMN_IDS),
|
|
1469
1661
|
sha: S,
|
|
1470
1662
|
/** The head was confirmed by the board's newest poll; GitHub did not answer the submit. */
|
|
1471
|
-
confirmedByPoll: z.literal(true).optional()
|
|
1663
|
+
confirmedByPoll: z.literal(true).optional(),
|
|
1664
|
+
/** The board accepted the submit before it could confirm the head; it confirms it on a later poll. */
|
|
1665
|
+
pending: z.literal(true).optional(),
|
|
1666
|
+
/** A pending submit settled without a turn: its PR merged at this head, not at `sha`. */
|
|
1667
|
+
supersededByMerge: S.optional()
|
|
1472
1668
|
}),
|
|
1473
1669
|
task_moved: z.looseObject({
|
|
1474
1670
|
from: z.enum(COLUMN_IDS),
|
|
@@ -2004,6 +2200,11 @@ const taskWhySchema = z.strictObject({
|
|
|
2004
2200
|
dispatcher: z.enum(DISPATCHER_MODES).nullable().describe("The project's dispatcher mode; null when the project is not configured."),
|
|
2005
2201
|
holds: z.array(z.enum(TASK_HOLDS)).describe("What holds the dispatcher from acting on the task; empty when nothing does."),
|
|
2006
2202
|
heldBy: z.array(blockIdSchema).min(1).optional().describe("Blocks of the open cycle-limit or course-check items holding the task; absent when none does."),
|
|
2203
|
+
pendingSubmit: z.strictObject({
|
|
2204
|
+
sha: commitShaSchema.describe("The submitted commit SHA the board has not confirmed yet."),
|
|
2205
|
+
until: z.iso.datetime().describe("When the board stops waiting for a PR, ISO 8601 UTC; a linked PR is waited for until a poll observes it."),
|
|
2206
|
+
text: z.string().describe("The hold in words: submit pending confirmation of <sha7>.")
|
|
2207
|
+
}).optional().describe("The turn submit the board accepted pending; absent when no submit waits."),
|
|
2007
2208
|
gates: z.array(z.strictObject({
|
|
2008
2209
|
column: z.enum(COLUMN_IDS).describe("Board column."),
|
|
2009
2210
|
enabled: z.boolean().describe("Whether the column is enabled in the project."),
|
|
@@ -2482,6 +2683,7 @@ const OPERATIONS = [
|
|
|
2482
2683
|
turn: taskTurnSchema.nullable().describe("The task's unclosed turn; null when none is open."),
|
|
2483
2684
|
turns: z.array(taskTurnSchema).optional().describe("Present only with detail: the last 5 closed turns, newest first."),
|
|
2484
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."),
|
|
2485
2687
|
blocks: z.array(blockViewSchema).describe("Blocks on the task, open and unblocked."),
|
|
2486
2688
|
comments: z.array(commentSchema).describe("Comments on the task, oldest first."),
|
|
2487
2689
|
why: taskWhySchema.optional().describe("Present only with why.")
|
|
@@ -3494,7 +3696,7 @@ const OPERATIONS = [
|
|
|
3494
3696
|
defineOperation({
|
|
3495
3697
|
id: "task.submit",
|
|
3496
3698
|
kind: "mutation",
|
|
3497
|
-
description: "Submit the
|
|
3699
|
+
description: "Submit the task's pull request head for a turn this session took; the turn closes; a pending result is final.",
|
|
3498
3700
|
mcp: {
|
|
3499
3701
|
whenToUse: "Hand in the work of a turn you took, at the pull request head. While the project dispatcher is in shadow mode no turn opens: the column executor submits with the task key.",
|
|
3500
3702
|
whenNotToUse: "Use task_return to send the task back to Dev instead."
|
|
@@ -3506,7 +3708,8 @@ const OPERATIONS = [
|
|
|
3506
3708
|
output: z.strictObject({
|
|
3507
3709
|
task: taskViewSchema,
|
|
3508
3710
|
turn: turnIdSchema.nullable().describe("The closed turn; null for a submit by task key in shadow mode."),
|
|
3509
|
-
sha: commitShaSchema.describe("The submitted commit SHA.")
|
|
3711
|
+
sha: commitShaSchema.describe("The submitted commit SHA."),
|
|
3712
|
+
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.")
|
|
3510
3713
|
}),
|
|
3511
3714
|
grants: [{ grant: "task-worker" }, { grant: "column-orchestrator" }],
|
|
3512
3715
|
errors: [
|
|
@@ -3523,35 +3726,53 @@ const OPERATIONS = [
|
|
|
3523
3726
|
args: ["turn", "sha"]
|
|
3524
3727
|
},
|
|
3525
3728
|
slack: null,
|
|
3526
|
-
examples: [
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3729
|
+
examples: [
|
|
3730
|
+
{
|
|
3731
|
+
summary: "Submit the pull request head",
|
|
3732
|
+
input: {
|
|
3733
|
+
turn: "T4",
|
|
3734
|
+
sha: submittedSha
|
|
3735
|
+
},
|
|
3736
|
+
output: {
|
|
3737
|
+
task: {
|
|
3738
|
+
...task,
|
|
3739
|
+
column: "review"
|
|
3740
|
+
},
|
|
3741
|
+
turn: "T4",
|
|
3742
|
+
sha: submittedSha,
|
|
3743
|
+
status: "confirmed"
|
|
3744
|
+
}
|
|
3531
3745
|
},
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3746
|
+
{
|
|
3747
|
+
summary: "Submit a dev turn before the board has seen the pull request",
|
|
3748
|
+
input: {
|
|
3749
|
+
turn: "T3",
|
|
3750
|
+
sha: submittedSha
|
|
3536
3751
|
},
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
turn: "PROJ-123",
|
|
3544
|
-
sha: submittedSha
|
|
3752
|
+
output: {
|
|
3753
|
+
task,
|
|
3754
|
+
turn: "T3",
|
|
3755
|
+
sha: submittedSha,
|
|
3756
|
+
status: "pending"
|
|
3757
|
+
}
|
|
3545
3758
|
},
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3759
|
+
{
|
|
3760
|
+
summary: "Submit the pull request head by task key while the dispatcher is in shadow mode",
|
|
3761
|
+
input: {
|
|
3762
|
+
turn: "PROJ-123",
|
|
3763
|
+
sha: submittedSha
|
|
3550
3764
|
},
|
|
3551
|
-
|
|
3552
|
-
|
|
3765
|
+
output: {
|
|
3766
|
+
task: {
|
|
3767
|
+
...task,
|
|
3768
|
+
column: "review"
|
|
3769
|
+
},
|
|
3770
|
+
turn: null,
|
|
3771
|
+
sha: submittedSha,
|
|
3772
|
+
status: "confirmed"
|
|
3773
|
+
}
|
|
3553
3774
|
}
|
|
3554
|
-
|
|
3775
|
+
]
|
|
3555
3776
|
}),
|
|
3556
3777
|
defineOperation({
|
|
3557
3778
|
id: "task.return",
|
|
@@ -3758,171 +3979,6 @@ async function buildCatalogSnapshot(operations) {
|
|
|
3758
3979
|
};
|
|
3759
3980
|
}
|
|
3760
3981
|
//#endregion
|
|
3761
|
-
//#region ../contracts/src/adapters.ts
|
|
3762
|
-
/** What the source answered for one requested entity. */
|
|
3763
|
-
const ENTITY_STATUSES = [
|
|
3764
|
-
"ok",
|
|
3765
|
-
"not_found",
|
|
3766
|
-
"no_access"
|
|
3767
|
-
];
|
|
3768
|
-
/** Opaque, adapter-issued position in a source. Core stores it and never parses it. */
|
|
3769
|
-
const sourceCursorSchema = z.string().min(1).brand();
|
|
3770
|
-
/** A requested entity: a pull request, a ticket or a session. */
|
|
3771
|
-
const entityRefSchema = z.discriminatedUnion("kind", [
|
|
3772
|
-
prRefSchema.extend({ kind: z.literal("pr").describe("A pull request.") }),
|
|
3773
|
-
z.strictObject({
|
|
3774
|
-
kind: z.literal("ticket").describe("A tracker ticket."),
|
|
3775
|
-
trackerId: z.string().min(1).describe("Stable id of the tracker the ticket lives in."),
|
|
3776
|
-
id: z.string().min(1).optional().describe("Known stable ticket id; omitted for a pending manual include."),
|
|
3777
|
-
key: taskKeySchema.describe("Ticket key; matches a pending request before its stable id is known.")
|
|
3778
|
-
}),
|
|
3779
|
-
z.strictObject({
|
|
3780
|
-
kind: z.literal("session").describe("A Spur session."),
|
|
3781
|
-
id: actorPartSchema.describe("Spur session name.")
|
|
3782
|
-
})
|
|
3783
|
-
]);
|
|
3784
|
-
/** The facts of one entity, tagged with their kind. */
|
|
3785
|
-
const batchItemSchema = z.discriminatedUnion("kind", [
|
|
3786
|
-
z.strictObject({
|
|
3787
|
-
kind: z.literal("pr").describe("Pull request facts."),
|
|
3788
|
-
facts: prFactsSchema,
|
|
3789
|
-
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.")
|
|
3790
|
-
}),
|
|
3791
|
-
z.strictObject({
|
|
3792
|
-
kind: z.literal("ticket").describe("Ticket facts."),
|
|
3793
|
-
facts: ticketFactsSchema
|
|
3794
|
-
}),
|
|
3795
|
-
z.strictObject({
|
|
3796
|
-
kind: z.literal("session").describe("Session facts."),
|
|
3797
|
-
facts: sessionFactsSchema
|
|
3798
|
-
})
|
|
3799
|
-
]);
|
|
3800
|
-
/** The identity a requested entity and its item share. */
|
|
3801
|
-
function refIdentity(ref) {
|
|
3802
|
-
switch (ref.kind) {
|
|
3803
|
-
case "pr": return JSON.stringify([
|
|
3804
|
-
ref.kind,
|
|
3805
|
-
ref.repo,
|
|
3806
|
-
ref.number
|
|
3807
|
-
]);
|
|
3808
|
-
case "ticket": return JSON.stringify([
|
|
3809
|
-
ref.kind,
|
|
3810
|
-
ref.trackerId,
|
|
3811
|
-
ref.id ?? `key:${ref.key}`
|
|
3812
|
-
]);
|
|
3813
|
-
case "session": return JSON.stringify([ref.kind, ref.id]);
|
|
3814
|
-
}
|
|
3815
|
-
}
|
|
3816
|
-
function itemIdentity(item) {
|
|
3817
|
-
switch (item.kind) {
|
|
3818
|
-
case "pr": return refIdentity({
|
|
3819
|
-
kind: "pr",
|
|
3820
|
-
repo: item.facts.repo,
|
|
3821
|
-
number: item.facts.number
|
|
3822
|
-
});
|
|
3823
|
-
case "ticket": return refIdentity({
|
|
3824
|
-
kind: "ticket",
|
|
3825
|
-
trackerId: item.facts.trackerId,
|
|
3826
|
-
id: item.facts.id,
|
|
3827
|
-
key: item.facts.key
|
|
3828
|
-
});
|
|
3829
|
-
case "session": return refIdentity({
|
|
3830
|
-
kind: "session",
|
|
3831
|
-
id: item.facts.id
|
|
3832
|
-
});
|
|
3833
|
-
}
|
|
3834
|
-
}
|
|
3835
|
-
function itemAnswersRef(item, ref) {
|
|
3836
|
-
if (item.kind !== ref.kind) return false;
|
|
3837
|
-
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);
|
|
3838
|
-
return itemIdentity(item) === refIdentity(ref);
|
|
3839
|
-
}
|
|
3840
|
-
const batchSchema = z.strictObject({
|
|
3841
|
-
source: z.string().min(1).describe("Id of the adapter that produced the batch."),
|
|
3842
|
-
observedAt: z.iso.datetime().describe("When the poll started (A2)."),
|
|
3843
|
-
complete: z.boolean().describe("Whether everything was listed without errors (A3); per-entity outcomes aside."),
|
|
3844
|
-
items: z.array(batchItemSchema).describe("Facts observed in this poll."),
|
|
3845
|
-
cursor: sourceCursorSchema.optional().describe("Where the next poll continues; omitted when the source has none (A5)."),
|
|
3846
|
-
entities: z.array(z.strictObject({
|
|
3847
|
-
ref: entityRefSchema.describe("The requested entity."),
|
|
3848
|
-
status: z.enum(ENTITY_STATUSES).describe("What the source answered for it.")
|
|
3849
|
-
})).describe("One entry per entity core asked for (A4)."),
|
|
3850
|
-
prProbes: z.array(z.strictObject({
|
|
3851
|
-
ref: prRefSchema.extend({ kind: z.literal("pr").describe("A pull request.") }).describe("The rechecked PR."),
|
|
3852
|
-
status: z.enum([
|
|
3853
|
-
"closed",
|
|
3854
|
-
"refreshed",
|
|
3855
|
-
"not_found",
|
|
3856
|
-
"no_access"
|
|
3857
|
-
]).describe("Unchanged closed state, full refresh, or failed lookup.")
|
|
3858
|
-
})).optional().describe("State-only PR rechecks, separate from normal entity coverage."),
|
|
3859
|
-
usage: z.strictObject({ points: z.int().nonnegative().describe("Reported points consumed.") }).optional().describe("Reported source points consumed by this attempt."),
|
|
3860
|
-
budget: z.strictObject({
|
|
3861
|
-
remaining: z.int().min(0).describe("Requests or points the source still allows."),
|
|
3862
|
-
resetAt: z.iso.datetime().describe("When the source restores the full budget.")
|
|
3863
|
-
}).optional().describe("Request budget the source reported on this poll; omitted when it reports none.")
|
|
3864
|
-
}).superRefine((batch, ctx) => {
|
|
3865
|
-
const items = /* @__PURE__ */ new Set();
|
|
3866
|
-
batch.items.forEach((item, index) => {
|
|
3867
|
-
const identity = itemIdentity(item);
|
|
3868
|
-
if (items.has(identity)) ctx.addIssue({
|
|
3869
|
-
code: "custom",
|
|
3870
|
-
path: ["items", index],
|
|
3871
|
-
message: "Report each entity in one item"
|
|
3872
|
-
});
|
|
3873
|
-
items.add(identity);
|
|
3874
|
-
});
|
|
3875
|
-
const requested = /* @__PURE__ */ new Set();
|
|
3876
|
-
batch.entities.forEach((entity, index) => {
|
|
3877
|
-
const identity = refIdentity(entity.ref);
|
|
3878
|
-
if (requested.has(identity)) {
|
|
3879
|
-
ctx.addIssue({
|
|
3880
|
-
code: "custom",
|
|
3881
|
-
path: [
|
|
3882
|
-
"entities",
|
|
3883
|
-
index,
|
|
3884
|
-
"ref"
|
|
3885
|
-
],
|
|
3886
|
-
message: "List each requested entity once"
|
|
3887
|
-
});
|
|
3888
|
-
return;
|
|
3889
|
-
}
|
|
3890
|
-
requested.add(identity);
|
|
3891
|
-
if (entity.status === "ok" !== batch.items.some((item) => itemAnswersRef(item, entity.ref))) ctx.addIssue({
|
|
3892
|
-
code: "custom",
|
|
3893
|
-
path: [
|
|
3894
|
-
"entities",
|
|
3895
|
-
index,
|
|
3896
|
-
"status"
|
|
3897
|
-
],
|
|
3898
|
-
message: entity.status === "ok" ? "An ok entity needs its item" : `A ${entity.status} entity has no item`
|
|
3899
|
-
});
|
|
3900
|
-
});
|
|
3901
|
-
}).describe("The result of one poll.");
|
|
3902
|
-
/** Source id of the PR poll of one project repo: `github:<project>:<repo lowercased>`. */
|
|
3903
|
-
function prSourceId(projectId, repo) {
|
|
3904
|
-
return `github:${projectId}:${repo.toLowerCase()}`;
|
|
3905
|
-
}
|
|
3906
|
-
/**
|
|
3907
|
-
* Source id of a project's tracker poll: `jira:<project>`, or
|
|
3908
|
-
* `github-issues:<project>:<tracker repo lowercased>`.
|
|
3909
|
-
*/
|
|
3910
|
-
function trackerSourceId(project) {
|
|
3911
|
-
return project.tracker.type === "jira" ? `jira:${project.id}` : `github-issues:${project.id}:${project.tracker.repo.toLowerCase()}`;
|
|
3912
|
-
}
|
|
3913
|
-
/** A whole-poll failure (A6). `retryAt` is when the source allows the next attempt. */
|
|
3914
|
-
var AdapterError = class extends Error {
|
|
3915
|
-
kind;
|
|
3916
|
-
retryAt;
|
|
3917
|
-
usage;
|
|
3918
|
-
constructor(kind, message, options = {}) {
|
|
3919
|
-
super(message, "cause" in options ? { cause: options.cause } : void 0);
|
|
3920
|
-
this.name = "AdapterError";
|
|
3921
|
-
this.kind = kind;
|
|
3922
|
-
this.retryAt = options.retryAt;
|
|
3923
|
-
}
|
|
3924
|
-
};
|
|
3925
|
-
//#endregion
|
|
3926
3982
|
//#region ../contracts/src/systemd.ts
|
|
3927
3983
|
/**
|
|
3928
3984
|
* systemd user-unit policy shared by the CLI unit writer and the daemon's board tick.
|
|
@@ -4009,4 +4065,4 @@ function assertNever(value) {
|
|
|
4009
4065
|
throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
|
|
4010
4066
|
}
|
|
4011
4067
|
//#endregion
|
|
4012
|
-
export {
|
|
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
|
|
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 {
|
|
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-
|
|
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-
|
|
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-
|
|
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 };
|