@oh-my-pi/pi-coding-agent 16.3.14 → 16.4.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 +35 -0
- package/dist/cli.js +3053 -3158
- package/dist/types/advisor/config.d.ts +7 -0
- package/dist/types/cli/args.d.ts +1 -0
- package/dist/types/config/model-resolver.d.ts +1 -1
- package/dist/types/config/models-config-schema.d.ts +28 -15
- package/dist/types/config/models-config.d.ts +6 -0
- package/dist/types/config/settings-schema.d.ts +7 -2
- package/dist/types/dap/config.d.ts +13 -1
- package/dist/types/extensibility/extensions/types.d.ts +6 -0
- package/dist/types/lsp/config.d.ts +7 -1
- package/dist/types/main.d.ts +2 -0
- package/dist/types/mcp/transports/stdio.d.ts +8 -3
- package/dist/types/modes/components/hook-selector.d.ts +2 -0
- package/dist/types/modes/theme/defaults/index.d.ts +2 -0
- package/dist/types/modes/theme/theme.d.ts +3 -2
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/session/agent-session.d.ts +5 -3
- package/dist/types/session/session-context.test.d.ts +1 -0
- package/dist/types/session/session-entries.d.ts +4 -0
- package/dist/types/thinking.d.ts +6 -3
- package/dist/types/utils/file-display-mode.d.ts +1 -1
- package/package.json +12 -12
- package/src/advisor/__tests__/config.test.ts +84 -0
- package/src/advisor/config.ts +28 -0
- package/src/cli/args.ts +1 -0
- package/src/cli/flag-tables.ts +3 -0
- package/src/config/model-registry.ts +1 -1
- package/src/config/model-resolver.ts +14 -12
- package/src/config/models-config-schema.ts +3 -2
- package/src/config/settings-schema.ts +5 -2
- package/src/dap/config.ts +136 -39
- package/src/dap/defaults.json +1 -1
- package/src/eval/js/shared/runtime.ts +20 -4
- package/src/eval/js/worker-core.ts +9 -2
- package/src/exec/bash-executor.ts +8 -1
- package/src/extensibility/extensions/types.ts +6 -0
- package/src/internal-urls/docs-index.generated.txt +1 -1
- package/src/lsp/config.ts +27 -13
- package/src/lsp/index.ts +114 -29
- package/src/main.ts +21 -1
- package/src/mcp/transports/stdio.test.ts +12 -0
- package/src/mcp/transports/stdio.ts +14 -8
- package/src/modes/components/hook-selector.ts +9 -2
- package/src/modes/controllers/extension-ui-controller.ts +3 -0
- package/src/modes/controllers/input-controller.ts +4 -4
- package/src/modes/controllers/selector-controller.ts +1 -1
- package/src/modes/theme/defaults/dark-poimandres.json +6 -5
- package/src/modes/theme/defaults/light-poimandres.json +6 -5
- package/src/modes/theme/theme-schema.json +6 -2
- package/src/modes/theme/theme.ts +24 -18
- package/src/prompts/agents/init.md +1 -1
- package/src/prompts/agents/plan.md +2 -2
- package/src/prompts/agents/reviewer.md +1 -1
- package/src/prompts/agents/{explore.md → scout.md} +3 -2
- package/src/prompts/system/plan-mode-active.md +2 -2
- package/src/prompts/system/system-prompt.md +5 -3
- package/src/prompts/tools/ast-grep.md +1 -1
- package/src/prompts/tools/debug.md +4 -4
- package/src/prompts/tools/grep.md +1 -1
- package/src/prompts/tools/task.md +2 -2
- package/src/sdk.ts +68 -45
- package/src/session/agent-session.ts +215 -64
- package/src/session/session-context.test.ts +83 -0
- package/src/session/session-context.ts +1 -0
- package/src/session/session-entries.ts +4 -0
- package/src/session/session-manager.ts +9 -1
- package/src/system-prompt.test.ts +20 -11
- package/src/task/agents.ts +2 -5
- package/src/task/executor.ts +111 -74
- package/src/thinking.ts +16 -7
- package/src/tools/ask.ts +51 -13
- package/src/tools/browser/cmux/cmux-tab.ts +21 -12
- package/src/tools/debug.ts +41 -11
- package/src/utils/file-display-mode.ts +1 -1
- package/src/prompts/agents/tester.md +0 -111
|
@@ -40,7 +40,7 @@ Write each section together with its body — block ops need a multi-line sectio
|
|
|
40
40
|
|
|
41
41
|
You eliminate unknowns by discovering facts, not by asking.
|
|
42
42
|
|
|
43
|
-
- **Discoverable facts** (file locations, current behavior, signatures, configs): you MUST find them yourself with `glob`, `grep`, `read`, or parallel `
|
|
43
|
+
- **Discoverable facts** (file locations, current behavior, signatures, configs): you MUST find them yourself with `glob`, `grep`, `read`, or parallel `scout` subagents. Every path, symbol, signature, and behavior the plan states as fact MUST come from something you actually read this session. Anything you could not confirm you mark inline (`unverified — confirm first`); you NEVER present a guess as settled. Ask only when several real candidates survive exploration — then present them with a recommendation.
|
|
44
44
|
- **Preferences and tradeoffs** (intent, UX, scope edges, performance-vs-simplicity): not derivable from code. Surface these early via `{{askToolName}}` with 2–4 mutually exclusive options and a recommended default. Left unanswered → proceed with the default and record it under Assumptions.
|
|
45
45
|
|
|
46
46
|
Every question MUST change the plan or settle a load-bearing choice. Batch them. You NEVER ask what exploration answers, and you NEVER ask filler.
|
|
@@ -69,7 +69,7 @@ Every question MUST change the plan or settle a load-bearing choice. Batch them.
|
|
|
69
69
|
## Workflow — parallel
|
|
70
70
|
|
|
71
71
|
<procedure>
|
|
72
|
-
1. **Understand** — focus on the request and the code behind it. Launch parallel `
|
|
72
|
+
1. **Understand** — focus on the request and the code behind it. Launch parallel `scout` subagents (via `task`) when scope spans areas; give each a distinct focus (existing implementations, related components, test patterns). Hunt for reusable code before proposing new.
|
|
73
73
|
2. **Design** — draft one approach from what you found, weigh tradeoffs briefly, then commit. For large or cross-cutting work you MAY spawn a critique subagent to pressure-test it before committing.
|
|
74
74
|
3. **Review** — read the files you intend to touch and confirm the approach holds against the real code; confirm the plan still answers the literal request; use `{{askToolName}}` to close any remaining preference questions.
|
|
75
75
|
4. **Write** — write the plan per **Plan contents** below.
|
|
@@ -182,9 +182,11 @@ EXECUTION WORKFLOW
|
|
|
182
182
|
{{#has tools "ask"}}- Ask before destructive commands or deleting code you didn't write.{{else}}- Don't run destructive git commands or delete code you didn't write.{{/has}}
|
|
183
183
|
|
|
184
184
|
# 5. Verify
|
|
185
|
-
- NEVER yield non-trivial work without proof: tests, E2E, browsing, or QA.
|
|
186
|
-
-
|
|
187
|
-
-
|
|
185
|
+
- NEVER yield non-trivial work without proof: tests, E2E, browsing, or QA.
|
|
186
|
+
- Every test MUST defend an observable contract and fail on a plausible bug.
|
|
187
|
+
- Test behavior, boundaries, invariants, transitions, precedence, and real errors—not plumbing, source text, or incidental defaults.
|
|
188
|
+
- Match existing conventions; keep tests deterministic, isolated, and full-suite safe.
|
|
189
|
+
- Run only touched tests; small/no-test changes still REQUIRE a focused behavioral smoke test.
|
|
188
190
|
|
|
189
191
|
# 6. Cleanup
|
|
190
192
|
Changelog, tests, docs, and removing scaffolding are the LAST phase—NEVER skipped, but gated on the request demonstrably working.
|
|
@@ -21,5 +21,5 @@ Structural code search via ast-grep.
|
|
|
21
21
|
<critical>
|
|
22
22
|
- AVOID repo-root scans — narrow `path` first
|
|
23
23
|
- Parse issues = query failure, not absence: fix the pattern or tighten `path` before concluding "no matches"
|
|
24
|
-
- Broad cross-subsystem exploration: you SHOULD use the Task tool +
|
|
24
|
+
- Broad cross-subsystem exploration: you SHOULD use the Task tool + scout subagent first
|
|
25
25
|
</critical>
|
|
@@ -2,7 +2,7 @@ Debugger access.
|
|
|
2
2
|
|
|
3
3
|
<instruction>
|
|
4
4
|
- You SHOULD prefer this over bash for program state, breakpoints, stepping, thread inspection, or interrupting a running process.
|
|
5
|
-
- `action: "launch"` starts a session; `program` required, `adapter` optional. Python: `
|
|
5
|
+
- `action: "launch"` starts a session; `program` required, `adapter` optional. Python: `program` = target `.py`, interpreter/script flags in `args`. Go: `program` = package directory, `.go` file, or compiled binary.
|
|
6
6
|
- `action: "attach"` connects to a running process: `pid` (local), `port` (remote), `adapter` forces a specific debugger.
|
|
7
7
|
- **Breakpoints**: `set_breakpoint`/`remove_breakpoint` with source (`file`+`line`) or function (`function`); optional `condition`.
|
|
8
8
|
- **Flow control**: `continue` (resume), `step_over`/`step_in`/`step_out` (single-step), `pause` (interrupt a running program).
|
|
@@ -11,7 +11,7 @@ Debugger access.
|
|
|
11
11
|
|
|
12
12
|
<caution>
|
|
13
13
|
- Only one active debug session at a time.
|
|
14
|
-
-
|
|
15
|
-
- `program`
|
|
16
|
-
- Python
|
|
14
|
+
- `adapter` is a configured id: `gdb`, `lldb-dap`, `debugpy`, `dlv`, `rdbg`, or any `dap.json` entry; its command must be installed.
|
|
15
|
+
- `program` is a target path, not a shell command. Directories require a directory-capable adapter such as `dlv`.
|
|
16
|
+
- Python requires `debugpy` (`pip install debugpy`); Go requires Delve (`go install github.com/go-delve/delve/cmd/dlv@latest`); Ruby requires `rdbg` (`gem install debug`).
|
|
17
17
|
</caution>
|
|
@@ -19,5 +19,5 @@ Greps files using regex.
|
|
|
19
19
|
|
|
20
20
|
<critical>
|
|
21
21
|
- MUST use built-in `grep` for any content search. NEVER shell out to `grep`, `rg`, `ripgrep`, `ag`, `ack`, `git grep`, `awk`, `sed`-for-search, or any CLI search via Bash — not even for one match or a quick check.
|
|
22
|
-
- Open-ended search needing multiple rounds? MUST use the Task tool with the
|
|
22
|
+
- Open-ended search needing multiple rounds? MUST use the Task tool with the scout subagent, NOT chained `grep` calls.
|
|
23
23
|
</critical>
|
|
@@ -11,10 +11,10 @@ Execution blocks your turn: the call only returns once the work is completely fi
|
|
|
11
11
|
{{#if ircEnabled}}- **Steering delivery:** Parent-to-subagent IRC is delivered immediately as steering; subagents blocked in `job poll` / `irc wait` do not need to poll separately for it.{{/if}}
|
|
12
12
|
- **Role matching:** Assign each subagent a specific `role` (e.g. "Security Reviewer", "DB Migrator"). Do not spawn generic workers.
|
|
13
13
|
- **No overhead:** Each assignment MUST instruct its agent to skip formatters, linters, and project-wide test suites. You will run those once at the end.
|
|
14
|
-
- **One-pass agents:** Prefer agents that investigate **and** edit in a single pass; only spin a read-only discovery step (e.g. `
|
|
14
|
+
- **One-pass agents:** Prefer agents that investigate **and** edit in a single pass; only spin a read-only discovery step (e.g. `scout`) when the affected files are genuinely unknown.
|
|
15
15
|
|
|
16
16
|
# Inputs
|
|
17
|
-
- `agent` (optional): The base agent type to use (e.g., `
|
|
17
|
+
- `agent` (optional): The base agent type to use (e.g., `scout`, `reviewer`). Defaults to `{{defaultAgent}}`{{#if defaultAgentIsGeneric}} (the general-purpose worker){{/if}} — omit it for the default worker instead of passing `agent: "{{defaultAgent}}"`.{{#if allowedAgentsText}} Current spawn policy allows: {{allowedAgentsText}}.{{/if}}
|
|
18
18
|
{{#if batchEnabled}}
|
|
19
19
|
- `context`: Shared project state, constraints, and contracts. Applies to the entire batch; do not duplicate this background into individual tasks.
|
|
20
20
|
- `tasks[]`: Array of subagents to spawn.
|
package/src/sdk.ts
CHANGED
|
@@ -426,6 +426,8 @@ export interface CreateAgentSessionOptions {
|
|
|
426
426
|
providerSessionId?: string;
|
|
427
427
|
/** Optional provider-facing prompt cache key, distinct from request lineage. */
|
|
428
428
|
providerPromptCacheKey?: string;
|
|
429
|
+
/** Whether `providerPromptCacheKey` is caller-pinned or inherited from a full fork. */
|
|
430
|
+
providerPromptCacheKeySource?: "explicit" | "fork";
|
|
429
431
|
/** Absolute wall-clock deadline in Unix epoch milliseconds. */
|
|
430
432
|
deadline?: number;
|
|
431
433
|
|
|
@@ -1221,6 +1223,25 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1221
1223
|
SessionManager.create(cwd, SessionManager.getDefaultSessionDir(cwd, agentDir)),
|
|
1222
1224
|
);
|
|
1223
1225
|
const providerSessionId = options.providerSessionId ?? sessionManager.getSessionId();
|
|
1226
|
+
const forkCacheShapeChanged =
|
|
1227
|
+
options.model !== undefined ||
|
|
1228
|
+
options.modelPattern !== undefined ||
|
|
1229
|
+
options.thinkingLevel !== undefined ||
|
|
1230
|
+
options.systemPrompt !== undefined ||
|
|
1231
|
+
options.customSystemPrompt !== undefined ||
|
|
1232
|
+
options.appendSystemPrompt !== undefined ||
|
|
1233
|
+
options.toolNames !== undefined ||
|
|
1234
|
+
options.customTools !== undefined;
|
|
1235
|
+
const inheritedPromptCacheKey = forkCacheShapeChanged
|
|
1236
|
+
? undefined
|
|
1237
|
+
: sessionManager.getHeader()?.providerPromptCacheKey;
|
|
1238
|
+
const providerPromptCacheKey = options.providerPromptCacheKey ?? inheritedPromptCacheKey;
|
|
1239
|
+
const providerPromptCacheKeySource =
|
|
1240
|
+
options.providerPromptCacheKey !== undefined
|
|
1241
|
+
? (options.providerPromptCacheKeySource ?? "explicit")
|
|
1242
|
+
: providerPromptCacheKey !== undefined
|
|
1243
|
+
? "fork"
|
|
1244
|
+
: undefined;
|
|
1224
1245
|
// Startup model *selection* only needs to know whether auth is configured for
|
|
1225
1246
|
// a candidate's provider — never the resolved key bytes. Use the synchronous,
|
|
1226
1247
|
// side-effect-free probe (`hasConfiguredAuth`): it refreshes no OAuth tokens,
|
|
@@ -1288,7 +1309,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1288
1309
|
for (let i = 0; i < sessionModelStrings.length; i++) {
|
|
1289
1310
|
const sessionModelStr = sessionModelStrings[i];
|
|
1290
1311
|
const parsedModel = parseModelString(sessionModelStr, {
|
|
1291
|
-
|
|
1312
|
+
allowMaxSuffix: true,
|
|
1292
1313
|
allowAutoAlias: true,
|
|
1293
1314
|
isLiteralModelId: (provider, id) => modelRegistry.find(provider, id) !== undefined,
|
|
1294
1315
|
});
|
|
@@ -1725,37 +1746,17 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1725
1746
|
}
|
|
1726
1747
|
applyMCPEnvironment(mcpResult);
|
|
1727
1748
|
logMCPLoadErrors(mcpResult.errors);
|
|
1728
|
-
// `tools.discoveryMode: "auto"` was resolved
|
|
1729
|
-
//
|
|
1730
|
-
//
|
|
1731
|
-
// BEFORE the refresh, or activateAll would dump every MCP tool into
|
|
1732
|
-
// the active set with no search_tool_bm25 registered.
|
|
1749
|
+
// `tools.discoveryMode: "auto"` was resolved before deferred MCP
|
|
1750
|
+
// tools existed. Reconcile again before refresh so a large toolset
|
|
1751
|
+
// cannot bypass discovery by arriving after first paint.
|
|
1733
1752
|
let discoveryEnabled = activation.mcpDiscoveryEnabled;
|
|
1734
1753
|
let activateAll = activation.activateAllMCPTools;
|
|
1735
|
-
if (
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
if (projectedMode !== "off") {
|
|
1742
|
-
effectiveDiscoveryMode = projectedMode;
|
|
1743
|
-
mcpDiscoveryEnabled = true;
|
|
1744
|
-
discoveryEnabled = true;
|
|
1745
|
-
activateAll = false;
|
|
1746
|
-
liveSession.enableMCPDiscovery();
|
|
1747
|
-
if (!toolRegistry.has("search_tool_bm25")) {
|
|
1748
|
-
const searchTool: Tool = new SearchToolBm25Tool(toolSession);
|
|
1749
|
-
toolRegistry.set(
|
|
1750
|
-
searchTool.name,
|
|
1751
|
-
new ExtensionToolWrapper(wrapToolWithMetaNotice(searchTool), extensionRunner) as Tool,
|
|
1752
|
-
);
|
|
1753
|
-
}
|
|
1754
|
-
await liveSession.setActiveToolsByName([
|
|
1755
|
-
...liveSession.getActiveToolNames(),
|
|
1756
|
-
"search_tool_bm25",
|
|
1757
|
-
]);
|
|
1758
|
-
}
|
|
1754
|
+
if (
|
|
1755
|
+
!discoveryEnabled &&
|
|
1756
|
+
(await enableDeferredMCPDiscoveryForTools(liveSession, mcpResult.tools))
|
|
1757
|
+
) {
|
|
1758
|
+
discoveryEnabled = true;
|
|
1759
|
+
activateAll = false;
|
|
1759
1760
|
}
|
|
1760
1761
|
await liveSession.refreshMCPTools(mcpResult.tools, { activateAll });
|
|
1761
1762
|
if (activation.explicitlyRequestedMCPToolNames.length > 0) {
|
|
@@ -1763,7 +1764,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1763
1764
|
// Discovery flipped on mid-flight: route the explicit request
|
|
1764
1765
|
// through discovery-aware activation so selection persists.
|
|
1765
1766
|
await liveSession.activateDiscoveredMCPTools(activation.explicitlyRequestedMCPToolNames);
|
|
1766
|
-
} else if (!discoveryEnabled) {
|
|
1767
|
+
} else if (!discoveryEnabled && !activateAll) {
|
|
1767
1768
|
await liveSession.setActiveToolsByName([
|
|
1768
1769
|
...liveSession.getActiveToolNames(),
|
|
1769
1770
|
...activation.explicitlyRequestedMCPToolNames,
|
|
@@ -1952,7 +1953,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1952
1953
|
for (let i = 0; i < sessionRetryLimit; i++) {
|
|
1953
1954
|
const sessionModelStr = sessionModelStrings[i];
|
|
1954
1955
|
const parsedModel = parseModelString(sessionModelStr, {
|
|
1955
|
-
|
|
1956
|
+
allowMaxSuffix: true,
|
|
1956
1957
|
allowAutoAlias: true,
|
|
1957
1958
|
isLiteralModelId: (provider, id) => modelRegistry.find(provider, id) !== undefined,
|
|
1958
1959
|
});
|
|
@@ -2296,6 +2297,34 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2296
2297
|
}
|
|
2297
2298
|
let mcpDiscoveryEnabled = effectiveDiscoveryMode !== "off"; // back-compat: true when any discovery active
|
|
2298
2299
|
|
|
2300
|
+
async function enableDeferredMCPDiscoveryForTools(
|
|
2301
|
+
liveSession: AgentSession,
|
|
2302
|
+
mcpTools: CustomTool[],
|
|
2303
|
+
): Promise<boolean> {
|
|
2304
|
+
if (mcpDiscoveryEnabled) return true;
|
|
2305
|
+
const nonMCPToolNames = [...toolRegistry.keys()].filter(name => !isMCPToolName(name));
|
|
2306
|
+
const projectedMode = resolveEffectiveToolDiscoveryMode(
|
|
2307
|
+
settings,
|
|
2308
|
+
countToolsForAutoDiscovery([...nonMCPToolNames, ...mcpTools.map(tool => tool.name)]),
|
|
2309
|
+
);
|
|
2310
|
+
if (projectedMode === "off") return false;
|
|
2311
|
+
|
|
2312
|
+
effectiveDiscoveryMode = projectedMode;
|
|
2313
|
+
mcpDiscoveryEnabled = true;
|
|
2314
|
+
liveSession.enableMCPDiscovery();
|
|
2315
|
+
if (!toolRegistry.has("search_tool_bm25")) {
|
|
2316
|
+
const searchTool: Tool = new SearchToolBm25Tool(toolSession);
|
|
2317
|
+
toolRegistry.set(
|
|
2318
|
+
searchTool.name,
|
|
2319
|
+
new ExtensionToolWrapper(wrapToolWithMetaNotice(searchTool), extensionRunner) as Tool,
|
|
2320
|
+
);
|
|
2321
|
+
}
|
|
2322
|
+
if (!liveSession.getActiveToolNames().includes("search_tool_bm25")) {
|
|
2323
|
+
await liveSession.setActiveToolsByName([...liveSession.getActiveToolNames(), "search_tool_bm25"]);
|
|
2324
|
+
}
|
|
2325
|
+
return true;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2299
2328
|
const reloadSshTool = async (): Promise<AgentTool | null> => {
|
|
2300
2329
|
if (!requestedToolNameSet.has("ssh")) return null;
|
|
2301
2330
|
const sshTool = (await loadSshTool({
|
|
@@ -2704,7 +2733,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2704
2733
|
onPayload,
|
|
2705
2734
|
onResponse,
|
|
2706
2735
|
sessionId: providerSessionId,
|
|
2707
|
-
promptCacheKey:
|
|
2736
|
+
promptCacheKey: providerPromptCacheKey,
|
|
2708
2737
|
deadline: options.deadline,
|
|
2709
2738
|
transformContext,
|
|
2710
2739
|
transformProviderContext,
|
|
@@ -2888,6 +2917,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2888
2917
|
agentId: resolvedAgentId,
|
|
2889
2918
|
agentKind,
|
|
2890
2919
|
providerSessionId: options.providerSessionId,
|
|
2920
|
+
providerPromptCacheKeySource,
|
|
2891
2921
|
parentEvalSessionId: options.parentEvalSessionId,
|
|
2892
2922
|
advisorTools,
|
|
2893
2923
|
titleSystemPrompt: options.titleSystemPrompt,
|
|
@@ -3053,18 +3083,11 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
3053
3083
|
mcpManager.setOnToolsChanged(tools => {
|
|
3054
3084
|
void (async () => {
|
|
3055
3085
|
try {
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
? { activateAll: true }
|
|
3060
|
-
: undefined,
|
|
3061
|
-
);
|
|
3062
|
-
if (deferMCPDiscoveryForUI && !mcpDiscoveryEnabled && explicitlyRequestedMCPToolNames.length > 0) {
|
|
3063
|
-
await session.setActiveToolsByName([
|
|
3064
|
-
...session.getActiveToolNames(),
|
|
3065
|
-
...explicitlyRequestedMCPToolNames,
|
|
3066
|
-
]);
|
|
3086
|
+
let activateAll = deferMCPDiscoveryForUI && !mcpDiscoveryEnabled;
|
|
3087
|
+
if (activateAll && (await enableDeferredMCPDiscoveryForTools(session, tools))) {
|
|
3088
|
+
activateAll = false;
|
|
3067
3089
|
}
|
|
3090
|
+
await session.refreshMCPTools(tools, activateAll ? { activateAll: true } : undefined);
|
|
3068
3091
|
} catch (error) {
|
|
3069
3092
|
logger.warn("MCP tool refresh failed", {
|
|
3070
3093
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -3106,7 +3129,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
3106
3129
|
startDeferredMCPDiscovery?.(session, {
|
|
3107
3130
|
mcpDiscoveryEnabled,
|
|
3108
3131
|
explicitlyRequestedMCPToolNames,
|
|
3109
|
-
activateAllMCPTools: !mcpDiscoveryEnabled
|
|
3132
|
+
activateAllMCPTools: !mcpDiscoveryEnabled,
|
|
3110
3133
|
});
|
|
3111
3134
|
|
|
3112
3135
|
return {
|