@pi-orca/tasks 0.0.2-dev.20260422214056 → 0.0.2-dev.20260517151352
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 +18 -13
- package/dist/commands.js +8 -8
- package/dist/commands.js.map +1 -1
- package/dist/engine/crud.d.ts.map +1 -1
- package/dist/engine/crud.js +11 -0
- package/dist/engine/crud.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +170 -59
- package/dist/index.js.map +1 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +252 -55
- package/dist/overlay.js.map +1 -1
- package/dist/tool-render.d.ts +1 -1
- package/dist/tool-render.d.ts.map +1 -1
- package/dist/tool-render.js +50 -4
- package/dist/tool-render.js.map +1 -1
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +178 -62
- package/dist/tool.js.map +1 -1
- package/dist/widget.d.ts.map +1 -1
- package/dist/widget.js +183 -49
- package/dist/widget.js.map +1 -1
- package/package.json +2 -2
- package/dist/commands.d.ts +0 -29
- package/dist/engine/crud.d.ts +0 -81
- package/dist/engine/dag.d.ts +0 -30
- package/dist/engine/index.d.ts +0 -8
- package/dist/engine/index.js +0 -8
- package/dist/engine/index.js.map +0 -1
- package/dist/engine/notes.d.ts +0 -26
- package/dist/engine/notes.js +0 -45
- package/dist/engine/notes.js.map +0 -1
- package/dist/engine/state-machine.d.ts +0 -57
- package/dist/index.d.ts +0 -13
- package/dist/overlay.d.ts +0 -9
- package/dist/tool.d.ts +0 -19
- package/dist/widget.d.ts +0 -24
package/dist/widget.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Task widget renderer — less/more HUD modes.
|
|
3
3
|
* Spec: §3.11 — Widget
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Uses component factory overload of setWidget() so the TUI re-renders
|
|
6
|
+
* on terminal resize, passing the current viewport width to render().
|
|
6
7
|
*/
|
|
7
8
|
import { listTasks } from "./engine/crud.js";
|
|
8
9
|
const STATUS_ICONS = {
|
|
@@ -23,80 +24,213 @@ function getStatusCounts(tasks) {
|
|
|
23
24
|
.filter((s) => (counts[s] ?? 0) > 0)
|
|
24
25
|
.map((s) => ({ status: s, count: counts[s] }));
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
function statusPartFull(c) {
|
|
28
|
+
return `${STATUS_ICONS[c.status] ?? "?"} ${c.count} ${c.status.replace("_", "-")}`;
|
|
29
|
+
}
|
|
30
|
+
function statusPartCompact(c) {
|
|
31
|
+
return `${STATUS_ICONS[c.status] ?? "?"} ${c.count}`;
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
34
|
+
* Build a status string that fits within `maxWidth` chars (including prefix + separator).
|
|
35
|
+
*
|
|
36
|
+
* Compression strategy (right → left):
|
|
37
|
+
* 1. All entries in full format (e.g. "✓ 1 completed")
|
|
38
|
+
* 2. Compress rightmost entries to icon+count only (e.g. "✓ 1")
|
|
39
|
+
* 3. Drop rightmost entries entirely
|
|
40
|
+
*
|
|
41
|
+
* Returns `""` when no stats fit.
|
|
35
42
|
*/
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
43
|
+
function fitStatusCounts(counts, prefix, maxWidth) {
|
|
44
|
+
const separator = " | ";
|
|
45
|
+
const baseLen = prefix.length + separator.length;
|
|
46
|
+
if (baseLen >= maxWidth)
|
|
47
|
+
return "";
|
|
48
|
+
// Phase 1: all full
|
|
49
|
+
const parts = counts.map((c) => statusPartFull(c));
|
|
50
|
+
function totalLen() {
|
|
51
|
+
return baseLen + parts.join(" ").length;
|
|
52
|
+
}
|
|
53
|
+
if (totalLen() <= maxWidth)
|
|
54
|
+
return parts.join(" ");
|
|
55
|
+
// Phase 2: compress rightmost entries to icon+count, one at a time
|
|
56
|
+
for (let i = counts.length - 1; i >= 0; i--) {
|
|
57
|
+
const compact = statusPartCompact(counts[i]);
|
|
58
|
+
if (compact.length >= parts[i].length)
|
|
59
|
+
continue;
|
|
60
|
+
parts[i] = compact;
|
|
61
|
+
if (totalLen() <= maxWidth)
|
|
62
|
+
return parts.join(" ");
|
|
63
|
+
}
|
|
64
|
+
// Phase 3: drop entries from the right
|
|
65
|
+
while (parts.length > 0) {
|
|
66
|
+
parts.pop();
|
|
67
|
+
if (parts.length === 0)
|
|
68
|
+
return "";
|
|
69
|
+
if (totalLen() <= maxWidth)
|
|
70
|
+
return parts.join(" ");
|
|
71
|
+
}
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Right-align `hint` on the same line as `content`, with at least `minGap`
|
|
76
|
+
* spaces between. Output is **hard-clamped** to exactly `width` characters
|
|
77
|
+
* — it will never exceed the terminal width under any circumstance.
|
|
78
|
+
*/
|
|
79
|
+
function rightAlign(content, hint, width, minGap) {
|
|
80
|
+
// Extreme case: width is smaller than the hint itself
|
|
81
|
+
if (width <= hint.length)
|
|
82
|
+
return hint.slice(0, width);
|
|
83
|
+
const minHintSpace = hint.length + minGap;
|
|
84
|
+
const maxContentLen = width - minHintSpace;
|
|
85
|
+
// Truncate content if it would push us past width
|
|
86
|
+
if (content.length > maxContentLen) {
|
|
87
|
+
content = content.slice(0, Math.max(0, maxContentLen - 1)) + "…";
|
|
88
|
+
}
|
|
89
|
+
const gap = width - content.length - hint.length;
|
|
90
|
+
return content + " ".repeat(Math.max(0, gap)) + hint;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Render the compact 1-line HUD for a given width.
|
|
94
|
+
* Hint appears right-aligned on this single line.
|
|
95
|
+
* Status counts are trimmed from the end until the line fits.
|
|
96
|
+
*/
|
|
97
|
+
export function renderLessLines(tasks, width) {
|
|
39
98
|
const completed = tasks.filter((t) => t.status === "completed").length;
|
|
40
99
|
const total = tasks.length;
|
|
41
100
|
const counts = getStatusCounts(tasks);
|
|
101
|
+
const hint = "/tasks more";
|
|
42
102
|
if (total === 0) {
|
|
43
|
-
|
|
44
|
-
const hint = "/task more";
|
|
45
|
-
return [`${left}${" ".repeat(Math.max(2, 80 - left.length - hint.length))}${hint}`];
|
|
103
|
+
return [rightAlign("📋 Tasks 0/0 done", hint, width, 2)];
|
|
46
104
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
105
|
+
const prefix = `📋 Tasks ${completed}/${total} done`;
|
|
106
|
+
// Reserve space for the hint and minimum gap
|
|
107
|
+
const maxContentWidth = width - hint.length - 2;
|
|
108
|
+
const statsStr = fitStatusCounts(counts, prefix, maxContentWidth);
|
|
109
|
+
const left = statsStr ? `${prefix} | ${statsStr}` : prefix;
|
|
110
|
+
return [rightAlign(left, hint, width, 2)];
|
|
51
111
|
}
|
|
52
112
|
/**
|
|
53
|
-
* Render the expanded multi-column task list
|
|
54
|
-
*
|
|
55
|
-
* Task rows exclude abandoned tasks.
|
|
56
|
-
* Returns string[] (one element per line) for setWidget().
|
|
113
|
+
* Render the expanded multi-column task list for a given width.
|
|
114
|
+
* Hint appears right-aligned on the header (first) line.
|
|
57
115
|
*/
|
|
58
|
-
export
|
|
59
|
-
const taskFiles = await listTasks({ projectSlug });
|
|
60
|
-
const tasks = taskFiles.map((t) => t.task);
|
|
116
|
+
export function renderMoreLines(tasks, width) {
|
|
61
117
|
const completed = tasks.filter((t) => t.status === "completed").length;
|
|
62
118
|
const total = tasks.length;
|
|
63
119
|
const counts = getStatusCounts(tasks);
|
|
64
|
-
const
|
|
65
|
-
const
|
|
120
|
+
const hint = "/tasks less";
|
|
121
|
+
const prefix = `📋 Tasks ${completed}/${total} done`;
|
|
122
|
+
const maxContentWidth = width - hint.length - 2;
|
|
123
|
+
const statsStr = fitStatusCounts(counts, prefix, maxContentWidth);
|
|
124
|
+
const headerLeft = statsStr ? `${prefix} | ${statsStr}` : prefix;
|
|
125
|
+
const header = rightAlign(headerLeft, hint, width, 2);
|
|
66
126
|
// Exclude abandoned from task rows
|
|
67
127
|
const displayTasks = tasks.filter((t) => t.status !== "abandoned");
|
|
68
128
|
if (displayTasks.length === 0) {
|
|
69
|
-
|
|
70
|
-
const emptyLine = ` (no active tasks)${" ".repeat(Math.max(2, 80 - 19 - hint.length))}${hint}`;
|
|
71
|
-
return [header, emptyLine];
|
|
129
|
+
return [header, " (no active tasks)"];
|
|
72
130
|
}
|
|
73
|
-
//
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
131
|
+
// ── Column layout ──────────────────────────────────────────────────────
|
|
132
|
+
const minCellWidth = 50;
|
|
133
|
+
const maxRows = 4;
|
|
134
|
+
const rowIndent = 2; // " " prefix on each row
|
|
135
|
+
const cellGap = 2; // " " between cells
|
|
136
|
+
let maxIdWidth = 0;
|
|
137
|
+
for (const t of displayTasks) {
|
|
78
138
|
const icon = STATUS_ICONS[t.status] ?? "?";
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
139
|
+
const prefixWidth = icon.length + 1 + t.id.length + 1;
|
|
140
|
+
if (prefixWidth > maxIdWidth)
|
|
141
|
+
maxIdWidth = prefixWidth;
|
|
142
|
+
}
|
|
143
|
+
const cellWidth = Math.max(minCellWidth, maxIdWidth);
|
|
144
|
+
// Cap cellWidth so a single cell + indent still fits
|
|
145
|
+
const maxCellWidth = width - rowIndent;
|
|
146
|
+
const effectiveCellWidth = Math.min(cellWidth, maxCellWidth);
|
|
147
|
+
// Row width = rowIndent + numCols*effectiveCellWidth + (numCols-1)*cellGap
|
|
148
|
+
// Solve: rowIndent + n*effectiveCellWidth + (n-1)*cellGap <= width
|
|
149
|
+
// => n*(effectiveCellWidth + cellGap) <= width - rowIndent + cellGap
|
|
150
|
+
const maxCols = Math.max(1, Math.floor((width - rowIndent + cellGap) / (effectiveCellWidth + cellGap)));
|
|
151
|
+
const numCols = maxCols;
|
|
152
|
+
const numTaskRows = Math.ceil(displayTasks.length / numCols);
|
|
153
|
+
let shownCount = displayTasks.length;
|
|
154
|
+
if (numTaskRows > maxRows) {
|
|
155
|
+
shownCount = numCols * maxRows;
|
|
156
|
+
}
|
|
157
|
+
const cells = displayTasks.slice(0, shownCount).map((t) => {
|
|
158
|
+
const icon = STATUS_ICONS[t.status] ?? "?";
|
|
159
|
+
return `${icon} ${t.id} ${t.title}`;
|
|
83
160
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
161
|
+
const paddedCells = cells.map((c) => c.length < effectiveCellWidth
|
|
162
|
+
? c + " ".repeat(effectiveCellWidth - c.length)
|
|
163
|
+
: c.slice(0, effectiveCellWidth));
|
|
87
164
|
const rows = [];
|
|
88
165
|
for (let i = 0; i < paddedCells.length; i += numCols) {
|
|
89
|
-
|
|
90
|
-
|
|
166
|
+
rows.push(" " + paddedCells.slice(i, i + numCols).join(" "));
|
|
167
|
+
}
|
|
168
|
+
if (displayTasks.length > shownCount) {
|
|
169
|
+
rows.push(" …more — /tasks to see all");
|
|
91
170
|
}
|
|
92
|
-
const hint = "/task less";
|
|
93
|
-
const lastRow = rows[rows.length - 1];
|
|
94
|
-
const padLen = Math.max(2, termWidth - lastRow.length - hint.length);
|
|
95
|
-
rows[rows.length - 1] = lastRow + " ".repeat(padLen) + hint;
|
|
96
171
|
return [header, ...rows];
|
|
97
172
|
}
|
|
173
|
+
// ── Async wrappers (for callers that don't use the component factory) ────
|
|
174
|
+
export async function renderTaskLess(projectSlug) {
|
|
175
|
+
const taskFiles = await listTasks({ projectSlug });
|
|
176
|
+
const tasks = taskFiles.map((t) => t.task);
|
|
177
|
+
return renderLessLines(tasks, process.stdout?.columns ?? 80);
|
|
178
|
+
}
|
|
179
|
+
export async function renderTaskMore(projectSlug) {
|
|
180
|
+
const taskFiles = await listTasks({ projectSlug });
|
|
181
|
+
const tasks = taskFiles.map((t) => t.task);
|
|
182
|
+
return renderMoreLines(tasks, process.stdout?.columns ?? 80);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Create a component factory for the "less" (compact) widget.
|
|
186
|
+
* Pass the result directly to ctx.ui.setWidget().
|
|
187
|
+
*
|
|
188
|
+
* If `preloaded` tasks are provided they're used immediately, avoiding a
|
|
189
|
+
* flash of "0/0 done" on the first render. Otherwise tasks are fetched
|
|
190
|
+
* async and the widget updates on the next paint cycle.
|
|
191
|
+
*/
|
|
192
|
+
export function createTaskWidgetFactory(projectSlug, preloaded) {
|
|
193
|
+
let tasks = preloaded ?? [];
|
|
194
|
+
return (tui) => {
|
|
195
|
+
if (!preloaded) {
|
|
196
|
+
listTasks({ projectSlug }).then((files) => {
|
|
197
|
+
tasks = files.map((f) => f.task);
|
|
198
|
+
tui.requestRender();
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
render(width) {
|
|
203
|
+
return renderLessLines(tasks, width);
|
|
204
|
+
},
|
|
205
|
+
invalidate() { },
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Create a component factory for the "more" (expanded) widget.
|
|
211
|
+
* Pass the result directly to ctx.ui.setWidget().
|
|
212
|
+
*
|
|
213
|
+
* Accepts optional `preloaded` tasks — see createTaskWidgetFactory.
|
|
214
|
+
*/
|
|
215
|
+
export function createTaskMoreWidgetFactory(projectSlug, preloaded) {
|
|
216
|
+
let tasks = preloaded ?? [];
|
|
217
|
+
return (tui) => {
|
|
218
|
+
if (!preloaded) {
|
|
219
|
+
listTasks({ projectSlug }).then((files) => {
|
|
220
|
+
tasks = files.map((f) => f.task);
|
|
221
|
+
tui.requestRender();
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
render(width) {
|
|
226
|
+
return renderMoreLines(tasks, width);
|
|
227
|
+
},
|
|
228
|
+
invalidate() { },
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
}
|
|
98
232
|
/**
|
|
99
|
-
* Legacy API — delegates to renderTaskLess
|
|
233
|
+
* Legacy API — delegates to renderTaskLess.
|
|
100
234
|
*/
|
|
101
235
|
export async function renderTaskWidget(projectSlug) {
|
|
102
236
|
return renderTaskLess(projectSlug);
|
package/dist/widget.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,YAAY,GAA2B;IAC3C,SAAS,EAAE,GAAG;IACd,WAAW,EAAE,GAAG;IAChB,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,GAAG;IACZ,SAAS,EAAE,GAAG;CACf,CAAC;AAEF,MAAM,YAAY,GAAa,CAAC,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAOzG,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,YAAY;SAChB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;SACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,cAA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,gBAAgB,CAAC,WAAoB;IACzD,OAAO,cAAc,CAAC,WAAW,CAAC,CAAC;AACrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-orca/tasks",
|
|
3
|
-
"version": "0.0.2-dev.
|
|
3
|
+
"version": "0.0.2-dev.20260517151352",
|
|
4
4
|
"description": "File-backed task DAG with locking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
"directory": "packages/tasks"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@pi-orca/core": "0.0.2-dev.
|
|
47
|
+
"@pi-orca/core": "0.0.2-dev.20260517151352"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/dist/commands.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slash command implementations for pi-orca-tasks.
|
|
3
|
-
* Spec: §3.10 — Slash Commands
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* /task (no args) — return widget string for display
|
|
7
|
-
*/
|
|
8
|
-
export declare function cmdTaskToggle(projectSlug?: string): Promise<string[]>;
|
|
9
|
-
/**
|
|
10
|
-
* /task list [status] — list tasks
|
|
11
|
-
*/
|
|
12
|
-
export declare function cmdTaskList(statusFilter?: string, projectSlug?: string): Promise<string>;
|
|
13
|
-
/**
|
|
14
|
-
* /task stuck — scan for stuck tasks
|
|
15
|
-
*/
|
|
16
|
-
export declare function cmdTaskStuck(projectSlug?: string): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* /task unlock <id> — force-release a stuck lock
|
|
19
|
-
*/
|
|
20
|
-
export declare function cmdTaskUnlock(taskId: string, projectSlug?: string): Promise<string>;
|
|
21
|
-
/**
|
|
22
|
-
* /task deps <id> — show dependency graph for a task
|
|
23
|
-
*/
|
|
24
|
-
export declare function cmdTaskDeps(taskId: string, projectSlug?: string): Promise<string>;
|
|
25
|
-
/**
|
|
26
|
-
* /task validate [id] — validate task files
|
|
27
|
-
*/
|
|
28
|
-
export declare function cmdTaskValidate(taskId?: string, projectSlug?: string): Promise<string>;
|
|
29
|
-
//# sourceMappingURL=commands.d.ts.map
|
package/dist/engine/crud.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task file CRUD operations.
|
|
3
|
-
* Spec: §3.3 — Task File Schema, §3.4 — Lock File Schema
|
|
4
|
-
*/
|
|
5
|
-
import { Task, TaskStatus, Labels } from "@pi-orca/core";
|
|
6
|
-
export interface CreateTaskParams {
|
|
7
|
-
title: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
dependencies?: string[];
|
|
10
|
-
labels?: Labels;
|
|
11
|
-
projectSlug?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface UpdateTaskParams {
|
|
14
|
-
title?: string;
|
|
15
|
-
dependencies?: string[];
|
|
16
|
-
labels?: Labels;
|
|
17
|
-
projectSlug?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface ListTasksFilter {
|
|
20
|
-
status?: TaskStatus | TaskStatus[];
|
|
21
|
-
labels?: Labels;
|
|
22
|
-
includeArchived?: boolean;
|
|
23
|
-
projectSlug?: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Task file with its path on disk.
|
|
27
|
-
*/
|
|
28
|
-
export interface TaskFile {
|
|
29
|
-
task: Task;
|
|
30
|
-
filePath: string;
|
|
31
|
-
body: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Generate the next sequential task ID.
|
|
35
|
-
*/
|
|
36
|
-
export declare function generateTaskId(tasksDir: string): Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Get full path to a task file.
|
|
39
|
-
*/
|
|
40
|
-
export declare function getTaskFilePath(taskId: string, projectSlug?: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Get full path to a task lock file.
|
|
43
|
-
*/
|
|
44
|
-
export declare function getTaskLockPath(taskId: string, projectSlug?: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* Create a new task file.
|
|
47
|
-
* Spec: §2.1.1
|
|
48
|
-
*/
|
|
49
|
-
export declare function createTask(params: CreateTaskParams): Promise<TaskFile>;
|
|
50
|
-
/**
|
|
51
|
-
* Read a task file from disk.
|
|
52
|
-
* Spec: §2.1.2
|
|
53
|
-
*/
|
|
54
|
-
export declare function readTask(taskId: string, projectSlug?: string): Promise<TaskFile | null>;
|
|
55
|
-
/**
|
|
56
|
-
* Write a task file to disk (replaces content).
|
|
57
|
-
*/
|
|
58
|
-
export declare function writeTask(taskFile: TaskFile): Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Update task frontmatter fields.
|
|
61
|
-
* Spec: §2.1.3
|
|
62
|
-
*/
|
|
63
|
-
export declare function updateTask(taskId: string, patch: Partial<Task>, projectSlug?: string): Promise<TaskFile | null>;
|
|
64
|
-
/**
|
|
65
|
-
* List tasks with optional filters.
|
|
66
|
-
* Spec: §2.1.4
|
|
67
|
-
*/
|
|
68
|
-
export declare function listTasks(filter?: ListTasksFilter): Promise<TaskFile[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Build dependency map from all task files.
|
|
71
|
-
* Returns { dependencies: task→deps[], dependents: task→dependents[] }
|
|
72
|
-
*/
|
|
73
|
-
export declare function buildDependencyMaps(projectSlug?: string): Promise<{
|
|
74
|
-
dependencies: Map<string, string[]>;
|
|
75
|
-
dependents: Map<string, string[]>;
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* Update reverse dependency (dependents) links when a task's dependencies change.
|
|
79
|
-
*/
|
|
80
|
-
export declare function syncDependentLinks(taskId: string, oldDeps: string[], newDeps: string[], projectSlug?: string): Promise<void>;
|
|
81
|
-
//# sourceMappingURL=crud.d.ts.map
|
package/dist/engine/dag.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DAG validation and cascading for tasks.
|
|
3
|
-
* Spec: §3.5 — Dependency Validation
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Validate that adding a dependency does not create a cycle.
|
|
7
|
-
* Returns cycle path string if cycle found, null if safe.
|
|
8
|
-
* Spec: §3.5 — Cycle Detection
|
|
9
|
-
*/
|
|
10
|
-
export declare function validateNoCycle(taskId: string, newDependency: string, projectSlug?: string): Promise<string | null>;
|
|
11
|
-
/**
|
|
12
|
-
* Validate all new dependencies for a task do not create cycles.
|
|
13
|
-
* Returns error message if any cycle found, null if all safe.
|
|
14
|
-
*/
|
|
15
|
-
export declare function validateDependencies(taskId: string, newDependencies: string[], projectSlug?: string): Promise<string | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Cascade failure to all transitive dependents.
|
|
18
|
-
* When a task fails, all tasks that depend on it (directly or transitively)
|
|
19
|
-
* are blocked with blockedReason pointing to the root failed task.
|
|
20
|
-
* Spec: §3.5 — Failure Cascading
|
|
21
|
-
*/
|
|
22
|
-
export declare function cascadeFailure(failedTaskId: string, projectSlug?: string): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Re-evaluate and unblock dependents after a task's failure is resolved.
|
|
25
|
-
* When a failed task is retried and completes, all dependents whose
|
|
26
|
-
* blockedReason traced back to this task are re-evaluated.
|
|
27
|
-
* Spec: §3.5 — Unblock Cascading
|
|
28
|
-
*/
|
|
29
|
-
export declare function cascadeUnblock(resolvedTaskId: string, projectSlug?: string): Promise<void>;
|
|
30
|
-
//# sourceMappingURL=dag.d.ts.map
|
package/dist/engine/index.d.ts
DELETED
package/dist/engine/index.js
DELETED
package/dist/engine/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
|
package/dist/engine/notes.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task note management.
|
|
3
|
-
* Spec: §3.7 — Task Notes and Resumption
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Format a timestamped note entry.
|
|
7
|
-
*/
|
|
8
|
-
export declare function formatNote(sessionId: string, note: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Append a timestamped note to a task's body.
|
|
11
|
-
* Spec: §3.7 — note action
|
|
12
|
-
*/
|
|
13
|
-
export declare function addNote(taskId: string, note: string, sessionId: string, projectSlug?: string): Promise<{
|
|
14
|
-
success: boolean;
|
|
15
|
-
error?: string;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Get context reminder injected on task claim.
|
|
19
|
-
* Spec: §3.7 — Context injection on claim
|
|
20
|
-
*/
|
|
21
|
-
export declare function getClaimContextReminder(hasNotes: boolean): string;
|
|
22
|
-
/**
|
|
23
|
-
* Check if a task body contains any notes (prior work).
|
|
24
|
-
*/
|
|
25
|
-
export declare function hasNotes(body: string): boolean;
|
|
26
|
-
//# sourceMappingURL=notes.d.ts.map
|
package/dist/engine/notes.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task note management.
|
|
3
|
-
* Spec: §3.7 — Task Notes and Resumption
|
|
4
|
-
*/
|
|
5
|
-
import { readTask, writeTask } from "./crud.js";
|
|
6
|
-
/**
|
|
7
|
-
* Format a timestamped note entry.
|
|
8
|
-
*/
|
|
9
|
-
export function formatNote(sessionId, note) {
|
|
10
|
-
const timestamp = new Date().toISOString();
|
|
11
|
-
return `_Updated by session ${sessionId} at ${timestamp}:_\n${note}`;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Append a timestamped note to a task's body.
|
|
15
|
-
* Spec: §3.7 — note action
|
|
16
|
-
*/
|
|
17
|
-
export async function addNote(taskId, note, sessionId, projectSlug) {
|
|
18
|
-
const taskFile = await readTask(taskId, projectSlug);
|
|
19
|
-
if (!taskFile) {
|
|
20
|
-
return { success: false, error: `Task ${taskId} not found` };
|
|
21
|
-
}
|
|
22
|
-
const formattedNote = formatNote(sessionId, note);
|
|
23
|
-
const separator = taskFile.body.endsWith("\n") ? "\n" : "\n\n";
|
|
24
|
-
taskFile.body = `${taskFile.body}${separator}${formattedNote}\n`;
|
|
25
|
-
taskFile.task.updatedAt = new Date().toISOString();
|
|
26
|
-
await writeTask(taskFile);
|
|
27
|
-
return { success: true };
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Get context reminder injected on task claim.
|
|
31
|
-
* Spec: §3.7 — Context injection on claim
|
|
32
|
-
*/
|
|
33
|
-
export function getClaimContextReminder(hasNotes) {
|
|
34
|
-
if (hasNotes) {
|
|
35
|
-
return "Review prior notes before starting — previous work may be partially complete.\nAdd notes as you progress to support resumption if the task is interrupted.";
|
|
36
|
-
}
|
|
37
|
-
return "Add notes as you progress to support resumption if the task is interrupted.";
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Check if a task body contains any notes (prior work).
|
|
41
|
-
*/
|
|
42
|
-
export function hasNotes(body) {
|
|
43
|
-
return body.includes("_Updated by session");
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=notes.js.map
|
package/dist/engine/notes.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notes.js","sourceRoot":"","sources":["../../src/engine/notes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAE,IAAY;IACxD,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,OAAO,uBAAuB,SAAS,OAAO,SAAS,OAAO,IAAI,EAAE,CAAC;AACvE,CAAC;A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
|
6
|
-
export interface TransitionResult {
|
|
7
|
-
success: boolean;
|
|
8
|
-
task?: TaskFile;
|
|
9
|
-
error?: string;
|
|
10
|
-
message?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Claim a pending task — acquires lock, sets in_progress.
|
|
14
|
-
* Spec: §2.2.2
|
|
15
|
-
*/
|
|
16
|
-
export declare function claimTask(taskId: string, sessionId: string, sessionPath: string, agentTemplate?: string, projectSlug?: string): Promise<TransitionResult & {
|
|
17
|
-
claimContext?: string;
|
|
18
|
-
}>;
|
|
19
|
-
/**
|
|
20
|
-
* Complete a claimed task — releases lock, sets completed.
|
|
21
|
-
* Spec: §2.2.3
|
|
22
|
-
*/
|
|
23
|
-
export declare function completeTask(taskId: string, sessionId: string, projectSlug?: string): Promise<TransitionResult>;
|
|
24
|
-
/**
|
|
25
|
-
* Fail a claimed task — releases lock, sets failed, cascades to dependents.
|
|
26
|
-
* Note is required.
|
|
27
|
-
* Spec: §2.2.4
|
|
28
|
-
*/
|
|
29
|
-
export declare function failTask(taskId: string, sessionId: string, note: string, projectSlug?: string): Promise<TransitionResult>;
|
|
30
|
-
/**
|
|
31
|
-
* Abandon a claimed task — releases lock, sets abandoned.
|
|
32
|
-
* Note is required.
|
|
33
|
-
* Spec: §2.2.5
|
|
34
|
-
*/
|
|
35
|
-
export declare function abandonTask(taskId: string, sessionId: string, note: string, projectSlug?: string): Promise<TransitionResult>;
|
|
36
|
-
/**
|
|
37
|
-
* Unclaim a task — releases lock, returns to pending.
|
|
38
|
-
* Spec: §2.2.6
|
|
39
|
-
*/
|
|
40
|
-
export declare function unclaimTask(taskId: string, sessionId: string, projectSlug?: string): Promise<TransitionResult>;
|
|
41
|
-
/**
|
|
42
|
-
* Retry a failed task — resets to pending, clears assignment, increments retryCount.
|
|
43
|
-
* Spec: §3.6 — Task Retry
|
|
44
|
-
*/
|
|
45
|
-
export declare function retryTask(taskId: string, projectSlug?: string): Promise<TransitionResult>;
|
|
46
|
-
/**
|
|
47
|
-
* Force-unlock a stuck task.
|
|
48
|
-
* Spec: §2.5.3
|
|
49
|
-
*/
|
|
50
|
-
export declare function unlockTask(taskId: string, projectSlug?: string): Promise<TransitionResult & {
|
|
51
|
-
wasStuck?: boolean;
|
|
52
|
-
}>;
|
|
53
|
-
/**
|
|
54
|
-
* Reopen an abandoned task → pending.
|
|
55
|
-
*/
|
|
56
|
-
export declare function reopenTask(taskId: string, projectSlug?: string): Promise<TransitionResult>;
|
|
57
|
-
//# sourceMappingURL=state-machine.d.ts.map
|
package/dist/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pi Orca Tasks Extension
|
|
3
|
-
* File-backed task DAG with locking.
|
|
4
|
-
* Spec: §3 — pi-orca-tasks Extension
|
|
5
|
-
*/
|
|
6
|
-
export { executeTaskTool } from "./tool.js";
|
|
7
|
-
export * from "./engine/index.js";
|
|
8
|
-
export { renderTaskWidget, renderTaskLess, renderTaskMore } from "./widget.js";
|
|
9
|
-
export { openTasksUI } from "./overlay.js";
|
|
10
|
-
export * from "./commands.js";
|
|
11
|
-
export declare function register(pi: any): void;
|
|
12
|
-
export default register;
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/overlay.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive task overlay — list/detail/filter screens.
|
|
3
|
-
* Opened by `/task` (no args). Follows the models overlay pattern.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Open the interactive task overlay.
|
|
7
|
-
*/
|
|
8
|
-
export declare function openTasksUI(_pi: any, ctx: any): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=overlay.d.ts.map
|