@cydm/pie 1.0.26 → 1.0.27
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/cli.js +146 -74
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -45727,6 +45727,45 @@ var ModelRegistry = class {
|
|
|
45727
45727
|
// src/core/settings-manager.ts
|
|
45728
45728
|
import * as fs3 from "fs";
|
|
45729
45729
|
import * as path3 from "path";
|
|
45730
|
+
|
|
45731
|
+
// src/tool-set.ts
|
|
45732
|
+
var DEFAULT_TOOL_SET = "lean";
|
|
45733
|
+
var LEAN_CODING_TOOL_NAMES = [
|
|
45734
|
+
"read_file",
|
|
45735
|
+
"edit_file",
|
|
45736
|
+
"write_file",
|
|
45737
|
+
"bash"
|
|
45738
|
+
];
|
|
45739
|
+
var CLI_DEFAULT_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
45740
|
+
"read_file",
|
|
45741
|
+
"write_file",
|
|
45742
|
+
"edit_file",
|
|
45743
|
+
"list_dir",
|
|
45744
|
+
"grep_text",
|
|
45745
|
+
"find_files",
|
|
45746
|
+
"bash",
|
|
45747
|
+
"web_research",
|
|
45748
|
+
"web_search",
|
|
45749
|
+
"web_fetch",
|
|
45750
|
+
"code_intel"
|
|
45751
|
+
]);
|
|
45752
|
+
var LEAN_CODING_TOOL_NAME_SET = new Set(LEAN_CODING_TOOL_NAMES);
|
|
45753
|
+
function normalizeDefaultToolSet(value) {
|
|
45754
|
+
return value === "full" ? "full" : DEFAULT_TOOL_SET;
|
|
45755
|
+
}
|
|
45756
|
+
function selectDefaultTools(tools, defaultSet) {
|
|
45757
|
+
if (defaultSet === "full") {
|
|
45758
|
+
return [...tools];
|
|
45759
|
+
}
|
|
45760
|
+
return tools.filter(
|
|
45761
|
+
(tool) => !CLI_DEFAULT_TOOL_NAMES.has(tool.name) || LEAN_CODING_TOOL_NAME_SET.has(tool.name)
|
|
45762
|
+
);
|
|
45763
|
+
}
|
|
45764
|
+
function formatDefaultToolSet(defaultSet) {
|
|
45765
|
+
return defaultSet === "full" ? "Full" : "Lean";
|
|
45766
|
+
}
|
|
45767
|
+
|
|
45768
|
+
// src/core/settings-manager.ts
|
|
45730
45769
|
var SettingsManager = class {
|
|
45731
45770
|
settingsPath;
|
|
45732
45771
|
legacyConfigPath;
|
|
@@ -45815,6 +45854,16 @@ var SettingsManager = class {
|
|
|
45815
45854
|
}
|
|
45816
45855
|
return "auto";
|
|
45817
45856
|
}
|
|
45857
|
+
getDefaultToolSet() {
|
|
45858
|
+
return normalizeDefaultToolSet(this.settings.tools?.defaultSet);
|
|
45859
|
+
}
|
|
45860
|
+
setDefaultToolSet(defaultSet) {
|
|
45861
|
+
this.settings.tools = {
|
|
45862
|
+
...this.settings.tools,
|
|
45863
|
+
defaultSet
|
|
45864
|
+
};
|
|
45865
|
+
this.writeSettings();
|
|
45866
|
+
}
|
|
45818
45867
|
// ==========================================================================
|
|
45819
45868
|
// Extension enablement (user ~/.pie/settings.json + project ./.pie/settings.json)
|
|
45820
45869
|
// ==========================================================================
|
|
@@ -60224,6 +60273,34 @@ var SettingsSelectorComponent = class extends Container {
|
|
|
60224
60273
|
}
|
|
60225
60274
|
)
|
|
60226
60275
|
},
|
|
60276
|
+
{
|
|
60277
|
+
id: "tools",
|
|
60278
|
+
label: "Tools",
|
|
60279
|
+
description: "Default model-visible tool set",
|
|
60280
|
+
currentValue: config.defaultToolSet,
|
|
60281
|
+
submenu: (currentValue, done) => new SelectSubmenu(
|
|
60282
|
+
"Default Tools",
|
|
60283
|
+
"Choose which built-in tools are visible in new coding sessions",
|
|
60284
|
+
[
|
|
60285
|
+
{
|
|
60286
|
+
value: "lean",
|
|
60287
|
+
label: "Lean",
|
|
60288
|
+
description: "read_file, edit_file, write_file, bash"
|
|
60289
|
+
},
|
|
60290
|
+
{
|
|
60291
|
+
value: "full",
|
|
60292
|
+
label: "Full",
|
|
60293
|
+
description: "All built-in tools, including search, web, and code intel"
|
|
60294
|
+
}
|
|
60295
|
+
],
|
|
60296
|
+
currentValue,
|
|
60297
|
+
(value) => {
|
|
60298
|
+
callbacks.onDefaultToolSetChange(value);
|
|
60299
|
+
done(value);
|
|
60300
|
+
},
|
|
60301
|
+
() => done()
|
|
60302
|
+
)
|
|
60303
|
+
},
|
|
60227
60304
|
{
|
|
60228
60305
|
id: "extensions",
|
|
60229
60306
|
label: "Extensions",
|
|
@@ -63566,10 +63643,7 @@ async function handleSkillsReload(host) {
|
|
|
63566
63643
|
const result = loadSkills({ builtinDir, userDir, projectDir });
|
|
63567
63644
|
host.skills = result.skills;
|
|
63568
63645
|
host.skillsSection = formatSkillsForPrompt(host.skills);
|
|
63569
|
-
|
|
63570
|
-
host.agent.state.tools = rebuiltTools.currentTools;
|
|
63571
|
-
host.allTools = [...rebuiltTools.currentTools];
|
|
63572
|
-
host.originalTools = [...rebuiltTools.originalTools];
|
|
63646
|
+
host.applyRuntimeToolMode(host.allTools.length > 0 ? host.allTools : host.agent.state.tools);
|
|
63573
63647
|
host.updateSystemPromptTools();
|
|
63574
63648
|
for (const skill of host.skills) {
|
|
63575
63649
|
const skillPath = ["skills", `skill:${skill.name}`];
|
|
@@ -63614,7 +63688,8 @@ function showSettingsSelector(host) {
|
|
|
63614
63688
|
availableThemes: getAvailableThemes(),
|
|
63615
63689
|
currentModel: currentModelId,
|
|
63616
63690
|
availableModels,
|
|
63617
|
-
yoloMode: host.yoloMode
|
|
63691
|
+
yoloMode: host.yoloMode,
|
|
63692
|
+
defaultToolSet: host.options.settingsManager.getDefaultToolSet()
|
|
63618
63693
|
},
|
|
63619
63694
|
{
|
|
63620
63695
|
onThinkingLevelChange: (level) => {
|
|
@@ -63643,6 +63718,10 @@ function showSettingsSelector(host) {
|
|
|
63643
63718
|
host.showError(`Failed to switch model: ${err}`);
|
|
63644
63719
|
}
|
|
63645
63720
|
},
|
|
63721
|
+
onDefaultToolSetChange: (defaultToolSet) => {
|
|
63722
|
+
host.options.settingsManager.setDefaultToolSet(defaultToolSet);
|
|
63723
|
+
host.showStatus(`Default tools: ${formatDefaultToolSet(defaultToolSet)} (restart Pie to apply)`);
|
|
63724
|
+
},
|
|
63646
63725
|
onYoloToggle: async () => {
|
|
63647
63726
|
await host.handleYoloCommand();
|
|
63648
63727
|
done();
|
|
@@ -64144,6 +64223,10 @@ function registerBuiltinCommands(host) {
|
|
|
64144
64223
|
description: "Change theme",
|
|
64145
64224
|
handler: () => host.showSettingsSelector()
|
|
64146
64225
|
});
|
|
64226
|
+
commandTree.register(["settings", "tools"], {
|
|
64227
|
+
description: "Choose the default model-visible tool set",
|
|
64228
|
+
handler: () => host.showSettingsSelector()
|
|
64229
|
+
});
|
|
64147
64230
|
commandTree.register(["settings", "thinking"], {
|
|
64148
64231
|
description: "Set thinking level (off/minimal/low/medium/high/xhigh)",
|
|
64149
64232
|
handler: (_2, args) => host.handleThinkingCommand(args)
|
|
@@ -66994,7 +67077,6 @@ function buildCodingAgentGuidelinesSection(tools = []) {
|
|
|
66994
67077
|
const hasRead = toolNames.has("read_file");
|
|
66995
67078
|
const hasWrite = toolNames.has("write_file");
|
|
66996
67079
|
const hasEdit = toolNames.has("edit_file");
|
|
66997
|
-
const hasList = toolNames.has("list_dir");
|
|
66998
67080
|
const hasGrep = toolNames.has("grep_text");
|
|
66999
67081
|
const hasFind = toolNames.has("find_files");
|
|
67000
67082
|
const hasBash = toolNames.has("bash");
|
|
@@ -67004,68 +67086,38 @@ function buildCodingAgentGuidelinesSection(tools = []) {
|
|
|
67004
67086
|
const hasCodeIntel = toolNames.has("code_intel");
|
|
67005
67087
|
const hasTodo = toolNames.has("manage_todo_list");
|
|
67006
67088
|
const guidelines = [
|
|
67007
|
-
"Complete coding tasks by
|
|
67089
|
+
"Complete coding tasks by making the needed file changes; do not stop at analysis."
|
|
67008
67090
|
];
|
|
67009
|
-
if (hasRead || hasList || hasGrep || hasFind) {
|
|
67010
|
-
guidelines.push("Explore with targeted search and relevant file reads; avoid repeated broad directory listings.");
|
|
67011
|
-
guidelines.push("Prefer first-class Pie tools for the task's semantic intent before lower-level shell preprocessing.");
|
|
67012
|
-
}
|
|
67013
|
-
if (hasGrep || hasFind || hasList) {
|
|
67014
|
-
guidelines.push("Prefer grep_text, find_files, and list_dir for workspace exploration when they are sufficient.");
|
|
67015
|
-
}
|
|
67016
|
-
if (hasGrep) {
|
|
67017
|
-
guidelines.push("Use grep_text outputMode='files_with_matches' to find candidate files, outputMode='count' to estimate impact, and outputMode='content' when you need matching lines and context.");
|
|
67018
|
-
guidelines.push("After a broad grep_text search, narrow the path, glob, pattern, outputMode, offset, or limit instead of repeating the same broad search.");
|
|
67019
|
-
}
|
|
67020
|
-
if (hasWebResearch) {
|
|
67021
|
-
guidelines.push("Use web_research for general public web research, current information, official docs, news, releases, issues, or webpage summaries; it searches, fetches, and returns cited sources.");
|
|
67022
|
-
guidelines.push("When web_research returns fetched sources that answer the request, synthesize the answer from that pack instead of calling web_search or web_fetch again.");
|
|
67023
|
-
}
|
|
67024
|
-
if (hasWebSearch && !hasWebResearch) {
|
|
67025
|
-
guidelines.push("Use web_search for public web research and grep_text/find_files/list_dir for local workspace search.");
|
|
67026
|
-
}
|
|
67027
|
-
if (hasWebFetch && !hasWebResearch) {
|
|
67028
|
-
guidelines.push("After web_search identifies a public source, use web_fetch to read the chosen URL before relying on it; also use web_fetch for user-supplied URLs.");
|
|
67029
|
-
} else if (hasWebResearch && hasWebSearch && hasWebFetch) {
|
|
67030
|
-
guidelines.push("Use web_search and web_fetch directly only when you need low-level control over exact queries or URLs.");
|
|
67031
|
-
}
|
|
67032
|
-
if (hasCodeIntel) {
|
|
67033
|
-
guidelines.push("Use code_intel for JS/TS diagnostics, definitions, references, symbols, or hover when type or symbol information matters before editing.");
|
|
67034
|
-
}
|
|
67035
67091
|
if (hasRead && hasEdit) {
|
|
67036
|
-
guidelines.push("Read the current file before edit_file
|
|
67092
|
+
guidelines.push("Read the current file before edit_file; use precise replacements and batch related edits when possible.");
|
|
67037
67093
|
}
|
|
67038
|
-
if (
|
|
67039
|
-
guidelines.push("Use
|
|
67040
|
-
guidelines.push("Use read_file directly for media and documents when the file-understanding route is available.");
|
|
67094
|
+
if (hasGrep || hasFind) {
|
|
67095
|
+
guidelines.push("Use targeted search to locate files, then read only the ranges needed for the edit.");
|
|
67041
67096
|
}
|
|
67042
|
-
if (hasEdit) {
|
|
67043
|
-
guidelines.push("
|
|
67044
|
-
guidelines.push("If edit_file fails because text is not unique, read the current file and retry with a larger exact block, or set replaceAll to true if every occurrence should be replaced.");
|
|
67097
|
+
if (hasRead && !hasEdit) {
|
|
67098
|
+
guidelines.push("Read only the relevant ranges; avoid repeating unchanged reads.");
|
|
67045
67099
|
}
|
|
67046
67100
|
if (hasWrite) {
|
|
67047
|
-
guidelines.push("Use write_file for new files or true complete rewrites;
|
|
67101
|
+
guidelines.push("Use write_file for new files or true complete rewrites; prefer edit_file for targeted changes.");
|
|
67048
67102
|
}
|
|
67049
67103
|
if (hasBash) {
|
|
67050
|
-
guidelines.push("Pass only executable shell commands to bash, not numbered plan items, headings, or prose.");
|
|
67051
67104
|
if (hasWrite || hasEdit) {
|
|
67052
|
-
guidelines.push("
|
|
67105
|
+
guidelines.push("Use file tools for file writes; do not use shell redirection or heredocs to bypass write_file/edit_file guards.");
|
|
67053
67106
|
}
|
|
67054
|
-
guidelines.push("
|
|
67107
|
+
guidelines.push("Use bash for tests, builds, and inspection commands; if a command fails or times out, change the approach instead of repeating it.");
|
|
67108
|
+
}
|
|
67109
|
+
if (hasWebResearch || hasWebSearch || hasWebFetch) {
|
|
67110
|
+
guidelines.push("Use web tools only when current or external public information is required.");
|
|
67111
|
+
}
|
|
67112
|
+
if (hasCodeIntel) {
|
|
67113
|
+
guidelines.push("Use code_intel when type, diagnostic, definition, or reference information would materially reduce code-reading churn.");
|
|
67055
67114
|
}
|
|
67056
67115
|
if (hasTodo) {
|
|
67057
|
-
guidelines.push("Use manage_todo_list only for multi-step work
|
|
67058
|
-
guidelines.push("Do not complete a todo item while implementation is partial, tests or verification are failing, or the required verification has not run.");
|
|
67116
|
+
guidelines.push("Use manage_todo_list only for genuinely multi-step work, and mark items done only after the work is complete.");
|
|
67059
67117
|
}
|
|
67060
67118
|
guidelines.push(
|
|
67061
|
-
"
|
|
67062
|
-
"
|
|
67063
|
-
"Prefer existing repository or task test commands over ad-hoc smoke checks; self-authored checks are useful only before running the authoritative local test.",
|
|
67064
|
-
"Read test or error output carefully and patch the failing code path directly before doing more broad debugging.",
|
|
67065
|
-
"When writing a module or library file, implement and export the exact functions or API names the task asks for; do not only write a standalone script.",
|
|
67066
|
-
"For multi-step work, keep checkpoints brief and avoid progress reports after every sub-step; batch related edits and advance.",
|
|
67067
|
-
"When the provided public verification command passes, stop immediately and let the harness run any further checks.",
|
|
67068
|
-
"Stop once the requested work is complete and verification is satisfactory; answer with one short final sentence and do not keep rechecking already-passed work."
|
|
67119
|
+
"Run the relevant existing test or build after changes; if it passes, stop and report the result.",
|
|
67120
|
+
"Keep task-relative paths relative to the current working directory."
|
|
67069
67121
|
);
|
|
67070
67122
|
return `## Guidelines
|
|
67071
67123
|
|
|
@@ -67081,7 +67133,7 @@ When the user asks about Pie itself, its extensions, skills, TUI, model configur
|
|
|
67081
67133
|
function buildCliSystemPrompt(options) {
|
|
67082
67134
|
const tools = options.tools.map((tool) => ({
|
|
67083
67135
|
name: tool.name,
|
|
67084
|
-
description:
|
|
67136
|
+
description: ""
|
|
67085
67137
|
}));
|
|
67086
67138
|
return [
|
|
67087
67139
|
options.customPrompt?.trim() || "You are Pie, a helpful AI coding assistant.",
|
|
@@ -68797,12 +68849,18 @@ async function loadInteractiveExtensions(host) {
|
|
|
68797
68849
|
}
|
|
68798
68850
|
}
|
|
68799
68851
|
const extensionTools = convertExtensionTools(extensions);
|
|
68800
|
-
host.agent.state.tools
|
|
68801
|
-
host.agent.state.tools = wrapToolsWithExtensions(
|
|
68852
|
+
const activeTools = [...host.agent.state.tools, ...extensionTools];
|
|
68853
|
+
host.agent.state.tools = wrapToolsWithExtensions(activeTools, host.extensionRunner);
|
|
68854
|
+
const availableTools = [
|
|
68855
|
+
...host.allTools.length > 0 ? host.allTools : host.originalTools.length > 0 ? host.originalTools : host.agent.state.tools,
|
|
68856
|
+
...extensionTools
|
|
68857
|
+
];
|
|
68858
|
+
host.allTools = wrapToolsWithExtensions(availableTools, host.extensionRunner);
|
|
68859
|
+
host.originalTools = [...host.allTools];
|
|
68802
68860
|
if (host.options.compositionTrace) {
|
|
68803
68861
|
recordCliCompositionStep(host.options.compositionTrace, {
|
|
68804
68862
|
id: "extensions_tool_wrapping",
|
|
68805
|
-
inputSummary: `baseTools=${host.agent.state.tools.length - extensionTools.length} extensionPaths=${host.options.extensionPaths?.length ?? 0}`,
|
|
68863
|
+
inputSummary: `baseTools=${host.agent.state.tools.length - extensionTools.length} availableTools=${host.allTools.length - extensionTools.length} extensionPaths=${host.options.extensionPaths?.length ?? 0}`,
|
|
68806
68864
|
outputSummary: `extensions=${extensions.length}`,
|
|
68807
68865
|
toolCount: host.agent.state.tools.length,
|
|
68808
68866
|
extensionWrapping: {
|
|
@@ -68812,8 +68870,6 @@ async function loadInteractiveExtensions(host) {
|
|
|
68812
68870
|
}
|
|
68813
68871
|
});
|
|
68814
68872
|
}
|
|
68815
|
-
host.allTools = [...host.agent.state.tools];
|
|
68816
|
-
host.originalTools = [...host.agent.state.tools];
|
|
68817
68873
|
host.updateSystemPromptTools();
|
|
68818
68874
|
if (process.env.PIE_VERBOSE) {
|
|
68819
68875
|
console.error("[System Prompt] Tools section updated:");
|
|
@@ -68955,7 +69011,8 @@ var InteractiveMode = class {
|
|
|
68955
69011
|
this.sessionManager = options.sessionManager;
|
|
68956
69012
|
this.sessionTrace = new SessionTraceWriter(options.sessionTraceDir, this.sessionManager);
|
|
68957
69013
|
this.skills = options.skills;
|
|
68958
|
-
this.
|
|
69014
|
+
this.allTools = [...options.allTools];
|
|
69015
|
+
this.originalTools = [...options.allTools];
|
|
68959
69016
|
this.skillsSection = formatSkillsForPrompt(options.skills);
|
|
68960
69017
|
this.knowledgeSection = buildCliProjectContextSection(options.cwd);
|
|
68961
69018
|
}
|
|
@@ -69077,8 +69134,10 @@ var InteractiveMode = class {
|
|
|
69077
69134
|
const rebuilt = this.rebuildSkillAwareTools(completeToolSet);
|
|
69078
69135
|
const currentTools = this.extensionRunner ? wrapToolsWithExtensions(rebuilt.currentTools, this.extensionRunner) : rebuilt.currentTools;
|
|
69079
69136
|
const originalTools = this.extensionRunner ? wrapToolsWithExtensions(rebuilt.originalTools, this.extensionRunner) : rebuilt.originalTools;
|
|
69137
|
+
const defaultToolSet = this.options.settingsManager.getDefaultToolSet();
|
|
69138
|
+
const defaultTools = selectDefaultTools(currentTools, defaultToolSet);
|
|
69080
69139
|
const activeTools = selectToolsForRuntimeMode(
|
|
69081
|
-
|
|
69140
|
+
defaultTools,
|
|
69082
69141
|
this.planModeEnabled ? "plan" : "normal"
|
|
69083
69142
|
);
|
|
69084
69143
|
this.agent.setTools(activeTools);
|
|
@@ -69641,15 +69700,17 @@ async function composeCliRuntime(params) {
|
|
|
69641
69700
|
outputSummary: summarizeToolNames(rawTools),
|
|
69642
69701
|
toolCount: rawTools.length
|
|
69643
69702
|
});
|
|
69644
|
-
const
|
|
69703
|
+
const allTools = createPolicyEnforcedTools(rawTools, {
|
|
69645
69704
|
getContext: () => ({ mode: "normal", confirmationPolicy: "allow" })
|
|
69646
69705
|
});
|
|
69706
|
+
const defaultToolSet = settingsManager.getDefaultToolSet();
|
|
69707
|
+
const tools = selectDefaultTools(allTools, defaultToolSet);
|
|
69647
69708
|
recordCliCompositionStep(compositionTrace, {
|
|
69648
69709
|
id: "policy_filtering",
|
|
69649
69710
|
inputSummary: `tools=${rawTools.length}`,
|
|
69650
|
-
outputSummary: summarizeToolNames(tools)
|
|
69711
|
+
outputSummary: `${summarizeToolNames(tools)} (defaultSet=${defaultToolSet}; available=${allTools.length})`,
|
|
69651
69712
|
toolCount: tools.length,
|
|
69652
|
-
policyDecisions: rawTools.length ===
|
|
69713
|
+
policyDecisions: rawTools.length === allTools.length ? ["allow:default"] : [`filtered:${rawTools.length - allTools.length}`]
|
|
69653
69714
|
});
|
|
69654
69715
|
for (const diag of diagnostics.filter((d) => d.type === "collision")) {
|
|
69655
69716
|
console.log(`[CLI] ${diag.message}`);
|
|
@@ -69698,6 +69759,7 @@ async function composeCliRuntime(params) {
|
|
|
69698
69759
|
skillsSection,
|
|
69699
69760
|
knowledgeSection,
|
|
69700
69761
|
tools,
|
|
69762
|
+
allTools,
|
|
69701
69763
|
fileObservationState,
|
|
69702
69764
|
extensionPaths: params.extensionPaths,
|
|
69703
69765
|
extensionFlags: params.extensionFlags ?? {},
|
|
@@ -69707,6 +69769,7 @@ async function composeCliRuntime(params) {
|
|
|
69707
69769
|
model,
|
|
69708
69770
|
apiKey,
|
|
69709
69771
|
tools,
|
|
69772
|
+
allTools,
|
|
69710
69773
|
fileObservationState,
|
|
69711
69774
|
sessionManager,
|
|
69712
69775
|
skills,
|
|
@@ -69747,11 +69810,13 @@ async function loadPrintModeExtensions(params) {
|
|
|
69747
69810
|
const executionState = new ExecutionStateManager();
|
|
69748
69811
|
const activeSession = params.sessionManager.getActiveSession();
|
|
69749
69812
|
executionState.restoreFromMetadata(activeSession?.metadata?.executionState);
|
|
69813
|
+
let availableTools = [...params.allTools ?? []];
|
|
69750
69814
|
const actions = {
|
|
69751
69815
|
setActiveTools: (toolNames) => {
|
|
69752
69816
|
const agent = params.getAgent();
|
|
69753
69817
|
if (!agent) return;
|
|
69754
|
-
const
|
|
69818
|
+
const toolList = availableTools.length ? availableTools : agent.state.tools;
|
|
69819
|
+
const nextTools = toolList.filter((tool) => toolNames.includes(tool.name));
|
|
69755
69820
|
agent.state.tools = nextTools;
|
|
69756
69821
|
},
|
|
69757
69822
|
getActiveTools: () => params.getAgent()?.state.tools.map((tool) => tool.name) ?? [],
|
|
@@ -69781,11 +69846,11 @@ async function loadPrintModeExtensions(params) {
|
|
|
69781
69846
|
apiKey: params.apiKey,
|
|
69782
69847
|
model: params.model,
|
|
69783
69848
|
skills: params.skills,
|
|
69784
|
-
getAllTools: () => params.getAgent()?.state.tools.map((tool) => ({
|
|
69849
|
+
getAllTools: () => (availableTools.length ? availableTools : params.getAgent()?.state.tools ?? []).map((tool) => ({
|
|
69785
69850
|
name: tool.name,
|
|
69786
69851
|
description: tool.description,
|
|
69787
69852
|
parameters: tool.parameters
|
|
69788
|
-
}))
|
|
69853
|
+
})),
|
|
69789
69854
|
getRuntimeTools: () => params.getAgent()?.state.tools ?? [],
|
|
69790
69855
|
resolveModelClass: (modelClass) => params.modelRegistry.resolveModelClass(modelClass),
|
|
69791
69856
|
getMessages: () => params.getAgent()?.state.messages ?? [],
|
|
@@ -69818,10 +69883,12 @@ async function loadPrintModeExtensions(params) {
|
|
|
69818
69883
|
false
|
|
69819
69884
|
);
|
|
69820
69885
|
runner.setUIContext(uiContext);
|
|
69886
|
+
const extensionTools = convertExtensionTools(extensions);
|
|
69887
|
+
availableTools = [...availableTools, ...extensionTools];
|
|
69821
69888
|
return {
|
|
69822
69889
|
extensions,
|
|
69823
69890
|
runner,
|
|
69824
|
-
extensionTools
|
|
69891
|
+
extensionTools
|
|
69825
69892
|
};
|
|
69826
69893
|
}
|
|
69827
69894
|
async function runPrintMode(params) {
|
|
@@ -69853,7 +69920,8 @@ async function runPrintMode(params) {
|
|
|
69853
69920
|
skills: runtime.skills,
|
|
69854
69921
|
getAgent: () => agent,
|
|
69855
69922
|
sessionManager: runtime.sessionManager,
|
|
69856
|
-
settingsManager: runtime.settingsManager
|
|
69923
|
+
settingsManager: runtime.settingsManager,
|
|
69924
|
+
allTools: runtime.allTools
|
|
69857
69925
|
});
|
|
69858
69926
|
const printModeTools = [...runtime.tools, ...printModeExtensions.extensionTools];
|
|
69859
69927
|
recordCliCompositionStep(runtime.compositionTrace, {
|
|
@@ -70145,11 +70213,13 @@ async function loadJsonModeExtensions(params) {
|
|
|
70145
70213
|
const executionState = new ExecutionStateManager();
|
|
70146
70214
|
const activeSession = params.runtime.sessionManager.getActiveSession();
|
|
70147
70215
|
executionState.restoreFromMetadata(activeSession?.metadata?.executionState);
|
|
70216
|
+
let availableTools = [...params.runtime.allTools];
|
|
70148
70217
|
const actions = {
|
|
70149
70218
|
setActiveTools: (toolNames) => {
|
|
70150
70219
|
const agent = params.getAgent();
|
|
70151
70220
|
if (!agent) return;
|
|
70152
|
-
|
|
70221
|
+
const toolList = availableTools.length > 0 ? availableTools : agent.state.tools;
|
|
70222
|
+
agent.state.tools = toolList.filter((tool) => toolNames.includes(tool.name));
|
|
70153
70223
|
},
|
|
70154
70224
|
getActiveTools: () => params.getAgent()?.state.tools.map((tool) => tool.name) ?? [],
|
|
70155
70225
|
sendUserMessage: () => {
|
|
@@ -70182,11 +70252,11 @@ async function loadJsonModeExtensions(params) {
|
|
|
70182
70252
|
return params.runtime.model;
|
|
70183
70253
|
},
|
|
70184
70254
|
skills: params.runtime.skills,
|
|
70185
|
-
getAllTools: () => params.getAgent()?.state.tools.map((tool) => ({
|
|
70255
|
+
getAllTools: () => (availableTools.length > 0 ? availableTools : params.getAgent()?.state.tools ?? []).map((tool) => ({
|
|
70186
70256
|
name: tool.name,
|
|
70187
70257
|
description: tool.description,
|
|
70188
70258
|
parameters: tool.parameters
|
|
70189
|
-
}))
|
|
70259
|
+
})),
|
|
70190
70260
|
getRuntimeTools: () => params.getAgent()?.state.tools ?? [],
|
|
70191
70261
|
resolveModelClass: (modelClass) => params.runtime.modelRegistry.resolveModelClass(modelClass),
|
|
70192
70262
|
getMessages: () => params.getAgent()?.state.messages ?? [],
|
|
@@ -70219,9 +70289,11 @@ async function loadJsonModeExtensions(params) {
|
|
|
70219
70289
|
false
|
|
70220
70290
|
);
|
|
70221
70291
|
runner.setUIContext(uiContext);
|
|
70292
|
+
const extensionTools = convertExtensionTools(extensions);
|
|
70293
|
+
availableTools = [...availableTools, ...extensionTools];
|
|
70222
70294
|
return {
|
|
70223
70295
|
runner,
|
|
70224
|
-
extensionTools
|
|
70296
|
+
extensionTools,
|
|
70225
70297
|
extensionCount: extensions.length
|
|
70226
70298
|
};
|
|
70227
70299
|
}
|