pi-advisor-flow 0.5.6 → 0.6.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/CHANGELOG.md +13 -0
- package/dist/index.js +1371 -1128
- package/extensions/index.ts +9 -9
- package/package.json +3 -1
- package/src/{untracked.ts → attachments.ts} +2 -5
- package/src/commands/activation-preparation.ts +6 -6
- package/src/commands/activation.ts +7 -7
- package/src/commands/lifecycle.ts +5 -5
- package/src/commands/manual-command.ts +13 -9
- package/src/commands/manual-consultation.ts +8 -8
- package/src/commands/manual-progress.ts +3 -3
- package/src/commands/model-commands.ts +6 -6
- package/src/commands/model-options.ts +4 -4
- package/src/commands/model-picker.ts +2 -2
- package/src/commands/registration.ts +8 -8
- package/src/commands/renderers.ts +5 -5
- package/src/commands/runtime.ts +8 -8
- package/src/commands/settings-commands.ts +8 -8
- package/src/commands/settings-persistence.ts +4 -4
- package/src/commands/types.ts +5 -13
- package/src/commands.ts +2 -2
- package/src/config/args.ts +3 -3
- package/src/config/defaults.ts +3 -3
- package/src/config/schema.ts +322 -0
- package/src/config/state.ts +2 -2
- package/src/config/storage.ts +20 -117
- package/src/config/types.ts +1 -1
- package/src/config/validation.ts +61 -181
- package/src/config.ts +7 -7
- package/src/content-utils.ts +30 -0
- package/src/conversation.ts +13 -168
- package/src/git.ts +4 -18
- package/src/herdr.ts +6 -8
- package/src/model-stream.ts +5 -8
- package/src/outcomes.ts +2 -5
- package/src/pi-settings.ts +59 -0
- package/src/preferences.ts +2 -2
- package/src/redaction.ts +50 -0
- package/src/scout-context.ts +121 -485
- package/src/scout-curation.ts +84 -0
- package/src/scout-groups.ts +485 -0
- package/src/scout-protocol.ts +122 -0
- package/src/scout-reconstruct.ts +44 -0
- package/src/scout-types.ts +66 -0
- package/src/scout.ts +53 -63
- package/src/session-state.ts +119 -76
- package/src/tool-result-cap.ts +88 -0
- package/src/tools/consult-context.ts +155 -0
- package/src/tools/consultation.ts +71 -220
- package/src/tools/gate-policy.ts +5 -5
- package/src/tools/gate-protocol.ts +2 -2
- package/src/tools/loop-gate.ts +70 -61
- package/src/tools/prompts.ts +4 -7
- package/src/tools/register-ask-advisor.ts +9 -14
- package/src/tools/register-lifecycle.ts +7 -7
- package/src/tools/register-outcome.ts +5 -5
- package/src/tools/register-renderers.ts +5 -5
- package/src/tools/registration.ts +10 -10
- package/src/tools/render-advisor-result.ts +11 -8
- package/src/tools/render-common.ts +25 -13
- package/src/tools/scout-status.ts +5 -5
- package/src/tools/session.ts +1 -1
- package/src/tools/types.ts +7 -7
- package/src/tools.ts +9 -9
- package/src/ui/manual-dialog-render.ts +2 -2
- package/src/ui/manual-dialog.ts +4 -9
- package/src/ui/model-selector.ts +1 -1
- package/src/ui/settings-formatting.ts +2 -2
- package/src/ui/settings-items.ts +4 -4
- package/src/ui/settings-mutations.ts +2 -2
- package/src/ui/settings-selector.ts +5 -5
- package/src/ui/text-setting-submenu.ts +1 -1
- package/src/ui/types.ts +2 -2
- package/src/ui.ts +4 -4
- package/src/usage.ts +1 -6
package/extensions/index.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { registerCommands } from "../src/commands/registration.
|
|
3
|
-
import { setHerdrBlockedEmitter } from "../src/herdr.
|
|
4
|
-
import { AdvisorSessionState } from "../src/session-state.
|
|
2
|
+
import { registerCommands } from "../src/commands/registration.ts";
|
|
3
|
+
import { setHerdrBlockedEmitter } from "../src/herdr.ts";
|
|
4
|
+
import { AdvisorSessionState } from "../src/session-state.ts";
|
|
5
5
|
import {
|
|
6
6
|
consultAdvisor as consultAdvisorImplementation,
|
|
7
7
|
runAdvisorGate as runAdvisorGateImplementation,
|
|
8
|
-
} from "../src/tools/consultation.
|
|
9
|
-
import { parseAutomaticDecision as parseAutomaticDecisionImplementation } from "../src/tools/gate-protocol.
|
|
10
|
-
import { registerAdvisorTool } from "../src/tools/registration.
|
|
11
|
-
import { ScoutStatusManager } from "../src/tools/scout-status.
|
|
8
|
+
} from "../src/tools/consultation.ts";
|
|
9
|
+
import { parseAutomaticDecision as parseAutomaticDecisionImplementation } from "../src/tools/gate-protocol.ts";
|
|
10
|
+
import { registerAdvisorTool } from "../src/tools/registration.ts";
|
|
11
|
+
import { ScoutStatusManager } from "../src/tools/scout-status.ts";
|
|
12
12
|
|
|
13
|
-
export type { AdvisorConfig, GateFailureMode } from "../src/config/types.
|
|
13
|
+
export type { AdvisorConfig, GateFailureMode } from "../src/config/types.ts";
|
|
14
14
|
export type {
|
|
15
15
|
AdvisorConsultationResult,
|
|
16
16
|
AdvisorGateFailure,
|
|
@@ -19,7 +19,7 @@ export type {
|
|
|
19
19
|
ConsultationTrigger,
|
|
20
20
|
GateDecision,
|
|
21
21
|
GateTrigger,
|
|
22
|
-
} from "../src/tools/types.
|
|
22
|
+
} from "../src/tools/types.ts";
|
|
23
23
|
export const consultAdvisor = (
|
|
24
24
|
...args: Parameters<typeof consultAdvisorImplementation>
|
|
25
25
|
) => consultAdvisorImplementation(...args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-advisor-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Advanced Executor/Advisor flow for Pi, fully configurable and extendable.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"build": "bun build ./extensions/index.ts --outfile dist/index.js --target node --format esm --external @earendil-works/pi-ai --external @earendil-works/pi-coding-agent --external @earendil-works/pi-tui --external typebox",
|
|
37
37
|
"check:boundaries": "node scripts/check-module-boundaries.mjs",
|
|
38
38
|
"format": "bunx ultracite fix --linter-enabled=false",
|
|
39
|
+
"knip": "knip",
|
|
39
40
|
"lint": "bunx ultracite check",
|
|
40
41
|
"lint:fix": "bunx ultracite fix",
|
|
41
42
|
"prepack": "bun run build >/dev/null",
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"@types/node": "^26.4.1",
|
|
69
70
|
"bun-types": "1.4.1",
|
|
70
71
|
"husky": "^9.1.7",
|
|
72
|
+
"knip": "^6.35.1",
|
|
71
73
|
"lint-staged": "^17.4.1",
|
|
72
74
|
"typebox": "^1.3.25",
|
|
73
75
|
"typescript": "^7.0.2",
|
|
@@ -2,18 +2,15 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
import { constants } from "node:fs";
|
|
3
3
|
import { lstat, open, realpath } from "node:fs/promises";
|
|
4
4
|
import { isAbsolute, relative, resolve } from "node:path";
|
|
5
|
-
import { redactAndCapText } from "./
|
|
5
|
+
import { redactAndCapText } from "./redaction.ts";
|
|
6
6
|
|
|
7
7
|
export const ADVISOR_FILE_MAX_BYTES = 8 * 1024;
|
|
8
|
-
|
|
9
|
-
export const UNTRACKED_FILE_MAX_BYTES = ADVISOR_FILE_MAX_BYTES;
|
|
10
|
-
export const UNTRACKED_TOTAL_MAX_BYTES = ADVISOR_FILES_TOTAL_MAX_BYTES;
|
|
8
|
+
const ADVISOR_FILES_TOTAL_MAX_BYTES = 24 * 1024;
|
|
11
9
|
export interface UntrackedAttachment {
|
|
12
10
|
bytes: number;
|
|
13
11
|
path: string;
|
|
14
12
|
text: string;
|
|
15
13
|
}
|
|
16
|
-
export type TrackedAttachment = UntrackedAttachment;
|
|
17
14
|
|
|
18
15
|
const PATH_SEGMENTS = /[\\/]/;
|
|
19
16
|
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
setAdvisorRef,
|
|
10
10
|
setExecutorEffortRef,
|
|
11
11
|
setExecutorRef,
|
|
12
|
-
} from "../config/state.
|
|
13
|
-
import { loadConfig } from "../config/storage.
|
|
12
|
+
} from "../config/state.ts";
|
|
13
|
+
import { loadConfig } from "../config/storage.ts";
|
|
14
14
|
import {
|
|
15
15
|
getAvailableModelRefs,
|
|
16
16
|
getExplicitModelError,
|
|
17
17
|
planActivationModels,
|
|
18
|
-
} from "./model-options.
|
|
19
|
-
import { selectAdvisorModels } from "./model-picker.
|
|
20
|
-
import { notify } from "./runtime.
|
|
21
|
-
import type { CommandRuntime } from "./types.
|
|
18
|
+
} from "./model-options.ts";
|
|
19
|
+
import { selectAdvisorModels } from "./model-picker.ts";
|
|
20
|
+
import { notify } from "./runtime.ts";
|
|
21
|
+
import type { CommandRuntime } from "./types.ts";
|
|
22
22
|
|
|
23
23
|
export interface PreparedActivationModels {
|
|
24
24
|
pendingExecutor?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { parseArgs } from "../config/args.
|
|
2
|
+
import { parseArgs } from "../config/args.ts";
|
|
3
3
|
import {
|
|
4
4
|
advisorEffortRef,
|
|
5
5
|
advisorRef,
|
|
@@ -11,20 +11,20 @@ import {
|
|
|
11
11
|
setContextMaxCharsRef,
|
|
12
12
|
setExecutorEffortRef,
|
|
13
13
|
setExecutorRef,
|
|
14
|
-
} from "../config/state.
|
|
15
|
-
import { saveConfig } from "../config/storage.
|
|
14
|
+
} from "../config/state.ts";
|
|
15
|
+
import { saveConfig } from "../config/storage.ts";
|
|
16
16
|
import {
|
|
17
17
|
loadCommandConfig,
|
|
18
18
|
prepareActivationModels,
|
|
19
|
-
} from "./activation-preparation.
|
|
19
|
+
} from "./activation-preparation.ts";
|
|
20
20
|
import {
|
|
21
21
|
ADVISOR_ACTIVATION_EXPLANATION,
|
|
22
22
|
findConfiguredModel,
|
|
23
23
|
hasAdvisorOverride,
|
|
24
24
|
hasExecutorOverride,
|
|
25
|
-
} from "./model-options.
|
|
26
|
-
import { notify } from "./runtime.
|
|
27
|
-
import type { CommandRuntime, ThinkingLevel } from "./types.
|
|
25
|
+
} from "./model-options.ts";
|
|
26
|
+
import { notify } from "./runtime.ts";
|
|
27
|
+
import type { CommandRuntime, ThinkingLevel } from "./types.ts";
|
|
28
28
|
|
|
29
29
|
const resolveActivationModels = async (
|
|
30
30
|
runtime: CommandRuntime,
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
executorRef,
|
|
5
5
|
getPersistedModelRefs,
|
|
6
6
|
setExecutorRef,
|
|
7
|
-
} from "../config/state.
|
|
8
|
-
import { loadConfig, saveConfig } from "../config/storage.
|
|
9
|
-
import { herdrAdvisorActivity } from "../herdr.
|
|
10
|
-
import { notify } from "./runtime.
|
|
11
|
-
import type { CommandRuntime } from "./types.
|
|
7
|
+
} from "../config/state.ts";
|
|
8
|
+
import { loadConfig, saveConfig } from "../config/storage.ts";
|
|
9
|
+
import { herdrAdvisorActivity } from "../herdr.ts";
|
|
10
|
+
import { notify } from "./runtime.ts";
|
|
11
|
+
import type { CommandRuntime } from "./types.ts";
|
|
12
12
|
|
|
13
13
|
export type ActivateAdvisor = (
|
|
14
14
|
args: string,
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
getAdvisorMaxCallsPerSession,
|
|
3
3
|
getAdvisorSettings,
|
|
4
4
|
isSimpleMode,
|
|
5
|
-
} from "../config/state.
|
|
6
|
-
import type { GitContextLevel } from "../git.
|
|
7
|
-
import { resolveAdvisorRequest } from "../tools/render-common.
|
|
8
|
-
import { ManualAdvisorDialog } from "../ui/manual-dialog.
|
|
9
|
-
import type { ManualAdvisorRequest } from "../ui/types.
|
|
10
|
-
import { loadCommandConfig } from "./activation-preparation.
|
|
11
|
-
import { startManualConsultation } from "./manual-consultation.
|
|
12
|
-
import type { CommandRuntime, ManualAdvisorProgressState } from "./types.
|
|
5
|
+
} from "../config/state.ts";
|
|
6
|
+
import type { GitContextLevel } from "../git.ts";
|
|
7
|
+
import { resolveAdvisorRequest } from "../tools/render-common.ts";
|
|
8
|
+
import { ManualAdvisorDialog } from "../ui/manual-dialog.ts";
|
|
9
|
+
import type { ManualAdvisorRequest } from "../ui/types.ts";
|
|
10
|
+
import { loadCommandConfig } from "./activation-preparation.ts";
|
|
11
|
+
import { startManualConsultation } from "./manual-consultation.ts";
|
|
12
|
+
import type { CommandRuntime, ManualAdvisorProgressState } from "./types.ts";
|
|
13
13
|
|
|
14
14
|
export const registerManualCommand = (runtime: CommandRuntime) => {
|
|
15
15
|
runtime.pi.registerCommand("advisor-manual", {
|
|
@@ -93,7 +93,11 @@ export const registerManualCommand = (runtime: CommandRuntime) => {
|
|
|
93
93
|
runtime.scoutStatus.register(scoutStatusToken);
|
|
94
94
|
runtime.manualConsultations.set(controller, scoutStatusToken);
|
|
95
95
|
runtime.pi.appendEntry?.("advisor-manual-call", { progressId, question });
|
|
96
|
-
|
|
96
|
+
// Intentional fire-and-forget: the consultation streams after the command
|
|
97
|
+
// handler returns. void satisfies noFloatingPromises; noVoid is ignored here
|
|
98
|
+
// because this Biome version offers no ignoreVoidAsExpression option.
|
|
99
|
+
// biome-ignore lint/complexity/noVoid: marks an intentional fire-and-forget promise
|
|
100
|
+
void startManualConsultation(
|
|
97
101
|
runtime,
|
|
98
102
|
ctx,
|
|
99
103
|
question,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { advisorRef } from "../config/state.
|
|
3
|
-
import type { GitContextLevel } from "../git.
|
|
4
|
-
import { herdrAdvisorActivity, notifyHerdrAdvisorFailure } from "../herdr.
|
|
5
|
-
import { appendScoutLifecycleEntry } from "../tools/scout-status.
|
|
6
|
-
import type { ScoutToolDetails } from "../tools/types.
|
|
7
|
-
import { advisorUsageCost, snapshotAdvisorUsage } from "../usage.
|
|
8
|
-
import { notify } from "./runtime.
|
|
9
|
-
import type { CommandRuntime, ManualAdvisorProgressState } from "./types.
|
|
2
|
+
import { advisorRef } from "../config/state.ts";
|
|
3
|
+
import type { GitContextLevel } from "../git.ts";
|
|
4
|
+
import { herdrAdvisorActivity, notifyHerdrAdvisorFailure } from "../herdr.ts";
|
|
5
|
+
import { appendScoutLifecycleEntry } from "../tools/scout-status.ts";
|
|
6
|
+
import type { ScoutToolDetails } from "../tools/types.ts";
|
|
7
|
+
import { advisorUsageCost, snapshotAdvisorUsage } from "../usage.ts";
|
|
8
|
+
import { notify } from "./runtime.ts";
|
|
9
|
+
import type { CommandRuntime, ManualAdvisorProgressState } from "./types.ts";
|
|
10
10
|
|
|
11
11
|
export const startManualConsultation = (
|
|
12
12
|
runtime: CommandRuntime,
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
renderAdvisorCallBox,
|
|
6
6
|
renderThinkingMarkdown,
|
|
7
7
|
SPINNER_FRAMES,
|
|
8
|
-
} from "../tools/render-common.
|
|
9
|
-
import { renderScoutDetails } from "../tools/scout-status.
|
|
10
|
-
import type { ManualAdvisorProgressState } from "./types.
|
|
8
|
+
} from "../tools/render-common.ts";
|
|
9
|
+
import { renderScoutDetails } from "../tools/scout-status.ts";
|
|
10
|
+
import type { ManualAdvisorProgressState } from "./types.ts";
|
|
11
11
|
|
|
12
12
|
export class ManualAdvisorProgressComponent implements Component {
|
|
13
13
|
private readonly question: string | undefined;
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
setAdvisorRef,
|
|
9
9
|
setExecutorEffortRef,
|
|
10
10
|
setExecutorRef,
|
|
11
|
-
} from "../config/state.
|
|
12
|
-
import { saveConfig } from "../config/storage.
|
|
13
|
-
import { activateAdvisor } from "./activation.
|
|
14
|
-
import { loadCommandConfig } from "./activation-preparation.
|
|
15
|
-
import { selectAdvisorModels } from "./model-picker.
|
|
16
|
-
import type { CommandRuntime } from "./types.
|
|
11
|
+
} from "../config/state.ts";
|
|
12
|
+
import { saveConfig } from "../config/storage.ts";
|
|
13
|
+
import { activateAdvisor } from "./activation.ts";
|
|
14
|
+
import { loadCommandConfig } from "./activation-preparation.ts";
|
|
15
|
+
import { selectAdvisorModels } from "./model-picker.ts";
|
|
16
|
+
import type { CommandRuntime } from "./types.ts";
|
|
17
17
|
|
|
18
18
|
export const registerModelCommands = (runtime: CommandRuntime) => {
|
|
19
19
|
runtime.pi.registerCommand("advisor", {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { type getPersistedModelRefs, splitRef } from "../config/state.
|
|
3
|
-
import type { ContextPreset } from "../ui/types.
|
|
2
|
+
import { type getPersistedModelRefs, splitRef } from "../config/state.ts";
|
|
3
|
+
import type { ContextPreset } from "../ui/types.ts";
|
|
4
4
|
|
|
5
5
|
export const DEFAULT_EFFORT_LEVEL = "Default (Model Default)";
|
|
6
|
-
|
|
6
|
+
const SELECTED_PREFIX = "✓ ";
|
|
7
7
|
export const EFFORT_LEVELS = [
|
|
8
8
|
DEFAULT_EFFORT_LEVEL,
|
|
9
9
|
"off",
|
|
@@ -105,7 +105,7 @@ export const getAvailableModelRefs = (
|
|
|
105
105
|
.map((model) => `${model.provider}/${model.id}`);
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
const isSelectableModel = (
|
|
109
109
|
ctx: ExtensionContext,
|
|
110
110
|
ref: string | undefined,
|
|
111
111
|
availableRefs: Set<string> | undefined
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { SearchableModelSelector } from "../ui/model-selector.
|
|
2
|
+
import { SearchableModelSelector } from "../ui/model-selector.ts";
|
|
3
3
|
import {
|
|
4
4
|
effortChoices,
|
|
5
5
|
getAvailableModelRefs,
|
|
6
6
|
selectedEffort,
|
|
7
|
-
} from "./model-options.
|
|
7
|
+
} from "./model-options.ts";
|
|
8
8
|
|
|
9
9
|
export interface AdvisorModelSelection {
|
|
10
10
|
advisor: string;
|
|
@@ -2,14 +2,14 @@ import type {
|
|
|
2
2
|
ExtensionAPI,
|
|
3
3
|
ExtensionContext,
|
|
4
4
|
} from "@earendil-works/pi-coding-agent";
|
|
5
|
-
import { activateAdvisor } from "./activation.
|
|
6
|
-
import { registerCommandLifecycle } from "./lifecycle.
|
|
7
|
-
import { registerManualCommand } from "./manual-command.
|
|
8
|
-
import { registerModelCommands } from "./model-commands.
|
|
9
|
-
import { registerCommandRenderers } from "./renderers.
|
|
10
|
-
import { createCommandRuntime } from "./runtime.
|
|
11
|
-
import { registerSettingsCommands } from "./settings-commands.
|
|
12
|
-
import type { CommandDependencies } from "./types.
|
|
5
|
+
import { activateAdvisor } from "./activation.ts";
|
|
6
|
+
import { registerCommandLifecycle } from "./lifecycle.ts";
|
|
7
|
+
import { registerManualCommand } from "./manual-command.ts";
|
|
8
|
+
import { registerModelCommands } from "./model-commands.ts";
|
|
9
|
+
import { registerCommandRenderers } from "./renderers.ts";
|
|
10
|
+
import { createCommandRuntime } from "./runtime.ts";
|
|
11
|
+
import { registerSettingsCommands } from "./settings-commands.ts";
|
|
12
|
+
import type { CommandDependencies } from "./types.ts";
|
|
13
13
|
|
|
14
14
|
export const registerCommands = (
|
|
15
15
|
pi: ExtensionAPI,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { getMarkdownTheme } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { Box, Markdown, Text } from "@earendil-works/pi-tui";
|
|
3
|
-
import { getAdvisorSettings } from "../config/state.
|
|
3
|
+
import { getAdvisorSettings } from "../config/state.ts";
|
|
4
4
|
import {
|
|
5
5
|
adviceForDisplay,
|
|
6
6
|
hasSoundVerdict,
|
|
7
7
|
renderAdvisorCallBox,
|
|
8
8
|
renderAdvisorResponseHeader,
|
|
9
|
-
} from "../tools/render-common.
|
|
10
|
-
import { formatAdvisorUsage } from "../usage.
|
|
11
|
-
import { ManualAdvisorProgressComponent } from "./manual-progress.
|
|
12
|
-
import type { CommandRuntime } from "./types.
|
|
9
|
+
} from "../tools/render-common.ts";
|
|
10
|
+
import { formatAdvisorUsage } from "../usage.ts";
|
|
11
|
+
import { ManualAdvisorProgressComponent } from "./manual-progress.ts";
|
|
12
|
+
import type { CommandRuntime } from "./types.ts";
|
|
13
13
|
|
|
14
14
|
export const registerCommandRenderers = (runtime: CommandRuntime) => {
|
|
15
15
|
runtime.pi.registerEntryRenderer?.(
|
package/src/commands/runtime.ts
CHANGED
|
@@ -2,18 +2,18 @@ import type {
|
|
|
2
2
|
ExtensionAPI,
|
|
3
3
|
ExtensionContext,
|
|
4
4
|
} from "@earendil-works/pi-coding-agent";
|
|
5
|
-
import { getAdvisorSettings } from "../config/state.
|
|
6
|
-
import { notifyHerdrAdvisorFailure } from "../herdr.
|
|
7
|
-
import type { AdvisorSessionState } from "../session-state.
|
|
8
|
-
import { consultAdvisor } from "../tools/consultation.
|
|
9
|
-
import { ScoutStatusManager } from "../tools/scout-status.
|
|
10
|
-
import { advisorSessionState as defaultAdvisorSessionState } from "../tools/session.
|
|
5
|
+
import { getAdvisorSettings } from "../config/state.ts";
|
|
6
|
+
import { notifyHerdrAdvisorFailure } from "../herdr.ts";
|
|
7
|
+
import type { AdvisorSessionState } from "../session-state.ts";
|
|
8
|
+
import { consultAdvisor } from "../tools/consultation.ts";
|
|
9
|
+
import { ScoutStatusManager } from "../tools/scout-status.ts";
|
|
10
|
+
import { advisorSessionState as defaultAdvisorSessionState } from "../tools/session.ts";
|
|
11
11
|
import type {
|
|
12
12
|
CommandDependencies,
|
|
13
13
|
CommandRuntime as CommandRuntimeContract,
|
|
14
14
|
ManualAdvisorProgressState,
|
|
15
15
|
ManualConsult,
|
|
16
|
-
} from "./types.
|
|
16
|
+
} from "./types.ts";
|
|
17
17
|
|
|
18
18
|
export const notify = (
|
|
19
19
|
ctx: ExtensionContext,
|
|
@@ -25,7 +25,7 @@ export const notify = (
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
class CommandRuntime implements CommandRuntimeContract {
|
|
29
29
|
readonly advisorSessionState: AdvisorSessionState;
|
|
30
30
|
readonly manualConsultations = new Map<AbortController, symbol>();
|
|
31
31
|
readonly manualProgress = new Map<string, ManualAdvisorProgressState>();
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
getAdvisorSettings,
|
|
4
4
|
getPersistedModelRefs,
|
|
5
5
|
setAlwaysOnRef,
|
|
6
|
-
} from "../config/state.
|
|
7
|
-
import { saveConfig } from "../config/storage.
|
|
8
|
-
import { AdvisorSettingsSelector } from "../ui/settings-selector.
|
|
9
|
-
import { loadCommandConfig } from "./activation-preparation.
|
|
10
|
-
import { CONTEXT_PRESETS, EFFORT_LEVELS } from "./model-options.
|
|
11
|
-
import { notify } from "./runtime.
|
|
12
|
-
import { saveAdvisorSettings } from "./settings-persistence.
|
|
13
|
-
import type { CommandRuntime } from "./types.
|
|
6
|
+
} from "../config/state.ts";
|
|
7
|
+
import { saveConfig } from "../config/storage.ts";
|
|
8
|
+
import { AdvisorSettingsSelector } from "../ui/settings-selector.ts";
|
|
9
|
+
import { loadCommandConfig } from "./activation-preparation.ts";
|
|
10
|
+
import { CONTEXT_PRESETS, EFFORT_LEVELS } from "./model-options.ts";
|
|
11
|
+
import { notify } from "./runtime.ts";
|
|
12
|
+
import { saveAdvisorSettings } from "./settings-persistence.ts";
|
|
13
|
+
import type { CommandRuntime } from "./types.ts";
|
|
14
14
|
|
|
15
15
|
export const registerSettingsCommands = (runtime: CommandRuntime) => {
|
|
16
16
|
runtime.pi.registerCommand("advisor-settings", {
|
|
@@ -29,12 +29,12 @@ import {
|
|
|
29
29
|
setShowUsageDetailsRef,
|
|
30
30
|
setShowUsageFooterRef,
|
|
31
31
|
setSimpleModeRef,
|
|
32
|
-
} from "../config/state.
|
|
33
|
-
import { saveConfig, saveGlobalOutcomeLogging } from "../config/storage.
|
|
34
|
-
import type { AdvisorSettings } from "../ui/types.
|
|
32
|
+
} from "../config/state.ts";
|
|
33
|
+
import { saveConfig, saveGlobalOutcomeLogging } from "../config/storage.ts";
|
|
34
|
+
import type { AdvisorSettings } from "../ui/types.ts";
|
|
35
35
|
|
|
36
36
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: one settings form maps every persisted control.
|
|
37
|
-
|
|
37
|
+
const applyAdvisorSettings = (settings: AdvisorSettings) => {
|
|
38
38
|
setAdvisorEffortRef(
|
|
39
39
|
settings.effort === "Default (Model Default)" ? undefined : settings.effort
|
|
40
40
|
);
|
package/src/commands/types.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ExtensionAPI,
|
|
3
3
|
ExtensionContext,
|
|
4
|
-
Theme,
|
|
5
4
|
} from "@earendil-works/pi-coding-agent";
|
|
6
|
-
import type { GitContextLevel } from "../git.
|
|
7
|
-
import type { ScoutLifecycleEvent } from "../scout.
|
|
8
|
-
import type { AdvisorSessionState } from "../session-state.
|
|
9
|
-
import type { ScoutStatusManager } from "../tools/scout-status.
|
|
10
|
-
import type { ScoutToolDetails } from "../tools/types.
|
|
5
|
+
import type { GitContextLevel } from "../git.ts";
|
|
6
|
+
import type { ScoutLifecycleEvent } from "../scout.ts";
|
|
7
|
+
import type { AdvisorSessionState } from "../session-state.ts";
|
|
8
|
+
import type { ScoutStatusManager } from "../tools/scout-status.ts";
|
|
9
|
+
import type { ScoutToolDetails } from "../tools/types.ts";
|
|
11
10
|
|
|
12
11
|
export type ManualConsult = (
|
|
13
12
|
ctx: ExtensionContext,
|
|
@@ -69,10 +68,3 @@ export interface CommandRuntime {
|
|
|
69
68
|
suppressModelSelectionSync: boolean;
|
|
70
69
|
updateAdvisorUsageStatus: (ctx: ExtensionContext) => void;
|
|
71
70
|
}
|
|
72
|
-
|
|
73
|
-
export interface ManualAdvisorProgressView {
|
|
74
|
-
expanded: boolean;
|
|
75
|
-
question: string | undefined;
|
|
76
|
-
state: ManualAdvisorProgressState;
|
|
77
|
-
theme: Theme;
|
|
78
|
-
}
|
package/src/commands.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// biome-ignore lint/performance/noBarrelFile: this facade intentionally preserves the public command module contract.
|
|
2
|
-
export { registerCommands } from "./commands/registration.
|
|
2
|
+
export { registerCommands } from "./commands/registration.ts";
|
|
3
3
|
export type {
|
|
4
4
|
CommandDependencies,
|
|
5
5
|
ManualAdvisorProgressPhase,
|
|
6
6
|
ManualAdvisorProgressState,
|
|
7
7
|
ManualConsult,
|
|
8
8
|
ThinkingLevel,
|
|
9
|
-
} from "./commands/types.
|
|
9
|
+
} from "./commands/types.ts";
|
package/src/config/args.ts
CHANGED
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
setAdvisorRef,
|
|
6
6
|
setContextMaxCharsRef,
|
|
7
7
|
setExecutorRef,
|
|
8
|
-
} from "./state.
|
|
9
|
-
import { MAX_CONTEXT_MAX_CHARS } from "./types.
|
|
10
|
-
import { isValidContextMaxChars } from "./validation.
|
|
8
|
+
} from "./state.ts";
|
|
9
|
+
import { MAX_CONTEXT_MAX_CHARS } from "./types.ts";
|
|
10
|
+
import { isValidContextMaxChars } from "./validation.ts";
|
|
11
11
|
|
|
12
12
|
const ARGUMENT_WHITESPACE = /\s+/;
|
|
13
13
|
|
package/src/config/defaults.ts
CHANGED
|
@@ -31,14 +31,14 @@ import {
|
|
|
31
31
|
setShowUsageDetailsRef,
|
|
32
32
|
setShowUsageFooterRef,
|
|
33
33
|
setSimpleModeRef,
|
|
34
|
-
} from "./state.
|
|
35
|
-
import type { AdvisorConfig } from "./types.
|
|
34
|
+
} from "./state.ts";
|
|
35
|
+
import type { AdvisorConfig } from "./types.ts";
|
|
36
36
|
import {
|
|
37
37
|
DEFAULT_ADVISOR_GIT_CONTEXT_MAX_CHARS,
|
|
38
38
|
DEFAULT_ADVISOR_TOOL_RESULT_MAX_BYTES,
|
|
39
39
|
DEFAULT_ADVISOR_TOOL_RESULT_MAX_LINES,
|
|
40
40
|
DEFAULT_CONTEXT_MAX_CHARS,
|
|
41
|
-
} from "./types.
|
|
41
|
+
} from "./types.ts";
|
|
42
42
|
|
|
43
43
|
export const resetDefaults = () => {
|
|
44
44
|
setExecutorRef("");
|