spur-board 0.61.0 → 0.62.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-DQwj2UTj.mjs → chunk-Czc8fVqW.mjs} +1 -1
- package/dist/{chunk-CLjE9L59.mjs → chunk-CzdGYlBy.mjs} +40 -2
- package/dist/{chunk-BLpo-8dp.mjs → chunk-DyPssI65.mjs} +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +361 -35
- package/dist/mcp.mjs +3 -3
- package/dist/migrations/0020_block_addressee_spur.sql +3 -0
- package/package.json +1 -1
- package/skills/spur-board/references/commands.md +1 -1
- package/skills/spur-board/references/how-board-works.md +19 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as errorEnvelopeSchema, Q as errorContextSchema, S as renderJsonError, X as ERRORS, c as tokenRequestStatusSchema, o as tokenRequestResultSchema, tt as successEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { $ as errorEnvelopeSchema, Q as errorContextSchema, S as renderJsonError, X as ERRORS, c as tokenRequestStatusSchema, o as tokenRequestResultSchema, tt as successEnvelopeSchema } from "./chunk-CzdGYlBy.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
@@ -295,6 +295,7 @@ const spurProject = z.strictObject({
|
|
|
295
295
|
"curator",
|
|
296
296
|
"orchestrator"
|
|
297
297
|
]).describe("worker: sessions of this Spur project may link to this project's tasks through their PR or branch. operator: sessions act as the operator. orchestrator: sessions execute named columns and never become task workers. curator: sessions answer the questions no column orchestrator takes and escalate the rest to the operator; a board project has at most one."),
|
|
298
|
+
shortName: z.string().regex(/^[a-z0-9][a-z0-9_-]{0,31}$/, "Expected a short name of lowercase letters, digits, _ and -, starting with a letter or digit, at most 32 characters").optional().describe("The name the operator types as @<shortName> at the start of a new message in the orchestrators channel to start a conversation with this Spur project's live session. Unique across the board."),
|
|
298
299
|
displayName: nonEmpty.max(80).optional().describe("The name a curator's answer lines in the feed are posted under. Defaults to the Spur project name. Only for a curator."),
|
|
299
300
|
icon: z.string().regex(/^:[a-z0-9_+'-]+:$/, "Expected an emoji shortcode such as :owl:").optional().describe("The emoji shortcode, such as :owl:, shown on a curator's answer lines in the feed instead of the curator icon. Only for a curator.")
|
|
300
301
|
});
|
|
@@ -479,11 +480,32 @@ function rejectSharedSpurProjects(items, ctx) {
|
|
|
479
480
|
});
|
|
480
481
|
});
|
|
481
482
|
}
|
|
483
|
+
/** A `shortName` addresses one Spur project, so it is unique across every board project. */
|
|
484
|
+
function rejectSharedShortNames(items, ctx) {
|
|
485
|
+
const seen = /* @__PURE__ */ new Set();
|
|
486
|
+
items.forEach((project, i) => {
|
|
487
|
+
project.spurProjects.forEach(({ shortName }, j) => {
|
|
488
|
+
if (shortName === void 0) return;
|
|
489
|
+
if (seen.has(shortName)) ctx.addIssue({
|
|
490
|
+
code: "custom",
|
|
491
|
+
path: [
|
|
492
|
+
i,
|
|
493
|
+
"spurProjects",
|
|
494
|
+
j,
|
|
495
|
+
"shortName"
|
|
496
|
+
],
|
|
497
|
+
message: `Duplicate short name: ${JSON.stringify(shortName)}`
|
|
498
|
+
});
|
|
499
|
+
seen.add(shortName);
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
}
|
|
482
503
|
/** The board config file. Every object rejects unknown keys; no key holds a secret. */
|
|
483
504
|
const configSchema = z.strictObject({
|
|
484
505
|
projects: z.array(projectSchema).min(1).superRefine((items, ctx) => {
|
|
485
506
|
rejectDuplicates(items, "id", "project id", ctx);
|
|
486
507
|
rejectSharedSpurProjects(items, ctx);
|
|
508
|
+
rejectSharedShortNames(items, ctx);
|
|
487
509
|
}).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."),
|
|
488
510
|
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.") }),
|
|
489
511
|
slack: z.strictObject({
|
|
@@ -493,7 +515,8 @@ const configSchema = z.strictObject({
|
|
|
493
515
|
channels: z.strictObject({
|
|
494
516
|
orchestrators: nonEmpty.optional().describe("Slack channel ID, such as C0123456789, where the board opens a thread for each block addressed to the operator by someone else. Once either channel is set, the daemon does not start without the other channel and SLACK_BOT_TOKEN, and without SLACK_APP_TOKEN it reads nothing from Slack."),
|
|
495
517
|
feed: nonEmpty.optional().describe("Slack channel ID where the board posts a line for each curator answer, each newly installed version, each revoked operator token, each `/board tokens` list and each operator item, with the buttons the operator presses. Operator items about failed Slack posts, transport health, undelivered answers and ended workers, and those shown as operator blocks, get no feed line. A line whose item clears before it is first sent, such as an expired token request, is dropped. Set it together with orchestrators.")
|
|
496
|
-
}).prefault({})
|
|
518
|
+
}).prefault({}),
|
|
519
|
+
defaultAddressee: z.string().optional().describe("The shortName of the Spur project that gets a new orchestrators-channel message which does not start with a known @<shortName>. Without it, such a message gets one reply listing the valid prefixes. Ignored when no shortName is configured.")
|
|
497
520
|
}).prefault({}),
|
|
498
521
|
thresholds: z.strictObject({
|
|
499
522
|
staleMultiplier: z.number().min(1).default(3).describe("A source with no complete poll for this many of its poll intervals turns blind stale. board status marks that source, and an operator item whose fact is older than that, as stale."),
|
|
@@ -542,6 +565,14 @@ const configSchema = z.strictObject({
|
|
|
542
565
|
maxEpisodeMs: durationMs(3e5, "Longest a host-load episode lasts before error flags resume")
|
|
543
566
|
}).prefault({})
|
|
544
567
|
}).prefault({})
|
|
568
|
+
}).superRefine((config, ctx) => {
|
|
569
|
+
const addressee = config.slack.defaultAddressee;
|
|
570
|
+
if (addressee === void 0) return;
|
|
571
|
+
if (!config.projects.some((project) => project.spurProjects.some(({ shortName }) => shortName === addressee))) ctx.addIssue({
|
|
572
|
+
code: "custom",
|
|
573
|
+
path: ["slack", "defaultAddressee"],
|
|
574
|
+
message: `Unknown short name ${JSON.stringify(addressee)}: set it as projects[].spurProjects[].shortName first`
|
|
575
|
+
});
|
|
545
576
|
});
|
|
546
577
|
/** Recognized names in the private secrets.env file; values never belong in config.yaml. */
|
|
547
578
|
const SECRET_ENV_KEYS = [
|
|
@@ -1590,6 +1621,11 @@ const text$1 = z.string();
|
|
|
1590
1621
|
const sourceUrl = z.url();
|
|
1591
1622
|
/** Configured board space for an interaction, or null when it came from outside. */
|
|
1592
1623
|
const sourceSpace = z.enum(SPACE_IDS).nullable();
|
|
1624
|
+
/**
|
|
1625
|
+
* Configured board space of a conversation's first message, set only when `rootMessage` equals
|
|
1626
|
+
* `message`; a reply in a conversation carries none.
|
|
1627
|
+
*/
|
|
1628
|
+
const firstMessageSpace = sourceSpace.optional();
|
|
1593
1629
|
const messageEventSchema = z.strictObject({
|
|
1594
1630
|
kind: z.literal("message"),
|
|
1595
1631
|
dedupeKey,
|
|
@@ -1600,6 +1636,7 @@ const messageEventSchema = z.strictObject({
|
|
|
1600
1636
|
author: userIdSchema,
|
|
1601
1637
|
text: text$1,
|
|
1602
1638
|
at: at$1,
|
|
1639
|
+
sourceSpace: firstMessageSpace,
|
|
1603
1640
|
originKey: z.string().min(1).optional()
|
|
1604
1641
|
});
|
|
1605
1642
|
/** `message` is the original message, `text` the new text and `at` the edit time. */
|
|
@@ -1671,6 +1708,7 @@ const mentionEventSchema = z.strictObject({
|
|
|
1671
1708
|
author: userIdSchema,
|
|
1672
1709
|
text: text$1,
|
|
1673
1710
|
at: at$1,
|
|
1711
|
+
sourceSpace: firstMessageSpace,
|
|
1674
1712
|
originKey: z.string().min(1).optional()
|
|
1675
1713
|
});
|
|
1676
1714
|
/** History may be missing. Without `conversation` the gap covers the whole gateway. */
|
|
@@ -3260,7 +3298,7 @@ const OPERATIONS = [
|
|
|
3260
3298
|
defineOperation({
|
|
3261
3299
|
id: "block.answer",
|
|
3262
3300
|
kind: "mutation",
|
|
3263
|
-
description: "Answer a question
|
|
3301
|
+
description: "Answer a question; the block closes unless it is an operator conversation.",
|
|
3264
3302
|
mcp: {
|
|
3265
3303
|
whenToUse: "Answer an open question.",
|
|
3266
3304
|
whenNotToUse: "Use block_unblock to close without an answer."
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as buildCatalogSnapshot, ct as plainHttpAllowed, st as configSchema, y as OPERATIONS } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { _ as buildCatalogSnapshot, ct as plainHttpAllowed, st as configSchema, y as OPERATIONS } from "./chunk-CzdGYlBy.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-Czc8fVqW.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 { G as actorIdSchema, X as ERRORS, a as requestHashOf, ft as SLACK_BOT_SCOPES, lt as requiredSecretKeys, r as remoteDoctorReportSchema, st as configSchema, tt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-
|
|
1
|
+
import { G as actorIdSchema, X as ERRORS, a as requestHashOf, ft as SLACK_BOT_SCOPES, lt as requiredSecretKeys, r as remoteDoctorReportSchema, st as configSchema, tt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-CzdGYlBy.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
|
|
3
|
-
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-
|
|
4
|
-
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-
|
|
3
|
+
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-Czc8fVqW.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-DyPssI65.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, userInfo } from "node:os";
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-Czc8fVqW.mjs";
|
|
2
2
|
export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as EVENT_KINDS, B as ringMarker, D as interactionRefSchema, E as inboundEventSchema, F as SESSION_STATUSES, G as actorIdSchema, H as ticketFactsSchema, I as isExternalAuthor, J as parseActorId, K as encodeActorId, L as parseRingMarker, M as PR_STATES, N as REVIEW_STATES, O as messageRefSchema, P as SESSION_HEALTH_STATES, R as prFactsSchema, T as conversationRefSchema, U as JIRA_PROJECT_KEY, V as sessionFactsSchema, W as REF_NUMBER, X as ERRORS, Y as parseRef$1, Z as err, _ as buildCatalogSnapshot, a as requestHashOf, at as DEFAULT_SLACK_COMMAND, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as plainHttpAllowed, d as AdapterError, dt as DISPATCHER_MODES, et as ok, f as batchSchema, ft as SLACK_BOT_SCOPES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as requiredSecretKeys, m as prSourceId, n as doctorReportSchema, o as tokenRequestResultSchema, ot as RESERVED_PROJECT, p as entityRefSchema, pt as TASK_HOLDS, q as errorCodeOf, rt as DEFAULT_LINK, s as tokenRequestSchema, st as configSchema, t as assertNever, tt as successEnvelopeSchema, ut as COLUMN_IDS, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as prRefSchema } from "./chunk-
|
|
1
|
+
import { A as EVENT_KINDS, B as ringMarker, D as interactionRefSchema, E as inboundEventSchema, F as SESSION_STATUSES, G as actorIdSchema, H as ticketFactsSchema, I as isExternalAuthor, J as parseActorId, K as encodeActorId, L as parseRingMarker, M as PR_STATES, N as REVIEW_STATES, O as messageRefSchema, P as SESSION_HEALTH_STATES, R as prFactsSchema, T as conversationRefSchema, U as JIRA_PROJECT_KEY, V as sessionFactsSchema, W as REF_NUMBER, X as ERRORS, Y as parseRef$1, Z as err, _ as buildCatalogSnapshot, a as requestHashOf, at as DEFAULT_SLACK_COMMAND, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as plainHttpAllowed, d as AdapterError, dt as DISPATCHER_MODES, et as ok, f as batchSchema, ft as SLACK_BOT_SCOPES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as requiredSecretKeys, m as prSourceId, n as doctorReportSchema, o as tokenRequestResultSchema, ot as RESERVED_PROJECT, p as entityRefSchema, pt as TASK_HOLDS, q as errorCodeOf, rt as DEFAULT_LINK, s as tokenRequestSchema, st as configSchema, t as assertNever, tt as successEnvelopeSchema, ut as COLUMN_IDS, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as prRefSchema } from "./chunk-CzdGYlBy.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -543,6 +543,8 @@ function matches(rule, actor, target, config) {
|
|
|
543
543
|
case "column-orchestrator": return target.task !== null && orchestrator$1(actor, target, config, target.task.column);
|
|
544
544
|
case "block-addressee": {
|
|
545
545
|
if (target.block === null) return false;
|
|
546
|
+
const spur = target.block.addressee_spur_project ?? null;
|
|
547
|
+
if (spur !== null) return parsed?.actor === "agent" && parsed.actorRef.project === spur;
|
|
546
548
|
const addressee = parseAddressee(target.block.addressee_role);
|
|
547
549
|
switch (addressee.kind) {
|
|
548
550
|
case "operator": return isOperator(actor, config);
|
|
@@ -8542,7 +8544,8 @@ const ITEM_KINDS = [
|
|
|
8542
8544
|
"turn",
|
|
8543
8545
|
"anomaly",
|
|
8544
8546
|
"cycle_limit",
|
|
8545
|
-
"course_check"
|
|
8547
|
+
"course_check",
|
|
8548
|
+
"conversation_waiting"
|
|
8546
8549
|
];
|
|
8547
8550
|
const ITEM_POLICY = {
|
|
8548
8551
|
token_request: {
|
|
@@ -8671,6 +8674,15 @@ const ITEM_POLICY = {
|
|
|
8671
8674
|
buttons: "item",
|
|
8672
8675
|
reconciled: false,
|
|
8673
8676
|
block: true
|
|
8677
|
+
},
|
|
8678
|
+
/** An operator conversation whose ring waits for a live session of its Spur project. */
|
|
8679
|
+
conversation_waiting: {
|
|
8680
|
+
retry: "none",
|
|
8681
|
+
feed: false,
|
|
8682
|
+
priority: 4,
|
|
8683
|
+
buttons: "item",
|
|
8684
|
+
reconciled: true,
|
|
8685
|
+
block: false
|
|
8674
8686
|
}
|
|
8675
8687
|
};
|
|
8676
8688
|
/** Guards a stored kind: the column is free text and old or hand-written rows may hold others. */
|
|
@@ -8783,6 +8795,7 @@ const OUTBOX_KINDS = [
|
|
|
8783
8795
|
"conversation.open",
|
|
8784
8796
|
"conversation.reply",
|
|
8785
8797
|
"conversation.close",
|
|
8798
|
+
"conversation.notice",
|
|
8786
8799
|
"feed.line",
|
|
8787
8800
|
"feed.line.edit",
|
|
8788
8801
|
"doorbell"
|
|
@@ -8792,6 +8805,7 @@ const KIND_SPACE = {
|
|
|
8792
8805
|
"conversation.open": "orchestrators",
|
|
8793
8806
|
"conversation.reply": "orchestrators",
|
|
8794
8807
|
"conversation.close": "orchestrators",
|
|
8808
|
+
"conversation.notice": "orchestrators",
|
|
8795
8809
|
"feed.line": "feed",
|
|
8796
8810
|
"feed.line.edit": "feed",
|
|
8797
8811
|
doorbell: null
|
|
@@ -8801,6 +8815,7 @@ const KIND_PRIORITY = {
|
|
|
8801
8815
|
"conversation.open": 0,
|
|
8802
8816
|
"conversation.reply": 0,
|
|
8803
8817
|
"conversation.close": 1,
|
|
8818
|
+
"conversation.notice": 0,
|
|
8804
8819
|
"feed.line": 2,
|
|
8805
8820
|
"feed.line.edit": 2,
|
|
8806
8821
|
doorbell: 0
|
|
@@ -8824,6 +8839,13 @@ const closePayload = z.strictObject({
|
|
|
8824
8839
|
});
|
|
8825
8840
|
const openPayload = closePayload.extend({ title: z.string().min(1) });
|
|
8826
8841
|
const replyPayload = closePayload.extend({ commentId: id });
|
|
8842
|
+
/** A board reply in a thread the operator started that opened no block; `key` names the board. */
|
|
8843
|
+
const noticePayload = z.strictObject({
|
|
8844
|
+
key: z.string().min(1),
|
|
8845
|
+
text: z.string().min(1),
|
|
8846
|
+
persona,
|
|
8847
|
+
targetConversation: conversationRefSchema
|
|
8848
|
+
});
|
|
8827
8849
|
const feedLineEditPayload = z.strictObject({
|
|
8828
8850
|
key: z.string().min(1),
|
|
8829
8851
|
text: z.string(),
|
|
@@ -8916,6 +8938,10 @@ const outboxBodySchema = z.discriminatedUnion("kind", [
|
|
|
8916
8938
|
kind: z.literal("conversation.close"),
|
|
8917
8939
|
payload: closePayload
|
|
8918
8940
|
}),
|
|
8941
|
+
z.strictObject({
|
|
8942
|
+
kind: z.literal("conversation.notice"),
|
|
8943
|
+
payload: noticePayload
|
|
8944
|
+
}),
|
|
8919
8945
|
z.strictObject({
|
|
8920
8946
|
kind: z.literal("feed.line"),
|
|
8921
8947
|
payload: feedLineWithLinkPayload
|
|
@@ -9374,10 +9400,17 @@ async function enqueueConversationOpen(trx, input) {
|
|
|
9374
9400
|
if (row.inserted && input.commentId !== null) await markCommentPending(trx, input.commentId);
|
|
9375
9401
|
return row.id;
|
|
9376
9402
|
}
|
|
9403
|
+
/** The thread an operator conversation was started in; undefined for every other block. */
|
|
9404
|
+
async function operatorThread(trx, blockId) {
|
|
9405
|
+
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();
|
|
9406
|
+
return row === void 0 ? void 0 : conversationRefSchema.parse(row.ref);
|
|
9407
|
+
}
|
|
9377
9408
|
/**
|
|
9378
9409
|
* Writes the `conversation.reply` row of a later comment on a block whose open row exists.
|
|
9379
9410
|
* The row waits for the thread's latest open, reply or close row. Returns null and writes
|
|
9380
|
-
* nothing when there is no such row or it is dead: a dead thread takes no more replies.
|
|
9411
|
+
* nothing when there is no such row or it is dead: a dead thread takes no more replies. A block
|
|
9412
|
+
* with no open row, an operator conversation, replies in its registered thread
|
|
9413
|
+
* (`targetConversation`), after its earlier replies.
|
|
9381
9414
|
*/
|
|
9382
9415
|
async function enqueueConversationReply(trx, input) {
|
|
9383
9416
|
const comment = await trx.selectFrom("comment").select([
|
|
@@ -9393,20 +9426,22 @@ async function enqueueConversationReply(trx, input) {
|
|
|
9393
9426
|
"conversation.reply",
|
|
9394
9427
|
"conversation.close"
|
|
9395
9428
|
]).where(sql`json_extract(payload, '$.blockId')`, "=", blockId).orderBy("id", "desc").limit(1).executeTakeFirst();
|
|
9396
|
-
|
|
9429
|
+
const started = await operatorThread(trx, blockId);
|
|
9430
|
+
if (tail === void 0 && started === void 0 || tail?.state === "dead") return null;
|
|
9397
9431
|
const payload = {
|
|
9398
9432
|
key: (await rowSubject(trx, comment)).key,
|
|
9399
9433
|
text: comment.text,
|
|
9400
9434
|
persona: input.persona,
|
|
9401
9435
|
taskId: comment.task_id,
|
|
9402
9436
|
blockId,
|
|
9403
|
-
commentId: comment.id
|
|
9437
|
+
commentId: comment.id,
|
|
9438
|
+
...started === void 0 ? {} : { targetConversation: started }
|
|
9404
9439
|
};
|
|
9405
9440
|
const row = await insertOutbox(trx, {
|
|
9406
9441
|
kind: "conversation.reply",
|
|
9407
9442
|
dedupeKey: `conversation.reply:comment:${String(comment.id)}`,
|
|
9408
9443
|
payload,
|
|
9409
|
-
parent: tail
|
|
9444
|
+
parent: tail?.id ?? null,
|
|
9410
9445
|
at: input.at
|
|
9411
9446
|
});
|
|
9412
9447
|
if (row.inserted) await markCommentPending(trx, comment.id);
|
|
@@ -9460,6 +9495,29 @@ async function enqueueConversationClose(trx, input) {
|
|
|
9460
9495
|
closed_at: input.at.toISOString()
|
|
9461
9496
|
}).where("block_id", "=", input.blockId).where("state", "=", "open").execute();
|
|
9462
9497
|
}
|
|
9498
|
+
/**
|
|
9499
|
+
* Posts one board line in a thread the operator started that opened nothing, such as the list of
|
|
9500
|
+
* valid addressees. It names no block or comment; each thread gets it once.
|
|
9501
|
+
*/
|
|
9502
|
+
async function enqueueConversationNotice(trx, input) {
|
|
9503
|
+
const hash = createHash("sha256").update(input.conversation).digest("hex");
|
|
9504
|
+
const payload = {
|
|
9505
|
+
key: "board",
|
|
9506
|
+
text: input.text,
|
|
9507
|
+
persona: {
|
|
9508
|
+
name: "board",
|
|
9509
|
+
role: "board"
|
|
9510
|
+
},
|
|
9511
|
+
targetConversation: input.conversation
|
|
9512
|
+
};
|
|
9513
|
+
await insertOutbox(trx, {
|
|
9514
|
+
kind: "conversation.notice",
|
|
9515
|
+
dedupeKey: `conversation.notice:ref:${hash}`,
|
|
9516
|
+
payload,
|
|
9517
|
+
parent: null,
|
|
9518
|
+
at: input.at
|
|
9519
|
+
});
|
|
9520
|
+
}
|
|
9463
9521
|
//#endregion
|
|
9464
9522
|
//#region ../core/src/app/block-thread.ts
|
|
9465
9523
|
function orchestrator(config, task) {
|
|
@@ -9907,6 +9965,10 @@ async function registerRemovedNotification(trx, block, at) {
|
|
|
9907
9965
|
}
|
|
9908
9966
|
/** Register an answer or clarification for the question's author, unless the author wrote it. */
|
|
9909
9967
|
async function registerAnswerNotification(trx, input, at) {
|
|
9968
|
+
if (input.block.addressee_spur_project !== null) {
|
|
9969
|
+
await registerConversationFollowUp(trx, input, at);
|
|
9970
|
+
return;
|
|
9971
|
+
}
|
|
9910
9972
|
const parsed = parseActorId(input.block.author);
|
|
9911
9973
|
if (parsed?.actor !== "agent" || input.actor === input.block.author) return;
|
|
9912
9974
|
const actor = parseActorId(input.actor);
|
|
@@ -9929,6 +9991,37 @@ async function registerAnswerNotification(trx, input, at) {
|
|
|
9929
9991
|
}).onConflict((oc) => oc.column("source_key").doNothing()).execute();
|
|
9930
9992
|
}
|
|
9931
9993
|
/**
|
|
9994
|
+
* Register the addressee's ring for an operator's follow-up in an open operator conversation. An
|
|
9995
|
+
* agent's answer rings nobody: the operator reads it in the thread.
|
|
9996
|
+
*/
|
|
9997
|
+
async function registerConversationFollowUp(trx, input, at) {
|
|
9998
|
+
if (input.actor !== "operator" || input.block.state !== "open") return;
|
|
9999
|
+
await trx.insertInto("notification").values({
|
|
10000
|
+
source_key: `comment:${String(input.commentId)}:${String(input.revision)}`,
|
|
10001
|
+
kind: "answer",
|
|
10002
|
+
task_id: input.block.task_id,
|
|
10003
|
+
block_id: input.block.id,
|
|
10004
|
+
comment_id: input.commentId,
|
|
10005
|
+
revision: input.revision,
|
|
10006
|
+
role: input.block.addressee_role,
|
|
10007
|
+
author_session: null,
|
|
10008
|
+
recipient_session: null,
|
|
10009
|
+
next_at: at.toISOString(),
|
|
10010
|
+
last_outbox_id: null,
|
|
10011
|
+
acked_at: null,
|
|
10012
|
+
exhausted_at: null,
|
|
10013
|
+
created_at: at.toISOString()
|
|
10014
|
+
}).onConflict((oc) => oc.column("source_key").doNothing()).execute();
|
|
10015
|
+
}
|
|
10016
|
+
/**
|
|
10017
|
+
* The Spur project an operator conversation's notification is addressed to, or null for every
|
|
10018
|
+
* other notification. It routes the ring before the role does.
|
|
10019
|
+
*/
|
|
10020
|
+
async function conversationTarget(trx, n) {
|
|
10021
|
+
if (n.block_id === void 0 || n.block_id === null) return null;
|
|
10022
|
+
return (await trx.selectFrom("block").select("addressee_spur_project").where("id", "=", n.block_id).executeTakeFirst())?.addressee_spur_project ?? null;
|
|
10023
|
+
}
|
|
10024
|
+
/**
|
|
9932
10025
|
* Register the worker's ring for a course note: the curator's answer to a course check, copied to
|
|
9933
10026
|
* the task. It names the course block, and until its first ring is delivered the worker's other
|
|
9934
10027
|
* rings on the task stay held (`courseHold`), so the worker reads the decision first.
|
|
@@ -9957,10 +10050,15 @@ const courseBlocks = (eb) => eb.selectFrom("operator_item").select("operator_ite
|
|
|
9957
10050
|
* Whether a worker notification is held by a course check on its task. Two holds apply: while a
|
|
9958
10051
|
* `course_check` item is active, and, once it clears with a note, until the note's first ring is
|
|
9959
10052
|
* delivered to any session, so the note rings first. A course note is a worker `answer`
|
|
9960
|
-
* notification on a course check's block. Other roles and `cycle_limit`
|
|
10053
|
+
* notification on a course check's block. Other roles, operator conversations and `cycle_limit`
|
|
10054
|
+
* items hold no ring.
|
|
9961
10055
|
*/
|
|
9962
10056
|
function courseHold(eb) {
|
|
9963
|
-
return eb.and([
|
|
10057
|
+
return eb.and([
|
|
10058
|
+
eb("notification.role", "=", "worker"),
|
|
10059
|
+
eb.not(eb.exists(eb.selectFrom("block").select("block.id").whereRef("block.id", "=", "notification.block_id").where("block.addressee_spur_project", "is not", null))),
|
|
10060
|
+
eb.or([eb.exists(eb.selectFrom("operator_item").select("operator_item.id").where("operator_item.kind", "=", "course_check").whereRef("operator_item.task_id", "=", "notification.task_id").where("operator_item.cleared_at", "is", null)), eb.and([eb.not(eb.and([eb("notification.kind", "=", "answer"), eb("notification.block_id", "in", courseBlocks(eb))])), eb.exists(eb.selectFrom("notification as note").select("note.id").whereRef("note.task_id", "=", "notification.task_id").where("note.role", "=", "worker").where("note.kind", "=", "answer").where("note.block_id", "in", courseBlocks(eb)).where("note.rings", "=", 0).where("note.acked_at", "is", null).where("note.exhausted_at", "is", null).where((inner) => inner.not(inner.exists(inner.selectFrom("outbox").select("outbox.id").where(sql`+outbox.state`, "=", "done").where("outbox.dedupe_key", ">", sql`'doorbell:' || ${sql.ref("note.id")} || ':'`).where("outbox.dedupe_key", "<", sql`'doorbell:' || ${sql.ref("note.id")} || ';'`)))))])])
|
|
10061
|
+
]);
|
|
9964
10062
|
}
|
|
9965
10063
|
/**
|
|
9966
10064
|
* Moves a block to a new addressee, for `block.escalate` and for a ring series that ended: the
|
|
@@ -10064,6 +10162,8 @@ function columnOrchestratorProject(config, projectId, column) {
|
|
|
10064
10162
|
*/
|
|
10065
10163
|
async function selectNotificationRecipient(trx, n, config) {
|
|
10066
10164
|
if (n.kind === "turn_reminder") return n.author_session === null ? void 0 : liveSession(trx, n.author_session);
|
|
10165
|
+
const target = await conversationTarget(trx, n);
|
|
10166
|
+
if (target !== null) return bestProjectSession(trx, target);
|
|
10067
10167
|
const addressee = parseAddressee(n.role);
|
|
10068
10168
|
switch (addressee.kind) {
|
|
10069
10169
|
case "curator": return curatorSession(trx, config, await noticeProject(trx, n));
|
|
@@ -10112,7 +10212,7 @@ async function endNotification(trx, n, subject, end) {
|
|
|
10112
10212
|
if (n.rings === 0) await releaseAfterCourseNote(trx, n, at);
|
|
10113
10213
|
const addressee = parseAddressee(n.role);
|
|
10114
10214
|
const { task } = subject;
|
|
10115
|
-
if (n.kind === "block" && task !== null && (addressee.kind === "curator" || session === null)) await moveBlockToAddressee(trx, {
|
|
10215
|
+
if (n.kind === "block" && task !== null && (addressee.kind === "curator" || session === null) && await conversationTarget(trx, n) === null) await moveBlockToAddressee(trx, {
|
|
10116
10216
|
task,
|
|
10117
10217
|
block: await trx.selectFrom("block").selectAll().where("id", "=", noticeBlockId(n)).executeTakeFirstOrThrow(),
|
|
10118
10218
|
to: "operator",
|
|
@@ -10181,9 +10281,10 @@ async function ringUndelivered(trx, input) {
|
|
|
10181
10281
|
* Why a notification with no recipient ends now, or null when it stays due for a next session. A
|
|
10182
10282
|
* curator block, and an orchestrator block of a course check, end with `session: null`, which
|
|
10183
10283
|
* `endNotification` turns into a move to the operator. A worker's answer on a project-level block
|
|
10184
|
-
* goes only to the session that asked.
|
|
10284
|
+
* goes only to the session that asked. An operator conversation's notification never ends here.
|
|
10185
10285
|
*/
|
|
10186
10286
|
async function noRecipientEnd(trx, n) {
|
|
10287
|
+
if (await conversationTarget(trx, n) !== null) return null;
|
|
10187
10288
|
if (n.kind === "removed" || n.kind === "turn_reminder" || n.kind === "answer" && n.role === "operator" || n.kind === "answer" && n.role === "worker" && n.task_id === null) return "no live addressee";
|
|
10188
10289
|
if (n.kind !== "block") return null;
|
|
10189
10290
|
if (n.role === "curator") return "no live curator session";
|
|
@@ -10221,7 +10322,7 @@ async function reconcileDoorbells(trx, at, config) {
|
|
|
10221
10322
|
const due = await dueNotifications(trx, at).selectAll("notification").orderBy("notification.id").execute();
|
|
10222
10323
|
for (const n of due) {
|
|
10223
10324
|
const session = await selectNotificationRecipient(trx, n, config);
|
|
10224
|
-
const keepsRings = resolvedByProject(n.role);
|
|
10325
|
+
const keepsRings = resolvedByProject(n.role) || await conversationTarget(trx, n) !== null;
|
|
10225
10326
|
if (session === void 0) {
|
|
10226
10327
|
const reason = await noRecipientEnd(trx, n);
|
|
10227
10328
|
if (reason !== null) await endNotification(trx, n, await rowSubject(trx, n), {
|
|
@@ -10404,6 +10505,8 @@ async function notificationAddressedTo(trx, n, actor, config) {
|
|
|
10404
10505
|
const parsed = parseActorId(actor);
|
|
10405
10506
|
if (parsed?.actor !== "agent") return false;
|
|
10406
10507
|
const { project, session } = parsed.actorRef;
|
|
10508
|
+
const target = await conversationTarget(trx, n);
|
|
10509
|
+
if (target !== null) return project === target;
|
|
10407
10510
|
const addressee = parseAddressee(n.role);
|
|
10408
10511
|
switch (addressee.kind) {
|
|
10409
10512
|
case "curator": return project === curatorProject(config, await noticeProject(trx, n));
|
|
@@ -10437,8 +10540,26 @@ async function closeBlockNotification(trx, blockId, at, actor) {
|
|
|
10437
10540
|
async function closeTurnNotification(trx, turnId, at) {
|
|
10438
10541
|
await closeOwnedNotifications(trx, "turn", turnId, at, "system");
|
|
10439
10542
|
}
|
|
10543
|
+
/**
|
|
10544
|
+
* Ends an operator conversation's block and follow-up rings, whoever answered or closed it: the
|
|
10545
|
+
* operation's grant already chose the actor. Exhaustion items are cleared by `actor`, and each
|
|
10546
|
+
* follow-up comment is marked read at its current revision.
|
|
10547
|
+
*/
|
|
10548
|
+
async function ackConversationNotifications(trx, blockId, at, actor) {
|
|
10549
|
+
const answers = await trx.selectFrom("notification").select("comment_id").where("block_id", "=", blockId).where("kind", "=", "answer").where("acked_at", "is", null).execute();
|
|
10550
|
+
await closeOwnedNotifications(trx, "conversation", blockId, at, actor);
|
|
10551
|
+
for (const { comment_id: id } of answers) {
|
|
10552
|
+
if (id === null) continue;
|
|
10553
|
+
await trx.updateTable("comment").set((eb) => ({ acked_revision: eb.ref("revision") })).where("id", "=", id).execute();
|
|
10554
|
+
}
|
|
10555
|
+
}
|
|
10556
|
+
const OWNED_KINDS = {
|
|
10557
|
+
block: ["block"],
|
|
10558
|
+
conversation: ["block", "answer"],
|
|
10559
|
+
turn: ["turn", "turn_reminder"]
|
|
10560
|
+
};
|
|
10440
10561
|
async function closeOwnedNotifications(trx, kind, ownerId, at, actor) {
|
|
10441
|
-
const closed = await trx.updateTable("notification").set({ acked_at: at.toISOString() }).where(kind === "
|
|
10562
|
+
const closed = await trx.updateTable("notification").set({ acked_at: at.toISOString() }).where(kind === "turn" ? "turn_id" : "block_id", "=", ownerId).where("kind", "in", OWNED_KINDS[kind]).where("acked_at", "is", null).returning(["kind", "source_key"]).execute();
|
|
10442
10563
|
for (const row of closed) {
|
|
10443
10564
|
const item = await trx.selectFrom("operator_item").select("id").where("item_key", "=", exhaustedItemKey(row)).where("cleared_at", "is", null).executeTakeFirst();
|
|
10444
10565
|
if (item !== void 0) await clearItem(trx, item.id, at, actor);
|
|
@@ -11498,7 +11619,8 @@ async function subjectTarget(trx, subject, block) {
|
|
|
11498
11619
|
block: block === void 0 ? null : {
|
|
11499
11620
|
type: block.type,
|
|
11500
11621
|
author: block.author,
|
|
11501
|
-
addressee_role: block.addressee_role
|
|
11622
|
+
addressee_role: block.addressee_role,
|
|
11623
|
+
addressee_spur_project: block.addressee_spur_project
|
|
11502
11624
|
},
|
|
11503
11625
|
workers
|
|
11504
11626
|
}
|
|
@@ -11655,8 +11777,11 @@ async function addComment(trx, subject, block, text, ctx, addressee, config, opt
|
|
|
11655
11777
|
});
|
|
11656
11778
|
return row;
|
|
11657
11779
|
}
|
|
11658
|
-
/**
|
|
11659
|
-
|
|
11780
|
+
/**
|
|
11781
|
+
* Opens a block; a project-level block, which has no task to route by, goes to the operator. An
|
|
11782
|
+
* operator conversation names the Spur project it is addressed to, which routes its rings.
|
|
11783
|
+
*/
|
|
11784
|
+
async function openBlock(trx, subject, type, reason, ctx, config, addressee, addresseeSpurProject) {
|
|
11660
11785
|
const { task } = subject;
|
|
11661
11786
|
addressee ??= task === null ? "operator" : await routeBlock(trx, task, {
|
|
11662
11787
|
type,
|
|
@@ -11676,7 +11801,8 @@ async function openBlock(trx, subject, type, reason, ctx, config, addressee) {
|
|
|
11676
11801
|
repeat_of: null,
|
|
11677
11802
|
unblocked_by: null,
|
|
11678
11803
|
unblocked_at: null,
|
|
11679
|
-
created_at: ctx.at
|
|
11804
|
+
created_at: ctx.at,
|
|
11805
|
+
addressee_spur_project: addresseeSpurProject ?? null
|
|
11680
11806
|
}).returningAll().executeTakeFirstOrThrow();
|
|
11681
11807
|
await journal$1(trx, subject, ctx, "block_opened", {
|
|
11682
11808
|
block: blockId$1(row.id),
|
|
@@ -11778,7 +11904,8 @@ async function closeOpenBlock(trx, subject, block, ctx, outcome, outcomeReason,
|
|
|
11778
11904
|
actor: ctx.actor,
|
|
11779
11905
|
at: new Date(ctx.at)
|
|
11780
11906
|
});
|
|
11781
|
-
await closeBlockNotification(trx, block.id, new Date(ctx.at), ctx.actor);
|
|
11907
|
+
if (block.addressee_spur_project === null) await closeBlockNotification(trx, block.id, new Date(ctx.at), ctx.actor);
|
|
11908
|
+
else await ackConversationNotifications(trx, block.id, new Date(ctx.at), ctx.actor);
|
|
11782
11909
|
const items = await trx.selectFrom("operator_item").selectAll().where("kind", "in", ["post_blocked", ...BLOCK_ITEM_KINDS]).where("block_id", "=", block.id).where("cleared_at", "is", null).execute();
|
|
11783
11910
|
if (subject.task !== null && ctx.actor !== "system" && (outcome === "done" || outcome === "reason") && items.some((item) => item.kind === "course_check")) await forwardCourseNote(trx, subject.task, block, ctx, outcome === "reason" ? outcomeReason : null, answer);
|
|
11784
11911
|
for (const item of items) if (item.kind === "post_blocked") await clearItem(trx, item.id, new Date(ctx.at), ctx.actor);
|
|
@@ -11792,7 +11919,17 @@ async function closeBlockIfOpen(trx, blockId, ctx, outcome, outcomeReason) {
|
|
|
11792
11919
|
if (block === void 0) return;
|
|
11793
11920
|
await closeOpenBlock(trx, await blockSubject(trx, block), block, ctx, outcome, outcomeReason);
|
|
11794
11921
|
}
|
|
11795
|
-
/**
|
|
11922
|
+
/** The thread messages that close an operator conversation, compared after trimming. */
|
|
11923
|
+
const CLOSE_COMMANDS = /* @__PURE__ */ new Set([
|
|
11924
|
+
"close",
|
|
11925
|
+
"✅",
|
|
11926
|
+
":white_check_mark:"
|
|
11927
|
+
]);
|
|
11928
|
+
/**
|
|
11929
|
+
* Applies an operator message to the block selected by its conversation, without echoing it. The
|
|
11930
|
+
* first message answers and closes a block; on an operator conversation it is a follow-up that
|
|
11931
|
+
* rings the addressee, and only the close command closes it.
|
|
11932
|
+
*/
|
|
11796
11933
|
async function recordInboundBlockMessage(trx, input) {
|
|
11797
11934
|
const block = await trx.selectFrom("block").selectAll().where("id", "=", input.blockId).executeTakeFirstOrThrow();
|
|
11798
11935
|
const subject = await blockSubject(trx, block);
|
|
@@ -11800,7 +11937,9 @@ async function recordInboundBlockMessage(trx, input) {
|
|
|
11800
11937
|
actor: "operator",
|
|
11801
11938
|
at: input.at
|
|
11802
11939
|
};
|
|
11803
|
-
const
|
|
11940
|
+
const conversation = block.addressee_spur_project !== null;
|
|
11941
|
+
const closes = conversation && block.state === "open" && CLOSE_COMMANDS.has(input.text.trim());
|
|
11942
|
+
const answered = block.state === "open" && !conversation;
|
|
11804
11943
|
if (answered) {
|
|
11805
11944
|
if (subject.task !== null) active(subject.task);
|
|
11806
11945
|
rule(() => {
|
|
@@ -11808,16 +11947,53 @@ async function recordInboundBlockMessage(trx, input) {
|
|
|
11808
11947
|
});
|
|
11809
11948
|
}
|
|
11810
11949
|
return {
|
|
11811
|
-
comment: await addComment(trx, subject, block, input.text, ctx, authorRole(input.config, subject, block.author), input.config, {
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11950
|
+
comment: await addComment(trx, subject, block, input.text, ctx, authorRole(input.config, subject, block.author), input.config, {
|
|
11951
|
+
source: {
|
|
11952
|
+
conversationRef: input.conversationRef,
|
|
11953
|
+
messageRef: input.messageRef
|
|
11954
|
+
},
|
|
11955
|
+
ringsAuthor: !closes
|
|
11956
|
+
}),
|
|
11957
|
+
block: answered || closes ? await closeOpenBlock(trx, subject, block, ctx, "done", null) : block,
|
|
11816
11958
|
subject,
|
|
11817
11959
|
answered,
|
|
11818
11960
|
authorRole: authorRole(input.config, subject, block.author)
|
|
11819
11961
|
};
|
|
11820
11962
|
}
|
|
11963
|
+
/**
|
|
11964
|
+
* `text` without a leading `@<shortName>` token and the space after it; a text that is only the
|
|
11965
|
+
* token stays whole. An operator conversation's reason is its opening text stripped this way.
|
|
11966
|
+
*/
|
|
11967
|
+
function stripShortName(text, shortName) {
|
|
11968
|
+
const prefix = /^@(\S+)\s*/.exec(text);
|
|
11969
|
+
if (prefix?.[1] !== shortName) return text;
|
|
11970
|
+
const rest = text.slice(prefix[0].length);
|
|
11971
|
+
return rest.length === 0 ? text : rest;
|
|
11972
|
+
}
|
|
11973
|
+
/**
|
|
11974
|
+
* An edit of an open operator conversation's opening message: the block reason follows the new
|
|
11975
|
+
* text, and an addressee that already read the conversation is rung once more. Target and scope
|
|
11976
|
+
* stay as opened.
|
|
11977
|
+
*/
|
|
11978
|
+
async function reviseConversationOpening(trx, updated, input, subject) {
|
|
11979
|
+
if (updated.block_id === null) return;
|
|
11980
|
+
const block = await trx.selectFrom("block").selectAll().where("id", "=", updated.block_id).executeTakeFirstOrThrow();
|
|
11981
|
+
const spur = block.addressee_spur_project;
|
|
11982
|
+
if (spur === null || block.state !== "open") return;
|
|
11983
|
+
if ((await trx.selectFrom("comment").select("id").where("block_id", "=", block.id).orderBy("id").executeTakeFirstOrThrow()).id !== updated.id) return;
|
|
11984
|
+
const shortName = input.config.projects.flatMap((project) => project.spurProjects).find((entry) => entry.name === spur)?.shortName;
|
|
11985
|
+
const reason = shortName === void 0 ? updated.text : stripShortName(updated.text, shortName);
|
|
11986
|
+
const revised = await trx.updateTable("block").set({ reason }).where("id", "=", block.id).returningAll().executeTakeFirstOrThrow();
|
|
11987
|
+
if (await trx.selectFrom("notification").select("id").where("block_id", "=", block.id).where("kind", "in", ["block", "answer"]).where("acked_at", "is", null).executeTakeFirst() !== void 0) return;
|
|
11988
|
+
await applyDoorbellPolicy(trx, {
|
|
11989
|
+
kind: "answer",
|
|
11990
|
+
block: revised,
|
|
11991
|
+
commentId: updated.id,
|
|
11992
|
+
revision: updated.revision,
|
|
11993
|
+
authorRole: authorRole(input.config, subject, block.author),
|
|
11994
|
+
actor: input.actor
|
|
11995
|
+
}, new Date(input.at));
|
|
11996
|
+
}
|
|
11821
11997
|
/** Uses the same revision and acknowledgment rule as the catalog comment.edit mutation. */
|
|
11822
11998
|
async function editInboundComment(trx, input) {
|
|
11823
11999
|
const subject = await rowSubject(trx, input.comment);
|
|
@@ -11841,6 +12017,7 @@ async function editInboundComment(trx, input) {
|
|
|
11841
12017
|
actor: input.actor
|
|
11842
12018
|
}, new Date(input.at));
|
|
11843
12019
|
}
|
|
12020
|
+
await reviseConversationOpening(trx, updated, input, subject);
|
|
11844
12021
|
return updated;
|
|
11845
12022
|
}
|
|
11846
12023
|
/** The task's tracker title, or undefined when no readable snapshot has one; never throws. */
|
|
@@ -11859,6 +12036,7 @@ async function ticketTitle(trx, task) {
|
|
|
11859
12036
|
/** Posts a curator's answer to the feed; an operator answer is already on the board. */
|
|
11860
12037
|
async function queueCuratorAnswerLine(trx, task, block, answer, note, ctx, config) {
|
|
11861
12038
|
if (parseAddressee(block.addressee_role).kind !== "curator") return;
|
|
12039
|
+
if (block.addressee_spur_project !== null) return;
|
|
11862
12040
|
if (authorRole(config, taskSubject(task), ctx.actor) === "operator") return;
|
|
11863
12041
|
const curator = parseActorId(ctx.actor);
|
|
11864
12042
|
if (curator?.actor !== "agent") return;
|
|
@@ -11946,7 +12124,7 @@ function createBlockMutations(config) {
|
|
|
11946
12124
|
if (input.note !== void 0) await addComment(trx, subject, block, input.note, ctx, block.addressee_role, config, { ringsAuthor: false });
|
|
11947
12125
|
return { block: blockView(block, subject) };
|
|
11948
12126
|
};
|
|
11949
|
-
if (!next.changed || task === null) return unchanged();
|
|
12127
|
+
if (!next.changed || task === null || block.addressee_spur_project !== null) return unchanged();
|
|
11950
12128
|
if (!holdsBlock(config, ctx.actor, target)) return unchanged();
|
|
11951
12129
|
const updated = await moveBlockToAddressee(trx, {
|
|
11952
12130
|
task,
|
|
@@ -11971,9 +12149,11 @@ function createBlockMutations(config) {
|
|
|
11971
12149
|
answerBlock(current$1(block));
|
|
11972
12150
|
});
|
|
11973
12151
|
const role = authorRole(config, subject, block.author);
|
|
12152
|
+
const conversation = block.addressee_spur_project !== null;
|
|
12153
|
+
if (conversation) await ackConversationNotifications(trx, block.id, new Date(ctx.at), ctx.actor);
|
|
11974
12154
|
const comment = await addComment(trx, subject, block, input.text, ctx, role, config);
|
|
11975
12155
|
if (input.note !== void 0) await addComment(trx, subject, block, input.note, ctx, role, config, { ringsAuthor: false });
|
|
11976
|
-
const updated = await closeOpenBlock(trx, subject, block, ctx, "done", null, comment);
|
|
12156
|
+
const updated = conversation ? block : await closeOpenBlock(trx, subject, block, ctx, "done", null, comment);
|
|
11977
12157
|
if (task !== null) await queueCuratorAnswerLine(trx, task, block, comment, input.note, ctx, config);
|
|
11978
12158
|
return {
|
|
11979
12159
|
block: blockView(updated, subject),
|
|
@@ -11983,7 +12163,24 @@ function createBlockMutations(config) {
|
|
|
11983
12163
|
};
|
|
11984
12164
|
const unblock = {
|
|
11985
12165
|
id: "block.unblock",
|
|
11986
|
-
resolveTargets
|
|
12166
|
+
async resolveTargets(trx, input) {
|
|
12167
|
+
const [target] = await blockTarget(trx, input.block);
|
|
12168
|
+
if (target?.kind !== "found" || target.value.block?.addressee_spur_project == null) return [target ?? { kind: "missing" }];
|
|
12169
|
+
const block = {
|
|
12170
|
+
...target.value.block,
|
|
12171
|
+
addressee_role: "operator"
|
|
12172
|
+
};
|
|
12173
|
+
return [{
|
|
12174
|
+
...target,
|
|
12175
|
+
value: {
|
|
12176
|
+
...target.value,
|
|
12177
|
+
block: {
|
|
12178
|
+
...block,
|
|
12179
|
+
addressee_spur_project: null
|
|
12180
|
+
}
|
|
12181
|
+
}
|
|
12182
|
+
}];
|
|
12183
|
+
},
|
|
11987
12184
|
async run(trx, input, ctx) {
|
|
11988
12185
|
const block = found(await blockById(trx, input.block));
|
|
11989
12186
|
const subject = await blockSubject(trx, block);
|
|
@@ -12683,9 +12880,16 @@ function target(claim) {
|
|
|
12683
12880
|
space: KIND_SPACE[body.kind],
|
|
12684
12881
|
title: body.payload.title
|
|
12685
12882
|
};
|
|
12686
|
-
case "conversation.reply": return parent && {
|
|
12883
|
+
case "conversation.reply": return body.payload.targetConversation === void 0 ? parent && {
|
|
12687
12884
|
kind: "reply",
|
|
12688
12885
|
conversation: parent.conversation
|
|
12886
|
+
} : {
|
|
12887
|
+
kind: "reply",
|
|
12888
|
+
conversation: body.payload.targetConversation
|
|
12889
|
+
};
|
|
12890
|
+
case "conversation.notice": return {
|
|
12891
|
+
kind: "reply",
|
|
12892
|
+
conversation: body.payload.targetConversation
|
|
12689
12893
|
};
|
|
12690
12894
|
case "conversation.close": return body.payload.targetConversation === void 0 ? parent && {
|
|
12691
12895
|
kind: "close",
|
|
@@ -12948,7 +13152,13 @@ function createSender(options) {
|
|
|
12948
13152
|
body: body.kind === "feed.line.edit" && body.payload.tokenCard !== void 0 ? tokenCardBody(body.payload.tokenCard, options.config) : body.kind === "feed.line.edit" && body.payload.resolved !== void 0 ? resolvedFeedBody({
|
|
12949
13153
|
...body.payload,
|
|
12950
13154
|
resolved: body.payload.resolved
|
|
12951
|
-
}, options.config) : c.body.kind === "
|
|
13155
|
+
}, options.config) : c.body.kind === "conversation.notice" ? [{
|
|
13156
|
+
kind: "paragraph",
|
|
13157
|
+
children: [{
|
|
13158
|
+
kind: "text",
|
|
13159
|
+
text: c.body.payload.text
|
|
13160
|
+
}]
|
|
13161
|
+
}] : c.body.kind === "feed.line" && c.body.payload.exchange !== void 0 ? exchangeBody({
|
|
12952
13162
|
...c.body.payload,
|
|
12953
13163
|
exchange: c.body.payload.exchange
|
|
12954
13164
|
}) : c.body.kind === "feed.line" ? feedLineBody(c.body.payload) : renderBody(c.body.payload.key, c.body.payload.text),
|
|
@@ -13008,7 +13218,7 @@ function createSender(options) {
|
|
|
13008
13218
|
if (body.kind === "doorbell" && body.payload.notificationId !== void 0 && body.payload.ring !== void 0) await recordRingDelivery(trx, body.payload.notificationId, body.payload.ring, body.payload.session, new Date(at), options.config);
|
|
13009
13219
|
return;
|
|
13010
13220
|
case "delivered": {
|
|
13011
|
-
const conversation = body.kind === "conversation.close" ? body.payload.targetConversation ?? outcome.conversation ?? c.parent?.conversation : body.kind === "feed.line.edit" ? c.parent?.conversation : outcome.conversation ?? c.parent?.conversation;
|
|
13221
|
+
const conversation = body.kind === "conversation.close" || body.kind === "conversation.reply" || body.kind === "conversation.notice" ? body.payload.targetConversation ?? outcome.conversation ?? c.parent?.conversation : body.kind === "feed.line.edit" ? c.parent?.conversation : outcome.conversation ?? c.parent?.conversation;
|
|
13012
13222
|
if (conversation === void 0) return postFailed({ last_error: "delivered without a conversation" });
|
|
13013
13223
|
const ref = {
|
|
13014
13224
|
conversation,
|
|
@@ -14461,6 +14671,25 @@ const ANOMALY_FLAGS = /* @__PURE__ */ new Set([
|
|
|
14461
14671
|
"worker_completed",
|
|
14462
14672
|
"worker_lost"
|
|
14463
14673
|
]);
|
|
14674
|
+
/**
|
|
14675
|
+
* The item for an open operator conversation with a ring that waits for a live session of its
|
|
14676
|
+
* Spur project, or undefined while a session can take it or nothing waits.
|
|
14677
|
+
*/
|
|
14678
|
+
async function conversationWaiting(trx, config, block, subject) {
|
|
14679
|
+
const spur = block.addressee_spur_project;
|
|
14680
|
+
if (spur === null) return void 0;
|
|
14681
|
+
if (await trx.selectFrom("notification").select("id").where("block_id", "=", block.id).where("kind", "in", ["block", "answer"]).where("acked_at", "is", null).where("exhausted_at", "is", null).executeTakeFirst() === void 0 || await bestProjectSession(trx, spur) !== void 0) return void 0;
|
|
14682
|
+
const shortName = config.projects.flatMap((project) => project.spurProjects).find((entry) => entry.name === spur)?.shortName ?? spur;
|
|
14683
|
+
return {
|
|
14684
|
+
key: `conversation:${String(block.id)}`,
|
|
14685
|
+
kind: "conversation_waiting",
|
|
14686
|
+
taskId: subject.task?.id ?? null,
|
|
14687
|
+
summary: `${subject.key}: message to @${shortName} waits for a live ${spur} session`,
|
|
14688
|
+
factAt: block.created_at,
|
|
14689
|
+
source: null,
|
|
14690
|
+
priority: ITEM_POLICY.conversation_waiting.priority
|
|
14691
|
+
};
|
|
14692
|
+
}
|
|
14464
14693
|
/** Reconciles every item in the caller's observation or tick transaction. */
|
|
14465
14694
|
async function reconcileItems(trx, config, now, spurComplete, warnSkipped) {
|
|
14466
14695
|
const candidates = [];
|
|
@@ -14543,6 +14772,10 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped) {
|
|
|
14543
14772
|
source: null,
|
|
14544
14773
|
priority: 0
|
|
14545
14774
|
});
|
|
14775
|
+
if (block.addressee_spur_project !== null) {
|
|
14776
|
+
const waiting = await conversationWaiting(trx, config, block, subject);
|
|
14777
|
+
if (waiting !== void 0) candidates.push(waiting);
|
|
14778
|
+
}
|
|
14546
14779
|
if (now - Date.parse(block.created_at) >= config.thresholds.blockOpenMs) candidates.push({
|
|
14547
14780
|
key: `block:${String(block.id)}`,
|
|
14548
14781
|
kind: "board_observation",
|
|
@@ -17301,6 +17534,83 @@ function commandReply(id, value, input) {
|
|
|
17301
17534
|
};
|
|
17302
17535
|
}
|
|
17303
17536
|
//#endregion
|
|
17537
|
+
//#region ../core/src/app/operator-conversation.ts
|
|
17538
|
+
function addressOperatorMessage(text, config) {
|
|
17539
|
+
const spurByShortName = /* @__PURE__ */ new Map();
|
|
17540
|
+
for (const project of config.projects) for (const spur of project.spurProjects) if (spur.shortName !== void 0) spurByShortName.set(spur.shortName, spur.name);
|
|
17541
|
+
if (spurByShortName.size === 0) return null;
|
|
17542
|
+
const prefix = /^@(\S+)\s*/.exec(text);
|
|
17543
|
+
const named = prefix?.[1] === void 0 ? void 0 : spurByShortName.get(prefix[1]);
|
|
17544
|
+
if (prefix?.[1] !== void 0 && named !== void 0) return {
|
|
17545
|
+
spur: named,
|
|
17546
|
+
text: stripShortName(text, prefix[1])
|
|
17547
|
+
};
|
|
17548
|
+
const fallback = config.slack.defaultAddressee;
|
|
17549
|
+
const fallbackSpur = fallback === void 0 ? void 0 : spurByShortName.get(fallback);
|
|
17550
|
+
if (fallbackSpur !== void 0) return {
|
|
17551
|
+
spur: fallbackSpur,
|
|
17552
|
+
text
|
|
17553
|
+
};
|
|
17554
|
+
return { hint: `No addressee. Start with one of: ${[...spurByShortName.keys()].map((name) => `@${name}`).join(", ")}.` };
|
|
17555
|
+
}
|
|
17556
|
+
/**
|
|
17557
|
+
* The open, non-archived task of `project` that the first word of `text` names, with trailing
|
|
17558
|
+
* `?.,:;` dropped; undefined when it names none.
|
|
17559
|
+
*/
|
|
17560
|
+
async function namedTask(trx, config, project, text) {
|
|
17561
|
+
const word = (/^\S+/.exec(text)?.[0] ?? "").replace(/[?.,:;]+$/, "");
|
|
17562
|
+
if (!parseRef$1(word, "task").ok) return void 0;
|
|
17563
|
+
let key;
|
|
17564
|
+
try {
|
|
17565
|
+
const canonical = canonicalKey(config, word);
|
|
17566
|
+
if (canonical.project.id !== project) return void 0;
|
|
17567
|
+
key = canonical.key;
|
|
17568
|
+
} catch {
|
|
17569
|
+
return;
|
|
17570
|
+
}
|
|
17571
|
+
return trx.selectFrom("task").selectAll().where("key", "=", key).where("project", "=", project).where("membership", "!=", "archived").executeTakeFirst();
|
|
17572
|
+
}
|
|
17573
|
+
/**
|
|
17574
|
+
* Opens the conversation an operator's new message starts, or posts the hint in its thread.
|
|
17575
|
+
* Returns false, and writes nothing, when no short name is configured.
|
|
17576
|
+
*/
|
|
17577
|
+
async function openOperatorConversation(trx, input) {
|
|
17578
|
+
const { config } = input;
|
|
17579
|
+
const address = addressOperatorMessage(input.text, config);
|
|
17580
|
+
if (address === null) return false;
|
|
17581
|
+
if ("hint" in address) {
|
|
17582
|
+
await enqueueConversationNotice(trx, {
|
|
17583
|
+
conversation: input.conversation,
|
|
17584
|
+
text: address.hint,
|
|
17585
|
+
at: new Date(input.at)
|
|
17586
|
+
});
|
|
17587
|
+
return true;
|
|
17588
|
+
}
|
|
17589
|
+
const project = config.projects.find((entry) => entry.spurProjects.some((spur) => spur.name === address.spur));
|
|
17590
|
+
if (project === void 0) return false;
|
|
17591
|
+
const role = project.spurProjects.find((spur) => spur.name === address.spur)?.role === "curator" ? "curator" : "worker";
|
|
17592
|
+
const task = await namedTask(trx, config, project.id, address.text);
|
|
17593
|
+
const subject = task === void 0 ? projectSubject(project.id) : taskSubject(task);
|
|
17594
|
+
const ctx = {
|
|
17595
|
+
actor: "operator",
|
|
17596
|
+
at: input.at
|
|
17597
|
+
};
|
|
17598
|
+
const block = await openBlock(trx, subject, "needs_input", address.text, ctx, config, role, address.spur);
|
|
17599
|
+
await insertComment(trx, subject, block.id, address.text, ctx, role, {
|
|
17600
|
+
conversationRef: input.conversation,
|
|
17601
|
+
messageRef: input.message
|
|
17602
|
+
});
|
|
17603
|
+
const conversation = await insertConversation(trx, {
|
|
17604
|
+
gateway: input.gateway,
|
|
17605
|
+
ref: input.conversation,
|
|
17606
|
+
rootMessage: input.rootMessage,
|
|
17607
|
+
at: input.at,
|
|
17608
|
+
blockId: block.id
|
|
17609
|
+
});
|
|
17610
|
+
if (conversation !== void 0) await advanceConversationCursor(trx, conversation, input.message, input.at);
|
|
17611
|
+
return true;
|
|
17612
|
+
}
|
|
17613
|
+
//#endregion
|
|
17304
17614
|
//#region ../core/src/app/inbound.ts
|
|
17305
17615
|
const resultSchema = z.strictObject({
|
|
17306
17616
|
status: z.enum([
|
|
@@ -17412,6 +17722,7 @@ async function linkedComment(trx, event) {
|
|
|
17412
17722
|
}
|
|
17413
17723
|
/** The answer's notification is already registered; this raises the item when nobody can read it. */
|
|
17414
17724
|
async function ringAuthor(trx, input) {
|
|
17725
|
+
if (input.block.addressee_spur_project !== null) return;
|
|
17415
17726
|
if (await trx.selectFrom("operator_item").select("id").where("block_id", "=", input.block.id).where("kind", "in", BLOCK_ITEM_KINDS).executeTakeFirst() !== void 0) return;
|
|
17416
17727
|
const key = `doorbell:comment:${String(input.comment.id)}:revision:${String(input.comment.revision)}`;
|
|
17417
17728
|
const parsed = parseActorId(input.block.author);
|
|
@@ -17483,6 +17794,15 @@ function createInbound(input) {
|
|
|
17483
17794
|
async function processMessage(trx, event, at) {
|
|
17484
17795
|
if (await alreadyApplied(trx, event)) return void 0;
|
|
17485
17796
|
const conversation = await sourceContext(trx, event, at);
|
|
17797
|
+
if (conversation === void 0 && (event.kind === "message" || event.kind === "mention") && event.sourceSpace === "orchestrators" && await openOperatorConversation(trx, {
|
|
17798
|
+
text: event.text,
|
|
17799
|
+
conversation: event.conversation,
|
|
17800
|
+
message: event.message,
|
|
17801
|
+
rootMessage: event.rootMessage,
|
|
17802
|
+
gateway: gateway.kind,
|
|
17803
|
+
at: event.at,
|
|
17804
|
+
config
|
|
17805
|
+
})) return { status: "applied" };
|
|
17486
17806
|
if (conversation?.block_id === null || conversation === void 0) return skip(trx, {
|
|
17487
17807
|
event,
|
|
17488
17808
|
reason: "Unknown board conversation.",
|
|
@@ -22231,11 +22551,14 @@ function normalizeMessage(channel, payload, context) {
|
|
|
22231
22551
|
}
|
|
22232
22552
|
const messageAt = iso(base.ts);
|
|
22233
22553
|
if (messageAt === void 0) return [];
|
|
22554
|
+
const kind = base.threadTs === base.ts && body.includes(`<@${context.bot.userId}>`) ? "mention" : "message";
|
|
22555
|
+
const space = base.threadTs === base.ts ? { sourceSpace: sourceSpace(channel, context.channels) } : {};
|
|
22234
22556
|
const events = [{
|
|
22235
|
-
kind
|
|
22557
|
+
kind,
|
|
22236
22558
|
dedupeKey: `slack:${channel}:${base.ts}`,
|
|
22237
22559
|
...eventBase,
|
|
22238
|
-
at: messageAt
|
|
22560
|
+
at: messageAt,
|
|
22561
|
+
...space
|
|
22239
22562
|
}];
|
|
22240
22563
|
if (editAt !== void 0 && editedTs !== void 0 && body.length > 0) events.push({
|
|
22241
22564
|
kind: "message_edited",
|
|
@@ -22366,7 +22689,7 @@ function gap(conversation) {
|
|
|
22366
22689
|
};
|
|
22367
22690
|
}
|
|
22368
22691
|
/** A scan is driven solely by its request; the core owns cursors and deduplication. */
|
|
22369
|
-
async function* recoverThreads(client, request, botIdentity, now) {
|
|
22692
|
+
async function* recoverThreads(client, request, botIdentity, now, channels) {
|
|
22370
22693
|
const until = now();
|
|
22371
22694
|
const from = request.since.getTime();
|
|
22372
22695
|
if (!Number.isFinite(from) || from > until) return;
|
|
@@ -22405,6 +22728,7 @@ async function* recoverThreads(client, request, botIdentity, now) {
|
|
|
22405
22728
|
if (source === null) continue;
|
|
22406
22729
|
const events = normalizeMessage(addressed.channel, source, {
|
|
22407
22730
|
bot,
|
|
22731
|
+
channels,
|
|
22408
22732
|
root,
|
|
22409
22733
|
rootTs: addressed.threadTs
|
|
22410
22734
|
});
|
|
@@ -22466,9 +22790,11 @@ function createSocket(api, config, botIdentity) {
|
|
|
22466
22790
|
const threadTs = textOf(message.thread_ts) ?? textOf(nested?.thread_ts) ?? textOf(previous?.thread_ts);
|
|
22467
22791
|
const messageTs = textOf(message.ts) ?? textOf(nested?.ts);
|
|
22468
22792
|
const deletedRoot = message.subtype === "message_deleted" && threadTs === textOf(message.deleted_ts);
|
|
22793
|
+
const root = threadTs === void 0 || threadTs === messageTs || deletedRoot ? message : await rootFor(api, channel, threadTs);
|
|
22469
22794
|
events = normalizeMessage(channel, message, {
|
|
22470
22795
|
bot,
|
|
22471
|
-
|
|
22796
|
+
channels: config.channels,
|
|
22797
|
+
root,
|
|
22472
22798
|
...threadTs === void 0 ? {} : { rootTs: threadTs }
|
|
22473
22799
|
});
|
|
22474
22800
|
}
|
|
@@ -22564,7 +22890,7 @@ function createSlackGateway(config) {
|
|
|
22564
22890
|
return {
|
|
22565
22891
|
...delivery,
|
|
22566
22892
|
...socket,
|
|
22567
|
-
recover: (request) => recoverThreads(api, request, botIdentity, config.now),
|
|
22893
|
+
recover: (request) => recoverThreads(api, request, botIdentity, config.now, config.channels),
|
|
22568
22894
|
async respond(interaction, text, options) {
|
|
22569
22895
|
const addressed = parseInteractionRef(interaction);
|
|
22570
22896
|
const rendered = renderResponse(text, options.cliHint);
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as renderMcpError, X as ERRORS, y as OPERATIONS } from "./chunk-
|
|
2
|
-
import { o as CliError, r as requestOperation } from "./chunk-
|
|
3
|
-
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-
|
|
1
|
+
import { C as renderMcpError, X as ERRORS, y as OPERATIONS } from "./chunk-CzdGYlBy.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-Czc8fVqW.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DyPssI65.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
package/package.json
CHANGED
|
@@ -125,7 +125,7 @@ Other errors: `wrong_id_kind`, `not_found`, `block_not_open`, `task_archived`, `
|
|
|
125
125
|
|
|
126
126
|
### `board answer`
|
|
127
127
|
|
|
128
|
-
Purpose: Answer a question
|
|
128
|
+
Purpose: Answer a question; the block closes unless it is an operator conversation.
|
|
129
129
|
Arguments: `<block>`, `<text>`.
|
|
130
130
|
Flags: `--note <value>`, `--key <key>`, `--json`.
|
|
131
131
|
Use when: Answer an open question.
|
|
@@ -114,22 +114,25 @@ ID). Role addresses follow the current session filling the role.
|
|
|
114
114
|
`slack.channels.feed` carries summaries such as curator answers and operator
|
|
115
115
|
items, with exceptions for items represented elsewhere or delivery problems.
|
|
116
116
|
`slack.channels.orchestrators` carries block threads addressed to the operator by
|
|
117
|
-
someone else. Answer in the existing block thread to preserve its task context
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
A
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
117
|
+
someone else. Answer in the existing block thread to preserve its task context.
|
|
118
|
+
|
|
119
|
+
## Slack addressing
|
|
120
|
+
|
|
121
|
+
Once a `projects[].spurProjects[].shortName` is set, a new operator message in
|
|
122
|
+
`slack.channels.orchestrators` starts a conversation. A leading registered
|
|
123
|
+
`@shortName` selects that Spur project and is stripped from the text. With an
|
|
124
|
+
absent or unknown leading name, `slack.defaultAddressee` receives the complete
|
|
125
|
+
text, retaining any unknown prefix; without it the Board replies once with the
|
|
126
|
+
valid prefixes. A mention in the middle, or a Slack `<@U…>` mention, addresses
|
|
127
|
+
nobody; an unknown name causes no lookup error. The operator checks short-name
|
|
128
|
+
collisions with workspace names. A task key right after the prefix attaches the
|
|
129
|
+
conversation to that task.
|
|
130
|
+
|
|
131
|
+
The addressee is rung with the block ID, reads the text in `board inbox` and
|
|
132
|
+
replies in the thread with `board answer`. An operator-role addressee posts as
|
|
133
|
+
`board`, a column orchestrator on its column's task as orchestrator. Each
|
|
134
|
+
operator thread message rings it again; `close` or ✅ in the thread closes it.
|
|
135
|
+
While no live session can take it, `board status` lists it as waiting.
|
|
133
136
|
|
|
134
137
|
## Done follows the ticket
|
|
135
138
|
|