spur-board 0.142.0 → 0.144.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-7rRkhWZT.mjs → chunk-B9Pt8i90.mjs} +1 -1
- package/dist/{chunk-94uNRHe7.mjs → chunk-Bt8v7TND.mjs} +13 -31
- package/dist/{chunk-DApVVC2b.mjs → chunk-sn-nSSNs.mjs} +2 -2
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +212 -84
- package/dist/mcp.mjs +3 -3
- package/dist/web/assets/index-BdbbRbrA.js +64 -0
- package/dist/web/assets/index-D8GjtUEd.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/skills/spur-board/references/how-board-works-blocks.md +4 -2
- package/skills/spur-board/references/web-ui-board-move.md +22 -1
- package/skills/spur-board/references/web-ui-board.md +17 -8
- package/skills/spur-board/references/web-ui-status.md +6 -3
- package/skills/spur-board/references/web-ui-task-approvals.md +56 -0
- package/skills/spur-board/references/web-ui-task-view.md +11 -11
- package/skills/spur-board/references/web-ui.md +7 -2
- package/dist/web/assets/index-53hvPUj_.css +0 -1
- package/dist/web/assets/index-59FR8rPS.js +0 -64
|
@@ -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-Bt8v7TND.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
@@ -126,15 +126,8 @@ const CHECKS_GATE_COLUMNS = [
|
|
|
126
126
|
const APPROVAL_RULES = ["any-approval", "github-rules"];
|
|
127
127
|
/** Where a column's effective orchestrator comes from: its own column entry or top-level `spurProjects`. */
|
|
128
128
|
const COLUMN_BINDING_SOURCES = ["project", "board-wide"];
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
* `spurProjects`, or, while no board-wide operator exists, another board project's list.
|
|
132
|
-
*/
|
|
133
|
-
const OPERATOR_BINDING_SOURCES = [
|
|
134
|
-
"project",
|
|
135
|
-
"board-wide",
|
|
136
|
-
"other-project"
|
|
137
|
-
];
|
|
129
|
+
/** Where a project's effective operator comes from: its own `spurProjects` or top-level `spurProjects`. */
|
|
130
|
+
const OPERATOR_BINDING_SOURCES = ["project", "board-wide"];
|
|
138
131
|
/** Where the default Slack addressee comes from: `slack.defaultAddressee`, the board-wide operator or a project's operator. */
|
|
139
132
|
const ADDRESSEE_SOURCES = [
|
|
140
133
|
"config",
|
|
@@ -445,7 +438,7 @@ const spurProject = z.strictObject({
|
|
|
445
438
|
"operator",
|
|
446
439
|
"curator",
|
|
447
440
|
"orchestrator"
|
|
448
|
-
]).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."),
|
|
441
|
+
]).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 of this board project only. 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."),
|
|
449
442
|
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."),
|
|
450
443
|
displayName: nonEmpty.max(80).optional().describe("The name Slack messages this Spur project's sessions write are posted under: block threads and replies, and a curator's answer lines in the feed. Defaults to the Spur project name."),
|
|
451
444
|
icon: z.string().regex(/^:[a-z0-9_+'-]+:$/, "Expected an emoji shortcode such as :owl:").optional().describe("The emoji shortcode, such as :owl:, shown on those messages instead of the role icon.")
|
|
@@ -748,7 +741,7 @@ function rejectSharedShortNames(items, ctx) {
|
|
|
748
741
|
/** A Spur project bound for every board project at once, in top-level `spurProjects`. */
|
|
749
742
|
const boardWideEntry = z.strictObject({
|
|
750
743
|
name: spurProject.shape.name.describe("The name of the project in Spur. It must not also be listed under any projects[].spurProjects, and none and operator are reserved."),
|
|
751
|
-
role: z.enum(["orchestrator", "operator"]).describe("orchestrator: sessions execute the listed columns in every board project that enables the column and leaves its orchestrator at none. operator: sessions act as the operator of every board project that lists no operator of its own;
|
|
744
|
+
role: z.enum(["orchestrator", "operator"]).describe("orchestrator: sessions execute the listed columns in every board project that enables the column and leaves its orchestrator at none. operator: sessions act as the operator of every board project that lists no operator of its own; a project's own operator acts only in its project. At most one operator."),
|
|
752
745
|
columns: z.array(columnId.describe("A built-in column this orchestrator executes.")).optional().describe("Required for role orchestrator, not allowed for operator. The columns it executes board-wide. A project column whose orchestrator is set to anything but none keeps it, and a disabled column is never filled; it must fill at least one column in some board project."),
|
|
753
746
|
shortName: spurProject.shape.shortName.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, top-level and projects[].spurProjects alike."),
|
|
754
747
|
displayName: spurProject.shape.displayName.describe("The name Slack messages this Spur project's sessions write are posted under. Defaults to the Spur project name."),
|
|
@@ -1127,14 +1120,12 @@ function defaultAddressee(config) {
|
|
|
1127
1120
|
}
|
|
1128
1121
|
/**
|
|
1129
1122
|
* The effective column orchestrators and operators of `projects`, in config order, and the
|
|
1130
|
-
* default Slack addressee. Columns that are disabled or left at none have no row
|
|
1131
|
-
*
|
|
1132
|
-
* act on every board project then (`isOperator`).
|
|
1123
|
+
* default Slack addressee. Columns that are disabled or left at none have no row; a project
|
|
1124
|
+
* operator acts only in the project that lists it (`isOperator`).
|
|
1133
1125
|
*/
|
|
1134
1126
|
function configBindings(config, projects) {
|
|
1135
1127
|
const source = (name) => boardWideSpurProject(config, name) === void 0 ? "project" : "board-wide";
|
|
1136
1128
|
const operatorsOf = (project) => project.spurProjects.filter((spur) => spur.role === "operator");
|
|
1137
|
-
const boardWideOperator = config.spurProjects.some((entry) => entry.role === "operator");
|
|
1138
1129
|
const served = config.projects.filter((project) => projects.has(project.id));
|
|
1139
1130
|
return {
|
|
1140
1131
|
columns: served.flatMap((project) => project.columns.filter((column) => column.enabled && column.orchestrator !== "none").map((column) => ({
|
|
@@ -1143,20 +1134,11 @@ function configBindings(config, projects) {
|
|
|
1143
1134
|
orchestrator: column.orchestrator,
|
|
1144
1135
|
source: source(column.orchestrator)
|
|
1145
1136
|
}))),
|
|
1146
|
-
operators: served.flatMap((project) => {
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}));
|
|
1152
|
-
if (boardWideOperator) return own;
|
|
1153
|
-
const others = config.projects.filter((other) => other.id !== project.id).flatMap(operatorsOf).map((spur) => ({
|
|
1154
|
-
project: project.id,
|
|
1155
|
-
operator: spur.name,
|
|
1156
|
-
source: "other-project"
|
|
1157
|
-
}));
|
|
1158
|
-
return [...own, ...others];
|
|
1159
|
-
}),
|
|
1137
|
+
operators: served.flatMap((project) => operatorsOf(project).map((spur) => ({
|
|
1138
|
+
project: project.id,
|
|
1139
|
+
operator: spur.name,
|
|
1140
|
+
source: source(spur.name)
|
|
1141
|
+
}))),
|
|
1160
1142
|
defaultAddressee: defaultAddressee(config)
|
|
1161
1143
|
};
|
|
1162
1144
|
}
|
|
@@ -3572,7 +3554,7 @@ const statusBindingsSchema = z.strictObject({
|
|
|
3572
3554
|
operators: z.array(z.strictObject({
|
|
3573
3555
|
project: z.string().min(1).describe("Board project."),
|
|
3574
3556
|
operator: z.string().min(1).describe("Spur project acting as operator there."),
|
|
3575
|
-
source: z.enum(OPERATOR_BINDING_SOURCES).describe("project: its own spurProjects; board-wide: top-level spurProjects
|
|
3557
|
+
source: z.enum(OPERATOR_BINDING_SOURCES).describe("project: its own spurProjects; board-wide: top-level spurProjects.")
|
|
3576
3558
|
}).describe("One operator binding.")).describe("Operator Spur projects of each requested project."),
|
|
3577
3559
|
defaultAddressee: z.strictObject({
|
|
3578
3560
|
spurProject: z.string().min(1).describe("Spur project the message goes to."),
|
|
@@ -4429,7 +4411,7 @@ const OPERATIONS = [
|
|
|
4429
4411
|
id: "inbox.operator",
|
|
4430
4412
|
web: true,
|
|
4431
4413
|
kind: "query",
|
|
4432
|
-
description: "List what waits for the operator and what was handled in the last 24 hours; a project's own operator session sees only its operator projects, and _board entries
|
|
4414
|
+
description: "List what waits for the operator and what was handled in the last 24 hours; a project's own operator session sees only its operator projects, and _board entries go to the operator token, the board-wide operator, or the operator of a one-project board without a board-wide operator.",
|
|
4433
4415
|
mcp: {
|
|
4434
4416
|
whenToUse: "As the operator, review every open operator item, block and turn across projects in one list.",
|
|
4435
4417
|
whenNotToUse: "Use inbox_get for the comments, blocks and turns addressed to an agent."
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Dt 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 { Dt as plainHttpAllowed, Tt as configSchema, d as buildCatalogSnapshot, p as OPERATIONS } from "./chunk-Bt8v7TND.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-B9Pt8i90.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 resolveWebOrigin, D as sortSkillFiles, It as SLACK_BOT_SCOPES, T as skillReloadFileSchema, Tt as configSchema, a as requestHashOf, f as roleCanUseOperation, it as actorIdSchema, kt as requiredSecretKeys, 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-
|
|
1
|
+
import { At as resolveWebOrigin, D as sortSkillFiles, It as SLACK_BOT_SCOPES, T as skillReloadFileSchema, Tt as configSchema, a as requestHashOf, f as roleCanUseOperation, it as actorIdSchema, kt as requiredSecretKeys, 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-Bt8v7TND.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-B9Pt8i90.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-sn-nSSNs.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-B9Pt8i90.mjs";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as ringMarker, A as eventPayloadSchemas, At as resolveWebOrigin, B as sourceCursorSchema, Bt as isTodoGroupColumn, C as messageRefSchema, Ct as columnTurnTimings, D as sortSkillFiles, Dt as plainHttpAllowed, E as skillReloadFilesSchema, Et as defaultAddressee, F as defaultBranchFactSchema, Ft as ITEM_KINDS, G as SESSION_HEALTH_STATES, H as PR_STATES, I as entityRefSchema, It as SLACK_BOT_SCOPES, J as parseRingMarker, K as SESSION_STATUSES, L as mirrorSourceId, Lt as TASK_HOLDS, M as MIRROR_FAILURES, Mt as COLUMN_GROUPS, N as MIRROR_FAILURE_CODES, Nt as COLUMN_IDS, O as EVENT_KINDS, Ot as readyMirrorOf, P as batchSchema, Pt as DISPATCHER_MODES, Q as prReviewRuleSchema, R as prSourceId, Rt as TODO_GROUP_COLUMN_IDS, S as interactionRefSchema, St as boardWideSpurProject, Tt as configSchema, U as REVIEW_DECISIONS, V as trackerSourceId, 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 COLUMNS, k as GATE_REASONS, kt as requiredSecretKeys, 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 VIAS } from "./chunk-
|
|
1
|
+
import { $ as ringMarker, A as eventPayloadSchemas, At as resolveWebOrigin, B as sourceCursorSchema, Bt as isTodoGroupColumn, C as messageRefSchema, Ct as columnTurnTimings, D as sortSkillFiles, Dt as plainHttpAllowed, E as skillReloadFilesSchema, Et as defaultAddressee, F as defaultBranchFactSchema, Ft as ITEM_KINDS, G as SESSION_HEALTH_STATES, H as PR_STATES, I as entityRefSchema, It as SLACK_BOT_SCOPES, J as parseRingMarker, K as SESSION_STATUSES, L as mirrorSourceId, Lt as TASK_HOLDS, M as MIRROR_FAILURES, Mt as COLUMN_GROUPS, N as MIRROR_FAILURE_CODES, Nt as COLUMN_IDS, O as EVENT_KINDS, Ot as readyMirrorOf, P as batchSchema, Pt as DISPATCHER_MODES, Q as prReviewRuleSchema, R as prSourceId, Rt as TODO_GROUP_COLUMN_IDS, S as interactionRefSchema, St as boardWideSpurProject, Tt as configSchema, U as REVIEW_DECISIONS, V as trackerSourceId, 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 COLUMNS, k as GATE_REASONS, kt as requiredSecretKeys, 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 VIAS } from "./chunk-Bt8v7TND.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";
|
|
@@ -496,11 +496,11 @@ function projectTarget(project) {
|
|
|
496
496
|
};
|
|
497
497
|
}
|
|
498
498
|
/**
|
|
499
|
-
* True for the operator token and for a session of an operator Spur project.
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
*
|
|
499
|
+
* True for the operator token and for a session of an operator Spur project. A session acts as
|
|
500
|
+
* operator on `project` only when that project lists its Spur project as operator; a board-wide
|
|
501
|
+
* operator is listed in every project without its own. On no project (`null`) it acts only as
|
|
502
|
+
* the board-wide operator or, without one, as an operator every board project lists, which only
|
|
503
|
+
* a one-project board has.
|
|
504
504
|
*/
|
|
505
505
|
function isOperator(actor, config, project) {
|
|
506
506
|
if (actor === "operator") return true;
|
|
@@ -509,8 +509,7 @@ function isOperator(actor, config, project) {
|
|
|
509
509
|
const name = parsed.actorRef.project;
|
|
510
510
|
const operatorIn = (entry) => entry.spurProjects.some((spur) => spur.name === name && spur.role === "operator");
|
|
511
511
|
const boardWide = config.spurProjects.find((entry) => entry.role === "operator");
|
|
512
|
-
if (boardWide === void 0
|
|
513
|
-
if (project === null) return name === boardWide.name;
|
|
512
|
+
if (project === null) return boardWide === void 0 ? config.projects.every(operatorIn) : name === boardWide.name;
|
|
514
513
|
const target = config.projects.find((entry) => entry.id === project);
|
|
515
514
|
return target !== void 0 && operatorIn(target);
|
|
516
515
|
}
|
|
@@ -13061,7 +13060,7 @@ function createMembershipMutations(config) {
|
|
|
13061
13060
|
return [];
|
|
13062
13061
|
}
|
|
13063
13062
|
const task = await trx.selectFrom("task").selectAll().where("project", "=", canonical.project.id).where("key", "=", canonical.key).executeTakeFirst();
|
|
13064
|
-
return task === void 0 ? [] : [await authorizationTarget(trx, task)];
|
|
13063
|
+
return task === void 0 ? [projectTarget(canonical.project.id)] : [await authorizationTarget(trx, task)];
|
|
13065
13064
|
},
|
|
13066
13065
|
async run(trx, input, ctx) {
|
|
13067
13066
|
const { project, key } = canonicalKey(config, input.task);
|
|
@@ -17450,82 +17449,202 @@ async function loadItem(trx, id) {
|
|
|
17450
17449
|
task: item.task_id === null ? void 0 : await trx.selectFrom("task").selectAll().where("id", "=", item.task_id).executeTakeFirstOrThrow()
|
|
17451
17450
|
};
|
|
17452
17451
|
}
|
|
17452
|
+
/**
|
|
17453
|
+
* A stored JSON reference read leniently: a legacy or hand-edited value that is not JSON or not
|
|
17454
|
+
* of `schema`'s shape is no reference, so the item falls to its next rule or to the board.
|
|
17455
|
+
*/
|
|
17456
|
+
function readRef(schema, text) {
|
|
17457
|
+
try {
|
|
17458
|
+
const parsed = schema.safeParse(JSON.parse(text));
|
|
17459
|
+
return parsed.success ? parsed.data : void 0;
|
|
17460
|
+
} catch {
|
|
17461
|
+
return;
|
|
17462
|
+
}
|
|
17463
|
+
}
|
|
17453
17464
|
/** The ids a delivery payload may carry; each payload kind has its own full schema. */
|
|
17454
17465
|
const deliveryPayloadSchema = z.object({
|
|
17455
17466
|
taskId: z.unknown().optional(),
|
|
17456
|
-
|
|
17467
|
+
blockId: z.unknown().optional(),
|
|
17468
|
+
notificationId: z.unknown().optional(),
|
|
17469
|
+
itemId: z.unknown().optional()
|
|
17457
17470
|
});
|
|
17458
17471
|
/** The outbox row of a `delivery:<outbox id>` item; the item itself has no task. */
|
|
17459
17472
|
function deliveryId$1(item) {
|
|
17460
|
-
|
|
17473
|
+
if (item.kind !== "post_failed" || item.task_id !== null) return void 0;
|
|
17474
|
+
const id = Number(item.item_key.slice(9));
|
|
17475
|
+
return Number.isSafeInteger(id) && id > 0 ? id : void 0;
|
|
17461
17476
|
}
|
|
17477
|
+
/** The conversation of an `inbound_failure` item's stored event. */
|
|
17478
|
+
const storedEventSchema = z.object({ conversation: z.unknown().optional() });
|
|
17479
|
+
const UNAVAILABLE_KEY = "doorbell:unavailable:";
|
|
17462
17480
|
/**
|
|
17463
|
-
*
|
|
17464
|
-
*
|
|
17481
|
+
* How an item with neither a task nor a block finds its subject from what it stores: an
|
|
17482
|
+
* unavailable answer author's ring key names the comment, a stored inbound event its thread.
|
|
17483
|
+
* Rows raised before the block was stored on these items have only these.
|
|
17465
17484
|
*/
|
|
17466
|
-
|
|
17467
|
-
|
|
17485
|
+
function storedRef(item) {
|
|
17486
|
+
if (item.item_key.startsWith(UNAVAILABLE_KEY)) {
|
|
17487
|
+
const comment = ringCommentId(item.item_key.slice(21));
|
|
17488
|
+
if (comment !== void 0) return { comment };
|
|
17489
|
+
}
|
|
17490
|
+
if (item.inbound_event_json === null) return {};
|
|
17491
|
+
const conversation = readRef(storedEventSchema, item.inbound_event_json)?.conversation;
|
|
17492
|
+
return typeof conversation === "string" ? { conversation } : {};
|
|
17493
|
+
}
|
|
17494
|
+
/**
|
|
17495
|
+
* How a failed delivery's outbox row finds its subject, from its payload or ring, if at all: a
|
|
17496
|
+
* feed line by the item it is about, a feed edit by the line it edits.
|
|
17497
|
+
*/
|
|
17498
|
+
function deliveryRef(row) {
|
|
17499
|
+
const payload = readRef(deliveryPayloadSchema, row.payload) ?? {};
|
|
17500
|
+
if (typeof payload.taskId === "number") return { task: payload.taskId };
|
|
17501
|
+
if (typeof payload.blockId === "number") return { block: payload.blockId };
|
|
17502
|
+
if (row.kind === "feed.line") return typeof payload.itemId === "number" ? { item: payload.itemId } : void 0;
|
|
17503
|
+
if (row.kind === "feed.line.edit") return row.parent_outbox_id === null ? void 0 : { delivery: row.parent_outbox_id };
|
|
17504
|
+
if (row.kind !== "doorbell") return void 0;
|
|
17505
|
+
if (typeof payload.notificationId === "number") return { notification: payload.notificationId };
|
|
17506
|
+
const comment = ringCommentId(row.dedupe_key);
|
|
17507
|
+
return comment === void 0 ? void 0 : { comment };
|
|
17508
|
+
}
|
|
17509
|
+
/** Outbox rows read per edit chain: a token card's revoked edit follows its card edit. */
|
|
17510
|
+
const DELIVERY_HOPS = 3;
|
|
17511
|
+
/** Operator items followed from a feed line: the line's item, never an item's line again. */
|
|
17512
|
+
const ITEM_HOPS = 1;
|
|
17513
|
+
/**
|
|
17514
|
+
* Each failed delivery's ref, following a feed edit to the line it edits for at most
|
|
17515
|
+
* `DELIVERY_HOPS` rows; a longer chain has no ref. One statement per hop.
|
|
17516
|
+
*/
|
|
17517
|
+
async function deliveryRefs(trx, outboxIds) {
|
|
17518
|
+
const refs = /* @__PURE__ */ new Map();
|
|
17519
|
+
let pending = new Map(outboxIds.map((id) => [id, id]));
|
|
17520
|
+
for (let hop = 0; hop < DELIVERY_HOPS && pending.size > 0; hop += 1) {
|
|
17521
|
+
const rows = await trx.selectFrom("outbox").select([
|
|
17522
|
+
"id",
|
|
17523
|
+
"kind",
|
|
17524
|
+
"dedupe_key",
|
|
17525
|
+
"payload",
|
|
17526
|
+
"parent_outbox_id"
|
|
17527
|
+
]).where("id", "in", [...new Set(pending.values())]).execute();
|
|
17528
|
+
const refOf = new Map(rows.map((row) => [row.id, deliveryRef(row)]));
|
|
17529
|
+
const next = /* @__PURE__ */ new Map();
|
|
17530
|
+
for (const [origin, current] of pending) {
|
|
17531
|
+
const ref = refOf.get(current);
|
|
17532
|
+
if (ref?.delivery === void 0) refs.set(origin, ref);
|
|
17533
|
+
else next.set(origin, ref.delivery);
|
|
17534
|
+
}
|
|
17535
|
+
pending = next;
|
|
17536
|
+
}
|
|
17537
|
+
return refs;
|
|
17538
|
+
}
|
|
17539
|
+
/**
|
|
17540
|
+
* What each item is about; `inbox.operator`, `status.get` and item actions all file an item by
|
|
17541
|
+
* it. An item is its own task's; else a failed delivery's: its payload's task, the block it
|
|
17542
|
+
* posts, for a doorbell its ring's notification or comment, for a feed line the subject of the
|
|
17543
|
+
* item it is about, for a feed edit that of the line it edits; else the block it refers to
|
|
17544
|
+
* (`itemBlockRef`); else the comment or thread it stores (`storedRef`). A notification, comment
|
|
17545
|
+
* or thread is its task's, else its block's; a block is its task's, else a project-level block
|
|
17546
|
+
* its project's. An item that reaches neither is the project's whose repository or tracker
|
|
17547
|
+
* source it names (`projectForSource`), such as a blind source or a red default branch; the
|
|
17548
|
+
* `spur` source and other board-wide ones name none. A subject whose project has left the config
|
|
17549
|
+
* is the board's, except an archived task's, which stays hidden. An item missing from the map is
|
|
17550
|
+
* a board item, as is one whose stored reference cannot be read. The number of statements it reads is bounded (`DELIVERY_HOPS`, `ITEM_HOPS`),
|
|
17551
|
+
* whatever the item count.
|
|
17552
|
+
*/
|
|
17553
|
+
async function itemSubjects(trx, items, config) {
|
|
17554
|
+
return subjectsOf(trx, items, config, ITEM_HOPS);
|
|
17555
|
+
}
|
|
17556
|
+
/** `itemSubjects`, following a feed line to its item for at most `itemHops` items. */
|
|
17557
|
+
async function subjectsOf(trx, items, config, itemHops) {
|
|
17468
17558
|
const outboxIds = items.flatMap((item) => deliveryId$1(item) ?? []);
|
|
17469
|
-
|
|
17470
|
-
const rows = await trx.selectFrom("outbox").select([
|
|
17471
|
-
"id",
|
|
17472
|
-
"kind",
|
|
17473
|
-
"dedupe_key",
|
|
17474
|
-
"payload"
|
|
17475
|
-
]).where("id", "in", outboxIds).execute();
|
|
17559
|
+
const refOfDelivery = outboxIds.length === 0 ? /* @__PURE__ */ new Map() : await deliveryRefs(trx, outboxIds);
|
|
17476
17560
|
const refs = /* @__PURE__ */ new Map();
|
|
17477
|
-
for (const row of rows) {
|
|
17478
|
-
const payload = parseJson(deliveryPayloadSchema, row.payload);
|
|
17479
|
-
if (typeof payload.taskId === "number") refs.set(row.id, { task: payload.taskId });
|
|
17480
|
-
else if (row.kind !== "doorbell") continue;
|
|
17481
|
-
else if (typeof payload.notificationId === "number") refs.set(row.id, { notification: payload.notificationId });
|
|
17482
|
-
else {
|
|
17483
|
-
const comment = ringCommentId(row.dedupe_key);
|
|
17484
|
-
if (comment !== void 0) refs.set(row.id, { comment });
|
|
17485
|
-
}
|
|
17486
|
-
}
|
|
17487
|
-
const ids = (pick) => [...refs.values()].flatMap((ref) => ref[pick] ?? []);
|
|
17488
|
-
const [notifications, comments] = await Promise.all(["notification", "comment"].map((table) => {
|
|
17489
|
-
const wanted = ids(table);
|
|
17490
|
-
return wanted.length === 0 ? Promise.resolve([]) : trx.selectFrom(table).select(["id", "task_id"]).where("id", "in", wanted).execute();
|
|
17491
|
-
}));
|
|
17492
|
-
const taskOf = {
|
|
17493
|
-
notification: new Map(notifications?.map((row) => [row.id, row.task_id])),
|
|
17494
|
-
comment: new Map(comments?.map((row) => [row.id, row.task_id]))
|
|
17495
|
-
};
|
|
17496
|
-
const taskIds = /* @__PURE__ */ new Map();
|
|
17497
|
-
for (const [outboxId, ref] of refs) {
|
|
17498
|
-
const taskId = ref.task ?? (ref.notification === void 0 ? void 0 : taskOf.notification.get(ref.notification)) ?? (ref.comment === void 0 ? void 0 : taskOf.comment.get(ref.comment));
|
|
17499
|
-
if (typeof taskId === "number") taskIds.set(outboxId, taskId);
|
|
17500
|
-
}
|
|
17501
|
-
if (taskIds.size === 0) return owners;
|
|
17502
|
-
const tasks = await trx.selectFrom("task").selectAll().where("id", "in", [...new Set(taskIds.values())]).execute();
|
|
17503
|
-
const taskById = new Map(tasks.map((task) => [task.id, task]));
|
|
17504
17561
|
for (const item of items) {
|
|
17505
17562
|
const outboxId = deliveryId$1(item);
|
|
17506
|
-
const
|
|
17507
|
-
const
|
|
17508
|
-
|
|
17563
|
+
const blockRef = itemBlockRef(item);
|
|
17564
|
+
const ref = item.task_id !== null ? { task: item.task_id } : (outboxId === void 0 ? void 0 : refOfDelivery.get(outboxId)) ?? (blockRef === void 0 ? storedRef(item) : { block: blockRef });
|
|
17565
|
+
refs.set(item.id, ref);
|
|
17566
|
+
}
|
|
17567
|
+
const ids = (pick) => [...new Set([...refs.values()].flatMap((ref) => ref[pick] ?? []))];
|
|
17568
|
+
const lineItemIds = itemHops === 0 ? [] : ids("item");
|
|
17569
|
+
const lineItems = lineItemIds.length === 0 ? [] : await trx.selectFrom("operator_item").selectAll().where("id", "in", lineItemIds).execute();
|
|
17570
|
+
const lineSubjects = lineItems.length === 0 ? /* @__PURE__ */ new Map() : await subjectsOf(trx, lineItems, config, itemHops - 1);
|
|
17571
|
+
const notificationIds = ids("notification");
|
|
17572
|
+
const commentIds = ids("comment");
|
|
17573
|
+
const conversationRefs = ids("conversation");
|
|
17574
|
+
const [notifications, comments, conversations] = await Promise.all([
|
|
17575
|
+
notificationIds.length === 0 ? [] : trx.selectFrom("notification").select([
|
|
17576
|
+
"id",
|
|
17577
|
+
"task_id",
|
|
17578
|
+
"block_id"
|
|
17579
|
+
]).where("id", "in", notificationIds).execute(),
|
|
17580
|
+
commentIds.length === 0 ? [] : trx.selectFrom("comment").select([
|
|
17581
|
+
"id",
|
|
17582
|
+
"task_id",
|
|
17583
|
+
"block_id"
|
|
17584
|
+
]).where("id", "in", commentIds).execute(),
|
|
17585
|
+
conversationRefs.length === 0 ? [] : trx.selectFrom("conversation").select([
|
|
17586
|
+
"ref",
|
|
17587
|
+
"task_id",
|
|
17588
|
+
"block_id"
|
|
17589
|
+
]).where("ref", "in", conversationRefs).execute()
|
|
17590
|
+
]);
|
|
17591
|
+
const linkedOf = {
|
|
17592
|
+
notification: new Map(notifications.map((row) => [row.id, row])),
|
|
17593
|
+
comment: new Map(comments.map((row) => [row.id, row])),
|
|
17594
|
+
conversation: new Map(conversations.map((row) => [row.ref, row]))
|
|
17595
|
+
};
|
|
17596
|
+
const linked = (ref) => (ref.notification === void 0 ? void 0 : linkedOf.notification.get(ref.notification)) ?? (ref.comment === void 0 ? void 0 : linkedOf.comment.get(ref.comment)) ?? (ref.conversation === void 0 ? void 0 : linkedOf.conversation.get(ref.conversation));
|
|
17597
|
+
const blockOf = (ref) => ref.block ?? linked(ref)?.block_id ?? void 0;
|
|
17598
|
+
const blockIds = [...new Set([...refs.values()].flatMap((ref) => blockOf(ref) ?? []))];
|
|
17599
|
+
const blocks = blockIds.length === 0 ? [] : await trx.selectFrom("block").select([
|
|
17600
|
+
"id",
|
|
17601
|
+
"task_id",
|
|
17602
|
+
"project"
|
|
17603
|
+
]).where("id", "in", blockIds).execute();
|
|
17604
|
+
const blockById = new Map(blocks.map((row) => [row.id, row]));
|
|
17605
|
+
const configured = new Set(config.projects.map((project) => project.id));
|
|
17606
|
+
const sourceOf = new Map(items.map((item) => [item.id, item.source]));
|
|
17607
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
17608
|
+
for (const [itemId, ref] of refs) {
|
|
17609
|
+
const blockId = blockOf(ref);
|
|
17610
|
+
const block = blockId === void 0 ? void 0 : blockById.get(blockId);
|
|
17611
|
+
const taskId = ref.task ?? linked(ref)?.task_id ?? block?.task_id;
|
|
17612
|
+
const source = sourceOf.get(itemId) ?? null;
|
|
17613
|
+
const sourceProject = source === null ? void 0 : projectForSource(config, source)?.id;
|
|
17614
|
+
if (typeof taskId === "number") resolved.set(itemId, { task: taskId });
|
|
17615
|
+
else if (block?.project != null) resolved.set(itemId, { project: block.project });
|
|
17616
|
+
else if (sourceProject !== void 0) resolved.set(itemId, { project: sourceProject });
|
|
17617
|
+
}
|
|
17618
|
+
const taskIds = [...new Set([...resolved.values()].flatMap((entry) => "task" in entry ? [entry.task] : []))];
|
|
17619
|
+
const tasks = taskIds.length === 0 ? [] : await trx.selectFrom("task").selectAll().where("id", "in", taskIds).execute();
|
|
17620
|
+
const taskById = new Map(tasks.map((task) => [task.id, task]));
|
|
17621
|
+
const subjects = /* @__PURE__ */ new Map();
|
|
17622
|
+
for (const [itemId, entry] of resolved) {
|
|
17623
|
+
const task = "task" in entry ? taskById.get(entry.task) : void 0;
|
|
17624
|
+
const subject = "task" in entry ? task === void 0 ? void 0 : taskSubject(task) : projectSubject(entry.project);
|
|
17625
|
+
if (subject === void 0) continue;
|
|
17626
|
+
if (configured.has(subject.project) || task?.membership === "archived") subjects.set(itemId, subject);
|
|
17509
17627
|
}
|
|
17510
|
-
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
return
|
|
17628
|
+
for (const [itemId, ref] of refs) {
|
|
17629
|
+
const subject = ref.item === void 0 ? void 0 : lineSubjects.get(ref.item);
|
|
17630
|
+
if (subject !== void 0) subjects.set(itemId, subject);
|
|
17631
|
+
}
|
|
17632
|
+
return subjects;
|
|
17515
17633
|
}
|
|
17516
|
-
/**
|
|
17517
|
-
async function
|
|
17518
|
-
return
|
|
17634
|
+
/** One item's subject (`itemSubjects`); undefined for a board item. */
|
|
17635
|
+
async function itemSubject(trx, item, config) {
|
|
17636
|
+
return (await itemSubjects(trx, [item], config)).get(item.id);
|
|
17519
17637
|
}
|
|
17520
17638
|
/**
|
|
17521
|
-
* An item
|
|
17522
|
-
* only the board-wide operator or
|
|
17639
|
+
* An item is its subject's project's (`itemSubjects`); a board item or an unknown ID has no
|
|
17640
|
+
* target, so only the token, the board-wide operator or, without one, a one-project board's
|
|
17641
|
+
* operator may act on it, and `run` raises the unknown ID.
|
|
17523
17642
|
*/
|
|
17524
|
-
async function itemTarget(trx, input) {
|
|
17643
|
+
async function itemTarget(trx, config, input) {
|
|
17525
17644
|
const item = await trx.selectFrom("operator_item").selectAll().where("id", "=", Number(input.item.slice(1))).executeTakeFirst();
|
|
17526
17645
|
if (item === void 0) return [];
|
|
17527
|
-
const
|
|
17528
|
-
return
|
|
17646
|
+
const subject = await itemSubject(trx, item, config);
|
|
17647
|
+
return subject === void 0 ? [] : [await subjectTarget(trx, subject)];
|
|
17529
17648
|
}
|
|
17530
17649
|
function view(item, task) {
|
|
17531
17650
|
return { item: {
|
|
@@ -17543,6 +17662,7 @@ function notApplicable(hint) {
|
|
|
17543
17662
|
* except a retry on a transport item, which the sender clears when the transport is back.
|
|
17544
17663
|
*/
|
|
17545
17664
|
function createItemMutations(deps) {
|
|
17665
|
+
const resolveTargets = (trx, input) => itemTarget(trx, deps.config, input);
|
|
17546
17666
|
/** Runs the retry behind the item's kind; false when the item must stay raised. */
|
|
17547
17667
|
async function retryAction(trx, item, at) {
|
|
17548
17668
|
const closeHint = `close it with \`board item close I${String(item.id)}\`.`;
|
|
@@ -17575,10 +17695,10 @@ function createItemMutations(deps) {
|
|
|
17575
17695
|
return {
|
|
17576
17696
|
retry: {
|
|
17577
17697
|
id: "item.retry",
|
|
17578
|
-
resolveTargets
|
|
17698
|
+
resolveTargets,
|
|
17579
17699
|
async run(trx, input, ctx) {
|
|
17580
17700
|
const { item, task } = await loadItem(trx, input.item);
|
|
17581
|
-
if ((
|
|
17701
|
+
if (((await itemSubject(trx, item, deps.config))?.task)?.membership === "archived") throw new CommandError("task_archived", "Add the task again before retrying its item.");
|
|
17582
17702
|
if (item.cleared_at !== null) throw notApplicable("The item is already cleared.");
|
|
17583
17703
|
if (await retryAction(trx, item, ctx.at)) await clearItem(trx, item.id, new Date(ctx.at), ctx.actor);
|
|
17584
17704
|
return view(item, task);
|
|
@@ -17586,7 +17706,7 @@ function createItemMutations(deps) {
|
|
|
17586
17706
|
},
|
|
17587
17707
|
close: {
|
|
17588
17708
|
id: "item.close",
|
|
17589
|
-
resolveTargets
|
|
17709
|
+
resolveTargets,
|
|
17590
17710
|
async run(trx, input, ctx) {
|
|
17591
17711
|
const { item, task } = await loadItem(trx, input.item);
|
|
17592
17712
|
if (item.cleared_at === null) {
|
|
@@ -17840,7 +17960,7 @@ async function getStatus(deps, options = {}) {
|
|
|
17840
17960
|
};
|
|
17841
17961
|
const { project: projectId, visibleProjects, detail = false } = options;
|
|
17842
17962
|
const includeBoardItems = options.includeBoardItems ?? visibleProjects === void 0;
|
|
17843
|
-
const operatorProjects = options.operatorProjects ??
|
|
17963
|
+
const operatorProjects = options.operatorProjects ?? new Set(visibleProjects === void 0 ? config.projects.map((project) => project.id) : []);
|
|
17844
17964
|
const visible = config.projects.filter((project) => visibleProjects === void 0 || visibleProjects.has(project.id));
|
|
17845
17965
|
const projects = projectId === void 0 ? visible : visible.filter((project) => project.id === projectId);
|
|
17846
17966
|
if (projects.length === 0) throw new CommandError("not_found", "Check the project ID.");
|
|
@@ -18029,17 +18149,15 @@ async function getStatus(deps, options = {}) {
|
|
|
18029
18149
|
}));
|
|
18030
18150
|
const itemRows = await store.db.selectFrom("operator_item").selectAll().where("cleared_at", "is", null).execute();
|
|
18031
18151
|
const itemTasks = new Map(rows.map((task) => [task.id, task]));
|
|
18032
|
-
const
|
|
18033
|
-
if (!includeBoardItems && operatorProjects.size > 0) for (const item of itemRows) {
|
|
18034
|
-
if (item.task_id !== null || item.source !== null) continue;
|
|
18035
|
-
const owner = await itemOwner(store.db, item);
|
|
18036
|
-
if (owner !== void 0) ownedProjects.set(item.id, owner.project);
|
|
18037
|
-
}
|
|
18152
|
+
const subjects = await itemSubjects(store.db, itemRows, config);
|
|
18038
18153
|
const ownedBy = (item) => {
|
|
18039
|
-
const
|
|
18040
|
-
|
|
18154
|
+
const subject = subjects.get(item.id);
|
|
18155
|
+
if (subject === void 0) return includeBoardItems || item.source !== null && required.has(item.source);
|
|
18156
|
+
if (item.task_id !== null) return subject.task?.membership !== "archived" && projectIds.has(subject.project);
|
|
18157
|
+
if (item.source !== null && projectForSource(config, item.source) !== void 0) return projectIds.has(subject.project);
|
|
18158
|
+
return projectIds.has(subject.project) && operatorProjects.has(subject.project);
|
|
18041
18159
|
};
|
|
18042
|
-
const items = itemRows.filter(
|
|
18160
|
+
const items = itemRows.filter(ownedBy).map((item) => {
|
|
18043
18161
|
const source = item.source === null ? null : sourceById.get(item.source);
|
|
18044
18162
|
const unconfirmed = item.fact_at !== null && item.source !== null && clock.now() - Date.parse(item.fact_at) > config.thresholds.staleMultiplier * sourceInterval(config, item.source) || item.text.includes("no_access") || source !== null && source !== void 0 && source.blind_reason !== null;
|
|
18045
18163
|
const time = item.fact_at === null ? null : new Date(item.fact_at).toISOString().slice(11, 16);
|
|
@@ -19517,7 +19635,7 @@ function createOperatorInbox(deps) {
|
|
|
19517
19635
|
const items = [...openItems, ...lastCleared.values()];
|
|
19518
19636
|
const blockIds = [...new Set(items.flatMap((item) => itemBlockRef(item) ?? []))];
|
|
19519
19637
|
const sourceIds = items.flatMap((item) => item.item_key.startsWith("source:") ? [item.item_key.slice(7)] : []);
|
|
19520
|
-
const [referenced,
|
|
19638
|
+
const [referenced, subjects, sources, deliveries, waiting] = await Promise.all([
|
|
19521
19639
|
blockIds.length === 0 ? Promise.resolve([]) : trx.selectFrom("block").leftJoin("task", "task.id", "block.task_id").select([
|
|
19522
19640
|
"block.id",
|
|
19523
19641
|
"block.addressee_role",
|
|
@@ -19525,7 +19643,7 @@ function createOperatorInbox(deps) {
|
|
|
19525
19643
|
"block.addressee_spur_project",
|
|
19526
19644
|
...taskColumns
|
|
19527
19645
|
]).where("block.id", "in", blockIds).execute(),
|
|
19528
|
-
|
|
19646
|
+
itemSubjects(trx, items, config),
|
|
19529
19647
|
sourceIds.length === 0 ? Promise.resolve([]) : trx.selectFrom("source_state").select([
|
|
19530
19648
|
"source",
|
|
19531
19649
|
"blind_reason",
|
|
@@ -19542,7 +19660,8 @@ function createOperatorInbox(deps) {
|
|
|
19542
19660
|
const ref = itemBlockRef(item);
|
|
19543
19661
|
const block = ref === void 0 ? void 0 : blockById.get(ref);
|
|
19544
19662
|
if (block?.addressee_role === "operator" && (ITEM_POLICY[kind].block || item.item_key.startsWith("operator-block:") || item.item_key.startsWith("block:"))) return void 0;
|
|
19545
|
-
const
|
|
19663
|
+
const subject = subjects.get(item.id);
|
|
19664
|
+
const task = subject?.task ?? null;
|
|
19546
19665
|
if (task?.membership === "archived") return void 0;
|
|
19547
19666
|
const { condition, action } = item.item_key.startsWith("source:") ? sourceText(item, sourceById.get(item.item_key.slice(7))) : kind === "board_observation" && item.item_key.startsWith("no-session:") ? noSessionText(item, config, waiting, clock.now()) : {
|
|
19548
19667
|
condition: item.text,
|
|
@@ -19554,7 +19673,7 @@ function createOperatorInbox(deps) {
|
|
|
19554
19673
|
const url = itemUrl(item, deliveries);
|
|
19555
19674
|
return {
|
|
19556
19675
|
id: `I${String(item.id)}`,
|
|
19557
|
-
project:
|
|
19676
|
+
project: subject?.project ?? "_board",
|
|
19558
19677
|
kind,
|
|
19559
19678
|
severity: itemSeverity(kind, item.item_key),
|
|
19560
19679
|
text: `${condition}: ${action}`,
|
|
@@ -21529,11 +21648,17 @@ async function journal(trx, input) {
|
|
|
21529
21648
|
async function taskContext(trx, event, gateway) {
|
|
21530
21649
|
if (!("conversation" in event) || event.conversation === void 0) return {
|
|
21531
21650
|
taskId: null,
|
|
21651
|
+
blockId: null,
|
|
21532
21652
|
project: null
|
|
21533
21653
|
};
|
|
21534
|
-
const row = await trx.selectFrom("conversation").leftJoin("task", "task.id", "conversation.task_id").leftJoin("block", "block.id", "conversation.block_id").select((eb) => [
|
|
21654
|
+
const row = await trx.selectFrom("conversation").leftJoin("task", "task.id", "conversation.task_id").leftJoin("block", "block.id", "conversation.block_id").select((eb) => [
|
|
21655
|
+
"conversation.task_id as taskId",
|
|
21656
|
+
"conversation.block_id as blockId",
|
|
21657
|
+
eb.fn.coalesce("task.project", "block.project").as("project")
|
|
21658
|
+
]).where("conversation.gateway", "=", gateway).where("conversation.ref", "=", event.conversation).executeTakeFirst();
|
|
21535
21659
|
return {
|
|
21536
21660
|
taskId: row?.taskId ?? null,
|
|
21661
|
+
blockId: row?.blockId ?? null,
|
|
21537
21662
|
project: row?.project ?? null
|
|
21538
21663
|
};
|
|
21539
21664
|
}
|
|
@@ -21544,7 +21669,7 @@ async function raiseInboundItem(trx, input) {
|
|
|
21544
21669
|
text: input.title,
|
|
21545
21670
|
url: input.sourceUrl ?? "",
|
|
21546
21671
|
taskId: input.taskId,
|
|
21547
|
-
blockId:
|
|
21672
|
+
blockId: input.blockId,
|
|
21548
21673
|
at: new Date(input.at)
|
|
21549
21674
|
});
|
|
21550
21675
|
if (input.retry && item.inbound_event_json === null) await trx.updateTable("operator_item").set({ inbound_event_json: toJson(inboundEventSchema, input.event) }).where("id", "=", item.id).execute();
|
|
@@ -21645,6 +21770,7 @@ async function ringAuthor(trx, input) {
|
|
|
21645
21770
|
sourceUrl: input.event.sourceUrl,
|
|
21646
21771
|
event: input.event,
|
|
21647
21772
|
taskId: input.subject.task?.id ?? null,
|
|
21773
|
+
blockId: input.block.id,
|
|
21648
21774
|
at: input.at,
|
|
21649
21775
|
retry: false
|
|
21650
21776
|
});
|
|
@@ -22002,6 +22128,7 @@ function createInbound(input) {
|
|
|
22002
22128
|
sourceUrl: event.sourceUrl,
|
|
22003
22129
|
event,
|
|
22004
22130
|
taskId: context.taskId,
|
|
22131
|
+
blockId: context.blockId,
|
|
22005
22132
|
at,
|
|
22006
22133
|
retry: true
|
|
22007
22134
|
});
|
|
@@ -22104,6 +22231,7 @@ function createInbound(input) {
|
|
|
22104
22231
|
sourceUrl: ref?.permalink ?? null,
|
|
22105
22232
|
event,
|
|
22106
22233
|
taskId: context.taskId,
|
|
22234
|
+
blockId: context.blockId,
|
|
22107
22235
|
at,
|
|
22108
22236
|
retry: false
|
|
22109
22237
|
});
|
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-Bt8v7TND.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-B9Pt8i90.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-sn-nSSNs.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|