spur-board 0.115.1 → 0.116.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-ALQZAGOg.mjs → chunk-D2XhQ1P5.mjs} +1 -1
- package/dist/{chunk-BX1CGMgV.mjs → chunk-DhRcRAgF.mjs} +1 -0
- package/dist/{chunk-FWOV2NJc.mjs → chunk-lKSPkzsR.mjs} +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +89 -32
- package/dist/mcp.mjs +3 -3
- package/dist/web/assets/{index-CZEVTXKP.js → index-DMh-p887.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/skills/spur-board/references/how-board-works-done.md +14 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as renderJsonError, at as successEnvelopeSchema, c as tokenRequestStatusSchema, et as ERRORS, nt as errorContextSchema, o as tokenRequestResultSchema, rt as errorEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { _ as renderJsonError, at as successEnvelopeSchema, c as tokenRequestStatusSchema, et as ERRORS, nt as errorContextSchema, o as tokenRequestResultSchema, rt as errorEnvelopeSchema } from "./chunk-DhRcRAgF.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as buildCatalogSnapshot, gt as plainHttpAllowed, mt as configSchema, p as OPERATIONS } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { d as buildCatalogSnapshot, gt as plainHttpAllowed, mt as configSchema, p as OPERATIONS } from "./chunk-DhRcRAgF.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-D2XhQ1P5.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { St as SLACK_BOT_SCOPES, Y as actorIdSchema, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, et as ERRORS, f as roleCanUseOperation, mt as configSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as DEFAULT_STAND_PORT_RANGE, vt as resolveWebOrigin } from "./chunk-
|
|
1
|
+
import { St as SLACK_BOT_SCOPES, Y as actorIdSchema, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, et as ERRORS, f as roleCanUseOperation, mt as configSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as DEFAULT_STAND_PORT_RANGE, vt as resolveWebOrigin } from "./chunk-DhRcRAgF.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
|
|
3
|
-
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-
|
|
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-D2XhQ1P5.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-lKSPkzsR.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, tmpdir, userInfo } from "node:os";
|
package/dist/client.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-
|
|
1
|
+
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-D2XhQ1P5.mjs";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as parseRef$1, A as defaultBranchFactSchema, B as isExternalAuthor, C as messageRefSchema, Ct as TASK_HOLDS, D as eventPayloadSchemas, E as GATE_REASONS, F as trackerSourceId, G as sessionFactsSchema, H as prFactsSchema, I as PR_STATES, J as REF_NUMBER, K as ticketFactsSchema, L as REVIEW_STATES, M as prSourceId, N as sessionTransitionSchema, O as AdapterError, P as sourceCursorSchema, Q as parseActorId, R as SESSION_HEALTH_STATES, S as interactionRefSchema, St as SLACK_BOT_SCOPES, T as EVENT_KINDS, U as prRefSchema, V as parseRingMarker, W as ringMarker, X as encodeActorId, Y as actorIdSchema, Z as errorCodeOf, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, b as conversationRefSchema, bt as DISPATCHER_MODES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as RESERVED_PROJECT, et as ERRORS, f as roleCanUseOperation, ft as boardWideSpurProject, g as renderHttpProblem, gt as plainHttpAllowed, h as turnHandedSchema, ht as defaultAddressee, i as TOKEN_REQUEST_LIMITS, it as ok, j as entityRefSchema, k as batchSchema, l as BOARD_TICK_MS, lt as DEFAULT_SLACK_COMMAND, m as defaultBranchViewSchema, mt as configSchema, n as doctorReportSchema, o as tokenRequestResultSchema, p as OPERATIONS, pt as configBindings, q as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as DEFAULT_LINK, t as assertNever, tt as err, vt as resolveWebOrigin, w as userIdSchema, wt as VIAS, x as inboundEventSchema, xt as ITEM_KINDS, y as SPACE_IDS, yt as COLUMN_IDS, z as SESSION_STATUSES } from "./chunk-
|
|
1
|
+
import { $ as parseRef$1, A as defaultBranchFactSchema, B as isExternalAuthor, C as messageRefSchema, Ct as TASK_HOLDS, D as eventPayloadSchemas, E as GATE_REASONS, F as trackerSourceId, G as sessionFactsSchema, H as prFactsSchema, I as PR_STATES, J as REF_NUMBER, K as ticketFactsSchema, L as REVIEW_STATES, M as prSourceId, N as sessionTransitionSchema, O as AdapterError, P as sourceCursorSchema, Q as parseActorId, R as SESSION_HEALTH_STATES, S as interactionRefSchema, St as SLACK_BOT_SCOPES, T as EVENT_KINDS, U as prRefSchema, V as parseRingMarker, W as ringMarker, X as encodeActorId, Y as actorIdSchema, Z as errorCodeOf, _t as requiredSecretKeys, a as requestHashOf, at as successEnvelopeSchema, b as conversationRefSchema, bt as DISPATCHER_MODES, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, dt as RESERVED_PROJECT, et as ERRORS, f as roleCanUseOperation, ft as boardWideSpurProject, g as renderHttpProblem, gt as plainHttpAllowed, h as turnHandedSchema, ht as defaultAddressee, i as TOKEN_REQUEST_LIMITS, it as ok, j as entityRefSchema, k as batchSchema, l as BOARD_TICK_MS, lt as DEFAULT_SLACK_COMMAND, m as defaultBranchViewSchema, mt as configSchema, n as doctorReportSchema, o as tokenRequestResultSchema, p as OPERATIONS, pt as configBindings, q as JIRA_PROJECT_KEY, s as tokenRequestSchema, st as DEFAULT_LINK, t as assertNever, tt as err, vt as resolveWebOrigin, w as userIdSchema, wt as VIAS, x as inboundEventSchema, xt as ITEM_KINDS, y as SPACE_IDS, yt as COLUMN_IDS, z as SESSION_STATUSES } from "./chunk-DhRcRAgF.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -7940,6 +7940,15 @@ function scanConfig() {
|
|
|
7940
7940
|
if (context === void 0) throw new Error(NO_SCAN);
|
|
7941
7941
|
return context.config;
|
|
7942
7942
|
}
|
|
7943
|
+
/** Task-change barriers must sample an injected clock while the write transaction is held. */
|
|
7944
|
+
function taskChangeContext() {
|
|
7945
|
+
const context = receipts.getStore();
|
|
7946
|
+
if (context?.clock === void 0) throw new Error("Task changes require a scan transaction with an acceptance clock");
|
|
7947
|
+
return {
|
|
7948
|
+
config: context.config,
|
|
7949
|
+
clock: context.clock
|
|
7950
|
+
};
|
|
7951
|
+
}
|
|
7943
7952
|
/** Used by the common outbox insertion point before it issues SQL. */
|
|
7944
7953
|
function checkGatewayStrings(strings) {
|
|
7945
7954
|
const context = receipts.getStore();
|
|
@@ -7961,11 +7970,12 @@ function checkGatewayStrings(strings) {
|
|
|
7961
7970
|
* A fresh time read on each pass makes a new string each pass and the replay never ends. A time
|
|
7962
7971
|
* kept only in the database may be read inside.
|
|
7963
7972
|
*/
|
|
7964
|
-
async function scanTransaction(store, config, fn) {
|
|
7973
|
+
async function scanTransaction(store, config, fn, clock) {
|
|
7965
7974
|
const known = /* @__PURE__ */ new Map();
|
|
7966
7975
|
for (let pass = 0; pass < MAX_PASSES; pass += 1) {
|
|
7967
7976
|
const context = {
|
|
7968
7977
|
config,
|
|
7978
|
+
clock,
|
|
7969
7979
|
known,
|
|
7970
7980
|
unseen: /* @__PURE__ */ new Set()
|
|
7971
7981
|
};
|
|
@@ -7997,6 +8007,18 @@ async function scanTransaction(store, config, fn) {
|
|
|
7997
8007
|
throw new Error("Gateway secret scan replay limit exceeded");
|
|
7998
8008
|
}
|
|
7999
8009
|
// ../core/src/app/board-utils.ts
|
|
8010
|
+
/** A changed task never trusts absence evidence older than any change already accepted. */
|
|
8011
|
+
function taskChangeAt(at) {
|
|
8012
|
+
const { config, clock } = taskChangeContext();
|
|
8013
|
+
const acceptedAt = new Date(clock.now()).toISOString();
|
|
8014
|
+
const scopes = config.projects.flatMap((project) => project.repos.length === 0 ? [] : [sql`(task.project = ${project.id} AND source IN (${sql.join(project.repos.map((repo) => prSourceId(project.id, repo)))}))`]);
|
|
8015
|
+
const sources = sql.join([sql`source = 'spur'`, ...scopes], sql` OR `);
|
|
8016
|
+
return sql`max(coalesce(last_change_at, created_at), ${at}, ${acceptedAt},
|
|
8017
|
+
coalesce((SELECT max(last_complete_at) FROM source_state WHERE ${sources}), ${at}))`;
|
|
8018
|
+
}
|
|
8019
|
+
async function markTaskChanged(trx, taskId, at) {
|
|
8020
|
+
await trx.updateTable("task").set({ last_change_at: taskChangeAt(at) }).where("id", "=", taskId).execute();
|
|
8021
|
+
}
|
|
8000
8022
|
/** Whether a ticket status is done: a Jira done status, or a closed GitHub Issue. */
|
|
8001
8023
|
function ticketDone(project, status) {
|
|
8002
8024
|
return project.tracker.type === "jira" ? project.tracker.doneStatuses.includes(status) : status === "closed";
|
|
@@ -8135,6 +8157,7 @@ function withVia(via, fn) {
|
|
|
8135
8157
|
async function emit(trx, kind, project, taskId, at, payload, actor = "system") {
|
|
8136
8158
|
const parsed = parseActorId(actor);
|
|
8137
8159
|
if (parsed === null) throw new Error("Invalid journal actor");
|
|
8160
|
+
if (taskId !== null && (kind === "task_added" || kind === "link_added" || kind === "link_removed")) await markTaskChanged(trx, taskId, at);
|
|
8138
8161
|
await trx.insertInto("event").values({
|
|
8139
8162
|
at,
|
|
8140
8163
|
project,
|
|
@@ -8462,7 +8485,7 @@ function createApply(deps) {
|
|
|
8462
8485
|
prepared
|
|
8463
8486
|
});
|
|
8464
8487
|
}
|
|
8465
|
-
}));
|
|
8488
|
+
}), clock);
|
|
8466
8489
|
if (result === void 0) throw new CommandError("forbidden", deniedHint ?? "Caller is not allowed.");
|
|
8467
8490
|
return result;
|
|
8468
8491
|
};
|
|
@@ -12763,7 +12786,7 @@ async function archiveTask(trx, input) {
|
|
|
12763
12786
|
await trx.updateTable("task").set({
|
|
12764
12787
|
membership: "archived",
|
|
12765
12788
|
archive_reason: reason,
|
|
12766
|
-
last_change_at: at
|
|
12789
|
+
last_change_at: taskChangeAt(at)
|
|
12767
12790
|
}).where("id", "=", task.id).execute();
|
|
12768
12791
|
await emit(trx, "task_archived", task.project, task.id, at, { reason }, actor);
|
|
12769
12792
|
}
|
|
@@ -12840,7 +12863,7 @@ function createMembershipMutations(config) {
|
|
|
12840
12863
|
manual_exclude: 0,
|
|
12841
12864
|
membership: "active",
|
|
12842
12865
|
archive_reason: null,
|
|
12843
|
-
last_change_at: ctx.at
|
|
12866
|
+
last_change_at: taskChangeAt(ctx.at)
|
|
12844
12867
|
}).where("id", "=", task.id).execute();
|
|
12845
12868
|
if (task.membership === "archived") await emit(trx, "task_added", project.id, task.id, ctx.at, { column: task.column }, "operator");
|
|
12846
12869
|
task = await trx.selectFrom("task").selectAll().where("id", "=", task.id).executeTakeFirstOrThrow();
|
|
@@ -14970,7 +14993,10 @@ function devReasons(facts, columns, waived, threads) {
|
|
|
14970
14993
|
}
|
|
14971
14994
|
/**
|
|
14972
14995
|
* The failing reasons of one column's exit condition. Only Dev's resolved-threads condition depends
|
|
14973
|
-
* on the column asked: `threads` says whether it counts.
|
|
14996
|
+
* on the column asked: `threads` says whether it counts. A `gate_broken` move re-evaluates at Dev,
|
|
14997
|
+
* where that condition may not count, so a reason or hand-over that must survive it keys on the
|
|
14998
|
+
* facts and `threadsGated(project)` (`withThreads`, `turnThreads`), and `explainGates` takes
|
|
14999
|
+
* `blockedIn` from `evaluateGate`.
|
|
14974
15000
|
*/
|
|
14975
15001
|
function columnCondition(column, facts, columns, waived, threads) {
|
|
14976
15002
|
switch (column) {
|
|
@@ -15151,6 +15177,12 @@ function workStarted(input) {
|
|
|
15151
15177
|
const workerLive = input.liveWorker && !input.spurBlind;
|
|
15152
15178
|
return input.openPr || !input.reopened && workerLive;
|
|
15153
15179
|
}
|
|
15180
|
+
function ticketFinished(input) {
|
|
15181
|
+
return input.ticketDone && !input.hasOpenLinkedPr && !input.liveWorker;
|
|
15182
|
+
}
|
|
15183
|
+
function absenceReady(input) {
|
|
15184
|
+
return ticketFinished(input) && input.allGithubReposReady && input.spurReady && !input.spurBlind;
|
|
15185
|
+
}
|
|
15154
15186
|
/**
|
|
15155
15187
|
* What holds the dispatcher on the task now: a blind GitHub or a pending submit stops it, a blind
|
|
15156
15188
|
* Spur defers a worker's turn, an active cycle-limit or course-check item stops every turn and
|
|
@@ -15159,11 +15191,11 @@ function workStarted(input) {
|
|
|
15159
15191
|
*/
|
|
15160
15192
|
function dispatchHolds(input) {
|
|
15161
15193
|
const holds = [];
|
|
15162
|
-
if (input.githubBlind) holds.push("github_blind");
|
|
15163
|
-
if (input.spurBlind) holds.push("spur_blind");
|
|
15194
|
+
if (input.githubBlind || input.column !== "done" && input.facts.pr?.state !== "merged" && ticketFinished(input) && !input.allGithubReposReady) holds.push("github_blind");
|
|
15195
|
+
if (input.spurBlind || input.column !== "done" && input.facts.pr?.state !== "merged" && ticketFinished(input) && !input.spurReady) holds.push("spur_blind");
|
|
15164
15196
|
if (input.submitPending) holds.push("submit_pending");
|
|
15165
15197
|
if (input.cycleHeld) holds.push("cycle_limit");
|
|
15166
|
-
if ((input.column === "todo" || input.column === "ready-for-dev") && !workStarted(input)) holds.push("work_not_started");
|
|
15198
|
+
if ((input.column === "todo" || input.column === "ready-for-dev") && !workStarted(input) && !absenceReady(input)) holds.push("work_not_started");
|
|
15167
15199
|
return holds;
|
|
15168
15200
|
}
|
|
15169
15201
|
/**
|
|
@@ -15222,7 +15254,7 @@ function dispatch(input) {
|
|
|
15222
15254
|
for (let step = 0; step < STEP_BOUND; step++) {
|
|
15223
15255
|
const merged = facts.pr?.state === "merged";
|
|
15224
15256
|
if (column === "done") {
|
|
15225
|
-
if (reopened && !merged) {
|
|
15257
|
+
if (reopened && !merged && !input.ticketDone) {
|
|
15226
15258
|
move("todo", "ticket_reopened");
|
|
15227
15259
|
continue;
|
|
15228
15260
|
}
|
|
@@ -15238,6 +15270,10 @@ function dispatch(input) {
|
|
|
15238
15270
|
move("done", "merged");
|
|
15239
15271
|
continue;
|
|
15240
15272
|
}
|
|
15273
|
+
if (absenceReady(input)) {
|
|
15274
|
+
move("done", "ticket_done_no_pr");
|
|
15275
|
+
continue;
|
|
15276
|
+
}
|
|
15241
15277
|
if (reopened && facts.pr === null && column !== "todo") {
|
|
15242
15278
|
move("todo", "ticket_reopened");
|
|
15243
15279
|
continue;
|
|
@@ -16325,7 +16361,7 @@ async function moveLeft(trx, input) {
|
|
|
16325
16361
|
column: to,
|
|
16326
16362
|
column_epoch: task.column_epoch + 1,
|
|
16327
16363
|
left_moves: task.left_moves + 1,
|
|
16328
|
-
last_change_at: at.toISOString()
|
|
16364
|
+
last_change_at: taskChangeAt(at.toISOString())
|
|
16329
16365
|
}).where("id", "=", task.id).returningAll().executeTakeFirstOrThrow();
|
|
16330
16366
|
await voidSubmits(trx, task.id, to, at);
|
|
16331
16367
|
await closeTurns(trx, {
|
|
@@ -16404,7 +16440,7 @@ async function syncModes(trx, config, at) {
|
|
|
16404
16440
|
await trx.updateTable("task").set({
|
|
16405
16441
|
column: task.shadow_column,
|
|
16406
16442
|
column_epoch: task.column_epoch + 1,
|
|
16407
|
-
last_change_at: at.toISOString()
|
|
16443
|
+
last_change_at: taskChangeAt(at.toISOString())
|
|
16408
16444
|
}).where("id", "=", task.id).execute();
|
|
16409
16445
|
await closeTurns(trx, {
|
|
16410
16446
|
taskId: task.id,
|
|
@@ -16451,11 +16487,11 @@ async function correctColumn(trx, input) {
|
|
|
16451
16487
|
const from = task.shadow_column ?? task.column;
|
|
16452
16488
|
await trx.updateTable("task").set(shadow ? {
|
|
16453
16489
|
shadow_column: to,
|
|
16454
|
-
last_change_at: at.toISOString()
|
|
16490
|
+
last_change_at: taskChangeAt(at.toISOString())
|
|
16455
16491
|
} : {
|
|
16456
16492
|
column: to,
|
|
16457
16493
|
column_epoch: task.column_epoch + 1,
|
|
16458
|
-
last_change_at: at.toISOString()
|
|
16494
|
+
last_change_at: taskChangeAt(at.toISOString())
|
|
16459
16495
|
}).where("id", "=", task.id).execute();
|
|
16460
16496
|
await voidSubmits(trx, task.id, to, at);
|
|
16461
16497
|
if (!shadow) await closeTurns(trx, {
|
|
@@ -16744,6 +16780,14 @@ async function readInput(trx, task, project, mode, blind, config, clock) {
|
|
|
16744
16780
|
}
|
|
16745
16781
|
if (mergedOpen !== void 0) pr = null;
|
|
16746
16782
|
const githubBlind = (pr === null ? project.repos : [pr.repo]).some((repo) => blind(prSourceId(project.id, repo)));
|
|
16783
|
+
const sourceReady = (source) => {
|
|
16784
|
+
const complete = clock.complete.get(source);
|
|
16785
|
+
return !blind(source) && complete !== void 0 && complete > (task.last_change_at ?? task.created_at);
|
|
16786
|
+
};
|
|
16787
|
+
const allGithubReposReady = project.repos.every((repo) => sourceReady(prSourceId(project.id, repo)));
|
|
16788
|
+
const ticket = await readTicket();
|
|
16789
|
+
const done = ticket !== void 0 && ticketDone(project, ticket.status);
|
|
16790
|
+
const hasOpenLinkedPr = await trx.selectFrom("link").select("id").where("task_id", "=", task.id).where("entity", "=", "pr").where("banned", "=", 0).where("pr_open", "=", 1).where(pastReopenFloor).executeTakeFirst() !== void 0;
|
|
16747
16791
|
const last = mode === "shadow" ? void 0 : await trx.selectFrom("turn").selectAll().where("task_id", "=", task.id).where("column", "=", task.column).where("epoch", "=", task.column_epoch).orderBy("seq", "desc").executeTakeFirst();
|
|
16748
16792
|
const pending = mode === "on" ? await readPendingSubmit(trx, task, project, {
|
|
16749
16793
|
link,
|
|
@@ -16788,7 +16832,11 @@ async function readInput(trx, task, project, mode, blind, config, clock) {
|
|
|
16788
16832
|
unresolvedThreads: pr === null ? 0 : pr.reviewThreads.filter((thread) => !thread.resolved).length,
|
|
16789
16833
|
marks
|
|
16790
16834
|
},
|
|
16791
|
-
reopened: mergedOpen === void 0 && await trx.selectFrom("link").select("id").where("task_id", "=", task.id).where("reopen_hidden_at", "is not", null).executeTakeFirst() !== void 0,
|
|
16835
|
+
reopened: mergedOpen === void 0 && (column === "done" && !done && task.reopened_at !== null || await trx.selectFrom("link").select("id").where("task_id", "=", task.id).where("reopen_hidden_at", "is not", null).executeTakeFirst() !== void 0),
|
|
16836
|
+
ticketDone: done,
|
|
16837
|
+
hasOpenLinkedPr,
|
|
16838
|
+
allGithubReposReady,
|
|
16839
|
+
spurReady: sourceReady("spur"),
|
|
16792
16840
|
openPr: link?.open === true,
|
|
16793
16841
|
githubBlind,
|
|
16794
16842
|
spurBlind: blind("spur"),
|
|
@@ -16851,7 +16899,7 @@ async function applyOn(trx, task, read, result, ctx) {
|
|
|
16851
16899
|
}
|
|
16852
16900
|
current = await trx.updateTable("task").set({
|
|
16853
16901
|
column: move.to,
|
|
16854
|
-
last_change_at: at.toISOString()
|
|
16902
|
+
last_change_at: taskChangeAt(at.toISOString())
|
|
16855
16903
|
}).where("id", "=", current.id).returningAll().executeTakeFirstOrThrow();
|
|
16856
16904
|
await closeTurns(trx, {
|
|
16857
16905
|
taskId: current.id,
|
|
@@ -16973,6 +17021,11 @@ async function dispatchSource(trx, source, ctx) {
|
|
|
16973
17021
|
if (projects.length === 0) return;
|
|
16974
17022
|
await dispatchTasks(trx, (await trx.selectFrom("task").select("id").where("project", "in", projects).where("membership", "!=", "archived").execute()).map((task) => task.id), ctx);
|
|
16975
17023
|
}
|
|
17024
|
+
/** Unchanged complete repository and Spur polls can confirm absence after the task changed. */
|
|
17025
|
+
async function dispatchDoneTickets(trx, source, ctx) {
|
|
17026
|
+
const projects = ctx.config.projects.filter((entry) => source === "spur" || entry.repos.some((repo) => prSourceId(entry.id, repo) === source));
|
|
17027
|
+
for (const project of projects) await dispatchTasks(trx, (await trx.selectFrom("task").innerJoin("ticket_snapshot", "ticket_snapshot.task_id", "task.id").select(["task.id", "ticket_snapshot.status"]).where("task.project", "=", project.id).where("task.membership", "!=", "archived").where(project.dispatcher.mode === "shadow" ? sql`coalesce(task.shadow_column, task.column)` : sql`task.column`, "!=", "done").execute()).filter((task) => ticketDone(project, task.status)).map((task) => task.id), ctx);
|
|
17028
|
+
}
|
|
16976
17029
|
/**
|
|
16977
17030
|
* Evaluates the tasks of a tracker source's project that are out of Done and whose PR merged:
|
|
16978
17031
|
* a poll that only refreshes an unchanged open ticket journals nothing, yet can confirm it open
|
|
@@ -18343,7 +18396,7 @@ async function sourceState(trx, source, state, observedAt, cursor, budget, defau
|
|
|
18343
18396
|
default_branch: branch ?? null
|
|
18344
18397
|
}).onConflict((oc) => oc.column("source").doUpdateSet((eb) => ({
|
|
18345
18398
|
initialized: observedAt === void 0 ? eb.ref("source_state.initialized") : 1,
|
|
18346
|
-
last_complete_at: state.lastCompleteAt ??
|
|
18399
|
+
last_complete_at: state.lastCompleteAt ?? eb.ref("source_state.last_complete_at"),
|
|
18347
18400
|
blind_reason: state.blind?.reason ?? null,
|
|
18348
18401
|
blind_message: state.blind?.message ?? null,
|
|
18349
18402
|
cursor: cursor ?? eb.ref("source_state.cursor"),
|
|
@@ -18481,7 +18534,7 @@ async function ticket(trx, config, fact, at, source) {
|
|
|
18481
18534
|
} else if (task.tracker_id !== fact.id || task.key !== fact.key) await trx.updateTable("task").set({
|
|
18482
18535
|
tracker_id: fact.id,
|
|
18483
18536
|
key: fact.key,
|
|
18484
|
-
last_change_at: at
|
|
18537
|
+
last_change_at: taskChangeAt(at)
|
|
18485
18538
|
}).where("id", "=", task.id).execute();
|
|
18486
18539
|
const previous = await trx.selectFrom("ticket_snapshot").selectAll().where("task_id", "=", task.id).executeTakeFirst();
|
|
18487
18540
|
const previousFact = previous === void 0 ? null : parseJson(ticketFactsSchema, previous.detail);
|
|
@@ -18508,7 +18561,7 @@ async function ticket(trx, config, fact, at, source) {
|
|
|
18508
18561
|
if (previousFact !== null && ticketDone(project, previousFact.status) && !ticketDone(project, fact.status)) await setReopenFloor(trx, task.id, at);
|
|
18509
18562
|
}
|
|
18510
18563
|
await emit(trx, "ticket_facts_changed", project.id, task.id, at, { facts: fact });
|
|
18511
|
-
await trx
|
|
18564
|
+
await markTaskChanged(trx, task.id, at);
|
|
18512
18565
|
}
|
|
18513
18566
|
if (fact.inFilter && (task.membership === "out_of_filter" || task.archive_reason === "out_of_filter")) {
|
|
18514
18567
|
await trx.updateTable("task").set({
|
|
@@ -18641,7 +18694,7 @@ async function pr(trx, config, fact, at, source) {
|
|
|
18641
18694
|
});
|
|
18642
18695
|
}
|
|
18643
18696
|
await emit(trx, "pr_facts_changed", task.project, task.id, at, { facts: fact });
|
|
18644
|
-
await trx
|
|
18697
|
+
await markTaskChanged(trx, task.id, at);
|
|
18645
18698
|
}
|
|
18646
18699
|
}
|
|
18647
18700
|
function branchHasKey(branch, key) {
|
|
@@ -18818,7 +18871,7 @@ async function session(trx, config, fact, at, source, ambiguousBranches, feedEna
|
|
|
18818
18871
|
to: fact.lifecycle
|
|
18819
18872
|
});
|
|
18820
18873
|
await emit(trx, "session_facts_changed", task.project, task.id, at, { facts: fact });
|
|
18821
|
-
await trx
|
|
18874
|
+
await markTaskChanged(trx, task.id, at);
|
|
18822
18875
|
}
|
|
18823
18876
|
}
|
|
18824
18877
|
/**
|
|
@@ -18892,6 +18945,7 @@ async function recordUsage(trx, source, usage, now) {
|
|
|
18892
18945
|
/** Core's adapter-facing port. Every accepted batch and its source state share one transaction. */
|
|
18893
18946
|
function createObservationCore(deps) {
|
|
18894
18947
|
const { store, config, clock } = deps;
|
|
18948
|
+
const transact = (fn) => scanTransaction(store, config, fn, clock);
|
|
18895
18949
|
const completeSince = /* @__PURE__ */ new Map();
|
|
18896
18950
|
const healthySince = /* @__PURE__ */ new Map();
|
|
18897
18951
|
const warnSkipped = warnSkippedOnce(deps.warn);
|
|
@@ -18991,7 +19045,7 @@ function createObservationCore(deps) {
|
|
|
18991
19045
|
async observe(source, observation) {
|
|
18992
19046
|
const { batch } = observation;
|
|
18993
19047
|
const now = clock.now();
|
|
18994
|
-
await
|
|
19048
|
+
await transact(async (trx) => {
|
|
18995
19049
|
const wasBlind = await blindReason(trx, source);
|
|
18996
19050
|
const previousSpur = source === "spur" ? await trx.selectFrom("source_state").select("last_complete_at").where("source", "=", source).executeTakeFirst() : void 0;
|
|
18997
19051
|
const spurGap = previousSpur?.last_complete_at != null && Date.parse(batch.observedAt) > Date.parse(previousSpur.last_complete_at) + config.adapters.spur.intervalMs * config.thresholds.staleMultiplier;
|
|
@@ -19064,6 +19118,7 @@ function createObservationCore(deps) {
|
|
|
19064
19118
|
const links = await trx.selectFrom("link").select(["task_id"]).where("entity", "=", "session").where("session_id", "=", old.id).execute();
|
|
19065
19119
|
for (const link of links) {
|
|
19066
19120
|
const task = await trx.selectFrom("task").selectAll().where("id", "=", link.task_id).executeTakeFirstOrThrow();
|
|
19121
|
+
await markTaskChanged(trx, task.id, batch.observedAt);
|
|
19067
19122
|
await emit(trx, "session_facts_changed", task.project, task.id, batch.observedAt, { facts: ended });
|
|
19068
19123
|
}
|
|
19069
19124
|
}
|
|
@@ -19094,7 +19149,7 @@ function createObservationCore(deps) {
|
|
|
19094
19149
|
observed_at: batch.observedAt
|
|
19095
19150
|
}).where("task_id", "=", row.task_id).execute();
|
|
19096
19151
|
await emit(trx, "ticket_facts_changed", project.id, row.task_id, batch.observedAt, { facts: outside });
|
|
19097
|
-
await trx.updateTable("task").set({ last_change_at: batch.observedAt }).where("id", "=", row.task_id).execute();
|
|
19152
|
+
await trx.updateTable("task").set({ last_change_at: taskChangeAt(batch.observedAt) }).where("id", "=", row.task_id).execute();
|
|
19098
19153
|
}
|
|
19099
19154
|
}
|
|
19100
19155
|
}
|
|
@@ -19112,6 +19167,7 @@ function createObservationCore(deps) {
|
|
|
19112
19167
|
};
|
|
19113
19168
|
const recovered = wasBlind !== null && observation.state.blind === void 0;
|
|
19114
19169
|
if (observation.effectiveComplete && !completeSince.has(source) || recovered) await dispatchSource(trx, source, dispatchContext);
|
|
19170
|
+
if (observation.effectiveComplete) await dispatchDoneTickets(trx, source, dispatchContext);
|
|
19115
19171
|
await dispatchMergedTickets(trx, source, dispatchContext);
|
|
19116
19172
|
await dispatchJournaled(trx, dispatchContext);
|
|
19117
19173
|
await reconcileItems(trx, config, now, currentComplete.has("spur"), warnSkipped, source === "spur" && observation.effectiveComplete && (!completeSince.has("spur") || spurGap) ? Date.parse(batch.observedAt) : void 0);
|
|
@@ -19129,7 +19185,7 @@ function createObservationCore(deps) {
|
|
|
19129
19185
|
},
|
|
19130
19186
|
async reportSourceState(source, state, usage) {
|
|
19131
19187
|
const now = clock.now();
|
|
19132
|
-
await
|
|
19188
|
+
await transact(async (trx) => {
|
|
19133
19189
|
const wasBlind = await blindReason(trx, source);
|
|
19134
19190
|
await sourceState(trx, source, state);
|
|
19135
19191
|
await recordUsage(trx, source, usage, now);
|
|
@@ -19144,7 +19200,7 @@ function createObservationCore(deps) {
|
|
|
19144
19200
|
},
|
|
19145
19201
|
notice(kind, value) {
|
|
19146
19202
|
const at = new Date(clock.now()).toISOString();
|
|
19147
|
-
return
|
|
19203
|
+
return transact(async (trx) => {
|
|
19148
19204
|
const key = `spur-notice:${kind}:${value}`;
|
|
19149
19205
|
if (await trx.selectFrom("meta").select("key").where("key", "=", key).executeTakeFirst() !== void 0) return;
|
|
19150
19206
|
await trx.insertInto("meta").values({
|
|
@@ -19241,7 +19297,7 @@ async function tickBoard(deps) {
|
|
|
19241
19297
|
});
|
|
19242
19298
|
await remindStuckTurns(trx, config, new Date(now));
|
|
19243
19299
|
await reconcileItems(trx, config, now, completeSince.has("spur"), deps.warnSkipped);
|
|
19244
|
-
});
|
|
19300
|
+
}, clock);
|
|
19245
19301
|
}
|
|
19246
19302
|
// ../core/src/app/command-replies.ts
|
|
19247
19303
|
function line(text) {
|
|
@@ -19584,6 +19640,7 @@ function createInbound(input) {
|
|
|
19584
19640
|
const { store, gateway, config } = input;
|
|
19585
19641
|
const warnSkipped = warnSkippedOnce(input.warn);
|
|
19586
19642
|
const clock = input.clock ?? { now: () => Date.now() };
|
|
19643
|
+
const transact = (fn) => scanTransaction(store, config, fn, clock);
|
|
19587
19644
|
const registry = input.registry ?? {};
|
|
19588
19645
|
let running = Promise.resolve();
|
|
19589
19646
|
const stopping = new AbortController();
|
|
@@ -19909,7 +19966,7 @@ function createInbound(input) {
|
|
|
19909
19966
|
});
|
|
19910
19967
|
}
|
|
19911
19968
|
async function recordFailure(event, error, at) {
|
|
19912
|
-
await withCommandKey(event.dedupeKey, () =>
|
|
19969
|
+
await withCommandKey(event.dedupeKey, () => transact(async (trx) => {
|
|
19913
19970
|
const context = await taskContext(trx, event, gateway.kind);
|
|
19914
19971
|
await journal(trx, {
|
|
19915
19972
|
kind: "inbound_failed",
|
|
@@ -19940,7 +19997,7 @@ function createInbound(input) {
|
|
|
19940
19997
|
let response = "not allowed";
|
|
19941
19998
|
if (event.sourceSpace === "feed") try {
|
|
19942
19999
|
const at = new Date(clock.now()).toISOString();
|
|
19943
|
-
response = (await
|
|
20000
|
+
response = (await transact((trx) => decideToken(trx, event.dedupeKey, token, at)))?.response ?? "not available yet";
|
|
19944
20001
|
} catch (error) {
|
|
19945
20002
|
if (!(error instanceof CommandError)) await recordFailure(event, error, new Date(clock.now()).toISOString());
|
|
19946
20003
|
response = error instanceof CommandError ? error.hint : "not available yet";
|
|
@@ -19958,7 +20015,7 @@ function createInbound(input) {
|
|
|
19958
20015
|
else try {
|
|
19959
20016
|
if (id === "token.list") {
|
|
19960
20017
|
const listedAt = new Date(clock.now());
|
|
19961
|
-
const listed = await
|
|
20018
|
+
const listed = await transact((trx) => postTokenList(trx, {
|
|
19962
20019
|
key: event.dedupeKey,
|
|
19963
20020
|
at: listedAt
|
|
19964
20021
|
}));
|
|
@@ -19998,7 +20055,7 @@ function createInbound(input) {
|
|
|
19998
20055
|
const at = new Date(clock.now()).toISOString();
|
|
19999
20056
|
const actor = event.kind === "message_deleted" || event.author === config.operator.slack ? "operator" : "system";
|
|
20000
20057
|
try {
|
|
20001
|
-
const result = await
|
|
20058
|
+
const result = await transact((trx) => replayOperation(trx, {
|
|
20002
20059
|
actor,
|
|
20003
20060
|
key: event.dedupeKey,
|
|
20004
20061
|
operation: operationId(event),
|
|
@@ -20018,7 +20075,7 @@ function createInbound(input) {
|
|
|
20018
20075
|
async function applyGap(event) {
|
|
20019
20076
|
await withVia("slack", async () => {
|
|
20020
20077
|
const at = new Date(clock.now()).toISOString();
|
|
20021
|
-
await
|
|
20078
|
+
await transact(async (trx) => {
|
|
20022
20079
|
const context = await taskContext(trx, event, gateway.kind);
|
|
20023
20080
|
const conversation = event.conversation === void 0 ? void 0 : await trx.selectFrom("conversation").select(["root_message_ref"]).where("gateway", "=", gateway.kind).where("ref", "=", event.conversation).executeTakeFirst();
|
|
20024
20081
|
const opened = conversation === void 0 ? void 0 : await trx.selectFrom("outbox").select(["id", "external_ref"]).where("kind", "=", "conversation.open").where("state", "=", "done").where(sql`json_extract(external_ref, '$.message')`, "=", conversation.root_message_ref).orderBy("id", "desc").executeTakeFirst();
|
|
@@ -20207,7 +20264,7 @@ function createInbound(input) {
|
|
|
20207
20264
|
return serial(async () => {
|
|
20208
20265
|
await readPending(await storedConversation(itemId));
|
|
20209
20266
|
const at = new Date(clock.now()).toISOString();
|
|
20210
|
-
await
|
|
20267
|
+
await transact(async (trx) => {
|
|
20211
20268
|
await reapply(trx, itemId, at);
|
|
20212
20269
|
await clearItem(trx, itemId, new Date(at));
|
|
20213
20270
|
});
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { et as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-
|
|
2
|
-
import { o as CliError, r as requestOperation } from "./chunk-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-
|
|
1
|
+
import { et as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-DhRcRAgF.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-D2XhQ1P5.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-lKSPkzsR.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|