spur-board 0.149.1 → 0.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-Cy6VBP_I.mjs → chunk-6hZvXPE0.mjs} +3 -3
- package/dist/{chunk-BhHKMsqI.mjs → chunk-D8IOOBWp.mjs} +1 -1
- package/dist/{chunk-C-Jr3pwy.mjs → chunk-DM0fcX7h.mjs} +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +154 -26
- package/dist/mcp.mjs +3 -3
- package/dist/web/assets/{index-CoOyeVqE.css → index-BfWHfRtD.css} +1 -1
- package/dist/web/assets/{index-CP1St7Hl.js → index-dzH_jnUB.js} +2 -2
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/skills/spur-board/references/how-board-works-inbox.md +5 -5
- package/skills/spur-board/references/how-board-works-slack.md +10 -1
- package/skills/spur-board/references/web-ui-task-view.md +19 -18
|
@@ -4848,9 +4848,9 @@ const OPERATIONS = [
|
|
|
4848
4848
|
id: "item.close",
|
|
4849
4849
|
web: true,
|
|
4850
4850
|
kind: "mutation",
|
|
4851
|
-
description: "Close a \"from you\" item without
|
|
4851
|
+
description: "Close a \"from you\" item without retrying; some block items close their block.",
|
|
4852
4852
|
mcp: {
|
|
4853
|
-
whenToUse: "Dismiss an item without retrying.",
|
|
4853
|
+
whenToUse: "Dismiss an item without retrying. An anomaly, cycle_limit or course_check item also closes its block; an operator-block: item closes its block when you may unblock it.",
|
|
4854
4854
|
whenNotToUse: "Use item_retry to try again."
|
|
4855
4855
|
},
|
|
4856
4856
|
input: itemInputSchema,
|
|
@@ -5988,4 +5988,4 @@ const remoteDoctorReportSchema = z.object({
|
|
|
5988
5988
|
function assertNever(value) {
|
|
5989
5989
|
throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
|
|
5990
5990
|
}
|
|
5991
|
-
export { ringMarker as $, eventPayloadSchemas as A, requiredSecretKeys as At, sourceCursorSchema as B,
|
|
5991
|
+
export { ringMarker as $, eventPayloadSchemas as A, requiredSecretKeys as At, sourceCursorSchema as B, TODO_GROUP_COLUMN_IDS as Bt, messageRefSchema as C, columnTurnTimings as Ct, sortSkillFiles as D, externalQuietAfterMs as Dt, skillReloadFilesSchema as E, defaultAddressee as Et, defaultBranchFactSchema as F, COLUMN_IDS as Ft, SESSION_HEALTH_STATES as G, PR_STATES as H, isTodoGroupColumn as Ht, entityRefSchema as I, DISPATCHER_MODES as It, parseRingMarker as J, SESSION_STATUSES as K, mirrorSourceId as L, ITEM_KINDS as Lt, MIRROR_FAILURES as M, BLOCK_TYPES as Mt, MIRROR_FAILURE_CODES as N, COLUMNS as Nt, EVENT_KINDS as O, plainHttpAllowed as Ot, batchSchema as P, COLUMN_GROUPS as Pt, prReviewRuleSchema as Q, prSourceId as R, SLACK_BOT_SCOPES as Rt, interactionRefSchema as S, boardWideSpurProject as St, skillReloadFileSchema as T, configSchema as Tt, REVIEW_DECISIONS as U, trackerSourceId as V, VIAS as Vt, REVIEW_STATES as W, prFactsSchema as X, prApprovalPairSchema as Y, prRefSchema as Z, renderJsonError as _, DEFAULT_SLACK_APP_NAME as _t, requestHashOf as a, encodeActorId as at, conversationRefSchema as b, RESERVED_PROJECT as bt, tokenRequestStatusSchema as c, parseRef as ct, buildCatalogSnapshot as d, errorContextSchema as dt, sessionFactsSchema as et, roleCanUseOperation as f, errorEnvelopeSchema as ft, renderHttpProblem as g, DEFAULT_LINK as gt, turnHandedSchema as h, DEFAULT_HTTP_PORT as ht, TOKEN_REQUEST_LIMITS as i, actorIdSchema as it, AdapterError as j, resolveWebOrigin as jt, GATE_REASONS as k, readyMirrorOf as kt, BOARD_TICK_MS as l, ERRORS as lt, defaultBranchViewSchema as m, successEnvelopeSchema as mt, doctorReportSchema as n, JIRA_PROJECT_KEY as nt, tokenRequestResultSchema as o, errorCodeOf as ot, OPERATIONS as p, ok as pt, isExternalAuthor as q, remoteDoctorReportSchema as r, REF_NUMBER as rt, tokenRequestSchema as s, parseActorId as st, assertNever as t, ticketFactsSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, err as ut, renderMcpError as v, DEFAULT_SLACK_COMMAND as vt, userIdSchema as w, configBindings as wt, inboundEventSchema as x, approvalRuleOf as xt, SPACE_IDS as y, DEFAULT_STAND_PORT_RANGE as yt, sessionTransitionSchema as z, TASK_HOLDS as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as renderJsonError, c as tokenRequestStatusSchema, dt as errorContextSchema, ft as errorEnvelopeSchema, lt as ERRORS, mt as successEnvelopeSchema, o as tokenRequestResultSchema } from "./chunk-
|
|
1
|
+
import { _ as renderJsonError, c as tokenRequestStatusSchema, dt as errorContextSchema, ft as errorEnvelopeSchema, lt as ERRORS, mt as successEnvelopeSchema, o as tokenRequestResultSchema } from "./chunk-6hZvXPE0.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ot as plainHttpAllowed, Tt as configSchema, d as buildCatalogSnapshot, p as OPERATIONS } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { Ot as plainHttpAllowed, Tt as configSchema, d as buildCatalogSnapshot, p as OPERATIONS } from "./chunk-6hZvXPE0.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-D8IOOBWp.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 { At as requiredSecretKeys, D as sortSkillFiles,
|
|
1
|
+
import { At as requiredSecretKeys, D as sortSkillFiles, Rt as SLACK_BOT_SCOPES, T as skillReloadFileSchema, Tt as configSchema, a as requestHashOf, f as roleCanUseOperation, it as actorIdSchema, jt as resolveWebOrigin, lt as ERRORS, mt as successEnvelopeSchema, p as OPERATIONS, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, yt as DEFAULT_STAND_PORT_RANGE } from "./chunk-6hZvXPE0.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-D8IOOBWp.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-DM0fcX7h.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, tmpdir, userInfo } from "node:os";
|
package/dist/client.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-
|
|
1
|
+
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-D8IOOBWp.mjs";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as ringMarker, A as eventPayloadSchemas, At as requiredSecretKeys, B as sourceCursorSchema, Bt as
|
|
1
|
+
import { $ as ringMarker, A as eventPayloadSchemas, At as requiredSecretKeys, B as sourceCursorSchema, Bt as TODO_GROUP_COLUMN_IDS, C as messageRefSchema, Ct as columnTurnTimings, D as sortSkillFiles, Dt as externalQuietAfterMs, E as skillReloadFilesSchema, Et as defaultAddressee, F as defaultBranchFactSchema, Ft as COLUMN_IDS, G as SESSION_HEALTH_STATES, H as PR_STATES, Ht as isTodoGroupColumn, I as entityRefSchema, It as DISPATCHER_MODES, J as parseRingMarker, K as SESSION_STATUSES, L as mirrorSourceId, Lt as ITEM_KINDS, M as MIRROR_FAILURES, Mt as BLOCK_TYPES, N as MIRROR_FAILURE_CODES, Nt as COLUMNS, O as EVENT_KINDS, Ot as plainHttpAllowed, P as batchSchema, Pt as COLUMN_GROUPS, Q as prReviewRuleSchema, R as prSourceId, Rt as SLACK_BOT_SCOPES, S as interactionRefSchema, St as boardWideSpurProject, Tt as configSchema, U as REVIEW_DECISIONS, V as trackerSourceId, Vt as VIAS, W as REVIEW_STATES, X as prFactsSchema, Y as prApprovalPairSchema, Z as prRefSchema, a as requestHashOf, at as encodeActorId, b as conversationRefSchema, bt as RESERVED_PROJECT, c as tokenRequestStatusSchema, ct as parseRef$1, d as buildCatalogSnapshot, et as sessionFactsSchema, f as roleCanUseOperation, g as renderHttpProblem, gt as DEFAULT_LINK, h as turnHandedSchema, i as TOKEN_REQUEST_LIMITS, it as actorIdSchema, j as AdapterError, jt as resolveWebOrigin, k as GATE_REASONS, kt as readyMirrorOf, l as BOARD_TICK_MS, lt as ERRORS, m as defaultBranchViewSchema, mt as successEnvelopeSchema, n as doctorReportSchema, nt as JIRA_PROJECT_KEY, o as tokenRequestResultSchema, ot as errorCodeOf, p as OPERATIONS, pt as ok, q as isExternalAuthor, rt as REF_NUMBER, s as tokenRequestSchema, st as parseActorId, t as assertNever, tt as ticketFactsSchema, ut as err, vt as DEFAULT_SLACK_COMMAND, w as userIdSchema, wt as configBindings, x as inboundEventSchema, xt as approvalRuleOf, y as SPACE_IDS, z as sessionTransitionSchema, zt as TASK_HOLDS } from "./chunk-6hZvXPE0.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";
|
|
@@ -9076,13 +9076,24 @@ const segment = z.discriminatedUnion("kind", [z.strictObject({
|
|
|
9076
9076
|
kind: z.literal("code"),
|
|
9077
9077
|
text: z.string().regex(/^[^\n]+$/)
|
|
9078
9078
|
})]);
|
|
9079
|
+
/**
|
|
9080
|
+
* A field of an outbox row's payload, or null when the payload is not JSON: `json_extract` throws
|
|
9081
|
+
* on one, and one unreadable row must not fail a lookup made for another row.
|
|
9082
|
+
*/
|
|
9083
|
+
function payloadField(path) {
|
|
9084
|
+
return sql`case when json_valid(payload) then json_extract(payload, ${path}) end`;
|
|
9085
|
+
}
|
|
9079
9086
|
/** The plain summary of `segments`: what is scanned, stored on the item and struck. */
|
|
9080
9087
|
function feedText(segments) {
|
|
9081
9088
|
return segments.map((part) => part.text).join("");
|
|
9082
9089
|
}
|
|
9083
|
-
/**
|
|
9090
|
+
/**
|
|
9091
|
+
* `segments`, when set, is the line's rich form of `text`; a mismatch is never sent. `blockType`
|
|
9092
|
+
* is the type of the operator block the line stands for; lines queued before it existed lack it.
|
|
9093
|
+
*/
|
|
9084
9094
|
const feedLineWithLinkPayload = feedLinePayload.extend({
|
|
9085
9095
|
itemId: id.optional(),
|
|
9096
|
+
blockType: z.enum(BLOCK_TYPES).optional(),
|
|
9086
9097
|
url: z.url().optional(),
|
|
9087
9098
|
actions: z.array(actionPayload).optional(),
|
|
9088
9099
|
exchange: exchange.optional(),
|
|
@@ -9275,8 +9286,11 @@ async function enqueueSkillReload(trx, input) {
|
|
|
9275
9286
|
if (row.id === null) throw new Error("Doorbell cannot be blocked by gateway scan");
|
|
9276
9287
|
return row.inserted;
|
|
9277
9288
|
}
|
|
9278
|
-
/**
|
|
9279
|
-
|
|
9289
|
+
/**
|
|
9290
|
+
* The key includes the item raise, so a restart cannot add a second line. A line with a `parent`
|
|
9291
|
+
* waits for that row's delivery and dies with it.
|
|
9292
|
+
*/
|
|
9293
|
+
async function enqueueFeedLine(trx, input, parent = null) {
|
|
9280
9294
|
return (await insertOutbox(trx, {
|
|
9281
9295
|
kind: "feed.line",
|
|
9282
9296
|
dedupeKey: `feed.line:${input.itemKey}:${String(input.raise)}`,
|
|
@@ -9293,9 +9307,10 @@ async function enqueueFeedLine(trx, input) {
|
|
|
9293
9307
|
taskId: input.taskId ?? void 0,
|
|
9294
9308
|
...input.url === "" ? {} : { url: input.url },
|
|
9295
9309
|
actions: input.actions,
|
|
9296
|
-
...input.segments === void 0 ? {} : { segments: input.segments }
|
|
9310
|
+
...input.segments === void 0 ? {} : { segments: input.segments },
|
|
9311
|
+
...input.blockType === void 0 ? {} : { blockType: input.blockType }
|
|
9297
9312
|
},
|
|
9298
|
-
parent
|
|
9313
|
+
parent,
|
|
9299
9314
|
at: input.at
|
|
9300
9315
|
})).id;
|
|
9301
9316
|
}
|
|
@@ -9577,6 +9592,17 @@ async function enqueueConversationOpen(trx, input) {
|
|
|
9577
9592
|
if (row.inserted && input.commentId !== null) await markCommentPending(trx, input.commentId);
|
|
9578
9593
|
return row.id;
|
|
9579
9594
|
}
|
|
9595
|
+
/**
|
|
9596
|
+
* A block's type and the live `conversation.open` row of its operator thread, null when it has no
|
|
9597
|
+
* such row; null when the block does not exist.
|
|
9598
|
+
*/
|
|
9599
|
+
async function blockThread(trx, blockId) {
|
|
9600
|
+
const row = await trx.selectFrom("block").leftJoin("outbox", (join) => join.on("outbox.dedupe_key", "=", `conversation.open:block:${String(blockId)}`).on("outbox.state", "!=", "dead")).select(["outbox.id", "block.type"]).where("block.id", "=", blockId).executeTakeFirst();
|
|
9601
|
+
return row === void 0 ? null : {
|
|
9602
|
+
parent: row.id,
|
|
9603
|
+
blockType: row.type
|
|
9604
|
+
};
|
|
9605
|
+
}
|
|
9580
9606
|
/** The thread an operator conversation was started in; undefined for every other block. */
|
|
9581
9607
|
async function operatorThread(trx, blockId) {
|
|
9582
9608
|
const row = await trx.selectFrom("conversation").innerJoin("block", "block.id", "conversation.block_id").select("conversation.ref").where("conversation.block_id", "=", blockId).where("block.addressee_spur_project", "is not", null).orderBy("conversation.created_at").executeTakeFirst();
|
|
@@ -9602,7 +9628,7 @@ async function enqueueConversationReply(trx, input) {
|
|
|
9602
9628
|
"conversation.open",
|
|
9603
9629
|
"conversation.reply",
|
|
9604
9630
|
"conversation.close"
|
|
9605
|
-
]).where(
|
|
9631
|
+
]).where(payloadField("$.blockId"), "=", blockId).orderBy("id", "desc").limit(1).executeTakeFirst();
|
|
9606
9632
|
const started = await operatorThread(trx, blockId);
|
|
9607
9633
|
if (tail === void 0 && started === void 0 || tail?.state === "dead") return null;
|
|
9608
9634
|
const payload = {
|
|
@@ -9631,8 +9657,8 @@ async function enqueueConversationClose(trx, input) {
|
|
|
9631
9657
|
"task_id",
|
|
9632
9658
|
"project"
|
|
9633
9659
|
]).where("id", "=", input.blockId).executeTakeFirstOrThrow();
|
|
9634
|
-
const tail = await trx.selectFrom("outbox").select(["id", "state"]).where("kind", "in", ["conversation.open", "conversation.reply"]).where(
|
|
9635
|
-
const open = await trx.selectFrom("outbox").select(["id", "state"]).where("kind", "=", "conversation.open").where(
|
|
9660
|
+
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();
|
|
9661
|
+
const open = await trx.selectFrom("outbox").select(["id", "state"]).where("kind", "=", "conversation.open").where(payloadField("$.blockId"), "=", input.blockId).executeTakeFirst();
|
|
9636
9662
|
const parent = tail?.state === "dead" ? null : tail?.id ?? null;
|
|
9637
9663
|
const conversations = await trx.selectFrom("conversation").select("ref").where("block_id", "=", input.blockId).execute();
|
|
9638
9664
|
const payload = {
|
|
@@ -9767,9 +9793,15 @@ function capPoints(text, max) {
|
|
|
9767
9793
|
const points = Array.from(text);
|
|
9768
9794
|
return points.length <= max ? text : `${points.slice(0, max - 1).join("")}…`;
|
|
9769
9795
|
}
|
|
9770
|
-
/**
|
|
9771
|
-
|
|
9772
|
-
|
|
9796
|
+
/**
|
|
9797
|
+
* Raise one item generation. A repeated raise of an active key is idempotent. An operator block's
|
|
9798
|
+
* line carries the block's type, and its `thread.parent` row holds the line until it is delivered.
|
|
9799
|
+
*/
|
|
9800
|
+
async function raiseItem(trx, input, thread = null) {
|
|
9801
|
+
return raiseItemWith(trx, input, (t, line) => thread === null ? enqueueFeedLine(t, line) : enqueueFeedLine(t, {
|
|
9802
|
+
...line,
|
|
9803
|
+
blockType: thread.blockType
|
|
9804
|
+
}, thread.parent));
|
|
9773
9805
|
}
|
|
9774
9806
|
/**
|
|
9775
9807
|
* Whether the course check `item` forwarded a note: a worker `answer` notification on its block.
|
|
@@ -9880,11 +9912,15 @@ function resolvedLine(by, at, config) {
|
|
|
9880
9912
|
];
|
|
9881
9913
|
}
|
|
9882
9914
|
/**
|
|
9883
|
-
* A feed line: its key, linked when it has a url, then its segments, or its text, as a quote.
|
|
9915
|
+
* A feed line: its key, linked when it has a url, then its segments, or its text, as a quote. An
|
|
9916
|
+
* operator block's line says what Close does right under the key, so a long reason cannot push the
|
|
9917
|
+
* warning off the message with the Close button. Under its delivered `thread` it links the
|
|
9918
|
+
* thread, and for a question says that a reply there answers it; a reply to any other block type
|
|
9919
|
+
* is refused. A line queued before the block type was stored names no type.
|
|
9884
9920
|
*/
|
|
9885
|
-
function feedLineBody(payload) {
|
|
9886
|
-
const { key, url, text, segments } = payload;
|
|
9887
|
-
|
|
9921
|
+
function feedLineBody(payload, thread) {
|
|
9922
|
+
const { key, url, text, segments, itemKey, blockType } = payload;
|
|
9923
|
+
const body = [{
|
|
9888
9924
|
kind: "paragraph",
|
|
9889
9925
|
children: [url === void 0 ? {
|
|
9890
9926
|
kind: "text",
|
|
@@ -9894,13 +9930,51 @@ function feedLineBody(payload) {
|
|
|
9894
9930
|
url,
|
|
9895
9931
|
text: key
|
|
9896
9932
|
}]
|
|
9897
|
-
}
|
|
9933
|
+
}];
|
|
9934
|
+
if (itemKey?.startsWith("operator-block:") === true) {
|
|
9935
|
+
const block = `B${itemKey.slice(15)}`;
|
|
9936
|
+
const close = blockType === "needs_input" ? `Close closes ${block} without an answer.` : blockType === void 0 ? `Close unblocks ${block} without an answer.` : `Close unblocks ${block}.`;
|
|
9937
|
+
const link = thread == null ? null : {
|
|
9938
|
+
kind: "link",
|
|
9939
|
+
url: thread.permalink,
|
|
9940
|
+
text: `the ${block} thread`
|
|
9941
|
+
};
|
|
9942
|
+
body.push({
|
|
9943
|
+
kind: "paragraph",
|
|
9944
|
+
children: link === null ? [{
|
|
9945
|
+
kind: "text",
|
|
9946
|
+
text: close
|
|
9947
|
+
}] : blockType === "needs_input" ? [
|
|
9948
|
+
{
|
|
9949
|
+
kind: "text",
|
|
9950
|
+
text: "Reply in "
|
|
9951
|
+
},
|
|
9952
|
+
link,
|
|
9953
|
+
{
|
|
9954
|
+
kind: "text",
|
|
9955
|
+
text: ` to answer it. ${close}`
|
|
9956
|
+
}
|
|
9957
|
+
] : [
|
|
9958
|
+
{
|
|
9959
|
+
kind: "text",
|
|
9960
|
+
text: "See "
|
|
9961
|
+
},
|
|
9962
|
+
link,
|
|
9963
|
+
{
|
|
9964
|
+
kind: "text",
|
|
9965
|
+
text: `. ${close}`
|
|
9966
|
+
}
|
|
9967
|
+
]
|
|
9968
|
+
});
|
|
9969
|
+
}
|
|
9970
|
+
body.push({
|
|
9898
9971
|
kind: "quote",
|
|
9899
9972
|
children: segments ?? [{
|
|
9900
9973
|
kind: "text",
|
|
9901
9974
|
text
|
|
9902
9975
|
}]
|
|
9903
|
-
}
|
|
9976
|
+
});
|
|
9977
|
+
return body;
|
|
9904
9978
|
}
|
|
9905
9979
|
/** A cleared line: its key line, the struck summary and who resolved it when; no actions. */
|
|
9906
9980
|
function resolvedFeedBody(payload, config) {
|
|
@@ -15887,11 +15961,18 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
15887
15961
|
priority: candidate.priority
|
|
15888
15962
|
};
|
|
15889
15963
|
if (ITEM_POLICY[candidate.kind].block && task !== null && task !== void 0) await raiseAnomaly(trx, config, task, input, stallExecutors.get(candidate.key));
|
|
15890
|
-
else
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15964
|
+
else {
|
|
15965
|
+
const blockId = candidate.key.startsWith("operator-block:") ? itemBlockRef({
|
|
15966
|
+
item_key: candidate.key,
|
|
15967
|
+
block_id: null
|
|
15968
|
+
}) : void 0;
|
|
15969
|
+
const thread = blockId === void 0 ? null : await blockThread(trx, blockId);
|
|
15970
|
+
await raiseItem(trx, {
|
|
15971
|
+
...input,
|
|
15972
|
+
taskId: candidate.taskId,
|
|
15973
|
+
blockId: null
|
|
15974
|
+
}, thread);
|
|
15975
|
+
}
|
|
15895
15976
|
}
|
|
15896
15977
|
}
|
|
15897
15978
|
/**
|
|
@@ -17367,6 +17448,16 @@ function createSender(options) {
|
|
|
17367
17448
|
}
|
|
17368
17449
|
}
|
|
17369
17450
|
/**
|
|
17451
|
+
* A feed line waits for its block's thread only to link it. When the thread post failed for good
|
|
17452
|
+
* or died while its block is still open (its failed post closed or blocked), the line goes on
|
|
17453
|
+
* without a parent, and so without the link. A thread that died because its block closed takes
|
|
17454
|
+
* its line with it. The block comes from the thread's dedupe key, not its payload, so a thread
|
|
17455
|
+
* whose payload is not JSON still releases its line and cannot stall a claim.
|
|
17456
|
+
*/
|
|
17457
|
+
async function detachAbandonedThreads(trx) {
|
|
17458
|
+
await trx.updateTable("outbox").set({ parent_outbox_id: null }).where("kind", "=", "feed.line").where("state", "in", ["pending", "post_failed"]).where("parent_outbox_id", "in", (eb) => eb.selectFrom("outbox as parent").innerJoin("block", (join) => join.on("parent.dedupe_key", "=", sql`'conversation.open:block:' || block.id`)).select("parent.id").where("parent.kind", "=", "conversation.open").where("parent.state", "in", ["post_failed", "dead"]).where("block.state", "=", "open")).execute();
|
|
17459
|
+
}
|
|
17460
|
+
/**
|
|
17370
17461
|
* Raising or refreshing health for `spaces` suspends the 30-min window of every waiting row
|
|
17371
17462
|
* there, so a row that retried before the outage gets a full window once the space recovers.
|
|
17372
17463
|
*/
|
|
@@ -17402,6 +17493,7 @@ function createSender(options) {
|
|
|
17402
17493
|
}
|
|
17403
17494
|
}
|
|
17404
17495
|
await kill(trx, stale, "superseded");
|
|
17496
|
+
await detachAbandonedThreads(trx);
|
|
17405
17497
|
await cascade(trx);
|
|
17406
17498
|
let ranThreshold = false;
|
|
17407
17499
|
if (gateway !== void 0 && !downRecorded && downSince !== void 0 && at - downSince > DOWN_THRESHOLD_MS) {
|
|
@@ -17584,7 +17676,7 @@ function createSender(options) {
|
|
|
17584
17676
|
}] : c.body.kind === "feed.line" && c.body.payload.exchange !== void 0 ? exchangeBody({
|
|
17585
17677
|
...c.body.payload,
|
|
17586
17678
|
exchange: c.body.payload.exchange
|
|
17587
|
-
}) : c.body.kind === "feed.line" ? feedLineBody(c.body.payload) : renderBody(c.body.payload.key, c.body.payload.text),
|
|
17679
|
+
}) : c.body.kind === "feed.line" ? feedLineBody(c.body.payload, c.parent) : renderBody(c.body.payload.key, c.body.payload.text),
|
|
17588
17680
|
...(body.kind === "feed.line" || body.kind === "feed.line.edit") && body.payload.actions !== void 0 ? { actions: body.payload.actions } : {}
|
|
17589
17681
|
};
|
|
17590
17682
|
return {
|
|
@@ -17663,10 +17755,10 @@ function createSender(options) {
|
|
|
17663
17755
|
...isBlock ? { blockId: body.payload.blockId } : { taskId: body.payload.taskId ?? null }
|
|
17664
17756
|
});
|
|
17665
17757
|
if (isBlock) {
|
|
17666
|
-
if (await trx.selectFrom("outbox").select("id").where("kind", "=", "conversation.close").where(
|
|
17758
|
+
if (await trx.selectFrom("outbox").select("id").where("kind", "=", "conversation.close").where(payloadField("$.blockId"), "=", body.payload.blockId).where(payloadField("$.targetConversation"), "=", conversation).executeTakeFirst() !== void 0) await trx.updateTable("outbox").set({
|
|
17667
17759
|
state: "dead",
|
|
17668
17760
|
last_error: "superseded"
|
|
17669
|
-
}).where("parent_outbox_id", "=", c.id).where("kind", "=", "conversation.close").where(
|
|
17761
|
+
}).where("parent_outbox_id", "=", c.id).where("kind", "=", "conversation.close").where(payloadField("$.targetConversation"), "is", null).where("state", "=", "pending").execute();
|
|
17670
17762
|
}
|
|
17671
17763
|
}
|
|
17672
17764
|
if (body.kind === "conversation.close") await trx.updateTable("conversation").set({
|
|
@@ -17782,6 +17874,8 @@ function createSender(options) {
|
|
|
17782
17874
|
};
|
|
17783
17875
|
}
|
|
17784
17876
|
// ../core/src/app/items.ts
|
|
17877
|
+
/** The reason an operator block closes with when the operator closes its feed line. */
|
|
17878
|
+
const FEED_CLOSE_REASON = "closed by the operator from the feed";
|
|
17785
17879
|
async function loadItem(trx, id) {
|
|
17786
17880
|
const item = await trx.selectFrom("operator_item").selectAll().where("id", "=", Number(id.slice(1))).executeTakeFirst();
|
|
17787
17881
|
if (item === void 0) throw new CommandError("not_found", "Check the item ID.");
|
|
@@ -18004,6 +18098,39 @@ function notApplicable(hint) {
|
|
|
18004
18098
|
*/
|
|
18005
18099
|
function createItemMutations(deps) {
|
|
18006
18100
|
const resolveTargets = (trx, input) => itemTarget(trx, deps.config, input);
|
|
18101
|
+
const unblock = createBlockMutations(deps.config).unblock;
|
|
18102
|
+
const unblockGrants = OPERATIONS.find((op) => op.id === "block.unblock")?.grants ?? [];
|
|
18103
|
+
/**
|
|
18104
|
+
* Closes the open operator-addressed block an `operator-block:` item names, as the operator's
|
|
18105
|
+
* unblock. A closed block, an agent's block, an archived task or a caller `block.unblock` would
|
|
18106
|
+
* refuse (a session whose project no longer holds the block) leaves the block as it is.
|
|
18107
|
+
*/
|
|
18108
|
+
async function closeOperatorBlock(trx, item, ctx) {
|
|
18109
|
+
const blockId = itemBlockRef(item);
|
|
18110
|
+
if (blockId === void 0) return;
|
|
18111
|
+
const block = await trx.selectFrom("block").select([
|
|
18112
|
+
"state",
|
|
18113
|
+
"addressee_role",
|
|
18114
|
+
"task_id"
|
|
18115
|
+
]).where("id", "=", blockId).executeTakeFirst();
|
|
18116
|
+
if (block?.state !== "open" || block.addressee_role !== "operator") return;
|
|
18117
|
+
if (block.task_id !== null) {
|
|
18118
|
+
if ((await trx.selectFrom("task").select("membership").where("id", "=", block.task_id).executeTakeFirstOrThrow()).membership === "archived") return;
|
|
18119
|
+
}
|
|
18120
|
+
const input = {
|
|
18121
|
+
mode: "reason",
|
|
18122
|
+
block: `B${String(blockId)}`,
|
|
18123
|
+
reason: FEED_CLOSE_REASON
|
|
18124
|
+
};
|
|
18125
|
+
const [target = { kind: "missing" }] = await unblock.resolveTargets(trx, input, ctx.actor);
|
|
18126
|
+
const state = {
|
|
18127
|
+
config: deps.config,
|
|
18128
|
+
target,
|
|
18129
|
+
mode: input.mode
|
|
18130
|
+
};
|
|
18131
|
+
if (authorize(unblockGrants, ctx.actor, state).status !== "allowed") return;
|
|
18132
|
+
await unblock.run(trx, input, ctx);
|
|
18133
|
+
}
|
|
18007
18134
|
/** Runs the retry behind the item's kind; false when the item must stay raised. */
|
|
18008
18135
|
async function retryAction(trx, item, at) {
|
|
18009
18136
|
const closeHint = `close it with \`board item close I${String(item.id)}\`.`;
|
|
@@ -18060,6 +18187,7 @@ function createItemMutations(deps) {
|
|
|
18060
18187
|
const reason = `closed as item I${String(item.id)}`;
|
|
18061
18188
|
await closeBlockIfOpen(trx, item.block_id, ctx, "reason", reason);
|
|
18062
18189
|
}
|
|
18190
|
+
if (item.item_key.startsWith("operator-block:")) await closeOperatorBlock(trx, item, ctx);
|
|
18063
18191
|
}
|
|
18064
18192
|
return view(item, task);
|
|
18065
18193
|
}
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { lt as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-
|
|
2
|
-
import { o as CliError, r as requestOperation } from "./chunk-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-
|
|
1
|
+
import { lt as ERRORS, p as OPERATIONS, v as renderMcpError } from "./chunk-6hZvXPE0.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-D8IOOBWp.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DM0fcX7h.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|