@mjasnikovs/pi-task 0.38.26 → 0.38.28

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.
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { Text } from '@earendil-works/pi-tui';
10
10
  import { Type } from '@sinclair/typebox';
11
+ import { getConfig } from '../config/config.js';
11
12
  import { groupThinkingArgs } from '../config/reasoning-args.js';
12
13
  import { runWorker } from './pi-worker-core.js';
13
14
  import { childFailureReason, formatChildFailure, makeWorkerTool, workerAnswer, workerUnavailable } from './shared.js';
@@ -47,12 +48,12 @@ export function registerPiWorker(pi) {
47
48
  prompt: params.prompt,
48
49
  cwd: ctx.cwd,
49
50
  signal,
50
- // `adhoc` is every guard at its default — which is what this call
51
- // site already got by naming none of them. Named now so it is a
52
- // decision, and so the one asymmetry it carries (a FIXED 240s cap
53
- // where a research worker gets 240s without progress) is written
54
- // down. See the `adhoc` row in workers/worker-profiles.ts.
55
51
  profile: 'adhoc',
52
+ // The user's own `stuck reply retry` is what bounds this worker
53
+ // now — it kills on SILENCE, never on slowness. It is an INPUT and
54
+ // not policy for the same reason the gate's two ceilings are: the
55
+ // number is the user's, the decision to arm it is the profile's.
56
+ policyInputs: { streamInactivityMs: getConfig().streamInactivityMs },
56
57
  thinking: groupThinkingArgs('research')
57
58
  });
58
59
  const details = { exitCode: result.exitCode };
@@ -295,7 +295,7 @@ export declare const WORKER_PROFILES: {
295
295
  readonly adhoc: {
296
296
  readonly id: "adhoc";
297
297
  readonly why: string;
298
- readonly resolve: () => {
298
+ readonly resolve: (inputs: WorkerPolicyInputs) => {
299
299
  guards: WorkerGuards;
300
300
  carryForward: false;
301
301
  };
@@ -175,18 +175,38 @@ export const WORKER_PROFILES = {
175
175
  },
176
176
  adhoc: {
177
177
  id: 'adhoc',
178
- why: 'The model-dispatched `pi-worker` tool. Every guard at its default, and '
179
- + 'this row exists so that is a DECISION rather than the absence of one — '
180
- + 'the call site passed nothing, and nobody could see what it therefore '
181
- + 'got. What the table now makes visible is an asymmetry: this is the '
182
- + 'strictest-clocked of the three children. It runs a FIXED 240s cap, '
183
- + 'because `progressCeilingMs` is null and the deadline re-arm is inert '
184
- + 'without one, while a research worker doing the same read-only '
185
- + 'exploration gets 240s WITHOUT PROGRESS up to 20 minutes. That '
186
- + 'difference is preserved exactly here and is NOT defended: the progress '
187
- + 'deadline was measured for the research workers (nexttask 9) and has '
188
- + 'never been measured for this tool. It is a candidate, not a bug.',
189
- resolve: () => ({ guards: baseGuards(), carryForward: false })
178
+ why: 'The model-dispatched `pi-worker` tool: a read-only child with '
179
+ + '`read,grep,find,ls` and nothing else, asked a question the MODEL wrote. '
180
+ + 'It has NO WALL CLOCK, and that is a decision with evidence behind it. '
181
+ + 'It used to run a FIXED 240s cap total elapsed, not idle — inherited by '
182
+ + 'naming no guards at all. A fixed wall clock on a read-only worker makes '
183
+ + "answer quality a function of the user's hardware: the same prompt on a "
184
+ + 'slower local model loses its work and degrades, which is the argument '
185
+ + 'research-fanout-budget.ts already records against every wall-clock lever '
186
+ + '("no constant fixes that"). THAT ARGUMENT IS WHAT DECIDES THIS, and it '
187
+ + 'needs no measurement. The constant was also already stale: it was sized '
188
+ + 'against "~25-130s on the local backend" its only stated basis, with no '
189
+ + 'entry in magicknumbers.md and replaying 28 real recorded prompts after '
190
+ + 'nothing but a MODEL swap on the SAME machine gave median 56s, p90 160s, '
191
+ + 'max 280s, with 5/28 above the 130s it was calibrated to. A bound that '
192
+ + 'must be re-measured whenever the model changes is the wrong bound. '
193
+ + "What replaces it is `stream-stall`, armed from the user's own "
194
+ + '`stuck reply retry` setting: it kills on SILENCE, never on slowness — '
195
+ + '"one token every 30s is a working local model and must never be killed; '
196
+ + 'zero events for the whole window is a hang" — so it needs no calibration '
197
+ + 'and no new setting. Real thrash is still caught by the two runaway '
198
+ + 'detectors and the dead-backend probe, all of which stay on.',
199
+ resolve: inputs => {
200
+ const guards = baseGuards();
201
+ // No wall clock. See `why`: a fixed elapsed-time cap on a read-only
202
+ // worker is a hardware test, not a work test.
203
+ guards['worker-timeout'] = { timeoutMs: 0, progressCeilingMs: null, fanout: null };
204
+ // The silence bound that replaces it — the user's own setting, not a
205
+ // new one. 0 when the caller hands none, which is off, exactly as
206
+ // before: a harness must not silently acquire a guard.
207
+ guards['stream-stall'] = inputs.streamInactivityMs ?? 0;
208
+ return { guards, carryForward: false };
209
+ }
190
210
  // `as const satisfies`, not an annotation — the same reason RESTART_ORDER
191
211
  // gives: an annotation widens each row back to `WorkerProfile`, and the
192
212
  // `why` strings and literal ids stop being visible to a reader or a test.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.38.26",
3
+ "version": "0.38.28",
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",