@opencow-ai/opencow-agent-sdk 0.4.16 → 0.4.18
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/README.md +6 -0
- package/dist/Tool.d.ts +5 -11
- package/dist/capabilities/mcp/utils.d.ts +6 -6
- package/dist/capabilities/shell/posixShellDetection.d.ts +1 -0
- package/dist/capabilities/shell/powershellDetection.d.ts +1 -10
- package/dist/capabilities/shell/shellCapabilities.d.ts +33 -0
- package/dist/capabilities/shell/shellProvider.d.ts +0 -1
- package/dist/capabilities/shell/shellToolUtils.d.ts +0 -10
- package/dist/capabilities/tools/BashTool/prompt.d.ts +1 -0
- package/dist/capabilities/tools/NotebookEditTool/NotebookEditTool.d.ts +0 -8
- package/dist/cli.mjs +174762 -175646
- package/dist/client.js +4518 -4772
- package/dist/constants/envVars.d.ts +0 -2
- package/dist/constants/prompts.d.ts +6 -4
- package/dist/entrypoints/sdk/runtimeTypes.d.ts +9 -0
- package/dist/lib/frontmatterParser.d.ts +4 -4
- package/dist/lib/windowsPaths.d.ts +12 -10
- package/dist/providers/shared/model/model.d.ts +0 -9
- package/dist/sdk.js +4518 -4772
- package/dist/session/collapseReadSearch.d.ts +2 -1
- package/dist/session/promptShellExecution.d.ts +3 -5
- package/dist/session/sessionStorage.d.ts +0 -4
- package/dist/session/settings/types.d.ts +0 -9
- package/dist/state/AppStateStore.d.ts +3 -4
- package/dist/tasks/LocalAgentTask/LocalAgentTask.d.ts +3 -3
- package/dist/tools.d.ts +6 -7
- package/dist/types/hooks.d.ts +0 -2
- package/dist/types/logs.d.ts +1 -26
- package/dist/types/toolRuntime.d.ts +0 -2
- package/package.json +1 -1
- package/dist/capabilities/generatedFiles.d.ts +0 -14
- package/dist/capabilities/tools/shared/teamMemorySync/index.d.ts +0 -121
- package/dist/capabilities/tools/shared/teamMemorySync/types.d.ts +0 -132
- package/dist/capabilities/tools/shared/teamMemorySync/watcher.d.ts +0 -78
- package/dist/lib/sequential.d.ts +0 -12
- package/dist/session/attribution.d.ts +0 -40
- package/dist/session/commitAttribution.d.ts +0 -193
- package/dist/session/sessionFileAccessHooks.d.ts +0 -11
package/README.md
CHANGED
|
@@ -148,6 +148,7 @@ const stream = query({
|
|
|
148
148
|
cwd: process.cwd(),
|
|
149
149
|
model: 'gpt-4o',
|
|
150
150
|
maxTurns: 3,
|
|
151
|
+
builtInToolPreset: 'default',
|
|
151
152
|
},
|
|
152
153
|
})
|
|
153
154
|
|
|
@@ -158,6 +159,11 @@ for await (const message of stream) {
|
|
|
158
159
|
}
|
|
159
160
|
```
|
|
160
161
|
|
|
162
|
+
`builtInToolPreset: 'default'` enables the SDK-owned tools for that query.
|
|
163
|
+
On Windows the SDK registers Bash when Git Bash is available; otherwise it
|
|
164
|
+
registers PowerShell (`pwsh`, then Windows PowerShell). Use `'none'`, or omit
|
|
165
|
+
the option, when the embedding host does not want SDK built-in tools.
|
|
166
|
+
|
|
161
167
|
### Use SDK MCP tools in-process
|
|
162
168
|
|
|
163
169
|
```bash
|
package/dist/Tool.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type { SpinnerMode } from './types/spinner.js';
|
|
|
22
22
|
import type { HookProgress } from './types/hooks.js';
|
|
23
23
|
import type { DeepImmutable } from './types/utils.js';
|
|
24
24
|
import type { ToolUI } from './types/toolUI.js';
|
|
25
|
-
import type { ToolRuntimeContext } from './types/toolRuntime.js';
|
|
25
|
+
import type { ToolRuntimeContext, ToolRuntimes } from './types/toolRuntime.js';
|
|
26
26
|
export type QueryChainTracking = {
|
|
27
27
|
chainId: string;
|
|
28
28
|
depth: number;
|
|
@@ -80,13 +80,7 @@ export type ToolUICallbacks = {
|
|
|
80
80
|
/** Open the interactive message selector dialog (REPL only). */
|
|
81
81
|
openMessageSelector?: () => void;
|
|
82
82
|
};
|
|
83
|
-
export type ToolUseContext = ToolRuntimeContext & ToolUICallbacks
|
|
84
|
-
/** Narrow tools to full Tool[] for CLI code that needs render methods. */
|
|
85
|
-
options: ToolRuntimeContext['options'] & {
|
|
86
|
-
tools: Tools;
|
|
87
|
-
refreshTools?: () => Tools;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
83
|
+
export type ToolUseContext = ToolRuntimeContext & ToolUICallbacks;
|
|
90
84
|
export type { ToolProgressData };
|
|
91
85
|
export type Progress = ToolProgressData | HookProgress;
|
|
92
86
|
export type ToolProgress<P extends ToolProgressData> = {
|
|
@@ -97,7 +91,7 @@ export declare function filterToolProgressMessages(progressMessagesForMessage: P
|
|
|
97
91
|
export type ToolResult<T> = {
|
|
98
92
|
data: T;
|
|
99
93
|
newMessages?: (UserMessage | AssistantMessage | AttachmentMessage | SystemMessage)[];
|
|
100
|
-
contextModifier?: (context:
|
|
94
|
+
contextModifier?: (context: ToolRuntimeContext) => ToolRuntimeContext;
|
|
101
95
|
/** MCP protocol metadata (structuredContent, _meta) to pass through to SDK consumers */
|
|
102
96
|
mcpMeta?: {
|
|
103
97
|
_meta?: Record<string, unknown>;
|
|
@@ -136,7 +130,7 @@ export type Tool<Input extends AnyObject = AnyObject, Output = unknown, P extend
|
|
|
136
130
|
description(input: z.infer<Input>, options: {
|
|
137
131
|
isNonInteractiveSession: boolean;
|
|
138
132
|
toolPermissionContext: ToolPermissionContext;
|
|
139
|
-
tools:
|
|
133
|
+
tools: ToolRuntimes;
|
|
140
134
|
}): Promise<string>;
|
|
141
135
|
readonly inputSchema: Input;
|
|
142
136
|
readonly inputJSONSchema?: ToolInputJSONSchema;
|
|
@@ -248,7 +242,7 @@ export type Tool<Input extends AnyObject = AnyObject, Output = unknown, P extend
|
|
|
248
242
|
preparePermissionMatcher?(input: z.infer<Input>): Promise<(pattern: string) => boolean>;
|
|
249
243
|
prompt(options: {
|
|
250
244
|
getToolPermissionContext: () => Promise<ToolPermissionContext>;
|
|
251
|
-
tools:
|
|
245
|
+
tools: ToolRuntimes;
|
|
252
246
|
agents: AgentDefinition[];
|
|
253
247
|
allowedAgentTypes?: string[];
|
|
254
248
|
}): Promise<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Command } from '../../types/command.js';
|
|
2
2
|
type AgentMcpServerInfo = any;
|
|
3
|
-
import type {
|
|
3
|
+
import type { ToolRuntime } from '../../types/toolRuntime.js';
|
|
4
4
|
import type { AgentDefinition } from '../tools/AgentTool/loadAgentsDir.js';
|
|
5
5
|
import { type ConfigScope, type MCPServerConnection, type McpServerConfig, type ScopedMcpServerConfig, type ServerResource } from './types.js';
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ import { type ConfigScope, type MCPServerConnection, type McpServerConfig, type
|
|
|
10
10
|
* @param serverName Name of the MCP server
|
|
11
11
|
* @returns Tools belonging to the specified server
|
|
12
12
|
*/
|
|
13
|
-
export declare function filterToolsByServer(tools:
|
|
13
|
+
export declare function filterToolsByServer(tools: ToolRuntime[], serverName: string): ToolRuntime[];
|
|
14
14
|
/**
|
|
15
15
|
* True when a command belongs to the given MCP server.
|
|
16
16
|
*
|
|
@@ -49,7 +49,7 @@ export declare function filterResourcesByServer(resources: ServerResource[], ser
|
|
|
49
49
|
* @param serverName Name of the MCP server to exclude
|
|
50
50
|
* @returns Tools not belonging to the specified server
|
|
51
51
|
*/
|
|
52
|
-
export declare function excludeToolsByServer(tools:
|
|
52
|
+
export declare function excludeToolsByServer(tools: ToolRuntime[], serverName: string): ToolRuntime[];
|
|
53
53
|
/**
|
|
54
54
|
* Removes commands belonging to a specific MCP server
|
|
55
55
|
* @param commands Array of commands
|
|
@@ -87,12 +87,12 @@ export declare function hashMcpConfig(config: ScopedMcpServerConfig): string;
|
|
|
87
87
|
*/
|
|
88
88
|
export declare function excludeStalePluginClients(mcp: {
|
|
89
89
|
clients: MCPServerConnection[];
|
|
90
|
-
tools:
|
|
90
|
+
tools: ToolRuntime[];
|
|
91
91
|
commands: Command[];
|
|
92
92
|
resources: Record<string, ServerResource[]>;
|
|
93
93
|
}, configs: Record<string, ScopedMcpServerConfig>): {
|
|
94
94
|
clients: MCPServerConnection[];
|
|
95
|
-
tools:
|
|
95
|
+
tools: ToolRuntime[];
|
|
96
96
|
commands: Command[];
|
|
97
97
|
resources: Record<string, ServerResource[]>;
|
|
98
98
|
stale: MCPServerConnection[];
|
|
@@ -109,7 +109,7 @@ export declare function isToolFromMcpServer(toolName: string, serverName: string
|
|
|
109
109
|
* @param tool The tool to check
|
|
110
110
|
* @returns True if the tool is from an MCP server
|
|
111
111
|
*/
|
|
112
|
-
export declare function isMcpTool(tool:
|
|
112
|
+
export declare function isMcpTool(tool: Pick<ToolRuntime, 'name' | 'isMcp'>): boolean;
|
|
113
113
|
/**
|
|
114
114
|
* Checks if a command belongs to any MCP server
|
|
115
115
|
* @param command The command to check
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findPosixShell(): Promise<string>;
|
|
@@ -10,11 +10,6 @@
|
|
|
10
10
|
* Windows/macOS, PATH is sufficient.
|
|
11
11
|
*/
|
|
12
12
|
export declare function findPowerShell(): Promise<string | null>;
|
|
13
|
-
/**
|
|
14
|
-
* Gets the cached PowerShell path. Returns a memoized promise that
|
|
15
|
-
* resolves to the PowerShell executable path or null.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getCachedPowerShellPath(): Promise<string | null>;
|
|
18
13
|
export type PowerShellEdition = 'core' | 'desktop';
|
|
19
14
|
/**
|
|
20
15
|
* Infers the PowerShell edition from the binary name without spawning.
|
|
@@ -29,8 +24,4 @@ export type PowerShellEdition = 'core' | 'desktop';
|
|
|
29
24
|
* the model doesn't emit `cmd1 && cmd2` on 5.1 (parser error) or avoid
|
|
30
25
|
* `&&` on 7+ where it's the correct short-circuiting operator.
|
|
31
26
|
*/
|
|
32
|
-
export declare function
|
|
33
|
-
/**
|
|
34
|
-
* Resets the cached PowerShell path. Only for testing.
|
|
35
|
-
*/
|
|
36
|
-
export declare function resetPowerShellCache(): void;
|
|
27
|
+
export declare function inferPowerShellEdition(executablePath: string | null): PowerShellEdition | null;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Platform } from '../../lib/platform.js';
|
|
2
|
+
import { type GitBashExecutable } from '../../lib/windowsPaths.js';
|
|
3
|
+
import type { ShellType } from './shellProvider.js';
|
|
4
|
+
export type ShellCapabilitySource = 'env' | 'standard-path' | 'path';
|
|
5
|
+
export type ShellExecutable = {
|
|
6
|
+
type: ShellType;
|
|
7
|
+
path: string;
|
|
8
|
+
source: ShellCapabilitySource;
|
|
9
|
+
};
|
|
10
|
+
export type ShellCapabilities = {
|
|
11
|
+
platform: Platform;
|
|
12
|
+
defaultShell: ShellExecutable | null;
|
|
13
|
+
bash: ShellExecutable | null;
|
|
14
|
+
powershell: ShellExecutable | null;
|
|
15
|
+
};
|
|
16
|
+
export type ShellCapabilityDependencies = {
|
|
17
|
+
platform: () => Platform;
|
|
18
|
+
findGitBash: () => GitBashExecutable | null;
|
|
19
|
+
findPowerShell: () => Promise<string | null>;
|
|
20
|
+
findPosixShell: () => Promise<string>;
|
|
21
|
+
setProcessShell: (shellPath: string) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare class ShellCapabilityError extends Error {
|
|
24
|
+
readonly code: 'NO_SHELL_AVAILABLE' | 'SHELL_NOT_AVAILABLE';
|
|
25
|
+
constructor(code: 'NO_SHELL_AVAILABLE' | 'SHELL_NOT_AVAILABLE', message: string);
|
|
26
|
+
}
|
|
27
|
+
export declare function detectShellCapabilities(dependencies?: ShellCapabilityDependencies): Promise<ShellCapabilities>;
|
|
28
|
+
export declare function initializeShellCapabilities(): Promise<ShellCapabilities>;
|
|
29
|
+
export declare function resolveShellCapability(capabilities: ShellCapabilities, type?: ShellType): ShellExecutable;
|
|
30
|
+
export declare function requireDefaultShellCapability(): Promise<ShellExecutable>;
|
|
31
|
+
export declare function requireShellCapability(type: ShellType): Promise<ShellExecutable>;
|
|
32
|
+
/** Test-only reset for deterministic platform and PATH fixtures. */
|
|
33
|
+
export declare function resetShellCapabilitiesForTest(): void;
|
|
@@ -1,11 +1 @@
|
|
|
1
1
|
export declare const SHELL_TOOL_NAMES: string[];
|
|
2
|
-
/**
|
|
3
|
-
* Runtime gate for PowerShellTool. Windows-only (the permission engine uses
|
|
4
|
-
* Win32-specific path normalizations). Ant defaults on (opt-out via env=0);
|
|
5
|
-
* external defaults off (opt-in via env=1).
|
|
6
|
-
*
|
|
7
|
-
* Used by tools.ts (tool-list visibility), processBashCommand (! routing),
|
|
8
|
-
* and promptShellExecution (skill frontmatter routing) so the gate is
|
|
9
|
-
* consistent across all paths that invoke PowerShellTool.call().
|
|
10
|
-
*/
|
|
11
|
-
export declare function isPowerShellToolEnabled(): boolean;
|
|
@@ -27,8 +27,6 @@ export declare const outputSchema: () => z.ZodObject<{
|
|
|
27
27
|
edit_mode: z.ZodString;
|
|
28
28
|
error: z.ZodOptional<z.ZodString>;
|
|
29
29
|
notebook_path: z.ZodString;
|
|
30
|
-
original_file: z.ZodString;
|
|
31
|
-
updated_file: z.ZodString;
|
|
32
30
|
}, z.core.$strip>;
|
|
33
31
|
type OutputSchema = ReturnType<typeof outputSchema>;
|
|
34
32
|
export type Output = z.infer<OutputSchema>;
|
|
@@ -71,8 +69,6 @@ export declare const NotebookEditTool: Omit<{
|
|
|
71
69
|
language: string;
|
|
72
70
|
edit_mode: string;
|
|
73
71
|
notebook_path: string;
|
|
74
|
-
original_file: string;
|
|
75
|
-
updated_file: string;
|
|
76
72
|
cell_id?: string;
|
|
77
73
|
error?: string;
|
|
78
74
|
}, toolUseID: string): {
|
|
@@ -120,8 +116,6 @@ export declare const NotebookEditTool: Omit<{
|
|
|
120
116
|
error: string;
|
|
121
117
|
cell_id: string;
|
|
122
118
|
notebook_path: string;
|
|
123
|
-
original_file: string;
|
|
124
|
-
updated_file: string;
|
|
125
119
|
};
|
|
126
120
|
} | {
|
|
127
121
|
data: {
|
|
@@ -132,8 +126,6 @@ export declare const NotebookEditTool: Omit<{
|
|
|
132
126
|
cell_id: any;
|
|
133
127
|
error: string;
|
|
134
128
|
notebook_path: string;
|
|
135
|
-
original_file: string;
|
|
136
|
-
updated_file: string;
|
|
137
129
|
};
|
|
138
130
|
}>;
|
|
139
131
|
}, "isEnabled" | "isConcurrencySafe" | "isReadOnly" | "isDestructive" | "checkPermissions" | "toAutoClassifierInput" | "userFacingName"> & {
|