@mjasnikovs/pi-task 0.42.0 → 0.42.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.
|
@@ -16,6 +16,10 @@ export declare function implementationGuardArmed(): boolean;
|
|
|
16
16
|
* one altered byte is a new key and a clean slate on both counters.
|
|
17
17
|
*/
|
|
18
18
|
export declare function blockedCallReason(toolName: string, count: number): string;
|
|
19
|
+
/** Every file under the task dir is host-written. MEASURED: an mx5 implementer
|
|
20
|
+
* wrote its report over TASK_AUTO_0001.md, and the run died on its front matter. */
|
|
21
|
+
export declare function targetsTaskDir(toolName: string, input: unknown): boolean;
|
|
22
|
+
export declare function taskDirWriteReason(): string;
|
|
19
23
|
/** The reason on the final block, which also ends the turn. */
|
|
20
24
|
export declare function terminalCallReason(): string;
|
|
21
25
|
export declare function consumeGuardTermination(): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LoopDetector, loopKey, LOOP_THRESHOLD, LOOP_WINDOW, MAX_LOOP_RESTARTS } from './loop-detector.js';
|
|
2
|
+
import { TASKS_DIR_NAME } from './task-types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Runaway guard for the IMPLEMENTATION TURN — the one model surface with none.
|
|
4
5
|
*
|
|
@@ -81,6 +82,18 @@ export function blockedCallReason(toolName, count) {
|
|
|
81
82
|
return (`Blocked: this is the ${count}th identical ${toolName} call in this turn. `
|
|
82
83
|
+ `Use what you already have, or do something different, then continue the task.`);
|
|
83
84
|
}
|
|
85
|
+
/** Every file under the task dir is host-written. MEASURED: an mx5 implementer
|
|
86
|
+
* wrote its report over TASK_AUTO_0001.md, and the run died on its front matter. */
|
|
87
|
+
export function targetsTaskDir(toolName, input) {
|
|
88
|
+
if (!MUTATING_TOOLS.has(toolName))
|
|
89
|
+
return false;
|
|
90
|
+
const target = input?.path;
|
|
91
|
+
return typeof target === 'string' && target.split(/[\\/]/).includes(TASKS_DIR_NAME);
|
|
92
|
+
}
|
|
93
|
+
export function taskDirWriteReason() {
|
|
94
|
+
return (`Blocked: ${TASKS_DIR_NAME}/ belongs to pi-task and is written only by the host. `
|
|
95
|
+
+ `Put your report in your reply, not in a file, then continue the task.`);
|
|
96
|
+
}
|
|
84
97
|
/** The reason on the final block, which also ends the turn. */
|
|
85
98
|
export function terminalCallReason() {
|
|
86
99
|
return (`Blocked: this turn repeated one call past every warning, so it is being stopped `
|
|
@@ -120,6 +133,9 @@ export function registerImplementationGuards(pi) {
|
|
|
120
133
|
if (state.terminating) {
|
|
121
134
|
return { block: true, terminate: true, reason: terminalCallReason() };
|
|
122
135
|
}
|
|
136
|
+
if (targetsTaskDir(event.toolName, event.input)) {
|
|
137
|
+
return { block: true, reason: taskDirWriteReason() };
|
|
138
|
+
}
|
|
123
139
|
const call = { name: event.toolName, args: event.input };
|
|
124
140
|
const mutating = MUTATING_TOOLS.has(event.toolName);
|
|
125
141
|
const hit = mutating ? state.edits.record(call) : state.loop.record(call);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mjasnikovs/pi-task",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "Deterministic task planning and spec-orchestration for local models — crash-safe /task pipelines with verify/enforce gates, a real-time remote web view, and web/docs/fetch/worker subagent tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|