@harborppm/cli 0.117.0 → 0.118.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/app.mjs +763 -187
- package/dist/words.mjs +19 -9
- package/lib/cli.mjs +367 -120
- package/lib/format.mjs +59 -0
- package/package.json +1 -1
package/dist/app.mjs
CHANGED
|
@@ -2567,6 +2567,186 @@ var init_board = __esmMin((() => {
|
|
|
2567
2567
|
];
|
|
2568
2568
|
}));
|
|
2569
2569
|
|
|
2570
|
+
// src/lib/cascade.ts
|
|
2571
|
+
/** What deleting a portfolio, program, or project takes with it, and the data left behind. Pure. */
|
|
2572
|
+
function cascadeDelete(data, kind, id) {
|
|
2573
|
+
const portfolioIds = new Set(kind === "portfolio" ? [id] : []);
|
|
2574
|
+
const programIds = new Set(kind === "program" ? [id] : data.programs.filter((p) => portfolioIds.has(p.portfolioId)).map((p) => p.id));
|
|
2575
|
+
const projectIds = new Set(kind === "project" ? [id] : data.projects.filter((p) => programIds.has(p.programId)).map((p) => p.id));
|
|
2576
|
+
const taskIds = new Set(data.tasks.filter((t) => projectIds.has(t.projectId)).map((t) => t.id));
|
|
2577
|
+
const milestones = data.milestones.filter((m) => !programIds.has(m.programId)).map((m) => withoutBlockers(m, projectIds));
|
|
2578
|
+
const goneMilestones = new Set(data.milestones.filter((m) => programIds.has(m.programId)).map((m) => m.id));
|
|
2579
|
+
const constraints = (data.constraints ?? []).filter((c) => !programIds.has(c.programId));
|
|
2580
|
+
const raidItems = data.raidItems.filter((r) => !(r.portfolioId && portfolioIds.has(r.portfolioId)) && !(r.programId && programIds.has(r.programId)) && !(r.projectId && projectIds.has(r.projectId)));
|
|
2581
|
+
const boardConfigs = Object.fromEntries(Object.entries(data.boardConfigs ?? {}).filter(([k]) => !projectIds.has(k)));
|
|
2582
|
+
return {
|
|
2583
|
+
data: {
|
|
2584
|
+
portfolios: data.portfolios.filter((p) => !portfolioIds.has(p.id)),
|
|
2585
|
+
programs: data.programs.filter((p) => !programIds.has(p.id)).map((p) => withoutBlockers(p, programIds)),
|
|
2586
|
+
projects: data.projects.filter((p) => !projectIds.has(p.id)).map((p) => withoutBlockers(p, projectIds)),
|
|
2587
|
+
tasks: data.tasks.filter((t) => !taskIds.has(t.id)).map((t) => withoutBlockers(t, taskIds)),
|
|
2588
|
+
milestones,
|
|
2589
|
+
constraints,
|
|
2590
|
+
raidItems,
|
|
2591
|
+
comments: data.comments.filter((c) => !taskIds.has(c.taskId)),
|
|
2592
|
+
attachments: (data.attachments ?? []).filter((a) => !taskIds.has(a.taskId)),
|
|
2593
|
+
boardConfigs,
|
|
2594
|
+
ropes: (data.ropes ?? []).map((r) => ({
|
|
2595
|
+
...r,
|
|
2596
|
+
taskIds: r.taskIds.filter((t) => !taskIds.has(t))
|
|
2597
|
+
})),
|
|
2598
|
+
spendEntries: (data.spendEntries ?? []).filter((e) => !projectIds.has(e.projectId)),
|
|
2599
|
+
reflections: (data.reflections ?? []).filter((r) => !projectIds.has(r.projectId) && !(r.programId && programIds.has(r.programId)) && !(r.thanksFor?.kind === "milestone" && goneMilestones.has(r.thanksFor.id)))
|
|
2600
|
+
},
|
|
2601
|
+
counts: {
|
|
2602
|
+
programs: programIds.size,
|
|
2603
|
+
projects: projectIds.size,
|
|
2604
|
+
tasks: taskIds.size,
|
|
2605
|
+
milestones: data.milestones.length - milestones.length,
|
|
2606
|
+
raidItems: data.raidItems.length - raidItems.length,
|
|
2607
|
+
constraints: (data.constraints ?? []).length - constraints.length
|
|
2608
|
+
}
|
|
2609
|
+
};
|
|
2610
|
+
}
|
|
2611
|
+
/** "2 projects, 14 tasks, 3 milestones and 2 risks or issues" — or "" when nothing else goes. */
|
|
2612
|
+
function cascadeSummary(counts, kind) {
|
|
2613
|
+
const bits = [];
|
|
2614
|
+
const n = (count, one, many) => count > 0 ? `${count} ${count === 1 ? one : many}` : null;
|
|
2615
|
+
if (kind === "portfolio") bits.push(n(counts.programs, "program", "programs") ?? "");
|
|
2616
|
+
if (kind !== "project") bits.push(n(counts.projects, "project", "projects") ?? "");
|
|
2617
|
+
bits.push(n(counts.tasks, "task", "tasks") ?? "");
|
|
2618
|
+
bits.push(n(counts.milestones, "milestone", "milestones") ?? "");
|
|
2619
|
+
bits.push(n(counts.raidItems, "logged risk, issue or decision", "logged risks, issues and decisions") ?? "");
|
|
2620
|
+
const list = bits.filter(Boolean);
|
|
2621
|
+
if (list.length === 0) return "";
|
|
2622
|
+
if (list.length === 1) return list[0];
|
|
2623
|
+
return `${list.slice(0, -1).join(", ")} and ${list.at(-1)}`;
|
|
2624
|
+
}
|
|
2625
|
+
/** `data` with the cut links put back, wherever both ends exist again. */
|
|
2626
|
+
function relink(data, links) {
|
|
2627
|
+
const out = {};
|
|
2628
|
+
const exists = (key) => new Set(data[key].map((r) => r.id));
|
|
2629
|
+
const targetOf = {
|
|
2630
|
+
programs: "programs",
|
|
2631
|
+
projects: "projects",
|
|
2632
|
+
tasks: "tasks",
|
|
2633
|
+
milestones: "projects"
|
|
2634
|
+
};
|
|
2635
|
+
for (const key of [
|
|
2636
|
+
"programs",
|
|
2637
|
+
"projects",
|
|
2638
|
+
"tasks",
|
|
2639
|
+
"milestones"
|
|
2640
|
+
]) {
|
|
2641
|
+
const cut = links.blockers[key];
|
|
2642
|
+
if (!cut) continue;
|
|
2643
|
+
const there = exists(targetOf[key]);
|
|
2644
|
+
out[key] = data[key].map((row) => {
|
|
2645
|
+
const was = cut[row.id];
|
|
2646
|
+
if (!was) return row;
|
|
2647
|
+
const ids = [.../* @__PURE__ */ new Set([...was, ...blockerIds(row)])].filter((id) => there.has(id));
|
|
2648
|
+
return ids.length === blockerIds(row).length ? row : {
|
|
2649
|
+
...row,
|
|
2650
|
+
...blockersPatch(ids)
|
|
2651
|
+
};
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
if (Object.keys(links.focus).length) {
|
|
2655
|
+
const tasks = exists("tasks");
|
|
2656
|
+
out.ropes = (data.ropes ?? []).map((r) => {
|
|
2657
|
+
const lost = links.focus[`${r.personId}|${r.date}`];
|
|
2658
|
+
if (!lost) return r;
|
|
2659
|
+
const back = lost.filter((id) => tasks.has(id) && !r.taskIds.includes(id));
|
|
2660
|
+
return back.length ? {
|
|
2661
|
+
...r,
|
|
2662
|
+
taskIds: [...r.taskIds, ...back]
|
|
2663
|
+
} : r;
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
return out;
|
|
2667
|
+
}
|
|
2668
|
+
var init_cascade = __esmMin((() => {
|
|
2669
|
+
init_blockers();
|
|
2670
|
+
}));
|
|
2671
|
+
|
|
2672
|
+
// src/lib/sample-ids.ts
|
|
2673
|
+
function isSampleId(id) {
|
|
2674
|
+
return typeof id === "string" && id.startsWith("sample-");
|
|
2675
|
+
}
|
|
2676
|
+
/** Whether the harbor still holds the sample portfolio. */
|
|
2677
|
+
function hasSample(data) {
|
|
2678
|
+
return data.portfolios.some((p) => p.id === SAMPLE_PORTFOLIO_ID);
|
|
2679
|
+
}
|
|
2680
|
+
/**
|
|
2681
|
+
* The harbor with the sample taken out: its portfolio and everything under
|
|
2682
|
+
* it (as deleting the portfolio takes it), any sample program or project
|
|
2683
|
+
* moved elsewhere, and its made-up people. Work of the owner's own that
|
|
2684
|
+
* named one of those people as owner keeps going, with the owner in their
|
|
2685
|
+
* place, or nobody where nobody is allowed. Returns only the collections it
|
|
2686
|
+
* changed, ready for the store's write.
|
|
2687
|
+
*/
|
|
2688
|
+
function withoutSample(data) {
|
|
2689
|
+
let doc = data;
|
|
2690
|
+
const cut = (kind, id) => {
|
|
2691
|
+
doc = {
|
|
2692
|
+
...doc,
|
|
2693
|
+
...cascadeDelete(doc, kind, id).data
|
|
2694
|
+
};
|
|
2695
|
+
};
|
|
2696
|
+
if (hasSample(doc)) cut("portfolio", SAMPLE_PORTFOLIO_ID);
|
|
2697
|
+
for (const p of doc.programs.filter((g) => isSampleId(g.id))) cut("program", p.id);
|
|
2698
|
+
for (const p of doc.projects.filter((j) => isSampleId(j.id))) cut("project", p.id);
|
|
2699
|
+
const gone = new Set(doc.people.filter((p) => isSampleId(p.id)).map((p) => p.id));
|
|
2700
|
+
const me = doc.currentUserId;
|
|
2701
|
+
const owner = (id) => gone.has(id) ? me : id;
|
|
2702
|
+
const maybe = (id) => id && gone.has(id) ? null : id ?? null;
|
|
2703
|
+
return {
|
|
2704
|
+
portfolios: doc.portfolios.map((p) => gone.has(p.ownerId) || p.goals?.some((g) => g.ownerId && gone.has(g.ownerId)) ? {
|
|
2705
|
+
...p,
|
|
2706
|
+
ownerId: owner(p.ownerId),
|
|
2707
|
+
...p.goals ? { goals: p.goals.map((g) => ({
|
|
2708
|
+
...g,
|
|
2709
|
+
ownerId: maybe(g.ownerId)
|
|
2710
|
+
})) } : {}
|
|
2711
|
+
} : p),
|
|
2712
|
+
programs: doc.programs.map((p) => gone.has(p.ownerId) ? {
|
|
2713
|
+
...p,
|
|
2714
|
+
ownerId: me
|
|
2715
|
+
} : p),
|
|
2716
|
+
projects: doc.projects.map((p) => gone.has(p.ownerId) ? {
|
|
2717
|
+
...p,
|
|
2718
|
+
ownerId: me
|
|
2719
|
+
} : p),
|
|
2720
|
+
tasks: doc.tasks.filter((t) => !isSampleId(t.id)).map((t) => t.assigneeId && gone.has(t.assigneeId) ? {
|
|
2721
|
+
...t,
|
|
2722
|
+
assigneeId: null
|
|
2723
|
+
} : t),
|
|
2724
|
+
milestones: doc.milestones.filter((m) => !isSampleId(m.id)).map((m) => m.approverId && gone.has(m.approverId) ? {
|
|
2725
|
+
...m,
|
|
2726
|
+
approverId: null
|
|
2727
|
+
} : m),
|
|
2728
|
+
raidItems: doc.raidItems.filter((r) => !isSampleId(r.id)).map((r) => r.ownerId && gone.has(r.ownerId) ? {
|
|
2729
|
+
...r,
|
|
2730
|
+
ownerId: null
|
|
2731
|
+
} : r),
|
|
2732
|
+
comments: doc.comments.filter((c) => !isSampleId(c.id)),
|
|
2733
|
+
people: doc.people.filter((p) => !gone.has(p.id)),
|
|
2734
|
+
constraints: doc.constraints,
|
|
2735
|
+
attachments: doc.attachments,
|
|
2736
|
+
boardConfigs: doc.boardConfigs,
|
|
2737
|
+
ropes: doc.ropes,
|
|
2738
|
+
...doc.spendEntries ? { spendEntries: doc.spendEntries } : {},
|
|
2739
|
+
...doc.reflections ? { reflections: doc.reflections } : {},
|
|
2740
|
+
activity: doc.activity.filter((a) => !a.href?.includes(`/${SAMPLE_PREFIX}`))
|
|
2741
|
+
};
|
|
2742
|
+
}
|
|
2743
|
+
var SAMPLE_PREFIX, SAMPLE_PORTFOLIO_ID;
|
|
2744
|
+
var init_sample_ids = __esmMin((() => {
|
|
2745
|
+
init_cascade();
|
|
2746
|
+
SAMPLE_PREFIX = "sample-";
|
|
2747
|
+
SAMPLE_PORTFOLIO_ID = "sample-portfolio";
|
|
2748
|
+
}));
|
|
2749
|
+
|
|
2570
2750
|
// src/lib/task-keys.ts
|
|
2571
2751
|
/** "Ridge Runner" → "RR", "Website" → "WEB", "Q4 launch plan" → "QLP". */
|
|
2572
2752
|
function baseKey(name) {
|
|
@@ -2750,6 +2930,15 @@ function ownProjects(projects) {
|
|
|
2750
2930
|
return projects.filter((p) => !isVoyageProject(p.id));
|
|
2751
2931
|
}
|
|
2752
2932
|
/**
|
|
2933
|
+
* The projects a harbor's people brought: without First voyage and without
|
|
2934
|
+
* the sample portfolio's (src/lib/sample-portfolio.ts). For the questions
|
|
2935
|
+
* about a new harbor's own start (its first project, where a new task goes,
|
|
2936
|
+
* the first-week list, the funnel), not for what the harbor's pages show.
|
|
2937
|
+
*/
|
|
2938
|
+
function realProjects(projects) {
|
|
2939
|
+
return projects.filter((p) => !isVoyageProject(p.id) && !isSampleId(p.id));
|
|
2940
|
+
}
|
|
2941
|
+
/**
|
|
2753
2942
|
* The harbor as anyone outside it may see it: First voyage is practice, so
|
|
2754
2943
|
* share links, their embeds and the Monday letter to stakeholders leave it
|
|
2755
2944
|
* out, with its tasks, risks and spend, from what they show and count.
|
|
@@ -2775,11 +2964,11 @@ function voyageTicks(data, signals) {
|
|
|
2775
2964
|
if (!data.projects.some((p) => isVoyageProject(p.id))) return [];
|
|
2776
2965
|
const open = data.tasks.filter((t) => SEEDED.has(t.id) && t.status !== "done" && t.assigneeId === data.currentUserId);
|
|
2777
2966
|
if (open.length === 0) return [];
|
|
2778
|
-
const own = (t) => !SEEDED.has(t.id);
|
|
2967
|
+
const own = (t) => !SEEDED.has(t.id) && !isSampleId(t.id);
|
|
2779
2968
|
const done = {
|
|
2780
2969
|
task: data.tasks.some(own),
|
|
2781
|
-
move: data.tasks.some((t) => MOVED.includes(t.status) || own(t) && t.status === "done"),
|
|
2782
|
-
crew: data.people.length > 1,
|
|
2970
|
+
move: data.tasks.some((t) => !isSampleId(t.id) && (MOVED.includes(t.status) || own(t) && t.status === "done")),
|
|
2971
|
+
crew: data.people.filter((p) => !isSampleId(p.id)).length > 1,
|
|
2783
2972
|
terminal: signals.apps?.some((a) => a === "Harbor CLI") ?? false,
|
|
2784
2973
|
agent: signals.apps?.some((a) => a !== "Harbor CLI") ?? false,
|
|
2785
2974
|
wrap: false
|
|
@@ -2788,6 +2977,7 @@ function voyageTicks(data, signals) {
|
|
|
2788
2977
|
}
|
|
2789
2978
|
var VOYAGE_PROJECT_ID, STEPS, voyageTaskId, VOYAGE_NO_FORECAST, MOVED, SEEDED;
|
|
2790
2979
|
var init_first_voyage = __esmMin((() => {
|
|
2980
|
+
init_sample_ids();
|
|
2791
2981
|
VOYAGE_PROJECT_ID = "voyage";
|
|
2792
2982
|
STEPS = [
|
|
2793
2983
|
{
|
|
@@ -3034,110 +3224,7 @@ function trialDaysLeft(trialEndsAt, now = /* @__PURE__ */ new Date()) {
|
|
|
3034
3224
|
return Math.ceil(ms / 864e5);
|
|
3035
3225
|
}
|
|
3036
3226
|
|
|
3037
|
-
// src/lib/cascade.ts
|
|
3038
|
-
/** What deleting a portfolio, program, or project takes with it, and the data left behind. Pure. */
|
|
3039
|
-
function cascadeDelete(data, kind, id) {
|
|
3040
|
-
const portfolioIds = new Set(kind === "portfolio" ? [id] : []);
|
|
3041
|
-
const programIds = new Set(kind === "program" ? [id] : data.programs.filter((p) => portfolioIds.has(p.portfolioId)).map((p) => p.id));
|
|
3042
|
-
const projectIds = new Set(kind === "project" ? [id] : data.projects.filter((p) => programIds.has(p.programId)).map((p) => p.id));
|
|
3043
|
-
const taskIds = new Set(data.tasks.filter((t) => projectIds.has(t.projectId)).map((t) => t.id));
|
|
3044
|
-
const milestones = data.milestones.filter((m) => !programIds.has(m.programId)).map((m) => withoutBlockers(m, projectIds));
|
|
3045
|
-
const goneMilestones = new Set(data.milestones.filter((m) => programIds.has(m.programId)).map((m) => m.id));
|
|
3046
|
-
const constraints = (data.constraints ?? []).filter((c) => !programIds.has(c.programId));
|
|
3047
|
-
const raidItems = data.raidItems.filter((r) => !(r.portfolioId && portfolioIds.has(r.portfolioId)) && !(r.programId && programIds.has(r.programId)) && !(r.projectId && projectIds.has(r.projectId)));
|
|
3048
|
-
const boardConfigs = Object.fromEntries(Object.entries(data.boardConfigs ?? {}).filter(([k]) => !projectIds.has(k)));
|
|
3049
|
-
return {
|
|
3050
|
-
data: {
|
|
3051
|
-
portfolios: data.portfolios.filter((p) => !portfolioIds.has(p.id)),
|
|
3052
|
-
programs: data.programs.filter((p) => !programIds.has(p.id)).map((p) => withoutBlockers(p, programIds)),
|
|
3053
|
-
projects: data.projects.filter((p) => !projectIds.has(p.id)).map((p) => withoutBlockers(p, projectIds)),
|
|
3054
|
-
tasks: data.tasks.filter((t) => !taskIds.has(t.id)).map((t) => withoutBlockers(t, taskIds)),
|
|
3055
|
-
milestones,
|
|
3056
|
-
constraints,
|
|
3057
|
-
raidItems,
|
|
3058
|
-
comments: data.comments.filter((c) => !taskIds.has(c.taskId)),
|
|
3059
|
-
attachments: (data.attachments ?? []).filter((a) => !taskIds.has(a.taskId)),
|
|
3060
|
-
boardConfigs,
|
|
3061
|
-
ropes: (data.ropes ?? []).map((r) => ({
|
|
3062
|
-
...r,
|
|
3063
|
-
taskIds: r.taskIds.filter((t) => !taskIds.has(t))
|
|
3064
|
-
})),
|
|
3065
|
-
spendEntries: (data.spendEntries ?? []).filter((e) => !projectIds.has(e.projectId)),
|
|
3066
|
-
reflections: (data.reflections ?? []).filter((r) => !projectIds.has(r.projectId) && !(r.programId && programIds.has(r.programId)) && !(r.thanksFor?.kind === "milestone" && goneMilestones.has(r.thanksFor.id)))
|
|
3067
|
-
},
|
|
3068
|
-
counts: {
|
|
3069
|
-
programs: programIds.size,
|
|
3070
|
-
projects: projectIds.size,
|
|
3071
|
-
tasks: taskIds.size,
|
|
3072
|
-
milestones: data.milestones.length - milestones.length,
|
|
3073
|
-
raidItems: data.raidItems.length - raidItems.length,
|
|
3074
|
-
constraints: (data.constraints ?? []).length - constraints.length
|
|
3075
|
-
}
|
|
3076
|
-
};
|
|
3077
|
-
}
|
|
3078
|
-
/** "2 projects, 14 tasks, 3 milestones and 2 risks or issues" — or "" when nothing else goes. */
|
|
3079
|
-
function cascadeSummary(counts, kind) {
|
|
3080
|
-
const bits = [];
|
|
3081
|
-
const n = (count, one, many) => count > 0 ? `${count} ${count === 1 ? one : many}` : null;
|
|
3082
|
-
if (kind === "portfolio") bits.push(n(counts.programs, "program", "programs") ?? "");
|
|
3083
|
-
if (kind !== "project") bits.push(n(counts.projects, "project", "projects") ?? "");
|
|
3084
|
-
bits.push(n(counts.tasks, "task", "tasks") ?? "");
|
|
3085
|
-
bits.push(n(counts.milestones, "milestone", "milestones") ?? "");
|
|
3086
|
-
bits.push(n(counts.raidItems, "logged risk, issue or decision", "logged risks, issues and decisions") ?? "");
|
|
3087
|
-
const list = bits.filter(Boolean);
|
|
3088
|
-
if (list.length === 0) return "";
|
|
3089
|
-
if (list.length === 1) return list[0];
|
|
3090
|
-
return `${list.slice(0, -1).join(", ")} and ${list.at(-1)}`;
|
|
3091
|
-
}
|
|
3092
|
-
/** `data` with the cut links put back, wherever both ends exist again. */
|
|
3093
|
-
function relink(data, links) {
|
|
3094
|
-
const out = {};
|
|
3095
|
-
const exists = (key) => new Set(data[key].map((r) => r.id));
|
|
3096
|
-
const targetOf = {
|
|
3097
|
-
programs: "programs",
|
|
3098
|
-
projects: "projects",
|
|
3099
|
-
tasks: "tasks",
|
|
3100
|
-
milestones: "projects"
|
|
3101
|
-
};
|
|
3102
|
-
for (const key of [
|
|
3103
|
-
"programs",
|
|
3104
|
-
"projects",
|
|
3105
|
-
"tasks",
|
|
3106
|
-
"milestones"
|
|
3107
|
-
]) {
|
|
3108
|
-
const cut = links.blockers[key];
|
|
3109
|
-
if (!cut) continue;
|
|
3110
|
-
const there = exists(targetOf[key]);
|
|
3111
|
-
out[key] = data[key].map((row) => {
|
|
3112
|
-
const was = cut[row.id];
|
|
3113
|
-
if (!was) return row;
|
|
3114
|
-
const ids = [.../* @__PURE__ */ new Set([...was, ...blockerIds(row)])].filter((id) => there.has(id));
|
|
3115
|
-
return ids.length === blockerIds(row).length ? row : {
|
|
3116
|
-
...row,
|
|
3117
|
-
...blockersPatch(ids)
|
|
3118
|
-
};
|
|
3119
|
-
});
|
|
3120
|
-
}
|
|
3121
|
-
if (Object.keys(links.focus).length) {
|
|
3122
|
-
const tasks = exists("tasks");
|
|
3123
|
-
out.ropes = (data.ropes ?? []).map((r) => {
|
|
3124
|
-
const lost = links.focus[`${r.personId}|${r.date}`];
|
|
3125
|
-
if (!lost) return r;
|
|
3126
|
-
const back = lost.filter((id) => tasks.has(id) && !r.taskIds.includes(id));
|
|
3127
|
-
return back.length ? {
|
|
3128
|
-
...r,
|
|
3129
|
-
taskIds: [...r.taskIds, ...back]
|
|
3130
|
-
} : r;
|
|
3131
|
-
});
|
|
3132
|
-
}
|
|
3133
|
-
return out;
|
|
3134
|
-
}
|
|
3135
|
-
var init_cascade = __esmMin((() => {
|
|
3136
|
-
init_blockers();
|
|
3137
|
-
}));
|
|
3138
|
-
|
|
3139
3227
|
// src/lib/forecast.ts
|
|
3140
|
-
init_cascade();
|
|
3141
3228
|
init_date_fns();
|
|
3142
3229
|
const day$9 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
3143
3230
|
/**
|
|
@@ -5209,6 +5296,7 @@ init_date_text();
|
|
|
5209
5296
|
init_first_voyage();
|
|
5210
5297
|
init_indexes();
|
|
5211
5298
|
init_subtasks();
|
|
5299
|
+
init_cascade();
|
|
5212
5300
|
init_tide();
|
|
5213
5301
|
init_format();
|
|
5214
5302
|
init_spend();
|
|
@@ -7954,7 +8042,83 @@ function wipOverflowing(data, projectId) {
|
|
|
7954
8042
|
const review = mine.filter((t) => t.status === "review").length;
|
|
7955
8043
|
return doing > 3 || review > 2;
|
|
7956
8044
|
}
|
|
8045
|
+
function idOf(value) {
|
|
8046
|
+
if (!value) return 0;
|
|
8047
|
+
let id = objectIds.get(value);
|
|
8048
|
+
if (id === void 0) objectIds.set(value, id = nextObjectId++);
|
|
8049
|
+
return id;
|
|
8050
|
+
}
|
|
8051
|
+
function calendarOf(data) {
|
|
8052
|
+
const kept = calendars.get(data.people);
|
|
8053
|
+
if (kept && kept.workCalendar === data.workCalendar) return kept.calendar;
|
|
8054
|
+
const calendar = workCalendar({
|
|
8055
|
+
people: data.people,
|
|
8056
|
+
workCalendar: data.workCalendar
|
|
8057
|
+
});
|
|
8058
|
+
calendars.set(data.people, {
|
|
8059
|
+
workCalendar: data.workCalendar,
|
|
8060
|
+
calendar
|
|
8061
|
+
});
|
|
8062
|
+
return calendar;
|
|
8063
|
+
}
|
|
8064
|
+
/**
|
|
8065
|
+
* The forecast's chance (0 to 1) that a project finishes by its end date,
|
|
8066
|
+
* the same number its Forecast tab shows; null when there's no forecast to
|
|
8067
|
+
* go by (no open work, too little finished lately, paused or done).
|
|
8068
|
+
*/
|
|
8069
|
+
function forecastChance(project, data, now) {
|
|
8070
|
+
if (project.health === "paused" || project.health === "done" || !project.endDate) return null;
|
|
8071
|
+
const tasks = tasksOf(data.tasks, project.id);
|
|
8072
|
+
let open = 0;
|
|
8073
|
+
for (const t of tasks) if (t.status !== "done") open++;
|
|
8074
|
+
if (open === 0) return null;
|
|
8075
|
+
const weekly = weeklyFinished(tasks, project.startDate, now);
|
|
8076
|
+
if (weekly.reduce((a, b) => a + b, 0) < 5) return null;
|
|
8077
|
+
let sig = "";
|
|
8078
|
+
for (const t of tasks) if (t.status !== "done") sig += `${t.id}:${t.status}:${t.dueDate ?? ""}:${t.assigneeId ?? ""};`;
|
|
8079
|
+
const key = [
|
|
8080
|
+
iso$3(now),
|
|
8081
|
+
project.startDate,
|
|
8082
|
+
project.endDate,
|
|
8083
|
+
weekly.join(","),
|
|
8084
|
+
idOf(data.reflections),
|
|
8085
|
+
idOf(data.people),
|
|
8086
|
+
idOf(data.workCalendar),
|
|
8087
|
+
sig
|
|
8088
|
+
].join("|");
|
|
8089
|
+
const kept = chanceKept.get(project.id);
|
|
8090
|
+
if (kept?.key === key) return kept.chance;
|
|
8091
|
+
const tide = tideForecast(project, tasks, now, {
|
|
8092
|
+
reflections: data.reflections,
|
|
8093
|
+
calendar: calendarOf(data)
|
|
8094
|
+
});
|
|
8095
|
+
const chance = tide.kind === "forecast" ? tide.chanceByEnd : null;
|
|
8096
|
+
if (chanceKept.size > 5e3) chanceKept.clear();
|
|
8097
|
+
chanceKept.set(project.id, {
|
|
8098
|
+
key,
|
|
8099
|
+
chance
|
|
8100
|
+
});
|
|
8101
|
+
return chance;
|
|
8102
|
+
}
|
|
8103
|
+
function forecastTrack(chance) {
|
|
8104
|
+
if (chance == null) return "on-track";
|
|
8105
|
+
if (chance < .15) return "off-track";
|
|
8106
|
+
if (chance < .5) return "at-risk";
|
|
8107
|
+
return "on-track";
|
|
8108
|
+
}
|
|
8109
|
+
/**
|
|
8110
|
+
* The rules, then the forecast: a project the rules call on track (or at
|
|
8111
|
+
* risk) reads worse when its forecast gives it under even odds of finishing
|
|
8112
|
+
* by its end date. The forecast only ever makes it worse: a late task is a
|
|
8113
|
+
* late task, whatever the pace says.
|
|
8114
|
+
*/
|
|
7957
8115
|
function deriveProjectHealth(project, data, now) {
|
|
8116
|
+
const rules = ruleProjectHealth(project, data, now);
|
|
8117
|
+
if (rules === "off-track") return rules;
|
|
8118
|
+
return worstTrack([rules, forecastTrack(forecastChance(project, data, now))]);
|
|
8119
|
+
}
|
|
8120
|
+
/** Health from late work, end dates, blockers and crowded boards, before the forecast. */
|
|
8121
|
+
function ruleProjectHealth(project, data, now) {
|
|
7958
8122
|
const tasks = tasksOf(data.tasks, project.id);
|
|
7959
8123
|
const open = tasks.filter(incomplete);
|
|
7960
8124
|
const maxOverdue = open.map((t) => daysOverdue(t.dueDate, now)).reduce((a, b) => Math.max(a, b), 0);
|
|
@@ -8102,7 +8266,7 @@ function programLateCount(programId, data, now) {
|
|
|
8102
8266
|
for (const p of data.projects) if (p.programId === programId) late += lateTasksOf([...tasksOf(data.tasks, p.id)], now).length;
|
|
8103
8267
|
return late;
|
|
8104
8268
|
}
|
|
8105
|
-
var iso$3, overdueDay, overdueByDue, untilDay, untilByDate;
|
|
8269
|
+
var iso$3, overdueDay, overdueByDue, untilDay, untilByDate, FORECAST_AT_RISK, FORECAST_OFF_TRACK, FORECAST_MIN_FINISHED, chanceKept, objectIds, nextObjectId, calendars;
|
|
8106
8270
|
var init_derived_health = __esmMin((() => {
|
|
8107
8271
|
init_date_fns();
|
|
8108
8272
|
init_date_text();
|
|
@@ -8110,6 +8274,8 @@ var init_derived_health = __esmMin((() => {
|
|
|
8110
8274
|
init_indexes();
|
|
8111
8275
|
init_health_history();
|
|
8112
8276
|
init_clock();
|
|
8277
|
+
init_holidays();
|
|
8278
|
+
init_tide();
|
|
8113
8279
|
iso$3 = (d) => {
|
|
8114
8280
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
8115
8281
|
};
|
|
@@ -8117,6 +8283,13 @@ var init_derived_health = __esmMin((() => {
|
|
|
8117
8283
|
overdueByDue = /* @__PURE__ */ new Map();
|
|
8118
8284
|
untilDay = "";
|
|
8119
8285
|
untilByDate = /* @__PURE__ */ new Map();
|
|
8286
|
+
FORECAST_AT_RISK = .5;
|
|
8287
|
+
FORECAST_OFF_TRACK = .15;
|
|
8288
|
+
FORECAST_MIN_FINISHED = 5;
|
|
8289
|
+
chanceKept = /* @__PURE__ */ new Map();
|
|
8290
|
+
objectIds = /* @__PURE__ */ new WeakMap();
|
|
8291
|
+
nextObjectId = 1;
|
|
8292
|
+
calendars = /* @__PURE__ */ new WeakMap();
|
|
8120
8293
|
}));
|
|
8121
8294
|
|
|
8122
8295
|
// src/lib/bottle-rules.ts
|
|
@@ -8991,7 +9164,7 @@ function shippingForecast(data, opts) {
|
|
|
8991
9164
|
const { now } = opts;
|
|
8992
9165
|
const today = todayISO(now);
|
|
8993
9166
|
const programs = data.programs.filter((p) => !opts.portfolioId || p.portfolioId === opts.portfolioId);
|
|
8994
|
-
const areas = programs.filter((p) => ORDER[p.health] != null).sort((a, b) => (ORDER[a.health] ?? 9) - (ORDER[b.health] ?? 9) || a.endDate.localeCompare(b.endDate)).map((program) => area(data, program, now, today));
|
|
9167
|
+
const areas = programs.filter((p) => ORDER$1[p.health] != null).sort((a, b) => (ORDER$1[a.health] ?? 9) - (ORDER$1[b.health] ?? 9) || a.endDate.localeCompare(b.endDate)).map((program) => area(data, program, now, today));
|
|
8995
9168
|
const opening = `And now the harbor forecast for ${opts.harborName?.trim() || "Harbor"}, issued at ${issuedAt(now)} on ${format(now, "EEEE d MMMM")}.`;
|
|
8996
9169
|
const gales = areas.filter((a) => a.health === "off-track").map((a) => a.name);
|
|
8997
9170
|
const warnings = gales.length ? `There are warnings of gales in ${list$3(gales)}.` : null;
|
|
@@ -9065,7 +9238,7 @@ function area(data, program, now, today) {
|
|
|
9065
9238
|
force: wind.force
|
|
9066
9239
|
};
|
|
9067
9240
|
}
|
|
9068
|
-
var FORECAST_AREAS, WORDS, VISIBILITY, ORDER;
|
|
9241
|
+
var FORECAST_AREAS, WORDS, VISIBILITY, ORDER$1;
|
|
9069
9242
|
var init_shipping_forecast = __esmMin((() => {
|
|
9070
9243
|
init_date_fns();
|
|
9071
9244
|
init_derived_health();
|
|
@@ -9096,7 +9269,7 @@ var init_shipping_forecast = __esmMin((() => {
|
|
|
9096
9269
|
"at-risk": "moderate",
|
|
9097
9270
|
"off-track": "poor"
|
|
9098
9271
|
};
|
|
9099
|
-
ORDER = {
|
|
9272
|
+
ORDER$1 = {
|
|
9100
9273
|
"off-track": 0,
|
|
9101
9274
|
"at-risk": 1,
|
|
9102
9275
|
"on-track": 2
|
|
@@ -10976,6 +11149,19 @@ const WHEN = [
|
|
|
10976
11149
|
].join("|");
|
|
10977
11150
|
const LEAD$1 = "(?:by|due|due on|due by|on|before|until|till)";
|
|
10978
11151
|
/** The day a phrase names, or null when it names none. */
|
|
11152
|
+
/**
|
|
11153
|
+
* The one person a name key ("sam", "samrivera", loosened) means: the full
|
|
11154
|
+
* name, else the first name, else (three letters or more) the one name it
|
|
11155
|
+
* starts. Two people who fit means nobody.
|
|
11156
|
+
*/
|
|
11157
|
+
function personForKey(key, people) {
|
|
11158
|
+
const full = people.filter((p) => loose(p.name) === key);
|
|
11159
|
+
if (full.length === 1) return full[0];
|
|
11160
|
+
const first = people.filter((p) => loose(p.name.split(/\s+/)[0] ?? "") === key);
|
|
11161
|
+
if (first.length === 1) return first[0];
|
|
11162
|
+
const begins = people.filter((p) => loose(p.name).startsWith(key));
|
|
11163
|
+
return key.length >= 3 && begins.length === 1 ? begins[0] : null;
|
|
11164
|
+
}
|
|
10979
11165
|
function dayFromWords(phrase, today) {
|
|
10980
11166
|
const p = phrase.toLowerCase().replace(/\s+/g, " ").replace(/^on /, "").trim();
|
|
10981
11167
|
if (p === "today" || p === "tonight") return today;
|
|
@@ -11090,14 +11276,7 @@ function readTaskWords(input, ctx) {
|
|
|
11090
11276
|
let owner = null;
|
|
11091
11277
|
const nobody = [];
|
|
11092
11278
|
if (!skip.has("owner")) {
|
|
11093
|
-
const byKey = (key) =>
|
|
11094
|
-
const full = ctx.people.filter((p) => loose(p.name) === key);
|
|
11095
|
-
if (full.length === 1) return full[0];
|
|
11096
|
-
const first = ctx.people.filter((p) => loose(p.name.split(/\s+/)[0] ?? "") === key);
|
|
11097
|
-
if (first.length === 1) return first[0];
|
|
11098
|
-
const begins = ctx.people.filter((p) => loose(p.name).startsWith(key));
|
|
11099
|
-
return key.length >= 3 && begins.length === 1 ? begins[0] : null;
|
|
11100
|
-
};
|
|
11279
|
+
const byKey = (key) => personForKey(key, ctx.people);
|
|
11101
11280
|
for (const m of text.matchAll(/(?:^|\s)@([\p{L}\p{N}._-]+)/gu)) {
|
|
11102
11281
|
const start = m.index + (m[0].length - m[0].trimStart().length);
|
|
11103
11282
|
const end = m.index + m[0].length;
|
|
@@ -13462,11 +13641,11 @@ function HistoryView({ active, width, height, go }) {
|
|
|
13462
13641
|
// src/lib/daily-digest.ts
|
|
13463
13642
|
/**
|
|
13464
13643
|
* The projects a scope covers; a person's are the ones they lead, sit under,
|
|
13465
|
-
* or have a task in. First voyage is practice
|
|
13466
|
-
* health never count as what changed.
|
|
13644
|
+
* or have a task in. First voyage is practice and the sample portfolio is
|
|
13645
|
+
* made up, so their tasks, talk and health never count as what changed.
|
|
13467
13646
|
*/
|
|
13468
13647
|
function projectsIn(data, scope) {
|
|
13469
|
-
const own =
|
|
13648
|
+
const own = realProjects(data.projects);
|
|
13470
13649
|
if (scope.kind === "harbor") return own;
|
|
13471
13650
|
if (scope.kind === "program") return own.filter((p) => p.programId === scope.id);
|
|
13472
13651
|
const led = new Set(data.programs.filter((p) => p.ownerId === scope.id).map((p) => p.id));
|
|
@@ -14413,6 +14592,314 @@ function InboxView({ active, width, height, go }) {
|
|
|
14413
14592
|
});
|
|
14414
14593
|
}
|
|
14415
14594
|
|
|
14595
|
+
// src/lib/agents.ts
|
|
14596
|
+
init_agent_check();
|
|
14597
|
+
const RANK$1 = {
|
|
14598
|
+
urgent: 0,
|
|
14599
|
+
high: 1,
|
|
14600
|
+
medium: 2,
|
|
14601
|
+
low: 3
|
|
14602
|
+
};
|
|
14603
|
+
/** Sent back by the person who checked it, with a note saying what to change. */
|
|
14604
|
+
const sentBack = (t) => t.approval?.status === "changes_requested" && t.status !== "done" && t.status !== "review";
|
|
14605
|
+
/** What an agent should work on: its open tasks not yet waiting on review, what was sent back first, then in progress, then most urgent and soonest. */
|
|
14606
|
+
function agentQueue(data, agentId) {
|
|
14607
|
+
return data.tasks.filter((t) => t.assigneeId === agentId && (t.status === "todo" || t.status === "doing" || t.status === "backlog")).sort((a, b) => Number(sentBack(b)) - Number(sentBack(a)) || Number(b.status === "doing") - Number(a.status === "doing") || Number(a.status === "backlog") - Number(b.status === "backlog") || RANK$1[a.priority] - RANK$1[b.priority] || (a.dueDate ?? "9999").localeCompare(b.dueDate ?? "9999"));
|
|
14608
|
+
}
|
|
14609
|
+
/** The agent an app means: the one named, else the only one on the crew. */
|
|
14610
|
+
function pickAgent(people, key) {
|
|
14611
|
+
const agents = people.filter(isAgent);
|
|
14612
|
+
if (agents.length === 0) return "There are no agents on this harbor's crew yet. Someone adds one on People with Add an agent.";
|
|
14613
|
+
if (!key) {
|
|
14614
|
+
if (agents.length === 1) return agents[0];
|
|
14615
|
+
return `This harbor has ${agents.length} agents (${agents.map((a) => a.name).join(", ")}). Say which with agent.`;
|
|
14616
|
+
}
|
|
14617
|
+
const k = key.trim().toLowerCase();
|
|
14618
|
+
return agents.find((a) => a.id === key.trim() || a.name.trim().toLowerCase() === k) ?? `No agent called "${key}". The crew's agents: ${agents.map((a) => a.name).join(", ")}.`;
|
|
14619
|
+
}
|
|
14620
|
+
|
|
14621
|
+
// src/lib/agents-page.ts
|
|
14622
|
+
init_agent_check();
|
|
14623
|
+
init_format();
|
|
14624
|
+
/** The agent a task belongs to: the one it's assigned to, else the one that handed it in. */
|
|
14625
|
+
function agentOf(task, agents) {
|
|
14626
|
+
return (task.assigneeId ? agents.get(task.assigneeId) : void 0) ?? (task.approval ? agents.get(task.approval.askedById) : void 0);
|
|
14627
|
+
}
|
|
14628
|
+
function agentsView(data, me, now, filter = {}) {
|
|
14629
|
+
const agents = data.people.filter(isAgent);
|
|
14630
|
+
const byAgent = new Map(agents.map((a) => [a.id, a]));
|
|
14631
|
+
const view = {
|
|
14632
|
+
agents,
|
|
14633
|
+
needsYou: [],
|
|
14634
|
+
withOthers: [],
|
|
14635
|
+
working: [],
|
|
14636
|
+
sentBack: [],
|
|
14637
|
+
doneToday: []
|
|
14638
|
+
};
|
|
14639
|
+
if (agents.length === 0) return view;
|
|
14640
|
+
const latest = /* @__PURE__ */ new Map();
|
|
14641
|
+
for (const c of data.comments) {
|
|
14642
|
+
if (!byAgent.has(c.authorId)) continue;
|
|
14643
|
+
const key = `${c.taskId} ${c.authorId}`;
|
|
14644
|
+
const had = latest.get(key);
|
|
14645
|
+
if (!had || had.createdAt < c.createdAt) latest.set(key, c);
|
|
14646
|
+
}
|
|
14647
|
+
const today = todayISO(now);
|
|
14648
|
+
for (const task of data.tasks) {
|
|
14649
|
+
const agent = agentOf(task, byAgent);
|
|
14650
|
+
if (!agent) continue;
|
|
14651
|
+
if (filter.agent && agent.id !== filter.agent) continue;
|
|
14652
|
+
if (filter.project && task.projectId !== filter.project) continue;
|
|
14653
|
+
const note = latest.get(`${task.id} ${agent.id}`) ?? null;
|
|
14654
|
+
const done = task.status === "done";
|
|
14655
|
+
const row = {
|
|
14656
|
+
task,
|
|
14657
|
+
agent,
|
|
14658
|
+
note,
|
|
14659
|
+
late: !done && !!task.dueDate && task.dueDate < today
|
|
14660
|
+
};
|
|
14661
|
+
const a = task.approval;
|
|
14662
|
+
if (done) {
|
|
14663
|
+
if (a?.status === "approved" && a.decidedAt && localDay(a.decidedAt) === today) view.doneToday.push(row);
|
|
14664
|
+
} else if (task.status === "review" && a?.status === "pending") (a.approverId === me ? view.needsYou : view.withOthers).push(row);
|
|
14665
|
+
else if (sentBack(task) && task.assigneeId === agent.id && task.status !== "doing") {
|
|
14666
|
+
const since = a?.decidedAt ?? "";
|
|
14667
|
+
if (!note || note.createdAt <= since) view.sentBack.push(row);
|
|
14668
|
+
} else if (task.status === "doing" && task.assigneeId === agent.id) view.working.push(row);
|
|
14669
|
+
}
|
|
14670
|
+
const asked = (r) => r.task.approval?.askedAt ?? "";
|
|
14671
|
+
const decided = (r) => r.task.approval?.decidedAt ?? "";
|
|
14672
|
+
view.needsYou.sort((x, y) => asked(x).localeCompare(asked(y)));
|
|
14673
|
+
view.withOthers.sort((x, y) => asked(x).localeCompare(asked(y)));
|
|
14674
|
+
view.sentBack.sort((x, y) => decided(x).localeCompare(decided(y)));
|
|
14675
|
+
view.doneToday.sort((x, y) => decided(y).localeCompare(decided(x)));
|
|
14676
|
+
view.working.sort((x, y) => Number(y.late) - Number(x.late) || (x.note?.createdAt ?? "").localeCompare(y.note?.createdAt ?? ""));
|
|
14677
|
+
return view;
|
|
14678
|
+
}
|
|
14679
|
+
/** A comment's body as one short line for a row. */
|
|
14680
|
+
function noteLine(body, max = 140) {
|
|
14681
|
+
const line = body.replace(/\s+/g, " ").trim();
|
|
14682
|
+
return line.length > max ? `${line.slice(0, max - 1).trimEnd()}…` : line;
|
|
14683
|
+
}
|
|
14684
|
+
|
|
14685
|
+
// src/lib/task-approval.ts
|
|
14686
|
+
/** Waits on its approver now: asked, not yet answered, and not done. */
|
|
14687
|
+
function awaitingApproval(task) {
|
|
14688
|
+
return Boolean(task?.approval && task.approval.status === "pending" && task.status !== "done");
|
|
14689
|
+
}
|
|
14690
|
+
/** The patch that asks `approverId` to approve the task (again, after changes). */
|
|
14691
|
+
function askApprovalPatch(task, approverId, opts) {
|
|
14692
|
+
if (task.status === "done") throw new ApprovalError("It's already done.");
|
|
14693
|
+
if (approverId === opts.by) throw new ApprovalError("Ask someone else. Your own approval is just finishing it.");
|
|
14694
|
+
return { approval: {
|
|
14695
|
+
approverId,
|
|
14696
|
+
askedById: opts.by,
|
|
14697
|
+
askedAt: opts.at,
|
|
14698
|
+
status: "pending",
|
|
14699
|
+
note: null,
|
|
14700
|
+
decidedAt: null
|
|
14701
|
+
} };
|
|
14702
|
+
}
|
|
14703
|
+
/**
|
|
14704
|
+
* The approver's answer as a patch: approving finishes the task; asking for
|
|
14705
|
+
* changes needs a note saying what, and leaves the task open.
|
|
14706
|
+
*/
|
|
14707
|
+
function decideApprovalPatch(task, decision, opts) {
|
|
14708
|
+
const a = task.approval;
|
|
14709
|
+
if (!a) throw new ApprovalError("Nobody asked for approval on this task.");
|
|
14710
|
+
if (a.approverId !== opts.by) throw new ApprovalError("Only the person asked can approve it.");
|
|
14711
|
+
const note = (opts.note ?? "").replace(/\s+/g, " ").trim().slice(0, 500);
|
|
14712
|
+
if (decision === "changes" && !note) throw new ApprovalError("Say what should change.");
|
|
14713
|
+
const approval = {
|
|
14714
|
+
...a,
|
|
14715
|
+
status: decision === "approve" ? "approved" : "changes_requested",
|
|
14716
|
+
note: note || null,
|
|
14717
|
+
decidedAt: opts.at
|
|
14718
|
+
};
|
|
14719
|
+
if (decision === "approve") return task.status !== "done" ? {
|
|
14720
|
+
approval,
|
|
14721
|
+
status: "done"
|
|
14722
|
+
} : { approval };
|
|
14723
|
+
return opts.askerIsAgent && task.status === "review" ? {
|
|
14724
|
+
approval,
|
|
14725
|
+
status: "todo"
|
|
14726
|
+
} : { approval };
|
|
14727
|
+
}
|
|
14728
|
+
/** Open tasks waiting on this person's approval, oldest ask first. */
|
|
14729
|
+
function approvalsWaitingOn(tasks, personId) {
|
|
14730
|
+
return tasks.filter((t) => awaitingApproval(t) && t.approval.approverId === personId).sort((a, b) => a.approval.askedAt.localeCompare(b.approval.askedAt));
|
|
14731
|
+
}
|
|
14732
|
+
var APPROVAL_NOTE_MAX, ApprovalError;
|
|
14733
|
+
var init_task_approval = __esmMin((() => {
|
|
14734
|
+
APPROVAL_NOTE_MAX = 500;
|
|
14735
|
+
ApprovalError = class extends Error {};
|
|
14736
|
+
}));
|
|
14737
|
+
|
|
14738
|
+
// src/tui/views/agents.tsx
|
|
14739
|
+
init_date_text();
|
|
14740
|
+
init_indexes();
|
|
14741
|
+
init_task_approval();
|
|
14742
|
+
init_task_keys();
|
|
14743
|
+
const TITLE = {
|
|
14744
|
+
needsYou: "For you to check",
|
|
14745
|
+
withOthers: "With someone else",
|
|
14746
|
+
working: "In play",
|
|
14747
|
+
sentBack: "Sent back, not picked up",
|
|
14748
|
+
doneToday: "Approved today"
|
|
14749
|
+
};
|
|
14750
|
+
const ORDER = [
|
|
14751
|
+
"needsYou",
|
|
14752
|
+
"withOthers",
|
|
14753
|
+
"working",
|
|
14754
|
+
"sentBack",
|
|
14755
|
+
"doneToday"
|
|
14756
|
+
];
|
|
14757
|
+
/**
|
|
14758
|
+
* The website's Agents page in the terminal (lib/agents-page.ts): every
|
|
14759
|
+
* agent's work across the harbor. a approves the work picked for you to
|
|
14760
|
+
* check, s sends it back with a one-line note, Enter opens the task.
|
|
14761
|
+
*/
|
|
14762
|
+
function AgentsView({ active, width, height, go }) {
|
|
14763
|
+
const { store } = useDeps();
|
|
14764
|
+
const people = useHarbor((s) => s.people);
|
|
14765
|
+
const tasks = useHarbor((s) => s.tasks);
|
|
14766
|
+
const comments = useHarbor((s) => s.comments);
|
|
14767
|
+
const projects = useHarbor((s) => s.projects);
|
|
14768
|
+
const me = useHarbor((s) => s.currentUserId);
|
|
14769
|
+
const view = useMemo(() => agentsView({
|
|
14770
|
+
people,
|
|
14771
|
+
tasks,
|
|
14772
|
+
comments
|
|
14773
|
+
}, me, /* @__PURE__ */ new Date()), [
|
|
14774
|
+
people,
|
|
14775
|
+
tasks,
|
|
14776
|
+
comments,
|
|
14777
|
+
me
|
|
14778
|
+
]);
|
|
14779
|
+
const lines = useMemo(() => {
|
|
14780
|
+
const out = [];
|
|
14781
|
+
for (const kind of ORDER) {
|
|
14782
|
+
const rows = view[kind];
|
|
14783
|
+
if (!rows.length) continue;
|
|
14784
|
+
out.push({
|
|
14785
|
+
kind: "head",
|
|
14786
|
+
title: TITLE[kind],
|
|
14787
|
+
n: rows.length
|
|
14788
|
+
});
|
|
14789
|
+
for (const row of rows) out.push({
|
|
14790
|
+
kind: "row",
|
|
14791
|
+
of: kind,
|
|
14792
|
+
row
|
|
14793
|
+
});
|
|
14794
|
+
}
|
|
14795
|
+
return out;
|
|
14796
|
+
}, [view]);
|
|
14797
|
+
const rows = lines.filter((l) => l.kind === "row");
|
|
14798
|
+
const [at, setAt] = useState(0);
|
|
14799
|
+
const picked = rows[Math.min(at, rows.length - 1)];
|
|
14800
|
+
const projectsById = byId(projects);
|
|
14801
|
+
const decide = (row, decision, note = "") => {
|
|
14802
|
+
try {
|
|
14803
|
+
const patch = decideApprovalPatch(row.task, decision, {
|
|
14804
|
+
by: me,
|
|
14805
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14806
|
+
note,
|
|
14807
|
+
askerIsAgent: true
|
|
14808
|
+
});
|
|
14809
|
+
store.getState().updateTask(row.task.id, patch, { allowOverCap: true });
|
|
14810
|
+
go.notify(decision === "approve" ? `Approved “${row.task.title}”, and finished it.` : `Sent “${row.task.title}” back to ${row.agent.name} with your note.`);
|
|
14811
|
+
} catch (e) {
|
|
14812
|
+
if (!(e instanceof ApprovalError)) throw e;
|
|
14813
|
+
go.notify(e.message);
|
|
14814
|
+
}
|
|
14815
|
+
};
|
|
14816
|
+
useInput((input, key) => {
|
|
14817
|
+
if (key.upArrow || input === "k") setAt((i) => step$1(i, -1, rows.length));
|
|
14818
|
+
else if (key.downArrow || input === "j") setAt((i) => step$1(i, 1, rows.length));
|
|
14819
|
+
else if (key.return && picked) go.openTask(picked.row.task.id);
|
|
14820
|
+
else if ((input === "a" || input === "s") && picked) {
|
|
14821
|
+
if (picked.of !== "needsYou") return go.notify("Only work handed in for you to check can be approved or sent back.");
|
|
14822
|
+
if (input === "a") decide(picked.row, "approve");
|
|
14823
|
+
else go.ask("What should change?", (text) => {
|
|
14824
|
+
if (text.trim()) decide(picked.row, "changes", text);
|
|
14825
|
+
});
|
|
14826
|
+
}
|
|
14827
|
+
}, { isActive: active });
|
|
14828
|
+
if (view.agents.length === 0) return /* @__PURE__ */ jsxs(Box, {
|
|
14829
|
+
flexDirection: "column",
|
|
14830
|
+
width,
|
|
14831
|
+
height,
|
|
14832
|
+
paddingX: 1,
|
|
14833
|
+
children: [/* @__PURE__ */ jsx(Heading, { children: "Agents" }), /* @__PURE__ */ jsx(Text, {
|
|
14834
|
+
color: theme.muted,
|
|
14835
|
+
wrap: "wrap",
|
|
14836
|
+
children: "No agents on the crew yet. Add one on the website's People page (Add an agent), then connect Claude or Claude Code to it. Its work shows here for you to approve."
|
|
14837
|
+
})]
|
|
14838
|
+
});
|
|
14839
|
+
const selectedLine = picked ? lines.indexOf(picked) : 0;
|
|
14840
|
+
const shown = windowOf(lines, selectedLine, Math.max(1, height - 2));
|
|
14841
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
14842
|
+
flexDirection: "column",
|
|
14843
|
+
width,
|
|
14844
|
+
height,
|
|
14845
|
+
paddingX: 1,
|
|
14846
|
+
children: [
|
|
14847
|
+
/* @__PURE__ */ jsx(Heading, {
|
|
14848
|
+
right: `${view.needsYou.length} for you · ${view.working.length} in play · a approves · s sends back`,
|
|
14849
|
+
children: "Agents"
|
|
14850
|
+
}),
|
|
14851
|
+
lines.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
14852
|
+
color: theme.muted,
|
|
14853
|
+
children: "Nothing from the agents right now."
|
|
14854
|
+
}) : null,
|
|
14855
|
+
shown.items.map((line, i) => {
|
|
14856
|
+
if (line.kind === "head") return /* @__PURE__ */ jsxs(Text, {
|
|
14857
|
+
bold: true,
|
|
14858
|
+
children: [
|
|
14859
|
+
i > 0 ? "\n" : "",
|
|
14860
|
+
line.title,
|
|
14861
|
+
" ",
|
|
14862
|
+
/* @__PURE__ */ jsx(Text, {
|
|
14863
|
+
color: theme.muted,
|
|
14864
|
+
children: line.n
|
|
14865
|
+
})
|
|
14866
|
+
]
|
|
14867
|
+
}, `h-${line.title}`);
|
|
14868
|
+
const { task, agent, note, late } = line.row;
|
|
14869
|
+
const on = active && line === picked;
|
|
14870
|
+
const key = taskKey(task, projectsById.get(task.projectId));
|
|
14871
|
+
const said = line.of === "sentBack" ? task.approval?.note : line.of === "doneToday" ? null : note?.body;
|
|
14872
|
+
const when = line.of === "needsYou" || line.of === "withOthers" ? task.approval?.askedAt : line.of === "working" ? note?.createdAt : task.approval?.decidedAt;
|
|
14873
|
+
return /* @__PURE__ */ jsxs(Text, {
|
|
14874
|
+
color: on ? theme.selected : void 0,
|
|
14875
|
+
bold: on,
|
|
14876
|
+
wrap: "truncate-end",
|
|
14877
|
+
children: [
|
|
14878
|
+
on ? "› " : " ",
|
|
14879
|
+
key ? /* @__PURE__ */ jsx(Text, {
|
|
14880
|
+
color: theme.muted,
|
|
14881
|
+
children: key.padEnd(8)
|
|
14882
|
+
}) : null,
|
|
14883
|
+
task.title,
|
|
14884
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
14885
|
+
color: theme.muted,
|
|
14886
|
+
children: [
|
|
14887
|
+
` · ${agent.name}`,
|
|
14888
|
+
late ? /* @__PURE__ */ jsx(Text, {
|
|
14889
|
+
color: theme.coral,
|
|
14890
|
+
children: " · late"
|
|
14891
|
+
}) : null,
|
|
14892
|
+
when ? ` · ${timeAgo(parseIso(when))}` : "",
|
|
14893
|
+
said ? ` · “${noteLine(said, 80)}”` : ""
|
|
14894
|
+
]
|
|
14895
|
+
})
|
|
14896
|
+
]
|
|
14897
|
+
}, task.id);
|
|
14898
|
+
})
|
|
14899
|
+
]
|
|
14900
|
+
});
|
|
14901
|
+
}
|
|
14902
|
+
|
|
14416
14903
|
// src/lib/load.ts
|
|
14417
14904
|
/** Open tasks for one person, bucketed by the week they are due, plus what is already late or has no date. */
|
|
14418
14905
|
function weeklyLoad(tasks, personId, now, weeks = 6, calendar) {
|
|
@@ -17227,7 +17714,7 @@ function HarborSwitch({ harbors, current, width, onPick, onClose }) {
|
|
|
17227
17714
|
const HELP$1 = [
|
|
17228
17715
|
["0–9 / Tab", "the screens / between the sidebar and a screen"],
|
|
17229
17716
|
[":", "anything: a screen, something new, a name"],
|
|
17230
|
-
["/ H C G O", "find a task / harbor / crew / goals / reports"],
|
|
17717
|
+
["/ H C G O I", "find a task / harbor / crew / goals / reports / agents"],
|
|
17231
17718
|
["↑↓ or j k", "move; ←→ or h l across columns and lists"],
|
|
17232
17719
|
["Enter / Esc", "open / back"],
|
|
17233
17720
|
["n", "new: a task, or what the screen lists"],
|
|
@@ -17596,6 +18083,7 @@ init_format();
|
|
|
17596
18083
|
const PAGES = {
|
|
17597
18084
|
today: "/today",
|
|
17598
18085
|
inbox: "/inbox",
|
|
18086
|
+
agents: "/agents",
|
|
17599
18087
|
chat: "/chat",
|
|
17600
18088
|
week: "/week",
|
|
17601
18089
|
brief: "/brief",
|
|
@@ -25192,7 +25680,8 @@ function dueText(task, today) {
|
|
|
25192
25680
|
return `due ${format(day(task.dueDate), "EEE, MMM d")}`;
|
|
25193
25681
|
}
|
|
25194
25682
|
/** What a person needs to hear about since `when.since`, as of `today` (YYYY-MM-DD). */
|
|
25195
|
-
function welcomeBack(data, personId, when, today) {
|
|
25683
|
+
function welcomeBack(data, personId, when, today, shown = []) {
|
|
25684
|
+
const below = new Set(shown);
|
|
25196
25685
|
const since = when.since;
|
|
25197
25686
|
const people = byId(data.people);
|
|
25198
25687
|
const projects = projectsOf(data, personId);
|
|
@@ -25233,12 +25722,27 @@ function welcomeBack(data, personId, when, today) {
|
|
|
25233
25722
|
}
|
|
25234
25723
|
moved.sort((a, b) => Number(Boolean(b.health)) - Number(Boolean(a.health)) || b.done - a.done);
|
|
25235
25724
|
const look = [];
|
|
25725
|
+
const more = [];
|
|
25236
25726
|
const seen = /* @__PURE__ */ new Set();
|
|
25727
|
+
const skipped = {
|
|
25728
|
+
late: 0,
|
|
25729
|
+
due: 0
|
|
25730
|
+
};
|
|
25237
25731
|
const push = (item) => {
|
|
25238
25732
|
const id = item.taskId ?? item.raidId ?? item.text;
|
|
25239
|
-
if (
|
|
25240
|
-
|
|
25241
|
-
|
|
25733
|
+
if (seen.has(id)) return;
|
|
25734
|
+
if (item.taskId && below.has(item.taskId) && (item.kind === "late" || item.kind === "due")) {
|
|
25735
|
+
seen.add(id);
|
|
25736
|
+
skipped[item.kind] += 1;
|
|
25737
|
+
return;
|
|
25738
|
+
}
|
|
25739
|
+
if (look.length < 3) {
|
|
25740
|
+
seen.add(id);
|
|
25741
|
+
look.push(item);
|
|
25742
|
+
} else if (item.kind !== "decision") {
|
|
25743
|
+
seen.add(id);
|
|
25744
|
+
more.push(item);
|
|
25745
|
+
}
|
|
25242
25746
|
};
|
|
25243
25747
|
for (const h of handed) {
|
|
25244
25748
|
const by = first(h.by);
|
|
@@ -25276,9 +25780,28 @@ function welcomeBack(data, personId, when, today) {
|
|
|
25276
25780
|
decisions,
|
|
25277
25781
|
moved: moved.slice(0, 6),
|
|
25278
25782
|
lookFirst: look,
|
|
25783
|
+
moreLook: more,
|
|
25784
|
+
skipped,
|
|
25279
25785
|
quiet: !handed.length && !decisions.length && !moved.length && !look.length
|
|
25280
25786
|
};
|
|
25281
25787
|
}
|
|
25788
|
+
const MORE_WORDS = {
|
|
25789
|
+
handed: "handed to you",
|
|
25790
|
+
late: "late",
|
|
25791
|
+
due: "due soon",
|
|
25792
|
+
decision: "decided"
|
|
25793
|
+
};
|
|
25794
|
+
/** "4 more late", "5 more: 3 late, 2 due soon"; null when nothing more. */
|
|
25795
|
+
function moreText(more) {
|
|
25796
|
+
if (!more.length) return null;
|
|
25797
|
+
const counts = /* @__PURE__ */ new Map();
|
|
25798
|
+
for (const m of more) {
|
|
25799
|
+
const word = MORE_WORDS[m.kind];
|
|
25800
|
+
counts.set(word, (counts.get(word) ?? 0) + 1);
|
|
25801
|
+
}
|
|
25802
|
+
if (counts.size === 1) return `${more.length} more ${[...counts.keys()][0]}`;
|
|
25803
|
+
return `${more.length} more: ${[...counts].map(([w, n]) => `${n} ${w}`).join(", ")}`;
|
|
25804
|
+
}
|
|
25282
25805
|
/** "Welcome back, Priya · away Oct 3 to Oct 17", or "· 5 days since you last looked". */
|
|
25283
25806
|
function welcomeTitle(w, name, today) {
|
|
25284
25807
|
const hi = name ? `Welcome back, ${name}` : "Welcome back";
|
|
@@ -25295,32 +25818,6 @@ function movedText(m, healthLabel) {
|
|
|
25295
25818
|
return `${m.project.name}: ${bits.join(", ")}`;
|
|
25296
25819
|
}
|
|
25297
25820
|
|
|
25298
|
-
// src/lib/agents.ts
|
|
25299
|
-
init_agent_check();
|
|
25300
|
-
const RANK$1 = {
|
|
25301
|
-
urgent: 0,
|
|
25302
|
-
high: 1,
|
|
25303
|
-
medium: 2,
|
|
25304
|
-
low: 3
|
|
25305
|
-
};
|
|
25306
|
-
/** Sent back by the person who checked it, with a note saying what to change. */
|
|
25307
|
-
const sentBack = (t) => t.approval?.status === "changes_requested" && t.status !== "done" && t.status !== "review";
|
|
25308
|
-
/** What an agent should work on: its open tasks not yet waiting on review, what was sent back first, then in progress, then most urgent and soonest. */
|
|
25309
|
-
function agentQueue(data, agentId) {
|
|
25310
|
-
return data.tasks.filter((t) => t.assigneeId === agentId && (t.status === "todo" || t.status === "doing" || t.status === "backlog")).sort((a, b) => Number(sentBack(b)) - Number(sentBack(a)) || Number(b.status === "doing") - Number(a.status === "doing") || Number(a.status === "backlog") - Number(b.status === "backlog") || RANK$1[a.priority] - RANK$1[b.priority] || (a.dueDate ?? "9999").localeCompare(b.dueDate ?? "9999"));
|
|
25311
|
-
}
|
|
25312
|
-
/** The agent an app means: the one named, else the only one on the crew. */
|
|
25313
|
-
function pickAgent(people, key) {
|
|
25314
|
-
const agents = people.filter(isAgent);
|
|
25315
|
-
if (agents.length === 0) return "There are no agents on this harbor's crew yet. Someone adds one on People with Add an agent.";
|
|
25316
|
-
if (!key) {
|
|
25317
|
-
if (agents.length === 1) return agents[0];
|
|
25318
|
-
return `This harbor has ${agents.length} agents (${agents.map((a) => a.name).join(", ")}). Say which with agent.`;
|
|
25319
|
-
}
|
|
25320
|
-
const k = key.trim().toLowerCase();
|
|
25321
|
-
return agents.find((a) => a.id === key.trim() || a.name.trim().toLowerCase() === k) ?? `No agent called "${key}". The crew's agents: ${agents.map((a) => a.name).join(", ")}.`;
|
|
25322
|
-
}
|
|
25323
|
-
|
|
25324
25821
|
// src/lib/fog.ts
|
|
25325
25822
|
function latestBy(cache, items, key, at) {
|
|
25326
25823
|
const hit = cache.get(items);
|
|
@@ -25780,33 +26277,6 @@ function gapText(gap) {
|
|
|
25780
26277
|
return `${called}; the numbers have said ${WORD[gap.rules]} for the last ${weeksText(gap.days)}.`;
|
|
25781
26278
|
}
|
|
25782
26279
|
|
|
25783
|
-
// src/lib/task-approval.ts
|
|
25784
|
-
/** Waits on its approver now: asked, not yet answered, and not done. */
|
|
25785
|
-
function awaitingApproval(task) {
|
|
25786
|
-
return Boolean(task?.approval && task.approval.status === "pending" && task.status !== "done");
|
|
25787
|
-
}
|
|
25788
|
-
/** The patch that asks `approverId` to approve the task (again, after changes). */
|
|
25789
|
-
function askApprovalPatch(task, approverId, opts) {
|
|
25790
|
-
if (task.status === "done") throw new ApprovalError("It's already done.");
|
|
25791
|
-
if (approverId === opts.by) throw new ApprovalError("Ask someone else. Your own approval is just finishing it.");
|
|
25792
|
-
return { approval: {
|
|
25793
|
-
approverId,
|
|
25794
|
-
askedById: opts.by,
|
|
25795
|
-
askedAt: opts.at,
|
|
25796
|
-
status: "pending",
|
|
25797
|
-
note: null,
|
|
25798
|
-
decidedAt: null
|
|
25799
|
-
} };
|
|
25800
|
-
}
|
|
25801
|
-
/** Open tasks waiting on this person's approval, oldest ask first. */
|
|
25802
|
-
function approvalsWaitingOn(tasks, personId) {
|
|
25803
|
-
return tasks.filter((t) => awaitingApproval(t) && t.approval.approverId === personId).sort((a, b) => a.approval.askedAt.localeCompare(b.approval.askedAt));
|
|
25804
|
-
}
|
|
25805
|
-
var ApprovalError;
|
|
25806
|
-
var init_task_approval = __esmMin((() => {
|
|
25807
|
-
ApprovalError = class extends Error {};
|
|
25808
|
-
}));
|
|
25809
|
-
|
|
25810
26280
|
// src/lib/mcp/tools.ts
|
|
25811
26281
|
init_project_messages();
|
|
25812
26282
|
init_daily_digest();
|
|
@@ -27002,7 +27472,7 @@ const HARBOR_TOOLS = [
|
|
|
27002
27472
|
tool({
|
|
27003
27473
|
name: "catch_up",
|
|
27004
27474
|
title: "While you were away",
|
|
27005
|
-
description: "The catch-up the website and the terminal app open on after time away or a few days unseen (while you were away): tasks handed to the person since then and by whom, decisions made on their projects without them, what moved on their projects (done, added, health changes), and the three to look at first. It counts from the start of time away they were marked for once its return date has come, else from since (when they last looked; any ISO date or moment), else the last 7 days. Reading it doesn't clear the catch-up anywhere." + DATA_NOTE,
|
|
27475
|
+
description: "The catch-up the website and the terminal app open on after time away or a few days unseen (while you were away): tasks handed to the person since then and by whom, decisions made on their projects without them, what moved on their projects (done, added, health changes), and the three to look at first (lookFirstMore counts the late, due-soon and handed-over tasks that didn't fit). It counts from the start of time away they were marked for once its return date has come, else from since (when they last looked; any ISO date or moment), else the last 7 days. Reading it doesn't clear the catch-up anywhere." + DATA_NOTE,
|
|
27006
27476
|
input: object({
|
|
27007
27477
|
harbor: harborArg,
|
|
27008
27478
|
since: string().regex(/^\d{4}-\d{2}-\d{2}/, "a date as YYYY-MM-DD, or an ISO moment").max(40).optional().describe("When the person last looked, YYYY-MM-DD or an ISO moment.")
|
|
@@ -27037,6 +27507,11 @@ const HARBOR_TOOLS = [
|
|
|
27037
27507
|
...l.taskId ? { taskId: l.taskId } : {},
|
|
27038
27508
|
...l.raidId ? { raidId: l.raidId } : {}
|
|
27039
27509
|
})),
|
|
27510
|
+
...w.moreLook.length ? { lookFirstMore: {
|
|
27511
|
+
late: w.moreLook.filter((l) => l.kind === "late").length,
|
|
27512
|
+
due: w.moreLook.filter((l) => l.kind === "due").length,
|
|
27513
|
+
handed: w.moreLook.filter((l) => l.kind === "handed").length
|
|
27514
|
+
} } : {},
|
|
27040
27515
|
handed: w.handed.map(({ task, by }) => ({
|
|
27041
27516
|
id: task.id,
|
|
27042
27517
|
...keyOf(task) ? { key: keyOf(task) } : {},
|
|
@@ -28121,6 +28596,77 @@ const HARBOR_TOOLS = [
|
|
|
28121
28596
|
};
|
|
28122
28597
|
}
|
|
28123
28598
|
}),
|
|
28599
|
+
tool({
|
|
28600
|
+
name: "agents_overview",
|
|
28601
|
+
title: "Every agent's work",
|
|
28602
|
+
description: "The harbor's Agents page as data: across every project, the agents' work handed in to the person for review (needsYou, oldest first, each with the agent's latest note), handed in to someone else (withOthers), in progress (working, late first), sent back and not picked up again (sentBack), and approved today (doneToday). Filter with agent and project. The person approves or sends back with decide_approval." + DATA_NOTE,
|
|
28603
|
+
input: object({
|
|
28604
|
+
harbor: harborArg,
|
|
28605
|
+
agent: string().max(200).optional().describe("One agent's name or id."),
|
|
28606
|
+
project: string().max(200).optional().describe("Project id, key or name, for one only."),
|
|
28607
|
+
limit: limitArg(50, 20)
|
|
28608
|
+
}),
|
|
28609
|
+
run: (ctx, input) => {
|
|
28610
|
+
const { data } = ctx;
|
|
28611
|
+
if (!data.people.some(isAgent)) return {
|
|
28612
|
+
agents: [],
|
|
28613
|
+
note: "There are no agents on this harbor's crew yet. Someone adds one on People with Add an agent."
|
|
28614
|
+
};
|
|
28615
|
+
const agent = input.agent ? pickAgent(data.people, input.agent) : null;
|
|
28616
|
+
if (typeof agent === "string") throw new ToolError(agent);
|
|
28617
|
+
const project = input.project ? findOne(data.projects, input.project, "project") : null;
|
|
28618
|
+
const view = agentsView(data, data.currentUserId, /* @__PURE__ */ new Date(), {
|
|
28619
|
+
...agent ? { agent: agent.id } : {},
|
|
28620
|
+
...project ? { project: project.id } : {}
|
|
28621
|
+
});
|
|
28622
|
+
const people = byId(data.people);
|
|
28623
|
+
const projects = byId(data.projects);
|
|
28624
|
+
const rows = (list) => list.slice(0, input.limit).map((r) => {
|
|
28625
|
+
const key = taskKey(r.task, projects.get(r.task.projectId));
|
|
28626
|
+
const a = r.task.approval;
|
|
28627
|
+
return {
|
|
28628
|
+
id: r.task.id,
|
|
28629
|
+
...key ? { key } : {},
|
|
28630
|
+
title: r.task.title,
|
|
28631
|
+
agent: r.agent.name,
|
|
28632
|
+
project: projects.get(r.task.projectId)?.name ?? null,
|
|
28633
|
+
...r.late ? { late: true } : {},
|
|
28634
|
+
due: dayOf(r.task.dueDate),
|
|
28635
|
+
...r.note ? { agentNote: {
|
|
28636
|
+
at: r.note.createdAt,
|
|
28637
|
+
body: r.note.body
|
|
28638
|
+
} } : {},
|
|
28639
|
+
...a && a.status === "pending" ? {
|
|
28640
|
+
askedAt: a.askedAt,
|
|
28641
|
+
waitingOn: nameOf$2(people, a.approverId)
|
|
28642
|
+
} : {},
|
|
28643
|
+
...a && a.status !== "pending" ? {
|
|
28644
|
+
decidedAt: a.decidedAt,
|
|
28645
|
+
by: nameOf$2(people, a.approverId),
|
|
28646
|
+
...a.note ? { note: a.note } : {}
|
|
28647
|
+
} : {},
|
|
28648
|
+
...webLink(ctx, { task: r.task.id })
|
|
28649
|
+
};
|
|
28650
|
+
});
|
|
28651
|
+
return {
|
|
28652
|
+
agents: view.agents.map((a) => ({
|
|
28653
|
+
id: a.id,
|
|
28654
|
+
name: a.name,
|
|
28655
|
+
lastReported: a.lastSeenAt ?? null
|
|
28656
|
+
})),
|
|
28657
|
+
counts: {
|
|
28658
|
+
needsYou: view.needsYou.length,
|
|
28659
|
+
working: view.working.length,
|
|
28660
|
+
doneToday: view.doneToday.length
|
|
28661
|
+
},
|
|
28662
|
+
needsYou: rows(view.needsYou),
|
|
28663
|
+
withOthers: rows(view.withOthers),
|
|
28664
|
+
working: rows(view.working),
|
|
28665
|
+
sentBack: rows(view.sentBack),
|
|
28666
|
+
doneToday: rows(view.doneToday)
|
|
28667
|
+
};
|
|
28668
|
+
}
|
|
28669
|
+
}),
|
|
28124
28670
|
tool({
|
|
28125
28671
|
name: "fog",
|
|
28126
28672
|
title: "Tasks in fog",
|
|
@@ -29086,8 +29632,9 @@ var init_session = __esmMin((() => {
|
|
|
29086
29632
|
/**
|
|
29087
29633
|
* The few things a new harbor needs in its first week, in the order they
|
|
29088
29634
|
* matter: a first project, a real name on the account, a confirmed email,
|
|
29089
|
-
*
|
|
29090
|
-
* joined is asked only for their name
|
|
29635
|
+
* someone else aboard, and an AI app connected. Today lists the ones not
|
|
29636
|
+
* done. Someone who joined is asked only for their name, their email and
|
|
29637
|
+
* the AI app, which is theirs, not the harbor's.
|
|
29091
29638
|
*
|
|
29092
29639
|
* The placeholder program ("The work") isn't on the list: it gives way to
|
|
29093
29640
|
* the first program anyone makes, so naming it is never a chore to set.
|
|
@@ -29100,7 +29647,7 @@ var init_session = __esmMin((() => {
|
|
|
29100
29647
|
function starterProgram(data) {
|
|
29101
29648
|
const program = data.programs.find((p) => p.name.trim() === STARTER_PROGRAM);
|
|
29102
29649
|
if (!program) return null;
|
|
29103
|
-
return
|
|
29650
|
+
return realProjects(data.projects).some((p) => p.programId === program.id) || data.milestones.some((m) => m.programId === program.id) || data.raidItems.some((r) => r.programId === program.id) ? null : program;
|
|
29104
29651
|
}
|
|
29105
29652
|
var init_first_week = __esmMin((() => {
|
|
29106
29653
|
init_first_voyage();
|
|
@@ -29613,6 +30160,16 @@ function hierarchySlice({ get, write }) {
|
|
|
29613
30160
|
get().log(`removed ${kind} “${name ?? id}”`);
|
|
29614
30161
|
return counts;
|
|
29615
30162
|
},
|
|
30163
|
+
clearSample: () => {
|
|
30164
|
+
const state = get();
|
|
30165
|
+
if (!hasSample(state) && !state.people.some((p) => isSampleId(p.id))) return false;
|
|
30166
|
+
write({
|
|
30167
|
+
...withoutSample(state),
|
|
30168
|
+
selectedTaskId: null
|
|
30169
|
+
});
|
|
30170
|
+
get().log("cleared the sample portfolio", "/portfolios");
|
|
30171
|
+
return true;
|
|
30172
|
+
},
|
|
29616
30173
|
setBoardConfig: (projectId, config) => {
|
|
29617
30174
|
write({ boardConfigs: {
|
|
29618
30175
|
...get().boardConfigs ?? {},
|
|
@@ -29662,6 +30219,7 @@ var init_hierarchy = __esmMin((() => {
|
|
|
29662
30219
|
init_format();
|
|
29663
30220
|
init_empty();
|
|
29664
30221
|
init_first_week();
|
|
30222
|
+
init_sample_ids();
|
|
29665
30223
|
SMALL_IMPORT = 20;
|
|
29666
30224
|
}));
|
|
29667
30225
|
|
|
@@ -30017,7 +30575,7 @@ function tasksSlice({ set, get, write }) {
|
|
|
30017
30575
|
...t,
|
|
30018
30576
|
id,
|
|
30019
30577
|
createdAt: stamp(),
|
|
30020
|
-
createdById: get().currentUserId || null,
|
|
30578
|
+
createdById: t.createdById ?? (get().currentUserId || null),
|
|
30021
30579
|
completedAt: t.status === "done" ? t.completedAt ?? stamp() : null,
|
|
30022
30580
|
checklist: t.checklist ?? [],
|
|
30023
30581
|
..."parentTaskId" in t ? { parentTaskId } : {},
|
|
@@ -34482,7 +35040,8 @@ function WelcomeView({ when, active, width, height, go, onDone }) {
|
|
|
34482
35040
|
}, { isActive: active });
|
|
34483
35041
|
const [hello, ...rest] = welcomeTitle(w, name, day).split(" · ");
|
|
34484
35042
|
const label = (h) => HEALTH_LABEL$1[h];
|
|
34485
|
-
const
|
|
35043
|
+
const more = moreText(w.moreLook);
|
|
35044
|
+
const room = Math.max(0, height - 6 - look.length - (more ? 1 : 0));
|
|
34486
35045
|
const lines = [
|
|
34487
35046
|
...w.decisions.length ? [{
|
|
34488
35047
|
head: true,
|
|
@@ -34531,6 +35090,16 @@ function WelcomeView({ when, active, width, height, go, onDone }) {
|
|
|
34531
35090
|
]
|
|
34532
35091
|
}, l.taskId ?? l.raidId ?? l.text);
|
|
34533
35092
|
}),
|
|
35093
|
+
more ? /* @__PURE__ */ jsxs(Text, {
|
|
35094
|
+
color: theme.muted,
|
|
35095
|
+
wrap: "truncate-end",
|
|
35096
|
+
children: [
|
|
35097
|
+
" ",
|
|
35098
|
+
"And ",
|
|
35099
|
+
more,
|
|
35100
|
+
", all on Today"
|
|
35101
|
+
]
|
|
35102
|
+
}) : null,
|
|
34534
35103
|
lines.map((l, i) => l.head ? /* @__PURE__ */ jsx(Box, {
|
|
34535
35104
|
marginTop: 1,
|
|
34536
35105
|
children: /* @__PURE__ */ jsx(Text, {
|
|
@@ -38200,14 +38769,19 @@ const NAV = [
|
|
|
38200
38769
|
{
|
|
38201
38770
|
screen: "reports",
|
|
38202
38771
|
label: "Reports"
|
|
38772
|
+
},
|
|
38773
|
+
{
|
|
38774
|
+
screen: "agents",
|
|
38775
|
+
label: "Agents"
|
|
38203
38776
|
}
|
|
38204
38777
|
];
|
|
38205
|
-
/** The keys past 0 that open a sidebar screen: C the crew, W your week, G goals, O reports. */
|
|
38778
|
+
/** The keys past 0 that open a sidebar screen: C the crew, W your week, G goals, O reports, I agents. */
|
|
38206
38779
|
const LETTER_KEYS = [
|
|
38207
38780
|
"C",
|
|
38208
38781
|
"W",
|
|
38209
38782
|
"G",
|
|
38210
|
-
"O"
|
|
38783
|
+
"O",
|
|
38784
|
+
"I"
|
|
38211
38785
|
];
|
|
38212
38786
|
/** The screens where n makes something: a task, or what the screen lists. */
|
|
38213
38787
|
const N_MAKES = /* @__PURE__ */ new Set([
|
|
@@ -38461,6 +39035,7 @@ function App({ ui, startIn }) {
|
|
|
38461
39035
|
if (input === "W") return goScreen("week");
|
|
38462
39036
|
if (input === "G") return goScreen("goals");
|
|
38463
39037
|
if (input === "O") return goScreen("reports");
|
|
39038
|
+
if (input === "I") return goScreen("agents");
|
|
38464
39039
|
if (input === "r" && page?.kind !== "bridge") {
|
|
38465
39040
|
sync.retryNow();
|
|
38466
39041
|
return notify("Saving now.");
|
|
@@ -38784,6 +39359,7 @@ function App({ ui, startIn }) {
|
|
|
38784
39359
|
else if (screen === "week") screenNode = /* @__PURE__ */ jsx(WeekView, { ...viewProps });
|
|
38785
39360
|
else if (screen === "goals") screenNode = /* @__PURE__ */ jsx(GoalsView, { ...viewProps });
|
|
38786
39361
|
else if (screen === "reports") screenNode = /* @__PURE__ */ jsx(ReportsView, { ...viewProps });
|
|
39362
|
+
else if (screen === "agents") screenNode = /* @__PURE__ */ jsx(AgentsView, { ...viewProps });
|
|
38787
39363
|
else screenNode = /* @__PURE__ */ jsx(HistoryView, { ...viewProps });
|
|
38788
39364
|
return /* @__PURE__ */ jsxs(Box, {
|
|
38789
39365
|
flexDirection: "column",
|