@abhishek944/pi-tasks 0.15.0 → 0.17.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/README.md +63 -14
- package/dist/agents/delegation.d.ts +4 -0
- package/dist/agents/delegation.js +130 -0
- package/dist/agents/herdr.d.ts +10 -3
- package/dist/agents/herdr.js +39 -12
- package/dist/agents/links.d.ts +3 -3
- package/dist/agents/links.js +42 -19
- package/dist/auto-continue.js +409 -33
- package/dist/blocked.d.ts +29 -0
- package/dist/blocked.js +100 -0
- package/dist/command.d.ts +2 -2
- package/dist/command.js +7 -3
- package/dist/delegated-time.d.ts +12 -1
- package/dist/delegated-time.js +96 -15
- package/dist/dependency.d.ts +7 -0
- package/dist/dependency.js +13 -0
- package/dist/durable.d.ts +42 -0
- package/dist/durable.js +577 -0
- package/dist/herdr-header.d.ts +3 -0
- package/dist/herdr-header.js +100 -0
- package/dist/herdr-panel.d.ts +15 -0
- package/dist/herdr-panel.js +219 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +125 -56
- package/dist/markdown.js +3 -1
- package/dist/panel-settings.d.ts +11 -0
- package/dist/panel-settings.js +30 -0
- package/dist/progress.js +1 -1
- package/dist/snapshot.d.ts +23 -0
- package/dist/snapshot.js +166 -0
- package/dist/state.d.ts +43 -18
- package/dist/state.js +581 -289
- package/dist/thoughts.d.ts +11 -0
- package/dist/thoughts.js +14 -0
- package/dist/timing.js +9 -2
- package/dist/tools.js +295 -34
- package/dist/tracking.js +25 -13
- package/dist/transition.d.ts +9 -0
- package/dist/transition.js +26 -0
- package/dist/types.d.ts +76 -3
- package/dist/ui/panel.js +38 -19
- package/dist/ui/task-view.d.ts +7 -0
- package/dist/ui/task-view.js +10 -0
- package/dist/ui/works-dashboard.js +37 -19
- package/docs/REFERENCE.md +85 -31
- package/docs/USAGE_GUIDE.md +129 -55
- package/herdr/pi-tasks/README.md +46 -0
- package/herdr/pi-tasks/header.js +212 -0
- package/herdr/pi-tasks/main.js +488 -0
- package/herdr/pi-tasks/mod.json +3 -0
- package/herdr/pi-tasks/spinner.svg +1 -0
- package/package.json +26 -1
- package/dist/agents/tools.d.ts +0 -3
- package/dist/agents/tools.js +0 -143
package/dist/tracking.js
CHANGED
|
@@ -2,8 +2,11 @@ const REQUIRED_TRACKING_TOOLS = ["WorkCreate", "WorkList", "WorkUpdate", "TodoCr
|
|
|
2
2
|
const TRACKING_GUIDANCE = `[SESSION COORDINATION]
|
|
3
3
|
Work is a collection of tasks with shared context and no status of its own. A todo is a concrete step that belongs to a work and owns its execution status. A monitor runs one long-lived background command. A loop schedules a future, recurring, event-driven, or idle continuation.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Tasks belong only to the Pi session ID. Conversation branch navigation never rolls back task records; a new session ID starts a separate store.
|
|
6
|
+
For every normal user request that starts or continues work, keep the session's work and todo records synchronized. Treat each distinct new actionable request as its own outcome: before starting or delegating it, create its own Todo under the relevant Work, or a new Work when the outcome is separate, even when the request extends an existing Work. Do not record a new request only by broadening workInfo, renaming an existing Todo, or blocking a previous Todo. Reuse an active Todo only when it genuinely owns the same outcome; do not create a Todo for each sentence, clarification, check, or tool call. Do not skip tracking because the work looks small. Plain conversation and clarification need no Todo, and /ask and /btw remain outside tracking.
|
|
7
|
+
Write workInfo in normal prose with full sentences and spaces between words. Conversational brevity modes must not compress stored records or concatenate words. taskInfo is hidden coordination metadata; finalThoughts is the user-visible result update, separate from stored goals and criteria where available.
|
|
8
|
+
|
|
9
|
+
Each task's finalThoughts is its concise result update. Write one concise update, never a goal restatement, ownership rationale, history, list, or section. For a blocked task, blockedReason is the authoritative visible dependency and what will unblock it; do not duplicate it in finalThoughts. A blocked task also requires dependentOn="user-decision" for a user response, decision, or permission, or dependentOn="another-agent" for another agent's output or review; task details show it beside Final thoughts. For a completed task, state the short actual result, the verification performed, and any remaining limits; do not omit it by habit. For an active task, update only when something significant changed; otherwise leave the thought unchanged rather than adding filler. Keep owner declarations, terminal/monitor links, artifact paths, and parent IDs in taskInfo, never in finalThoughts.
|
|
7
10
|
|
|
8
11
|
Every delegated subagent, at every delegation depth, must use these tools to create or resume its own session-local Work and Todos before assigned work. Do not begin assigned work without a real workId and an active taskId for the current step. Keep these records current and return the IDs with results, checks, and blockers. Parent assignment IDs are context, not shared records: IDs are session-scoped. Record the parent assignment in the worker's details; do not mutate the parent's session records. Include this requirement in every subagent prompt. If tracking tools or IDs are unavailable, report the blocker and do not begin delegated work; a parent-owned Todo or Markdown checklist is not a substitute. Do not invent IDs or backdate tracking. This is an instruction, not a runtime enforcement hook, and does not change the /ask or /btw exceptions.
|
|
9
12
|
|
|
@@ -12,26 +15,31 @@ Shared workflow contract:
|
|
|
12
15
|
- Before execution, read the full current sessionId through the agent's own shell tool using printf '%s\\n' "$PI_SESSION_ID". Require a nonempty safe component matching [A-Za-z0-9][A-Za-z0-9_-]* and real tool-returned Work/Task IDs. Missing tools, identity, or IDs block execution; never substitute the parent's identity or invent IDs. Reading instructions, obtaining identity, and establishing tracking are startup steps.
|
|
13
16
|
- Root task artifacts use repository-relative var/<sessionId>/<workId>/<taskId>/, not system /var/. A delegated worker appends its own <childSessionId>/<childWorkId>/<childTaskId>/ beneath the exact parentTaskDir supplied in its assignment, recursively. Keep resolved paths inside the repository's var/, including through symlinks. Record canonical paths and parent IDs in taskInfo, pass them unchanged in handoffs, and return them with results. Validate ownership before reuse after resume or branch navigation; do not overwrite artifacts just because numeric IDs match. Create artifacts only when useful; feature names are descriptions, not path keys. Do not migrate existing artifacts implicitly. Follow implement for the detailed contract and report incompatible helper paths rather than inventing arguments.
|
|
14
17
|
- For every task, start taskInfo with owner: self or owner: delegate followed by a short reason before execution. Preserve this explicit declaration when updating taskInfo; the panel reads this line to show the ownership badge, with unassigned for missing or conflicting decisions. Delegate only when scope/acceptance criteria are clear, ownership can be isolated, inputs and prerequisites are ready, and useful parallelism or expertise outweighs startup and integration costs. Respect skill-specific delegation restrictions and required tracking/monitor tools. Keep small, tightly coupled, shared-interface, or expensive-to-explain work with one owner. Delegating agents retain responsibility for monitoring, integration, verification, and cleanup; children apply the same rule when allowed to delegate. No arbitrary worker, file-count, or depth thresholds.
|
|
15
|
-
- Herdr subagent
|
|
16
|
-
- Prefer pi-
|
|
17
|
-
- Pi-tasks owns task records/progress and
|
|
18
|
+
- Workers are Core-only by default and need no Herdr app, space, tab or adoption label. When the user or the active harness explicitly requires a visible worker, that Core subagent has its own Herdr app tab named exactly with the parent's delegated Task ID, such as T34, with no brackets, descriptions, Work IDs or prefixes; request it with pi-herdr AgentCreate present:true and use the actual returned terminalId/tabId values because task labels repeat across parent sessions. This is a tab display label, not a terminal address or the child's session/Task identity. Rename the owned tab if assigning a different parent Todo. Never substitute a hidden worker when presentation was explicitly required, and do not split a shared tab.
|
|
19
|
+
- Prefer pi-herdr AgentCreate/Resume/List/Status/Output/Send/Interrupt/Close/Focus for Core operations; use hc only for unavailable process capabilities and herdr-app only for requested presentation and focus. Never use the retired herdr TUI CLI or require HERDR_ENV. AgentCreate verifies the real HC_TERMINAL_ID parent, starts interactive Pi with explicit model flags (Core-only, or in its own task-named visible app tab when presentation is requested), checks Pi readiness, registers a readiness-verified MonitorCreate with hcTerminalId, links the delegate badge and blocks the parent task. It sends no work: confirm MonitorList shows Core subscription ready, then AgentSend the returned assignment to terminalId. Follow-ups retain that monitor/callbacks. onSignal handles worker changes; onDone means the subscription process ended, not task completion. Do not add duplicate monitors, infer completion from signals or close workers before follow-ups finish. A post-launch AgentCreate failure returns structured partial handles; call AgentResume for that same terminal once it is idle, and never relaunch a replacement. AgentResume validates ownership and reuses or replaces exactly one Core subscription before relinking timing. Use AgentClose with terminalId and the monitorId when present; a partial worker with no monitor needs only terminalId. No registry or automatic recovery is added.
|
|
20
|
+
- Pi-tasks owns task records/progress, timing, and delegation metadata; pi-herdr owns the Agent tools and lifecycle orchestration; implement owns coordination and artifact paths; Core owns terminals/processes, Herdr app owns requested presentation and focus, and pi-loop-monitor owns supervision. The shared skill/path guidance is instruction-only, not automatic cross-session shared records; Agent tools simply wrap the CLI and existing monitor tools. Plain conversation, /ask, and /btw remain outside this workflow.
|
|
18
21
|
|
|
19
22
|
Before implementation, investigation, or any other requested work:
|
|
20
23
|
1. Use WorkList and TodoList to find the relevant existing records and avoid duplicates.
|
|
21
24
|
2. If no suitable work exists, create one with WorkCreate. Otherwise use WorkUpdate when its scope or shared context needs refreshing.
|
|
22
|
-
3. Create or update
|
|
23
|
-
4. Mark the todo being attempted active with TodoUpdate before doing that work.
|
|
25
|
+
3. Create a Todo for each distinct new actionable request, or update an existing Todo that already owns the same outcome; adding a request to an existing Work never makes it part of an existing Todo. Works have no status. Each task carries its own visible goal and acceptance criteria and starts active with no separate goal approval; only an explicit human decision cancels or reopens a closed or cancelled task. Keep taskInfo to hidden coordination metadata and set concise finalThoughts for visible updates.
|
|
26
|
+
4. Mark the todo being attempted active with TodoUpdate before doing that work. An active owner: self task starts timing automatically when execution begins or when it becomes the only eligible task; use working=true only to switch between several eligible tasks, and working=false to pause for the rest of the run. Only one local task can be timed; selecting another pauses the previous one. Idle, blocking user prompts, and terminal statuses pause automatically. Delegated agents time their own local tasks; a parent delegate record is not a running local task. AgentCreate provides a timing reportPath: workers pause or complete assignment tasks and call TaskTimeExport with that path and all assignment-local taskIds before returning. The parent calls TaskTimeImport for its delegated task after worker output is available, before closing the agent. Follow-ups re-export the cumulative assignment task set and re-import. Import nested delegate time before exporting to your own caller. These tools read measured values; never hand-write timing reports or estimate or submit durations.
|
|
24
27
|
5. completionPercent on TodoCreate/TodoUpdate is optional. When estimating, use an approximate integer from 0 to 100 based on actual work and verification, not elapsed time or a fixed mapping from status. Use 0 for genuinely unstarted tasks and null when unknown. Never invent progress to make a work look further along.
|
|
25
28
|
|
|
26
29
|
During and after the attempt:
|
|
27
30
|
- When available, use MonitorCreate only when a command should continue in the background; inspect it with MonitorList and do not poll it with shell sleep loops.
|
|
28
31
|
- When available, use LoopCreate only when work needs a future or repeated wake. Do not create a loop for ordinary synchronous work.
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
+
- Waiting has an owner and a wake. A real delegated agent keeps its parent task blocked with dependentOn="another-agent" and one continuous Core monitor (hcTerminalId); a state change is a cue to inspect fresh output, and done or idle is not completion proof. A long command keeps its task active with owner: self and uses a monitor onDone wake; it is not blocked merely because a process is running. An external service, failed tool, or missing access keeps the task active only when nobody can act on it yet; classify by who can clear it. When only the user can unblock the next step, such as a browser profile they must sign in or reconnect, access they must grant, or an identifier only they hold, that is a user-decision blocker for the browser decision workflow, never a plain external obstacle. Never mislabel an external obstacle a user decision or agent output merely because a tool failed. Do not poll on a timer, add one-shot waits, retry unchanged work, or write repeat updates that only restate waiting. A stopped or unchanged loop iteration is normal: for a dynamic loop, update it once; fixed cron/event loops persist normally and need no update. Continue only with remaining work and finish cleanly when the stop condition is met.
|
|
33
|
+
- A loop or monitor does not replace task status. Mark a task blocked only when its next step waits for a user decision or another agent's output or review. Supply both blockedReason and dependentOn when creating a blocked task or entering blocked status; dependentOn must be exactly "user-decision" or "another-agent". Explain the current dependency and what will unblock it; preserve progress. blockedReason is the visible Final thoughts for a blocked task, so do not duplicate it in finalThoughts. Unrelated blocked edits preserve both fields; leaving blocked clears both. Do not mark a task blocked when a service, tool or access failed and nobody can act on it yet: continue safe work and report the unavailable dependency truthfully instead of misclassifying it. Do not leave an obstacle that only the user can clear as an active task with no request to them either; that is a user-decision blocker. When the blocker is a pi-decisions page, set decisionQuestionId to its questionId and pass the same task IDs to SubmitQuestion; if several tasks share one decision, one answer must reconcile all of them, and a superseded page is withdrawn with WithdrawQuestion in the same turn that its linked tasks are updated. If you conclude that a blocked dependency no longer exists, update the task record in that same turn: saying no input is needed without clearing or re-recording the blocker is a lifecycle defect. A task whose premise no longer holds is retired through the human cancellation decision with the reason, never by staying active or marking completion. Parent delegated tasks stay blocked while awaiting worker output; the worker's own local tasks may be active. AgentCreate marks the parent task blocked automatically with dependentOn="another-agent". For manual delegation, mark the parent task blocked explicitly. When the dependency resolves and work resumes, mark the affected tasks active and state the new significant update if there is one; a status change clears an unsupplied stale thought.
|
|
34
|
+
- During longer tasks, include an evidence-based completionPercent estimate in TodoUpdate after roughly 5–10 meaningful working steps or a milestone. Do not wait until completion or only update status when an estimate is possible. When a change is significant, explain the visible evidence and remaining work in finalThoughts; never narrate progress in taskInfo and do not add filler on every estimate. Estimates remain optional: use null when unknown, and leave a percentage unchanged if there is no new evidence. Keep estimates current, including after scope changes. Work completion is derived as the equal average of non-cancelled task percentages; any unknown child makes it unknown. Do not set an independent work percentage.
|
|
35
|
+
- Mark the todo completed, blocked, or cancelled as appropriate. Only use completed/100 after verification. On completion, set finalThoughts to the short actual result, checks performed, and remaining limits. Blocking retains the last percentage; it does not erase completed effort. Reopening a completed task needs a fresh estimate (otherwise it becomes unknown). Update taskInfo only when coordination metadata changes.
|
|
32
36
|
- Percentages are approximate completion, not ETA or proof. Never change task statuses merely because a percentage looks complete.
|
|
33
|
-
- Work is only a collection: never assign it active, blocked, completed, or cancelled status. Track every executable step as a todo; empty works do not trigger continuation. Automatic continuation checks active todos across all works
|
|
34
|
-
- Never create or update works, todos, loops, or monitors during /ask, /btw, or any BTW side thread
|
|
37
|
+
- Work is only a collection: never assign it active, blocked, completed, or cancelled status. Track every executable step as a todo; empty works do not trigger continuation. Automatic continuation checks active todos across all works in the current Pi session; blocked, completed, and cancelled tasks do not trigger it. Update workInfo only when shared scope, context, or decisions change.
|
|
38
|
+
- Never create or update works, todos, loops, or monitors during /ask, /btw, or any BTW side thread.
|
|
39
|
+
|
|
40
|
+
Task lifecycle: every task carries its own visible goal and acceptance criteria and starts active; no separate approval is required to begin, delegate, complete, or close it. Use TaskGoalUpdate when scope materially changes the goal. completed means verified work at 100%; close a completed task when no further work belongs to it. For a delegated worker, request and verify its /close with TaskWorkerClose, or use TaskCloseoutFinalize to verify absence before closing; closure itself needs no approval. Use TaskLifecycleDecision for explicit human cancellation or reopening of closed or cancelled tasks; never autonomously cancel or reopen them. Genuine user decisions still use the browser decision workflow.
|
|
41
|
+
|
|
42
|
+
When enabled, pi-tasks may deliver one combined task review at a safe settlement after tracked transitions or for eligible active work; record-correctness reviews for completed/blocked transitions are delivered even when progress auto-continuation is disabled or its budget is spent. Every delivered review and the first turn after a session resume includes a read-only blocked-task audit with dependency class, blocked age, linked question and reason. Use it to reconcile each record, not to clear blockers that still exist. Treat it as part of the same authorized run: sweep in-scope work and verification before handing back, and do not expand completion into unrelated optional work. A genuine human decision goes to the browser workflow (SubmitQuestion, then WaitForAnswer once) rather than a chat question; share the URL and yield for the watcher wake. If those tools are unavailable or headless, say so and keep the exact dependency in blockedReason. An other-agent wait is not a human decision: keep dependentOn="another-agent" and one continuous monitor.`;
|
|
35
43
|
export function areTrackingToolsActive(pi) {
|
|
36
44
|
const active = new Set(pi.getActiveTools());
|
|
37
45
|
return REQUIRED_TRACKING_TOOLS.every((name) => active.has(name));
|
|
@@ -40,6 +48,10 @@ export function registerTrackingGuidance(pi) {
|
|
|
40
48
|
pi.on("before_agent_start", (event) => {
|
|
41
49
|
if (!areTrackingToolsActive(pi))
|
|
42
50
|
return;
|
|
43
|
-
|
|
51
|
+
const options = event.systemPromptOptions;
|
|
52
|
+
const guidance = TRACKING_GUIDANCE;
|
|
53
|
+
options.appendSystemPrompt = options.appendSystemPrompt
|
|
54
|
+
? `${options.appendSystemPrompt}\n\n${guidance}`
|
|
55
|
+
: guidance;
|
|
44
56
|
});
|
|
45
57
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Todo } from "./types.js";
|
|
2
|
+
/** The tracked status changes that deserve an in-run review. */
|
|
3
|
+
export type TodoTransitionKind = "completed" | "blocked-user" | "blocked-agent";
|
|
4
|
+
/**
|
|
5
|
+
* Map one TodoUpdate state change to its review kind. Ordinary same-status
|
|
6
|
+
* edits emit nothing, except a blocked task whose dependency changes class:
|
|
7
|
+
* that is a genuinely new wait and needs its own review.
|
|
8
|
+
*/
|
|
9
|
+
export declare function todoTransition(previous: Pick<Todo, "status" | "dependentOn"> | undefined, todo: Pick<Todo, "status" | "dependentOn">): TodoTransitionKind | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function blockedKind(dependentOn) {
|
|
2
|
+
if (dependentOn === "user-decision")
|
|
3
|
+
return "blocked-user";
|
|
4
|
+
if (dependentOn === "another-agent")
|
|
5
|
+
return "blocked-agent";
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Map one TodoUpdate state change to its review kind. Ordinary same-status
|
|
10
|
+
* edits emit nothing, except a blocked task whose dependency changes class:
|
|
11
|
+
* that is a genuinely new wait and needs its own review.
|
|
12
|
+
*/
|
|
13
|
+
export function todoTransition(previous, todo) {
|
|
14
|
+
if (previous?.status === todo.status) {
|
|
15
|
+
if (todo.status !== "blocked" || previous.dependentOn === todo.dependentOn)
|
|
16
|
+
return undefined;
|
|
17
|
+
const from = blockedKind(previous.dependentOn);
|
|
18
|
+
const to = blockedKind(todo.dependentOn);
|
|
19
|
+
return from === to ? undefined : to;
|
|
20
|
+
}
|
|
21
|
+
if (todo.status === "completed")
|
|
22
|
+
return "completed";
|
|
23
|
+
if (todo.status === "blocked")
|
|
24
|
+
return blockedKind(todo.dependentOn);
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TaskDependency } from "./dependency.js";
|
|
2
|
+
export type { TaskDependency } from "./dependency.js";
|
|
3
|
+
export type TodoStatus = "active" | "blocked" | "completed" | "closed" | "cancelled";
|
|
2
4
|
export interface Work {
|
|
3
5
|
workId: string;
|
|
4
6
|
workName: string;
|
|
@@ -9,22 +11,93 @@ export interface Work {
|
|
|
9
11
|
/** One assignment's cumulative imported effort; absent measurement stays unknown. */
|
|
10
12
|
export interface DelegatedTime {
|
|
11
13
|
reportPath: string;
|
|
14
|
+
/** Worker checkout root used to validate cross-worktree reports. */
|
|
15
|
+
reportRoot?: string;
|
|
12
16
|
elapsedMs: number | null;
|
|
13
17
|
workerSessionId?: string;
|
|
14
18
|
}
|
|
19
|
+
export interface TaskGoal {
|
|
20
|
+
goal: string;
|
|
21
|
+
criteria: string[];
|
|
22
|
+
revision: number;
|
|
23
|
+
/** Legacy stored human confirmation; no longer required or written. */
|
|
24
|
+
confirmation?: {
|
|
25
|
+
revision: number;
|
|
26
|
+
questionId: string;
|
|
27
|
+
answeredAt: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Legacy stored closeout review evidence; no longer created or required. */
|
|
31
|
+
export interface CloseoutAttempt {
|
|
32
|
+
questionId: string;
|
|
33
|
+
batchTaskIds: string[];
|
|
34
|
+
taskRevision: number;
|
|
35
|
+
taskName: string;
|
|
36
|
+
goal: TaskGoal;
|
|
37
|
+
results: Array<{
|
|
38
|
+
criterion: string;
|
|
39
|
+
result: string;
|
|
40
|
+
evidence: string;
|
|
41
|
+
}>;
|
|
42
|
+
limits: string;
|
|
43
|
+
decision?: {
|
|
44
|
+
approved: boolean;
|
|
45
|
+
answeredAt: string;
|
|
46
|
+
feedback: string;
|
|
47
|
+
};
|
|
48
|
+
workerClose?: "not-run-absent" | "unverified-absent" | "completed";
|
|
49
|
+
workerCloseRequest?: {
|
|
50
|
+
terminalId: string;
|
|
51
|
+
turn: number;
|
|
52
|
+
requestedAt: number;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface WorkerClose {
|
|
56
|
+
request?: {
|
|
57
|
+
terminalId: string;
|
|
58
|
+
turn: number;
|
|
59
|
+
requestedAt: number;
|
|
60
|
+
};
|
|
61
|
+
outcome?: "not-run-absent" | "unverified-absent" | "completed";
|
|
62
|
+
}
|
|
15
63
|
export interface Todo {
|
|
16
64
|
taskId: string;
|
|
17
65
|
workId: string;
|
|
18
66
|
taskName: string;
|
|
67
|
+
/** Monotonic mutation identity for binding human decisions. */
|
|
68
|
+
revision?: number;
|
|
69
|
+
/** User-visible outcome and criteria. */
|
|
70
|
+
goal?: TaskGoal;
|
|
71
|
+
lifecycleDecisions?: Array<{
|
|
72
|
+
action: "cancel" | "reopen";
|
|
73
|
+
questionId: string;
|
|
74
|
+
answeredAt: string;
|
|
75
|
+
reason?: string;
|
|
76
|
+
}>;
|
|
77
|
+
/** Legacy closeout review history; retained for existing records only. */
|
|
78
|
+
closeoutAttempts?: CloseoutAttempt[];
|
|
79
|
+
/** Delegated worker `/close` request and outcome; the task may close without it. */
|
|
80
|
+
workerClose?: WorkerClose;
|
|
81
|
+
/** Name of the worktree assigned to this task, when applicable. */
|
|
82
|
+
worktree?: string;
|
|
83
|
+
/** Hidden coordination metadata: owner declaration, artifact paths, parent IDs, identifiers. Never shown as task text. */
|
|
19
84
|
taskInfo: string;
|
|
85
|
+
/** The only visible task text. Concise status update, not a goal or narrative. */
|
|
86
|
+
finalThoughts?: string;
|
|
20
87
|
status: TodoStatus;
|
|
21
88
|
/** Current obstacle and resume condition; cleared when leaving blocked. */
|
|
22
89
|
blockedReason?: string | null;
|
|
90
|
+
/** The only two valid blocked dependencies; absent on nonblocked and legacy tasks. */
|
|
91
|
+
dependentOn?: TaskDependency;
|
|
92
|
+
/** When the current blocked state began; absent on legacy records, so age stays unknown. */
|
|
93
|
+
blockedAt?: number;
|
|
94
|
+
/** Linked browser decision for a user-decision blocker; shared questions are reconciled together. */
|
|
95
|
+
decisionQuestionId?: string;
|
|
23
96
|
completionPercent?: number | null;
|
|
24
97
|
/** Accumulated measured time; missing/null means historical time is unknown. */
|
|
25
98
|
elapsedMs?: number | null;
|
|
26
99
|
delegatedTimes?: DelegatedTime[];
|
|
27
|
-
/** Current interval start
|
|
100
|
+
/** Current interval start in the shared snapshot; cleared on process resume. */
|
|
28
101
|
workingSince?: number;
|
|
29
102
|
createdAt: number;
|
|
30
103
|
updatedAt: number;
|
|
@@ -58,7 +131,7 @@ export type TaskEvent = {
|
|
|
58
131
|
type: "todo-updated";
|
|
59
132
|
at: number;
|
|
60
133
|
taskId: string;
|
|
61
|
-
patch: Partial<Pick<Todo, "taskName" | "taskInfo" | "status" | "blockedReason" | "completionPercent">>;
|
|
134
|
+
patch: Partial<Pick<Todo, "taskName" | "taskInfo" | "finalThoughts" | "status" | "blockedReason" | "dependentOn" | "completionPercent">>;
|
|
62
135
|
} | {
|
|
63
136
|
version: 1;
|
|
64
137
|
type: "todo-time";
|
package/dist/ui/panel.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { stripVTControlCharacters } from "node:util";
|
|
2
2
|
import { copyToClipboard } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { sliceByColumn, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
4
|
-
import { delegateLink,
|
|
4
|
+
import { delegateLink, focusTerminal } from "../agents/links.js";
|
|
5
|
+
import { blockedDependencyCounts, blockedRowLabel, compactBlockedSummary } from "../blocked.js";
|
|
5
6
|
import { formatWorksMarkdown } from "../markdown.js";
|
|
6
7
|
import { openRepository, openSession } from "../open-repository.js";
|
|
7
8
|
import { taskOwner } from "../ownership.js";
|
|
8
9
|
import { formatCompletion, taskCompletion, workCompletion } from "../progress.js";
|
|
9
10
|
import { safeSingleLine } from "../text.js";
|
|
10
11
|
import { formatTime, taskTime, workTime } from "../time.js";
|
|
12
|
+
import { readTaskView } from "./task-view.js";
|
|
11
13
|
const EMPTY_COMPONENT = { render: () => [], invalidate: () => { } };
|
|
12
14
|
const PROGRESS_VALUE_WIDTH = 4;
|
|
13
15
|
const TIME_VALUE_WIDTH = 8;
|
|
@@ -23,7 +25,7 @@ export class TasksPanelHost {
|
|
|
23
25
|
panel;
|
|
24
26
|
handle;
|
|
25
27
|
ui;
|
|
26
|
-
mode = "
|
|
28
|
+
mode = "off";
|
|
27
29
|
minimized = false;
|
|
28
30
|
cwd = "";
|
|
29
31
|
sessionId = "Session unavailable";
|
|
@@ -155,12 +157,18 @@ class TasksPanel {
|
|
|
155
157
|
this.setVisible(width >= 48);
|
|
156
158
|
if (width < 48)
|
|
157
159
|
return [];
|
|
158
|
-
const works = this.state
|
|
160
|
+
const { works, error } = readTaskView(this.state);
|
|
161
|
+
const visible = (todos) => todos.filter((todo) => todo.status !== "closed" && todo.status !== "cancelled");
|
|
162
|
+
const todos = visible(works.flatMap((work) => work.tasks));
|
|
159
163
|
const boxWidth = this.placement === "floating" ? width : Math.min(54, Math.max(48, Math.floor(width * 0.44)));
|
|
160
164
|
const innerWidth = boxWidth - 2;
|
|
161
165
|
const leftPad = this.placement === "widget" ? " ".repeat(Math.max(0, width - boxWidth)) : "";
|
|
166
|
+
if (error) {
|
|
167
|
+
this.copyHitRegion = this.sessionHitRegion = this.openHitRegion = this.toggleHitRegion = undefined;
|
|
168
|
+
return [border(innerWidth, "top", this.theme), frame(this.theme.fg("error", "Tasks unavailable"), innerWidth, this.theme), frame(truncateToWidth(error, innerWidth, "…"), innerWidth, this.theme), border(innerWidth, "bottom", this.theme)].map((line) => `${leftPad}${line}`);
|
|
169
|
+
}
|
|
162
170
|
if (this.minimized) {
|
|
163
|
-
const header = this.renderHeader(innerWidth, leftPad.length);
|
|
171
|
+
const header = this.renderHeader(innerWidth, leftPad.length, todos);
|
|
164
172
|
return [
|
|
165
173
|
gitBorder(innerWidth, this.theme, this.git.getSnapshot()),
|
|
166
174
|
frame(header, innerWidth, this.theme),
|
|
@@ -173,13 +181,15 @@ class TasksPanel {
|
|
|
173
181
|
if (works.length === 0)
|
|
174
182
|
content.push(metricsColumn(this.theme.fg("muted", "No works yet."), null, null, false, innerWidth, this.theme));
|
|
175
183
|
for (const work of works) {
|
|
176
|
-
const
|
|
177
|
-
const
|
|
184
|
+
const shown = visible(work.tasks);
|
|
185
|
+
const completed = shown.filter((todo) => todo.status === "completed").length;
|
|
186
|
+
const summary = workSummaryLine(work.workName, `${completed}/${shown.length}`, contentWidth, this.theme, work.workId);
|
|
178
187
|
content.push(metricsColumn(summary, workCompletion(work), workTime(work), work.tasks.some((todo) => todo.workingSince !== undefined), innerWidth, this.theme));
|
|
179
|
-
for (const todo of
|
|
188
|
+
for (const todo of shown) {
|
|
180
189
|
const agent = delegateLink(todo.taskInfo);
|
|
181
190
|
const lead = ` ${todoIcon(todo.status, this.theme)} ${recordId(todo.taskId, this.theme)} `;
|
|
182
|
-
const
|
|
191
|
+
const blocked = blockedRowLabel(todo);
|
|
192
|
+
const label = `${lead}${ownerBadge(todo.taskInfo, this.theme, Boolean(agent))} ${this.theme.fg(todo.status === "completed" ? "muted" : "text", safeSingleLine(todo.taskName))}${blocked === undefined ? "" : ` ${this.theme.fg("warning", `· ${blocked}`)}`}`;
|
|
183
193
|
delegateRows.set(content.length, { agent, start: visibleWidth(lead) });
|
|
184
194
|
content.push(metricsColumn(label, taskCompletion(todo), taskTime(todo), todo.workingSince !== undefined, innerWidth, this.theme));
|
|
185
195
|
}
|
|
@@ -211,7 +221,7 @@ class TasksPanel {
|
|
|
211
221
|
const suffix = this.placement === "floating" && hasOverflow
|
|
212
222
|
? this.tui.mode === "fullscreen" ? ` · ${range}` : ` · ${range} · latest · /works for all`
|
|
213
223
|
: "";
|
|
214
|
-
const header = this.renderHeader(innerWidth, leftPad.length, suffix);
|
|
224
|
+
const header = this.renderHeader(innerWidth, leftPad.length, todos, suffix);
|
|
215
225
|
const lines = [
|
|
216
226
|
gitBorder(innerWidth, this.theme, this.git.getSnapshot()),
|
|
217
227
|
frame(header, innerWidth, this.theme),
|
|
@@ -277,7 +287,8 @@ class TasksPanel {
|
|
|
277
287
|
if (visible) {
|
|
278
288
|
this.unsubscribeGit ??= this.git.subscribe(() => this.tui.requestRender());
|
|
279
289
|
this.refreshTimer ??= setInterval(() => {
|
|
280
|
-
|
|
290
|
+
const view = readTaskView(this.state);
|
|
291
|
+
if (view.error || (!this.minimized && view.works.some((work) => work.tasks.some((todo) => todo.workingSince !== undefined))))
|
|
281
292
|
this.tui.requestRender();
|
|
282
293
|
}, 1_000);
|
|
283
294
|
this.refreshTimer.unref?.();
|
|
@@ -296,13 +307,21 @@ class TasksPanel {
|
|
|
296
307
|
this.onMinimizedChange(minimized);
|
|
297
308
|
this.tui.requestRender();
|
|
298
309
|
}
|
|
299
|
-
renderHeader(width, leftPadWidth, suffix = "") {
|
|
300
|
-
const counts = { active: 0, blocked: 0, completed: 0, cancelled: 0 };
|
|
301
|
-
for (const todo of
|
|
310
|
+
renderHeader(width, leftPadWidth, todos, suffix = "") {
|
|
311
|
+
const counts = { active: 0, blocked: 0, completed: 0, closed: 0, cancelled: 0 };
|
|
312
|
+
for (const todo of todos)
|
|
302
313
|
counts[todo.status]++;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
314
|
+
// One aggregate blocked count made 2 user blockers + 1 agent wait read as
|
|
315
|
+
// "3 blocked on me". Keep the classes visible wherever the header fits.
|
|
316
|
+
const parts = [];
|
|
317
|
+
const blockedSummary = compactBlockedSummary(blockedDependencyCounts(todos));
|
|
318
|
+
if (blockedSummary)
|
|
319
|
+
parts.push(blockedSummary);
|
|
320
|
+
for (const status of ["active", "completed", "cancelled"]) {
|
|
321
|
+
if (counts[status] > 0)
|
|
322
|
+
parts.push(`${counts[status]}${todoIcon(status, this.theme)}`);
|
|
323
|
+
}
|
|
324
|
+
const summary = parts.join(" ");
|
|
306
325
|
const copyAction = this.copying
|
|
307
326
|
? this.theme.fg("dim", "[Copying…]")
|
|
308
327
|
: this.theme.fg("accent", this.theme.bold("[Copy]"));
|
|
@@ -334,7 +353,7 @@ class TasksPanel {
|
|
|
334
353
|
return;
|
|
335
354
|
this.openingDelegate = true;
|
|
336
355
|
try {
|
|
337
|
-
await
|
|
356
|
+
await focusTerminal(link.terminalId, this.cwd);
|
|
338
357
|
}
|
|
339
358
|
catch (error) {
|
|
340
359
|
const reason = error instanceof Error ? safeSingleLine(error.message) : "Unknown error.";
|
|
@@ -375,8 +394,8 @@ class TasksPanel {
|
|
|
375
394
|
return;
|
|
376
395
|
this.copying = true;
|
|
377
396
|
this.tui.requestRender();
|
|
378
|
-
const works = this.state.listWorks();
|
|
379
397
|
try {
|
|
398
|
+
const works = this.state.listWorks();
|
|
380
399
|
await copyToClipboard(formatWorksMarkdown(works));
|
|
381
400
|
const todoCount = works.reduce((total, work) => total + work.tasks.length, 0);
|
|
382
401
|
this.notify(`Copied ${works.length} work${works.length === 1 ? "" : "s"} and ${todoCount} todo${todoCount === 1 ? "" : "s"} as Markdown.`, "info");
|
|
@@ -453,7 +472,7 @@ function workSummaryLine(name, count, width, theme, workId) {
|
|
|
453
472
|
return `${shownLeft}${gap}${right}`;
|
|
454
473
|
}
|
|
455
474
|
export function todoIcon(status, theme) {
|
|
456
|
-
if (status === "completed")
|
|
475
|
+
if (status === "completed" || status === "closed")
|
|
457
476
|
return theme.fg("success", "✓");
|
|
458
477
|
if (status === "active")
|
|
459
478
|
return theme.fg("accent", "▶");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TaskState } from "../state.js";
|
|
2
|
+
import type { WorkWithTodos } from "../types.js";
|
|
3
|
+
/** Disk failures belong in the view, never in the terminal render/timer exception path. */
|
|
4
|
+
export declare function readTaskView(state: TaskState): {
|
|
5
|
+
works: WorkWithTodos[];
|
|
6
|
+
error?: string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { safeSingleLine } from "../text.js";
|
|
2
|
+
/** Disk failures belong in the view, never in the terminal render/timer exception path. */
|
|
3
|
+
export function readTaskView(state) {
|
|
4
|
+
try {
|
|
5
|
+
return { works: state.listWorks() };
|
|
6
|
+
}
|
|
7
|
+
catch (error) {
|
|
8
|
+
return { works: [], error: safeSingleLine(error instanceof Error ? error.message : "Task storage is unavailable.") };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { copyToClipboard } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "@earendil-works/pi-tui";
|
|
3
|
-
import { delegateLink,
|
|
3
|
+
import { delegateLink, focusTerminal } from "../agents/links.js";
|
|
4
|
+
import { blockedDependencyCounts, blockedRowLabel, compactBlockedSummary } from "../blocked.js";
|
|
5
|
+
import { dependentOnLabel } from "../dependency.js";
|
|
4
6
|
import { formatWorksMarkdown } from "../markdown.js";
|
|
5
7
|
import { openRepository } from "../open-repository.js";
|
|
6
8
|
import { formatCompletion, taskCompletion, workCompletion } from "../progress.js";
|
|
7
9
|
import { safeMultiline, safeSingleLine } from "../text.js";
|
|
10
|
+
import { finalThoughtsFor } from "../thoughts.js";
|
|
8
11
|
import { formatTime, taskTime, workTime } from "../time.js";
|
|
9
12
|
import { border, delegateHitRegion, frame, gitBorder, metricsColumn, metricsHeader, ownerBadge, recordId, rule, todoIcon } from "./panel.js";
|
|
13
|
+
import { readTaskView } from "./task-view.js";
|
|
10
14
|
const CHROME_LINES = 9;
|
|
11
15
|
export class WorksDashboard {
|
|
12
16
|
tui;
|
|
@@ -65,7 +69,9 @@ export class WorksDashboard {
|
|
|
65
69
|
this.toggleHitRegion = undefined;
|
|
66
70
|
const dialogWidth = Math.max(1, width);
|
|
67
71
|
const innerWidth = Math.max(1, dialogWidth - 2);
|
|
68
|
-
const works = this.state
|
|
72
|
+
const { works, error } = readTaskView(this.state);
|
|
73
|
+
if (error)
|
|
74
|
+
return [border(innerWidth, "top", this.theme), frame(this.theme.fg("error", "Tasks unavailable · Escape closes"), innerWidth, this.theme), frame(truncateToWidth(error, innerWidth, "…"), innerWidth, this.theme), border(innerWidth, "bottom", this.theme)];
|
|
69
75
|
const todos = works.flatMap((work) => work.tasks);
|
|
70
76
|
const items = this.items(works);
|
|
71
77
|
this.syncSelection(items);
|
|
@@ -85,8 +91,9 @@ export class WorksDashboard {
|
|
|
85
91
|
const terminalRows = this.tui.terminal.rows || process.stdout.rows || 30;
|
|
86
92
|
const dialogHeight = Math.max(8, Math.min(36, Math.floor(terminalRows * 0.82)));
|
|
87
93
|
const activeTodos = todos.filter((todo) => todo.status === "active").length;
|
|
88
|
-
const completedTodos = todos.filter((todo) => todo.status === "completed").length;
|
|
89
|
-
const
|
|
94
|
+
const completedTodos = todos.filter((todo) => todo.status === "completed" || todo.status === "closed").length;
|
|
95
|
+
const blocked = compactBlockedSummary(blockedDependencyCounts(todos));
|
|
96
|
+
const summary = `${works.length} works · ${activeTodos} todos active${blocked ? ` · ${blocked}` : ""} · ${completedTodos}/${todos.length} completed · session scoped`;
|
|
90
97
|
const listHeight = Math.max(0, dialogHeight - CHROME_LINES);
|
|
91
98
|
if (listHeight > 0)
|
|
92
99
|
this.keepSelectionVisible(items, listHeight);
|
|
@@ -157,7 +164,7 @@ export class WorksDashboard {
|
|
|
157
164
|
if (link)
|
|
158
165
|
void this.openLinkedDelegate(link);
|
|
159
166
|
else {
|
|
160
|
-
this.message = "Select a delegated task with a
|
|
167
|
+
this.message = "Select a delegated task with a Core terminal link. Navigation requires the Herdr app.";
|
|
161
168
|
this.messageColor = "warning";
|
|
162
169
|
this.tui.requestRender();
|
|
163
170
|
}
|
|
@@ -240,7 +247,7 @@ export class WorksDashboard {
|
|
|
240
247
|
this.unsubscribeGit();
|
|
241
248
|
clearInterval(this.refreshTimer);
|
|
242
249
|
}
|
|
243
|
-
items(works = this.state.
|
|
250
|
+
items(works = readTaskView(this.state).works) {
|
|
244
251
|
const items = [];
|
|
245
252
|
for (const work of works) {
|
|
246
253
|
items.push({ key: `work:${work.workId}`, kind: "work", work });
|
|
@@ -276,12 +283,12 @@ export class WorksDashboard {
|
|
|
276
283
|
const selected = item.key === this.selectedKey;
|
|
277
284
|
const prefix = selected ? this.theme.fg("accent", "▶ ") : " ";
|
|
278
285
|
if (item.kind === "work") {
|
|
279
|
-
const done = item.work.tasks.filter((todo) => todo.status === "completed").length;
|
|
286
|
+
const done = item.work.tasks.filter((todo) => todo.status === "completed" || todo.status === "closed").length;
|
|
280
287
|
const metadata = this.theme.fg("dim", `${done}/${item.work.tasks.length} completed`);
|
|
281
288
|
const label = `${prefix}${this.theme.bold(`${recordId(item.work.workId, this.theme)} ${safeSingleLine(item.work.workName)}`)} ${metadata}`;
|
|
282
289
|
return metricsColumn(label, workCompletion(item.work), workTime(item.work), item.work.tasks.some((todo) => todo.workingSince !== undefined), width, this.theme);
|
|
283
290
|
}
|
|
284
|
-
const metadata = this.theme.fg("dim", item.todo.status);
|
|
291
|
+
const metadata = this.theme.fg(item.todo.status === "blocked" ? "warning" : "dim", blockedRowLabel(item.todo) ?? item.todo.status);
|
|
285
292
|
const label = `${prefix} ${todoIcon(item.todo.status, this.theme)} ${recordId(item.todo.taskId, this.theme)} ${ownerBadge(item.todo.taskInfo, this.theme, Boolean(delegateLink(item.todo.taskInfo)))} ${safeSingleLine(item.todo.taskName)} ${metadata}`;
|
|
286
293
|
const line = metricsColumn(label, taskCompletion(item.todo), taskTime(item.todo), item.todo.workingSince !== undefined, width, this.theme);
|
|
287
294
|
const start = visibleWidth(`${prefix} ${todoIcon(item.todo.status, this.theme)} ${recordId(item.todo.taskId, this.theme)} `);
|
|
@@ -329,21 +336,32 @@ export class WorksDashboard {
|
|
|
329
336
|
const lines = ["", ...wrap(this.theme.bold(safeSingleLine(name))), ""];
|
|
330
337
|
if (task) {
|
|
331
338
|
lines.push(...wrap(this.theme.fg("muted", `${recordId(item.work.workId, this.theme)} ${safeSingleLine(item.work.workName)}`)), "");
|
|
332
|
-
const
|
|
339
|
+
const blocked = blockedRowLabel(task);
|
|
340
|
+
const status = `${todoIcon(task.status, this.theme)} ${task.status}${blocked ? ` · ${blocked}` : ""}`;
|
|
333
341
|
lines.push(...wrap(`${status} · ${formatCompletion(taskCompletion(task))} complete · Time: ${formatTime(taskTime(task))}`), "");
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
lines.push(...wrap(`${formatCompletion(workCompletion(item.work))} complete · Time (task effort): ${formatTime(workTime(item.work))}`), "");
|
|
345
|
+
}
|
|
346
|
+
if (task) {
|
|
347
|
+
if (task.goal) {
|
|
348
|
+
lines.push(this.theme.fg("accent", this.theme.bold("Goal")));
|
|
349
|
+
lines.push(...safeMultiline(task.goal.goal).flatMap(wrap));
|
|
350
|
+
lines.push(this.theme.fg("accent", this.theme.bold("Acceptance criteria")));
|
|
351
|
+
for (const criterion of task.goal.criteria)
|
|
352
|
+
lines.push(...safeMultiline(`• ${criterion}`).flatMap(wrap));
|
|
339
353
|
lines.push("");
|
|
340
354
|
}
|
|
355
|
+
const dependency = dependentOnLabel(task.dependentOn);
|
|
356
|
+
lines.push(this.theme.fg("accent", this.theme.bold(dependency === undefined ? "Final thoughts" : `Final thoughts · Dependent on: ${dependency}`)));
|
|
357
|
+
const thoughts = finalThoughtsFor(task) ?? "No final thoughts recorded.";
|
|
358
|
+
const color = task.status === "blocked" ? "warning" : "muted";
|
|
359
|
+
lines.push(...safeMultiline(thoughts).flatMap(wrap).map((line) => this.theme.fg(color, line)));
|
|
341
360
|
}
|
|
342
361
|
else {
|
|
343
|
-
lines.push(
|
|
362
|
+
lines.push(this.theme.fg("accent", this.theme.bold("Work details")));
|
|
363
|
+
lines.push(...safeMultiline(item.work.workInfo).flatMap(wrap));
|
|
344
364
|
}
|
|
345
|
-
lines.push(this.theme.fg("accent", this.theme.bold(task ? "Task details" : "Work details")));
|
|
346
|
-
lines.push(...safeMultiline(task?.taskInfo ?? item.work.workInfo).flatMap(wrap));
|
|
347
365
|
this.detailPageSize = budget;
|
|
348
366
|
this.detailOffset = Math.max(0, Math.min(this.detailOffset, Math.max(0, lines.length - budget)));
|
|
349
367
|
const shown = lines.slice(this.detailOffset, this.detailOffset + budget);
|
|
@@ -403,7 +421,7 @@ export class WorksDashboard {
|
|
|
403
421
|
this.messageColor = "warning";
|
|
404
422
|
this.tui.requestRender();
|
|
405
423
|
try {
|
|
406
|
-
await
|
|
424
|
+
await focusTerminal(link.terminalId, this.cwd);
|
|
407
425
|
this.message = "Opened delegated agent in Herdr.";
|
|
408
426
|
this.messageColor = "success";
|
|
409
427
|
}
|
|
@@ -452,8 +470,8 @@ export class WorksDashboard {
|
|
|
452
470
|
this.message = "Copying all works and todos as Markdown…";
|
|
453
471
|
this.messageColor = "warning";
|
|
454
472
|
this.tui.requestRender();
|
|
455
|
-
const works = this.state.listWorks();
|
|
456
473
|
try {
|
|
474
|
+
const works = this.state.listWorks();
|
|
457
475
|
await copyToClipboard(formatWorksMarkdown(works));
|
|
458
476
|
const todoCount = works.reduce((total, work) => total + work.tasks.length, 0);
|
|
459
477
|
this.message = `Copied ${works.length} work${works.length === 1 ? "" : "s"} and ${todoCount} todo${todoCount === 1 ? "" : "s"} as Markdown.`;
|