@songsid/agend 2.4.0-beta.27 → 2.4.0-beta.29
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/agent-cli-instructions.md +2 -1
- package/dist/agent-cli.js +6 -0
- package/dist/agent-cli.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/discord.d.ts +13 -1
- package/dist/channel/adapters/discord.js +51 -21
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/mcp-tools.js +1 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/claude-turn-boundaries.d.ts +15 -0
- package/dist/claude-turn-boundaries.js +88 -0
- package/dist/claude-turn-boundaries.js.map +1 -0
- package/dist/contact-auth-service.js +3 -0
- package/dist/contact-auth-service.js.map +1 -1
- package/dist/contact-auth-store.d.ts +16 -0
- package/dist/contact-auth-store.js +61 -1
- package/dist/contact-auth-store.js.map +1 -1
- package/dist/daemon.d.ts +12 -1
- package/dist/daemon.js +130 -19
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-outbox.d.ts +38 -0
- package/dist/delivery-outbox.js +81 -1
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +17 -1
- package/dist/fleet-manager.js +239 -16
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +5 -0
- package/dist/general-knowledge/skills/task-board/SKILL.md +14 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +1 -1
- package/dist/host-memory.d.ts +21 -1
- package/dist/host-memory.js +30 -4
- package/dist/host-memory.js.map +1 -1
- package/dist/host-monitoring/linux/interpretation.js +1 -1
- package/dist/host-monitoring/linux/interpretation.js.map +1 -1
- package/dist/host-monitoring/wsl/interpretation.js +1 -1
- package/dist/host-monitoring/wsl/interpretation.js.map +1 -1
- package/dist/host-monitoring.d.ts +3 -1
- package/dist/hub/compose/server.js +1 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/hub/http/compose.js +100 -56
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/core.d.ts +2 -0
- package/dist/hub/http/core.js +17 -7
- package/dist/hub/http/core.js.map +1 -1
- package/dist/hub/policy.js +56 -27
- package/dist/hub/policy.js.map +1 -1
- package/dist/hub/roles/clock.d.ts +1 -1
- package/dist/hub/roles/clock.js +8 -6
- package/dist/hub/roles/clock.js.map +1 -1
- package/dist/hub/roles/cutover-clock-facts.d.ts +13 -0
- package/dist/hub/roles/cutover-clock-facts.js +25 -0
- package/dist/hub/roles/cutover-clock-facts.js.map +1 -0
- package/dist/hub/roles/read.d.ts +2 -0
- package/dist/hub/roles/read.js +15 -6
- package/dist/hub/roles/read.js.map +1 -1
- package/dist/hub/rooms.d.ts +8 -4
- package/dist/hub/rooms.js +18 -5
- package/dist/hub/rooms.js.map +1 -1
- package/dist/hub/send-timing.d.ts +6 -0
- package/dist/hub/send-timing.js +39 -0
- package/dist/hub/send-timing.js.map +1 -0
- package/dist/hub/settings-directory-decision.js +11 -5
- package/dist/hub/settings-directory-decision.js.map +1 -1
- package/dist/hub/settings-member-address-decision.js +1 -1
- package/dist/hub/settings-member-address-decision.js.map +1 -1
- package/dist/hub/store.d.ts +4 -0
- package/dist/hub/store.js +19 -4
- package/dist/hub/store.js.map +1 -1
- package/dist/locale.js +19 -1
- package/dist/locale.js.map +1 -1
- package/dist/memory-pressure.js +8 -1
- package/dist/memory-pressure.js.map +1 -1
- package/dist/outbound-schemas.d.ts +3 -0
- package/dist/outbound-schemas.js +4 -2
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/request-context-activation.js +14 -3
- package/dist/request-context-activation.js.map +1 -1
- package/dist/request-context-call.d.ts +1 -0
- package/dist/request-context-call.js.map +1 -1
- package/dist/request-context-compatibility.js +10 -2
- package/dist/request-context-compatibility.js.map +1 -1
- package/dist/request-context-control-api.d.ts +18 -0
- package/dist/request-context-control-api.js +4 -2
- package/dist/request-context-control-api.js.map +1 -1
- package/dist/request-context-drain-projection.d.ts +8 -0
- package/dist/request-context-drain-projection.js +40 -0
- package/dist/request-context-drain-projection.js.map +1 -0
- package/dist/request-context-drain.d.ts +9 -0
- package/dist/request-context-drain.js +63 -4
- package/dist/request-context-drain.js.map +1 -1
- package/dist/request-context-human.d.ts +6 -0
- package/dist/request-context-human.js +24 -1
- package/dist/request-context-human.js.map +1 -1
- package/dist/request-context-migration.d.ts +11 -0
- package/dist/request-context-migration.js +16 -3
- package/dist/request-context-migration.js.map +1 -1
- package/dist/request-context-reply-pending.d.ts +16 -0
- package/dist/request-context-reply-pending.js +77 -0
- package/dist/request-context-reply-pending.js.map +1 -0
- package/dist/request-context-resolution.d.ts +35 -0
- package/dist/request-context-resolution.js +86 -0
- package/dist/request-context-resolution.js.map +1 -0
- package/dist/request-context-retirement.d.ts +2 -0
- package/dist/request-context-retirement.js.map +1 -1
- package/dist/runtime-build-info.js +1 -1
- package/dist/runtime-build-info.js.map +1 -1
- package/dist/scheduler/db.js +9 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-text.d.ts +3 -6
- package/dist/scheduler/task-board-text.js +15 -10
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board-unread.d.ts +90 -0
- package/dist/scheduler/task-board-unread.js +192 -0
- package/dist/scheduler/task-board-unread.js.map +1 -0
- package/dist/scheduler/task-board.d.ts +324 -6
- package/dist/scheduler/task-board.js +786 -47
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/settings-effect.js +17 -2
- package/dist/settings-effect.js.map +1 -1
- package/dist/task-board-tool.js +24 -3
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-board-waker.d.ts +53 -2
- package/dist/task-board-waker.js +183 -12
- package/dist/task-board-waker.js.map +1 -1
- package/dist/transcript-monitor.d.ts +6 -1
- package/dist/transcript-monitor.js +59 -4
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-turns.d.ts +3 -0
- package/dist/transcript-turns.js +5 -0
- package/dist/transcript-turns.js.map +1 -1
- package/dist/ui/fleet-task-activity.js +164 -24
- package/dist/ui/fleet-task-card.js +77 -13
- package/dist/ui/fleet-task-common.js +14 -0
- package/dist/ui/fleet-task-flow.js +353 -0
- package/dist/ui/fleet-task-md.js +1 -1
- package/dist/ui/fleet-task-run.js +98 -22
- package/dist/ui/fleet-task-thread.js +245 -0
- package/dist/ui/fleet-task-unread.js +100 -0
- package/dist/ui/fleet-task-view.js +6 -5
- package/dist/ui/fleet-task-wake.js +140 -0
- package/dist/ui/fleet-tasks.js +13 -6
- package/dist/ui/host-health.js +3 -3
- package/dist/ui/host-monitoring-linux.js +2 -2
- package/dist/ui/host-monitoring-wsl.js +2 -2
- package/dist/ui/panel-windows-cli.js +2 -2
- package/dist/ui/request-context-control.js +51 -13
- package/dist/ui/shared/access-overview.css +1 -1
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +4 -1
- package/dist/ui/shared/app-stream.js +3 -1
- package/dist/ui/shared/app.css +8 -2
- package/dist/ui/shared/app.js +3 -0
- package/dist/ui/shared/task-board.css +164 -0
- package/dist/ui/shared/ui-icons.js +3 -0
- package/dist/ui/task-unread.js +70 -0
- package/dist/ui/windows-cli-catalog.js +33 -6
- package/dist/update-goback.js +3 -1
- package/dist/update-goback.js.map +1 -1
- package/dist/web-api.d.ts +45 -1
- package/dist/web-api.js +184 -6
- package/dist/web-api.js.map +1 -1
- package/dist/windows-cli-api.js +4 -2
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli.d.ts +40 -1
- package/dist/windows-cli.js +93 -11
- package/dist/windows-cli.js.map +1 -1
- package/dist/windows-shortcuts.d.ts +3 -22
- package/dist/windows-shortcuts.js +5 -45
- package/dist/windows-shortcuts.js.map +1 -1
- package/dist/workflow-templates/default.md +3 -2
- package/dist/wsl-host.d.ts +52 -0
- package/dist/wsl-host.js +97 -0
- package/dist/wsl-host.js.map +1 -0
- package/package.json +1 -1
package/dist/web-api.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ import { type WebModelAction } from "./web-commands.js";
|
|
|
23
23
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
24
24
|
import { type ModuleGraph } from "./web-asset-version.js";
|
|
25
25
|
import type { LifecycleCreateArgs } from "./instance-lifecycle.js";
|
|
26
|
-
import { type Actor as BoardActor, type TaskBoard } from "./scheduler/task-board.js";
|
|
26
|
+
import { type Actor as BoardActor, type EntryWake, type Handoff, type HandoffWhy, type TaskBoard, type WakeSkip } from "./scheduler/task-board.js";
|
|
27
27
|
import { type PreviewAvailability } from "./web-preview.js";
|
|
28
28
|
import { type WebChatHistory, type WebChatMessage, type WebChatPost } from "./web-chat-history.js";
|
|
29
29
|
import { type WebFileLedger } from "./web-upload.js";
|
|
@@ -552,6 +552,8 @@ export interface WebApiContext extends ClaudeCredentialApi {
|
|
|
552
552
|
status: number;
|
|
553
553
|
body: Record<string, unknown>;
|
|
554
554
|
}>;
|
|
555
|
+
/** The comment status (docs/design/task-board.md): how far the notices that carried comments got in the delivery outbox, by their keys. */
|
|
556
|
+
taskWakeProgress?(keys: readonly string[]): Map<string, import("./delivery-outbox.js").NoticeProgress>;
|
|
555
557
|
/** #2910 D2: a web-only fleet's Notices (web-notices.ts); null on a fleet whose General says them. */
|
|
556
558
|
webNoticesFeed?(): {
|
|
557
559
|
view(): {
|
|
@@ -685,6 +687,48 @@ export interface WebPerson {
|
|
|
685
687
|
* quick-tunnel link. Off the gateway, what the TCP peer and Host say.
|
|
686
688
|
*/
|
|
687
689
|
export declare function webPeerOf(req: IncomingMessage): WebPeer;
|
|
690
|
+
/**
|
|
691
|
+
* How far a comment's news got for one instance, as the card page shows it (docs/design/task-board.md, "Comment status"): what the
|
|
692
|
+
* board kept with the comment (`wakes`) and what the delivery outbox says of the notice that carried it. `sending`: gathered, not yet
|
|
693
|
+
* handed over (10 s); `queued`: handed over, the instance has not taken it (offline, paused, busy); `delivered`: put to the
|
|
694
|
+
* instance; `read`: its transcript shows it took it up; `failed` / `uncertain` / `withdrawn`: the delivery failed, could not be
|
|
695
|
+
* confirmed, or was dropped because the card changed again; `skipped`: not sent, `skip` says why. Whether the instance is working
|
|
696
|
+
* on it or has answered is the page's to say (it has the instance's state and the comments). No text, no key, no delivery id.
|
|
697
|
+
*/
|
|
698
|
+
export interface WakeView {
|
|
699
|
+
to: string;
|
|
700
|
+
why: EntryWake["why"];
|
|
701
|
+
state: "sending" | "queued" | "delivered" | "read" | "failed" | "uncertain" | "withdrawn" | "skipped" | "unknown";
|
|
702
|
+
skip?: WakeSkip;
|
|
703
|
+
/** M-3908: why a `failed` notice failed (the outbox's category, never its recorded text). */
|
|
704
|
+
failure?: import("./delivery-outbox.js").NoticeFailure;
|
|
705
|
+
/** When the comment was routed. */
|
|
706
|
+
at: string;
|
|
707
|
+
/** When the instance took it up (read). */
|
|
708
|
+
readAt?: string;
|
|
709
|
+
}
|
|
710
|
+
export declare function wakeViews(wakes: ReadonlyArray<EntryWake>, progress: ReadonlyMap<string, import("./delivery-outbox.js").NoticeProgress>, now: number): WakeView[];
|
|
711
|
+
/**
|
|
712
|
+
* A card handed to the instance that works it next, as the card page shows it (docs/design/task-board.md, "Handoffs"): the card, the
|
|
713
|
+
* instance, why (`ready`: everything it waited for is done; `assigned`), the card whose finishing readied it, when — and how far the notice
|
|
714
|
+
* got, in `wakeViews`' words (`state`, `skip`, `readAt`). No key, no delivery id, no text of the notice.
|
|
715
|
+
*/
|
|
716
|
+
export interface HandoffView extends Pick<WakeView, "state" | "skip" | "readAt" | "at" | "to"> {
|
|
717
|
+
/** The handoff's own number (the page's key for it), not a card's. */
|
|
718
|
+
id: number;
|
|
719
|
+
card: string;
|
|
720
|
+
why: HandoffWhy;
|
|
721
|
+
after: string | null;
|
|
722
|
+
}
|
|
723
|
+
export declare function handoffViews(list: ReadonlyArray<Handoff>, progress: ReadonlyMap<string, import("./delivery-outbox.js").NoticeProgress>, now: number): HandoffView[];
|
|
724
|
+
/**
|
|
725
|
+
* A card's handoffs (its own and, for a main task, those of its sub tasks) with how far each notice got — for a session that can write, never of an
|
|
726
|
+
* instance kept out of sight; the card whose finishing readied one (`after`) is numbered only if the viewer may see it (`hiddenCode`: a card kept out of
|
|
727
|
+
* sight reads as none, and the page says "S-2 can start" instead of "S-1 done").
|
|
728
|
+
*/
|
|
729
|
+
export declare function withHandoffViews(board: TaskBoard, ref: string, children: ReadonlyArray<{
|
|
730
|
+
uuid: string;
|
|
731
|
+
}>, ctx: WebApiContext, hiddenName: (n: string) => boolean, hiddenCode?: (code: string) => boolean): HandoffView[];
|
|
688
732
|
export declare function handleWebRequest(req: IncomingMessage, res: ServerResponse, url: URL, ctx: WebApiContext): boolean;
|
|
689
733
|
/**
|
|
690
734
|
* #2272: the line a web reply's channel copy opens with — the quoted sender and first words when that message reached
|
package/dist/web-api.js
CHANGED
|
@@ -56,7 +56,7 @@ import { createHash, createHmac, randomUUID } from "node:crypto";
|
|
|
56
56
|
import { CreateInstanceArgs, CreateScheduleArgs, UpdateScheduleArgs, validateArgs } from "./outbound-schemas.js";
|
|
57
57
|
import { scheduleView } from "./web-schedules.js";
|
|
58
58
|
import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
|
|
59
|
-
import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError, archiveAfterDays, cardCode } from "./scheduler/task-board.js";
|
|
59
|
+
import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, MAX_RECIPIENTS, TaskBoardError, archiveAfterDays, cardCode } from "./scheduler/task-board.js";
|
|
60
60
|
import { TASK_REF_SEPARATOR, cardsForRefs, taskReadWay, taskRefBlock, taskRefCodes, taskRefView } from "./chat-task-refs.js";
|
|
61
61
|
import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js";
|
|
62
62
|
import { z } from "zod";
|
|
@@ -161,7 +161,38 @@ const CardPatchSchema = z.object({
|
|
|
161
161
|
projectId: z.number().int().nullable().optional(),
|
|
162
162
|
log: z.string().max(BOARD_TEXT).optional(),
|
|
163
163
|
comment: z.string().max(MAX_TEXT).optional(),
|
|
164
|
+
// Comment threads (docs/design/task-board.md): the comment this one answers, and whom it is for (the recipient chip).
|
|
165
|
+
replyTo: z.number().int().positive().optional(),
|
|
166
|
+
to: z.array(z.string().min(1).max(256)).max(MAX_RECIPIENTS).optional(),
|
|
164
167
|
}).strict();
|
|
168
|
+
/**
|
|
169
|
+
* A card's comments as the public link may read them (docs/design/task-board.md, "Comment threads"): a reply to a comment kept
|
|
170
|
+
* out of sight reads as a comment of its own (nothing says what it answers), and an instance kept out of sight is not named as
|
|
171
|
+
* the one who reacted, resolved or deleted.
|
|
172
|
+
*/
|
|
173
|
+
function threadsShown(comments, hiddenName) {
|
|
174
|
+
const ids = new Set(comments.map((e) => e.id));
|
|
175
|
+
return comments.map((e) => {
|
|
176
|
+
const { parentId, reactions, resolved, deleted, ...rest } = e;
|
|
177
|
+
const out = { ...rest };
|
|
178
|
+
if (parentId !== undefined && ids.has(parentId))
|
|
179
|
+
out.parentId = parentId;
|
|
180
|
+
const kept = (reactions ?? []).map((r) => ({ ...r, by: r.by.filter((b) => !hiddenName(b.name)) })).filter((r) => r.by.length);
|
|
181
|
+
if (kept.length)
|
|
182
|
+
out.reactions = kept;
|
|
183
|
+
if (resolved)
|
|
184
|
+
out.resolved = hiddenName(resolved.by) ? { at: resolved.at, by: "" } : resolved;
|
|
185
|
+
if (deleted)
|
|
186
|
+
out.deleted = hiddenName(deleted.by) ? { at: deleted.at, by: "" } : deleted;
|
|
187
|
+
return out;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/** A change to one comment of a card (docs/design/task-board.md, "Comment threads"), by the verb in the address. */
|
|
191
|
+
const CommentEditSchema = z.object({ text: z.string().max(MAX_TEXT) }).strict();
|
|
192
|
+
const CommentReactSchema = z.object({ emoji: z.string().min(1).max(64), on: z.boolean().optional() }).strict();
|
|
193
|
+
const CommentResolveSchema = z.object({ resolved: z.boolean().optional() }).strict();
|
|
194
|
+
const CommentDeleteSchema = z.object({}).strict();
|
|
195
|
+
const CardReadSchema = z.object({}).strict();
|
|
165
196
|
const CardMoveSchema = z.object({
|
|
166
197
|
to: z.enum(CARD_STATUSES),
|
|
167
198
|
reason: z.string().max(BOARD_TEXT).optional(),
|
|
@@ -2613,7 +2644,7 @@ function webPersonOr401(req, res, url, ctx) {
|
|
|
2613
2644
|
*/
|
|
2614
2645
|
function boardActor(req, url, ctx, p) {
|
|
2615
2646
|
const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
|
|
2616
|
-
return v.kind === "allow" && v.via === "session" ? { kind: "person", name: p.name } : { kind: "script", name: "web-token" };
|
|
2647
|
+
return v.kind === "allow" && v.via === "session" ? { kind: "person", name: p.name, key: p.key } : { kind: "script", name: "web-token" };
|
|
2617
2648
|
}
|
|
2618
2649
|
/**
|
|
2619
2650
|
* A board refusal as the dashboard reads it: the board's sentence, its code and the status that fits, and — when the
|
|
@@ -2664,6 +2695,79 @@ async function serveCardFile(res, board, id, rules) {
|
|
|
2664
2695
|
miss();
|
|
2665
2696
|
}
|
|
2666
2697
|
}
|
|
2698
|
+
/** A notice that has not been handed to delivery this long after its comment is lost (the fleet stopped while it was gathering it). */
|
|
2699
|
+
const WAKE_LOST_MS = 2 * 60_000;
|
|
2700
|
+
/** The person's unread, by card number (the board's `unreadFor`), without a card the viewer may not see. */
|
|
2701
|
+
function unreadBody(board, person, gone, hidden) {
|
|
2702
|
+
const cards = {};
|
|
2703
|
+
for (const u of board.unreadFor(person, gone).cards) {
|
|
2704
|
+
const card = board.findCard(u.id);
|
|
2705
|
+
if (!card || hidden(card))
|
|
2706
|
+
continue;
|
|
2707
|
+
cards[u.id] = { n: u.n, reasons: u.reasons, entries: u.entries, at: u.at, by: u.by };
|
|
2708
|
+
}
|
|
2709
|
+
return { total: Object.keys(cards).length, cards };
|
|
2710
|
+
}
|
|
2711
|
+
/** A card's comments with the status of those written for instances (`wakeViews`); a comment nobody was meant to hear is as it was. */
|
|
2712
|
+
function withWakeViews(comments, stored, ctx, hiddenName) {
|
|
2713
|
+
if (!stored.size)
|
|
2714
|
+
return comments;
|
|
2715
|
+
// Each notice once (a gathered window of comments shares one), and none whose comment shows a skip (wakeViews reads no key for it).
|
|
2716
|
+
const keys = [...new Set([...stored.values()].flat().flatMap((w) => (w.key && !w.skip ? [w.key] : [])))];
|
|
2717
|
+
const progress = keys.length ? ctx.taskWakeProgress?.(keys) ?? new Map() : new Map();
|
|
2718
|
+
const now = Date.now();
|
|
2719
|
+
return comments.map((e) => {
|
|
2720
|
+
const list = stored.get(e.id);
|
|
2721
|
+
if (!list || e.deleted)
|
|
2722
|
+
return e;
|
|
2723
|
+
const views = wakeViews(list.filter((w) => !hiddenName(w.to)), progress, now);
|
|
2724
|
+
return views.length ? { ...e, wakes: views } : e;
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
/** How far one notice got, from what the board kept (`key` / `skip`, when it was routed) and what the delivery outbox says of it. */
|
|
2728
|
+
function noticeState(w, progress, now) {
|
|
2729
|
+
if (w.skip)
|
|
2730
|
+
return { state: "skipped", skip: w.skip };
|
|
2731
|
+
if (!w.key)
|
|
2732
|
+
return now - Date.parse(w.at) > WAKE_LOST_MS ? { state: "skipped", skip: "lost" } : { state: "sending" };
|
|
2733
|
+
const p = progress.get(w.key);
|
|
2734
|
+
if (!p)
|
|
2735
|
+
return { state: "unknown" };
|
|
2736
|
+
switch (p.state) {
|
|
2737
|
+
case "delivered": return p.consumedAt ? { state: "read", readAt: p.consumedAt } : { state: "delivered" };
|
|
2738
|
+
case "failed": return { state: "failed", ...(p.failure ? { failure: p.failure } : {}) };
|
|
2739
|
+
case "uncertain": return { state: "uncertain" };
|
|
2740
|
+
case "cancelled": return { state: "withdrawn" };
|
|
2741
|
+
default: return { state: "queued" };
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
export function wakeViews(wakes, progress, now) {
|
|
2745
|
+
return wakes.map((w) => ({ to: w.to, why: w.why, at: w.at, ...noticeState(w, progress, now) }));
|
|
2746
|
+
}
|
|
2747
|
+
export function handoffViews(list, progress, now) {
|
|
2748
|
+
return list.map((h) => {
|
|
2749
|
+
// (M-3908's `failure` is the comment status's: a hand-over says only that it failed.)
|
|
2750
|
+
const { failure: _failure, ...state } = noticeState(h, progress, now);
|
|
2751
|
+
return { id: h.id, card: h.card, to: h.to, why: h.why, after: h.after, at: h.at, ...state };
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* A card's handoffs (its own and, for a main task, those of its sub tasks) with how far each notice got — for a session that can write, never of an
|
|
2756
|
+
* instance kept out of sight; the card whose finishing readied one (`after`) is numbered only if the viewer may see it (`hiddenCode`: a card kept out of
|
|
2757
|
+
* sight reads as none, and the page says "S-2 can start" instead of "S-1 done").
|
|
2758
|
+
*/
|
|
2759
|
+
export function withHandoffViews(board, ref, children, ctx, hiddenName, hiddenCode = () => false) {
|
|
2760
|
+
// The card read already has its sub tasks (with their uuids): only the card itself is looked up.
|
|
2761
|
+
const own = board.findCard(ref);
|
|
2762
|
+
const uuids = [...(own ? [own.uuid] : []), ...children.map((c) => c.uuid)];
|
|
2763
|
+
const list = board.handoffsOf(uuids).filter((h) => !hiddenName(h.to)).map((h) => (h.after && hiddenCode(h.after) ? { ...h, after: null } : h));
|
|
2764
|
+
if (!list.length)
|
|
2765
|
+
return [];
|
|
2766
|
+
// Each notice once (one notice can carry several hand-overs), and none whose hand-over shows a skip (handoffViews reads no key for it), as withWakeViews.
|
|
2767
|
+
const keys = [...new Set(list.flatMap((h) => (h.key && !h.skip ? [h.key] : [])))];
|
|
2768
|
+
const progress = keys.length ? ctx.taskWakeProgress?.(keys) ?? new Map() : new Map();
|
|
2769
|
+
return handoffViews(list, progress, Date.now());
|
|
2770
|
+
}
|
|
2667
2771
|
function boardError(res, err) {
|
|
2668
2772
|
if (res.headersSent)
|
|
2669
2773
|
return;
|
|
@@ -5501,11 +5605,18 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5501
5605
|
}
|
|
5502
5606
|
// ── Task board (scheduler/task-board.ts) ──────────────
|
|
5503
5607
|
// Reads are the session's; every write is the signed-in person's, through the same rules an instance's tools use.
|
|
5504
|
-
if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/refs" || path === "/ui/tasks/work" || path === "/ui/tasks/archive" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects") || path.startsWith("/ui/tasks/files/")) {
|
|
5608
|
+
if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/refs" || path === "/ui/tasks/work" || path === "/ui/tasks/archive" || path === "/ui/tasks/unread" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects") || path.startsWith("/ui/tasks/files/")) {
|
|
5505
5609
|
const board = ctx.scheduler?.db.board;
|
|
5506
5610
|
// M-3668: how many days after it finished a main task leaves the board (defaults.task_board.archive_after_days).
|
|
5507
5611
|
const archiveDays = archiveAfterDays(ctx.fleetConfig?.defaults?.task_board?.archive_after_days);
|
|
5508
5612
|
if (!board) {
|
|
5613
|
+
// The page asks for the person's unread on every admin page (task-unread.js), so a fleet with no task board answers it as it does a
|
|
5614
|
+
// session that has none — nothing — and not with an error the browser logs as one.
|
|
5615
|
+
if (method === "GET" && path === "/ui/tasks/unread") {
|
|
5616
|
+
res.setHeader("Cache-Control", "no-store");
|
|
5617
|
+
json(res, 200, { enabled: false, total: 0, cards: {} });
|
|
5618
|
+
return true;
|
|
5619
|
+
}
|
|
5509
5620
|
json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
|
|
5510
5621
|
return true;
|
|
5511
5622
|
}
|
|
@@ -5586,11 +5697,15 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5586
5697
|
// A main task kept out of sight is not named here either: its watchers go with it (the `parent` above reads as none).
|
|
5587
5698
|
inheritedWatchers: d.card.parentId && hiddenRef(d.card.parentId) ? [] : d.inheritedWatchers.filter((n) => !hiddenName(n)),
|
|
5588
5699
|
leader: d.leader && hiddenName(d.leader.name) ? null : d.leader, // as a project's hidden lead: read as none
|
|
5589
|
-
comments: d.comments.filter((e) => !hiddenName(e.author)),
|
|
5700
|
+
comments: threadsShown(d.comments.filter((e) => !hiddenName(e.author)), hiddenName),
|
|
5590
5701
|
logs: d.logs.filter((e) => !hiddenName(e.author)),
|
|
5591
5702
|
history: d.history.filter((e) => !hiddenName(e.actor) && !mentionsHidden(e.data)).flatMap((e) => unnumberedEvent(e) ?? []),
|
|
5703
|
+
// A sub task kept out of sight has no moves here, nor does one a hidden instance made.
|
|
5704
|
+
subEvents: d.subEvents.filter((e) => !hiddenCode(e.card) && !hiddenName(e.actor) && !mentionsHidden(e.data)),
|
|
5592
5705
|
};
|
|
5593
5706
|
const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder|watchers))?$/.exec(path);
|
|
5707
|
+
const comment = /^\/ui\/tasks\/cards\/([^/]+)\/comments\/(\d{1,12})\/(edit|react|resolve|delete)$/.exec(path);
|
|
5708
|
+
const opened = /^\/ui\/tasks\/cards\/([^/]+)\/read$/.exec(path);
|
|
5594
5709
|
const project = /^\/ui\/tasks\/projects\/(\d+)$/.exec(path);
|
|
5595
5710
|
try {
|
|
5596
5711
|
const ref = card ? decodeURIComponent(card[1]) : "";
|
|
@@ -5632,6 +5747,30 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5632
5747
|
jsonText(res, 200, body);
|
|
5633
5748
|
return true;
|
|
5634
5749
|
}
|
|
5750
|
+
// What is new for this person (docs/design/task-board.md, "Unread"): the cards someone answered, named them on or handed them to
|
|
5751
|
+
// confirm or answer. Theirs alone — an admin session's name; a read-only reader has no one, so no unread, no mark. Never cached
|
|
5752
|
+
// (it moves with every comment) and never carries a hidden instance's card.
|
|
5753
|
+
if (method === "GET" && path === "/ui/tasks/unread") {
|
|
5754
|
+
res.setHeader("Cache-Control", "no-store");
|
|
5755
|
+
const reader = adminAdmissionOf(req, url, ctx) ? webPersonOf(req, url, ctx) : null;
|
|
5756
|
+
const who = reader ? boardActor(req, url, ctx, reader) : null;
|
|
5757
|
+
if (!who || who.kind !== "person") {
|
|
5758
|
+
json(res, 200, { enabled: false, total: 0, cards: {} });
|
|
5759
|
+
return true;
|
|
5760
|
+
}
|
|
5761
|
+
json(res, 200, { enabled: true, ...unreadBody(board, who, ctx.dispatcherGone, hidden) });
|
|
5762
|
+
return true;
|
|
5763
|
+
}
|
|
5764
|
+
if (method === "POST" && opened) {
|
|
5765
|
+
// They opened the card: all of it so far is read. A card kept out of sight is "no such card", as everywhere.
|
|
5766
|
+
const cardRef = decodeURIComponent(opened[1]);
|
|
5767
|
+
if (hidden(board.getCard(cardRef))) {
|
|
5768
|
+
json(res, 404, { error: "no such card", code: "not_found" });
|
|
5769
|
+
return true;
|
|
5770
|
+
}
|
|
5771
|
+
boardWrite(req, res, url, ctx, board, CardReadSchema, (_body, person) => { board.markRead(person, cardRef); return { ok: true, ...unreadBody(board, person, ctx.dispatcherGone, hidden) }; });
|
|
5772
|
+
return true;
|
|
5773
|
+
}
|
|
5635
5774
|
if (method === "GET" && path === "/ui/tasks/work") {
|
|
5636
5775
|
// #2246 step 3: each instance's work on the board — what its `task mine` reads (myWork) — for the board's
|
|
5637
5776
|
// Instance list and an instance's Details page (`?instance=`): the fleet's instances and anyone else a live
|
|
@@ -5712,7 +5851,22 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5712
5851
|
json(res, 404, { error: "no such card", code: "not_found" });
|
|
5713
5852
|
return true;
|
|
5714
5853
|
}
|
|
5715
|
-
|
|
5854
|
+
// `viewer`: who this request writes as — an admin session's person — so the page knows which comments are theirs to edit
|
|
5855
|
+
// (and that it may react, resolve and delete); none for a read-only session, the CLI's token or a guest.
|
|
5856
|
+
const viewerPerson = adminAdmissionOf(req, url, ctx) ? webPersonOf(req, url, ctx) : null;
|
|
5857
|
+
const viewer = viewerPerson ? boardActor(req, url, ctx, viewerPerson) : null;
|
|
5858
|
+
const read = shown(board.detail(ref, scope, ctx.dispatcherGone));
|
|
5859
|
+
// The comment status: only to a session that can write (it is the writer's feedback), and never of an instance kept out of sight.
|
|
5860
|
+
const withStatus = viewer ? withWakeViews(read.comments, board.entryWakes(ref), ctx, hiddenName) : read.comments;
|
|
5861
|
+
// Each comment says whether it is the viewer's (two people who are both "web-user" are told apart by their key, not their name).
|
|
5862
|
+
const mine = viewer && viewer.kind === "person" ? board.commentsWrittenBy(ref, viewer) : null;
|
|
5863
|
+
// And which reactions are theirs: by the same key, so two people with one name do not press each other's chip.
|
|
5864
|
+
const reacted = viewer && viewer.kind === "person" ? board.reactedBy(ref, viewer) : null;
|
|
5865
|
+
const shownComments = mine ? withStatus.map((e) => ({ ...e, mine: mine.has(e.id), ...(e.reactions ? { reactions: e.reactions.map((r) => ({ ...r, mine: !!reacted?.has(`${e.id}|${r.emoji}`) })) } : {}) })) : withStatus;
|
|
5866
|
+
// The handoffs, like the comment status, only to a session that can write (the delivery's state is the writer's feedback).
|
|
5867
|
+
const handoffs = viewer ? withHandoffViews(board, ref, read.children, ctx, hiddenName, hiddenCode) : [];
|
|
5868
|
+
json(res, 200, { ...read, comments: shownComments, ...(mine ? { viewer: { name: viewer.name, kind: viewer.kind } } : {}), ...(handoffs.length ? { handoffs } : {}),
|
|
5869
|
+
...(board.isArchived(found, archiveDays) ? { archived: true, archiveAfterDays: archiveDays } : {}) });
|
|
5716
5870
|
return true;
|
|
5717
5871
|
}
|
|
5718
5872
|
if (method === "GET" && path === "/ui/tasks/archive") {
|
|
@@ -5739,6 +5893,30 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5739
5893
|
});
|
|
5740
5894
|
return true;
|
|
5741
5895
|
}
|
|
5896
|
+
if (method === "POST" && comment) {
|
|
5897
|
+
// One comment of a card: edit, react, resolve, delete. A card kept out of sight is "no such card"; over the link only an
|
|
5898
|
+
// admin session gets here (above), and it sees the board whole.
|
|
5899
|
+
const cardRef = decodeURIComponent(comment[1]), entryId = Number(comment[2]);
|
|
5900
|
+
const found = board.getCard(cardRef);
|
|
5901
|
+
if (hidden(found)) {
|
|
5902
|
+
json(res, 404, { error: "no such card", code: "not_found" });
|
|
5903
|
+
return true;
|
|
5904
|
+
}
|
|
5905
|
+
const answer = (done) => ({ card: board.view(done.card, {}, ctx.dispatcherGone), comment: done.entry, notes: done.said });
|
|
5906
|
+
switch (comment[3]) {
|
|
5907
|
+
case "edit":
|
|
5908
|
+
boardWrite(req, res, url, ctx, board, CommentEditSchema, ({ text }, person) => answer(board.editComment(person, cardRef, entryId, text)));
|
|
5909
|
+
break;
|
|
5910
|
+
case "react":
|
|
5911
|
+
boardWrite(req, res, url, ctx, board, CommentReactSchema, ({ emoji, on }, person) => answer(board.react(person, cardRef, entryId, emoji, on !== false)));
|
|
5912
|
+
break;
|
|
5913
|
+
case "resolve":
|
|
5914
|
+
boardWrite(req, res, url, ctx, board, CommentResolveSchema, ({ resolved }, person) => answer(board.resolveThread(person, cardRef, entryId, resolved !== false)));
|
|
5915
|
+
break;
|
|
5916
|
+
default: boardWrite(req, res, url, ctx, board, CommentDeleteSchema, (_body, person) => answer(board.deleteComment(person, cardRef, entryId)));
|
|
5917
|
+
}
|
|
5918
|
+
return true;
|
|
5919
|
+
}
|
|
5742
5920
|
if (method === "POST" && card) {
|
|
5743
5921
|
if (card[2] === "move") {
|
|
5744
5922
|
boardWrite(req, res, url, ctx, board, CardMoveSchema, ({ to, ...move }, person) => {
|
|
@@ -7299,7 +7477,7 @@ export function shellPreload(mode, guest, path, workspace) {
|
|
|
7299
7477
|
if (!guest) {
|
|
7300
7478
|
if (panel && panel !== "chat" && panel !== "view" && PANEL_MODULES[panel])
|
|
7301
7479
|
entries.push(PANEL_MODULES[panel]);
|
|
7302
|
-
entries.push("/ui/js/backend-signin.js", "/ui/js/agent-proposals.js");
|
|
7480
|
+
entries.push("/ui/js/backend-signin.js", "/ui/js/agent-proposals.js", "/ui/js/task-unread.js");
|
|
7303
7481
|
if (workspace)
|
|
7304
7482
|
entries.push("/ui/js/chat-workspace.js", PANEL_MODULES.details, PANEL_MODULES.log, PANEL_MODULES.view);
|
|
7305
7483
|
}
|