@mjasnikovs/pi-task 0.38.29 → 0.38.31
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/dist/config/config.d.ts +70 -70
- package/dist/config/config.js +26 -35
- package/dist/config/extension-list.d.ts +6 -5
- package/dist/config/extension-list.js +3 -2
- package/dist/config/reasoning-args.d.ts +9 -7
- package/dist/config/reasoning-args.js +12 -10
- package/dist/config/reasoning.d.ts +44 -105
- package/dist/config/reasoning.js +27 -704
- package/dist/config/register.d.ts +34 -48
- package/dist/config/register.js +41 -51
- package/dist/config/tool-list.d.ts +16 -16
- package/dist/config/tool-list.js +1 -1
- package/dist/index.js +2 -0
- package/dist/remote/bridge.d.ts +19 -10
- package/dist/remote/bridge.js +3 -2
- package/dist/remote/broadcast.js +3 -1
- package/dist/remote/events.js +12 -11
- package/dist/remote/history.d.ts +1 -1
- package/dist/remote/protocol.d.ts +6 -3
- package/dist/remote/protocol.js +2 -1
- package/dist/remote/push.d.ts +16 -16
- package/dist/remote/push.js +27 -27
- package/dist/remote/register.d.ts +3 -3
- package/dist/remote/register.js +17 -19
- package/dist/remote/server.d.ts +9 -8
- package/dist/remote/server.js +15 -14
- package/dist/remote/session-state.d.ts +5 -4
- package/dist/remote/session-state.js +8 -5
- package/dist/remote/sw.d.ts +7 -6
- package/dist/remote/sw.js +7 -6
- package/dist/remote/tailscale.d.ts +4 -2
- package/dist/remote/tailscale.js +4 -2
- package/dist/remote/ui-highlight.js +6 -5
- package/dist/remote/ui-render.js +4 -4
- package/dist/remote/ui-script.js +24 -24
- package/dist/remote/ui-styles.d.ts +1 -1
- package/dist/remote/ui-styles.js +10 -13
- package/dist/remote/ui-tools.js +9 -6
- package/dist/shared/child-extensions.d.ts +29 -17
- package/dist/shared/child-extensions.js +29 -17
- package/dist/shared/child-output.d.ts +30 -24
- package/dist/shared/child-output.js +25 -17
- package/dist/shared/child-process.d.ts +47 -40
- package/dist/shared/child-process.js +50 -59
- package/dist/shared/command-watchdog.d.ts +85 -16
- package/dist/shared/command-watchdog.js +115 -21
- package/dist/shared/fs-text.d.ts +16 -10
- package/dist/shared/fs-text.js +16 -10
- package/dist/shared/git-runner.d.ts +25 -25
- package/dist/shared/git-runner.js +25 -25
- package/dist/shared/leaked-tool-call.d.ts +17 -11
- package/dist/shared/leaked-tool-call.js +23 -15
- package/dist/shared/model-endpoint.d.ts +29 -16
- package/dist/shared/model-endpoint.js +33 -21
- package/dist/shared/pi-invocation.d.ts +7 -4
- package/dist/shared/pi-invocation.js +12 -7
- package/dist/shared/pkg-version.d.ts +13 -5
- package/dist/shared/pkg-version.js +13 -5
- package/dist/shared/reasoning-capability.d.ts +35 -24
- package/dist/shared/reasoning-capability.js +35 -24
- package/dist/shared/stream-watchdog.d.ts +60 -44
- package/dist/shared/stream-watchdog.js +62 -45
- package/dist/task/accept-debt.d.ts +41 -43
- package/dist/task/accept-debt.js +73 -65
- package/dist/task/api-synthesis.d.ts +24 -21
- package/dist/task/api-synthesis.js +32 -26
- package/dist/task/apis-contract.d.ts +32 -64
- package/dist/task/apis-contract.js +32 -64
- package/dist/task/artifact-closure.d.ts +27 -13
- package/dist/task/artifact-closure.js +95 -67
- package/dist/task/auto-commit.d.ts +46 -35
- package/dist/task/auto-commit.js +51 -38
- package/dist/task/auto-io.d.ts +45 -25
- package/dist/task/auto-io.js +57 -29
- package/dist/task/auto-orchestrator.d.ts +26 -24
- package/dist/task/auto-orchestrator.js +192 -165
- package/dist/task/auto-prompts.d.ts +36 -24
- package/dist/task/auto-prompts.js +40 -26
- package/dist/task/autofix-ledger.d.ts +27 -25
- package/dist/task/autofix-ledger.js +29 -26
- package/dist/task/batch-test-task.d.ts +20 -12
- package/dist/task/batch-test-task.js +67 -60
- package/dist/task/boot-probe.d.ts +60 -44
- package/dist/task/boot-probe.js +91 -72
- package/dist/task/cancel-input.d.ts +30 -16
- package/dist/task/cancel-input.js +20 -11
- package/dist/task/cancel-points.d.ts +27 -20
- package/dist/task/cancel-points.js +30 -22
- package/dist/task/child-runner.d.ts +124 -55
- package/dist/task/child-runner.js +298 -90
- package/dist/task/child-status.d.ts +23 -16
- package/dist/task/child-status.js +23 -16
- package/dist/task/clamp-output.js +12 -5
- package/dist/task/command-run.d.ts +31 -28
- package/dist/task/command-run.js +44 -35
- package/dist/task/command-shrink.d.ts +25 -18
- package/dist/task/command-shrink.js +37 -31
- package/dist/task/command-watchdog.d.ts +9 -6
- package/dist/task/command-watchdog.js +21 -15
- package/dist/task/context-attribution.d.ts +34 -26
- package/dist/task/context-attribution.js +34 -26
- package/dist/task/context-silence.d.ts +39 -29
- package/dist/task/context-silence.js +35 -25
- package/dist/task/context-usage.d.ts +16 -9
- package/dist/task/context-usage.js +16 -9
- package/dist/task/contracts.d.ts +8 -4
- package/dist/task/contracts.js +25 -17
- package/dist/task/coverage-loop.d.ts +22 -18
- package/dist/task/coverage-loop.js +35 -30
- package/dist/task/critique-probes.d.ts +13 -14
- package/dist/task/critique-probes.js +50 -39
- package/dist/task/debug-log.d.ts +13 -5
- package/dist/task/debug-log.js +32 -20
- package/dist/task/decompose-fidelity.d.ts +11 -9
- package/dist/task/decompose-fidelity.js +38 -33
- package/dist/task/decompose-granularity.d.ts +41 -38
- package/dist/task/decompose-granularity.js +41 -38
- package/dist/task/deep-render-check.d.ts +22 -14
- package/dist/task/deep-render-check.js +40 -31
- package/dist/task/dropped-input.d.ts +12 -7
- package/dist/task/dropped-input.js +5 -2
- package/dist/task/enforce-attribution.d.ts +38 -47
- package/dist/task/enforce-attribution.js +46 -52
- package/dist/task/enforce-guidelines.d.ts +31 -20
- package/dist/task/enforce-guidelines.js +32 -21
- package/dist/task/enrichment.d.ts +7 -2
- package/dist/task/enrichment.js +26 -14
- package/dist/task/env-notes.d.ts +16 -7
- package/dist/task/env-notes.js +48 -31
- package/dist/task/env-template-closure.d.ts +4 -4
- package/dist/task/env-template-closure.js +42 -34
- package/dist/task/external-context.d.ts +28 -21
- package/dist/task/external-context.js +17 -12
- package/dist/task/failure-classifier.d.ts +4 -5
- package/dist/task/failure-classifier.js +30 -8
- package/dist/task/file-inventory.d.ts +15 -11
- package/dist/task/file-inventory.js +25 -22
- package/dist/task/final-gate-fix.d.ts +74 -86
- package/dist/task/final-gate-fix.js +97 -116
- package/dist/task/final-gate-progress.d.ts +29 -46
- package/dist/task/final-gate-progress.js +40 -51
- package/dist/task/final-gate.d.ts +64 -97
- package/dist/task/final-gate.js +192 -199
- package/dist/task/fix-child.d.ts +21 -27
- package/dist/task/fix-child.js +21 -27
- package/dist/task/foreign-path.d.ts +6 -5
- package/dist/task/foreign-path.js +0 -0
- package/dist/task/frozen-conflict.d.ts +9 -10
- package/dist/task/frozen-conflict.js +61 -64
- package/dist/task/frozen-path-guard.d.ts +35 -14
- package/dist/task/frozen-path-guard.js +56 -39
- package/dist/task/gate-child.d.ts +27 -28
- package/dist/task/gate-child.js +36 -35
- package/dist/task/gate-deps.d.ts +34 -27
- package/dist/task/gate-deps.js +169 -159
- package/dist/task/gate-tally.d.ts +77 -80
- package/dist/task/gate-tally.js +65 -68
- package/dist/task/git-state-guard.d.ts +15 -11
- package/dist/task/git-state-guard.js +76 -66
- package/dist/task/impl-widget.d.ts +25 -16
- package/dist/task/impl-widget.js +27 -17
- package/dist/task/implementation-guards.d.ts +26 -0
- package/dist/task/implementation-guards.js +177 -0
- package/dist/task/implementation-thinking.d.ts +33 -31
- package/dist/task/implementation-thinking.js +5 -6
- package/dist/task/implementation-turn.d.ts +39 -31
- package/dist/task/implementation-turn.js +41 -28
- package/dist/task/inline-markdown.d.ts +20 -7
- package/dist/task/inline-markdown.js +15 -6
- package/dist/task/launch-config-gap.js +25 -39
- package/dist/task/launch-contract.d.ts +18 -21
- package/dist/task/launch-contract.js +28 -30
- package/dist/task/launch-manifest.d.ts +6 -2
- package/dist/task/launch-manifest.js +35 -34
- package/dist/task/ledger.js +16 -14
- package/dist/task/lint-fix.d.ts +6 -8
- package/dist/task/lint-fix.js +67 -69
- package/dist/task/loop-detector.d.ts +27 -8
- package/dist/task/loop-detector.js +38 -14
- package/dist/task/mid-run-input.d.ts +17 -15
- package/dist/task/mid-run-input.js +17 -15
- package/dist/task/orchestrator.d.ts +24 -28
- package/dist/task/orchestrator.js +89 -66
- package/dist/task/orientation.d.ts +18 -23
- package/dist/task/orientation.js +24 -31
- package/dist/task/owned-freeze-conflict.d.ts +21 -20
- package/dist/task/owned-freeze-conflict.js +52 -85
- package/dist/task/owned-freeze-reassign.d.ts +40 -60
- package/dist/task/owned-freeze-reassign.js +41 -61
- package/dist/task/parsers.d.ts +4 -2
- package/dist/task/parsers.js +4 -4
- package/dist/task/phases.d.ts +41 -48
- package/dist/task/phases.js +196 -252
- package/dist/task/plan-io.d.ts +6 -7
- package/dist/task/plan-io.js +6 -7
- package/dist/task/plan-orchestrator.d.ts +10 -8
- package/dist/task/plan-orchestrator.js +14 -10
- package/dist/task/plan-prompts.d.ts +6 -5
- package/dist/task/plan-prompts.js +6 -5
- package/dist/task/plan-readonly.d.ts +4 -5
- package/dist/task/plan-readonly.js +4 -5
- package/dist/task/plan-rounds.d.ts +17 -29
- package/dist/task/plan-rounds.js +21 -34
- package/dist/task/plan-session.d.ts +58 -72
- package/dist/task/plan-session.js +61 -83
- package/dist/task/probe-gaming.d.ts +28 -27
- package/dist/task/probe-gaming.js +0 -0
- package/dist/task/prohibition-probe.d.ts +14 -16
- package/dist/task/prompts.d.ts +3 -4
- package/dist/task/prompts.js +17 -26
- package/dist/task/qa-transcript.d.ts +15 -22
- package/dist/task/qa-transcript.js +15 -21
- package/dist/task/question-box.d.ts +17 -13
- package/dist/task/question-box.js +19 -15
- package/dist/task/question-dedup.d.ts +6 -7
- package/dist/task/question-dedup.js +13 -14
- package/dist/task/question-dialog.d.ts +22 -32
- package/dist/task/question-dialog.js +22 -32
- package/dist/task/question-source.d.ts +18 -44
- package/dist/task/question-source.js +22 -51
- package/dist/task/refuted-constraint.d.ts +11 -31
- package/dist/task/refuted-constraint.js +27 -51
- package/dist/task/regenerable-artifacts.d.ts +12 -31
- package/dist/task/regenerable-artifacts.js +12 -31
- package/dist/task/render-check.d.ts +11 -22
- package/dist/task/render-check.js +33 -46
- package/dist/task/repo-health-check.d.ts +10 -14
- package/dist/task/repo-health-check.js +17 -23
- package/dist/task/requirements.d.ts +38 -71
- package/dist/task/requirements.js +78 -126
- package/dist/task/research-fanout-budget.d.ts +51 -88
- package/dist/task/research-fanout-budget.js +51 -88
- package/dist/task/research-worker.d.ts +29 -39
- package/dist/task/research-worker.js +37 -61
- package/dist/task/resume-gap.d.ts +14 -15
- package/dist/task/root-cause-repair.d.ts +9 -9
- package/dist/task/root-cause-repair.js +28 -40
- package/dist/task/run-bracket.d.ts +10 -13
- package/dist/task/run-end.d.ts +12 -22
- package/dist/task/run-end.js +8 -16
- package/dist/task/run-final-gate.d.ts +19 -21
- package/dist/task/run-final-gate.js +62 -80
- package/dist/task/runner-globs.d.ts +12 -13
- package/dist/task/runner-globs.js +12 -13
- package/dist/task/runner-resolve.d.ts +9 -9
- package/dist/task/runner-resolve.js +22 -23
- package/dist/task/script-escape.d.ts +10 -12
- package/dist/task/script-escape.js +13 -14
- package/dist/task/serve-entry.d.ts +1 -1
- package/dist/task/serve-entry.js +22 -25
- package/dist/task/service-blocks.js +4 -2
- package/dist/task/shipped-source.d.ts +11 -29
- package/dist/task/shipped-source.js +11 -29
- package/dist/task/skip-escape.js +10 -14
- package/dist/task/spec-urls.d.ts +26 -65
- package/dist/task/spec-urls.js +26 -65
- package/dist/task/spec-validation.d.ts +17 -20
- package/dist/task/spec-validation.js +17 -20
- package/dist/task/stall-detector.d.ts +23 -30
- package/dist/task/stall-detector.js +23 -30
- package/dist/task/stream-watchdog.d.ts +14 -12
- package/dist/task/stream-watchdog.js +14 -12
- package/dist/task/substitution-probe.d.ts +17 -20
- package/dist/task/substitution-probe.js +17 -20
- package/dist/task/task-gates.d.ts +36 -41
- package/dist/task/task-gates.js +95 -106
- package/dist/task/task-io.d.ts +4 -4
- package/dist/task/task-io.js +4 -4
- package/dist/task/task-parsers.js +4 -3
- package/dist/task/task-provenance.d.ts +2 -2
- package/dist/task/task-provenance.js +11 -13
- package/dist/task/task-types.d.ts +4 -3
- package/dist/task/terminal-outcome.d.ts +14 -16
- package/dist/task/terminal-outcome.js +12 -14
- package/dist/task/test-assembly.d.ts +13 -20
- package/dist/task/test-assembly.js +13 -20
- package/dist/task/timings.d.ts +5 -3
- package/dist/task/timings.js +5 -3
- package/dist/task/title-label.d.ts +9 -4
- package/dist/task/title-label.js +9 -4
- package/dist/task/type-only-answer.d.ts +44 -52
- package/dist/task/type-only-answer.js +44 -52
- package/dist/task/unfailable-command.d.ts +18 -24
- package/dist/task/unfailable-command.js +21 -27
- package/dist/task/unknown-routing.d.ts +10 -4
- package/dist/task/unknown-routing.js +10 -4
- package/dist/task/user-directives.d.ts +5 -8
- package/dist/task/user-directives.js +5 -8
- package/dist/task/verify-quality.d.ts +18 -22
- package/dist/task/verify-quality.js +45 -46
- package/dist/task/verify-reconcile.d.ts +15 -10
- package/dist/task/verify-reconcile.js +45 -43
- package/dist/task/verify-resolution.d.ts +24 -20
- package/dist/task/verify-resolution.js +51 -50
- package/dist/task/verify-work.d.ts +59 -66
- package/dist/task/verify-work.js +101 -138
- package/dist/task/widget.d.ts +15 -14
- package/dist/task/widget.js +22 -17
- package/dist/task/wiring-claims.d.ts +25 -32
- package/dist/task/wiring-claims.js +30 -35
- package/dist/task/write-guard.d.ts +39 -39
- package/dist/task/write-guard.js +48 -51
- package/dist/task/yolo.d.ts +34 -30
- package/dist/task/yolo.js +42 -37
- package/dist/workers/abstention.d.ts +21 -41
- package/dist/workers/abstention.js +27 -48
- package/dist/workers/brave-search.d.ts +4 -3
- package/dist/workers/brave-search.js +5 -2
- package/dist/workers/brave-warning.d.ts +7 -4
- package/dist/workers/brave-warning.js +19 -7
- package/dist/workers/ddg-search.d.ts +6 -6
- package/dist/workers/ddg-search.js +18 -12
- package/dist/workers/docs-cache.js +5 -2
- package/dist/workers/docs-chunk.d.ts +30 -37
- package/dist/workers/docs-chunk.js +37 -41
- package/dist/workers/docs-core.d.ts +28 -44
- package/dist/workers/docs-core.js +25 -44
- package/dist/workers/docs-index.js +4 -3
- package/dist/workers/docs-lookup.d.ts +15 -22
- package/dist/workers/docs-lookup.js +12 -21
- package/dist/workers/docs-project.d.ts +15 -9
- package/dist/workers/docs-project.js +17 -10
- package/dist/workers/docs-resolve.d.ts +19 -20
- package/dist/workers/docs-resolve.js +35 -32
- package/dist/workers/docs-retrieve.d.ts +5 -6
- package/dist/workers/docs-retrieve.js +18 -15
- package/dist/workers/exa-search.d.ts +9 -6
- package/dist/workers/exa-search.js +23 -12
- package/dist/workers/fetch-core.d.ts +13 -16
- package/dist/workers/fetch-core.js +23 -23
- package/dist/workers/focused-extractor.d.ts +13 -12
- package/dist/workers/focused-extractor.js +27 -19
- package/dist/workers/html-clean.js +24 -14
- package/dist/workers/http-request.d.ts +28 -20
- package/dist/workers/http-request.js +22 -17
- package/dist/workers/npm-version.d.ts +28 -11
- package/dist/workers/npm-version.js +24 -15
- package/dist/workers/phantom-imports.d.ts +15 -12
- package/dist/workers/phantom-imports.js +30 -24
- package/dist/workers/pi-worker-core.d.ts +65 -96
- package/dist/workers/pi-worker-core.js +93 -181
- package/dist/workers/pi-worker-docs.d.ts +24 -19
- package/dist/workers/pi-worker-docs.js +67 -76
- package/dist/workers/pi-worker-fetch.d.ts +7 -3
- package/dist/workers/pi-worker-fetch.js +27 -19
- package/dist/workers/pi-worker-search.js +12 -8
- package/dist/workers/pi-worker.d.ts +9 -4
- package/dist/workers/pi-worker.js +21 -14
- package/dist/workers/reasoning-warning.d.ts +18 -17
- package/dist/workers/reasoning-warning.js +22 -20
- package/dist/workers/research-cache.js +50 -78
- package/dist/workers/search-core.js +7 -5
- package/dist/workers/search-types.d.ts +10 -9
- package/dist/workers/search-types.js +9 -8
- package/dist/workers/session-hint.d.ts +13 -14
- package/dist/workers/session-hint.js +8 -9
- package/dist/workers/shared.d.ts +21 -25
- package/dist/workers/shared.js +0 -0
- package/dist/workers/single-read-extension.d.ts +14 -7
- package/dist/workers/single-read-extension.js +14 -7
- package/dist/workers/single-read-guard.d.ts +27 -30
- package/dist/workers/single-read-guard.js +36 -36
- package/dist/workers/typeonly-log.d.ts +12 -9
- package/dist/workers/typeonly-log.js +29 -33
- package/dist/workers/worker-channels.d.ts +15 -23
- package/dist/workers/worker-channels.js +15 -23
- package/dist/workers/worker-failure.d.ts +38 -46
- package/dist/workers/worker-failure.js +31 -39
- package/dist/workers/worker-kill.d.ts +25 -26
- package/dist/workers/worker-kill.js +16 -19
- package/dist/workers/worker-profiles.d.ts +54 -56
- package/dist/workers/worker-profiles.js +63 -39
- package/package.json +10 -8
|
@@ -2,11 +2,13 @@ import { spawn as defaultSpawn } from 'node:child_process';
|
|
|
2
2
|
import { Type } from '@sinclair/typebox';
|
|
3
3
|
import { Text } from '@earendil-works/pi-tui';
|
|
4
4
|
import { openCache as defaultOpenCache } from './docs-cache.js';
|
|
5
|
+
import { ensureIndexed as defaultEnsureIndexed } from './docs-index.js';
|
|
6
|
+
import { resolvePackage as defaultResolvePackage } from './docs-resolve.js';
|
|
5
7
|
import { retrieveChunks as defaultRetrieveChunks } from './docs-retrieve.js';
|
|
6
8
|
import { docsLookup } from './docs-lookup.js';
|
|
7
9
|
import { projectCorpus } from './docs-project.js';
|
|
8
10
|
import { docsRaw, packageCorpus, buildVersionBanner } from './docs-core.js';
|
|
9
|
-
import { formatNpmVersionSection } from './npm-version.js';
|
|
11
|
+
import { npmVersionLookup as defaultNpmVersionLookup, formatNpmVersionSection } from './npm-version.js';
|
|
10
12
|
import { childFailureReason, makeWorkerTool, workerAnswer, workerUnavailable } from './shared.js';
|
|
11
13
|
import { isTypeOnlyAnswer } from '../task/type-only-answer.js';
|
|
12
14
|
import { logDocsAnswer } from './typeonly-log.js';
|
|
@@ -27,10 +29,13 @@ const Params = Type.Object({
|
|
|
27
29
|
/**
|
|
28
30
|
* Pull `@see {@link https://…}` pointers out of retrieved .d.ts/README text.
|
|
29
31
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* When the answer to a type-only lookup is not in the package, it is often at the
|
|
33
|
+
* `@see` URL the excerpt being returned already carries. Surfacing that link costs
|
|
34
|
+
* nothing: the pointer is already in hand.
|
|
35
|
+
*
|
|
36
|
+
* Matches `{@link URL}` and a bare `@link URL`, case-insensitively; strips a trailing
|
|
37
|
+
* `.`/`,`/`;` the surrounding prose added; deduplicates. A bare URL with no `@see` is
|
|
38
|
+
* not a pointer and is not returned.
|
|
34
39
|
*/
|
|
35
40
|
export function extractSeeUrls(content) {
|
|
36
41
|
const out = [];
|
|
@@ -57,16 +62,15 @@ function pinDetails(pin) {
|
|
|
57
62
|
return pin ? { versionSource: pin.source, declaredRange: pin.range } : {};
|
|
58
63
|
}
|
|
59
64
|
/**
|
|
60
|
-
* The tool result for a focused-extraction child that failed, shared by both docs paths
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* its version banner and npm-version header; the project path has neither.
|
|
65
|
+
* The tool result for a focused-extraction child that failed, shared by both docs paths.
|
|
66
|
+
* They differ only in `prefix`: the npm path leads every result, failures included, with
|
|
67
|
+
* its version banner and npm-version header; the project path passes ''.
|
|
64
68
|
*
|
|
65
|
-
* It says UNAVAILABLE, so the cache cannot take it.
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
69
|
+
* It says UNAVAILABLE, so the cache cannot take it. Writing a non-zero `childExitCode`
|
|
70
|
+
* and letting `docsCacheable` re-derive the verdict would fail on the case it matters
|
|
71
|
+
* most for: node reports a signal kill as `close` with `code === null`, and
|
|
72
|
+
* child-process.ts settles that as `code ?? 0` — so an aborted child carries exit code
|
|
73
|
+
* ZERO and `"Docs lookup aborted."` would be cached for the whole run.
|
|
70
74
|
*/
|
|
71
75
|
function docsFailureResult(extraction, baseDetails, prefix) {
|
|
72
76
|
return workerUnavailable(prefix + extraction.failure, {
|
|
@@ -76,13 +80,12 @@ function docsFailureResult(extraction, baseDetails, prefix) {
|
|
|
76
80
|
}, childFailureReason({ exitCode: extraction.exitCode, aborted: extraction.aborted }));
|
|
77
81
|
}
|
|
78
82
|
export function registerPiWorkerDocs(pi, internals = {}) {
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
// (projectDocsBudgetNotice)
|
|
84
|
-
//
|
|
85
|
-
// already shows does not bind.
|
|
83
|
+
// Project-lookup budget — OFF unless PI_TASK_PROJECT_DOCS_BUDGET is set, and then
|
|
84
|
+
// per-ATTEMPT by construction: the extension is loaded into a fresh pi child on
|
|
85
|
+
// every spawn, so a restarted attempt starts this counter at 0. The budget it
|
|
86
|
+
// enforces is the one the worker was told about in its prompt
|
|
87
|
+
// (projectDocsBudgetNotice). Enforcement without the notice would be a silent
|
|
88
|
+
// tool failure; the notice without enforcement binds nothing.
|
|
86
89
|
let projectLookups = 0;
|
|
87
90
|
makeWorkerTool(pi, {
|
|
88
91
|
name: 'pi-worker-docs',
|
|
@@ -121,12 +124,9 @@ export function registerPiWorkerDocs(pi, internals = {}) {
|
|
|
121
124
|
+ '- You need docs for a specific newer version than what is installed — use pi-worker-fetch on the upstream docs site',
|
|
122
125
|
parameters: Params,
|
|
123
126
|
async run(params, signal, ctx) {
|
|
124
|
-
// Always node:child_process spawn
|
|
125
|
-
// worker
|
|
126
|
-
//
|
|
127
|
-
// runChild/SpawnFn require — so it threw "cmd must be an array" whenever it ran.
|
|
128
|
-
// It was DEAD in production (pi runs under node) and BYPASSED under bun test
|
|
129
|
-
// (internals.spawn is always injected), i.e. untested, unreachable, and wrong.
|
|
127
|
+
// Always node:child_process spawn, matching fetch-core and every other
|
|
128
|
+
// worker. `SpawnFn` is the node `(cmd, args, opts)` shape; Bun.spawn takes
|
|
129
|
+
// `([cmd, ...args], opts)` and would throw here.
|
|
130
130
|
const spawn = internals.spawn ?? defaultSpawn;
|
|
131
131
|
// Both arms below run the SAME tail — concatenate, extract, verify,
|
|
132
132
|
// format — through `docsLookup`; only the CORPUS differs. The
|
|
@@ -184,12 +184,10 @@ export function registerPiWorkerDocs(pi, internals = {}) {
|
|
|
184
184
|
if (r.kind === 'failed')
|
|
185
185
|
return docsFailureResult(r.extraction, baseDetails, '');
|
|
186
186
|
const { extraction, excerptVerified: verified, body: text } = r;
|
|
187
|
-
// SAME instrumentation channel as the package path below
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
// last docs answer before the worker stopped" was unanswerable: the sink's
|
|
192
|
-
// last row was routinely not the worker's last answer.
|
|
187
|
+
// SAME instrumentation channel as the package path below. Both branches
|
|
188
|
+
// record, or "the last docs answer before the worker stopped" is
|
|
189
|
+
// unanswerable whenever the last answer came from the branch that does
|
|
190
|
+
// not log.
|
|
193
191
|
//
|
|
194
192
|
// `typeOnly` is recorded FALSE with an explicit reason rather than by running
|
|
195
193
|
// the detector: this path never applies it, and the record must say what the
|
|
@@ -239,11 +237,11 @@ export function registerPiWorkerDocs(pi, internals = {}) {
|
|
|
239
237
|
hitCache: rawResult.hitCache,
|
|
240
238
|
cacheError: rawResult.cacheError,
|
|
241
239
|
autoInstalled: rawResult.autoInstalled,
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
//
|
|
246
|
-
//
|
|
240
|
+
// Carry the pin here as the sibling arms do. Without it a package
|
|
241
|
+
// that WAS auto-installed and then failed to re-resolve loses its
|
|
242
|
+
// `versionSource`/`declaredRange`, and the answer cannot say what
|
|
243
|
+
// version it is grounded in. `docsRaw` sets `autoInstallPin` on
|
|
244
|
+
// every error return that follows an auto-install.
|
|
247
245
|
...pinDetails(rawResult.autoInstallPin),
|
|
248
246
|
...npmDetails
|
|
249
247
|
};
|
|
@@ -265,7 +263,6 @@ export function registerPiWorkerDocs(pi, internals = {}) {
|
|
|
265
263
|
...npmDetails
|
|
266
264
|
});
|
|
267
265
|
}
|
|
268
|
-
// kind === 'ok'
|
|
269
266
|
const { pkg, chunks, hitCache, indexingMs, cacheError, autoInstalled } = rawResult;
|
|
270
267
|
const versionBanner = buildVersionBanner(rawResult.autoInstallPin, pkg.name, pkg.version, ctx.cwd);
|
|
271
268
|
const baseDetails = {
|
|
@@ -283,18 +280,16 @@ export function registerPiWorkerDocs(pi, internals = {}) {
|
|
|
283
280
|
return docsFailureResult(r.extraction, baseDetails, versionBanner + npmHeader);
|
|
284
281
|
}
|
|
285
282
|
const { extraction, excerptVerified: verified, body, content: concatenated } = r;
|
|
286
|
-
//
|
|
283
|
+
// A TYPE-ONLY answer is the dangerous failure. "unclear from this package"
|
|
287
284
|
// is honest and already escalates; a signature is a well-formed, confident,
|
|
288
285
|
// on-topic answer that names the very parameter asked about, so the worker
|
|
289
|
-
// stops — and
|
|
290
|
-
// Measured: 14 of 17 live reps terminated on exactly this shape.
|
|
286
|
+
// stops asking — and the semantic gap then gets filled from memory.
|
|
291
287
|
//
|
|
292
288
|
// The retrieved type is KEPT (it is real and useful) and an UNANSWERED banner
|
|
293
289
|
// is prepended, naming the gap and — when the excerpt carries one — the `@see`
|
|
294
|
-
// URL that actually documents the semantics.
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
// parallel execution mode and cannot cleanly spawn a fetch of its own.
|
|
290
|
+
// URL that actually documents the semantics. Prompting the escalation beats
|
|
291
|
+
// performing it here: this tool runs in parallel execution mode and cannot
|
|
292
|
+
// cleanly spawn a fetch of its own.
|
|
298
293
|
const typeOnly = isTypeOnlyAnswer(extraction.answer, params.query);
|
|
299
294
|
let text = versionBanner + npmHeader + body;
|
|
300
295
|
if (typeOnly.typeOnly) {
|
|
@@ -315,15 +310,14 @@ export function registerPiWorkerDocs(pi, internals = {}) {
|
|
|
315
310
|
+ '\nThe declaration that WAS retrieved (context only, not the answer):\n'
|
|
316
311
|
+ body;
|
|
317
312
|
}
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
//
|
|
322
|
-
// denominator. See typeonly-log.ts.
|
|
313
|
+
// Off unless PI_TASK_TYPEONLY_LOG names a sink, and side-effect only: nothing
|
|
314
|
+
// below reads it, and every failure inside is swallowed. It records EVERY
|
|
315
|
+
// answer, flagged or not — a log of firings alone would have no denominator to
|
|
316
|
+
// read a rate against. See typeonly-log.ts.
|
|
323
317
|
//
|
|
324
|
-
// It sits AFTER `text` is final
|
|
318
|
+
// It sits AFTER `text` is final, not above `text`'s first assignment,
|
|
325
319
|
// so the record carries what the worker was actually handed, banner and cited
|
|
326
|
-
// excerpt included, not just the child's prose.
|
|
320
|
+
// excerpt included, not just the child's prose. Position only: logDocsAnswer
|
|
327
321
|
// returns nothing and nothing between the two positions reads it, so the tool's
|
|
328
322
|
// behaviour and its return value are unchanged.
|
|
329
323
|
logDocsAnswer({
|
|
@@ -362,16 +356,12 @@ export function registerPiWorkerDocs(pi, internals = {}) {
|
|
|
362
356
|
// matched against package.json verbatim (npm names are case-sensitive), unlike
|
|
363
357
|
// the cache key, which normalises for phrasing collisions.
|
|
364
358
|
cachePkg: docsCachePkg,
|
|
365
|
-
//
|
|
366
|
-
//
|
|
367
|
-
//
|
|
368
|
-
//
|
|
369
|
-
//
|
|
370
|
-
//
|
|
371
|
-
// as a cache hit to every later sibling task — 52 of run 15's cached entries were
|
|
372
|
-
// "unclear" with hitCache true. One dead end, paid for many times, and escalation
|
|
373
|
-
// could never re-fire because the miss never recurred. So a non-answer is now never
|
|
374
|
-
// stored: the next task that asks pays for a real lookup and can escalate.
|
|
359
|
+
// Process health is NOT answer quality, and this rule only judges quality.
|
|
360
|
+
// not-installed, resolve and cache errors, and aborts return `unavailable`, which
|
|
361
|
+
// makeWorkerTool refuses before reaching here. What is left is real answers, and a
|
|
362
|
+
// child that ran fine and answered "unclear from this package" exits 0 — so a rule
|
|
363
|
+
// keyed on exit code would memoise that non-answer and re-serve it as a hit to
|
|
364
|
+
// every later sibling, with nothing left to re-trigger an escalation.
|
|
375
365
|
//
|
|
376
366
|
// `text` is supplied by makeWorkerTool (shared.ts) alongside details, so the
|
|
377
367
|
// content check needs no new plumbing.
|
|
@@ -379,31 +369,32 @@ export function registerPiWorkerDocs(pi, internals = {}) {
|
|
|
379
369
|
});
|
|
380
370
|
}
|
|
381
371
|
/**
|
|
382
|
-
* The
|
|
383
|
-
*
|
|
372
|
+
* The cache rule for the docs channel, as a NAMED export rather than an anonymous
|
|
373
|
+
* property of an adapter literal.
|
|
384
374
|
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
* exists to prevent: four regexes matching three phrasings, documented at length in
|
|
390
|
-
* abstention.ts, which cost a real bug.
|
|
375
|
+
* As a property of the adapter literal it would be reachable only through
|
|
376
|
+
* `registerTool → execute()`, so a test would have to retype the rule and would then
|
|
377
|
+
* assert against its own copy — green even after the shipped rule changed. Exported,
|
|
378
|
+
* the test imports the rule it is checking.
|
|
391
379
|
*/
|
|
392
380
|
export function docsCacheable(d, text) {
|
|
393
381
|
// Answer QUALITY only. Whether there IS an answer is `WorkerOutcome.kind`, and
|
|
394
382
|
// `makeWorkerTool` has already refused an `unavailable` before reaching here —
|
|
395
|
-
// this
|
|
396
|
-
//
|
|
383
|
+
// opening this with `childExitCode === 0` memoises an aborted lookup for the
|
|
384
|
+
// whole run, because a signal-killed child satisfies it.
|
|
397
385
|
return d.typeOnly !== true && d.excerptVerified !== false && !isAbstention(text);
|
|
398
386
|
}
|
|
399
|
-
/** The docs cache key: a package's answer is per (module, question)
|
|
400
|
-
*
|
|
387
|
+
/** The docs cache key: a package's answer is per (module, question), with the question
|
|
388
|
+
* lowercased and its whitespace collapsed so phrasing variants share one entry. Returns
|
|
389
|
+
* null for the project-source `.` lookup, which is never cached — the working tree
|
|
390
|
+
* mutates as tasks implement. */
|
|
401
391
|
export function docsCacheKey(params) {
|
|
402
392
|
return params.module === '.' ?
|
|
403
393
|
null
|
|
404
394
|
: `${normalizeQuery(params.module)}::${normalizeQuery(params.query)}`;
|
|
405
395
|
}
|
|
406
|
-
/** Package provenance for per-entry resume invalidation
|
|
396
|
+
/** Package provenance for per-entry resume invalidation: the package ROOT of the
|
|
397
|
+
* specifier (`hono/client` → `hono`), and undefined for the project-source `.`. */
|
|
407
398
|
export function docsCachePkg(params) {
|
|
408
399
|
return params.module === '.' ? undefined : packageRootOf(params.module);
|
|
409
400
|
}
|
|
@@ -24,9 +24,13 @@ export interface PiWorkerFetchInternals {
|
|
|
24
24
|
}
|
|
25
25
|
export declare function registerPiWorkerFetch(pi: ExtensionAPI, internals?: PiWorkerFetchInternals): void;
|
|
26
26
|
/**
|
|
27
|
-
* The
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* The cache rule for the fetch channel, named for the same reason as `docsCacheable`:
|
|
28
|
+
* left anonymous inside the adapter literal, a test can only hand-retype it, and then
|
|
29
|
+
* asserts against a copy a change to the shipped rule would leave green.
|
|
30
|
+
*
|
|
31
|
+
* A coverage MISS is cacheable. "not covered by this page" is a real, correct answer
|
|
32
|
+
* ABOUT that page, and re-fetching cannot change it — only the abstention sentinel is
|
|
33
|
+
* refused.
|
|
30
34
|
*/
|
|
31
35
|
export declare function fetchCacheable(_d: Pick<FetchDetails, never>, text: string): boolean;
|
|
32
36
|
/** The fetch cache key. URL verbatim (path case can matter), question normalised —
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Type } from '@sinclair/typebox';
|
|
2
2
|
import { Text } from '@earendil-works/pi-tui';
|
|
3
|
-
import { FetchAndCleanError } from './html-clean.js';
|
|
3
|
+
import { fetchAndClean as defaultFetchAndClean, FetchAndCleanError } from './html-clean.js';
|
|
4
4
|
import { fetchFocused } from './fetch-core.js';
|
|
5
5
|
import { formatResultText } from '../shared/child-output.js';
|
|
6
6
|
import { childFailureReason, makeWorkerTool, workerAnswer, workerUnavailable } from './shared.js';
|
|
@@ -47,8 +47,8 @@ export function registerPiWorkerFetch(pi, internals = {}) {
|
|
|
47
47
|
spawn: internals.spawn
|
|
48
48
|
});
|
|
49
49
|
// Child failure is decided and formatted once, inside the focused extractor
|
|
50
|
-
// (workers/focused-extractor.ts) —
|
|
51
|
-
// ChildOutcome just
|
|
50
|
+
// (workers/focused-extractor.ts) — re-mapping the result back into a
|
|
51
|
+
// ChildOutcome here would just ask formatChildFailure the same question.
|
|
52
52
|
if (result.failure !== undefined) {
|
|
53
53
|
return workerUnavailable(result.failure, { childExitCode: result.childExitCode }, childFailureReason({
|
|
54
54
|
exitCode: result.childExitCode,
|
|
@@ -85,30 +85,38 @@ export function registerPiWorkerFetch(pi, internals = {}) {
|
|
|
85
85
|
text += `\n${theme.fg('dim', ` query: ${truncatedQuery}`)}`;
|
|
86
86
|
return new Text(text, 0, 0);
|
|
87
87
|
},
|
|
88
|
-
// Cache fetch answers per run
|
|
89
|
-
//
|
|
90
|
-
//
|
|
88
|
+
// Cache fetch answers per run, or the same page is re-fetched by every sibling
|
|
89
|
+
// task. Both parts key the entry: the URL trimmed but otherwise VERBATIM, since
|
|
90
|
+
// path case can matter, and the query lowercased with its whitespace collapsed
|
|
91
|
+
// so phrasing variants share an entry. Same page, different question is a
|
|
91
92
|
// different answer.
|
|
92
93
|
cacheKey: fetchCacheKey,
|
|
93
|
-
// Only a completed fetch
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
94
|
+
// Only a completed fetch is a real answer; invalid-URL, fetch failures and
|
|
95
|
+
// aborts come back as `unavailable`, which makeWorkerTool refuses before the
|
|
96
|
+
// cache is consulted at all.
|
|
97
|
+
//
|
|
98
|
+
// Process health is NOT answer quality. A child that ran fine and answered
|
|
99
|
+
// "unclear from this page" exits 0, so caching on health alone memoises the
|
|
100
|
+
// NON-ANSWER and re-serves it to every later sibling task — one dead end paid
|
|
101
|
+
// for many times, with escalation unable to re-fire because the miss never
|
|
102
|
+
// recurs. One predicate covers every corpus (workers/abstention.ts).
|
|
101
103
|
cacheable: fetchCacheable
|
|
102
104
|
});
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
105
|
-
* The
|
|
106
|
-
*
|
|
107
|
-
*
|
|
107
|
+
* The cache rule for the fetch channel, named for the same reason as `docsCacheable`:
|
|
108
|
+
* left anonymous inside the adapter literal, a test can only hand-retype it, and then
|
|
109
|
+
* asserts against a copy a change to the shipped rule would leave green.
|
|
110
|
+
*
|
|
111
|
+
* A coverage MISS is cacheable. "not covered by this page" is a real, correct answer
|
|
112
|
+
* ABOUT that page, and re-fetching cannot change it — only the abstention sentinel is
|
|
113
|
+
* refused.
|
|
108
114
|
*/
|
|
109
115
|
export function fetchCacheable(_d, text) {
|
|
110
|
-
// Answer QUALITY only — see docsCacheable.
|
|
111
|
-
//
|
|
116
|
+
// Answer QUALITY only — see docsCacheable. This predicate returns true for
|
|
117
|
+
// `"Fetch aborted."` on its own; what keeps an aborted fetch out of the cache is
|
|
118
|
+
// the `unavailable` outcome upstream. Leading the rule with `childExitCode === 0`
|
|
119
|
+
// would not, because an aborted child settles at exit code 0.
|
|
112
120
|
return !isAbstention(text);
|
|
113
121
|
}
|
|
114
122
|
/** The fetch cache key. URL verbatim (path case can matter), question normalised —
|
|
@@ -41,8 +41,9 @@ export function registerPiWorkerSearch(pi, internals = {}) {
|
|
|
41
41
|
return workerUnavailable(result.message, { resultCount: 0 }, result.kind);
|
|
42
42
|
}
|
|
43
43
|
const { results } = result;
|
|
44
|
-
// Zero results IS an answer: the search ran and the web has nothing
|
|
45
|
-
// Only a search that could
|
|
44
|
+
// Zero results IS an answer: the search ran and the web has nothing, so it
|
|
45
|
+
// comes back as `workerAnswer` with resultCount 0. Only a search that could
|
|
46
|
+
// not run — no key, or an engine error — is `unavailable`.
|
|
46
47
|
if (results.length === 0) {
|
|
47
48
|
return workerAnswer(`No results for: ${params.query}`, { resultCount: 0 });
|
|
48
49
|
}
|
|
@@ -57,13 +58,16 @@ export function registerPiWorkerSearch(pi, internals = {}) {
|
|
|
57
58
|
}
|
|
58
59
|
return new Text(text, 0, 0);
|
|
59
60
|
},
|
|
60
|
-
// Cache search results per run
|
|
61
|
-
// the live web
|
|
62
|
-
//
|
|
63
|
-
//
|
|
61
|
+
// Cache search results per run, or the same query re-run by a sibling task hits
|
|
62
|
+
// the live web again. Three parts key the entry: the PROVIDER, because two
|
|
63
|
+
// engines' result sets for one query are different answers and must not serve
|
|
64
|
+
// for each other; the query, lowercased and whitespace-collapsed by
|
|
65
|
+
// `normalizeQuery` so phrasing variants share an entry; and the COUNT, because a
|
|
66
|
+
// larger request is a different result set.
|
|
64
67
|
cacheKey: params => `${provider()}::${normalizeQuery(params.query)}::${params.count ?? ''}`,
|
|
65
|
-
// Only a non-empty result set is worth caching
|
|
66
|
-
//
|
|
68
|
+
// Only a non-empty result set is worth caching. An empty one falls through so a
|
|
69
|
+
// later attempt can succeed; no-key and engine errors never reach this at all,
|
|
70
|
+
// since makeWorkerTool refuses to store an `unavailable` outcome.
|
|
67
71
|
cacheable: d => d.resultCount > 0
|
|
68
72
|
});
|
|
69
73
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pi-worker — minimal subagent tool.
|
|
3
3
|
*
|
|
4
|
-
* Spawns
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Spawns one child pi per call and returns its assistant text. `childBaseArgs`
|
|
5
|
+
* gives the child `--print --no-skills --no-extensions --no-prompt-templates
|
|
6
|
+
* --no-context-files --no-session`, and runWorker adds `--mode json` plus its
|
|
7
|
+
* default `--tools read,grep,find,ls`.
|
|
8
|
+
*
|
|
9
|
+
* That tool string is what makes the child read-only and non-recursive: no bash,
|
|
10
|
+
* write or edit, and no `pi-worker` of its own to dispatch. `--no-extensions`
|
|
11
|
+
* disables DISCOVERY, so the user's whitelisted `-e` extensions are still loaded
|
|
12
|
+
* — the tool whitelist, not the extension flag, is the bound that holds.
|
|
8
13
|
*/
|
|
9
14
|
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
10
15
|
export declare function registerPiWorker(pi: ExtensionAPI): void;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pi-worker — minimal subagent tool.
|
|
3
3
|
*
|
|
4
|
-
* Spawns
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Spawns one child pi per call and returns its assistant text. `childBaseArgs`
|
|
5
|
+
* gives the child `--print --no-skills --no-extensions --no-prompt-templates
|
|
6
|
+
* --no-context-files --no-session`, and runWorker adds `--mode json` plus its
|
|
7
|
+
* default `--tools read,grep,find,ls`.
|
|
8
|
+
*
|
|
9
|
+
* That tool string is what makes the child read-only and non-recursive: no bash,
|
|
10
|
+
* write or edit, and no `pi-worker` of its own to dispatch. `--no-extensions`
|
|
11
|
+
* disables DISCOVERY, so the user's whitelisted `-e` extensions are still loaded
|
|
12
|
+
* — the tool whitelist, not the extension flag, is the bound that holds.
|
|
8
13
|
*/
|
|
9
14
|
import { Text } from '@earendil-works/pi-tui';
|
|
10
15
|
import { Type } from '@sinclair/typebox';
|
|
@@ -41,24 +46,26 @@ export function registerPiWorker(pi) {
|
|
|
41
46
|
+ '- The task needs the web — use `pi-worker-search` / `pi-worker-fetch`',
|
|
42
47
|
parameters: WorkerParams,
|
|
43
48
|
async run(params, signal, ctx) {
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
49
|
+
// `adhoc` guards, `research` thinking — deliberately not the same word.
|
|
50
|
+
// Guards answer "how may this child die"; the reasoning group answers
|
|
51
|
+
// "how hard may it think", and this is the same read-only exploration
|
|
52
|
+
// loop the research workers run, just dispatched by a model rather than
|
|
53
|
+
// by the pipeline. See the header of worker-profiles.ts.
|
|
48
54
|
const result = await runWorker({
|
|
49
55
|
prompt: params.prompt,
|
|
50
56
|
cwd: ctx.cwd,
|
|
51
57
|
signal,
|
|
52
58
|
profile: 'adhoc',
|
|
53
|
-
// The
|
|
54
|
-
//
|
|
59
|
+
// The `adhoc` profile carries NO wall clock (`timeoutMs: 0`); what
|
|
60
|
+
// bounds this worker is the user's own `stuck reply retry` setting,
|
|
61
|
+
// which kills on SILENCE and never on slowness. It is an INPUT and
|
|
55
62
|
// not policy for the same reason the gate's two ceilings are: the
|
|
56
63
|
// number is the user's, the decision to arm it is the profile's.
|
|
57
64
|
policyInputs: { streamInactivityMs: getConfig().streamInactivityMs },
|
|
58
|
-
// The session's own window, handed down.
|
|
59
|
-
//
|
|
60
|
-
// its window is the honest one. Without this the churn
|
|
61
|
-
// cannot fire — see RunWorkerInput.contextWindow.
|
|
65
|
+
// The session's own window, handed down. No child argv anywhere in
|
|
66
|
+
// this codebase passes `-m`, so the parent's model IS the child's
|
|
67
|
+
// model and its window is the honest one. Without this the churn
|
|
68
|
+
// rule cannot fire — see RunWorkerInput.contextWindow.
|
|
62
69
|
contextWindow: getParentContextWindow(ctx) || 'unknown',
|
|
63
70
|
thinking: groupThinkingArgs('research')
|
|
64
71
|
});
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
* One-line startup hint shown when /task-config asks for a thinking level the
|
|
3
3
|
* connected model will not honour.
|
|
4
4
|
*
|
|
5
|
-
* WHY IT HAS TO EXIST. pi
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* WHY IT HAS TO EXIST. pi silently rewrites the level and says nothing. Its own
|
|
6
|
+
* `clampThinkingLevel` (pi-ai models.js) shows both halves: a model with
|
|
7
|
+
* `reasoning: false` supports only `["off"]`, so every requested level collapses
|
|
8
|
+
* there; and a level the model's `thinkingLevelMap` nulls is filtered out, after
|
|
9
|
+
* which the clamp scans UPWARD before downward — so asking for `off` on a model
|
|
10
|
+
* that nulls `off` gets the next level that IS available, and thinking stays on.
|
|
11
|
+
* A reasoning profile the user set and the model erased is worse than no profile
|
|
12
|
+
* feature, because it looks like it worked.
|
|
12
13
|
*
|
|
13
14
|
* ANTI-NAG. This warns once per session and clears on the first keystroke, and
|
|
14
15
|
* that is the whole mechanism — deliberately no "already warned about model X"
|
|
15
16
|
* file. Such a record goes stale the moment models.json is edited, and would
|
|
16
17
|
* suppress the warning at exactly the moment a `/model` switch made it true.
|
|
17
|
-
* brave-warning.ts nags every session for a standing misconfiguration and that
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* model and nothing renders at all.
|
|
18
|
+
* brave-warning.ts nags every session for a standing misconfiguration and that is
|
|
19
|
+
* correct; this is the same class. Setting a group back to `inherit` is what
|
|
20
|
+
* silences it: an all-`inherit` table yields no mismatches for any model.
|
|
21
21
|
*/
|
|
22
22
|
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
23
23
|
import { type GroupSetting, type ReasoningGroup } from '../config/reasoning.js';
|
|
@@ -28,18 +28,19 @@ import { type ChatTemplateCaps } from '../shared/model-endpoint.js';
|
|
|
28
28
|
*
|
|
29
29
|
* Names the MODEL it checked, because children carry no `-m` and resolve pi's
|
|
30
30
|
* default model, which need not be the host session's — a warning that does not
|
|
31
|
-
* say what it looked at cannot be acted on. Names at most two groups
|
|
32
|
-
*
|
|
33
|
-
* reads.
|
|
31
|
+
* say what it looked at cannot be acted on. Names at most two groups and appends
|
|
32
|
+
* `(+N more)` only when there are more than two, since a line long enough to list
|
|
33
|
+
* every group is a line nobody reads. Null when nothing mismatched.
|
|
34
34
|
*/
|
|
35
35
|
export declare function formatReasoningWarning(modelName: string, mismatches: readonly ReasoningMismatch[]): string | null;
|
|
36
36
|
/**
|
|
37
37
|
* The extra cause line, when the SERVER disagrees with models.json.
|
|
38
38
|
*
|
|
39
39
|
* This is the `/login llama.cpp` case and the only thing the host-side clamp
|
|
40
|
-
* cannot see: pi
|
|
41
|
-
* a perfectly capable server is described to pi
|
|
42
|
-
* Returns null whenever the two agree,
|
|
40
|
+
* cannot see: pi ships llama.cpp as a built-in extension whose provider entry
|
|
41
|
+
* hardcodes `reasoning: false`, so a perfectly capable server is described to pi
|
|
42
|
+
* as having no reasoning at all. Returns null whenever the two agree, and null
|
|
43
|
+
* when the probe answered nothing, so an unreachable server adds no cause line.
|
|
43
44
|
*/
|
|
44
45
|
export declare function formatCapabilityConflict(serverSupportsEffort: boolean | null, modelDeclaresReasoning: boolean): string | null;
|
|
45
46
|
export declare function registerReasoningWarning(pi: ExtensionAPI,
|