pi-advisor-flow 0.5.0 → 0.5.2
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 +54 -0
- package/README.md +37 -71
- package/extensions/index.ts +7 -7
- package/package.json +19 -6
- package/src/commands/activation-preparation.ts +117 -0
- package/src/commands/activation.ts +135 -0
- package/src/commands/lifecycle.ts +83 -0
- package/src/commands/manual-command.ts +107 -0
- package/src/commands/manual-consultation.ts +144 -0
- package/src/commands/manual-progress.ts +93 -0
- package/src/commands/model-commands.ts +66 -0
- package/src/commands/model-options.ts +181 -0
- package/src/commands/model-picker.ts +110 -0
- package/src/commands/registration.ts +27 -0
- package/src/commands/renderers.ts +76 -0
- package/src/commands/runtime.ts +114 -0
- package/src/commands/settings-commands.ts +80 -0
- package/src/commands/settings-persistence.ts +81 -0
- package/src/commands/types.ts +78 -0
- package/src/commands.ts +9 -946
- package/src/config/args.ts +37 -0
- package/src/config/defaults.ts +190 -0
- package/src/config/state.ts +199 -0
- package/src/config/storage.ts +224 -0
- package/src/config/types.ts +63 -0
- package/src/config/validation.ts +234 -0
- package/src/config.ts +104 -791
- package/src/conversation.ts +4 -2
- package/src/herdr.ts +1 -1
- package/src/model-stream.ts +25 -2
- package/src/scout-context.ts +2 -2
- package/src/scout.ts +1 -1
- package/src/tools/consultation.ts +337 -0
- package/src/tools/gate-policy.ts +132 -0
- package/src/tools/gate-protocol.ts +127 -0
- package/src/tools/loop-gate.ts +210 -0
- package/src/tools/prompts.ts +159 -0
- package/src/tools/register-ask-advisor.ts +225 -0
- package/src/tools/register-lifecycle.ts +89 -0
- package/src/tools/register-outcome.ts +75 -0
- package/src/tools/register-renderers.ts +88 -0
- package/src/tools/registration.ts +35 -0
- package/src/tools/render-advisor-result.ts +168 -0
- package/src/tools/render-common.ts +120 -0
- package/src/tools/scout-status.ts +206 -0
- package/src/tools/session.ts +3 -0
- package/src/tools/types.ts +119 -0
- package/src/tools.ts +42 -1811
- package/src/ui/manual-dialog-render.ts +150 -0
- package/src/ui/manual-dialog.ts +305 -0
- package/src/ui/model-selector.ts +166 -0
- package/src/ui/settings-formatting.ts +133 -0
- package/src/ui/settings-items.ts +323 -0
- package/src/ui/settings-list-adapter.ts +103 -0
- package/src/ui/settings-mutations.ts +80 -0
- package/src/ui/settings-selector.ts +161 -0
- package/src/ui/text-setting-submenu.ts +66 -0
- package/src/ui/types.ts +111 -0
- package/src/ui.ts +9 -1418
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { appendOutcome } from "../outcomes.js";
|
|
3
|
+
import type { ScoutOutcome } from "../scout.js";
|
|
4
|
+
import type {
|
|
5
|
+
AdvisorSessionState,
|
|
6
|
+
ConsultationTrigger,
|
|
7
|
+
GateDecision,
|
|
8
|
+
GateTrigger,
|
|
9
|
+
} from "../session-state.js";
|
|
10
|
+
import type { consultAdvisor, runAdvisorGate } from "./consultation.js";
|
|
11
|
+
import type { ScoutStatusManager } from "./scout-status.js";
|
|
12
|
+
|
|
13
|
+
export type {
|
|
14
|
+
AdvisorInvocationRecord,
|
|
15
|
+
ConsultationTrigger,
|
|
16
|
+
GateDecision,
|
|
17
|
+
GateTrigger,
|
|
18
|
+
} from "../session-state.js";
|
|
19
|
+
|
|
20
|
+
export interface ScoutToolDetails {
|
|
21
|
+
availableCount?: number;
|
|
22
|
+
fallbackReason?: string;
|
|
23
|
+
latencyMs?: number;
|
|
24
|
+
model: string;
|
|
25
|
+
omittedBeforeScout?: number;
|
|
26
|
+
selectedCount?: number;
|
|
27
|
+
selectedLabels?: string[];
|
|
28
|
+
status: "calling" | "streaming" | "curated" | "fallback" | "cancelled";
|
|
29
|
+
synthesis?: string;
|
|
30
|
+
text?: string;
|
|
31
|
+
thinking?: string;
|
|
32
|
+
usage?: unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface AdvisorGateFailure {
|
|
36
|
+
category: GateFailureCategory;
|
|
37
|
+
markdown?: string;
|
|
38
|
+
message: string;
|
|
39
|
+
ok: false;
|
|
40
|
+
usage?: unknown;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface AdvisorConsultationResult {
|
|
44
|
+
adviceId: string;
|
|
45
|
+
draftBytes?: number;
|
|
46
|
+
markdown: string;
|
|
47
|
+
model: string;
|
|
48
|
+
preferenceBytes?: number;
|
|
49
|
+
scout?: Exclude<ScoutOutcome, { cancelled: true }>;
|
|
50
|
+
thinkingText: string;
|
|
51
|
+
trackedBytes?: number;
|
|
52
|
+
trigger: ConsultationTrigger;
|
|
53
|
+
untrackedBytes?: number;
|
|
54
|
+
usage?: unknown;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface AdvisorGateResult {
|
|
58
|
+
decision: GateDecision;
|
|
59
|
+
markdown: string;
|
|
60
|
+
model: string;
|
|
61
|
+
ok: true;
|
|
62
|
+
thinkingText: string;
|
|
63
|
+
trigger: GateTrigger;
|
|
64
|
+
usage?: unknown;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type AdvisorGateOutcome = AdvisorGateResult | AdvisorGateFailure;
|
|
68
|
+
|
|
69
|
+
export type GateFailureCategory =
|
|
70
|
+
| "provider-error"
|
|
71
|
+
| "empty-response"
|
|
72
|
+
| "missing-decision"
|
|
73
|
+
| "malformed-decision"
|
|
74
|
+
| "duplicate-decision"
|
|
75
|
+
| "contradictory-decision"
|
|
76
|
+
| "budget-exhausted";
|
|
77
|
+
|
|
78
|
+
export interface AdvisorToolDetails {
|
|
79
|
+
adviceId?: string;
|
|
80
|
+
advisor?: string;
|
|
81
|
+
draftBytes?: number;
|
|
82
|
+
preferenceBytes?: number;
|
|
83
|
+
question?: string;
|
|
84
|
+
scout?: ScoutToolDetails;
|
|
85
|
+
text?: string;
|
|
86
|
+
thinking?: string;
|
|
87
|
+
trackedBytes?: number;
|
|
88
|
+
untrackedBytes?: number;
|
|
89
|
+
usage?: unknown;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface AdvisorRenderState {
|
|
93
|
+
phase?: string;
|
|
94
|
+
scout?: ScoutToolDetails;
|
|
95
|
+
timerId?: ReturnType<typeof setInterval>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface AdvisorToolContext {
|
|
99
|
+
invalidate: () => void;
|
|
100
|
+
lastComponent: unknown;
|
|
101
|
+
state: AdvisorRenderState;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface ToolRegistrationContext {
|
|
105
|
+
appendOutcome: typeof appendOutcome;
|
|
106
|
+
consult: typeof consultAdvisor;
|
|
107
|
+
pi: ExtensionAPI;
|
|
108
|
+
reservedCalls: Set<string>;
|
|
109
|
+
runGate: typeof runAdvisorGate;
|
|
110
|
+
scoutStatus: ScoutStatusManager;
|
|
111
|
+
session: AdvisorSessionState;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface ToolRegistrationDependencies {
|
|
115
|
+
appendOutcome?: typeof appendOutcome;
|
|
116
|
+
consult?: typeof consultAdvisor;
|
|
117
|
+
runGate?: typeof runAdvisorGate;
|
|
118
|
+
statusManager?: ScoutStatusManager;
|
|
119
|
+
}
|