mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 00:04:49 +00:00
fix(sdk): extensions: [] now disables discovery as documented (#465)
This commit is contained in:
parent
6a8609ac56
commit
042d3fa310
3 changed files with 14 additions and 6 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- SDK: passing `extensions: []` now disables extension discovery as documented ([#465](https://github.com/badlogic/pi-mono/pull/465) by [@aliou](https://github.com/aliou))
|
||||||
|
|
||||||
## [0.36.0] - 2026-01-05
|
## [0.36.0] - 2026-01-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@
|
||||||
* IMPORTANT: When providing `tools` with a custom `cwd`, use the tool factory
|
* IMPORTANT: When providing `tools` with a custom `cwd`, use the tool factory
|
||||||
* functions (createReadTool, createBashTool, etc.) to ensure tools resolve
|
* functions (createReadTool, createBashTool, etc.) to ensure tools resolve
|
||||||
* paths relative to your cwd.
|
* paths relative to your cwd.
|
||||||
*
|
|
||||||
* NOTE: Extensions (extensions, custom tools) are always loaded via discovery.
|
|
||||||
* To use custom extensions, place them in the extensions directory or
|
|
||||||
* pass paths via additionalExtensionPaths.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getModel } from "@mariozechner/pi-ai";
|
import { getModel } from "@mariozechner/pi-ai";
|
||||||
|
|
@ -57,8 +53,8 @@ const { session } = await createAgentSession({
|
||||||
Available: read, bash. Be concise.`,
|
Available: read, bash. Be concise.`,
|
||||||
// Use factory functions with the same cwd to ensure path resolution works correctly
|
// Use factory functions with the same cwd to ensure path resolution works correctly
|
||||||
tools: [createReadTool(cwd), createBashTool(cwd)],
|
tools: [createReadTool(cwd), createBashTool(cwd)],
|
||||||
// Extensions are loaded from disk - use additionalExtensionPaths to add custom ones
|
// Pass empty array to disable extension discovery, or provide inline factories
|
||||||
// additionalExtensionPaths: ["./my-extension.ts"],
|
extensions: [],
|
||||||
skills: [],
|
skills: [],
|
||||||
contextFiles: [],
|
contextFiles: [],
|
||||||
promptTemplates: [],
|
promptTemplates: [],
|
||||||
|
|
|
||||||
|
|
@ -444,6 +444,14 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
||||||
errors: [],
|
errors: [],
|
||||||
setUIContext: () => {},
|
setUIContext: () => {},
|
||||||
};
|
};
|
||||||
|
} else if (options.extensions !== undefined) {
|
||||||
|
// User explicitly provided extensions array (even if empty) - skip discovery
|
||||||
|
// Inline factories from options.extensions are loaded below
|
||||||
|
extensionsResult = {
|
||||||
|
extensions: [],
|
||||||
|
errors: [],
|
||||||
|
setUIContext: () => {},
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
// Discover extensions, merging with additional paths
|
// Discover extensions, merging with additional paths
|
||||||
const configuredPaths = [...settingsManager.getExtensionPaths(), ...(options.additionalExtensionPaths ?? [])];
|
const configuredPaths = [...settingsManager.getExtensionPaths(), ...(options.additionalExtensionPaths ?? [])];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue