spur-board 0.160.0 → 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-DpR7gxfh.mjs → chunk-BFzKesDt.mjs} +1 -1
- package/dist/{chunk-CV__xxV8.mjs → chunk-Bc7i_dwR.mjs} +20 -4
- package/dist/{chunk-bxssICzu.mjs → chunk-ChF7zDxN.mjs} +2 -2
- package/dist/cli.mjs +14 -6
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +129 -31
- 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-done.md +9 -2
- package/skills/spur-board/references/how-board-works-turns.md +10 -10
- 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";
|
|
@@ -195,7 +195,7 @@ const SUBMISSION_BASES = [
|
|
|
195
195
|
* when the task moved on (it also covers returns and mode switches recorded by older versions),
|
|
196
196
|
* `corrected` by the operator's column correction, `rerouted` to another executor,
|
|
197
197
|
* `mode_changed` by a dispatcher mode switch, `archived` with the task. `moved` also closes a
|
|
198
|
-
* Done wrap-up turn whose holder session ended.
|
|
198
|
+
* Done wrap-up turn whose holder session ended, or an untaken one with no recipient left.
|
|
199
199
|
*/
|
|
200
200
|
const TURN_OUTCOMES = [
|
|
201
201
|
"submitted",
|
|
@@ -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,
|
|
@@ -15619,13 +15650,18 @@ async function turnsWithoutSession(trx, config, now, taskById) {
|
|
|
15619
15650
|
/**
|
|
15620
15651
|
* Reconciles every item in the caller's observation or tick transaction. It first closes each
|
|
15621
15652
|
* Done wrap-up turn whose holder session ended (`closeEndedDoneTurns`), so no stall item is
|
|
15622
|
-
* raised for it
|
|
15653
|
+
* raised for it, and, while Spur is current, each untaken one left with no recipient
|
|
15654
|
+
* (`closeUnaddressedDoneTurns`).
|
|
15623
15655
|
*/
|
|
15624
15656
|
async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurContinuityStartAt) {
|
|
15625
|
-
await closeEndedDoneTurns(trx, new Date(now));
|
|
15626
|
-
const candidates = [];
|
|
15627
15657
|
const sources = await trx.selectFrom("source_state").selectAll().execute();
|
|
15628
15658
|
const sourceById = new Map(sources.map((state) => [state.source, state]));
|
|
15659
|
+
const spur = sourceById.get("spur");
|
|
15660
|
+
const spurBlind = spur !== void 0 && spur.blind_reason !== null;
|
|
15661
|
+
const spurExpired = spur?.last_complete_at != null && now > Date.parse(spur.last_complete_at) + config.adapters.spur.intervalMs * config.thresholds.staleMultiplier;
|
|
15662
|
+
await closeEndedDoneTurns(trx, new Date(now));
|
|
15663
|
+
if (!(spurBlind || !spurComplete || spurExpired)) await closeUnaddressedDoneTurns(trx, config, new Date(now));
|
|
15664
|
+
const candidates = [];
|
|
15629
15665
|
for (const source of sources) {
|
|
15630
15666
|
if (source.blind_reason === null) continue;
|
|
15631
15667
|
if (source.blind_reason === "stale" && source.source !== "spur") continue;
|
|
@@ -15746,8 +15782,6 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
15746
15782
|
source: null,
|
|
15747
15783
|
priority: ITEM_POLICY.post_failed.priority
|
|
15748
15784
|
});
|
|
15749
|
-
const spur = sourceById.get("spur");
|
|
15750
|
-
const spurBlind = spur !== void 0 && spur.blind_reason !== null;
|
|
15751
15785
|
const subjects = (await trx.selectFrom("link").innerJoin("session_snapshot", "session_snapshot.id", "link.session_id").select([
|
|
15752
15786
|
"link.task_id",
|
|
15753
15787
|
"link.role",
|
|
@@ -15925,7 +15959,6 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
15925
15959
|
observedAt: null,
|
|
15926
15960
|
resumedAt: null
|
|
15927
15961
|
} : parseJson(stallObservationSchema, observationRow.value);
|
|
15928
|
-
const spurExpired = spur?.last_complete_at != null && now > Date.parse(spur.last_complete_at) + config.adapters.spur.intervalMs * config.thresholds.staleMultiplier;
|
|
15929
15962
|
const observation = spurBlind || !spurComplete || spurExpired ? {
|
|
15930
15963
|
...previousObservation,
|
|
15931
15964
|
blind: true,
|
|
@@ -15959,11 +15992,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
15959
15992
|
}, config) : void 0;
|
|
15960
15993
|
if (executor === void 0 && turn.acked_at === null) {
|
|
15961
15994
|
const target = config.projects.find((entry) => entry.id === task.project)?.columns.find((entry) => entry.id === turn.column)?.orchestrator;
|
|
15962
|
-
|
|
15963
|
-
for (const row of stopped) if (await trx.selectFrom("link").select("id").where("task_id", "=", task.id).where("session_id", "=", row.id).where("role", "=", turn.role === "worker" ? "worker" : "orchestrator").where("banned", "=", 0).executeTakeFirst() !== void 0 || turn.role !== "worker" && row.spur_project === target) {
|
|
15964
|
-
executor = row;
|
|
15965
|
-
break;
|
|
15966
|
-
}
|
|
15995
|
+
executor = await stoppedExecutor(trx, task.id, turn.role, target);
|
|
15967
15996
|
}
|
|
15968
15997
|
if (executor === void 0 || executor.ended_at !== null || executor.absent_since !== null) {
|
|
15969
15998
|
await observeTurnEpisode(trx, turn.id, null);
|
|
@@ -16068,8 +16097,24 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
16068
16097
|
}).onConflict((oc) => oc.column("key").doUpdateSet({ value: toJson(episodeSchema, health.episode) })).execute();
|
|
16069
16098
|
const resting = await restingHolders(trx, config, now);
|
|
16070
16099
|
const restingIdle = (flag) => flag.kind === "worker_idle" && resting.has(`${flag.taskId}:${flag.sessionId}`);
|
|
16100
|
+
const turnTasks = new Set(turns.map((turn) => turn.task_id));
|
|
16101
|
+
const latestDoneTurns = new Map((await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").select([
|
|
16102
|
+
"turn.task_id",
|
|
16103
|
+
"turn.acked_at",
|
|
16104
|
+
"turn.role",
|
|
16105
|
+
"turn.closed_reason"
|
|
16106
|
+
]).where("turn.column", "=", "done").where("task.column", "=", "done").whereRef("turn.epoch", "=", "task.column_epoch").orderBy("turn.id").execute()).map((turn) => [turn.task_id, turn]));
|
|
16107
|
+
const unaddressedDone = new Set([...latestDoneTurns.values()].filter((turn) => turn.closed_reason === "moved" && turn.acked_at === null && turn.role === "worker").map((turn) => turn.task_id));
|
|
16108
|
+
const addressed = /* @__PURE__ */ new Set();
|
|
16109
|
+
for (const taskId of unaddressedDone) {
|
|
16110
|
+
if (!taskById.has(taskId) || turnTasks.has(taskId)) continue;
|
|
16111
|
+
const session = await stoppedExecutor(trx, taskId, "worker", void 0);
|
|
16112
|
+
if (session !== void 0) addressed.add(`${String(taskId)}:${session.id}`);
|
|
16113
|
+
}
|
|
16114
|
+
const stoppedInDone = new Set(subjects.filter((subject) => subject.role === "worker" && subject.lifecycle === "stopped" && subject.endedAt === null && addressed.has(`${subject.taskId}:${subject.id}`)).map((subject) => `${subject.taskId}:${subject.id}`));
|
|
16115
|
+
const stoppedRetained = (flag) => ["stuck_worker", "needs_input"].includes(flag.kind) && stoppedInDone.has(`${flag.taskId}:${flag.sessionId}`);
|
|
16071
16116
|
for (const flag of health.flags) {
|
|
16072
|
-
if (endedHolders.has(`${flag.taskId}:${flag.sessionId}`) || restingIdle(flag)) continue;
|
|
16117
|
+
if (endedHolders.has(`${flag.taskId}:${flag.sessionId}`) || restingIdle(flag) || stoppedRetained(flag)) continue;
|
|
16073
16118
|
const task = taskById.get(Number(flag.taskId));
|
|
16074
16119
|
if (task === void 0) continue;
|
|
16075
16120
|
const fact = subjects.find((subject) => subject.taskId === flag.taskId && subject.id === flag.sessionId);
|
|
@@ -16130,12 +16175,12 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
16130
16175
|
const ordered = orderItems(candidates);
|
|
16131
16176
|
const seen = /* @__PURE__ */ new Set([...ordered.map((item) => item.key), ...heldKeys]);
|
|
16132
16177
|
for (const flag of health.held) {
|
|
16133
|
-
if (endedHolders.has(`${flag.taskId}:${flag.sessionId}`) || restingIdle(flag)) continue;
|
|
16178
|
+
if (endedHolders.has(`${flag.taskId}:${flag.sessionId}`) || restingIdle(flag) || stoppedRetained(flag)) continue;
|
|
16134
16179
|
const task = taskById.get(Number(flag.taskId));
|
|
16135
16180
|
if (task !== void 0 && !stalled.has(`${flag.taskId}:${flag.sessionId}`)) seen.add(healthKey(task.id, flag));
|
|
16136
16181
|
}
|
|
16137
16182
|
const existing = await trx.selectFrom("operator_item").selectAll().where("kind", "in", RECONCILED_KINDS).where("cleared_at", "is", null).execute();
|
|
16138
|
-
const stillInError = new Set(health.hostLoad === null ? [] : subjects.filter((subject) => subject.endedAt === null && subject.health === "error" && subject.role !== "other" && !stalled.has(`${subject.taskId}:${subject.id}`)).map((subject) => healthKey(Number(subject.taskId), {
|
|
16183
|
+
const stillInError = new Set(health.hostLoad === null ? [] : subjects.filter((subject) => subject.endedAt === null && subject.health === "error" && subject.role !== "other" && !stalled.has(`${subject.taskId}:${subject.id}`) && !stoppedInDone.has(`${subject.taskId}:${subject.id}`)).map((subject) => healthKey(Number(subject.taskId), {
|
|
16139
16184
|
taskId: subject.taskId,
|
|
16140
16185
|
sessionId: subject.id,
|
|
16141
16186
|
kind: subject.role === "worker" ? "stuck_worker" : "stuck_orchestrator"
|
|
@@ -16276,6 +16321,26 @@ async function closeEndedDoneTurns(trx, at) {
|
|
|
16276
16321
|
for (const item of items) await clearReconciled(trx, item, at, reason);
|
|
16277
16322
|
}
|
|
16278
16323
|
}
|
|
16324
|
+
/**
|
|
16325
|
+
* Closes, as `moved`, each untaken worker-role Done wrap-up turn of an unarchived Done task when
|
|
16326
|
+
* no recipient is left: no live worker session is linked to the task and Done has no
|
|
16327
|
+
* orchestrator. The caller runs it only while Spur is current, so a missed session end does not
|
|
16328
|
+
* close a turn a live worker still holds.
|
|
16329
|
+
*/
|
|
16330
|
+
async function closeUnaddressedDoneTurns(trx, config, at) {
|
|
16331
|
+
const turns = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").select(["turn.task_id", "task.project"]).where("turn.closed_at", "is", null).where("turn.acked_at", "is", null).where("turn.role", "=", "worker").where("turn.column", "=", "done").where("task.column", "=", "done").where("task.membership", "!=", "archived").orderBy("turn.id").execute();
|
|
16332
|
+
for (const turn of turns) {
|
|
16333
|
+
const project = config.projects.find((candidate) => candidate.id === turn.project);
|
|
16334
|
+
if (project === void 0) continue;
|
|
16335
|
+
if ((project.columns.find((column) => column.id === "done")?.orchestrator ?? "none") !== "none") continue;
|
|
16336
|
+
if (await linkedSession(trx, turn.task_id, "worker") !== void 0) continue;
|
|
16337
|
+
await closeTurns(trx, {
|
|
16338
|
+
taskId: turn.task_id,
|
|
16339
|
+
reason: "moved",
|
|
16340
|
+
at
|
|
16341
|
+
});
|
|
16342
|
+
}
|
|
16343
|
+
}
|
|
16279
16344
|
/** Raise ended-holder attention from ownership, independent of links, PRs and source freshness. */
|
|
16280
16345
|
async function endedTurnItems(trx, tasks, candidates, at, spurConfirmedAt) {
|
|
16281
16346
|
const holders = /* @__PURE__ */ new Set();
|
|
@@ -16356,6 +16421,20 @@ async function observeTurnEpisode(trx, turnId, fact) {
|
|
|
16356
16421
|
}).onConflict((oc) => oc.column("key").doUpdateSet({ value: toJson(stallEpisodeSchema, episode) })).execute();
|
|
16357
16422
|
return episode;
|
|
16358
16423
|
}
|
|
16424
|
+
/**
|
|
16425
|
+
* The stopped session an untaken turn of `role` with no live recipient is diagnosed against: the
|
|
16426
|
+
* newest stopped, present session linked to the task in that role, or for a column orchestrator
|
|
16427
|
+
* turn one of the column's orchestrator project `target`. It runs on every reconcile, so each
|
|
16428
|
+
* query is scoped to the task's links or to that project.
|
|
16429
|
+
*/
|
|
16430
|
+
async function stoppedExecutor(trx, taskId, role, target) {
|
|
16431
|
+
const newestStopped = trx.selectFrom("session_snapshot").selectAll("session_snapshot").where("session_snapshot.state", "=", "stopped").where("session_snapshot.ended_at", "is", null).where("session_snapshot.absent_since", "is", null).orderBy("session_snapshot.first_seen", "desc").orderBy("session_snapshot.id").limit(1);
|
|
16432
|
+
const linked = await newestStopped.innerJoin("link", "link.session_id", "session_snapshot.id").where("link.task_id", "=", taskId).where("link.entity", "=", "session").where("link.role", "=", role === "worker" ? "worker" : "orchestrator").where("link.banned", "=", 0).executeTakeFirst();
|
|
16433
|
+
if (role === "worker" || target === void 0) return linked;
|
|
16434
|
+
const inProject = await newestStopped.where("session_snapshot.spur_project", "=", target).executeTakeFirst();
|
|
16435
|
+
if (linked === void 0 || inProject === void 0) return linked ?? inProject;
|
|
16436
|
+
return inProject.first_seen > linked.first_seen || inProject.first_seen === linked.first_seen && inProject.id < linked.id ? inProject : linked;
|
|
16437
|
+
}
|
|
16359
16438
|
function healthKey(taskId, flag) {
|
|
16360
16439
|
return `health:${String(taskId)}:${flag.sessionId}:${flag.kind}`;
|
|
16361
16440
|
}
|
|
@@ -18062,11 +18141,24 @@ function createSender(options) {
|
|
|
18062
18141
|
await scanTransaction(store, options.config, (trx) => record(trx, c, outcome, error, at, started.at));
|
|
18063
18142
|
}
|
|
18064
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
|
+
}
|
|
18065
18156
|
return {
|
|
18066
18157
|
async recover() {
|
|
18067
18158
|
const nowIso = now().toISOString();
|
|
18068
18159
|
const failed = await scanTransaction(store, options.config, async (trx) => {
|
|
18069
18160
|
await releaseOrphans(trx, nowIso);
|
|
18161
|
+
if (gateway === void 0) await retireGatewayRows(trx);
|
|
18070
18162
|
return (await trx.selectFrom("outbox").select("id").where("state", "=", "post_failed").execute()).map((row) => row.id);
|
|
18071
18163
|
});
|
|
18072
18164
|
for (let i = 0; i < failed.length; i += RECOVER_BATCH) {
|
|
@@ -21219,9 +21311,11 @@ async function orchestratorSessions(db, config) {
|
|
|
21219
21311
|
}
|
|
21220
21312
|
/**
|
|
21221
21313
|
* Called from an accepted observation's transaction after board and item reconciliation.
|
|
21222
|
-
* 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.
|
|
21223
21316
|
*/
|
|
21224
21317
|
async function enqueueLiveAfterFirstPoll(trx, input) {
|
|
21318
|
+
if (!slackConfigured(input.config)) return;
|
|
21225
21319
|
if ([...doctorSources(input.config)].some((source) => !input.completeSince.has(source) || input.blind.has(source))) return;
|
|
21226
21320
|
const value = JSON.stringify(input.productVersion);
|
|
21227
21321
|
if ((await trx.selectFrom("meta").select("value").where("key", "=", LIVE_VERSION_KEY).executeTakeFirst())?.value === value) return;
|
|
@@ -22773,7 +22867,7 @@ function createInbound(input) {
|
|
|
22773
22867
|
return;
|
|
22774
22868
|
}
|
|
22775
22869
|
await replayOperation(trx, {
|
|
22776
|
-
actor: event.kind === "message_deleted" || event.author === config.operator
|
|
22870
|
+
actor: event.kind === "message_deleted" || event.author === config.operator?.slack ? "operator" : "system",
|
|
22777
22871
|
key: event.dedupeKey,
|
|
22778
22872
|
operation: operationId(event),
|
|
22779
22873
|
fingerprintInput: event,
|
|
@@ -22800,14 +22894,14 @@ function createInbound(input) {
|
|
|
22800
22894
|
}
|
|
22801
22895
|
const token = event.kind === "action" ? tokenAction(event) : null;
|
|
22802
22896
|
if (token !== null) {
|
|
22803
|
-
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.");
|
|
22804
22898
|
await decideToken(trx, event.dedupeKey, token, at);
|
|
22805
22899
|
return;
|
|
22806
22900
|
}
|
|
22807
22901
|
const { id, operationInput } = interactionOperation(event);
|
|
22808
22902
|
if (id === void 0) throw new CommandError("retry_not_applicable", "This interaction cannot be retried.");
|
|
22809
22903
|
if (id === "token.list") {
|
|
22810
|
-
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.");
|
|
22811
22905
|
await postTokenList(trx, {
|
|
22812
22906
|
key: event.dedupeKey,
|
|
22813
22907
|
at: new Date(at)
|
|
@@ -22818,7 +22912,7 @@ function createInbound(input) {
|
|
|
22818
22912
|
const handler = registry[id];
|
|
22819
22913
|
const entry = OPERATIONS.find((candidate) => candidate.id === id);
|
|
22820
22914
|
const parsed = entry?.input.safeParse(operationInput);
|
|
22821
|
-
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.");
|
|
22822
22916
|
const input = parsed.data;
|
|
22823
22917
|
await replayOperation(trx, {
|
|
22824
22918
|
actor: "operator",
|
|
@@ -22842,7 +22936,7 @@ function createInbound(input) {
|
|
|
22842
22936
|
gateway: gateway.kind,
|
|
22843
22937
|
at
|
|
22844
22938
|
});
|
|
22845
|
-
if (event.kind !== "message_deleted" && event.author !== config.operator
|
|
22939
|
+
if (event.kind !== "message_deleted" && event.author !== config.operator?.slack) return deny(trx, {
|
|
22846
22940
|
config,
|
|
22847
22941
|
event,
|
|
22848
22942
|
reason: "Only the configured operator may act.",
|
|
@@ -23069,12 +23163,12 @@ function createInbound(input) {
|
|
|
23069
23163
|
}
|
|
23070
23164
|
async function applyUser(event) {
|
|
23071
23165
|
await withVia("slack", async () => {
|
|
23072
|
-
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)) {
|
|
23073
23167
|
await dispatchInteraction(event);
|
|
23074
23168
|
return;
|
|
23075
23169
|
}
|
|
23076
23170
|
const at = new Date(clock.now()).toISOString();
|
|
23077
|
-
const actor = event.kind === "message_deleted" || event.author === config.operator
|
|
23171
|
+
const actor = event.kind === "message_deleted" || event.author === config.operator?.slack ? "operator" : "system";
|
|
23078
23172
|
try {
|
|
23079
23173
|
const result = await transact((trx) => replayOperation(trx, {
|
|
23080
23174
|
actor,
|
|
@@ -30157,7 +30251,6 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
|
|
|
30157
30251
|
const spurVersion = readSpurVersion(ctx, fetcher, deadlineMs, config.adapters.spur.baseUrl);
|
|
30158
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."));
|
|
30159
30253
|
const jiraTrackers = config.projects.flatMap((project) => project.tracker.type === "jira" ? [project.tracker] : []);
|
|
30160
|
-
const slackConfigured = Boolean(config.slack.channels.feed || config.slack.channels.orchestrators);
|
|
30161
30254
|
const linkSamples = sampleLinks(ctx, fetcher, deadlineMs, secrets["GITHUB_TOKEN"]);
|
|
30162
30255
|
const ruled = ruledRepos(config).length > 0;
|
|
30163
30256
|
const ruleToken = secrets["GITHUB_TOKEN"];
|
|
@@ -30207,7 +30300,12 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
|
|
|
30207
30300
|
checks.push(check("spur.api", spurOk, "Start or correct the configured Spur API."));
|
|
30208
30301
|
checks.push(check("spur.send", spurSend.ok, spurSend.reachable ? SPUR_SEND_FIX : SPUR_SEND_UNREACHABLE_FIX));
|
|
30209
30302
|
const spurVersionAt = checks.length;
|
|
30210
|
-
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));
|
|
30211
30309
|
else {
|
|
30212
30310
|
const botToken = secrets["SLACK_BOT_TOKEN"];
|
|
30213
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";
|