spur-board 0.134.0 → 0.134.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-EIGSWJA9.mjs → chunk-BA7MJmCk.mjs} +2 -2
- package/dist/{chunk-DPzFY26V.mjs → chunk-CAcIV8kO.mjs} +1 -1
- package/dist/{chunk-CtrQ6KMg.mjs → chunk-nXKh8r0i.mjs} +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +161 -53
- package/dist/mcp.mjs +3 -3
- package/dist/web/assets/{index-CrdcWk57.js → index-EnNtaf0Z.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 +27 -1
- package/skills/spur-board/references/how-board-works-inbox.md +1 -1
|
@@ -3264,7 +3264,7 @@ const columnsDescribeOutputSchema = z.strictObject({ projects: z.array(z.strictO
|
|
|
3264
3264
|
resolvedThreadsFrom: z.enum(COLUMN_IDS).nullable().describe("Leftmost enabled thread gate, or null when none."),
|
|
3265
3265
|
completion: z.strictObject({
|
|
3266
3266
|
to: z.literal("done").describe("Completion destination, separate from ordinary gate progression."),
|
|
3267
|
-
text: z.string().describe("Alternative completion routes: eligible linked merged PR with a tracker-done ticket (GitHub closed or effective Jira doneStatuses), or a done ticket without open linked PRs/live workers after fresh complete non-blind repository and Spur observations. Missing/unconfirmed merged-ticket status holds dispatch;
|
|
3267
|
+
text: z.string().describe("Alternative completion routes: eligible linked merged PR with a tracker-done ticket (GitHub closed or effective Jira doneStatuses), or a done ticket without open linked PRs/live workers after fresh complete non-blind repository and Spur observations. Missing/unconfirmed merged-ticket status holds dispatch; a ticket that stays non-done and changed in any way at or after the newest merge, in filter or manually included, resumes work; a ticket untouched since the merge stays unconfirmed; when no merged PR has a stored merge time (facts from before the dispatcher), work resumes once the ticket, in filter or manually included, is observed open at or past the judged PR last update plus the tracker interval. Blind GitHub and pending submits hold both routes. Includes eligibility/readability, non-archived scope and dispatcher-mode qualifications.")
|
|
3268
3268
|
}).describe("Project-wide completion route from any column other than Done. Completion bypasses normal gates; it is not conjoined with exit.conditions."),
|
|
3269
3269
|
columns: z.array(z.strictObject({
|
|
3270
3270
|
id: z.enum(COLUMN_IDS).describe("Enabled column in canonical order."),
|
|
@@ -5340,7 +5340,7 @@ const OPERATIONS = [
|
|
|
5340
5340
|
resolvedThreadsFrom: null,
|
|
5341
5341
|
completion: {
|
|
5342
5342
|
to: "done",
|
|
5343
|
-
text: "Completion bypasses normal gates: an eligible linked merged PR with a done ticket (GitHub closed or configured Jira doneStatuses), or a done ticket without open linked PRs/live workers and with fresh complete non-blind repository and Spur observations. Missing/unconfirmed merged-ticket status holds dispatch. An open ticket resumes work after the
|
|
5343
|
+
text: "Completion bypasses normal gates: an eligible linked merged PR with a done ticket (GitHub closed or configured Jira doneStatuses), or a done ticket without open linked PRs/live workers and with fresh complete non-blind repository and Spur observations. Missing/unconfirmed merged-ticket status holds dispatch. An open ticket resumes work only once it changed at or after the newest merge, with in-filter or manual-inclusion evidence; when no merged PR has a stored merge time (facts from before the dispatcher), work resumes once the ticket, in filter or manually included, is observed open at or past the judged PR last update plus the tracker interval. Blind GitHub or a pending submit holds both routes."
|
|
5344
5344
|
},
|
|
5345
5345
|
columns: [{
|
|
5346
5346
|
id: "todo",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as renderJsonError, at as ERRORS, c as tokenRequestStatusSchema, ct as errorEnvelopeSchema, o as tokenRequestResultSchema, st as errorContextSchema, ut as successEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { _ as renderJsonError, at as ERRORS, c as tokenRequestStatusSchema, ct as errorEnvelopeSchema, o as tokenRequestResultSchema, st as errorContextSchema, ut as successEnvelopeSchema } from "./chunk-BA7MJmCk.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 { Ct as plainHttpAllowed, d as buildCatalogSnapshot, p as OPERATIONS, xt as configSchema } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { Ct as plainHttpAllowed, d as buildCatalogSnapshot, p as OPERATIONS, xt as configSchema } from "./chunk-BA7MJmCk.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-CAcIV8kO.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 { D as sortSkillFiles, T as skillReloadFileSchema, Tt as resolveWebOrigin, a as requestHashOf, at as ERRORS, et as actorIdSchema, f as roleCanUseOperation, ht as DEFAULT_STAND_PORT_RANGE, jt as SLACK_BOT_SCOPES, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as successEnvelopeSchema, wt as requiredSecretKeys, xt as configSchema } from "./chunk-
|
|
1
|
+
import { D as sortSkillFiles, T as skillReloadFileSchema, Tt as resolveWebOrigin, a as requestHashOf, at as ERRORS, et as actorIdSchema, f as roleCanUseOperation, ht as DEFAULT_STAND_PORT_RANGE, jt as SLACK_BOT_SCOPES, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as successEnvelopeSchema, wt as requiredSecretKeys, xt as configSchema } from "./chunk-BA7MJmCk.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-CAcIV8kO.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-nXKh8r0i.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-CAcIV8kO.mjs";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as REF_NUMBER, A as eventPayloadSchemas, At as ITEM_KINDS, B as REVIEW_DECISIONS, C as messageRefSchema, Ct as plainHttpAllowed, D as sortSkillFiles, Dt as COLUMN_GROUPS, E as skillReloadFilesSchema, Et as COLUMNS, F as prSourceId, Ft as isTodoGroupColumn, G as parseRingMarker, H as SESSION_HEALTH_STATES, I as sessionTransitionSchema, J as prReviewRuleSchema, K as prFactsSchema, L as sourceCursorSchema, M as batchSchema, Mt as TASK_HOLDS, N as defaultBranchFactSchema, Nt as TODO_GROUP_COLUMN_IDS, O as EVENT_KINDS, Ot as COLUMN_IDS, P as entityRefSchema, Pt as VIAS, Q as JIRA_PROJECT_KEY, R as trackerSourceId, S as interactionRefSchema, St as defaultAddressee, Tt as resolveWebOrigin, U as SESSION_STATUSES, V as REVIEW_STATES, W as isExternalAuthor, X as sessionFactsSchema, Y as ringMarker, Z as ticketFactsSchema, _t as approvalRuleOf, a as requestHashOf, at as ERRORS, b as conversationRefSchema, bt as configBindings, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, et as actorIdSchema, f as roleCanUseOperation, ft as DEFAULT_LINK, g as renderHttpProblem, gt as RESERVED_PROJECT, h as turnHandedSchema, i as TOKEN_REQUEST_LIMITS, it as parseRef$1, j as AdapterError, jt as SLACK_BOT_SCOPES, k as GATE_REASONS, kt as DISPATCHER_MODES, l as BOARD_TICK_MS, lt as ok, m as defaultBranchViewSchema, mt as DEFAULT_SLACK_COMMAND, n as doctorReportSchema, nt as errorCodeOf, o as tokenRequestResultSchema, ot as err, p as OPERATIONS, q as prRefSchema, rt as parseActorId, s as tokenRequestSchema, t as assertNever, tt as encodeActorId, ut as successEnvelopeSchema, vt as boardWideSpurProject, w as userIdSchema, wt as requiredSecretKeys, x as inboundEventSchema, xt as configSchema, y as SPACE_IDS, yt as columnTurnTimings, z as PR_STATES } from "./chunk-
|
|
1
|
+
import { $ as REF_NUMBER, A as eventPayloadSchemas, At as ITEM_KINDS, B as REVIEW_DECISIONS, C as messageRefSchema, Ct as plainHttpAllowed, D as sortSkillFiles, Dt as COLUMN_GROUPS, E as skillReloadFilesSchema, Et as COLUMNS, F as prSourceId, Ft as isTodoGroupColumn, G as parseRingMarker, H as SESSION_HEALTH_STATES, I as sessionTransitionSchema, J as prReviewRuleSchema, K as prFactsSchema, L as sourceCursorSchema, M as batchSchema, Mt as TASK_HOLDS, N as defaultBranchFactSchema, Nt as TODO_GROUP_COLUMN_IDS, O as EVENT_KINDS, Ot as COLUMN_IDS, P as entityRefSchema, Pt as VIAS, Q as JIRA_PROJECT_KEY, R as trackerSourceId, S as interactionRefSchema, St as defaultAddressee, Tt as resolveWebOrigin, U as SESSION_STATUSES, V as REVIEW_STATES, W as isExternalAuthor, X as sessionFactsSchema, Y as ringMarker, Z as ticketFactsSchema, _t as approvalRuleOf, a as requestHashOf, at as ERRORS, b as conversationRefSchema, bt as configBindings, c as tokenRequestStatusSchema, d as buildCatalogSnapshot, et as actorIdSchema, f as roleCanUseOperation, ft as DEFAULT_LINK, g as renderHttpProblem, gt as RESERVED_PROJECT, h as turnHandedSchema, i as TOKEN_REQUEST_LIMITS, it as parseRef$1, j as AdapterError, jt as SLACK_BOT_SCOPES, k as GATE_REASONS, kt as DISPATCHER_MODES, l as BOARD_TICK_MS, lt as ok, m as defaultBranchViewSchema, mt as DEFAULT_SLACK_COMMAND, n as doctorReportSchema, nt as errorCodeOf, o as tokenRequestResultSchema, ot as err, p as OPERATIONS, q as prRefSchema, rt as parseActorId, s as tokenRequestSchema, t as assertNever, tt as encodeActorId, ut as successEnvelopeSchema, vt as boardWideSpurProject, w as userIdSchema, wt as requiredSecretKeys, x as inboundEventSchema, xt as configSchema, y as SPACE_IDS, yt as columnTurnTimings, z as PR_STATES } from "./chunk-BA7MJmCk.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";
|
|
@@ -8024,24 +8024,47 @@ function ticketDone(project, status) {
|
|
|
8024
8024
|
return project.tracker.type === "jira" ? project.tracker.doneStatuses.includes(status) : status === "closed";
|
|
8025
8025
|
}
|
|
8026
8026
|
/**
|
|
8027
|
-
* How the ticket of a task stands after its PR merged at `mergedAt`: `done`; `
|
|
8028
|
-
*
|
|
8029
|
-
*
|
|
8030
|
-
*
|
|
8027
|
+
* How the ticket of a task stands after its PR merged at `mergedAt`: `done`; `reopened` once the
|
|
8028
|
+
* ticket changed at or after the merge and is still not done, in the filter or fetched by key for
|
|
8029
|
+
* a hand-added task; else `unconfirmed`, since a ticket untouched since the merge only waits to be
|
|
8030
|
+
* moved to done, and a ticket dropped from the filter keeps a stale status. An equal time counts as
|
|
8031
|
+
* a change: GitHub times have one-second precision, and a merge-triggered edit of the issue in the
|
|
8032
|
+
* same second shows the merge time. PR facts stored by an earlier version carry no merge time: for
|
|
8033
|
+
* them the ticket is `open`, as it was then, once seen open one tracker interval after the PR's
|
|
8034
|
+
* last change; that stops the merged PR counting like `reopened`, without naming a reopen.
|
|
8031
8035
|
*/
|
|
8032
|
-
function mergedTicket(project, config, ticket, manualInclude,
|
|
8036
|
+
function mergedTicket(project, config, ticket, manualInclude, pr) {
|
|
8033
8037
|
if (ticket === void 0) return "unconfirmed";
|
|
8034
8038
|
if (ticketDone(project, ticket.status)) return "done";
|
|
8035
|
-
|
|
8039
|
+
if (pr.mergedAt === void 0) return seenOpenSince(project, config, ticket, manualInclude, Date.parse(pr.updatedAt)) ? "open" : "unconfirmed";
|
|
8040
|
+
let facts;
|
|
8036
8041
|
try {
|
|
8037
8042
|
const parsed = ticketFactsSchema.safeParse(JSON.parse(ticket.detail));
|
|
8038
8043
|
if (!parsed.success) return "unconfirmed";
|
|
8039
|
-
|
|
8044
|
+
facts = parsed.data;
|
|
8040
8045
|
} catch {
|
|
8041
8046
|
return "unconfirmed";
|
|
8042
8047
|
}
|
|
8048
|
+
if (!(facts.inFilter || manualInclude)) return "unconfirmed";
|
|
8049
|
+
return Date.parse(facts.updatedAt) >= Date.parse(pr.mergedAt) ? "reopened" : "unconfirmed";
|
|
8050
|
+
}
|
|
8051
|
+
/**
|
|
8052
|
+
* Whether the tracker saw the ticket still not done, in the filter or fetched by key for a
|
|
8053
|
+
* hand-added task, at least one tracker interval after `since`: the grace in which a close the
|
|
8054
|
+
* PR's merge triggers may not be polled yet.
|
|
8055
|
+
*/
|
|
8056
|
+
function seenOpenSince(project, config, ticket, manualInclude, since) {
|
|
8057
|
+
if (ticket === void 0 || ticketDone(project, ticket.status)) return false;
|
|
8058
|
+
const parsed = (() => {
|
|
8059
|
+
try {
|
|
8060
|
+
return ticketFactsSchema.safeParse(JSON.parse(ticket.detail));
|
|
8061
|
+
} catch {
|
|
8062
|
+
return null;
|
|
8063
|
+
}
|
|
8064
|
+
})();
|
|
8065
|
+
if (parsed?.success !== true || !(parsed.data.inFilter || manualInclude)) return false;
|
|
8043
8066
|
const { intervalMs } = project.tracker.type === "jira" ? config.adapters.jira : config.adapters.githubIssues;
|
|
8044
|
-
return
|
|
8067
|
+
return Date.parse(ticket.observed_at) >= since + intervalMs;
|
|
8045
8068
|
}
|
|
8046
8069
|
/**
|
|
8047
8070
|
* Whether a PR link counts past the task's reopen floor: an open link, or a link not hidden by a
|
|
@@ -8076,6 +8099,19 @@ async function taskMergedPr(db, taskId) {
|
|
|
8076
8099
|
number: link.number
|
|
8077
8100
|
};
|
|
8078
8101
|
}
|
|
8102
|
+
/**
|
|
8103
|
+
* The newest merge time among the task's eligible merged PRs (those `taskMergedPr` picks from), or
|
|
8104
|
+
* null when none is readable. A merge after the judged PR's still holds a ticket edited before it.
|
|
8105
|
+
*/
|
|
8106
|
+
async function newestMergeAt(db, taskId) {
|
|
8107
|
+
return latest$1((await db.selectFrom("link").innerJoin("pr_snapshot", (join) => join.on(sql`lower(pr_snapshot.repo) = lower(link.repo)`).onRef("pr_snapshot.number", "=", "link.number")).select("pr_snapshot.detail").where("link.task_id", "=", taskId).where("link.entity", "=", "pr").where("link.pr_state", "=", "active").where("link.banned", "=", 0).where("pr_snapshot.state", "=", "merged").where(pastReopenFloor).execute()).map((row) => parsePr(row.detail)?.mergedAt ?? null));
|
|
8108
|
+
}
|
|
8109
|
+
/** The latest of some times, or null when none is given. */
|
|
8110
|
+
function latest$1(times) {
|
|
8111
|
+
let newest = null;
|
|
8112
|
+
for (const time of times) if (time != null && (newest === null || Date.parse(time) > Date.parse(newest))) newest = time;
|
|
8113
|
+
return newest;
|
|
8114
|
+
}
|
|
8079
8115
|
/** A PR snapshot's facts, or null when the detail is missing or unreadable. */
|
|
8080
8116
|
function parsePr(detail) {
|
|
8081
8117
|
if (detail === void 0) return null;
|
|
@@ -8818,7 +8854,7 @@ const BLOCK_ITEM_KINDS = ITEM_KINDS.filter((kind) => ITEM_POLICY[kind].block);
|
|
|
8818
8854
|
function fingerprint(candidate) {
|
|
8819
8855
|
return createHash("sha256").update(JSON.stringify([
|
|
8820
8856
|
candidate.key,
|
|
8821
|
-
candidate.summary,
|
|
8857
|
+
candidate.hashedSummary ?? candidate.summary,
|
|
8822
8858
|
candidate.source,
|
|
8823
8859
|
candidate.revision ?? null
|
|
8824
8860
|
])).digest("hex");
|
|
@@ -14276,9 +14312,9 @@ const stallObservationSchema = z.object({
|
|
|
14276
14312
|
resumedAt: z.number().nullable()
|
|
14277
14313
|
});
|
|
14278
14314
|
const ENDED_WORKER_LABELS = {
|
|
14279
|
-
worker_completed: "worker ended (completed)
|
|
14280
|
-
worker_killed: "worker ended (killed)
|
|
14281
|
-
worker_vanished: "worker vanished
|
|
14315
|
+
worker_completed: "worker ended (completed)",
|
|
14316
|
+
worker_killed: "worker ended (killed)",
|
|
14317
|
+
worker_vanished: "worker vanished"
|
|
14282
14318
|
};
|
|
14283
14319
|
/** Health flags only the operator can resolve; each opens an operator block. */
|
|
14284
14320
|
const ANOMALY_FLAGS = /* @__PURE__ */ new Set([
|
|
@@ -14555,9 +14591,11 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
14555
14591
|
});
|
|
14556
14592
|
const liveSessionTasks = new Set(subjects.filter((subject) => subject.endedAt === null).map((subject) => subject.taskId));
|
|
14557
14593
|
const prs = await trx.selectFrom("link").leftJoin("pr_snapshot", (join) => join.on(sql`lower(pr_snapshot.repo) = lower(link.repo)`).onRef("pr_snapshot.number", "=", "link.number")).select([
|
|
14594
|
+
"link.id",
|
|
14558
14595
|
"link.task_id",
|
|
14559
14596
|
"link.repo",
|
|
14560
14597
|
"link.number",
|
|
14598
|
+
"link.pr_state",
|
|
14561
14599
|
"pr_snapshot.state",
|
|
14562
14600
|
"pr_snapshot.source",
|
|
14563
14601
|
"pr_snapshot.observed_at",
|
|
@@ -14581,62 +14619,103 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
14581
14619
|
ticketDone: project !== void 0 && ticket !== void 0 && ticketDone(project, ticket.status)
|
|
14582
14620
|
};
|
|
14583
14621
|
}
|
|
14622
|
+
const closeTime = (pr) => {
|
|
14623
|
+
const facts = pr.detail === null ? null : parseJson(prFactsSchema, pr.detail);
|
|
14624
|
+
return facts === null ? NaN : Date.parse(facts.closedAt ?? facts.updatedAt);
|
|
14625
|
+
};
|
|
14584
14626
|
const mergedAt = /* @__PURE__ */ new Map();
|
|
14627
|
+
const newestMerge = /* @__PURE__ */ new Map();
|
|
14628
|
+
const judged = /* @__PURE__ */ new Map();
|
|
14585
14629
|
for (const pr of prs) {
|
|
14586
14630
|
const state = taskPrs[String(pr.task_id)];
|
|
14587
14631
|
if (state === void 0) continue;
|
|
14588
14632
|
if (pr.state === "open") state.hasOpenPr = true;
|
|
14589
|
-
if (pr.state !== "merged") continue;
|
|
14633
|
+
if (pr.state !== "merged" || pr.pr_state !== "active") continue;
|
|
14590
14634
|
const facts = parsePr(pr.detail ?? void 0);
|
|
14591
14635
|
const at = facts === null ? null : facts.mergedAt ?? facts.updatedAt;
|
|
14592
14636
|
const newest = mergedAt.get(pr.task_id) ?? null;
|
|
14593
14637
|
if (newest === null || at !== null && Date.parse(at) >= Date.parse(newest)) mergedAt.set(pr.task_id, at);
|
|
14638
|
+
newestMerge.set(pr.task_id, latest$1([newestMerge.get(pr.task_id), facts?.mergedAt]));
|
|
14639
|
+
const current = judged.get(pr.task_id);
|
|
14640
|
+
if (current === void 0 || pr.id > current.id) judged.set(pr.task_id, {
|
|
14641
|
+
id: pr.id,
|
|
14642
|
+
facts,
|
|
14643
|
+
at,
|
|
14644
|
+
ref: `${pr.repo ?? ""}#${String(pr.number)}`
|
|
14645
|
+
});
|
|
14594
14646
|
}
|
|
14595
|
-
|
|
14596
|
-
const state = taskPrs[String(taskId)];
|
|
14597
|
-
const task = taskById.get(taskId);
|
|
14598
|
-
if (state === void 0 || task === void 0) continue;
|
|
14599
|
-
const project = config.projects.find((entry) => entry.id === task.project);
|
|
14600
|
-
state.hasMergedPr = at === null || project === void 0 || mergedTicket(project, config, tickets.find((entry) => entry.task_id === taskId), task.manual_include === 1, at) !== "open";
|
|
14601
|
-
}
|
|
14602
|
-
const heldKeys = [];
|
|
14647
|
+
const prClosed = /* @__PURE__ */ new Map();
|
|
14603
14648
|
for (const task of tasks) {
|
|
14604
14649
|
const state = taskPrs[String(task.id)];
|
|
14605
|
-
if (state === void 0 || state.hasOpenPr
|
|
14650
|
+
if (state === void 0 || state.hasOpenPr) continue;
|
|
14606
14651
|
const mergedSince = Date.parse(mergedAt.get(task.id) ?? "");
|
|
14607
|
-
const closed = prs.filter((pr) => pr.task_id === task.id && pr.state === "closed").map((pr) => {
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
closedAt: facts === null ? NaN : Date.parse(facts.closedAt ?? facts.updatedAt)
|
|
14613
|
-
};
|
|
14614
|
-
}).filter((pr) => !(pr.closedAt < mergedSince)).sort((left, right) => left.ref.localeCompare(right.ref));
|
|
14652
|
+
const closed = prs.filter((pr) => pr.task_id === task.id && pr.state === "closed").map((pr) => ({
|
|
14653
|
+
...pr,
|
|
14654
|
+
ref: `${pr.repo ?? ""}#${String(pr.number)}`,
|
|
14655
|
+
closedAt: closeTime(pr)
|
|
14656
|
+
})).filter((pr) => !(pr.closedAt < mergedSince)).sort((left, right) => left.ref.localeCompare(right.ref));
|
|
14615
14657
|
const first = closed[0];
|
|
14616
14658
|
if (first === void 0) continue;
|
|
14617
14659
|
const closedAt = Math.max(...closed.map((pr) => pr.closedAt));
|
|
14618
14660
|
const key = `pr-closed:${String(task.id)}`;
|
|
14619
14661
|
if (state.prCompleteAt === null || !(state.prCompleteAt >= closedAt)) {
|
|
14620
|
-
|
|
14662
|
+
prClosed.set(task.id, {
|
|
14663
|
+
held: true,
|
|
14664
|
+
key
|
|
14665
|
+
});
|
|
14621
14666
|
continue;
|
|
14622
14667
|
}
|
|
14623
14668
|
const refs = closed.map((pr) => pr.ref);
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14669
|
+
prClosed.set(task.id, {
|
|
14670
|
+
held: false,
|
|
14671
|
+
closedAt,
|
|
14672
|
+
item: {
|
|
14673
|
+
key,
|
|
14674
|
+
kind: "anomaly",
|
|
14675
|
+
taskId: task.id,
|
|
14676
|
+
summary: `${task.key}: linked pull request ${refs.join(", ")} closed without merge, no open PR`,
|
|
14677
|
+
factAt: first.observed_at,
|
|
14678
|
+
source: prSourceId(task.project, first.repo ?? ""),
|
|
14679
|
+
priority: 4,
|
|
14680
|
+
revision: refs.join(",")
|
|
14681
|
+
}
|
|
14633
14682
|
});
|
|
14634
14683
|
}
|
|
14684
|
+
const reopened = /* @__PURE__ */ new Map();
|
|
14685
|
+
const liftHeld = /* @__PURE__ */ new Set();
|
|
14686
|
+
for (const [taskId, { facts, at, ref }] of judged) {
|
|
14687
|
+
const state = taskPrs[String(taskId)];
|
|
14688
|
+
const task = taskById.get(taskId);
|
|
14689
|
+
if (state === void 0 || task === void 0) continue;
|
|
14690
|
+
const project = config.projects.find((entry) => entry.id === task.project);
|
|
14691
|
+
const ticket = tickets.find((entry) => entry.task_id === taskId);
|
|
14692
|
+
const storedMerge = latest$1([facts?.mergedAt, newestMerge.get(taskId)]);
|
|
14693
|
+
const judgement = facts === null || project === void 0 ? "unconfirmed" : mergedTicket(project, config, ticket, task.manual_include === 1, {
|
|
14694
|
+
...facts,
|
|
14695
|
+
...storedMerge === null ? {} : { mergedAt: storedMerge }
|
|
14696
|
+
});
|
|
14697
|
+
const closure = prClosed.get(taskId);
|
|
14698
|
+
const seenOpen = project !== void 0 && seenOpenSince(project, config, ticket, task.manual_include === 1, Date.parse(mergedAt.get(taskId) ?? ""));
|
|
14699
|
+
const followUpClosed = closure?.held === false && seenOpen;
|
|
14700
|
+
state.hasMergedPr = at === null || project === void 0 || judgement !== "reopened" && judgement !== "open" && (judgement === "done" || !followUpClosed);
|
|
14701
|
+
if (judgement === "reopened") reopened.set(taskId, `; PR ${ref} merged, ticket reopened`);
|
|
14702
|
+
if (state.hasMergedPr && seenOpen && closure?.held === true) liftHeld.add(taskId);
|
|
14703
|
+
}
|
|
14704
|
+
const heldKeys = [];
|
|
14705
|
+
for (const task of tasks) {
|
|
14706
|
+
const closure = prClosed.get(task.id);
|
|
14707
|
+
if (closure === void 0) continue;
|
|
14708
|
+
const key = closure.held ? closure.key : closure.item.key;
|
|
14709
|
+
if (taskPrs[String(task.id)]?.hasMergedPr !== false) {
|
|
14710
|
+
if (liftHeld.has(task.id)) heldKeys.push(key);
|
|
14711
|
+
} else if (closure.held) heldKeys.push(key);
|
|
14712
|
+
else candidates.push(closure.item);
|
|
14713
|
+
}
|
|
14635
14714
|
for (const task of tasks) {
|
|
14636
14715
|
const state = taskPrs[String(task.id)];
|
|
14637
14716
|
const project = config.projects.find((entry) => entry.id === task.project);
|
|
14638
14717
|
const ticket = tickets.find((entry) => entry.task_id === task.id);
|
|
14639
|
-
const closedWhileLive = state !== void 0 && project !== void 0 && ticket !== void 0 && ticketDone(project, ticket.status) && (state.hasOpenPr || liveSessionTasks.has(String(task.id))) && !state.hasMergedPr;
|
|
14718
|
+
const closedWhileLive = state !== void 0 && project !== void 0 && ticket !== void 0 && ticketDone(project, ticket.status) && (state.hasOpenPr || liveSessionTasks.has(String(task.id))) && !state.hasMergedPr && !prs.some((pr) => pr.task_id === task.id && pr.state === "merged");
|
|
14640
14719
|
if (task.membership === "out_of_filter" && !closedWhileLive) candidates.push({
|
|
14641
14720
|
key: `filter:${String(task.id)}`,
|
|
14642
14721
|
kind: "board_observation",
|
|
@@ -14792,6 +14871,23 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
14792
14871
|
now,
|
|
14793
14872
|
episode: previousEpisode === void 0 ? null : parseJson(episodeSchema, previousEpisode.value)
|
|
14794
14873
|
});
|
|
14874
|
+
if (liftHeld.size > 0) {
|
|
14875
|
+
const lifted = evaluateSessionHealth({
|
|
14876
|
+
sessions: subjects,
|
|
14877
|
+
tasks: Object.fromEntries(Object.entries(taskPrs).map(([id, state]) => [id, liftHeld.has(Number(id)) ? {
|
|
14878
|
+
...state,
|
|
14879
|
+
hasMergedPr: false
|
|
14880
|
+
} : state])),
|
|
14881
|
+
spur: {
|
|
14882
|
+
blind: spurBlind,
|
|
14883
|
+
observationComplete: spurComplete
|
|
14884
|
+
},
|
|
14885
|
+
config: config.health,
|
|
14886
|
+
now,
|
|
14887
|
+
episode: previousEpisode === void 0 ? null : parseJson(episodeSchema, previousEpisode.value)
|
|
14888
|
+
});
|
|
14889
|
+
for (const flag of [...lifted.flags, ...lifted.held]) if (liftHeld.has(Number(flag.taskId)) && ENDED_WORKER_LABELS[flag.kind] !== void 0) heldKeys.push(healthKey(Number(flag.taskId), flag));
|
|
14890
|
+
}
|
|
14795
14891
|
await trx.insertInto("meta").values({
|
|
14796
14892
|
key: "host_load_episode",
|
|
14797
14893
|
value: toJson(episodeSchema, health.episode)
|
|
@@ -14815,7 +14911,8 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
14815
14911
|
key: healthKey(task.id, flag),
|
|
14816
14912
|
kind: ANOMALY_FLAGS.has(flag.kind) && !asking ? "anomaly" : flag.kind === "worker_killed" ? "worker_ended" : "board_observation",
|
|
14817
14913
|
taskId: task.id,
|
|
14818
|
-
summary: `${task.key}: ${endedLabel
|
|
14914
|
+
summary: `${task.key}: ${endedLabel === void 0 ? flag.kind.replaceAll("_", " ") : `${endedLabel}${reopened.get(task.id) ?? ", no PR"}`} (${flag.sessionId})`,
|
|
14915
|
+
...endedLabel === void 0 ? {} : { hashedSummary: `${task.key}: ${endedLabel}, no PR (${flag.sessionId})` },
|
|
14819
14916
|
factAt: endedLabel === void 0 ? fact?.healthSince ?? null : spur?.last_complete_at ?? fact?.endedAt ?? null,
|
|
14820
14917
|
source: "spur",
|
|
14821
14918
|
priority: 4,
|
|
@@ -14879,10 +14976,13 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
14879
14976
|
if (old !== void 0 && (dismissal?.fingerprint === hash || !kept)) await clearReconciled(trx, old, new Date(now));
|
|
14880
14977
|
if (dismissal?.fingerprint === hash) continue;
|
|
14881
14978
|
if (kept) {
|
|
14882
|
-
if (old.fact_at !== candidate.factAt || old.source !== candidate.source) await trx.updateTable("operator_item").set({
|
|
14979
|
+
if (old.fact_at !== candidate.factAt || old.source !== candidate.source || old.text !== candidate.summary) await trx.updateTable("operator_item").set({
|
|
14883
14980
|
fact_at: candidate.factAt,
|
|
14884
|
-
source: candidate.source
|
|
14981
|
+
source: candidate.source,
|
|
14982
|
+
text: candidate.summary
|
|
14885
14983
|
}).where("id", "=", old.id).execute();
|
|
14984
|
+
const task = candidate.taskId === null ? void 0 : taskById.get(candidate.taskId);
|
|
14985
|
+
if (candidate.hashedSummary !== void 0 && old.text !== candidate.summary && old.block_id !== null && task !== void 0) await trx.updateTable("block").set({ reason: blockReason(task, candidate.summary) }).where("id", "=", old.block_id).where("state", "=", "open").execute();
|
|
14886
14986
|
continue;
|
|
14887
14987
|
}
|
|
14888
14988
|
const task = candidate.taskId === null ? null : taskById.get(candidate.taskId);
|
|
@@ -14923,14 +15023,18 @@ function prCompleteAt(project, sourceById) {
|
|
|
14923
15023
|
* Raises a ledger item with the operator block it stands for. An active item of the key is
|
|
14924
15024
|
* returned as it is, so a repeated raise opens no second block.
|
|
14925
15025
|
*/
|
|
15026
|
+
/** The reason of an item's block: the item text without its task key prefix. */
|
|
15027
|
+
function blockReason(task, text) {
|
|
15028
|
+
const prefix = `${task.key}: `;
|
|
15029
|
+
return text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
15030
|
+
}
|
|
14926
15031
|
async function raiseAnomaly(trx, config, task, input, executorId) {
|
|
14927
15032
|
const active = await trx.selectFrom("operator_item").selectAll().where("item_key", "=", input.itemKey).where("cleared_at", "is", null).executeTakeFirst();
|
|
14928
15033
|
if (active !== void 0) return active;
|
|
14929
|
-
const prefix = `${task.key}: `;
|
|
14930
15034
|
const toCurator = input.itemKey.startsWith("turn-stall:") && curatorProject(config, task.project) !== null && (await curatorSession(trx, config, task.project))?.id !== executorId;
|
|
14931
15035
|
const block = await openSystemBlock(trx, {
|
|
14932
15036
|
task,
|
|
14933
|
-
reason:
|
|
15037
|
+
reason: blockReason(task, input.text),
|
|
14934
15038
|
at: input.at.toISOString(),
|
|
14935
15039
|
config,
|
|
14936
15040
|
...toCurator ? { addressee: "curator" } : {}
|
|
@@ -15065,13 +15169,12 @@ function healthKey(taskId, flag) {
|
|
|
15065
15169
|
// ../core/src/app/dispatch.ts
|
|
15066
15170
|
const CURSOR_KEY = "dispatcher_cursor";
|
|
15067
15171
|
/** Policy counterpart of readInput's mergedTicket qualification and dispatchTasks' scope. */
|
|
15068
|
-
function describeCompletion(project
|
|
15172
|
+
function describeCompletion(project) {
|
|
15069
15173
|
const route = describeCompletion$1();
|
|
15070
15174
|
const done = project.tracker.type === "jira" ? `a Jira status in ${JSON.stringify(project.tracker.doneStatuses)}` : "GitHub status \"closed\"";
|
|
15071
|
-
const interval = project.tracker.type === "jira" ? config.adapters.jira.intervalMs : config.adapters.githubIssues.intervalMs;
|
|
15072
15175
|
return {
|
|
15073
15176
|
...route,
|
|
15074
|
-
text: `${route.text} A done ticket means ${done}. After a merge, a missing ticket or unconfirmed status holds dispatch. An open ticket resumes work without the merged PR only once
|
|
15177
|
+
text: `${route.text} A done ticket means ${done}. After a merge, a missing ticket or unconfirmed status holds dispatch. An open ticket resumes work without the merged PR only once it changed at or after the newest merge, in the tracker filter or for a manually included task; a ticket untouched since the merge stays unconfirmed, and dropped-filter evidence alone stays unconfirmed; when no merged PR has a stored merge time (facts from before the dispatcher), work resumes once the ticket, in filter or manually included, is observed open at or past the judged PR's last update plus the tracker interval. Only non-archived tasks are evaluated; eligible links must be unbanned and past the reopen floor. Missing or unreadable facts for a chosen or fallback PR hold evaluation. Cycle holds do not stop completion shortcuts. Dispatcher on applies moves; shadow computes only a shadow position.`
|
|
15075
15178
|
};
|
|
15076
15179
|
}
|
|
15077
15180
|
const modeKey = (project) => `dispatcher_mode:${project}`;
|
|
@@ -15572,8 +15675,13 @@ async function readInput(trx, task, project, mode, blind, config, clock) {
|
|
|
15572
15675
|
let mergedOpen;
|
|
15573
15676
|
let ticketUnconfirmed = false;
|
|
15574
15677
|
if (pr?.state === "merged") {
|
|
15575
|
-
const
|
|
15576
|
-
|
|
15678
|
+
const ticket = await readTicket();
|
|
15679
|
+
const mergedAt = latest$1([pr.mergedAt, await newestMergeAt(trx, task.id)]);
|
|
15680
|
+
const judged = mergedTicket(project, config, ticket, task.manual_include === 1, {
|
|
15681
|
+
...pr,
|
|
15682
|
+
...mergedAt === null ? {} : { mergedAt }
|
|
15683
|
+
});
|
|
15684
|
+
if (judged === "reopened" || judged === "open") mergedOpen = {
|
|
15577
15685
|
repo: pr.repo,
|
|
15578
15686
|
number: pr.number
|
|
15579
15687
|
};
|
|
@@ -18254,7 +18362,7 @@ async function describeProject(trx, config, project) {
|
|
|
18254
18362
|
checksGate: project.checksGate,
|
|
18255
18363
|
reposWithoutCi: [...project.reposWithoutCi],
|
|
18256
18364
|
resolvedThreadsFrom: from ?? null,
|
|
18257
|
-
completion: describeCompletion(project
|
|
18365
|
+
completion: describeCompletion(project),
|
|
18258
18366
|
columns
|
|
18259
18367
|
};
|
|
18260
18368
|
}
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { at 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 { at as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-BA7MJmCk.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-CAcIV8kO.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-nXKh8r0i.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|