spur-board 0.160.1 → 0.161.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/README.md +7 -6
- package/dist/{chunk-DrCDq9Bd.mjs → chunk-BFzKesDt.mjs} +1 -1
- package/dist/{chunk-C4g6_v8X.mjs → chunk-Bc7i_dwR.mjs} +19 -3
- package/dist/{chunk-De2rPW0w.mjs → chunk-ChF7zDxN.mjs} +2 -2
- package/dist/cli.mjs +14 -6
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +67 -17
- package/dist/mcp.mjs +3 -3
- package/dist/web/assets/index-Boc251Mh.js +64 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/skills/setup/SKILL.md +3 -3
- package/skills/setup/references/access.md +1 -1
- package/skills/spur-board/references/how-board-works-web.md +2 -2
- package/skills/spur-board/references/web-ui-status.md +6 -4
- package/dist/web/assets/index-jL_feovj.js +0 -64
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A kanban board for agent-driven development on top of [Spur](https://github.com/ashugaev/spur):
|
|
4
4
|
a local daemon that tracks tasks across GitHub, Jira and agent sessions, a `board` CLI and MCP
|
|
5
|
-
server for agents, and Slack for the human operator.
|
|
5
|
+
server for agents, and optionally Slack for the human operator.
|
|
6
6
|
|
|
7
7
|
**Status:** early development. Work is tracked in
|
|
8
8
|
[GitHub Issues](https://github.com/AnDeVerin/spur-board/issues).
|
|
@@ -12,11 +12,12 @@ server for agents, and Slack for the human operator.
|
|
|
12
12
|
Ask your agent to check whether `spur-board-setup` is already installed. If it is missing, the
|
|
13
13
|
agent asks your approval to write its skill folders before running
|
|
14
14
|
`npx -y spur-board@latest skills install`. It then reads the installed `spur-board-setup` skill
|
|
15
|
-
and follows it through a green `board doctor
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
and follows it through a green `board doctor`. With Slack, it then waits for the live
|
|
16
|
+
announcement in the feed; without Slack, it checks the web inbox or `board status`. The agent
|
|
17
|
+
checks state before each action, asks one question at a time, and asks before changing package,
|
|
18
|
+
config, secret, service, token, skill-folder, or project-checkout state or enabling lingering. You
|
|
19
|
+
supply Jira and GitHub tokens, and the Slack app if you use Slack, through private local input;
|
|
20
|
+
never paste tokens into chat.
|
|
20
21
|
|
|
21
22
|
## License
|
|
22
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as tokenRequestStatusSchema, gt as errorEnvelopeSchema, ht as errorContextSchema, l as tokenRequestResultSchema, pt as ERRORS, vt as successEnvelopeSchema, x as renderJsonError } from "./chunk-Bc7i_dwR.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
@@ -842,7 +842,7 @@ const configObject = z.strictObject({
|
|
|
842
842
|
rejectSharedShortNames(items, ctx);
|
|
843
843
|
}).describe("Board projects, at least one. Each reads tasks from one tracker and PRs from its repos. A Spur project can be listed under only one board project; one that serves several goes in top-level spurProjects."),
|
|
844
844
|
spurProjects: z.array(boardWideEntry).superRefine(checkBoardWide).default([]).describe("Spur projects bound board-wide, each with role orchestrator or operator. A project-level binding wins for its own project. A Spur project here serves every board project it binds, and one of its sessions acts on the turns, inbox, questions and doorbells of each of them and no other."),
|
|
845
|
-
operator: z.strictObject({ slack: nonEmpty.describe("Slack user ID of the operator, such as U0123456789. Slack commands, button presses and messages from anyone else are denied. A feed line the operator resolves names this user.") }),
|
|
845
|
+
operator: z.strictObject({ slack: nonEmpty.optional().describe("Slack user ID of the operator, such as U0123456789. Required once slack.channels is set. Slack commands, button presses and messages from anyone else are denied. A feed line the operator resolves names this user.") }).optional().describe("The operator. Leave it out, with slack.channels, to run without Slack: questions addressed to the operator are then read in board inbox operator and the web inbox. Add operator.slack back before board rollback to a version that requires it."),
|
|
846
846
|
slack: z.strictObject({
|
|
847
847
|
appName: z.string().trim().min(1).default(DEFAULT_SLACK_APP_NAME).describe("Slack app and bot display name that board slack manifest writes when --app-name is not given."),
|
|
848
848
|
command: z.string().regex(/^\/[a-z0-9_-]+$/, "Expected a slash command such as /board").default(DEFAULT_SLACK_COMMAND).describe("Slash command with its leading slash. The board acts only on this command, and board slack manifest writes it when --command is not given. When slack.channels is set and SLACK_APP_CONFIG_TOKEN and slack.appId are present, board doctor compares it with the installed app."),
|
|
@@ -1090,6 +1090,11 @@ const configSchema = configObject.superRefine(checkBoardWideAgainstProjects).sup
|
|
|
1090
1090
|
message: `Stand port range includes ${field}.port ${String(port)}`
|
|
1091
1091
|
});
|
|
1092
1092
|
}
|
|
1093
|
+
if (slackConfigured(config) && config.operator?.slack === void 0) ctx.addIssue({
|
|
1094
|
+
code: "custom",
|
|
1095
|
+
path: ["operator", "slack"],
|
|
1096
|
+
message: "Set operator.slack, the operator's Slack user ID, when slack.channels is set"
|
|
1097
|
+
});
|
|
1093
1098
|
const addressee = config.slack.defaultAddressee;
|
|
1094
1099
|
if (addressee === void 0) return;
|
|
1095
1100
|
if (!(config.spurProjects.some(({ shortName }) => shortName === addressee) || config.projects.some((project) => project.spurProjects.some(({ shortName }) => shortName === addressee)))) ctx.addIssue({
|
|
@@ -1215,9 +1220,16 @@ const SECRET_ENV_KEYS = [
|
|
|
1215
1220
|
purpose: "Override the Slack API URL for local testing. https:, or http: only on a loopback host."
|
|
1216
1221
|
}
|
|
1217
1222
|
];
|
|
1223
|
+
/**
|
|
1224
|
+
* Whether Slack is on: either slack channel is set. Without one the daemon builds no Slack
|
|
1225
|
+
* gateway and the board writes no Slack messages.
|
|
1226
|
+
*/
|
|
1227
|
+
function slackConfigured(config) {
|
|
1228
|
+
return Boolean(config.slack.channels.feed || config.slack.channels.orchestrators);
|
|
1229
|
+
}
|
|
1218
1230
|
function requiredSecretKeys(config) {
|
|
1219
1231
|
const jira = config.projects.some((project) => project.tracker.type === "jira");
|
|
1220
|
-
const slack =
|
|
1232
|
+
const slack = slackConfigured(config);
|
|
1221
1233
|
return SECRET_ENV_KEYS.filter(({ requiredWhen }) => requiredWhen === "always" || requiredWhen === "jira" && jira || requiredWhen === "slack" && slack).map(({ name }) => name);
|
|
1222
1234
|
}
|
|
1223
1235
|
// ../contracts/src/errors.ts
|
|
@@ -6036,6 +6048,10 @@ function requestHashOf(hash) {
|
|
|
6036
6048
|
* (`GET /sessions/transitions`, Spur #1447). Bump it with the feature that needs a newer Spur.
|
|
6037
6049
|
*/
|
|
6038
6050
|
const SPUR_MIN_VERSION = "1.53.0";
|
|
6051
|
+
/** The `slack.configured` fix when neither slack.channels nor operator.slack is set. */
|
|
6052
|
+
const SLACK_OFF_FIX = "Slack off: questions addressed to you are in board inbox operator and the web inbox. A new token needs Slack approval, so outside Spur only tokens approved earlier work, until board token revoke. Run the spur-board-setup skill to add Slack.";
|
|
6053
|
+
/** The `slack.configured` fix when operator.slack is set but slack.channels is not. */
|
|
6054
|
+
const SLACK_PARTLY_FIX = "Slack is partly configured: operator.slack is set but slack.channels is not, so nothing reaches Slack and questions addressed to you are only visible through board inbox. Run the spur-board-setup skill to set slack.channels, or remove operator.slack to run without Slack.";
|
|
6039
6055
|
const checkShape = {
|
|
6040
6056
|
id: z.string(),
|
|
6041
6057
|
status: z.enum([
|
|
@@ -6069,4 +6085,4 @@ const remoteDoctorReportSchema = z.object({
|
|
|
6069
6085
|
function assertNever(value) {
|
|
6070
6086
|
throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
|
|
6071
6087
|
}
|
|
6072
|
-
export {
|
|
6088
|
+
export { prApprovalPairSchema as $, skillReloadFilesSchema as A, defaultAddressee as At, entityRefSchema as B, COLUMN_IDS as Bt, SPACE_IDS as C, DEFAULT_STAND_PORT_RANGE as Ct, messageRefSchema as D, columnTurnTimings as Dt, interactionRefSchema as E, boardWideSpurProject as Et, AdapterError as F, resolveWebOrigin as Ft, trackerSourceId as G, TODO_GROUP_COLUMN_IDS as Gt, prSourceId as H, ITEM_KINDS as Ht, MIRROR_FAILURES as I, slackConfigured as It, REVIEW_STATES as J, PR_STATES as K, VIAS as Kt, MIRROR_FAILURE_CODES as L, BLOCK_TYPES as Lt, EVENT_KINDS as M, plainHttpAllowed as Mt, GATE_REASONS as N, readyMirrorOf as Nt, userIdSchema as O, configBindings as Ot, eventPayloadSchemas as P, requiredSecretKeys as Pt, parseRingMarker as Q, batchSchema as R, COLUMNS as Rt, renderMcpError as S, DEFAULT_SLACK_COMMAND as St, inboundEventSchema as T, approvalRuleOf as Tt, sessionTransitionSchema as U, SLACK_BOT_SCOPES as Ut, mirrorSourceId as V, DISPATCHER_MODES as Vt, sourceCursorSchema as W, TASK_HOLDS as Wt, SESSION_STATUSES as X, SESSION_HEALTH_STATES as Y, isExternalAuthor as Z, defaultBranchViewSchema as _, ok as _t, doctorReportSchema as a, ticketFactsSchema as at, renderHttpProblem as b, DEFAULT_LINK as bt, requestHashOf as c, actorIdSchema as ct, tokenRequestStatusSchema as d, parseActorId as dt, prFactsSchema as et, BOARD_TICK_MS as f, parseRef as ft, OPERATIONS as g, errorEnvelopeSchema as gt, roleCanUseOperation as h, errorContextSchema as ht, SPUR_MIN_VERSION as i, sessionFactsSchema as it, sortSkillFiles as j, externalQuietAfterMs as jt, skillReloadFileSchema as k, configSchema as kt, tokenRequestResultSchema as l, encodeActorId as lt, buildCatalogSnapshot as m, err as mt, SLACK_OFF_FIX as n, prReviewRuleSchema as nt, remoteDoctorReportSchema as o, JIRA_PROJECT_KEY as ot, SYSTEMD_SERVICE_SETTINGS as p, ERRORS as pt, REVIEW_DECISIONS as q, isTodoGroupColumn as qt, SLACK_PARTLY_FIX as r, ringMarker as rt, TOKEN_REQUEST_LIMITS as s, REF_NUMBER as st, assertNever as t, prRefSchema as tt, tokenRequestSchema as u, errorCodeOf as ut, inboxNoSessionSchema as v, successEnvelopeSchema as vt, conversationRefSchema as w, RESERVED_PROJECT as wt, renderJsonError as x, DEFAULT_SLACK_APP_NAME as xt, turnHandedSchema as y, DEFAULT_HTTP_PORT as yt, defaultBranchFactSchema as z, COLUMN_GROUPS as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { Mt as plainHttpAllowed, g as OPERATIONS, kt as configSchema, m as buildCatalogSnapshot } from "./chunk-Bc7i_dwR.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-BFzKesDt.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 {
|
|
1
|
+
import { Ct as DEFAULT_STAND_PORT_RANGE, Ft as resolveWebOrigin, It as slackConfigured, Pt as requiredSecretKeys, Ut as SLACK_BOT_SCOPES, c as requestHashOf, ct as actorIdSchema, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, kt as configSchema, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, pt as ERRORS, r as SLACK_PARTLY_FIX, vt as successEnvelopeSchema } from "./chunk-Bc7i_dwR.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-BFzKesDt.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-ChF7zDxN.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";
|
|
@@ -1041,11 +1041,19 @@ async function runDoctor(options = {}) {
|
|
|
1041
1041
|
blocking: true,
|
|
1042
1042
|
fix: daemonSecrets.fix ?? "Add the missing required keys to secrets.env and restart the daemon."
|
|
1043
1043
|
} : secrets);
|
|
1044
|
-
const
|
|
1045
|
-
if (remote === null) checks.push(...remoteIdSet(
|
|
1044
|
+
const slackOn = slackConfigured(config);
|
|
1045
|
+
if (remote === null) checks.push(...remoteIdSet(slackOn).filter((id) => id !== "secrets").map((id) => {
|
|
1046
|
+
if (id !== "slack.configured") return warning(id, "Start the daemon, then rerun board doctor to complete this check.");
|
|
1047
|
+
return config.operator?.slack === void 0 ? {
|
|
1048
|
+
id,
|
|
1049
|
+
status: "pass",
|
|
1050
|
+
blocking: false,
|
|
1051
|
+
fix: SLACK_OFF_FIX
|
|
1052
|
+
} : warning(id, SLACK_PARTLY_FIX);
|
|
1053
|
+
}));
|
|
1046
1054
|
else {
|
|
1047
1055
|
const localIds = /* @__PURE__ */ new Set([...checks.map((check) => check.id), "versions"]);
|
|
1048
|
-
checks.push(...remoteMerge(remote.checks, localIds,
|
|
1056
|
+
checks.push(...remoteMerge(remote.checks, localIds, slackOn));
|
|
1049
1057
|
}
|
|
1050
1058
|
const availableVersions = [
|
|
1051
1059
|
...currentBoard.exitCode === 0 ? [currentBoard.stdout.trim()] : [],
|
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-BFzKesDt.mjs";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as prApprovalPairSchema, A as skillReloadFilesSchema, At as defaultAddressee, B as entityRefSchema, Bt as COLUMN_IDS, C as SPACE_IDS, D as messageRefSchema, Dt as columnTurnTimings, E as interactionRefSchema, Et as boardWideSpurProject, F as AdapterError, Ft as resolveWebOrigin, G as trackerSourceId, Gt as TODO_GROUP_COLUMN_IDS, H as prSourceId, Ht as ITEM_KINDS, I as MIRROR_FAILURES, It as slackConfigured, J as REVIEW_STATES, K as PR_STATES, Kt as VIAS, L as MIRROR_FAILURE_CODES, Lt as BLOCK_TYPES, M as EVENT_KINDS, Mt as plainHttpAllowed, N as GATE_REASONS, Nt as readyMirrorOf, O as userIdSchema, Ot as configBindings, P as eventPayloadSchemas, Pt as requiredSecretKeys, Q as parseRingMarker, R as batchSchema, Rt as COLUMNS, St as DEFAULT_SLACK_COMMAND, T as inboundEventSchema, Tt as approvalRuleOf, U as sessionTransitionSchema, Ut as SLACK_BOT_SCOPES, V as mirrorSourceId, Vt as DISPATCHER_MODES, W as sourceCursorSchema, Wt as TASK_HOLDS, X as SESSION_STATUSES, Y as SESSION_HEALTH_STATES, Z as isExternalAuthor, _ as defaultBranchViewSchema, _t as ok, a as doctorReportSchema, at as ticketFactsSchema, b as renderHttpProblem, bt as DEFAULT_LINK, c as requestHashOf, ct as actorIdSchema, d as tokenRequestStatusSchema, dt as parseActorId, et as prFactsSchema, f as BOARD_TICK_MS, ft as parseRef$1, g as OPERATIONS, h as roleCanUseOperation, i as SPUR_MIN_VERSION, it as sessionFactsSchema, j as sortSkillFiles, jt as externalQuietAfterMs, kt as configSchema, l as tokenRequestResultSchema, lt as encodeActorId, m as buildCatalogSnapshot, mt as err, n as SLACK_OFF_FIX, nt as prReviewRuleSchema, ot as JIRA_PROJECT_KEY, pt as ERRORS, q as REVIEW_DECISIONS, qt as isTodoGroupColumn, r as SLACK_PARTLY_FIX, rt as ringMarker, s as TOKEN_REQUEST_LIMITS, st as REF_NUMBER, t as assertNever, tt as prRefSchema, u as tokenRequestSchema, ut as errorCodeOf, v as inboxNoSessionSchema, vt as successEnvelopeSchema, w as conversationRefSchema, wt as RESERVED_PROJECT, y as turnHandedSchema, z as defaultBranchFactSchema, zt as COLUMN_GROUPS } from "./chunk-Bc7i_dwR.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";
|
|
@@ -9118,6 +9118,15 @@ const segment = z.discriminatedUnion("kind", [z.strictObject({
|
|
|
9118
9118
|
function payloadField(path) {
|
|
9119
9119
|
return sql`case when json_valid(payload) then json_extract(payload, ${path}) end`;
|
|
9120
9120
|
}
|
|
9121
|
+
/** The `last_error` of a gateway row a start without Slack retired; it was never sent. */
|
|
9122
|
+
const SLACK_OFF = "slack off";
|
|
9123
|
+
/**
|
|
9124
|
+
* Leaves out rows retired as Slack off, so a thread's tail is its last row that may have been
|
|
9125
|
+
* sent: a reply or close written after Slack is back follows that row, not a retired one.
|
|
9126
|
+
*/
|
|
9127
|
+
function notRetired(eb) {
|
|
9128
|
+
return eb.or([eb("state", "!=", "dead"), eb("last_error", "is not", SLACK_OFF)]);
|
|
9129
|
+
}
|
|
9121
9130
|
/** The plain summary of `segments`: what is scanned, stored on the item and struck. */
|
|
9122
9131
|
function feedText(segments) {
|
|
9123
9132
|
return segments.map((part) => part.text).join("");
|
|
@@ -9555,6 +9564,10 @@ async function insertOutbox(trx, row) {
|
|
|
9555
9564
|
if (row.kind !== "doorbell") {
|
|
9556
9565
|
const payload = row.payload;
|
|
9557
9566
|
if (payload === null || typeof payload !== "object" || !("key" in payload)) throw new Error("Invalid gateway outbox payload");
|
|
9567
|
+
if (!slackConfigured(scanConfig())) return {
|
|
9568
|
+
id: null,
|
|
9569
|
+
inserted: false
|
|
9570
|
+
};
|
|
9558
9571
|
const rule = checkGatewayStrings(payloadStrings(payload));
|
|
9559
9572
|
if (rule === SCAN_PENDING) return {
|
|
9560
9573
|
id: null,
|
|
@@ -9645,7 +9658,8 @@ async function operatorThread(trx, blockId) {
|
|
|
9645
9658
|
}
|
|
9646
9659
|
/**
|
|
9647
9660
|
* Writes the `conversation.reply` row of a later comment on a block whose open row exists.
|
|
9648
|
-
* The row waits for the thread's latest open, reply or close row
|
|
9661
|
+
* The row waits for the thread's latest open, reply or close row, not counting rows retired as
|
|
9662
|
+
* Slack off (`notRetired`). Returns null and writes
|
|
9649
9663
|
* nothing when there is no such row or it is dead: a dead thread takes no more replies. A block
|
|
9650
9664
|
* with no open row, an operator conversation, replies in its registered thread
|
|
9651
9665
|
* (`targetConversation`), after its earlier replies.
|
|
@@ -9663,7 +9677,7 @@ async function enqueueConversationReply(trx, input) {
|
|
|
9663
9677
|
"conversation.open",
|
|
9664
9678
|
"conversation.reply",
|
|
9665
9679
|
"conversation.close"
|
|
9666
|
-
]).where(payloadField("$.blockId"), "=", blockId).orderBy("id", "desc").limit(1).executeTakeFirst();
|
|
9680
|
+
]).where(payloadField("$.blockId"), "=", blockId).where(notRetired).orderBy("id", "desc").limit(1).executeTakeFirst();
|
|
9667
9681
|
const started = await operatorThread(trx, blockId);
|
|
9668
9682
|
if (tail === void 0 && started === void 0 || tail?.state === "dead") return null;
|
|
9669
9683
|
const payload = {
|
|
@@ -9692,7 +9706,7 @@ async function enqueueConversationClose(trx, input) {
|
|
|
9692
9706
|
"task_id",
|
|
9693
9707
|
"project"
|
|
9694
9708
|
]).where("id", "=", input.blockId).executeTakeFirstOrThrow();
|
|
9695
|
-
const tail = await trx.selectFrom("outbox").select(["id", "state"]).where("kind", "in", ["conversation.open", "conversation.reply"]).where(payloadField("$.blockId"), "=", input.blockId).orderBy("id", "desc").executeTakeFirst();
|
|
9709
|
+
const tail = await trx.selectFrom("outbox").select(["id", "state"]).where("kind", "in", ["conversation.open", "conversation.reply"]).where(payloadField("$.blockId"), "=", input.blockId).where(notRetired).orderBy("id", "desc").executeTakeFirst();
|
|
9696
9710
|
const open = await trx.selectFrom("outbox").select(["id", "state"]).where("kind", "=", "conversation.open").where(payloadField("$.blockId"), "=", input.blockId).executeTakeFirst();
|
|
9697
9711
|
const parent = tail?.state === "dead" ? null : tail?.id ?? null;
|
|
9698
9712
|
const conversations = await trx.selectFrom("conversation").select("ref").where("block_id", "=", input.blockId).execute();
|
|
@@ -9918,14 +9932,22 @@ function feedTime(at, config, date = false) {
|
|
|
9918
9932
|
const time = `${part("hour")}:${part("minute")}`;
|
|
9919
9933
|
return date ? `${part("year")}-${part("month")}-${part("day")} ${time}` : time;
|
|
9920
9934
|
}
|
|
9921
|
-
/**
|
|
9935
|
+
/**
|
|
9936
|
+
* Who acted, for a non-system actor: an agent by its session, else the operator's mention, or
|
|
9937
|
+
* the word operator when operator.slack is unset.
|
|
9938
|
+
*/
|
|
9922
9939
|
function actorInline(by, parsed, config) {
|
|
9923
|
-
|
|
9940
|
+
if (parsed.actor === "agent" && !isOperator(by, config, null)) return {
|
|
9924
9941
|
kind: "text",
|
|
9925
9942
|
text: `${parsed.actorRef.project}/${parsed.actorRef.session}`
|
|
9943
|
+
};
|
|
9944
|
+
const slack = config.operator?.slack;
|
|
9945
|
+
return slack === void 0 ? {
|
|
9946
|
+
kind: "text",
|
|
9947
|
+
text: "operator"
|
|
9926
9948
|
} : {
|
|
9927
9949
|
kind: "mention",
|
|
9928
|
-
user: userIdSchema.parse(
|
|
9950
|
+
user: userIdSchema.parse(slack)
|
|
9929
9951
|
};
|
|
9930
9952
|
}
|
|
9931
9953
|
function resolvedLine(by, at, config) {
|
|
@@ -11189,6 +11211,15 @@ async function decideTokenInTransaction(trx, itemId, decision, at) {
|
|
|
11189
11211
|
status
|
|
11190
11212
|
};
|
|
11191
11213
|
}
|
|
11214
|
+
if (decision === "approve") {
|
|
11215
|
+
if ((await trx.selectFrom("operator_item").select("cleared_at").where("id", "=", row.item_id).executeTakeFirstOrThrow()).cleared_at !== null) {
|
|
11216
|
+
await expireToken(trx, row, at);
|
|
11217
|
+
return {
|
|
11218
|
+
name: row.name,
|
|
11219
|
+
status: "expired"
|
|
11220
|
+
};
|
|
11221
|
+
}
|
|
11222
|
+
}
|
|
11192
11223
|
const next = decision === "approve" ? "approved" : "denied";
|
|
11193
11224
|
await trx.updateTable("operator_token").set({
|
|
11194
11225
|
status: next,
|
|
@@ -18110,11 +18141,24 @@ function createSender(options) {
|
|
|
18110
18141
|
await scanTransaction(store, options.config, (trx) => record(trx, c, outcome, error, at, started.at));
|
|
18111
18142
|
}
|
|
18112
18143
|
}
|
|
18144
|
+
/**
|
|
18145
|
+
* Slack off: no gateway will send what earlier runs left, uncertain rows included, so they go
|
|
18146
|
+
* dead and their comments superseded. Doorbells stay. One statement with no id list, so a
|
|
18147
|
+
* backlog of any size stays under the SQLite parameter limit.
|
|
18148
|
+
*/
|
|
18149
|
+
async function retireGatewayRows(trx) {
|
|
18150
|
+
await supersedeComments(trx, await trx.updateTable("outbox").set({
|
|
18151
|
+
state: "dead",
|
|
18152
|
+
last_error: SLACK_OFF
|
|
18153
|
+
}).where("kind", "!=", "doorbell").where("state", "in", ["pending", "post_failed"]).returning(["kind", "payload"]).execute());
|
|
18154
|
+
await cascade(trx);
|
|
18155
|
+
}
|
|
18113
18156
|
return {
|
|
18114
18157
|
async recover() {
|
|
18115
18158
|
const nowIso = now().toISOString();
|
|
18116
18159
|
const failed = await scanTransaction(store, options.config, async (trx) => {
|
|
18117
18160
|
await releaseOrphans(trx, nowIso);
|
|
18161
|
+
if (gateway === void 0) await retireGatewayRows(trx);
|
|
18118
18162
|
return (await trx.selectFrom("outbox").select("id").where("state", "=", "post_failed").execute()).map((row) => row.id);
|
|
18119
18163
|
});
|
|
18120
18164
|
for (let i = 0; i < failed.length; i += RECOVER_BATCH) {
|
|
@@ -21267,9 +21311,11 @@ async function orchestratorSessions(db, config) {
|
|
|
21267
21311
|
}
|
|
21268
21312
|
/**
|
|
21269
21313
|
* Called from an accepted observation's transaction after board and item reconciliation.
|
|
21270
|
-
* The version marker and feed row share that transaction with the source-state update.
|
|
21314
|
+
* The version marker and feed row share that transaction with the source-state update. With
|
|
21315
|
+
* Slack off it writes neither, so the first poll after Slack is set posts the line.
|
|
21271
21316
|
*/
|
|
21272
21317
|
async function enqueueLiveAfterFirstPoll(trx, input) {
|
|
21318
|
+
if (!slackConfigured(input.config)) return;
|
|
21273
21319
|
if ([...doctorSources(input.config)].some((source) => !input.completeSince.has(source) || input.blind.has(source))) return;
|
|
21274
21320
|
const value = JSON.stringify(input.productVersion);
|
|
21275
21321
|
if ((await trx.selectFrom("meta").select("value").where("key", "=", LIVE_VERSION_KEY).executeTakeFirst())?.value === value) return;
|
|
@@ -22821,7 +22867,7 @@ function createInbound(input) {
|
|
|
22821
22867
|
return;
|
|
22822
22868
|
}
|
|
22823
22869
|
await replayOperation(trx, {
|
|
22824
|
-
actor: event.kind === "message_deleted" || event.author === config.operator
|
|
22870
|
+
actor: event.kind === "message_deleted" || event.author === config.operator?.slack ? "operator" : "system",
|
|
22825
22871
|
key: event.dedupeKey,
|
|
22826
22872
|
operation: operationId(event),
|
|
22827
22873
|
fingerprintInput: event,
|
|
@@ -22848,14 +22894,14 @@ function createInbound(input) {
|
|
|
22848
22894
|
}
|
|
22849
22895
|
const token = event.kind === "action" ? tokenAction(event) : null;
|
|
22850
22896
|
if (token !== null) {
|
|
22851
|
-
if (event.kind !== "action" || event.author !== config.operator
|
|
22897
|
+
if (event.kind !== "action" || event.author !== config.operator?.slack || event.sourceSpace !== "feed") throw new CommandError("retry_not_applicable", "This interaction cannot be retried.");
|
|
22852
22898
|
await decideToken(trx, event.dedupeKey, token, at);
|
|
22853
22899
|
return;
|
|
22854
22900
|
}
|
|
22855
22901
|
const { id, operationInput } = interactionOperation(event);
|
|
22856
22902
|
if (id === void 0) throw new CommandError("retry_not_applicable", "This interaction cannot be retried.");
|
|
22857
22903
|
if (id === "token.list") {
|
|
22858
|
-
if (event.kind !== "command" || event.author !== config.operator
|
|
22904
|
+
if (event.kind !== "command" || event.author !== config.operator?.slack) throw new CommandError("retry_not_applicable", "This interaction cannot be retried.");
|
|
22859
22905
|
await postTokenList(trx, {
|
|
22860
22906
|
key: event.dedupeKey,
|
|
22861
22907
|
at: new Date(at)
|
|
@@ -22866,7 +22912,7 @@ function createInbound(input) {
|
|
|
22866
22912
|
const handler = registry[id];
|
|
22867
22913
|
const entry = OPERATIONS.find((candidate) => candidate.id === id);
|
|
22868
22914
|
const parsed = entry?.input.safeParse(operationInput);
|
|
22869
|
-
if (event.kind !== "action" || event.author !== config.operator
|
|
22915
|
+
if (event.kind !== "action" || event.author !== config.operator?.slack || event.sourceSpace === null || handler === void 0 || entry === void 0 || parsed?.success !== true) throw new CommandError("retry_not_applicable", "This interaction cannot be retried.");
|
|
22870
22916
|
const input = parsed.data;
|
|
22871
22917
|
await replayOperation(trx, {
|
|
22872
22918
|
actor: "operator",
|
|
@@ -22890,7 +22936,7 @@ function createInbound(input) {
|
|
|
22890
22936
|
gateway: gateway.kind,
|
|
22891
22937
|
at
|
|
22892
22938
|
});
|
|
22893
|
-
if (event.kind !== "message_deleted" && event.author !== config.operator
|
|
22939
|
+
if (event.kind !== "message_deleted" && event.author !== config.operator?.slack) return deny(trx, {
|
|
22894
22940
|
config,
|
|
22895
22941
|
event,
|
|
22896
22942
|
reason: "Only the configured operator may act.",
|
|
@@ -23117,12 +23163,12 @@ function createInbound(input) {
|
|
|
23117
23163
|
}
|
|
23118
23164
|
async function applyUser(event) {
|
|
23119
23165
|
await withVia("slack", async () => {
|
|
23120
|
-
if ((event.kind === "command" || event.kind === "action") && event.author === config.operator
|
|
23166
|
+
if ((event.kind === "command" || event.kind === "action") && event.author === config.operator?.slack && (event.kind !== "command" || event.name === void 0 || event.name === config.slack.command) && (event.kind === "command" || event.sourceSpace !== null)) {
|
|
23121
23167
|
await dispatchInteraction(event);
|
|
23122
23168
|
return;
|
|
23123
23169
|
}
|
|
23124
23170
|
const at = new Date(clock.now()).toISOString();
|
|
23125
|
-
const actor = event.kind === "message_deleted" || event.author === config.operator
|
|
23171
|
+
const actor = event.kind === "message_deleted" || event.author === config.operator?.slack ? "operator" : "system";
|
|
23126
23172
|
try {
|
|
23127
23173
|
const result = await transact((trx) => replayOperation(trx, {
|
|
23128
23174
|
actor,
|
|
@@ -30205,7 +30251,6 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
|
|
|
30205
30251
|
const spurVersion = readSpurVersion(ctx, fetcher, deadlineMs, config.adapters.spur.baseUrl);
|
|
30206
30252
|
if (config.web.port !== void 0) checks.push(webListening?.() === true ? check("web.listening", true, "") : warning("web.listening", "Free the configured web port and restart the daemon."));
|
|
30207
30253
|
const jiraTrackers = config.projects.flatMap((project) => project.tracker.type === "jira" ? [project.tracker] : []);
|
|
30208
|
-
const slackConfigured = Boolean(config.slack.channels.feed || config.slack.channels.orchestrators);
|
|
30209
30254
|
const linkSamples = sampleLinks(ctx, fetcher, deadlineMs, secrets["GITHUB_TOKEN"]);
|
|
30210
30255
|
const ruled = ruledRepos(config).length > 0;
|
|
30211
30256
|
const ruleToken = secrets["GITHUB_TOKEN"];
|
|
@@ -30255,7 +30300,12 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
|
|
|
30255
30300
|
checks.push(check("spur.api", spurOk, "Start or correct the configured Spur API."));
|
|
30256
30301
|
checks.push(check("spur.send", spurSend.ok, spurSend.reachable ? SPUR_SEND_FIX : SPUR_SEND_UNREACHABLE_FIX));
|
|
30257
30302
|
const spurVersionAt = checks.length;
|
|
30258
|
-
if (!slackConfigured) checks.push(
|
|
30303
|
+
if (!slackConfigured(config)) checks.push(config.operator?.slack === void 0 ? {
|
|
30304
|
+
id: "slack.configured",
|
|
30305
|
+
status: "pass",
|
|
30306
|
+
blocking: false,
|
|
30307
|
+
fix: SLACK_OFF_FIX
|
|
30308
|
+
} : warning("slack.configured", SLACK_PARTLY_FIX));
|
|
30259
30309
|
else {
|
|
30260
30310
|
const botToken = secrets["SLACK_BOT_TOKEN"];
|
|
30261
30311
|
const slackHeaders = botToken ? { Authorization: `Bearer ${botToken}` } : {};
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
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 { S as renderMcpError, g as OPERATIONS, pt as ERRORS } from "./chunk-Bc7i_dwR.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-BFzKesDt.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-ChF7zDxN.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|