@songsid/agend 2.4.0-beta.23 → 2.4.0-beta.24
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 +4 -3
- package/dist/agent-cli.js +32 -2
- package/dist/agent-cli.js.map +1 -1
- package/dist/agent-file-read.js +2 -2
- package/dist/agent-file-read.js.map +1 -1
- package/dist/agent-whats-new.js +11 -1
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/backend/claude-code.d.ts +15 -0
- package/dist/backend/claude-code.js +8 -3
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/claude-mcp-carry.d.ts +63 -0
- package/dist/backend/claude-mcp-carry.js +242 -0
- package/dist/backend/claude-mcp-carry.js.map +1 -0
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +7 -6
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/config-validator.js +6 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.d.ts +11 -0
- package/dist/daemon.js +66 -15
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard-permissions.d.ts +8 -0
- package/dist/dashboard-permissions.js +8 -0
- package/dist/dashboard-permissions.js.map +1 -1
- package/dist/delivery-outbox.d.ts +15 -1
- package/dist/delivery-outbox.js +60 -2
- package/dist/delivery-outbox.js.map +1 -1
- package/dist/fleet-manager.d.ts +14 -0
- package/dist/fleet-manager.js +67 -0
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/concepts/SKILL.md +22 -9
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +6 -0
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +3 -3
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -1
- package/dist/general-knowledge/skills/task-board/SKILL.md +17 -0
- package/dist/general-knowledge/skills/web-appearance/SKILL.md +4 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +21 -3
- package/dist/hub/group-policy/resources.d.ts +1 -1
- package/dist/instance-lifecycle.d.ts +2 -0
- package/dist/instance-lifecycle.js +29 -1
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +10 -0
- package/dist/locale.js.map +1 -1
- package/dist/needs-you-hub.d.ts +3 -0
- package/dist/needs-you-hub.js +31 -5
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +14 -1
- package/dist/needs-you.js +5 -0
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/office-share.js +2 -1
- package/dist/office-share.js.map +1 -1
- package/dist/outbound-handlers.js +29 -6
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +3 -0
- package/dist/outbound-schemas.js +7 -5
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/public-web-gateway.js +3 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/request-context-compatibility.d.ts +20 -0
- package/dist/request-context-compatibility.js +74 -0
- package/dist/request-context-compatibility.js.map +1 -0
- package/dist/request-context-protocol.d.ts +137 -0
- package/dist/request-context-protocol.js +38 -0
- package/dist/request-context-protocol.js.map +1 -0
- package/dist/request-context-store.d.ts +25 -0
- package/dist/request-context-store.js +137 -0
- package/dist/request-context-store.js.map +1 -0
- package/dist/scheduler/db.js +26 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/scheduler/task-board-text.d.ts +2 -0
- package/dist/scheduler/task-board-text.js +12 -0
- package/dist/scheduler/task-board-text.js.map +1 -1
- package/dist/scheduler/task-board.d.ts +102 -2
- package/dist/scheduler/task-board.js +242 -24
- package/dist/scheduler/task-board.js.map +1 -1
- package/dist/scheduler/task-files.d.ts +80 -0
- package/dist/scheduler/task-files.js +357 -0
- package/dist/scheduler/task-files.js.map +1 -0
- package/dist/settings-api.d.ts +2 -0
- package/dist/settings-api.js +6 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +1 -0
- package/dist/settings-baseline.js +1 -1
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-effect.d.ts +2 -0
- package/dist/settings-effect.js +5 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/task-attach-client.d.ts +43 -0
- package/dist/task-attach-client.js +125 -0
- package/dist/task-attach-client.js.map +1 -0
- package/dist/task-board-tool.d.ts +12 -0
- package/dist/task-board-tool.js +107 -6
- package/dist/task-board-tool.js.map +1 -1
- package/dist/task-file-limits.d.ts +15 -0
- package/dist/task-file-limits.js +21 -0
- package/dist/task-file-limits.js.map +1 -0
- package/dist/tool-permissions.d.ts +32 -0
- package/dist/tool-permissions.js +63 -0
- package/dist/tool-permissions.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/ui/agent-details-settings.js +7 -5
- package/dist/ui/agent-who-can-use-strings.js +125 -0
- package/dist/ui/agent-who-can-use.js +238 -0
- package/dist/ui/fleet-office-card.js +23 -5
- package/dist/ui/fleet-office-editor.js +5 -5
- package/dist/ui/fleet-office-pack.d.ts +10 -0
- package/dist/ui/fleet-office-pack.js +65 -2
- package/dist/ui/fleet-office-skin.js +42 -8
- package/dist/ui/fleet-office-store.js +33 -2
- package/dist/ui/fleet-office-vehicles.js +130 -0
- package/dist/ui/fleet-office-zones.js +5 -1
- package/dist/ui/fleet-office.js +112 -31
- package/dist/ui/fleet-task-activity.js +9 -82
- package/dist/ui/fleet-task-archive.js +111 -0
- package/dist/ui/fleet-task-card.js +6 -4
- package/dist/ui/fleet-task-common.js +2 -2
- package/dist/ui/fleet-task-edit.js +8 -1
- package/dist/ui/fleet-task-files.js +196 -0
- package/dist/ui/fleet-task-md.js +98 -0
- package/dist/ui/fleet-task-menu.js +1 -1
- package/dist/ui/fleet-task-stats.js +2 -2
- package/dist/ui/fleet-task-view.js +12 -8
- package/dist/ui/fleet-tasks.js +42 -18
- package/dist/ui/panel-details.js +3 -1
- package/dist/ui/panel-needs.js +3 -3
- package/dist/ui/panel-settings.js +15 -1
- package/dist/ui/settings-registry.js +1 -0
- package/dist/ui/settings-shared-strings.js +9 -0
- package/dist/ui/settings-shared.js +6 -1
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-needs.js +8 -1
- package/dist/ui/shared/app.css +55 -3
- package/dist/ui/shared/chat-strings.js +4 -4
- package/dist/ui/shared/task-board.css +64 -0
- package/dist/web-api.d.ts +3 -0
- package/dist/web-api.js +97 -14
- package/dist/web-api.js.map +1 -1
- package/dist/web-office-acts.d.ts +16 -0
- package/dist/web-office-acts.js +27 -9
- package/dist/web-office-acts.js.map +1 -1
- package/dist/web-office-pack-read.js +1 -1
- package/dist/web-office-pack-read.js.map +1 -1
- package/dist/web-office-skins.d.ts +5 -3
- package/dist/web-office-skins.js +20 -16
- package/dist/web-office-skins.js.map +1 -1
- package/dist/web-settings-patch.d.ts +27 -0
- package/dist/web-settings-patch.js +67 -0
- package/dist/web-settings-patch.js.map +1 -1
- package/dist/workflow-templates/default.md +1 -0
- package/package.json +1 -1
|
@@ -492,6 +492,8 @@ button.tb-row-progress:hover { background: var(--surface-2); }
|
|
|
492
492
|
.tb-progress { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); font-size: var(--fs-sm); min-width: 0; }
|
|
493
493
|
.tb-progress > .tb-bar { width: auto; flex: 1 1 64px; min-width: 64px; }
|
|
494
494
|
.tb-stats > .tb-sort-link { grid-column: 1 / -1; margin-top: 0; }
|
|
495
|
+
/* M-3668: "Archived · N" on its own row under the name (in the name's row it squeezed the name letter by letter). */
|
|
496
|
+
.tb-stats > .tb-archived-link { grid-column: 1 / -1; justify-self: start; }
|
|
495
497
|
/* Home's head: the title with Agent and New project in its row; the search under it, across the width. */
|
|
496
498
|
.tb-home > .tb-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-2); }
|
|
497
499
|
.tb-home > .tb-head > .s-page-title { flex: 1 1 auto; min-width: min-content; }
|
|
@@ -587,3 +589,65 @@ button.tb-owner-btn:hover { border-color: var(--border); background: var(--surfa
|
|
|
587
589
|
@media (prefers-reduced-motion: reduce) {
|
|
588
590
|
.tr-mark.s-working .tr-dot, .tr-state.s-working .tr-dot { animation: none; }
|
|
589
591
|
}
|
|
592
|
+
|
|
593
|
+
/* M-3668: the Done column's "Show 20 more" under its newest cards; this week's count beside its title; the Archive's filter. */
|
|
594
|
+
.tb-done-more { display: block; margin: var(--s-2) auto; }
|
|
595
|
+
/* #4428 capture check: under the Done column's head, not in it (a narrow head squeezed its title to 「完 / 成」). */
|
|
596
|
+
.tb-done-week-line { margin: 0 0 var(--s-2); font-size: var(--fs-xs); }
|
|
597
|
+
.tb-nowrap { white-space: nowrap; }
|
|
598
|
+
.tb-archive .tb-row-time { width: 11em; }
|
|
599
|
+
.tb-archive-who { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); font-size: var(--fs-sm); color: var(--text-2); }
|
|
600
|
+
|
|
601
|
+
/* Markdown in a card's fields and in a file's preview: the timeline's own rules (`.tl-body.md …`, above) — the element carries
|
|
602
|
+
`.tl-body` and `.md` too — with the timeline's indent (the avatar's width) taken off, and the field's own box and size. */
|
|
603
|
+
.tc-md.tl-body { padding: var(--s-2); }
|
|
604
|
+
.tf-md.tl-body { padding: var(--s-2) var(--s-3); }
|
|
605
|
+
.tc-md.tl-body { cursor: text; }
|
|
606
|
+
/* The Edit button: on the desk it sits at the field's top right, shown on hover or focus, with room reserved for it so it never covers text;
|
|
607
|
+
on a touch screen it is always there and a 44px box; on a phone it is a row of its own under the text (nothing to cover). */
|
|
608
|
+
.tc-md-wrap { position: relative; min-width: 0; }
|
|
609
|
+
.tc-md-edit { position: absolute; top: 2px; right: 2px; opacity: 0; }
|
|
610
|
+
.tc-md-wrap:hover .tc-md-edit, .tc-md-edit:focus-visible { opacity: 1; }
|
|
611
|
+
.tp .tc-md-wrap .tc-text { padding-right: calc(var(--s-8) + var(--s-4)); }
|
|
612
|
+
@media (pointer: coarse) { .tc-md-edit { opacity: 1; min-width: var(--tap); min-height: var(--tap); } }
|
|
613
|
+
/* The Edit button is a quiet ghost button, easy to miss on the dark theme: its enabled state takes the accent token (the colour of links and
|
|
614
|
+
selected text, defined for every theme) in its text and border. Colour only: the size and the 44px touch box are the rules above. */
|
|
615
|
+
.tc-md-edit.btn-ghost { color: var(--accent); border-color: var(--accent); }
|
|
616
|
+
|
|
617
|
+
/* Files on a card (fleet-task-files.js): under the comment they came with, and together in the card's Files field. One row each — the
|
|
618
|
+
name (the download), the size, who and when, the Download button — then what the page can show of it: the picture, the text, the preview. */
|
|
619
|
+
.tf-list { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; margin: 0; padding: 0; list-style: none; }
|
|
620
|
+
.tl-files { margin: var(--s-2) 0 0 36px; }
|
|
621
|
+
.tf-row { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; padding: var(--s-2) var(--s-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); }
|
|
622
|
+
.tf-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); min-width: 0; }
|
|
623
|
+
.tf-icon { display: inline-flex; flex: none; color: var(--text-3); }
|
|
624
|
+
.tf-name { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-weight: var(--fw-semibold); text-decoration: none; }
|
|
625
|
+
.tf-name:hover { text-decoration: underline; }
|
|
626
|
+
.tf-meta { font-size: var(--fs-xs); color: var(--text-3); }
|
|
627
|
+
.tf-grow { flex: 1 1 auto; }
|
|
628
|
+
.tf-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
|
|
629
|
+
.tf-img { display: block; width: fit-content; max-width: 100%; }
|
|
630
|
+
.tf-img img { display: block; max-width: min(100%, 420px); max-height: 280px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); object-fit: contain; }
|
|
631
|
+
.tf-pre { margin: 0; padding: var(--s-2) var(--s-3); max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.5; white-space: pre; }
|
|
632
|
+
.tf-body { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
|
|
633
|
+
.tf-body > .tf-pre { border: 0; }
|
|
634
|
+
.tf-body > .tf-more { align-self: flex-start; margin: 0 var(--s-3) var(--s-2); }
|
|
635
|
+
.tf-note { margin-top: 0; }
|
|
636
|
+
.tf-count { margin-left: var(--s-1); font-weight: var(--fw-regular); color: var(--text-3); }
|
|
637
|
+
.tf-html, .tf-text { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
|
|
638
|
+
.tf-holder { margin-top: 0; }
|
|
639
|
+
/* While a preview runs, its bar — "Stop preview" and the mark that this is a preview — stays at the top of the scrolling page for as long as the
|
|
640
|
+
preview's box is on screen, so a person using the embedded page never has to scroll back up to stop it or to remember what it is. (The page's
|
|
641
|
+
header sits above the scrolling area, so `top: 0` is directly under it.) The bar is opaque and above the frame; it keeps the 44px boxes below. */
|
|
642
|
+
.tf-actions.tf-live { position: sticky; top: 0; z-index: 3; align-items: center; padding: var(--s-1) 0; background: var(--bg); border-bottom: 1px solid var(--border); }
|
|
643
|
+
.tf-live-mark { display: inline-flex; align-items: center; padding: 2px var(--s-2); border-radius: var(--r-full); background: var(--warn-bg); color: var(--warn); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
|
|
644
|
+
/* A running preview has a place of its own: a frame that fills a box of fixed height (a page that lays itself out by the window's height — a
|
|
645
|
+
canvas game — has no height of its own to report, and the automatic height left it a strip of 40px). A page taller than the box scrolls. */
|
|
646
|
+
.tf-holder:not(:empty) { display: flex; flex-direction: column; height: min(75vh, 640px); min-height: 260px; }
|
|
647
|
+
@media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
|
|
648
|
+
.tl-files { margin-left: 0; }
|
|
649
|
+
.tf-dl, .tf-actions .btn, .tf-more { min-height: var(--tap); }
|
|
650
|
+
.tc-md-wrap { display: flex; flex-direction: column; }
|
|
651
|
+
.tp .tc-md-wrap .tc-text { padding-right: var(--s-2); }
|
|
652
|
+
.tc-md-edit { position: static; opacity: 1; align-self: flex-start; min-width: var(--tap); min-height: var(--tap); }
|
|
653
|
+
}
|
package/dist/web-api.d.ts
CHANGED
|
@@ -162,6 +162,9 @@ export interface WebApiContext extends ClaudeCredentialApi {
|
|
|
162
162
|
defaults?: {
|
|
163
163
|
backend?: string;
|
|
164
164
|
effort?: string;
|
|
165
|
+
task_board?: {
|
|
166
|
+
archive_after_days?: number;
|
|
167
|
+
};
|
|
165
168
|
};
|
|
166
169
|
instances: Record<string, {
|
|
167
170
|
topic_id?: number | string;
|
package/dist/web-api.js
CHANGED
|
@@ -26,7 +26,7 @@ import { AGENT_WIDGET_SLOTS, checkWidgetData, checkWidgetSpec } from "./web-widg
|
|
|
26
26
|
import { checkOwnerCss, ownerCssAssetRefs } from "./web-owner-css.js";
|
|
27
27
|
import { canonicalText } from "./web-theme.js";
|
|
28
28
|
import { parsePinKey } from "./web-pin-store.js";
|
|
29
|
-
import { SKIN_WIRE_BYTES } from "./web-office-skins.js";
|
|
29
|
+
import { SKIN_WIRE_BYTES, skinPictureType } from "./web-office-skins.js";
|
|
30
30
|
import { gatewayRequestContext } from "./web-request-context.js";
|
|
31
31
|
import { crossInstanceVisibility } from "./cross-instance-notice.js";
|
|
32
32
|
import { permitWebContinuation } from "./web-continuation.js";
|
|
@@ -44,7 +44,8 @@ import { MAX_COMMAND_ARGS } from "./web-commands.js";
|
|
|
44
44
|
import { ROUTE_WORKER_CSP, ROUTE_WORKER_PATH, sendPanelHtml } from "./web-host-guard.js";
|
|
45
45
|
import { libavoidFile } from "./web-libavoid.js";
|
|
46
46
|
import { shellRoute } from "./web-shell-routes.js";
|
|
47
|
-
import { createReadStream, createWriteStream, existsSync, readFileSync, closeSync } from "node:fs";
|
|
47
|
+
import { createReadStream, createWriteStream, existsSync, readFileSync, closeSync, constants as fsConstants } from "node:fs";
|
|
48
|
+
import { open as openFile } from "node:fs/promises";
|
|
48
49
|
import { servedAssets } from "./auth-api.js";
|
|
49
50
|
import { assetIntact, assetsUnchanged, assetVersion, assetVersionMark, answerStaleAsset, buildModuleGraph, staticClosure, versionShell, IMMUTABLE_PRIVATE } from "./web-asset-version.js";
|
|
50
51
|
import { join, dirname } from "node:path";
|
|
@@ -53,7 +54,7 @@ import { createHash, createHmac, randomUUID } from "node:crypto";
|
|
|
53
54
|
import { CreateInstanceArgs, CreateScheduleArgs, UpdateScheduleArgs, validateArgs } from "./outbound-schemas.js";
|
|
54
55
|
import { scheduleView } from "./web-schedules.js";
|
|
55
56
|
import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
|
|
56
|
-
import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError, cardCode } from "./scheduler/task-board.js";
|
|
57
|
+
import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError, archiveAfterDays, cardCode } from "./scheduler/task-board.js";
|
|
57
58
|
import { TASK_REF_SEPARATOR, cardsForRefs, taskReadWay, taskRefBlock, taskRefCodes, taskRefView } from "./chat-task-refs.js";
|
|
58
59
|
import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js";
|
|
59
60
|
import { z } from "zod";
|
|
@@ -274,7 +275,9 @@ function boardHiding(ctx, gateway) {
|
|
|
274
275
|
const fleet = ctx.fleetConfig;
|
|
275
276
|
const hiddenName = (n) => gateway && typeof n === "string" && !!n && !!ctx.fleetConfig?.instances?.[n] && crossInstanceVisibility(fleet, n) === "hidden";
|
|
276
277
|
const hidden = (c) => [c.assignee, c.createdBy, c.dispatcher?.name].some(hiddenName);
|
|
277
|
-
|
|
278
|
+
/** M-3668 review: the names hiddenName() refuses, for a read that must leave them out before it pages (the Archive). */
|
|
279
|
+
const hiddenNames = () => Object.keys(ctx.fleetConfig?.instances ?? {}).filter(hiddenName);
|
|
280
|
+
return { hiddenName, hidden, hiddenNames };
|
|
278
281
|
}
|
|
279
282
|
/**
|
|
280
283
|
* Chat history as the public link may see it (#2341 review): a status line that names board cards (the daily summary)
|
|
@@ -1047,7 +1050,7 @@ function handleOfficeSkins(req, res, url, ctx, path, method) {
|
|
|
1047
1050
|
json(res, 404, { error: "No such image" });
|
|
1048
1051
|
return true;
|
|
1049
1052
|
}
|
|
1050
|
-
res.setHeader("Content-Type",
|
|
1053
|
+
res.setHeader("Content-Type", skinPictureType(bytes));
|
|
1051
1054
|
// Keyed by the sha of its bytes: a picture at this URL never changes.
|
|
1052
1055
|
res.setHeader("Cache-Control", "private, max-age=31536000, immutable");
|
|
1053
1056
|
res.setHeader("Content-Security-Policy", "default-src 'none'; sandbox");
|
|
@@ -2550,6 +2553,51 @@ function boardActor(req, url, ctx, p) {
|
|
|
2550
2553
|
* A board refusal as the dashboard reads it: the board's sentence, its code and the status that fits, and — when the
|
|
2551
2554
|
* person can meet it — the key and values the page says it with in its own language.
|
|
2552
2555
|
*/
|
|
2556
|
+
/**
|
|
2557
|
+
* GET /ui/tasks/files/<id> — a file an agent put on a card, sent as a DOWNLOAD. It is read with the card: any
|
|
2558
|
+
* session that may read the card may fetch it, and over the public link a card kept out of sight (or its main task), or a
|
|
2559
|
+
* file one of those instances wrote, is "no such file" — the same answer an unknown id gets. Never sent as a page: an image
|
|
2560
|
+
* as an image, text as plain text, everything else (HTML and SVG included) as an opaque download, under a sandboxing CSP and
|
|
2561
|
+
* `nosniff`; what the dashboard shows of an HTML file it fetches and runs in the preview frame, never from here.
|
|
2562
|
+
*/
|
|
2563
|
+
async function serveCardFile(res, board, id, rules) {
|
|
2564
|
+
const miss = () => { if (!res.headersSent)
|
|
2565
|
+
json(res, 404, { error: "No such file" }); };
|
|
2566
|
+
try {
|
|
2567
|
+
const found = board.attachment(id);
|
|
2568
|
+
const store = board.files();
|
|
2569
|
+
if (!found || !store || rules.hidden(found.card) || rules.hiddenName(found.file.author))
|
|
2570
|
+
return miss();
|
|
2571
|
+
const on = store.pathOf(found.card.uuid, id);
|
|
2572
|
+
if (!on || on.size !== found.file.size)
|
|
2573
|
+
return miss();
|
|
2574
|
+
// O_NOFOLLOW is undefined on Windows (the flag is then 0): there the isFile and size checks below stand alone (docs/design/task-board.md).
|
|
2575
|
+
const fh = await openFile(on.path, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW);
|
|
2576
|
+
let bytes;
|
|
2577
|
+
try {
|
|
2578
|
+
const st = await fh.stat();
|
|
2579
|
+
if (!st.isFile() || st.size !== found.file.size)
|
|
2580
|
+
return miss();
|
|
2581
|
+
bytes = await fh.readFile();
|
|
2582
|
+
}
|
|
2583
|
+
finally {
|
|
2584
|
+
await fh.close().catch(() => { });
|
|
2585
|
+
}
|
|
2586
|
+
const { file } = found;
|
|
2587
|
+
const inline = INLINE_MIME.has(file.mime);
|
|
2588
|
+
res.setHeader("Content-Type", inline ? file.mime : file.mime.startsWith("text/") ? "text/plain; charset=utf-8" : "application/octet-stream");
|
|
2589
|
+
res.setHeader("Content-Disposition", `${inline ? "inline" : "attachment"}; filename*=UTF-8''${encodeURIComponent(wellFormed(file.name))}`);
|
|
2590
|
+
res.setHeader("Content-Length", bytes.length);
|
|
2591
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
2592
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
2593
|
+
res.setHeader("Content-Security-Policy", "default-src 'none'; img-src 'self'; style-src 'unsafe-inline'; sandbox");
|
|
2594
|
+
res.writeHead(200);
|
|
2595
|
+
res.end(bytes);
|
|
2596
|
+
}
|
|
2597
|
+
catch {
|
|
2598
|
+
miss();
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2553
2601
|
function boardError(res, err) {
|
|
2554
2602
|
if (res.headersSent)
|
|
2555
2603
|
return;
|
|
@@ -5379,8 +5427,10 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5379
5427
|
}
|
|
5380
5428
|
// ── Task board (scheduler/task-board.ts) ──────────────
|
|
5381
5429
|
// Reads are the session's; every write is the signed-in person's, through the same rules an instance's tools use.
|
|
5382
|
-
if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/refs" || path === "/ui/tasks/work" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects")) {
|
|
5430
|
+
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/")) {
|
|
5383
5431
|
const board = ctx.scheduler?.db.board;
|
|
5432
|
+
// M-3668: how many days after it finished a main task leaves the board (defaults.task_board.archive_after_days).
|
|
5433
|
+
const archiveDays = archiveAfterDays(ctx.fleetConfig?.defaults?.task_board?.archive_after_days);
|
|
5384
5434
|
if (!board) {
|
|
5385
5435
|
json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
|
|
5386
5436
|
return true;
|
|
@@ -5394,7 +5444,7 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5394
5444
|
return true;
|
|
5395
5445
|
}
|
|
5396
5446
|
// …nor shows the cards of instances kept out of sight (cross_instance_visibility: hidden).
|
|
5397
|
-
const { hiddenName, hidden } = boardHiding(ctx, !!gateway);
|
|
5447
|
+
const { hiddenName, hidden, hiddenNames } = boardHiding(ctx, !!gateway);
|
|
5398
5448
|
// #2303 review: what a visible card shows of the cards around it follows the same rule — its children, its main
|
|
5399
5449
|
// task (a search hit's too) — and so do the words and the history a hidden instance left on it.
|
|
5400
5450
|
// …and a hidden instance's words on a visible card are not counted, named or found there (#2304 review).
|
|
@@ -5471,10 +5521,15 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5471
5521
|
try {
|
|
5472
5522
|
const ref = card ? decodeURIComponent(card[1]) : "";
|
|
5473
5523
|
if (method === "GET" && path === "/ui/tasks/board") {
|
|
5474
|
-
// A page that has this revision already is told so, not sent the board again.
|
|
5524
|
+
// A page that has this revision already is told so, not sent the board again. #4428 review: and only when time
|
|
5525
|
+
// has not moved a card across one of the board's lines (archived, this week, the recent window) since it read:
|
|
5526
|
+
// `epoch` says where they stood (a page that sends none, an older one, always gets the board).
|
|
5475
5527
|
const rev = board.revision();
|
|
5476
|
-
|
|
5477
|
-
|
|
5528
|
+
// #4428 review: over the public link the hidden instances' cards move neither the epoch nor any project number.
|
|
5529
|
+
const leaveOut = hiddenNames();
|
|
5530
|
+
const epoch = board.boardEpoch(archiveDays, undefined, leaveOut);
|
|
5531
|
+
if (url.searchParams.get("rev") === String(rev) && url.searchParams.get("epoch") === epoch) {
|
|
5532
|
+
json(res, 200, { rev, epoch, unchanged: true });
|
|
5478
5533
|
return true;
|
|
5479
5534
|
}
|
|
5480
5535
|
const allDone = url.searchParams.get("done") === "all";
|
|
@@ -5485,19 +5540,19 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5485
5540
|
// The instances with the task board switched off: no card is handed to them (the pickers mark them), and a
|
|
5486
5541
|
// fleet.yaml edit changes them with the revision unchanged.
|
|
5487
5542
|
const boardOff = taskBoardOffNames(ctx.fleetConfig).filter((n) => !hiddenName(n));
|
|
5488
|
-
const key = gateway ? null : `${rev}:${allDone ? 1 : 0}:${Math.floor(Date.now() / 60_000)}:${board.goneDispatchers(ctx.dispatcherGone)}:${boardOff.join("\u0000")}`;
|
|
5543
|
+
const key = gateway ? null : `${rev}:${allDone ? 1 : 0}:${epoch}:${Math.floor(Date.now() / 60_000)}:${board.goneDispatchers(ctx.dispatcherGone)}:${boardOff.join("\u0000")}`;
|
|
5489
5544
|
const kept = key ? boardBodies.get(board) : undefined;
|
|
5490
5545
|
if (kept && kept.key === key) {
|
|
5491
5546
|
jsonText(res, 200, kept.body);
|
|
5492
5547
|
return true;
|
|
5493
5548
|
}
|
|
5494
|
-
const cards = board.boardCards(undefined, allDone).filter((c) => !hidden(c));
|
|
5549
|
+
const cards = board.boardCards(undefined, allDone, archiveDays).filter((c) => !hidden(c));
|
|
5495
5550
|
// #2352: over the public link a hidden lead is not named (the project reads as having none).
|
|
5496
5551
|
const projects = board.listProjects(true).map((p) => (p.leadInstance && hiddenName(p.leadInstance) ? { ...p, leadInstance: null } : p));
|
|
5497
5552
|
// #2355 review: the names a project's lead may be — the fleet's instances (a Classic-only room is not one); over the
|
|
5498
5553
|
// public link, not a hidden one.
|
|
5499
5554
|
const leads = Object.keys(ctx.fleetConfig?.instances ?? {}).filter((n) => !hiddenName(n)).sort();
|
|
5500
|
-
const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone).map(unnumbered), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone) });
|
|
5555
|
+
const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone).map(unnumbered), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone, archiveDays, leaveOut), archiveAfterDays: archiveDays, epoch });
|
|
5501
5556
|
if (key)
|
|
5502
5557
|
boardBodies.set(board, { key, body });
|
|
5503
5558
|
jsonText(res, 200, body);
|
|
@@ -5546,6 +5601,8 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5546
5601
|
const results = hits.map(({ card: c, match }, i) => ({
|
|
5547
5602
|
card: views[i],
|
|
5548
5603
|
match,
|
|
5604
|
+
// M-3668: a card the board has archived says so (its number and this search still open it).
|
|
5605
|
+
...(board.isArchived(c, archiveDays) ? { archived: true } : {}),
|
|
5549
5606
|
project: c.projectId === null ? null : names.get(c.projectId) ?? null,
|
|
5550
5607
|
parentTitle: c.parent && !hiddenRef(c.parent) ? board.findCard(c.parent)?.title ?? null : null,
|
|
5551
5608
|
}));
|
|
@@ -5566,13 +5623,39 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
5566
5623
|
json(res, 200, { refs: board.suggest((url.searchParams.get("q") ?? "").slice(0, 100), limit, (c) => !hidden(c)).map(taskRefView) });
|
|
5567
5624
|
return true;
|
|
5568
5625
|
}
|
|
5626
|
+
// a file on a card, as a download — the gate of reading the card (below), plus the file's own author.
|
|
5627
|
+
const cardFile = method === "GET" ? /^\/ui\/tasks\/files\/([0-9a-f]{32})$/.exec(path) : null;
|
|
5628
|
+
if (cardFile) {
|
|
5629
|
+
void serveCardFile(res, board, cardFile[1], {
|
|
5630
|
+
hidden: (c) => !!gateway && (hidden(c) || (!!c.parent && hiddenRef(c.parent))),
|
|
5631
|
+
hiddenName: (n) => !!gateway && hiddenName(n),
|
|
5632
|
+
});
|
|
5633
|
+
return true;
|
|
5634
|
+
}
|
|
5569
5635
|
if (method === "GET" && card && !card[2]) {
|
|
5570
5636
|
const found = board.getCard(ref);
|
|
5571
5637
|
if (hidden(found)) {
|
|
5572
5638
|
json(res, 404, { error: "no such card", code: "not_found" });
|
|
5573
5639
|
return true;
|
|
5574
5640
|
}
|
|
5575
|
-
json(res, 200, shown(board.detail(ref, scope, ctx.dispatcherGone)));
|
|
5641
|
+
json(res, 200, { ...shown(board.detail(ref, scope, ctx.dispatcherGone)), ...(board.isArchived(found, archiveDays) ? { archived: true, archiveAfterDays: archiveDays } : {}) });
|
|
5642
|
+
return true;
|
|
5643
|
+
}
|
|
5644
|
+
if (method === "GET" && path === "/ui/tasks/archive") {
|
|
5645
|
+
// M-3668: a project's archived main tasks (`project`: an id, or "none"), newest first, a page at a time (`before`),
|
|
5646
|
+
// filtered by who had them (`assignee`). Over the public link, not a card that names an instance kept out of sight.
|
|
5647
|
+
const p = url.searchParams.get("project") ?? "none";
|
|
5648
|
+
const project = p === "none" ? null : /^\d{1,9}$/.test(p) ? Number(p) : NaN;
|
|
5649
|
+
if (Number.isNaN(project)) {
|
|
5650
|
+
json(res, 400, { error: "invalid project", code: "invalid" });
|
|
5651
|
+
return true;
|
|
5652
|
+
}
|
|
5653
|
+
const who = url.searchParams.get("assignee");
|
|
5654
|
+
// #4428 review: the hidden ones are left out inside the read, before its page, cursor, total and assignees.
|
|
5655
|
+
const list = board.archiveList(project, archiveDays, { before: url.searchParams.get("before"), limit: Number(url.searchParams.get("limit")) || 50,
|
|
5656
|
+
assignee: who && !hiddenName(who) ? who : null, leaveOut: hiddenNames() });
|
|
5657
|
+
json(res, 200, { cards: board.views(list.cards, scope, ctx.dispatcherGone).map(unnumbered), next: list.next, total: list.total,
|
|
5658
|
+
assignees: list.assignees, archiveAfterDays: archiveDays });
|
|
5576
5659
|
return true;
|
|
5577
5660
|
}
|
|
5578
5661
|
if (method === "POST" && path === "/ui/tasks/cards") {
|