pi-thread-engine 0.2.0 → 0.2.1
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/extensions/index.ts +0 -4
- package/package.json +1 -1
- package/src/core/registry.ts +5 -0
- package/src/dashboard.ts +1 -5
package/extensions/index.ts
CHANGED
|
@@ -88,10 +88,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
88
88
|
return tasks;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
function pad(s: string, n: number): string {
|
|
92
|
-
return s.length >= n ? s.slice(0, n) : s + " ".repeat(n - s.length);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
91
|
function stateIcon(state: string): string {
|
|
96
92
|
switch (state) {
|
|
97
93
|
case "running": return "⟳";
|
package/package.json
CHANGED
package/src/core/registry.ts
CHANGED
|
@@ -213,9 +213,14 @@ export class ThreadRegistry {
|
|
|
213
213
|
restore(threads: Thread[], stories: Story[]) {
|
|
214
214
|
for (const t of threads) {
|
|
215
215
|
this.threads.set(t.id, t);
|
|
216
|
+
// Advance ID counter past restored IDs to avoid collisions
|
|
217
|
+
const num = parseInt(t.id.replace("t-", ""), 10);
|
|
218
|
+
if (!isNaN(num) && num >= nextThreadId) nextThreadId = num + 1;
|
|
216
219
|
}
|
|
217
220
|
for (const s of stories) {
|
|
218
221
|
this.stories.set(s.id, s);
|
|
222
|
+
const num = parseInt(s.id.replace("s-", ""), 10);
|
|
223
|
+
if (!isNaN(num) && num >= nextStoryId) nextStoryId = num + 1;
|
|
219
224
|
}
|
|
220
225
|
}
|
|
221
226
|
|
package/src/dashboard.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Keys: ↑↓ navigate, Enter expand, k kill, r review, p prune, q/Esc close
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { DynamicBorder } from "@mariozechner/pi-coding-agent";
|
|
7
|
+
import { matchesKey, Key, truncateToWidth } from "@mariozechner/pi-tui";
|
|
9
8
|
import type { ThreadRegistry } from "./core/registry.js";
|
|
10
|
-
import type { Thread, Story, ThreadSummary } from "./core/types.js";
|
|
11
9
|
|
|
12
10
|
export interface DashboardTheme {
|
|
13
11
|
fg: (color: string, text: string) => string;
|
|
@@ -32,7 +30,6 @@ export function createDashboard(
|
|
|
32
30
|
let expanded: string | null = null;
|
|
33
31
|
let rows: DashboardRow[] = [];
|
|
34
32
|
let cachedWidth: number | undefined;
|
|
35
|
-
let cachedLines: string[] | undefined;
|
|
36
33
|
|
|
37
34
|
function stateIcon(state: string): string {
|
|
38
35
|
switch (state) {
|
|
@@ -215,7 +212,6 @@ export function createDashboard(
|
|
|
215
212
|
|
|
216
213
|
invalidate() {
|
|
217
214
|
cachedWidth = undefined;
|
|
218
|
-
cachedLines = undefined;
|
|
219
215
|
},
|
|
220
216
|
};
|
|
221
217
|
|