@mjasnikovs/pi-task 0.13.35 → 0.13.36

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.
@@ -324,9 +324,11 @@ function defaultDeps(ctx, cwd, signal, title) {
324
324
  runChild: async (tools, prompt, sig) => {
325
325
  // The enforcement child is a slow local-model pass with edit
326
326
  // tools; show the same /task-auto status block as planning so
327
- // it isn't silent — head · enforcing guidelines/elapsed ·
328
- // last line. (runWorker surfaces no context usage, so that
329
- // line is just omitted.)
327
+ // it isn't silent — head · enforcing guidelines/elapsed ·
328
+ // tokens/window [bar] · ↳ last line. The worker runs the same
329
+ // `--mode json` stream as the phase children, so it emits
330
+ // context_usage; forward it (onContextUsage below) so the bar
331
+ // renders here exactly like every other phase widget.
330
332
  lastLine = undefined;
331
333
  contextUsage = undefined;
332
334
  const startedAt = Date.now();
@@ -364,6 +366,9 @@ function defaultDeps(ctx, cwd, signal, title) {
364
366
  onLine: line => {
365
367
  lastLine = line;
366
368
  logEnforce(line);
369
+ },
370
+ onContextUsage: snapshot => {
371
+ contextUsage = resolveContextUsage(snapshot, contextUsage, parentContextWindow);
367
372
  }
368
373
  });
369
374
  const failure = classifyEnforceChildFailure(r);
@@ -1,4 +1,4 @@
1
- import { type SpawnFn } from '../shared/child-process.js';
1
+ import { type ContextSnapshot, type SpawnFn } from '../shared/child-process.js';
2
2
  import { type LoopHit } from '../task/loop-detector.js';
3
3
  export interface RunWorkerInput {
4
4
  prompt: string;
@@ -11,6 +11,13 @@ export interface RunWorkerInput {
11
11
  extensions?: string[];
12
12
  /** Called for each tool execution start and text-writing event inside the worker. */
13
13
  onLine?: (line: string) => void;
14
+ /**
15
+ * Called for each context_usage snapshot the child emits (same `--mode json`
16
+ * stream the phase children parse). Lets a caller's status widget show the
17
+ * tokens/window progress bar for the worker exactly like the phase widget,
18
+ * instead of omitting it.
19
+ */
20
+ onContextUsage?: (snapshot: ContextSnapshot) => void;
14
21
  /**
15
22
  * Per-worker wall-clock timeout in ms. Defaults to RESEARCH_WORKER_TIMEOUT_MS.
16
23
  * Pass 0 to disable the timeout entirely (run until the child exits on its
@@ -104,7 +104,8 @@ export async function runWorker(input) {
104
104
  loopHit = hit;
105
105
  return hit;
106
106
  },
107
- onLine: input.onLine
107
+ onLine: input.onLine,
108
+ onContextUsage: input.onContextUsage
108
109
  }, input.spawn);
109
110
  }
110
111
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.13.35",
3
+ "version": "0.13.36",
4
4
  "description": "Deterministic spec-orchestration for local models, with a bundled real-time remote web view and web/docs/fetch/worker subagent tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",