spur-board 0.54.0 → 0.54.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-DjHqB_QC.mjs → chunk-C0avjvF7.mjs} +37 -9
- package/dist/{chunk-C7CHbmMl.mjs → chunk-CaWf-PGm.mjs} +2 -2
- package/dist/{chunk-DgTcmpig.mjs → chunk-Dd1yi1dh.mjs} +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +256 -184
- package/dist/mcp.mjs +3 -3
- package/package.json +1 -1
- package/skills/spur-board/SKILL.md +6 -6
- package/skills/spur-board/references/commands.md +2 -2
|
@@ -992,6 +992,11 @@ const blockIdSchema = refSchema("block", "Block ID: B followed by a number, e.g.
|
|
|
992
992
|
const commentIdSchema = refSchema("comment", "Comment ID: C followed by a number, e.g. C3.", NUMBERED_ID_MAX);
|
|
993
993
|
const itemIdSchema = refSchema("item", "Item ID: I followed by a number, e.g. I7.", NUMBERED_ID_MAX);
|
|
994
994
|
const turnIdSchema = refSchema("turn", "Turn ID: T followed by a number, e.g. T4.", NUMBERED_ID_MAX);
|
|
995
|
+
/**
|
|
996
|
+
* The ring ID a doorbell text ends with, `N<notification>-<ring>`, or a bare `N<notification>`.
|
|
997
|
+
* Only `inbox.ack` takes it; it is not a `RefKind`, since `N18-1` is also a valid Jira key.
|
|
998
|
+
*/
|
|
999
|
+
const ringIdSchema = z.string().max(32).regex(new RegExp(`^N${REF_NUMBER}(?:-${REF_NUMBER})?$`)).describe("Ring ID from a doorbell text: N<notification>-<ring>, e.g. N18-1; the ring part is optional.");
|
|
995
1000
|
const TASK_KEY_DESCRIPTION = "Task key: a Jira key (PROJ-123) or a GitHub issue (owner/repo#42, or repo#42).";
|
|
996
1001
|
const taskKeySchema = refSchema("task", TASK_KEY_DESCRIPTION);
|
|
997
1002
|
/** The task key an operation input takes: `taskKeySchema` with a length cap. */
|
|
@@ -2642,9 +2647,9 @@ const OPERATIONS = [
|
|
|
2642
2647
|
defineOperation({
|
|
2643
2648
|
id: "inbox.ack",
|
|
2644
2649
|
kind: "mutation",
|
|
2645
|
-
description: "Mark comments, agent-addressed blocks or
|
|
2650
|
+
description: "Mark comments, agent-addressed blocks, turns or doorbell rings as read; acking a turn makes the caller its taker.",
|
|
2646
2651
|
mcp: {
|
|
2647
|
-
whenToUse: "Mark handled inbox items read.",
|
|
2652
|
+
whenToUse: "Mark handled inbox items or a ring ID like N18-1 read; an item handled before comes back under alreadyHandled.",
|
|
2648
2653
|
whenNotToUse: "Use inbox_get to inspect them first."
|
|
2649
2654
|
},
|
|
2650
2655
|
input: z.strictObject({ entries: z.array(z.union([
|
|
@@ -2653,13 +2658,23 @@ const OPERATIONS = [
|
|
|
2653
2658
|
revision: z.int().positive().describe("Revision the caller read.")
|
|
2654
2659
|
}),
|
|
2655
2660
|
z.strictObject({ id: blockIdSchema }),
|
|
2656
|
-
z.strictObject({ id: turnIdSchema })
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2661
|
+
z.strictObject({ id: turnIdSchema }),
|
|
2662
|
+
z.strictObject({ id: ringIdSchema })
|
|
2663
|
+
])).min(1).max(ACK_ENTRIES_MAX).describe("Comment revisions, blocks, turns and ring IDs to acknowledge.") }),
|
|
2664
|
+
output: z.strictObject({
|
|
2665
|
+
acked: z.array(z.union([
|
|
2666
|
+
commentIdSchema,
|
|
2667
|
+
blockIdSchema,
|
|
2668
|
+
turnIdSchema,
|
|
2669
|
+
ringIdSchema
|
|
2670
|
+
])).describe("Entries now acknowledged."),
|
|
2671
|
+
alreadyHandled: z.array(z.union([
|
|
2672
|
+
commentIdSchema,
|
|
2673
|
+
blockIdSchema,
|
|
2674
|
+
turnIdSchema,
|
|
2675
|
+
ringIdSchema
|
|
2676
|
+
])).optional().describe("Entries that were already handled; nothing new was acknowledged for them.")
|
|
2677
|
+
}),
|
|
2663
2678
|
grants: [{ grant: "project-agent" }],
|
|
2664
2679
|
errors: [
|
|
2665
2680
|
"wrong_id_kind",
|
|
@@ -2689,6 +2704,19 @@ const OPERATIONS = [
|
|
|
2689
2704
|
summary: "Take a turn",
|
|
2690
2705
|
input: { entries: [{ id: "T4" }] },
|
|
2691
2706
|
output: { acked: ["T4"] }
|
|
2707
|
+
},
|
|
2708
|
+
{
|
|
2709
|
+
summary: "Acknowledge a doorbell by the ring ID at the end of its text",
|
|
2710
|
+
input: { entries: [{ id: "N18-1" }] },
|
|
2711
|
+
output: { acked: ["N18-1"] }
|
|
2712
|
+
},
|
|
2713
|
+
{
|
|
2714
|
+
summary: "Acknowledge a block already closed by an answer",
|
|
2715
|
+
input: { entries: [{ id: "B14" }] },
|
|
2716
|
+
output: {
|
|
2717
|
+
acked: ["B14"],
|
|
2718
|
+
alreadyHandled: ["B14"]
|
|
2719
|
+
}
|
|
2692
2720
|
}
|
|
2693
2721
|
]
|
|
2694
2722
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as buildCatalogSnapshot, ct as plainHttpAllowed, st as configSchema, y as OPERATIONS } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { _ as buildCatalogSnapshot, ct as plainHttpAllowed, st as configSchema, y as OPERATIONS } from "./chunk-C0avjvF7.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-Dd1yi1dh.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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errorEnvelopeSchema, Q as errorContextSchema, S as renderJsonError, X as ERRORS, c as tokenRequestStatusSchema, o as tokenRequestResultSchema, tt as successEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { $ as errorEnvelopeSchema, Q as errorContextSchema, S as renderJsonError, X as ERRORS, c as tokenRequestStatusSchema, o as tokenRequestResultSchema, tt as successEnvelopeSchema } from "./chunk-C0avjvF7.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as actorIdSchema, X as ERRORS, a as requestHashOf, ft as SLACK_BOT_SCOPES, lt as requiredSecretKeys, r as remoteDoctorReportSchema, st as configSchema, tt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-
|
|
1
|
+
import { W as actorIdSchema, X as ERRORS, a as requestHashOf, ft as SLACK_BOT_SCOPES, lt as requiredSecretKeys, r as remoteDoctorReportSchema, st as configSchema, tt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-C0avjvF7.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
|
|
3
|
-
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-
|
|
4
|
-
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-
|
|
3
|
+
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-Dd1yi1dh.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-CaWf-PGm.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, userInfo } from "node:os";
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-Dd1yi1dh.mjs";
|
|
2
2
|
export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as EVENT_KINDS, B as sessionFactsSchema, D as interactionRefSchema, E as inboundEventSchema, F as isExternalAuthor, G as encodeActorId, H as JIRA_PROJECT_KEY, I as parseRingMarker, J as parseRef$1, K as errorCodeOf, L as prFactsSchema, M as REVIEW_STATES, N as SESSION_HEALTH_STATES, O as messageRefSchema, P as SESSION_STATUSES, R as prRefSchema, T as conversationRefSchema, U as REF_NUMBER, V as ticketFactsSchema, W as actorIdSchema, X as ERRORS, Y as taskKeySchema, Z as err, _ as buildCatalogSnapshot, a as requestHashOf, at as DEFAULT_SLACK_COMMAND, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as plainHttpAllowed, d as AdapterError, dt as DISPATCHER_MODES, et as ok, f as batchSchema, ft as SLACK_BOT_SCOPES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as requiredSecretKeys, m as prSourceId, n as doctorReportSchema, o as tokenRequestResultSchema, ot as RESERVED_PROJECT, p as entityRefSchema, q as parseActorId, rt as DEFAULT_LINK, s as tokenRequestSchema, st as configSchema, t as assertNever, tt as successEnvelopeSchema, ut as COLUMN_IDS, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as ringMarker } from "./chunk-
|
|
1
|
+
import { A as EVENT_KINDS, B as sessionFactsSchema, D as interactionRefSchema, E as inboundEventSchema, F as isExternalAuthor, G as encodeActorId, H as JIRA_PROJECT_KEY, I as parseRingMarker, J as parseRef$1, K as errorCodeOf, L as prFactsSchema, M as REVIEW_STATES, N as SESSION_HEALTH_STATES, O as messageRefSchema, P as SESSION_STATUSES, R as prRefSchema, T as conversationRefSchema, U as REF_NUMBER, V as ticketFactsSchema, W as actorIdSchema, X as ERRORS, Y as taskKeySchema, Z as err, _ as buildCatalogSnapshot, a as requestHashOf, at as DEFAULT_SLACK_COMMAND, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as plainHttpAllowed, d as AdapterError, dt as DISPATCHER_MODES, et as ok, f as batchSchema, ft as SLACK_BOT_SCOPES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as requiredSecretKeys, m as prSourceId, n as doctorReportSchema, o as tokenRequestResultSchema, ot as RESERVED_PROJECT, p as entityRefSchema, q as parseActorId, rt as DEFAULT_LINK, s as tokenRequestSchema, st as configSchema, t as assertNever, tt as successEnvelopeSchema, ut as COLUMN_IDS, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as ringMarker } from "./chunk-C0avjvF7.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -11186,6 +11186,10 @@ async function blockById(trx, id) {
|
|
|
11186
11186
|
async function commentById(trx, id) {
|
|
11187
11187
|
return trx.selectFrom("comment").selectAll().where("id", "=", idNumber(id)).executeTakeFirst();
|
|
11188
11188
|
}
|
|
11189
|
+
/** The notification a ring ID `N<notification>[-<ring>]` names; the ring part is ignored. */
|
|
11190
|
+
async function notificationByRingId(trx, id) {
|
|
11191
|
+
return trx.selectFrom("notification").selectAll().where("id", "=", Number.parseInt(id.slice(1), 10)).executeTakeFirst();
|
|
11192
|
+
}
|
|
11189
11193
|
function found(value) {
|
|
11190
11194
|
if (value === void 0) throw new CommandError("not_found", "Check the target ID.");
|
|
11191
11195
|
return value;
|
|
@@ -11574,166 +11578,253 @@ async function queueCuratorAnswerLine(trx, task, block, answer, note, ctx, confi
|
|
|
11574
11578
|
}
|
|
11575
11579
|
/** Concrete block and comment mutations for the generic apply boundary. */
|
|
11576
11580
|
function createBlockMutations(config) {
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
11587
|
-
|
|
11588
|
-
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
value
|
|
11615
|
-
|
|
11616
|
-
block
|
|
11617
|
-
|
|
11618
|
-
addressee_role
|
|
11619
|
-
}
|
|
11581
|
+
const ask = {
|
|
11582
|
+
id: "block.ask",
|
|
11583
|
+
resolveTargets: (trx, input) => taskTarget(trx, input.task),
|
|
11584
|
+
async run(trx, input, ctx) {
|
|
11585
|
+
const task = found(await taskByKey$1(trx, input.task));
|
|
11586
|
+
active(task);
|
|
11587
|
+
const block = await openBlock(trx, task, "needs_input", input.text, ctx, config);
|
|
11588
|
+
await addComment(trx, task, block, input.text, ctx, block.addressee_role, config);
|
|
11589
|
+
await queueBlockOpen(trx, task, block, ctx, config);
|
|
11590
|
+
return { block: blockView(block, task) };
|
|
11591
|
+
}
|
|
11592
|
+
};
|
|
11593
|
+
const create = {
|
|
11594
|
+
id: "block.create",
|
|
11595
|
+
resolveTargets: (trx, input) => taskTarget(trx, input.task),
|
|
11596
|
+
async run(trx, input, ctx) {
|
|
11597
|
+
const task = found(await taskByKey$1(trx, input.task));
|
|
11598
|
+
active(task);
|
|
11599
|
+
const block = await openBlock(trx, task, input.type, input.reason, ctx, config);
|
|
11600
|
+
await queueBlockOpen(trx, task, block, ctx, config);
|
|
11601
|
+
return { block: blockView(block, task) };
|
|
11602
|
+
}
|
|
11603
|
+
};
|
|
11604
|
+
const escalate = {
|
|
11605
|
+
id: "block.escalate",
|
|
11606
|
+
async resolveTargets(trx, input, actor) {
|
|
11607
|
+
const block = await blockById(trx, input.block);
|
|
11608
|
+
if (block === void 0) return blockTarget(trx, input.block);
|
|
11609
|
+
const task = await taskById$1(trx, block.task_id);
|
|
11610
|
+
const target = await authorizationTarget(trx, task, block);
|
|
11611
|
+
if (target.kind !== "found" || target.value.block === null) return [target];
|
|
11612
|
+
if (holdsBlock(config, actor, target)) return [target];
|
|
11613
|
+
const priors = priorAddressees(await routeBlock(trx, task, block, config), block.addressee_role, block.type, curatorProject(config, task.project) !== null);
|
|
11614
|
+
for (const addressee_role of priors) {
|
|
11615
|
+
const prior = {
|
|
11616
|
+
kind: "found",
|
|
11617
|
+
value: {
|
|
11618
|
+
...target.value,
|
|
11619
|
+
block: {
|
|
11620
|
+
...target.value.block,
|
|
11621
|
+
addressee_role
|
|
11620
11622
|
}
|
|
11621
|
-
}
|
|
11622
|
-
if (holdsBlock(config, actor, prior)) return [prior];
|
|
11623
|
-
}
|
|
11624
|
-
return [target];
|
|
11625
|
-
},
|
|
11626
|
-
async run(trx, input, ctx) {
|
|
11627
|
-
const block = found(await blockById(trx, input.block));
|
|
11628
|
-
const task = await taskById$1(trx, block.task_id);
|
|
11629
|
-
active(task);
|
|
11630
|
-
const hasCurator = curatorProject(config, task.project) !== null;
|
|
11631
|
-
const next = rule(() => escalateBlock(current$1(block), hasCurator));
|
|
11632
|
-
const unchanged = async () => {
|
|
11633
|
-
if (input.note !== void 0) await addComment(trx, task, block, input.note, ctx, block.addressee_role, config, { ringsAuthor: false });
|
|
11634
|
-
return { block: blockView(block, task) };
|
|
11635
|
-
};
|
|
11636
|
-
if (!next.changed) return unchanged();
|
|
11637
|
-
const target = await authorizationTarget(trx, task, block);
|
|
11638
|
-
if (!holdsBlock(config, ctx.actor, target)) return unchanged();
|
|
11639
|
-
const updated = await moveBlockToAddressee(trx, {
|
|
11640
|
-
task,
|
|
11641
|
-
block,
|
|
11642
|
-
to: next.addressee,
|
|
11643
|
-
ctx,
|
|
11644
|
-
config
|
|
11645
|
-
});
|
|
11646
|
-
if (input.note !== void 0) await addComment(trx, task, updated, input.note, ctx, next.addressee, config, { ringsAuthor: false });
|
|
11647
|
-
return { block: blockView(updated, task) };
|
|
11648
|
-
}
|
|
11649
|
-
},
|
|
11650
|
-
answer: {
|
|
11651
|
-
id: "block.answer",
|
|
11652
|
-
resolveTargets: (trx, input) => blockTarget(trx, input.block),
|
|
11653
|
-
async run(trx, input, ctx) {
|
|
11654
|
-
const block = found(await blockById(trx, input.block));
|
|
11655
|
-
const task = await taskById$1(trx, block.task_id);
|
|
11656
|
-
active(task);
|
|
11657
|
-
rule(() => {
|
|
11658
|
-
answerBlock(current$1(block));
|
|
11659
|
-
});
|
|
11660
|
-
const role = authorRole(config, task, block.author);
|
|
11661
|
-
const comment = await addComment(trx, task, block, input.text, ctx, role, config);
|
|
11662
|
-
if (input.note !== void 0) await addComment(trx, task, block, input.note, ctx, role, config, { ringsAuthor: false });
|
|
11663
|
-
const updated = await closeOpenBlock(trx, task, block, ctx, "done", null, comment);
|
|
11664
|
-
await queueCuratorAnswerLine(trx, task, block, comment, input.note, ctx, config);
|
|
11665
|
-
return {
|
|
11666
|
-
block: blockView(updated, task),
|
|
11667
|
-
comment: commentView(comment, task)
|
|
11623
|
+
}
|
|
11668
11624
|
};
|
|
11625
|
+
if (holdsBlock(config, actor, prior)) return [prior];
|
|
11669
11626
|
}
|
|
11627
|
+
return [target];
|
|
11670
11628
|
},
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11629
|
+
async run(trx, input, ctx) {
|
|
11630
|
+
const block = found(await blockById(trx, input.block));
|
|
11631
|
+
const task = await taskById$1(trx, block.task_id);
|
|
11632
|
+
active(task);
|
|
11633
|
+
const hasCurator = curatorProject(config, task.project) !== null;
|
|
11634
|
+
const next = rule(() => escalateBlock(current$1(block), hasCurator));
|
|
11635
|
+
const unchanged = async () => {
|
|
11636
|
+
if (input.note !== void 0) await addComment(trx, task, block, input.note, ctx, block.addressee_role, config, { ringsAuthor: false });
|
|
11637
|
+
return { block: blockView(block, task) };
|
|
11638
|
+
};
|
|
11639
|
+
if (!next.changed) return unchanged();
|
|
11640
|
+
const target = await authorizationTarget(trx, task, block);
|
|
11641
|
+
if (!holdsBlock(config, ctx.actor, target)) return unchanged();
|
|
11642
|
+
const updated = await moveBlockToAddressee(trx, {
|
|
11643
|
+
task,
|
|
11644
|
+
block,
|
|
11645
|
+
to: next.addressee,
|
|
11646
|
+
ctx,
|
|
11647
|
+
config
|
|
11648
|
+
});
|
|
11649
|
+
if (input.note !== void 0) await addComment(trx, task, updated, input.note, ctx, next.addressee, config, { ringsAuthor: false });
|
|
11650
|
+
return { block: blockView(updated, task) };
|
|
11651
|
+
}
|
|
11652
|
+
};
|
|
11653
|
+
const answer = {
|
|
11654
|
+
id: "block.answer",
|
|
11655
|
+
resolveTargets: (trx, input) => blockTarget(trx, input.block),
|
|
11656
|
+
async run(trx, input, ctx) {
|
|
11657
|
+
const block = found(await blockById(trx, input.block));
|
|
11658
|
+
const task = await taskById$1(trx, block.task_id);
|
|
11659
|
+
active(task);
|
|
11660
|
+
rule(() => {
|
|
11661
|
+
answerBlock(current$1(block));
|
|
11662
|
+
});
|
|
11663
|
+
const role = authorRole(config, task, block.author);
|
|
11664
|
+
const comment = await addComment(trx, task, block, input.text, ctx, role, config);
|
|
11665
|
+
if (input.note !== void 0) await addComment(trx, task, block, input.note, ctx, role, config, { ringsAuthor: false });
|
|
11666
|
+
const updated = await closeOpenBlock(trx, task, block, ctx, "done", null, comment);
|
|
11667
|
+
await queueCuratorAnswerLine(trx, task, block, comment, input.note, ctx, config);
|
|
11668
|
+
return {
|
|
11669
|
+
block: blockView(updated, task),
|
|
11670
|
+
comment: commentView(comment, task)
|
|
11671
|
+
};
|
|
11672
|
+
}
|
|
11673
|
+
};
|
|
11674
|
+
const unblock = {
|
|
11675
|
+
id: "block.unblock",
|
|
11676
|
+
resolveTargets: (trx, input) => blockTarget(trx, input.block),
|
|
11677
|
+
async run(trx, input, ctx) {
|
|
11678
|
+
const block = found(await blockById(trx, input.block));
|
|
11679
|
+
const task = await taskById$1(trx, block.task_id);
|
|
11680
|
+
active(task);
|
|
11681
|
+
const target = await authorizationTarget(trx, task, block);
|
|
11682
|
+
const decision = rule(() => input.mode === "done" ? closeBlock(current$1(block), {
|
|
11683
|
+
mode: "done",
|
|
11684
|
+
...input.ref === void 0 ? {} : { ref: input.ref }
|
|
11685
|
+
}) : input.mode === "reason" ? closeBlock(current$1(block), {
|
|
11686
|
+
mode: "reason",
|
|
11687
|
+
reason: input.reason
|
|
11688
|
+
}) : closeBlock(current$1(block), {
|
|
11689
|
+
mode: "withdraw",
|
|
11690
|
+
isAuthor: wroteBlock(config, ctx.actor, target),
|
|
11691
|
+
reason: input.answer
|
|
11692
|
+
}));
|
|
11693
|
+
if (input.mode === "withdraw") await addComment(trx, task, block, input.answer, ctx, block.addressee_role, config, { ringsAuthor: false });
|
|
11694
|
+
const updated = await closeOpenBlock(trx, task, block, ctx, decision.outcome, decision.outcomeReason);
|
|
11695
|
+
await applyDoorbellPolicy(trx, input.mode === "done" || holdsBlock(config, ctx.actor, target) ? { kind: "block_closed_by_addressee" } : {
|
|
11696
|
+
kind: "block_removed",
|
|
11697
|
+
block: updated
|
|
11698
|
+
}, new Date(ctx.at));
|
|
11699
|
+
return { block: blockView(updated, task) };
|
|
11700
|
+
}
|
|
11701
|
+
};
|
|
11702
|
+
const add = {
|
|
11703
|
+
id: "comment.add",
|
|
11704
|
+
resolveTargets: (trx, input) => taskTarget(trx, input.task),
|
|
11705
|
+
async run(trx, input, ctx) {
|
|
11706
|
+
const task = found(await taskByKey$1(trx, input.task));
|
|
11707
|
+
active(task);
|
|
11708
|
+
const block = input.block === void 0 ? void 0 : found(await blockById(trx, input.block));
|
|
11709
|
+
if (block !== void 0 && block.task_id !== task.id) throw new CommandError("not_found", "Block does not belong to this task.");
|
|
11710
|
+
let addressee = "worker";
|
|
11711
|
+
if (block !== void 0) if (ctx.actor !== block.author) addressee = authorRole(config, task, block.author);
|
|
11712
|
+
else if (block.outcome === "done" && block.unblocked_by !== null && block.unblocked_by !== block.author) addressee = authorRole(config, task, block.unblocked_by);
|
|
11713
|
+
else addressee = block.addressee_role;
|
|
11714
|
+
return { comment: commentView(await addComment(trx, task, block, input.text, ctx, addressee, config), task) };
|
|
11715
|
+
}
|
|
11716
|
+
};
|
|
11717
|
+
const edit = {
|
|
11718
|
+
id: "comment.edit",
|
|
11719
|
+
async resolveTargets(trx, input) {
|
|
11720
|
+
return [await commentTarget(trx, input.comment)];
|
|
11730
11721
|
},
|
|
11722
|
+
async run(trx, input, ctx) {
|
|
11723
|
+
const comment = found(await commentById(trx, input.comment));
|
|
11724
|
+
if (comment.author !== ctx.actor) throw new CommandError("forbidden", "Only the comment author can edit it.");
|
|
11725
|
+
return { comment: commentView(await editInboundComment(trx, {
|
|
11726
|
+
comment,
|
|
11727
|
+
text: input.text,
|
|
11728
|
+
at: ctx.at,
|
|
11729
|
+
actor: ctx.actor,
|
|
11730
|
+
config
|
|
11731
|
+
}), await taskById$1(trx, comment.task_id)) };
|
|
11732
|
+
}
|
|
11733
|
+
};
|
|
11734
|
+
/** Marks a comment read at `revision` and acks its unread answer notifications. */
|
|
11735
|
+
async function ackComment(trx, comment, revision, ctx) {
|
|
11736
|
+
const task = await taskById$1(trx, comment.task_id);
|
|
11737
|
+
await acknowledgeNotification(trx, {
|
|
11738
|
+
commentId: comment.id,
|
|
11739
|
+
revision,
|
|
11740
|
+
actor: ctx.actor,
|
|
11741
|
+
at: new Date(ctx.at),
|
|
11742
|
+
config
|
|
11743
|
+
});
|
|
11744
|
+
await trx.updateTable("comment").set({ acked_revision: revision }).where("id", "=", comment.id).execute();
|
|
11745
|
+
await journal$1(trx, task, ctx, "comment_acked", {
|
|
11746
|
+
comment: commentId(comment.id),
|
|
11747
|
+
revision
|
|
11748
|
+
});
|
|
11749
|
+
}
|
|
11750
|
+
/** Acks the caller's unread answers of an asked block, then its unread block notification. */
|
|
11751
|
+
async function ackBlock(trx, id, ctx) {
|
|
11752
|
+
const rows = await trx.selectFrom("notification").selectAll().where("block_id", "=", id).where("kind", "in", ["block", "answer"]).orderBy("id", "desc").execute();
|
|
11753
|
+
const addressed = /* @__PURE__ */ new Set();
|
|
11754
|
+
for (const row of rows) if (await notificationAddressedTo(trx, row, ctx.actor, config)) addressed.add(row.id);
|
|
11755
|
+
const answered = /* @__PURE__ */ new Set();
|
|
11756
|
+
for (const row of rows) if (row.kind === "answer" && row.acked_at === null && row.comment_id !== null && addressed.has(row.id)) answered.add(row.comment_id);
|
|
11757
|
+
for (const answer of answered) {
|
|
11758
|
+
const comment = found(await commentById(trx, commentId(answer)));
|
|
11759
|
+
await ackComment(trx, comment, comment.revision, ctx);
|
|
11760
|
+
}
|
|
11761
|
+
const unread = rows.find((row) => row.kind === "block" && row.acked_at === null);
|
|
11762
|
+
const readsBlock = unread !== void 0 && addressed.has(unread.id);
|
|
11763
|
+
if (readsBlock) await acknowledgeNotification(trx, {
|
|
11764
|
+
blockId: id,
|
|
11765
|
+
actor: ctx.actor,
|
|
11766
|
+
at: new Date(ctx.at),
|
|
11767
|
+
config
|
|
11768
|
+
});
|
|
11769
|
+
if (answered.size > 0 || readsBlock) return "acked";
|
|
11770
|
+
if (addressed.size > 0) return "handled";
|
|
11771
|
+
if (unread !== void 0) throw new CommandError("forbidden", "Only the addressed task role can acknowledge.");
|
|
11772
|
+
throw new CommandError("not_found", "No unread block notification.");
|
|
11773
|
+
}
|
|
11774
|
+
/** Takes a turn; a turn the caller took or was rung for before it closed is already handled. */
|
|
11775
|
+
async function ackTurn(trx, id, ctx) {
|
|
11776
|
+
if (await takeTurn(trx, {
|
|
11777
|
+
turnId: id,
|
|
11778
|
+
actor: ctx.actor,
|
|
11779
|
+
at: new Date(ctx.at),
|
|
11780
|
+
config
|
|
11781
|
+
})) return "acked";
|
|
11782
|
+
const turn = await trx.selectFrom("turn").selectAll().where("id", "=", id).executeTakeFirst();
|
|
11783
|
+
if (turn?.acked_by === ctx.actor) return "handled";
|
|
11784
|
+
if (turn !== void 0 && turn.closed_at !== null) {
|
|
11785
|
+
const notice = await trx.selectFrom("notification").selectAll().where("turn_id", "=", id).where("kind", "=", "turn").orderBy("id", "desc").executeTakeFirst();
|
|
11786
|
+
if (notice !== void 0 && await notificationAddressedTo(trx, notice, ctx.actor, config)) return "handled";
|
|
11787
|
+
}
|
|
11788
|
+
throw new CommandError("not_found", "No open turn to take for this ID.");
|
|
11789
|
+
}
|
|
11790
|
+
/** Acks the item a ring `N<notification>[-<ring>]` was sent for. */
|
|
11791
|
+
async function ackRing(trx, id, ctx) {
|
|
11792
|
+
const notice = found(await notificationByRingId(trx, id));
|
|
11793
|
+
if (notice.kind === "block" && notice.block_id !== null) return ackBlock(trx, notice.block_id, ctx);
|
|
11794
|
+
if (notice.kind === "turn" && notice.turn_id !== null) return ackTurn(trx, notice.turn_id, ctx);
|
|
11795
|
+
if (!await notificationAddressedTo(trx, notice, ctx.actor, config)) throw new CommandError("forbidden", "Only the addressed task role can acknowledge.");
|
|
11796
|
+
if (notice.kind === "answer" && notice.acked_at === null && notice.comment_id !== null) {
|
|
11797
|
+
const comment = found(await commentById(trx, commentId(notice.comment_id)));
|
|
11798
|
+
await ackComment(trx, comment, comment.revision, ctx);
|
|
11799
|
+
return "acked";
|
|
11800
|
+
}
|
|
11801
|
+
return "handled";
|
|
11802
|
+
}
|
|
11803
|
+
return {
|
|
11804
|
+
ask,
|
|
11805
|
+
create,
|
|
11806
|
+
escalate,
|
|
11807
|
+
answer,
|
|
11808
|
+
unblock,
|
|
11809
|
+
add,
|
|
11810
|
+
edit,
|
|
11731
11811
|
ack: {
|
|
11732
11812
|
id: "inbox.ack",
|
|
11733
11813
|
async resolveTargets(trx, input) {
|
|
11734
11814
|
return Promise.all(input.entries.map(async ({ id }) => {
|
|
11735
11815
|
if (id.startsWith("C")) return commentTarget(trx, id);
|
|
11736
11816
|
if (id.startsWith("T")) return turnTarget(trx, id);
|
|
11817
|
+
if (id.startsWith("N")) {
|
|
11818
|
+
const notice = await notificationByRingId(trx, id);
|
|
11819
|
+
if (notice === void 0) return {
|
|
11820
|
+
kind: "missing",
|
|
11821
|
+
id
|
|
11822
|
+
};
|
|
11823
|
+
return {
|
|
11824
|
+
...await authorizationTarget(trx, await taskById$1(trx, notice.task_id)),
|
|
11825
|
+
id
|
|
11826
|
+
};
|
|
11827
|
+
}
|
|
11737
11828
|
const target = (await blockTarget(trx, id))[0];
|
|
11738
11829
|
return target === void 0 ? {
|
|
11739
11830
|
kind: "missing",
|
|
@@ -11745,42 +11836,23 @@ function createBlockMutations(config) {
|
|
|
11745
11836
|
}));
|
|
11746
11837
|
},
|
|
11747
11838
|
async run(trx, input, ctx) {
|
|
11839
|
+
const alreadyHandled = [];
|
|
11748
11840
|
for (const entry of input.entries) {
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
if (!("revision" in entry)) {
|
|
11759
|
-
if (!await acknowledgeNotification(trx, {
|
|
11760
|
-
blockId: found(await blockById(trx, entry.id)).id,
|
|
11761
|
-
actor: ctx.actor,
|
|
11762
|
-
at: new Date(ctx.at),
|
|
11763
|
-
config
|
|
11764
|
-
})) throw new CommandError("not_found", "No unread block notification.");
|
|
11765
|
-
continue;
|
|
11766
|
-
}
|
|
11767
|
-
const comment = found(await commentById(trx, entry.id));
|
|
11768
|
-
const task = await taskById$1(trx, comment.task_id);
|
|
11769
|
-
const revision = rule(() => acknowledgeComment(comment.revision, entry.revision));
|
|
11770
|
-
await acknowledgeNotification(trx, {
|
|
11771
|
-
commentId: comment.id,
|
|
11772
|
-
revision,
|
|
11773
|
-
actor: ctx.actor,
|
|
11774
|
-
at: new Date(ctx.at),
|
|
11775
|
-
config
|
|
11776
|
-
});
|
|
11777
|
-
await trx.updateTable("comment").set({ acked_revision: revision }).where("id", "=", comment.id).execute();
|
|
11778
|
-
await journal$1(trx, task, ctx, "comment_acked", {
|
|
11779
|
-
comment: entry.id,
|
|
11780
|
-
revision
|
|
11781
|
-
});
|
|
11841
|
+
let result;
|
|
11842
|
+
if ("revision" in entry) {
|
|
11843
|
+
const comment = found(await commentById(trx, entry.id));
|
|
11844
|
+
await ackComment(trx, comment, rule(() => acknowledgeComment(comment.revision, entry.revision)), ctx);
|
|
11845
|
+
result = "acked";
|
|
11846
|
+
} else if (entry.id.startsWith("T")) result = await ackTurn(trx, idNumber(entry.id), ctx);
|
|
11847
|
+
else if (entry.id.startsWith("N")) result = await ackRing(trx, entry.id, ctx);
|
|
11848
|
+
else result = await ackBlock(trx, found(await blockById(trx, entry.id)).id, ctx);
|
|
11849
|
+
if (result === "handled") alreadyHandled.push(entry.id);
|
|
11782
11850
|
}
|
|
11783
|
-
|
|
11851
|
+
const acked = input.entries.map(({ id }) => id);
|
|
11852
|
+
return alreadyHandled.length > 0 ? {
|
|
11853
|
+
acked,
|
|
11854
|
+
alreadyHandled
|
|
11855
|
+
} : { acked };
|
|
11784
11856
|
}
|
|
11785
11857
|
}
|
|
11786
11858
|
};
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as renderMcpError, X as ERRORS, y as OPERATIONS } 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 { C as renderMcpError, X as ERRORS, y as OPERATIONS } from "./chunk-C0avjvF7.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-Dd1yi1dh.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-CaWf-PGm.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
package/package.json
CHANGED
|
@@ -30,8 +30,8 @@ On `turn_closed`, act only on a turn `board inbox` lists. Shadow mode opens no t
|
|
|
30
30
|
Re-request review only from reviewers whose threads this push closed.
|
|
31
31
|
- Column orchestrator: ack, then keyed `board submit <turn> <sha>` for the reviewed head, or
|
|
32
32
|
`board return <turn> <reason>` to send it to Dev with what to change. Never push.
|
|
33
|
-
- Operator's turn: one inbox "from you" item and one Slack thread,
|
|
34
|
-
|
|
33
|
+
- Operator's turn: one inbox "from you" item and one Slack thread, without repeats; it closes
|
|
34
|
+
when the task leaves the column.
|
|
35
35
|
|
|
36
36
|
## Worker flow
|
|
37
37
|
|
|
@@ -41,19 +41,19 @@ On `turn_closed`, act only on a turn `board inbox` lists. Shadow mode opens no t
|
|
|
41
41
|
- Blocking question: keyed `board ask <task> <text>`; keep its B<number> and wait for the
|
|
42
42
|
doorbell. Nonblocking update: keyed `board comment <task> <text>`.
|
|
43
43
|
- On a doorbell, read `board inbox` and the addressed C<number>@<revision> comment or B<number>
|
|
44
|
-
block
|
|
45
|
-
`board inbox ack <entries>`.
|
|
44
|
+
block. Once handled, ack that revision, ID or the ring's N<number>-<ring> with keyed
|
|
45
|
+
`board inbox ack <entries>`. Keyed `board answer` handles its block; no ack follows.
|
|
46
46
|
- For a "back" code block to you, read `board task <task>` for the reason, fix it,
|
|
47
47
|
then keyed `board unblock <block> --done <ref>` with a commit or PR link.
|
|
48
48
|
- Exit 3: not applied. Ask in your own session; when the Board returns, retry identically.
|
|
49
|
-
- Exit 4: no Board configuration. Say so in your own session; keep the key
|
|
49
|
+
- Exit 4: no Board configuration. Say so in your own session; keep the key.
|
|
50
50
|
- Exit 5 (unknown): retry up to 3 times in about a minute, then ask in your own session.
|
|
51
51
|
Reads take no `--key`. For a mutation, check the outcome; if unclear, repeat it identically.
|
|
52
52
|
- An answer received in your own session: add one keyed provenance-only task-level comment,
|
|
53
53
|
then keyed `board unblock <block> --withdraw <answer>`; it records the answer and
|
|
54
54
|
replies. Add no other answer comment or reply.
|
|
55
55
|
- Only the asking session may `--withdraw`. A replacement session posts provenance in a
|
|
56
|
-
keyed `board comment` and leaves the block open
|
|
56
|
+
keyed `board comment` and leaves the block open.
|
|
57
57
|
|
|
58
58
|
## Board commands
|
|
59
59
|
|
|
@@ -55,10 +55,10 @@ Other errors: `not_found`.
|
|
|
55
55
|
|
|
56
56
|
### `board inbox ack`
|
|
57
57
|
|
|
58
|
-
Purpose: Mark comments, agent-addressed blocks or
|
|
58
|
+
Purpose: Mark comments, agent-addressed blocks, turns or doorbell rings as read; acking a turn makes the caller its taker.
|
|
59
59
|
Arguments: `<entries>`.
|
|
60
60
|
Flags: `--key <key>`, `--json`.
|
|
61
|
-
Use when: Mark handled inbox items read.
|
|
61
|
+
Use when: Mark handled inbox items or a ring ID like N18-1 read; an item handled before comes back under alreadyHandled.
|
|
62
62
|
Avoid when: Use `board inbox` to inspect them first.
|
|
63
63
|
Example: `board inbox ack C3@1 --key inbox-ack-PROJ-123-comment-revision-1432` — Acknowledge a comment revision.
|
|
64
64
|
Other errors: `wrong_id_kind`, `not_found`, `stale_comment_revision`, `idempotency_key_mismatch`.
|