@mjasnikovs/pi-task 0.38.31 → 0.39.0
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/README.md +2 -1
- package/dist/config/config.d.ts +16 -2
- package/dist/config/config.js +7 -2
- package/dist/config/group-args.d.ts +52 -0
- package/dist/config/group-args.js +110 -0
- package/dist/config/group-models.d.ts +88 -0
- package/dist/config/group-models.js +117 -0
- package/dist/config/groups.d.ts +76 -0
- package/dist/config/groups.js +110 -0
- package/dist/config/option-picker.d.ts +70 -0
- package/dist/config/option-picker.js +113 -0
- package/dist/config/reasoning.d.ts +26 -64
- package/dist/config/reasoning.js +31 -115
- package/dist/config/register.d.ts +144 -24
- package/dist/config/register.js +345 -56
- package/dist/index.js +2 -0
- package/dist/remote/push.js +1 -7
- package/dist/shared/data-home.d.ts +8 -0
- package/dist/shared/data-home.js +14 -0
- package/dist/shared/model-endpoint.d.ts +53 -0
- package/dist/shared/model-endpoint.js +98 -2
- package/dist/shared/reasoning-capability.d.ts +25 -5
- package/dist/shared/reasoning-capability.js +18 -9
- package/dist/task/child-runner.d.ts +19 -16
- package/dist/task/child-runner.js +64 -36
- package/dist/task/context-usage.d.ts +46 -0
- package/dist/task/context-usage.js +41 -0
- package/dist/task/gate-child.d.ts +15 -4
- package/dist/task/gate-child.js +2 -2
- package/dist/task/gate-deps.js +7 -2
- package/dist/task/implementation-hold.d.ts +118 -0
- package/dist/task/implementation-hold.js +165 -0
- package/dist/task/model-hold-stash.d.ts +43 -0
- package/dist/task/model-hold-stash.js +70 -0
- package/dist/task/orchestrator.d.ts +18 -5
- package/dist/task/orchestrator.js +36 -4
- package/dist/task/phases.js +2 -2
- package/dist/task/research-worker.d.ts +2 -2
- package/dist/task/research-worker.js +1 -1
- package/dist/workers/docs-core.js +2 -2
- package/dist/workers/docs-lookup.d.ts +4 -3
- package/dist/workers/docs-lookup.js +1 -1
- package/dist/workers/fetch-core.js +2 -2
- package/dist/workers/focused-extractor.d.ts +4 -3
- package/dist/workers/focused-extractor.js +5 -4
- package/dist/workers/index.js +2 -0
- package/dist/workers/model-warning.d.ts +69 -0
- package/dist/workers/model-warning.js +113 -0
- package/dist/workers/pi-worker-core.d.ts +7 -7
- package/dist/workers/pi-worker-core.js +4 -3
- package/dist/workers/pi-worker-docs.js +2 -2
- package/dist/workers/pi-worker.js +4 -4
- package/dist/workers/reasoning-warning.d.ts +17 -9
- package/dist/workers/reasoning-warning.js +69 -22
- package/package.json +1 -1
- package/dist/config/reasoning-args.d.ts +0 -23
- package/dist/config/reasoning-args.js +0 -28
- package/dist/task/implementation-thinking.d.ts +0 -56
- package/dist/task/implementation-thinking.js +0 -32
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The live-config bridge for reasoning profiles: group in, argv fragment out.
|
|
3
|
-
*
|
|
4
|
-
* Separate from reasoning.ts because that module must take no import with a
|
|
5
|
-
* runtime side effect — see its header. The `getConfig()` read lives here
|
|
6
|
-
* instead: this file imports both, and nothing in config/ imports it back, so
|
|
7
|
-
* the graph stays a tree.
|
|
8
|
-
*
|
|
9
|
-
* Read PER CALL, never cached at module scope, so a /task-config change lands on
|
|
10
|
-
* the next child without a restart. Same contract `childBaseArgs` keeps.
|
|
11
|
-
*/
|
|
12
|
-
import { type PiTaskConfig } from './config.js';
|
|
13
|
-
import { type ReasoningGroup } from './reasoning.js';
|
|
14
|
-
/**
|
|
15
|
-
* The `['--thinking', level]` fragment for a group, or `[]` when the group is
|
|
16
|
-
* `inherit` and the child should keep falling back to settings.json.
|
|
17
|
-
*
|
|
18
|
-
* Every argv builder calls this rather than reading config itself. The two
|
|
19
|
-
* callers that skip it are not argv builders: the host-session turn
|
|
20
|
-
* (implementation-thinking.ts) and the settings UI (register.ts) both need the
|
|
21
|
-
* level itself, not a flag, so they call `resolveReasoning` directly.
|
|
22
|
-
*/
|
|
23
|
-
export declare function groupThinkingArgs(group: ReasoningGroup, cfg?: PiTaskConfig): string[];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The live-config bridge for reasoning profiles: group in, argv fragment out.
|
|
3
|
-
*
|
|
4
|
-
* Separate from reasoning.ts because that module must take no import with a
|
|
5
|
-
* runtime side effect — see its header. The `getConfig()` read lives here
|
|
6
|
-
* instead: this file imports both, and nothing in config/ imports it back, so
|
|
7
|
-
* the graph stays a tree.
|
|
8
|
-
*
|
|
9
|
-
* Read PER CALL, never cached at module scope, so a /task-config change lands on
|
|
10
|
-
* the next child without a restart. Same contract `childBaseArgs` keeps.
|
|
11
|
-
*/
|
|
12
|
-
import { getConfig } from './config.js';
|
|
13
|
-
import { resolveReasoning, thinkingArgs } from './reasoning.js';
|
|
14
|
-
/**
|
|
15
|
-
* The `['--thinking', level]` fragment for a group, or `[]` when the group is
|
|
16
|
-
* `inherit` and the child should keep falling back to settings.json.
|
|
17
|
-
*
|
|
18
|
-
* Every argv builder calls this rather than reading config itself. The two
|
|
19
|
-
* callers that skip it are not argv builders: the host-session turn
|
|
20
|
-
* (implementation-thinking.ts) and the settings UI (register.ts) both need the
|
|
21
|
-
* level itself, not a flag, so they call `resolveReasoning` directly.
|
|
22
|
-
*/
|
|
23
|
-
export function groupThinkingArgs(group, cfg) {
|
|
24
|
-
// The default is evaluated HERE, per call. Hoisting the read to module scope
|
|
25
|
-
// would leave every test green, so the optional parameter is what makes the
|
|
26
|
-
// per-call contract assertable.
|
|
27
|
-
return thinkingArgs(resolveReasoning(group, cfg ?? getConfig()));
|
|
28
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hold the host session at the `implementation` group's thinking level for the
|
|
3
|
-
* duration of one implementation turn, then put it back.
|
|
4
|
-
*
|
|
5
|
-
* WHY THIS GROUP IS NOT LIKE THE OTHERS
|
|
6
|
-
* -------------------------------------
|
|
7
|
-
* Every other reasoning group runs in a child process, so its level is one argv
|
|
8
|
-
* flag (`--thinking <level>`, built in reasoning-args.ts) and it dies with the
|
|
9
|
-
* child. The implementation turn runs in the USER'S OWN session
|
|
10
|
-
* (orchestrator.ts `sendSpec` -> `sendUserMessage` -> `superviseImplementation`),
|
|
11
|
-
* so the only lever is `pi.setThinkingLevel`, which is session-global.
|
|
12
|
-
*
|
|
13
|
-
* THREE THINGS pi DOES that this has to survive:
|
|
14
|
-
*
|
|
15
|
-
* 1. IT PERSISTS. pi-coding-agent's agent-session `setThinkingLevel` calls
|
|
16
|
-
* `settingsManager.setDefaultThinkingLevel(...)` whenever the effective
|
|
17
|
-
* level actually changes, and that writes pi's global settings file
|
|
18
|
-
* (`~/.pi/agent/settings.json`). Without the restore, running one task would
|
|
19
|
-
* silently rewrite the user's global default. That makes `release()`
|
|
20
|
-
* load-bearing, not tidy-up.
|
|
21
|
-
* 2. IT CLAMPS, to the levels the model declares. A model with no reasoning
|
|
22
|
-
* support offers only `off`, so asking for `medium` yields `off`. The
|
|
23
|
-
* restore therefore writes back what was READ after setting, never what was
|
|
24
|
-
* asked for — otherwise a clamp would ratchet the stored default a little
|
|
25
|
-
* further every run.
|
|
26
|
-
* 3. IT IS OBSERVABLE, and the user can change it mid-turn: `shift+tab` is the
|
|
27
|
-
* default binding for `app.thinking.cycle`, and a change invalidates the
|
|
28
|
-
* footer. Restoring blindly would clobber a choice they just made. We detect
|
|
29
|
-
* it by comparing the live level at release against what we applied: if it
|
|
30
|
-
* has moved, somebody else moved it, and we leave it alone.
|
|
31
|
-
*
|
|
32
|
-
* We compare rather than subscribe because the extension API's `on(...)` returns
|
|
33
|
-
* `void` — there is no unsubscribe handle — so a per-turn listener could only
|
|
34
|
-
* ever be added, never removed. The comparison answers the same question with no
|
|
35
|
-
* accumulating state.
|
|
36
|
-
*/
|
|
37
|
-
import type { ThinkingLevel } from '@earendil-works/pi-agent-core';
|
|
38
|
-
import { type GroupSetting } from '../config/reasoning.js';
|
|
39
|
-
/**
|
|
40
|
-
* The slice of the extension API this needs, named so tests can drive the
|
|
41
|
-
* hold-and-restore with a fake object instead of a live pi session.
|
|
42
|
-
*/
|
|
43
|
-
export interface ThinkingControl {
|
|
44
|
-
get(): ThinkingLevel;
|
|
45
|
-
set(level: ThinkingLevel): void;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Put the session at the implementation group's level and return the function
|
|
49
|
-
* that puts it back. Always call the returned function — `finally`, not the
|
|
50
|
-
* happy path.
|
|
51
|
-
*
|
|
52
|
-
* `inherit` makes NO call at all, not even a redundant set-to-current. It means
|
|
53
|
-
* the same thing here as in `thinkingArgs`, which emits no `--thinking` flag for
|
|
54
|
-
* it: leave the level wherever it already is.
|
|
55
|
-
*/
|
|
56
|
-
export declare function holdImplementationThinking(control: ThinkingControl, setting?: GroupSetting): () => void;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { getConfig } from '../config/config.js';
|
|
2
|
-
import { resolveReasoning } from '../config/reasoning.js';
|
|
3
|
-
/**
|
|
4
|
-
* Put the session at the implementation group's level and return the function
|
|
5
|
-
* that puts it back. Always call the returned function — `finally`, not the
|
|
6
|
-
* happy path.
|
|
7
|
-
*
|
|
8
|
-
* `inherit` makes NO call at all, not even a redundant set-to-current. It means
|
|
9
|
-
* the same thing here as in `thinkingArgs`, which emits no `--thinking` flag for
|
|
10
|
-
* it: leave the level wherever it already is.
|
|
11
|
-
*/
|
|
12
|
-
export function holdImplementationThinking(control, setting = resolveReasoning('implementation', getConfig())) {
|
|
13
|
-
if (setting === 'inherit')
|
|
14
|
-
return () => { };
|
|
15
|
-
const before = control.get();
|
|
16
|
-
control.set(setting);
|
|
17
|
-
// Post-clamp, so a model that cannot do `medium` does not leave us believing
|
|
18
|
-
// it is at `medium` and treating the user's later change as our own.
|
|
19
|
-
const applied = control.get();
|
|
20
|
-
if (applied === before)
|
|
21
|
-
return () => { };
|
|
22
|
-
let released = false;
|
|
23
|
-
return () => {
|
|
24
|
-
// Idempotent by contract: only the first call restores. A later call
|
|
25
|
-
// would write `before` on top of whatever the level is by then.
|
|
26
|
-
if (released)
|
|
27
|
-
return;
|
|
28
|
-
released = true;
|
|
29
|
-
if (control.get() === applied)
|
|
30
|
-
control.set(before);
|
|
31
|
-
};
|
|
32
|
-
}
|