pi-advisor-flow 0.13.1 → 0.13.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 +6 -0
- package/dist/index.js +14 -7
- package/extensions/index.ts +6 -0
- package/package.json +9 -9
- package/scripts/check-bun-version.mjs +9 -0
- package/src/attachments.ts +36 -0
- package/src/child-session.ts +1 -0
- package/src/commands/activation-preparation.ts +12 -0
- package/src/commands/activation.ts +43 -0
- package/src/commands/advisor-tools.ts +3 -0
- package/src/commands/lifecycle.ts +15 -0
- package/src/commands/manual-command.ts +19 -0
- package/src/commands/manual-consultation.ts +20 -0
- package/src/commands/manual-progress.ts +13 -0
- package/src/commands/model-commands.ts +4 -0
- package/src/commands/model-options.ts +18 -0
- package/src/commands/model-picker.ts +16 -0
- package/src/commands/outcome-stats.ts +9 -0
- package/src/commands/registration.ts +1 -0
- package/src/commands/renderers.ts +14 -0
- package/src/commands/runtime.ts +5 -0
- package/src/commands/settings-commands.ts +18 -0
- package/src/commands/settings-persistence.ts +2 -0
- package/src/commands.ts +1 -0
- package/src/config/args.ts +7 -0
- package/src/config/defaults.ts +1 -0
- package/src/config/schema.ts +1 -0
- package/src/config/state.ts +64 -1
- package/src/config/storage.ts +37 -0
- package/src/config/types.ts +9 -0
- package/src/config/validation.ts +7 -0
- package/src/config.ts +6 -0
- package/src/content-utils.ts +5 -0
- package/src/conversation.ts +39 -0
- package/src/follow-up.ts +8 -0
- package/src/git.ts +8 -0
- package/src/herdr-block.ts +7 -0
- package/src/herdr-shared.ts +23 -0
- package/src/herdr.ts +18 -0
- package/src/image-attachments.ts +24 -0
- package/src/image-validation.ts +58 -0
- package/src/images.ts +24 -0
- package/src/jev/base-url.ts +14 -0
- package/src/jev/client.ts +49 -0
- package/src/jev/decisions-client.ts +14 -0
- package/src/jev/decisions-response.ts +38 -0
- package/src/jev/endpoint-key-store.ts +18 -0
- package/src/jev/key-store.ts +28 -0
- package/src/jev/ledger.ts +30 -12
- package/src/jev/openai-key-store.ts +17 -0
- package/src/jev/questions.ts +15 -0
- package/src/jev/state.ts +5 -0
- package/src/jev/transport.ts +35 -0
- package/src/model-stream.ts +32 -0
- package/src/outcome-stats.ts +16 -0
- package/src/outcomes.ts +31 -0
- package/src/pi-settings.ts +9 -0
- package/src/preferences.ts +26 -0
- package/src/redaction.ts +8 -0
- package/src/scout-context.ts +17 -0
- package/src/scout-curation.ts +12 -0
- package/src/scout-groups.ts +47 -0
- package/src/scout-protocol.ts +17 -0
- package/src/scout-reconstruct.ts +12 -0
- package/src/scout.ts +47 -0
- package/src/session-context.ts +11 -0
- package/src/session-state.ts +73 -13
- package/src/tool-result-cap.ts +11 -0
- package/src/tools/consult-context.ts +24 -0
- package/src/tools/consultation.ts +43 -0
- package/src/tools/gate-policy.ts +18 -0
- package/src/tools/gate-protocol.ts +22 -0
- package/src/tools/jev-filter.ts +26 -0
- package/src/tools/jev-turn-gate.ts +17 -0
- package/src/tools/loop-gate.ts +25 -0
- package/src/tools/model-access.ts +12 -0
- package/src/tools/outage-notifier.ts +4 -0
- package/src/tools/prompts.ts +17 -0
- package/src/tools/register-ask-advisor.ts +44 -0
- package/src/tools/register-lifecycle.ts +32 -0
- package/src/tools/register-outcome.ts +7 -0
- package/src/tools/register-renderers.ts +14 -0
- package/src/tools/registration.ts +3 -0
- package/src/tools/render-advisor-result.ts +44 -0
- package/src/tools/render-common.ts +10 -0
- package/src/tools/scout-status.ts +34 -0
- package/src/tools/session.ts +3 -0
- package/src/tools.ts +8 -0
- package/src/ui/jev-filter-submenu.ts +21 -0
- package/src/ui/jev-provider-submenu-view.ts +22 -0
- package/src/ui/jev-provider-submenu.ts +81 -0
- package/src/ui/jev-setup-support.ts +26 -0
- package/src/ui/manual-dialog-render.ts +20 -0
- package/src/ui/manual-dialog.ts +38 -0
- package/src/ui/masked-input.ts +2 -0
- package/src/ui/searchable-model-list.ts +28 -0
- package/src/ui/settings-formatting.ts +26 -0
- package/src/ui/settings-items.ts +11 -0
- package/src/ui/settings-list-adapter.ts +13 -0
- package/src/ui/settings-mutations.ts +60 -0
- package/src/ui/settings-selector.ts +30 -0
- package/src/ui/text-setting-submenu.ts +9 -0
- package/src/ui-guard.ts +1 -0
- package/src/ui.ts +3 -0
- package/src/usage.ts +31 -0
|
@@ -36,9 +36,11 @@ const formatByteSize = (bytes: number) => {
|
|
|
36
36
|
if (bytes >= 1024 * 1024) {
|
|
37
37
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;
|
|
38
38
|
}
|
|
39
|
+
|
|
39
40
|
if (bytes >= 1024) {
|
|
40
41
|
return `${Math.round(bytes / 1024)} KiB`;
|
|
41
42
|
}
|
|
43
|
+
|
|
42
44
|
return `${bytes} B`;
|
|
43
45
|
};
|
|
44
46
|
|
|
@@ -46,9 +48,11 @@ const manualCallRenderer =
|
|
|
46
48
|
(runtime: CommandRuntime): EntryRenderer<ManualCallEntryDetails> =>
|
|
47
49
|
(entry, { expanded }, theme) => {
|
|
48
50
|
const { progressId, question } = entry.data ?? {};
|
|
51
|
+
|
|
49
52
|
const progress = progressId
|
|
50
53
|
? runtime.manualProgress.get(progressId)
|
|
51
54
|
: undefined;
|
|
55
|
+
|
|
52
56
|
return progress
|
|
53
57
|
? new ManualAdvisorProgressComponent(
|
|
54
58
|
question,
|
|
@@ -66,24 +70,30 @@ const manualResultRenderer: MessageRenderer<ManualResultDetails> = (
|
|
|
66
70
|
) => {
|
|
67
71
|
const { details } = message;
|
|
68
72
|
const box = new Box(1, 1, (text) => theme.bg("customMessageBg", text));
|
|
73
|
+
|
|
69
74
|
const advice =
|
|
70
75
|
details?.text ??
|
|
71
76
|
(isString(message.content)
|
|
72
77
|
? message.content
|
|
73
78
|
: "(Advisor returned no advice.)");
|
|
79
|
+
|
|
74
80
|
// Manual consultations must render exactly like an Executor ask_advisor call.
|
|
75
81
|
box.addChild(
|
|
76
82
|
new Text(renderAdvisorResponseHeader(hasSoundVerdict(advice), theme), 0, 0)
|
|
77
83
|
);
|
|
84
|
+
|
|
78
85
|
if (details?.advisor) {
|
|
79
86
|
box.addChild(new Text(theme.fg("dim", ` ${details.advisor}`), 0, 0));
|
|
80
87
|
}
|
|
88
|
+
|
|
81
89
|
if (getAdvisorSettings().showUsageDetails) {
|
|
82
90
|
const usage = formatAdvisorUsage(details?.usage);
|
|
91
|
+
|
|
83
92
|
if (usage) {
|
|
84
93
|
box.addChild(new Text(theme.fg("dim", ` Usage: ${usage}`), 0, 0));
|
|
85
94
|
}
|
|
86
95
|
}
|
|
96
|
+
|
|
87
97
|
const attachments = [
|
|
88
98
|
details?.agentRulesBytes
|
|
89
99
|
? `AGENTS.md rules attached · ${formatByteSize(details.agentRulesBytes)}`
|
|
@@ -92,14 +102,17 @@ const manualResultRenderer: MessageRenderer<ManualResultDetails> = (
|
|
|
92
102
|
? `Project preferences attached · ${formatByteSize(details.preferenceBytes)}`
|
|
93
103
|
: undefined,
|
|
94
104
|
].filter((value): value is string => value !== undefined);
|
|
105
|
+
|
|
95
106
|
if (attachments.length) {
|
|
96
107
|
box.addChild(
|
|
97
108
|
new Text(theme.fg("dim", ` ${attachments.join(" · ")}`), 0, 0)
|
|
98
109
|
);
|
|
99
110
|
}
|
|
111
|
+
|
|
100
112
|
box.addChild(
|
|
101
113
|
new Markdown(adviceForDisplay(advice, expanded), 0, 0, getMarkdownTheme())
|
|
102
114
|
);
|
|
115
|
+
|
|
103
116
|
return box;
|
|
104
117
|
};
|
|
105
118
|
|
|
@@ -120,6 +133,7 @@ const outcomeStatsRenderer: MessageRenderer<AdvisorStatsDetails> = (
|
|
|
120
133
|
getMarkdownTheme()
|
|
121
134
|
)
|
|
122
135
|
);
|
|
136
|
+
|
|
123
137
|
return box;
|
|
124
138
|
};
|
|
125
139
|
|
package/src/commands/runtime.ts
CHANGED
|
@@ -109,7 +109,9 @@ class CommandRuntime implements CommandRuntimeContract {
|
|
|
109
109
|
if (!this.flowEnabled()) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
+
|
|
112
113
|
const disabled = sameModelAdvisorDisabled(ctx, model);
|
|
114
|
+
|
|
113
115
|
if (disabled && this.lastSameModelDisabled !== true) {
|
|
114
116
|
notify(ctx, sameModelAdvisorNotice, "info");
|
|
115
117
|
} else if (!disabled && this.lastSameModelDisabled === true) {
|
|
@@ -119,11 +121,13 @@ class CommandRuntime implements CommandRuntimeContract {
|
|
|
119
121
|
"info"
|
|
120
122
|
);
|
|
121
123
|
}
|
|
124
|
+
|
|
122
125
|
this.lastSameModelDisabled = disabled;
|
|
123
126
|
}
|
|
124
127
|
|
|
125
128
|
nextManualProgressId() {
|
|
126
129
|
this.manualProgressSequence += 1;
|
|
130
|
+
|
|
127
131
|
return `manual-${this.manualProgressSequence}`;
|
|
128
132
|
}
|
|
129
133
|
|
|
@@ -131,6 +135,7 @@ class CommandRuntime implements CommandRuntimeContract {
|
|
|
131
135
|
model: Parameters<ExtensionAPI["setModel"]>[0]
|
|
132
136
|
): Promise<boolean> {
|
|
133
137
|
this.suppressModelSelectionSync = true;
|
|
138
|
+
|
|
134
139
|
try {
|
|
135
140
|
return await this.pi.setModel(model);
|
|
136
141
|
} finally {
|
|
@@ -36,8 +36,10 @@ const persistJevSettings = (
|
|
|
36
36
|
} catch (error) {
|
|
37
37
|
const message = error instanceof Error ? error.message : String(error);
|
|
38
38
|
ctx.ui.notify(`Could not save Advisor settings: ${message}`, "error");
|
|
39
|
+
|
|
39
40
|
return false;
|
|
40
41
|
}
|
|
42
|
+
|
|
41
43
|
try {
|
|
42
44
|
setAdvisorToolsActive(runtime.pi, settings.advisorToolsEnabled ?? true);
|
|
43
45
|
runtime.updateSameModelNotice(ctx);
|
|
@@ -49,6 +51,7 @@ const persistJevSettings = (
|
|
|
49
51
|
"warning"
|
|
50
52
|
);
|
|
51
53
|
}
|
|
54
|
+
|
|
52
55
|
return true;
|
|
53
56
|
};
|
|
54
57
|
|
|
@@ -80,18 +83,23 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
|
|
|
80
83
|
onChange: (settings) => {
|
|
81
84
|
const toolsWereEnabled =
|
|
82
85
|
getAdvisorSettings().advisorToolsEnabled ?? true;
|
|
86
|
+
|
|
83
87
|
const toolsEnabled = settings.advisorToolsEnabled ?? true;
|
|
88
|
+
|
|
84
89
|
try {
|
|
85
90
|
saveAdvisorSettings(ctx, settings);
|
|
91
|
+
|
|
86
92
|
if (toolsWereEnabled !== toolsEnabled) {
|
|
87
93
|
runtime.noteAdvisorToolsStateChange();
|
|
88
94
|
}
|
|
95
|
+
|
|
89
96
|
setAdvisorToolsActive(runtime.pi, toolsEnabled);
|
|
90
97
|
runtime.updateSameModelNotice(ctx);
|
|
91
98
|
runtime.updateAdvisorUsageStatus(ctx);
|
|
92
99
|
} catch (error) {
|
|
93
100
|
const toolsDisabled =
|
|
94
101
|
toolsWereEnabled && settings.advisorToolsEnabled === false;
|
|
102
|
+
|
|
95
103
|
if (toolsDisabled) {
|
|
96
104
|
runtime.noteAdvisorToolsStateChange();
|
|
97
105
|
setAdvisorToolsEnabledRef(false);
|
|
@@ -99,8 +107,10 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
|
|
|
99
107
|
setAdvisorToolsActive(runtime.pi, false);
|
|
100
108
|
runtime.resetSameModelNotice();
|
|
101
109
|
}
|
|
110
|
+
|
|
102
111
|
const message =
|
|
103
112
|
error instanceof Error ? error.message : String(error);
|
|
113
|
+
|
|
104
114
|
ctx.ui.notify(
|
|
105
115
|
toolsDisabled
|
|
106
116
|
? `Could not save Advisor settings; tools remain disabled for this session. ${message}`
|
|
@@ -128,6 +138,7 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
|
|
|
128
138
|
runtime.noteAdvisorToolsStateChange();
|
|
129
139
|
setAdvisorToolsActive(runtime.pi, false);
|
|
130
140
|
runtime.resetSameModelNotice();
|
|
141
|
+
|
|
131
142
|
try {
|
|
132
143
|
loadConfig(ctx);
|
|
133
144
|
} catch (error) {
|
|
@@ -139,14 +150,18 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
|
|
|
139
150
|
`Advisor tools disabled for this session, but configuration could not be reloaded: ${message}`,
|
|
140
151
|
"error"
|
|
141
152
|
);
|
|
153
|
+
|
|
142
154
|
return Promise.resolve();
|
|
143
155
|
}
|
|
156
|
+
|
|
144
157
|
const wasAlwaysOn = alwaysOnRef;
|
|
145
158
|
const persisted = getPersistedModelRefs();
|
|
146
159
|
setAdvisorToolsEnabledRef(false);
|
|
160
|
+
|
|
147
161
|
if (wasAlwaysOn) {
|
|
148
162
|
setAlwaysOnRef(false);
|
|
149
163
|
}
|
|
164
|
+
|
|
150
165
|
try {
|
|
151
166
|
saveConfig(ctx, {
|
|
152
167
|
persistAdvisor: Boolean(persisted.advisor),
|
|
@@ -159,13 +174,16 @@ export const registerSettingsCommands = (runtime: CommandRuntime) => {
|
|
|
159
174
|
`Advisor tools disabled for this session, but the setting could not be saved: ${message}`,
|
|
160
175
|
"error"
|
|
161
176
|
);
|
|
177
|
+
|
|
162
178
|
return Promise.resolve();
|
|
163
179
|
}
|
|
180
|
+
|
|
164
181
|
notify(
|
|
165
182
|
ctx,
|
|
166
183
|
`Advisor tools disabled. Current model unchanged.${wasAlwaysOn ? " Always on turned off." : ""}`,
|
|
167
184
|
"info"
|
|
168
185
|
);
|
|
186
|
+
|
|
169
187
|
return Promise.resolve();
|
|
170
188
|
},
|
|
171
189
|
});
|
|
@@ -157,6 +157,7 @@ export const saveAdvisorSettings = (
|
|
|
157
157
|
options: SaveAdvisorSettingsOptions = {}
|
|
158
158
|
) => {
|
|
159
159
|
const previous = getAdvisorSettings();
|
|
160
|
+
|
|
160
161
|
try {
|
|
161
162
|
applyAdvisorSettings(settings);
|
|
162
163
|
const persisted = getPersistedModelRefs();
|
|
@@ -164,6 +165,7 @@ export const saveAdvisorSettings = (
|
|
|
164
165
|
persistAdvisor: Boolean(persisted.advisor),
|
|
165
166
|
persistExecutor: Boolean(persisted.executor),
|
|
166
167
|
});
|
|
168
|
+
|
|
167
169
|
if (!options.skipOutcomeLogging) {
|
|
168
170
|
saveGlobalOutcomeLogging(settings.outcomeLogging ?? false);
|
|
169
171
|
}
|
package/src/commands.ts
CHANGED
package/src/config/args.ts
CHANGED
|
@@ -15,24 +15,31 @@ export const parseArgs = (args: string): string | undefined => {
|
|
|
15
15
|
let nextExecutor = executorRef;
|
|
16
16
|
let nextAdvisor = advisorRef;
|
|
17
17
|
let nextContextMaxChars = contextMaxCharsRef;
|
|
18
|
+
|
|
18
19
|
for (const token of args.trim().split(ARGUMENT_WHITESPACE).filter(Boolean)) {
|
|
19
20
|
const separator = token.indexOf("=");
|
|
20
21
|
const key = separator === -1 ? token : token.slice(0, separator);
|
|
21
22
|
const value = separator === -1 ? undefined : token.slice(separator + 1);
|
|
23
|
+
|
|
22
24
|
if (key === "executor" && value) {
|
|
23
25
|
nextExecutor = value;
|
|
24
26
|
}
|
|
27
|
+
|
|
25
28
|
if (key === "advisor" && value) {
|
|
26
29
|
nextAdvisor = value;
|
|
27
30
|
}
|
|
31
|
+
|
|
28
32
|
if (key === "contextMaxChars") {
|
|
29
33
|
const parsed = Number(value);
|
|
34
|
+
|
|
30
35
|
if (!isValidContextMaxChars(parsed)) {
|
|
31
36
|
return `contextMaxChars must be a non-negative integer no greater than ${MAX_CONTEXT_MAX_CHARS}.`;
|
|
32
37
|
}
|
|
38
|
+
|
|
33
39
|
nextContextMaxChars = parsed;
|
|
34
40
|
}
|
|
35
41
|
}
|
|
42
|
+
|
|
36
43
|
setExecutorRef(nextExecutor);
|
|
37
44
|
setAdvisorRef(nextAdvisor);
|
|
38
45
|
setContextMaxCharsRef(nextContextMaxChars);
|
package/src/config/defaults.ts
CHANGED
package/src/config/schema.ts
CHANGED
package/src/config/state.ts
CHANGED
|
@@ -50,11 +50,15 @@ export let alwaysOnRef = false;
|
|
|
50
50
|
export let advisorFailureModeRef: GateFailureMode = "block-session";
|
|
51
51
|
export let advisorHerdrIntegrationRef = true;
|
|
52
52
|
export let advisorJevFilterEnabledRef = false;
|
|
53
|
+
|
|
53
54
|
export let advisorJevFilterSkipConfidenceRef =
|
|
54
55
|
DEFAULT_JEV_FILTER_SKIP_CONFIDENCE;
|
|
56
|
+
|
|
55
57
|
export let advisorJevFilterNoulMarginRef = DEFAULT_JEV_FILTER_NOUL_MARGIN;
|
|
58
|
+
|
|
56
59
|
export let advisorJevFilterOverrideWindowRef =
|
|
57
60
|
DEFAULT_JEV_FILTER_OVERRIDE_WINDOW;
|
|
61
|
+
|
|
58
62
|
export let advisorJevModelRef = DEFAULT_JEV_MODEL;
|
|
59
63
|
export let advisorJevTimeoutMsRef = DEFAULT_JEV_TIMEOUT_MS;
|
|
60
64
|
export let advisorJevDigestMaxCharsRef = DEFAULT_JEV_DIGEST_MAX_CHARS;
|
|
@@ -63,8 +67,10 @@ export let advisorJevBaseUrlRef: string | undefined;
|
|
|
63
67
|
export let advisorJevKeyProviderRef: string | undefined;
|
|
64
68
|
export let advisorJevTransportRef: JevTransport = DEFAULT_JEV_TRANSPORT;
|
|
65
69
|
export let advisorJevTurnGateEveryTurnsRef = DEFAULT_JEV_TURN_GATE_EVERY_TURNS;
|
|
70
|
+
|
|
66
71
|
export let advisorJevTurnGateNoulThresholdRef =
|
|
67
72
|
DEFAULT_JEV_TURN_GATE_NOUL_THRESHOLD;
|
|
73
|
+
|
|
68
74
|
export let advisorToolResultMaxLinesRef = DEFAULT_ADVISOR_TOOL_RESULT_MAX_LINES;
|
|
69
75
|
export let advisorToolResultMaxBytesRef = DEFAULT_ADVISOR_TOOL_RESULT_MAX_BYTES;
|
|
70
76
|
export let advisorRedactSecretsRef = false;
|
|
@@ -82,15 +88,19 @@ export let showUsageFooterRef = false;
|
|
|
82
88
|
export const setExecutorRef = (ref: string) => {
|
|
83
89
|
executorRef = ref;
|
|
84
90
|
};
|
|
91
|
+
|
|
85
92
|
export const setAdvisorRef = (ref: string) => {
|
|
86
93
|
advisorRef = ref;
|
|
87
94
|
};
|
|
95
|
+
|
|
88
96
|
export const setAdvisorFallbackModelRef = (ref: string | undefined) => {
|
|
89
97
|
advisorFallbackModelRef = ref?.trim() || undefined;
|
|
90
98
|
};
|
|
99
|
+
|
|
91
100
|
export const setAdvisorAgentsMdContextRef = (enabled: boolean) => {
|
|
92
101
|
advisorAgentsMdContextRef = enabled;
|
|
93
102
|
};
|
|
103
|
+
|
|
94
104
|
/** Returns model refs explicitly persisted in the global Advisor config. */
|
|
95
105
|
export const getPersistedModelRefs = () => ({
|
|
96
106
|
advisor: persistedAdvisorRef,
|
|
@@ -109,142 +119,194 @@ export const setPersistedModelRefs = (
|
|
|
109
119
|
export const setExecutorEffortRef = (effort: string | undefined) => {
|
|
110
120
|
executorEffortRef = effort;
|
|
111
121
|
};
|
|
122
|
+
|
|
112
123
|
export const setAdvisorEffortRef = (effort: string | undefined) => {
|
|
113
124
|
advisorEffortRef = effort;
|
|
114
125
|
};
|
|
126
|
+
|
|
115
127
|
export const setContextMaxCharsRef = (value: number) => {
|
|
116
128
|
contextMaxCharsRef = value;
|
|
117
129
|
};
|
|
130
|
+
|
|
118
131
|
export const setAdvisorPlanGateRef = (enabled: boolean) => {
|
|
119
132
|
advisorPlanGateRef = enabled;
|
|
120
133
|
};
|
|
134
|
+
|
|
121
135
|
export const setAdvisorFailureGateRef = (enabled: boolean) => {
|
|
122
136
|
advisorFailureGateRef = enabled;
|
|
123
137
|
};
|
|
138
|
+
|
|
124
139
|
export const setAdvisorCompletionGateRef = (enabled: boolean) => {
|
|
125
140
|
advisorCompletionGateRef = enabled;
|
|
126
141
|
};
|
|
142
|
+
|
|
127
143
|
export const setAdvisorCustomInvocationRef = (rule: string | undefined) => {
|
|
128
144
|
advisorCustomInvocationRef = rule?.trim() || undefined;
|
|
129
145
|
};
|
|
146
|
+
|
|
130
147
|
export const setAdvisorDisableSameModelRef = (enabled: boolean) => {
|
|
131
148
|
advisorDisableSameModelRef = enabled;
|
|
132
149
|
};
|
|
150
|
+
|
|
133
151
|
export const setAdvisorCollapseResponsesRef = (enabled: boolean) => {
|
|
134
152
|
advisorCollapseResponsesRef = enabled;
|
|
135
153
|
};
|
|
154
|
+
|
|
136
155
|
export const setAdvisorBlockOnBlockedRef = (enabled: boolean) => {
|
|
137
156
|
advisorBlockOnBlockedRef = enabled;
|
|
138
157
|
};
|
|
158
|
+
|
|
139
159
|
export const setAdvisorAutoLoopGateRef = (enabled: boolean) => {
|
|
140
160
|
advisorAutoLoopGateRef = enabled;
|
|
141
161
|
};
|
|
162
|
+
|
|
142
163
|
export const setAdvisorLoopThresholdRef = (value: number) => {
|
|
143
164
|
advisorLoopThresholdRef = value;
|
|
144
165
|
};
|
|
166
|
+
|
|
145
167
|
export const setAdvisorMaxCallsPerSessionRef = (value: number | undefined) => {
|
|
146
168
|
advisorMaxCallsPerSessionRef = value;
|
|
147
169
|
};
|
|
170
|
+
|
|
148
171
|
export const setAdvisorModelWhitelistRef = (models: string[]) => {
|
|
149
172
|
advisorModelWhitelistRef = [
|
|
150
|
-
...new Set(
|
|
173
|
+
...new Set(
|
|
174
|
+
models.flatMap((model) => {
|
|
175
|
+
const trimmed = model.trim();
|
|
176
|
+
|
|
177
|
+
return trimmed ? [trimmed] : [];
|
|
178
|
+
})
|
|
179
|
+
),
|
|
151
180
|
];
|
|
152
181
|
};
|
|
182
|
+
|
|
153
183
|
export const setAdvisorSessionSummaryRef = (enabled: boolean) => {
|
|
154
184
|
advisorSessionSummaryRef = enabled;
|
|
155
185
|
};
|
|
186
|
+
|
|
156
187
|
export const setSimpleModeRef = (enabled: boolean) => {
|
|
157
188
|
simpleModeRef = enabled;
|
|
158
189
|
};
|
|
190
|
+
|
|
159
191
|
export const setAdvisorToolsEnabledRef = (enabled: boolean) => {
|
|
160
192
|
advisorToolsEnabledRef = enabled;
|
|
161
193
|
};
|
|
194
|
+
|
|
162
195
|
export const setAlwaysOnRef = (enabled: boolean) => {
|
|
163
196
|
alwaysOnRef = enabled;
|
|
164
197
|
};
|
|
198
|
+
|
|
165
199
|
/** Whether advanced Advisor automation is suppressed for this session. */
|
|
166
200
|
export const isSimpleMode = () => simpleModeRef;
|
|
201
|
+
|
|
167
202
|
export const setAdvisorFailureModeRef = (value: GateFailureMode) => {
|
|
168
203
|
advisorFailureModeRef = value;
|
|
169
204
|
};
|
|
205
|
+
|
|
170
206
|
export const setAdvisorHerdrIntegrationRef = (enabled: boolean) => {
|
|
171
207
|
advisorHerdrIntegrationRef = enabled;
|
|
172
208
|
};
|
|
209
|
+
|
|
173
210
|
export const setAdvisorJevFilterEnabledRef = (enabled: boolean) => {
|
|
174
211
|
advisorJevFilterEnabledRef = enabled;
|
|
175
212
|
};
|
|
213
|
+
|
|
176
214
|
export const setAdvisorJevFilterSkipConfidenceRef = (value: number) => {
|
|
177
215
|
advisorJevFilterSkipConfidenceRef = value;
|
|
178
216
|
};
|
|
217
|
+
|
|
179
218
|
export const setAdvisorJevFilterNoulMarginRef = (value: number) => {
|
|
180
219
|
advisorJevFilterNoulMarginRef = value;
|
|
181
220
|
};
|
|
221
|
+
|
|
182
222
|
export const setAdvisorJevFilterOverrideWindowRef = (value: number) => {
|
|
183
223
|
advisorJevFilterOverrideWindowRef = value;
|
|
184
224
|
};
|
|
225
|
+
|
|
185
226
|
export const setAdvisorJevModelRef = (model: string | undefined) => {
|
|
186
227
|
advisorJevModelRef = model?.trim() || DEFAULT_JEV_MODEL;
|
|
187
228
|
};
|
|
229
|
+
|
|
188
230
|
export const setAdvisorJevTimeoutMsRef = (value: number) => {
|
|
189
231
|
advisorJevTimeoutMsRef = value;
|
|
190
232
|
};
|
|
233
|
+
|
|
191
234
|
export const setAdvisorJevDigestMaxCharsRef = (value: number) => {
|
|
192
235
|
advisorJevDigestMaxCharsRef = value;
|
|
193
236
|
};
|
|
237
|
+
|
|
194
238
|
export const setAdvisorJevPricePerMtokRef = (value: number) => {
|
|
195
239
|
advisorJevPricePerMtokRef = value;
|
|
196
240
|
};
|
|
241
|
+
|
|
197
242
|
export const setAdvisorJevBaseUrlRef = (value: string | undefined) => {
|
|
198
243
|
advisorJevBaseUrlRef = value?.trim() || undefined;
|
|
199
244
|
};
|
|
245
|
+
|
|
200
246
|
export const setAdvisorJevKeyProviderRef = (value: string | undefined) => {
|
|
201
247
|
advisorJevKeyProviderRef = value?.trim() || undefined;
|
|
202
248
|
};
|
|
249
|
+
|
|
203
250
|
export const setAdvisorJevTransportRef = (value: JevTransport) => {
|
|
204
251
|
advisorJevTransportRef = value;
|
|
205
252
|
};
|
|
253
|
+
|
|
206
254
|
export const setAdvisorJevTurnGateEveryTurnsRef = (value: number) => {
|
|
207
255
|
advisorJevTurnGateEveryTurnsRef = value;
|
|
208
256
|
};
|
|
257
|
+
|
|
209
258
|
export const setAdvisorJevTurnGateNoulThresholdRef = (value: number) => {
|
|
210
259
|
advisorJevTurnGateNoulThresholdRef = value;
|
|
211
260
|
};
|
|
261
|
+
|
|
212
262
|
export const setAdvisorToolResultMaxLinesRef = (value: number) => {
|
|
213
263
|
advisorToolResultMaxLinesRef = value;
|
|
214
264
|
};
|
|
265
|
+
|
|
215
266
|
export const setAdvisorToolResultMaxBytesRef = (value: number) => {
|
|
216
267
|
advisorToolResultMaxBytesRef = value;
|
|
217
268
|
};
|
|
269
|
+
|
|
218
270
|
export const setAdvisorRedactSecretsRef = (enabled: boolean) => {
|
|
219
271
|
advisorRedactSecretsRef = enabled;
|
|
220
272
|
};
|
|
273
|
+
|
|
221
274
|
export const setAdvisorGitContextRef = (level: GitContextLevel) => {
|
|
222
275
|
advisorGitContextRef = level;
|
|
223
276
|
};
|
|
277
|
+
|
|
224
278
|
export const setAdvisorGitContextMaxCharsRef = (value: number) => {
|
|
225
279
|
advisorGitContextMaxCharsRef = value;
|
|
226
280
|
};
|
|
281
|
+
|
|
227
282
|
export const setAdvisorToolPoliciesRef = (policies: AdvisorToolPolicies) => {
|
|
228
283
|
advisorToolPoliciesRef = { ...policies };
|
|
229
284
|
};
|
|
285
|
+
|
|
230
286
|
export const setAdvisorOutcomeLoggingRef = (enabled: boolean) => {
|
|
231
287
|
advisorOutcomeLoggingRef = enabled;
|
|
232
288
|
};
|
|
289
|
+
|
|
233
290
|
export const setAdvisorUntrackedContentRef = (enabled: boolean) => {
|
|
234
291
|
advisorUntrackedContentRef = enabled;
|
|
235
292
|
};
|
|
293
|
+
|
|
236
294
|
export const setAdvisorTrackedFileContentRef = (enabled: boolean) => {
|
|
237
295
|
advisorTrackedFileContentRef = enabled;
|
|
238
296
|
};
|
|
297
|
+
|
|
239
298
|
export const setAdvisorScoutEnabledRef = (enabled: boolean) => {
|
|
240
299
|
advisorScoutEnabledRef = enabled;
|
|
241
300
|
};
|
|
301
|
+
|
|
242
302
|
export const setAdvisorScoutTimeoutMsRef = (value: number) => {
|
|
243
303
|
advisorScoutTimeoutMsRef = value;
|
|
244
304
|
};
|
|
305
|
+
|
|
245
306
|
export const setShowUsageDetailsRef = (enabled: boolean) => {
|
|
246
307
|
showUsageDetailsRef = enabled;
|
|
247
308
|
};
|
|
309
|
+
|
|
248
310
|
export const setShowUsageFooterRef = (enabled: boolean) => {
|
|
249
311
|
showUsageFooterRef = enabled;
|
|
250
312
|
};
|
|
@@ -309,5 +371,6 @@ export const getAdvisorMaxCallsPerSession = () =>
|
|
|
309
371
|
|
|
310
372
|
export const splitRef = (ref: string): [string, string] => {
|
|
311
373
|
const i = ref.indexOf("/");
|
|
374
|
+
|
|
312
375
|
return i === -1 ? ["openai-codex", ref] : [ref.slice(0, i), ref.slice(i + 1)];
|
|
313
376
|
};
|