@trevonistrevon/pi-loop 0.5.7 → 0.5.8
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/coverage/coverage-final.json +23 -23
- package/coverage/index.html +39 -39
- package/coverage/src/commands/index.html +1 -1
- package/coverage/src/commands/loop-command.ts.html +1 -1
- package/coverage/src/commands/tasks-command.ts.html +1 -1
- package/coverage/src/coordinator.ts.html +20 -20
- package/coverage/src/goal-coordinator.ts.html +1 -1
- package/coverage/src/goal-reducer.ts.html +1 -1
- package/coverage/src/goal-store.ts.html +1 -1
- package/coverage/src/goal-verifier.ts.html +1 -1
- package/coverage/src/index.html +33 -33
- package/coverage/src/index.ts.html +16 -16
- package/coverage/src/loop-parse.ts.html +62 -62
- package/coverage/src/loop-reducer.ts.html +21 -21
- package/coverage/src/monitor-completion-coordinator.ts.html +3 -3
- package/coverage/src/monitor-manager.ts.html +75 -69
- package/coverage/src/monitor-reducer.ts.html +28 -28
- package/coverage/src/notification-reducer.ts.html +6 -6
- package/coverage/src/reducer-backed-store.ts.html +28 -28
- package/coverage/src/runtime/index.html +45 -45
- package/coverage/src/runtime/monitor-ondone-runtime.ts.html +39 -39
- package/coverage/src/runtime/notification-runtime.ts.html +15 -15
- package/coverage/src/runtime/scope.ts.html +34 -34
- package/coverage/src/runtime/session-runtime.ts.html +58 -52
- package/coverage/src/runtime/task-backlog-runtime.ts.html +48 -48
- package/coverage/src/runtime/task-rpc.ts.html +80 -80
- package/coverage/src/scheduler.ts.html +35 -35
- package/coverage/src/store.ts.html +24 -24
- package/coverage/src/task-backlog-coordinator.ts.html +8 -8
- package/coverage/src/task-reducer.ts.html +39 -39
- package/coverage/src/task-store.ts.html +55 -55
- package/coverage/src/tools/index.html +43 -43
- package/coverage/src/tools/loop-tools.ts.html +94 -94
- package/coverage/src/tools/monitor-tools.ts.html +53 -53
- package/coverage/src/tools/native-task-tools.ts.html +66 -66
- package/coverage/src/trigger-system.ts.html +1 -1
- package/coverage/src/ui/index.html +1 -1
- package/coverage/src/ui/widget.ts.html +1 -1
- package/dist/commands/tasks-command.js +12 -9
- package/dist/monitor-manager.js +3 -1
- package/dist/runtime/session-runtime.js +3 -1
- package/dist/runtime/task-events.d.ts +15 -0
- package/dist/runtime/task-events.js +13 -0
- package/dist/runtime/task-rpc.js +2 -0
- package/dist/tools/native-task-tools.js +20 -9
- package/package.json +1 -1
- package/src/commands/tasks-command.ts +9 -9
- package/src/monitor-manager.ts +3 -1
- package/src/runtime/session-runtime.ts +3 -1
- package/src/runtime/task-events.ts +41 -0
- package/src/runtime/task-rpc.ts +2 -0
- package/src/tools/native-task-tools.ts +16 -9
- package/vitest.config.ts +7 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
|
+
import { emitNativeTaskEvent } from "../runtime/task-events.js";
|
|
3
4
|
import { TaskStore } from "../task-store.js";
|
|
4
5
|
|
|
5
6
|
export interface TaskBacklogResult {
|
|
@@ -47,12 +48,7 @@ Fields:
|
|
|
47
48
|
}),
|
|
48
49
|
async execute(_toolCallId, params) {
|
|
49
50
|
const entry = taskStore.create(params.subject, params.description);
|
|
50
|
-
pi
|
|
51
|
-
taskId: entry.id,
|
|
52
|
-
subject: entry.subject,
|
|
53
|
-
description: entry.description,
|
|
54
|
-
status: entry.status,
|
|
55
|
-
});
|
|
51
|
+
emitNativeTaskEvent(pi, "tasks:created", entry);
|
|
56
52
|
const backlog = await evaluateTaskBacklog(taskStore, taskStore.pendingCount());
|
|
57
53
|
updateWidget();
|
|
58
54
|
|
|
@@ -111,13 +107,22 @@ Parameters: id (required), status, subject, description`,
|
|
|
111
107
|
let entry = taskStore.get(id);
|
|
112
108
|
if (!entry) return Promise.resolve(textResult(`Task #${id} not found`));
|
|
113
109
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
const previousStatus = entry.status;
|
|
111
|
+
if (status === "in_progress") {
|
|
112
|
+
entry = taskStore.start(id);
|
|
113
|
+
if (entry) emitNativeTaskEvent(pi, "tasks:started", entry, previousStatus);
|
|
114
|
+
} else if (status === "completed") {
|
|
115
|
+
entry = taskStore.complete(id);
|
|
116
|
+
if (entry) emitNativeTaskEvent(pi, "tasks:completed", entry, previousStatus);
|
|
117
|
+
} else if (status === "pending") {
|
|
118
|
+
entry = taskStore.reopen(id);
|
|
119
|
+
if (entry) emitNativeTaskEvent(pi, "tasks:reopened", entry, previousStatus);
|
|
120
|
+
}
|
|
117
121
|
|
|
118
122
|
if (!entry) return Promise.resolve(textResult(`Task #${id} not found`));
|
|
119
123
|
if (subject !== undefined || description !== undefined) {
|
|
120
124
|
entry = taskStore.updateDetails(id, { subject, description });
|
|
125
|
+
if (entry) emitNativeTaskEvent(pi, "tasks:updated", entry, previousStatus);
|
|
121
126
|
}
|
|
122
127
|
if (!entry) return Promise.resolve(textResult(`Task #${id} not found`));
|
|
123
128
|
updateWidget();
|
|
@@ -138,9 +143,11 @@ Parameters: id (required), status, subject, description`,
|
|
|
138
143
|
id: Type.String({ description: "Task ID to delete" }),
|
|
139
144
|
}),
|
|
140
145
|
async execute(_toolCallId, params) {
|
|
146
|
+
const existing = taskStore.get(params.id);
|
|
141
147
|
const deleted = taskStore.delete(params.id);
|
|
142
148
|
updateWidget();
|
|
143
149
|
if (deleted) {
|
|
150
|
+
if (existing) emitNativeTaskEvent(pi, "tasks:deleted", existing, existing.status);
|
|
144
151
|
await evaluateTaskBacklog(taskStore, taskStore.pendingCount());
|
|
145
152
|
return Promise.resolve(textResult(`Task #${params.id} deleted`));
|
|
146
153
|
}
|
package/vitest.config.ts
CHANGED
|
@@ -11,14 +11,14 @@ export default defineConfig({
|
|
|
11
11
|
include: ["src/**/*.ts"],
|
|
12
12
|
// Type-only modules and test helpers carry no executable logic worth gating.
|
|
13
13
|
exclude: ["src/**/*-types.ts", "src/types.ts"],
|
|
14
|
-
// Floors set just below current actuals (stmts
|
|
15
|
-
// funcs
|
|
16
|
-
// runtime/
|
|
14
|
+
// Floors set just below current actuals (stmts 84%, branches 75%,
|
|
15
|
+
// funcs 95%, lines 86%) to catch regressions. Raised in Phase 4 after the
|
|
16
|
+
// runtime/ + tools/ suites landed.
|
|
17
17
|
thresholds: {
|
|
18
|
-
statements:
|
|
19
|
-
branches:
|
|
20
|
-
functions:
|
|
21
|
-
lines:
|
|
18
|
+
statements: 82,
|
|
19
|
+
branches: 73,
|
|
20
|
+
functions: 94,
|
|
21
|
+
lines: 84,
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
},
|