spur-board 0.17.1 → 0.19.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/cli.mjs +3 -3
- package/dist/{client-Swp5TBku.mjs → client-DfvJWQFq.mjs} +1 -1
- package/dist/client.mjs +1 -1
- package/dist/{config-C1ly8wCm.mjs → config-BDEvO1UV.mjs} +2 -2
- package/dist/daemon.mjs +146 -23
- package/dist/mcp.mjs +3 -3
- package/dist/{src-vzl2nFf6.mjs → src-BQIJz8yP.mjs} +4 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as SLACK_BOT_SCOPES, P as ERRORS, U as configSchema, W as requiredSecretKeys, l as roleCanUseOperation, r as SYSTEMD_SERVICE_SETTINGS, u as OPERATIONS } from "./src-
|
|
2
|
-
import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadEnrollmentConfig, i as fileVerdictCache, l as readConfiguredPort, n as cliPackageVersion, o as configFile, s as loadClientConfig, t as checkCatalog, u as resolveDaemonAddress } from "./config-
|
|
1
|
+
import { G as SLACK_BOT_SCOPES, P as ERRORS, U as configSchema, W as requiredSecretKeys, l as roleCanUseOperation, r as SYSTEMD_SERVICE_SETTINGS, u as OPERATIONS } from "./src-BQIJz8yP.mjs";
|
|
2
|
+
import { a as errorExitCode, i as CliError, n as requestOperation, o as renderCliError, r as requestTokenEnrollment, s as escapeTerminalControls } from "./client-DfvJWQFq.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadEnrollmentConfig, i as fileVerdictCache, l as readConfiguredPort, n as cliPackageVersion, o as configFile, s as loadClientConfig, t as checkCatalog, u as resolveDaemonAddress } from "./config-BDEvO1UV.mjs";
|
|
4
4
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
5
5
|
import { chmodSync, closeSync, constants, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { homedir, hostname, userInfo } from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-
|
|
1
|
+
import { F as errorContextSchema, I as errorEnvelopeSchema, L as successEnvelopeSchema, P as ERRORS, f as renderJsonError } from "./src-BQIJz8yP.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { n as requestOperation, r as requestTokenEnrollment, t as fetchCatalogVersion } from "./client-DfvJWQFq.mjs";
|
|
2
2
|
export { fetchCatalogVersion, requestOperation, requestTokenEnrollment };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as DEFAULT_HTTP_PORT, U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-
|
|
2
|
-
import { i as CliError, t as fetchCatalogVersion } from "./client-
|
|
1
|
+
import { R as DEFAULT_HTTP_PORT, U as configSchema, c as buildCatalogSnapshot, u as OPERATIONS } from "./src-BQIJz8yP.mjs";
|
|
2
|
+
import { i as CliError, t as fetchCatalogVersion } from "./client-DfvJWQFq.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/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as errorCodeOf, C as SESSION_STATUSES, D as ticketFactsSchema, E as sessionFactsSchema, G as SLACK_BOT_SCOPES, H as RESERVED_PROJECT, L as successEnvelopeSchema, M as parseRef$1, N as taskKeySchema, O as actorIdSchema, P as ERRORS, S as SESSION_HEALTH_STATES, T as prRefSchema, U as configSchema, V as DEFAULT_SLACK_COMMAND, W as requiredSecretKeys, _ as interactionRefSchema, a as batchSchema, b as EVENT_KINDS, c as buildCatalogSnapshot, d as renderHttpProblem, g as inboundEventSchema, h as conversationRefSchema, i as AdapterError, j as parseActorId, k as encodeActorId, l as roleCanUseOperation, m as SPACE_IDS, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, u as OPERATIONS, v as messageRefSchema, w as prFactsSchema, x as eventPayloadSchemas, y as userIdSchema, z as DEFAULT_LINK } from "./src-
|
|
1
|
+
import { A as errorCodeOf, C as SESSION_STATUSES, D as ticketFactsSchema, E as sessionFactsSchema, G as SLACK_BOT_SCOPES, H as RESERVED_PROJECT, L as successEnvelopeSchema, M as parseRef$1, N as taskKeySchema, O as actorIdSchema, P as ERRORS, S as SESSION_HEALTH_STATES, T as prRefSchema, U as configSchema, V as DEFAULT_SLACK_COMMAND, W as requiredSecretKeys, _ as interactionRefSchema, a as batchSchema, b as EVENT_KINDS, c as buildCatalogSnapshot, d as renderHttpProblem, g as inboundEventSchema, h as conversationRefSchema, i as AdapterError, j as parseActorId, k as encodeActorId, l as roleCanUseOperation, m as SPACE_IDS, n as BOARD_TICK_MS, o as entityRefSchema, s as sourceCursorSchema, t as assertNever, u as OPERATIONS, v as messageRefSchema, w as prFactsSchema, x as eventPayloadSchemas, y as userIdSchema, z as DEFAULT_LINK } from "./src-BQIJz8yP.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, existsSync, fstatSync, ftruncateSync, mkdirSync, openSync, readFileSync, readdirSync, writeSync } from "node:fs";
|
|
@@ -7590,7 +7590,8 @@ function visibleInline(value) {
|
|
|
7590
7590
|
switch (value.kind) {
|
|
7591
7591
|
case "text":
|
|
7592
7592
|
case "emphasis":
|
|
7593
|
-
case "code":
|
|
7593
|
+
case "code":
|
|
7594
|
+
case "strike": return value.text;
|
|
7594
7595
|
case "link": return `${value.text} (${value.url})`;
|
|
7595
7596
|
case "mention": return `<@${value.user}>`;
|
|
7596
7597
|
}
|
|
@@ -8137,7 +8138,16 @@ const feedLineEditPayload = z.strictObject({
|
|
|
8137
8138
|
itemKey: z.string().min(1),
|
|
8138
8139
|
taskId: id.optional()
|
|
8139
8140
|
});
|
|
8140
|
-
const
|
|
8141
|
+
const feedLinePayload = feedLineEditPayload.extend({ title: z.string().min(1) });
|
|
8142
|
+
/** `text` is the line's summary; a row without `resolved` predates the resolved rendering. */
|
|
8143
|
+
const feedEditPayload = feedLineEditPayload.extend({
|
|
8144
|
+
url: z.url().optional(),
|
|
8145
|
+
resolved: z.strictObject({
|
|
8146
|
+
by: actorIdSchema,
|
|
8147
|
+
at: z.iso.datetime()
|
|
8148
|
+
}).optional()
|
|
8149
|
+
});
|
|
8150
|
+
const feedLineWithLinkPayload = feedLinePayload.extend({
|
|
8141
8151
|
itemId: id.optional(),
|
|
8142
8152
|
url: z.url().optional(),
|
|
8143
8153
|
actions: z.array(z.strictObject({
|
|
@@ -8171,7 +8181,7 @@ const outboxBodySchema = z.discriminatedUnion("kind", [
|
|
|
8171
8181
|
}),
|
|
8172
8182
|
z.strictObject({
|
|
8173
8183
|
kind: z.literal("feed.line.edit"),
|
|
8174
|
-
payload:
|
|
8184
|
+
payload: feedEditPayload
|
|
8175
8185
|
}),
|
|
8176
8186
|
z.strictObject({
|
|
8177
8187
|
kind: z.literal("doorbell"),
|
|
@@ -8271,13 +8281,18 @@ async function enqueueFeedEdit(trx, input) {
|
|
|
8271
8281
|
dedupeKey: `feed.line.edit:${input.itemKey}:${String(input.raise)}`,
|
|
8272
8282
|
payload: {
|
|
8273
8283
|
key: input.key,
|
|
8274
|
-
text:
|
|
8284
|
+
text: input.summary,
|
|
8275
8285
|
persona: {
|
|
8276
8286
|
name: "board",
|
|
8277
8287
|
role: "board"
|
|
8278
8288
|
},
|
|
8279
8289
|
itemKey: input.itemKey,
|
|
8280
|
-
taskId: input.taskId ?? void 0
|
|
8290
|
+
taskId: input.taskId ?? void 0,
|
|
8291
|
+
...input.url === "" ? {} : { url: input.url },
|
|
8292
|
+
resolved: {
|
|
8293
|
+
by: input.by,
|
|
8294
|
+
at: input.at.toISOString()
|
|
8295
|
+
}
|
|
8281
8296
|
},
|
|
8282
8297
|
parent: input.lineId,
|
|
8283
8298
|
at: input.at
|
|
@@ -8513,6 +8528,13 @@ async function enqueueInboundDoorbell(trx, input) {
|
|
|
8513
8528
|
}
|
|
8514
8529
|
//#endregion
|
|
8515
8530
|
//#region ../core/src/app/feed.ts
|
|
8531
|
+
/** The struck summary is capped so the edit stays one message part. */
|
|
8532
|
+
const MAX_SUMMARY = 500;
|
|
8533
|
+
/** Counts code points, so the cut never splits a surrogate pair. */
|
|
8534
|
+
function capSummary(text) {
|
|
8535
|
+
const points = Array.from(text);
|
|
8536
|
+
return points.length <= MAX_SUMMARY ? text : `${points.slice(0, MAX_SUMMARY - 1).join("")}…`;
|
|
8537
|
+
}
|
|
8516
8538
|
/** Raise one item generation. A repeated raise of an active key is idempotent. */
|
|
8517
8539
|
async function raiseItem(trx, input) {
|
|
8518
8540
|
return raiseItemWith(trx, input, enqueueFeedLine);
|
|
@@ -8533,9 +8555,70 @@ async function clearItem(trx, itemId, at, actor = "system") {
|
|
|
8533
8555
|
lineId: item.line_outbox_id,
|
|
8534
8556
|
key: task?.key ?? "spur-board",
|
|
8535
8557
|
taskId: item.task_id,
|
|
8558
|
+
summary: capSummary(item.text),
|
|
8559
|
+
url: item.url,
|
|
8560
|
+
by: actor,
|
|
8536
8561
|
at
|
|
8537
8562
|
});
|
|
8538
8563
|
}
|
|
8564
|
+
function resolvedLine(by, at, config) {
|
|
8565
|
+
const parsed = parseActorId(by);
|
|
8566
|
+
if (parsed === null || parsed.actor === "system") return [{
|
|
8567
|
+
kind: "text",
|
|
8568
|
+
text: "✓ Resolved: condition ended"
|
|
8569
|
+
}];
|
|
8570
|
+
const time = new Intl.DateTimeFormat("en-GB", {
|
|
8571
|
+
timeZone: config.digest.tz,
|
|
8572
|
+
hour: "2-digit",
|
|
8573
|
+
minute: "2-digit",
|
|
8574
|
+
hourCycle: "h23"
|
|
8575
|
+
}).format(new Date(at));
|
|
8576
|
+
return [
|
|
8577
|
+
{
|
|
8578
|
+
kind: "text",
|
|
8579
|
+
text: "✓ Resolved by "
|
|
8580
|
+
},
|
|
8581
|
+
parsed.actor === "agent" ? {
|
|
8582
|
+
kind: "text",
|
|
8583
|
+
text: `${parsed.actorRef.project}/${parsed.actorRef.session}`
|
|
8584
|
+
} : {
|
|
8585
|
+
kind: "mention",
|
|
8586
|
+
user: userIdSchema.parse(config.operator.slack)
|
|
8587
|
+
},
|
|
8588
|
+
{
|
|
8589
|
+
kind: "text",
|
|
8590
|
+
text: ` at ${time}`
|
|
8591
|
+
}
|
|
8592
|
+
];
|
|
8593
|
+
}
|
|
8594
|
+
/** A cleared line: its key line, the struck summary and who resolved it when; no actions. */
|
|
8595
|
+
function resolvedFeedBody(payload, config) {
|
|
8596
|
+
const { key, url, text, resolved } = payload;
|
|
8597
|
+
return [
|
|
8598
|
+
{
|
|
8599
|
+
kind: "paragraph",
|
|
8600
|
+
children: [url === void 0 ? {
|
|
8601
|
+
kind: "text",
|
|
8602
|
+
text: key
|
|
8603
|
+
} : {
|
|
8604
|
+
kind: "link",
|
|
8605
|
+
url,
|
|
8606
|
+
text: key
|
|
8607
|
+
}]
|
|
8608
|
+
},
|
|
8609
|
+
{
|
|
8610
|
+
kind: "quote",
|
|
8611
|
+
children: [{
|
|
8612
|
+
kind: "strike",
|
|
8613
|
+
text
|
|
8614
|
+
}]
|
|
8615
|
+
},
|
|
8616
|
+
{
|
|
8617
|
+
kind: "paragraph",
|
|
8618
|
+
children: resolvedLine(resolved.by, resolved.at, config)
|
|
8619
|
+
}
|
|
8620
|
+
];
|
|
8621
|
+
}
|
|
8539
8622
|
//#endregion
|
|
8540
8623
|
//#region ../core/src/app/tokens.ts
|
|
8541
8624
|
const REQUEST_LIFETIME_MS = 900 * 1e3;
|
|
@@ -8625,7 +8708,7 @@ async function decideTokenInTransaction(trx, itemId, decision, at) {
|
|
|
8625
8708
|
decided_at: at.toISOString()
|
|
8626
8709
|
}).where("id", "=", row.id).execute();
|
|
8627
8710
|
await journalToken(trx, decision === "approve" ? "token_approved" : "token_denied", row.name, at);
|
|
8628
|
-
await clearItem(trx, row.item_id, at);
|
|
8711
|
+
await clearItem(trx, row.item_id, at, "operator");
|
|
8629
8712
|
return {
|
|
8630
8713
|
name: row.name,
|
|
8631
8714
|
status: next
|
|
@@ -8679,7 +8762,7 @@ const tokenRevokeMutation = {
|
|
|
8679
8762
|
decided_at: ctx.at
|
|
8680
8763
|
}).where("id", "=", row.id).execute();
|
|
8681
8764
|
await journalToken(trx, "token_revoked", row.name, at);
|
|
8682
|
-
await clearItem(trx, row.item_id, at);
|
|
8765
|
+
await clearItem(trx, row.item_id, at, ctx.actor);
|
|
8683
8766
|
}
|
|
8684
8767
|
return {
|
|
8685
8768
|
name: row.name,
|
|
@@ -10302,13 +10385,17 @@ function createSender(options) {
|
|
|
10302
10385
|
if (gateway === void 0) throw new Error("gateway is not configured");
|
|
10303
10386
|
const to = target(c);
|
|
10304
10387
|
if (to === null) throw new Error("a dependent row without its parent ref");
|
|
10388
|
+
const { body } = c;
|
|
10305
10389
|
const request = {
|
|
10306
10390
|
key: c.key,
|
|
10307
10391
|
maybeSent: c.maybeSent,
|
|
10308
10392
|
...firstDeliveryAt === null ? {} : { firstAttemptAt: new Date(firstDeliveryAt) },
|
|
10309
10393
|
target: to,
|
|
10310
10394
|
persona: c.body.payload.persona,
|
|
10311
|
-
body:
|
|
10395
|
+
body: body.kind === "feed.line.edit" && body.payload.resolved !== void 0 ? resolvedFeedBody({
|
|
10396
|
+
...body.payload,
|
|
10397
|
+
resolved: body.payload.resolved
|
|
10398
|
+
}, options.config) : c.body.kind === "feed.line" && c.body.payload.url !== void 0 ? [{
|
|
10312
10399
|
kind: "paragraph",
|
|
10313
10400
|
children: [{
|
|
10314
10401
|
kind: "link",
|
|
@@ -11403,6 +11490,7 @@ function evaluateSessionHealth(input) {
|
|
|
11403
11490
|
const previousEpisode = input.episode ?? null;
|
|
11404
11491
|
if (spur.blind) return {
|
|
11405
11492
|
flags: [],
|
|
11493
|
+
held: [],
|
|
11406
11494
|
statuses: [],
|
|
11407
11495
|
hostLoad: null,
|
|
11408
11496
|
episode: previousEpisode
|
|
@@ -11429,6 +11517,7 @@ function evaluateSessionHealth(input) {
|
|
|
11429
11517
|
}
|
|
11430
11518
|
}
|
|
11431
11519
|
const flags = [];
|
|
11520
|
+
const held = [];
|
|
11432
11521
|
const statuses = [];
|
|
11433
11522
|
const seen = /* @__PURE__ */ new Set();
|
|
11434
11523
|
for (const session of sessions) {
|
|
@@ -11437,11 +11526,14 @@ function evaluateSessionHealth(input) {
|
|
|
11437
11526
|
seen.add(identity);
|
|
11438
11527
|
const task = tasks[session.taskId];
|
|
11439
11528
|
if (session.endedAt !== null) {
|
|
11440
|
-
if (session.role === "worker" &&
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11529
|
+
if (session.role === "worker" && (session.endReason === "complete" || session.endReason === "kill" || session.endReason === "vanished") && task !== void 0 && !task.hasOpenPr && !task.hasMergedPr && !liveWorkerTasks.has(session.taskId)) {
|
|
11530
|
+
const flag = {
|
|
11531
|
+
taskId: session.taskId,
|
|
11532
|
+
sessionId: session.id,
|
|
11533
|
+
kind: "worker_vanished"
|
|
11534
|
+
};
|
|
11535
|
+
(spur.observationComplete ? flags : held).push(flag);
|
|
11536
|
+
}
|
|
11445
11537
|
continue;
|
|
11446
11538
|
}
|
|
11447
11539
|
if (session.health === "rate_limited") {
|
|
@@ -11466,6 +11558,7 @@ function evaluateSessionHealth(input) {
|
|
|
11466
11558
|
}
|
|
11467
11559
|
return {
|
|
11468
11560
|
flags,
|
|
11561
|
+
held,
|
|
11469
11562
|
statuses,
|
|
11470
11563
|
hostLoad: episode === null ? null : { kind: "host_under_load" },
|
|
11471
11564
|
episode
|
|
@@ -11620,7 +11713,7 @@ async function reconcileItems(trx, config, now, spurComplete) {
|
|
|
11620
11713
|
if (task === void 0) continue;
|
|
11621
11714
|
const fact = subjects.find((subject) => subject.taskId === flag.taskId && subject.id === flag.sessionId);
|
|
11622
11715
|
candidates.push({
|
|
11623
|
-
key:
|
|
11716
|
+
key: healthKey(task.id, flag),
|
|
11624
11717
|
taskId: task.id,
|
|
11625
11718
|
summary: `${task.key}: ${flag.kind.replaceAll("_", " ")} (${flag.sessionId})`,
|
|
11626
11719
|
factAt: fact?.healthSince ?? null,
|
|
@@ -11631,6 +11724,10 @@ async function reconcileItems(trx, config, now, spurComplete) {
|
|
|
11631
11724
|
}
|
|
11632
11725
|
const ordered = orderItems(candidates);
|
|
11633
11726
|
const seen = new Set(ordered.map((item) => item.key));
|
|
11727
|
+
for (const flag of health.held) {
|
|
11728
|
+
const task = taskById.get(Number(flag.taskId));
|
|
11729
|
+
if (task !== void 0) seen.add(healthKey(task.id, flag));
|
|
11730
|
+
}
|
|
11634
11731
|
const existing = await trx.selectFrom("operator_item").selectAll().where("kind", "=", "board_observation").where("cleared_at", "is", null).execute();
|
|
11635
11732
|
for (const item of existing) if (!seen.has(item.item_key)) await clearItem(trx, item.id, new Date(now));
|
|
11636
11733
|
for (const candidate of ordered) {
|
|
@@ -11663,6 +11760,9 @@ async function reconcileItems(trx, config, now, spurComplete) {
|
|
|
11663
11760
|
});
|
|
11664
11761
|
}
|
|
11665
11762
|
}
|
|
11763
|
+
function healthKey(taskId, flag) {
|
|
11764
|
+
return `health:${String(taskId)}:${flag.sessionId}:${flag.kind}`;
|
|
11765
|
+
}
|
|
11666
11766
|
//#endregion
|
|
11667
11767
|
//#region ../core/src/app/observe.ts
|
|
11668
11768
|
function refKey(ref) {
|
|
@@ -11947,6 +12047,12 @@ async function pr(trx, config, fact, at, source) {
|
|
|
11947
12047
|
await trx.updateTable("task").set({ last_change_at: at }).where("id", "=", task.id).execute();
|
|
11948
12048
|
}
|
|
11949
12049
|
}
|
|
12050
|
+
function branchHasKey(branch, key) {
|
|
12051
|
+
const text = branch.toLowerCase();
|
|
12052
|
+
const needle = key.toLowerCase();
|
|
12053
|
+
for (let index = text.indexOf(needle); index !== -1; index = text.indexOf(needle, index + 1)) if (!/[a-z0-9]/.test(text[index - 1] ?? "") && !/[0-9]/.test(text[index + needle.length] ?? "")) return true;
|
|
12054
|
+
return false;
|
|
12055
|
+
}
|
|
11950
12056
|
async function session(trx, config, fact, at, source, ambiguousBranches) {
|
|
11951
12057
|
const old = await trx.selectFrom("session_snapshot").selectAll().where("id", "=", fact.id).executeTakeFirst();
|
|
11952
12058
|
const previous = old === void 0 ? null : parseJson(sessionFactsSchema, old.detail);
|
|
@@ -11997,7 +12103,7 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
|
|
|
11997
12103
|
const tasks = await trx.selectFrom("task").selectAll().where("membership", "!=", "archived").execute();
|
|
11998
12104
|
const branchPrs = await trx.selectFrom("link").innerJoin("pr_snapshot", (join) => join.on(sql`lower(pr_snapshot.repo) = lower(link.repo)`).onRef("pr_snapshot.number", "=", "link.number")).select(["link.task_id", "pr_snapshot.head_branch"]).where("link.entity", "=", "pr").where("pr_snapshot.head_branch", "=", fact.branch).where("link.banned", "=", 0).execute();
|
|
11999
12105
|
const matches = tasks.filter((task) => {
|
|
12000
|
-
return config.projects.find((entry) => entry.id === task.project)?.spurProjects.some((spur) => spur.name === fact.spurProject && spur.role === "worker") === true && (fact.branch
|
|
12106
|
+
return config.projects.find((entry) => entry.id === task.project)?.spurProjects.some((spur) => spur.name === fact.spurProject && spur.role === "worker") === true && (fact.branch !== null && branchHasKey(fact.branch, task.key) || branchPrs.some((pr) => pr.task_id === task.id));
|
|
12001
12107
|
});
|
|
12002
12108
|
if (matches.length === 1) {
|
|
12003
12109
|
const candidate = matches[0];
|
|
@@ -12798,6 +12904,7 @@ function createInbound(input) {
|
|
|
12798
12904
|
function interactionOperation(event) {
|
|
12799
12905
|
let id;
|
|
12800
12906
|
let operationInput;
|
|
12907
|
+
let item;
|
|
12801
12908
|
if (event.kind === "command") {
|
|
12802
12909
|
const command = event.command;
|
|
12803
12910
|
if (command?.kind === "query") {
|
|
@@ -12814,15 +12921,18 @@ function createInbound(input) {
|
|
|
12814
12921
|
const parts = event.actionId.split(":");
|
|
12815
12922
|
if (parts.length === 2 && /^I[1-9]\d*$/.test(parts[1] ?? "")) {
|
|
12816
12923
|
id = parts[0] === "item.close" || parts[0] === "item.retry" ? parts[0] : void 0;
|
|
12817
|
-
|
|
12924
|
+
item = parts[1];
|
|
12925
|
+
operationInput = { item };
|
|
12818
12926
|
} else if (parts.length === 3 && parts[0] === "item" && /^[1-9]\d*$/.test(parts[1] ?? "")) {
|
|
12819
12927
|
id = parts[2] === "close" ? "item.close" : parts[2] === "retry" ? "item.retry" : void 0;
|
|
12820
|
-
|
|
12928
|
+
item = `I${parts[1] ?? ""}`;
|
|
12929
|
+
operationInput = { item };
|
|
12821
12930
|
}
|
|
12822
12931
|
}
|
|
12823
12932
|
return {
|
|
12824
12933
|
id,
|
|
12825
|
-
operationInput
|
|
12934
|
+
operationInput,
|
|
12935
|
+
...item === void 0 ? {} : { item }
|
|
12826
12936
|
};
|
|
12827
12937
|
}
|
|
12828
12938
|
function tokenAction(event) {
|
|
@@ -12895,7 +13005,7 @@ function createInbound(input) {
|
|
|
12895
13005
|
} catch {}
|
|
12896
13006
|
return;
|
|
12897
13007
|
}
|
|
12898
|
-
const { id, operationInput } = interactionOperation(event);
|
|
13008
|
+
const { id, operationInput, item } = interactionOperation(event);
|
|
12899
13009
|
let response;
|
|
12900
13010
|
let cliHint;
|
|
12901
13011
|
if (event.kind === "command" && event.command?.kind === "usage") response = plain(event.command.text);
|
|
@@ -12911,7 +13021,7 @@ function createInbound(input) {
|
|
|
12911
13021
|
const reply = commandReply(id, value, operationInput);
|
|
12912
13022
|
response = reply.body;
|
|
12913
13023
|
cliHint = reply.cliHint;
|
|
12914
|
-
} else response = plain(
|
|
13024
|
+
} else response = plain(id === "item.close" ? `Closed ${item ?? ""}.` : `Retry started for ${item ?? ""}.`);
|
|
12915
13025
|
} catch (error) {
|
|
12916
13026
|
if (!(error instanceof CommandError)) await recordFailure(event, error, new Date(clock.now()).toISOString());
|
|
12917
13027
|
response = plain(error instanceof CommandError && error.code !== "not_implemented" ? event.kind === "command" ? `${ERRORS[error.code].message} ${ERRORS[error.code].hint}` : error.hint : "not available yet");
|
|
@@ -14243,10 +14353,14 @@ function normalize(issue, trackerId, repo, inFilter) {
|
|
|
14243
14353
|
};
|
|
14244
14354
|
}
|
|
14245
14355
|
function matchesFilter(issue, tracker) {
|
|
14356
|
+
if (tracker.label === void 0 && tracker.milestone === void 0) return true;
|
|
14246
14357
|
if (tracker.label !== void 0) return issue.labels.some((label) => label.name === tracker.label);
|
|
14247
14358
|
return issue.milestone?.title === tracker.milestone;
|
|
14248
14359
|
}
|
|
14249
|
-
/**
|
|
14360
|
+
/**
|
|
14361
|
+
* Lists open filter issues, or every open issue when neither label nor milestone is set, and
|
|
14362
|
+
* resolves requested tickets missing from that listing.
|
|
14363
|
+
*/
|
|
14250
14364
|
function createGithubIssuesAdapter(options) {
|
|
14251
14365
|
const transport = options.fetch ?? fetch;
|
|
14252
14366
|
const [owner, name] = options.tracker.repo.split("/");
|
|
@@ -15632,11 +15746,19 @@ function originKeyFromBlocks(blocks) {
|
|
|
15632
15746
|
function escapeText(value) {
|
|
15633
15747
|
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
15634
15748
|
}
|
|
15749
|
+
/** Slack strikes only within one line and not across edge spaces or a `~` inside. */
|
|
15750
|
+
function strike(text) {
|
|
15751
|
+
return text.split("\n").map((line) => {
|
|
15752
|
+
const value = line.trim().replaceAll("~", "∼");
|
|
15753
|
+
return value.length === 0 ? "" : `~${escapeText(value)}~`;
|
|
15754
|
+
}).join("\n");
|
|
15755
|
+
}
|
|
15635
15756
|
function inline(value) {
|
|
15636
15757
|
switch (value.kind) {
|
|
15637
15758
|
case "text": return escapeText(value.text);
|
|
15638
15759
|
case "emphasis": return `*${escapeText(value.text)}*`;
|
|
15639
15760
|
case "code": return `\`${value.text.replaceAll("`", "´")}\``;
|
|
15761
|
+
case "strike": return strike(value.text);
|
|
15640
15762
|
case "link": return `<${value.url.replace(/[<>|]/g, "")}|${escapeText(value.text).replaceAll("|", "¦")}>`;
|
|
15641
15763
|
case "mention": return `<@${value.user}>`;
|
|
15642
15764
|
}
|
|
@@ -15652,7 +15774,8 @@ function literal(value) {
|
|
|
15652
15774
|
switch (value.kind) {
|
|
15653
15775
|
case "text":
|
|
15654
15776
|
case "emphasis":
|
|
15655
|
-
case "code":
|
|
15777
|
+
case "code":
|
|
15778
|
+
case "strike": return value.text;
|
|
15656
15779
|
case "link": return `${value.text} (${value.url})`;
|
|
15657
15780
|
case "mention": return `<@${value.user}>`;
|
|
15658
15781
|
}
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-
|
|
2
|
-
import { i as CliError, n as requestOperation } from "./client-
|
|
3
|
-
import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-
|
|
1
|
+
import { P as ERRORS, p as renderMcpError, u as OPERATIONS } from "./src-BQIJz8yP.mjs";
|
|
2
|
+
import { i as CliError, n as requestOperation } from "./client-DfvJWQFq.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, r as compareCatalogs, s as loadClientConfig, t as checkCatalog } from "./config-BDEvO1UV.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -194,13 +194,13 @@ function linkPattern(fallback, description) {
|
|
|
194
194
|
const githubIssuesTracker = z.strictObject({
|
|
195
195
|
type: z.literal("github-issues"),
|
|
196
196
|
repo: repoSlugSchema,
|
|
197
|
-
label: nonEmpty.optional(),
|
|
198
|
-
milestone: nonEmpty.optional()
|
|
197
|
+
label: nonEmpty.describe("Only open issues with this label become tasks. Set at most one of label and milestone; with neither, every open issue of tracker.repo becomes a task.").optional(),
|
|
198
|
+
milestone: nonEmpty.describe("Only open issues in the milestone with this title become tasks. Set at most one of label and milestone; with neither, every open issue of tracker.repo becomes a task.").optional()
|
|
199
199
|
}).superRefine((tracker, ctx) => {
|
|
200
|
-
if (tracker.label
|
|
200
|
+
if (tracker.label !== void 0 && tracker.milestone !== void 0) ctx.addIssue({
|
|
201
201
|
code: "custom",
|
|
202
202
|
path: ["label"],
|
|
203
|
-
message: "Set
|
|
203
|
+
message: "Set at most one of label or milestone"
|
|
204
204
|
});
|
|
205
205
|
});
|
|
206
206
|
const spurProject = z.strictObject({
|