@nuvin/agent-core 0.2.0-rc.1 → 0.2.0-rc.11
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/VERSION +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/agent/metrics.d.ts +17 -1
- package/dist/chunk-D5IVWJHX.js +1 -1
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-GAZGO6N7.js +1 -0
- package/dist/chunk-IUZALP6K.js +1 -0
- package/dist/chunk-KIIEBXJF.js +1 -0
- package/dist/chunk-LIE76IJA.js +1 -0
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/chunk-YNOIG4FD.js +1 -0
- package/dist/formats/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/lsp/client.d.ts +4 -0
- package/dist/models/chat-model.d.ts +1 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +1 -1
- package/dist/models/mock-model.d.ts +2 -0
- package/dist/models/model-cost.d.ts +5 -0
- package/dist/models/model-pricing-generator.d.ts +9 -0
- package/dist/models/model-pricing-products.d.ts +45 -0
- package/dist/models/model-pricing-types.d.ts +33 -0
- package/dist/models/model-pricing.d.ts +13 -0
- package/dist/models/model-pricing.generated.d.ts +23147 -0
- package/dist/models/model-registry.d.ts +8 -0
- package/dist/models/openai-surfaces.d.ts +4 -1
- package/dist/models/routed-model.d.ts +3 -0
- package/dist/shared/abort-aware-semaphore.d.ts +5 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -1
- package/dist/shared/reasoning-config.d.ts +3 -4
- package/dist/shared/types.d.ts +105 -24
- package/dist/tools/{internal-tool-runtime.d.ts → core/internal-tool-runtime.d.ts} +1 -1
- package/dist/tools/core/mock-tool-runtime.d.ts +3 -0
- package/dist/tools/core/runtime-manager-tools.d.ts +87 -0
- package/dist/tools/{tool-output-offload.d.ts → core/tool-output-offload.d.ts} +1 -1
- package/dist/tools/{tools.d.ts → core/tools.d.ts} +4 -1
- package/dist/tools/file-editing/anchored-file-edit.d.ts +53 -0
- package/dist/tools/file-editing/anchored-file-errors.d.ts +5 -0
- package/dist/tools/file-editing/anchored-file-operations.d.ts +38 -0
- package/dist/tools/file-editing/anchored-file-read.d.ts +37 -0
- package/dist/tools/file-editing/atomic-file-write.d.ts +19 -0
- package/dist/tools/file-editing/file-edit-tool.d.ts +166 -0
- package/dist/tools/file-editing/file-mutation-coordinator.d.ts +13 -0
- package/dist/tools/file-editing/file-mutation.d.ts +15 -0
- package/dist/tools/{file-new-tool.d.ts → file-editing/file-new-tool.d.ts} +5 -2
- package/dist/tools/file-editing/file-observation-store.d.ts +40 -0
- package/dist/tools/{file-read-tool.d.ts → file-editing/file-read-tool.d.ts} +8 -2
- package/dist/tools/file-editing/file-snapshot.d.ts +16 -0
- package/dist/tools/file-editing/hashline-file-edit-adapter.d.ts +19 -0
- package/dist/tools/file-editing/structured-file-edit-adapter.d.ts +94 -0
- package/dist/tools/file-editing/workspace-paths.d.ts +20 -0
- package/dist/tools/index.d.ts +43 -29
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp/mcp-connection-generation.d.ts +59 -0
- package/dist/tools/mcp/mcp-safe-error-provenance.d.ts +4 -0
- package/dist/tools/mcp/mcp-safe-error.d.ts +14 -0
- package/dist/tools/mcp/mcp-server-manager.d.ts +16 -0
- package/dist/tools/mcp/mcp-tool-adapter.d.ts +72 -0
- package/dist/tools/{glob-tool.d.ts → search/glob-tool.d.ts} +2 -2
- package/dist/tools/search/grep-engine.d.ts +22 -0
- package/dist/tools/{grep-tool.d.ts → search/grep-tool.d.ts} +3 -3
- package/dist/tools/{ls-tool.d.ts → search/ls-tool.d.ts} +2 -2
- package/dist/tools/{ripgrep.d.ts → search/ripgrep.d.ts} +1 -0
- package/dist/tools/{view-file-tool.d.ts → search/view-file-tool.d.ts} +2 -2
- package/dist/tools/{ask-user-tool.d.ts → session/ask-user-tool.d.ts} +2 -2
- package/dist/tools/{lsp-tool.d.ts → session/lsp-tool.d.ts} +5 -5
- package/dist/tools/{skill-tool.d.ts → session/skill-tool.d.ts} +2 -2
- package/dist/tools/{todo-write-tool.d.ts → session/todo-write-tool.d.ts} +2 -2
- package/dist/tools/session/update-topic-tool.d.ts +12 -0
- package/dist/tools/shell/background-process-registry.d.ts +116 -0
- package/dist/tools/{bash-output-tool.d.ts → shell/bash-output-tool.d.ts} +2 -2
- package/dist/tools/{bash-tool.d.ts → shell/bash-tool.d.ts} +10 -6
- package/dist/tools/{command-tool.d.ts → shell/command-tool.d.ts} +2 -2
- package/dist/tools/{kill-shell-tool.d.ts → shell/kill-shell-tool.d.ts} +2 -2
- package/dist/tools/shell/process-tree-termination.d.ts +25 -0
- package/dist/tools/shell/terminal-output-normalizer.d.ts +6 -0
- package/dist/tools/{web-fetch-tool.d.ts → web/web-fetch-tool.d.ts} +2 -2
- package/dist/tools/{web-search-tool.d.ts → web/web-search-tool.d.ts} +2 -2
- package/package.json +4 -3
- package/dist/chunk-E4R6CEFK.js +0 -1
- package/dist/chunk-NYZR4XKO.js +0 -1
- package/dist/chunk-RABU4RC2.js +0 -1
- package/dist/chunk-RTDLM6FU.js +0 -1
- package/dist/tools/background-process-registry.d.ts +0 -64
- package/dist/tools/file-edit-tool.d.ts +0 -34
- package/dist/tools/mcp-server-manager.d.ts +0 -60
- package/dist/tools/mcp-tool-adapter.d.ts +0 -47
- package/dist/tools/mock-tool-runtime.d.ts +0 -3
- package/dist/tools/runtime-manager-tools.d.ts +0 -58
- package/dist/tools/update-topic-tool.d.ts +0 -12
- package/dist/tools/workspace-paths.d.ts +0 -5
- /package/dist/tools/{mcp-oauth-provider.d.ts → mcp/mcp-oauth-provider.d.ts} +0 -0
- /package/dist/tools/{bash-internals.d.ts → shell/bash-internals.d.ts} +0 -0
- /package/dist/tools/{safe-fetch.d.ts → web/safe-fetch.d.ts} +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { MCPServerConfig } from "@nuvin/config";
|
|
2
|
+
import type { AnyToolDefinition, ToolDefinitionLifecycle, ToolPermissionClass } from "../../shared/types.ts";
|
|
3
|
+
import { type McpServerToolInfo, type McpToolClient, type McpToolDescriptor } from "./mcp-tool-adapter.ts";
|
|
4
|
+
export interface McpTimeoutSource {
|
|
5
|
+
get(): number;
|
|
6
|
+
set(timeoutMs: number): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createMcpTimeoutSource(initialTimeoutMs: number): McpTimeoutSource;
|
|
9
|
+
export declare function resolveMcpTimeoutMs(server: MCPServerConfig, defaultTimeoutMs: number | undefined): number;
|
|
10
|
+
export type McpTerminalTransportError = {
|
|
11
|
+
readonly code: "mcp-transport-error";
|
|
12
|
+
readonly cause: unknown;
|
|
13
|
+
};
|
|
14
|
+
export interface ConnectedMcpClient extends McpToolClient {
|
|
15
|
+
listTools(options?: {
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}): Promise<{
|
|
18
|
+
tools: McpToolDescriptor[];
|
|
19
|
+
}>;
|
|
20
|
+
onTerminalError?(listener: (event: McpTerminalTransportError) => void): () => void;
|
|
21
|
+
close(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export interface McpConnectionOptions {
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
oauth?: {
|
|
26
|
+
storageDir: string;
|
|
27
|
+
callbackUrl: string;
|
|
28
|
+
onRedirect(serverName: string, url: URL): void | Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
timeoutSource?: McpTimeoutSource;
|
|
31
|
+
}
|
|
32
|
+
export type McpConnector = (serverName: string, config: MCPServerConfig, options?: McpConnectionOptions) => Promise<ConnectedMcpClient>;
|
|
33
|
+
export interface McpConnectionGeneration {
|
|
34
|
+
readonly client: ConnectedMcpClient;
|
|
35
|
+
readonly descriptors: readonly McpToolDescriptor[];
|
|
36
|
+
readonly lifecycle: ToolDefinitionLifecycle;
|
|
37
|
+
projectTools(input: {
|
|
38
|
+
serverName: string;
|
|
39
|
+
prefix?: string;
|
|
40
|
+
allowedTools?: Record<string, boolean>;
|
|
41
|
+
toolPermissions?: Record<string, ToolPermissionClass>;
|
|
42
|
+
}): {
|
|
43
|
+
tools: AnyToolDefinition[];
|
|
44
|
+
descriptors: McpServerToolInfo[];
|
|
45
|
+
};
|
|
46
|
+
onTerminalError(listener: (event: McpTerminalTransportError) => void): () => void;
|
|
47
|
+
retire(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export declare function buildMcpHttpHeaders(config: MCPServerConfig): Record<string, string> | undefined;
|
|
50
|
+
export declare function connectMcpServer(serverName: string, config: MCPServerConfig, options?: McpConnectionOptions): Promise<ConnectedMcpClient>;
|
|
51
|
+
export declare function createMcpConnectionGeneration(input: {
|
|
52
|
+
serverName: string;
|
|
53
|
+
config: MCPServerConfig;
|
|
54
|
+
timeoutSource: McpTimeoutSource;
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
connection?: McpConnectionOptions;
|
|
57
|
+
connect?: McpConnector;
|
|
58
|
+
}): Promise<McpConnectionGeneration>;
|
|
59
|
+
//# sourceMappingURL=mcp-connection-generation.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type McpSafeError, toMcpSafeError } from "./mcp-safe-error.ts";
|
|
2
|
+
export declare function createOwnedMcpSafeError(input: Parameters<typeof toMcpSafeError>[0]): McpSafeError;
|
|
3
|
+
export declare function extractOwnedMcpSafeError(error: unknown): McpSafeError | undefined;
|
|
4
|
+
//# sourceMappingURL=mcp-safe-error-provenance.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type McpSafeErrorCode = "mcp-auth-required" | "mcp-close-failed" | "mcp-connect-failed" | "mcp-discovery-failed" | "mcp-request-timeout" | "mcp-tool-call-failed";
|
|
2
|
+
export type McpSafeError = {
|
|
3
|
+
code: McpSafeErrorCode;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
type McpOperation = "close" | "connect" | "discover" | "toolCall";
|
|
7
|
+
export declare function toMcpSafeError(input: {
|
|
8
|
+
serverName: string;
|
|
9
|
+
operation: McpOperation;
|
|
10
|
+
error: unknown;
|
|
11
|
+
}): McpSafeError;
|
|
12
|
+
export declare function redactMcpDiagnostic(text: string, secrets: readonly string[]): string;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=mcp-safe-error.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { ConnectedMcpClient, McpConnectionOptions, McpConnector, } from "./mcp-connection-generation.ts";
|
|
2
|
+
export { buildMcpHttpHeaders, connectMcpServer, } from "./mcp-connection-generation.ts";
|
|
3
|
+
export type { McpServerToolInfo } from "./mcp-tool-adapter.ts";
|
|
4
|
+
export type McpServerConnectionStatus = {
|
|
5
|
+
status: "connected";
|
|
6
|
+
toolCount: number;
|
|
7
|
+
} | {
|
|
8
|
+
status: "disabled";
|
|
9
|
+
} | {
|
|
10
|
+
status: "authRequired";
|
|
11
|
+
message: string;
|
|
12
|
+
} | {
|
|
13
|
+
status: "error";
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=mcp-server-manager.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import type { AnyToolDefinition, JsonObject, JsonSchema, JsonSchemaObject, JsonValue, ToolDefinitionLifecycle, ToolPermissionClass } from "../../shared/types.ts";
|
|
3
|
+
export interface McpToolDescriptor {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
inputSchema?: unknown;
|
|
7
|
+
annotations?: {
|
|
8
|
+
readOnlyHint?: unknown;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface McpToolClient {
|
|
12
|
+
callTool(input: {
|
|
13
|
+
name: string;
|
|
14
|
+
arguments?: JsonObject;
|
|
15
|
+
}): Promise<CallToolResult>;
|
|
16
|
+
}
|
|
17
|
+
export interface McpServerToolInfo {
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
inputSchema?: JsonValue;
|
|
21
|
+
permissionClass: ToolPermissionClass;
|
|
22
|
+
permissionConfigured: boolean;
|
|
23
|
+
suggestedPermissionClass?: "read" | "write";
|
|
24
|
+
}
|
|
25
|
+
export declare function projectMcpTools(input: {
|
|
26
|
+
serverName: string;
|
|
27
|
+
prefix?: string;
|
|
28
|
+
descriptors: readonly McpToolDescriptor[];
|
|
29
|
+
client: McpToolClient;
|
|
30
|
+
lifecycle: ToolDefinitionLifecycle;
|
|
31
|
+
allowedTools?: Record<string, boolean>;
|
|
32
|
+
toolPermissions?: Record<string, ToolPermissionClass>;
|
|
33
|
+
}): {
|
|
34
|
+
tools: AnyToolDefinition[];
|
|
35
|
+
descriptors: McpServerToolInfo[];
|
|
36
|
+
};
|
|
37
|
+
export declare function createMcpToolName(serverName: string, toolName: string): string;
|
|
38
|
+
export declare function toNuvinToolSchema(inputSchema: unknown): JsonSchemaObject;
|
|
39
|
+
export declare function createMcpTool(options: {
|
|
40
|
+
serverName: string;
|
|
41
|
+
tool: McpToolDescriptor;
|
|
42
|
+
client: McpToolClient;
|
|
43
|
+
permissionClass: ToolPermissionClass;
|
|
44
|
+
internalLifecycle?: ToolDefinitionLifecycle;
|
|
45
|
+
}): import("../../shared/types.ts").ToolDefinition<{
|
|
46
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | {
|
|
47
|
+
[x: string]: JsonValue | /*elided*/ any | /*elided*/ any;
|
|
48
|
+
})[] | {
|
|
49
|
+
[x: string]: JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any;
|
|
50
|
+
})[] | {
|
|
51
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
52
|
+
})[] | {
|
|
53
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
54
|
+
})[] | {
|
|
55
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
56
|
+
})[] | {
|
|
57
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
58
|
+
})[] | {
|
|
59
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
60
|
+
})[] | {
|
|
61
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
62
|
+
})[] | {
|
|
63
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
64
|
+
})[] | {
|
|
65
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
66
|
+
})[] | {
|
|
67
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
68
|
+
})[] | {
|
|
69
|
+
[x: string]: JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | (JsonValue | /*elided*/ any | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any)[] | /*elided*/ any;
|
|
70
|
+
};
|
|
71
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, JsonSchemaObject<Record<string, JsonSchema>, readonly string[] | undefined>>;
|
|
72
|
+
//# sourceMappingURL=mcp-tool-adapter.d.ts.map
|
|
@@ -4,11 +4,11 @@ export interface GlobToolOptions {
|
|
|
4
4
|
limit?: number;
|
|
5
5
|
name?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function createGlobTool(options?: GlobToolOptions): import("
|
|
7
|
+
export declare function createGlobTool(options?: GlobToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
8
8
|
pattern: string;
|
|
9
9
|
path?: string | undefined;
|
|
10
10
|
limit?: number | undefined;
|
|
11
|
-
}, import("
|
|
11
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
12
12
|
type: "object";
|
|
13
13
|
properties: {
|
|
14
14
|
pattern: {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as Ripgrep from "./ripgrep.ts";
|
|
2
|
+
export declare const GREP_DEFAULT_LIMIT = 100;
|
|
3
|
+
export declare const GREP_MAX_PATTERN_LENGTH = 1024;
|
|
4
|
+
export declare const GREP_MAX_SNIPPET_LENGTH = 2000;
|
|
5
|
+
export interface RegexSearchOptions {
|
|
6
|
+
cwd: string;
|
|
7
|
+
pattern: string;
|
|
8
|
+
files?: readonly string[];
|
|
9
|
+
glob?: string;
|
|
10
|
+
context?: number;
|
|
11
|
+
limit?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface RegexSearchResult {
|
|
14
|
+
matches: Ripgrep.RipgrepMatch[];
|
|
15
|
+
matchCount: number;
|
|
16
|
+
fileCount: number;
|
|
17
|
+
truncated: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function validateGrepPattern(pattern: string): void;
|
|
20
|
+
export declare function boundedGrepSnippet(line: string): string;
|
|
21
|
+
export declare function searchRegex(options: RegexSearchOptions): Promise<RegexSearchResult>;
|
|
22
|
+
//# sourceMappingURL=grep-engine.d.ts.map
|
|
@@ -4,13 +4,13 @@ export interface GrepToolOptions {
|
|
|
4
4
|
limit?: number;
|
|
5
5
|
name?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function createGrepTool(options?: GrepToolOptions): import("
|
|
7
|
+
export declare function createGrepTool(options?: GrepToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
8
8
|
pattern: string;
|
|
9
9
|
include?: string | undefined;
|
|
10
10
|
path?: string | undefined;
|
|
11
|
-
limit?: number | undefined;
|
|
12
11
|
context?: number | undefined;
|
|
13
|
-
|
|
12
|
+
limit?: number | undefined;
|
|
13
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
14
14
|
type: "object";
|
|
15
15
|
properties: {
|
|
16
16
|
pattern: {
|
|
@@ -3,10 +3,10 @@ export interface LsToolOptions {
|
|
|
3
3
|
defaultCwd?: string;
|
|
4
4
|
name?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function createLsTool(options?: LsToolOptions): import("
|
|
6
|
+
export declare function createLsTool(options?: LsToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
7
7
|
path: string;
|
|
8
8
|
limit: number;
|
|
9
|
-
}, import("
|
|
9
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
10
10
|
type: "object";
|
|
11
11
|
properties: {
|
|
12
12
|
path: {
|
|
@@ -4,10 +4,10 @@ export interface ViewFileToolOptions {
|
|
|
4
4
|
maxBytes?: number;
|
|
5
5
|
name?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function createViewFileTool(options?: ViewFileToolOptions): import("
|
|
7
|
+
export declare function createViewFileTool(options?: ViewFileToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
8
8
|
path: string;
|
|
9
9
|
detail?: string | undefined;
|
|
10
|
-
}, import("
|
|
10
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
11
11
|
type: "object";
|
|
12
12
|
properties: {
|
|
13
13
|
path: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function createAskUserTool(): import("
|
|
1
|
+
export declare function createAskUserTool(): import("../../shared/types.ts").ToolDefinition<{
|
|
2
2
|
answers: {};
|
|
3
3
|
questions: {
|
|
4
4
|
question: string;
|
|
@@ -9,7 +9,7 @@ export declare function createAskUserTool(): import("../shared/types.ts").ToolDe
|
|
|
9
9
|
}[];
|
|
10
10
|
multiSelect: boolean;
|
|
11
11
|
}[];
|
|
12
|
-
}, import("
|
|
12
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, import("../../shared/types.ts").ToolOutputEnvelope | undefined, {
|
|
13
13
|
type: "object";
|
|
14
14
|
properties: {
|
|
15
15
|
questions: {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { LspService } from "
|
|
1
|
+
import type { LspService } from "../../lsp/index.ts";
|
|
2
2
|
export interface LspToolOptions {
|
|
3
3
|
defaultCwd?: string;
|
|
4
4
|
allowedDirs?: readonly string[];
|
|
5
5
|
lspService?: LspService;
|
|
6
6
|
name?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function createLspTool(options?: LspToolOptions): import("
|
|
9
|
-
filePath: string;
|
|
8
|
+
export declare function createLspTool(options?: LspToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
10
9
|
line: number;
|
|
11
|
-
character: number;
|
|
12
10
|
operation: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
character: number;
|
|
13
13
|
query?: string | undefined;
|
|
14
|
-
}, import("
|
|
14
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
15
15
|
type: "object";
|
|
16
16
|
properties: {
|
|
17
17
|
operation: {
|
|
@@ -19,9 +19,9 @@ export interface SkillToolOptions<TRef extends SkillReference = SkillReference>
|
|
|
19
19
|
skills: TRef[];
|
|
20
20
|
loadSkill: (reference: TRef) => Promise<LoadedSkill>;
|
|
21
21
|
}
|
|
22
|
-
export declare function createLoadSkillTool<TRef extends SkillReference>(options: SkillToolOptions<TRef>): import("
|
|
22
|
+
export declare function createLoadSkillTool<TRef extends SkillReference>(options: SkillToolOptions<TRef>): import("../../shared/types.ts").ToolDefinition<{
|
|
23
23
|
name: string;
|
|
24
|
-
}, import("
|
|
24
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
25
25
|
type: "object";
|
|
26
26
|
properties: {
|
|
27
27
|
name: {
|
|
@@ -24,7 +24,7 @@ declare class TodoStore {
|
|
|
24
24
|
setTodos(sessionId: string, todos: TodoItem[]): void;
|
|
25
25
|
getStats(sessionId: string): TodoStats;
|
|
26
26
|
}
|
|
27
|
-
export declare function createTodoWriteTool(store?: TodoStore): import("
|
|
27
|
+
export declare function createTodoWriteTool(store?: TodoStore): import("../../shared/types.ts").ToolDefinition<{
|
|
28
28
|
todos: {
|
|
29
29
|
id: string;
|
|
30
30
|
content: string;
|
|
@@ -32,7 +32,7 @@ export declare function createTodoWriteTool(store?: TodoStore): import("../share
|
|
|
32
32
|
priority: string;
|
|
33
33
|
createdAt: string;
|
|
34
34
|
}[];
|
|
35
|
-
}, never, import("
|
|
35
|
+
}, never, import("../../shared/types.ts").ToolOutputEnvelope, {
|
|
36
36
|
type: "object";
|
|
37
37
|
properties: {
|
|
38
38
|
todos: {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function createUpdateTopicTool(): import("../../shared/types.ts").ToolDefinition<{
|
|
2
|
+
topic: string;
|
|
3
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
4
|
+
readonly type: "object";
|
|
5
|
+
readonly properties: {
|
|
6
|
+
readonly topic: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
readonly required: readonly ["topic"];
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=update-topic-tool.d.ts.map
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
|
+
import { StringDecoder } from "node:string_decoder";
|
|
3
|
+
import { type ProcessTreeSignalAdapter } from "./process-tree-termination.ts";
|
|
4
|
+
import { type TerminalOutputNormalizer } from "./terminal-output-normalizer.ts";
|
|
5
|
+
export type BackgroundProcessStatus = "running" | "terminating" | "exited" | "killed" | "error";
|
|
6
|
+
export interface BackgroundProcessReservation {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BackgroundProcessTerminationResult {
|
|
10
|
+
shellId: string;
|
|
11
|
+
outcome: "killed" | "already-terminal" | "failed";
|
|
12
|
+
status: BackgroundProcessStatus;
|
|
13
|
+
exitCode: number | null;
|
|
14
|
+
signal: NodeJS.Signals | null;
|
|
15
|
+
error: string | null;
|
|
16
|
+
gracefulRequested: boolean;
|
|
17
|
+
forceRequested: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface BackgroundProcessEntry {
|
|
20
|
+
shellId: string;
|
|
21
|
+
command: string;
|
|
22
|
+
cwd: string;
|
|
23
|
+
pid: number | undefined;
|
|
24
|
+
processGroupId: number | undefined;
|
|
25
|
+
status: BackgroundProcessStatus;
|
|
26
|
+
exitCode: number | null;
|
|
27
|
+
signal: NodeJS.Signals | null;
|
|
28
|
+
startedAt: number;
|
|
29
|
+
error: string | null;
|
|
30
|
+
gracefulRequested: boolean;
|
|
31
|
+
forceRequested: boolean;
|
|
32
|
+
child: ChildProcess | null;
|
|
33
|
+
buffer: string[];
|
|
34
|
+
bufferChars: number;
|
|
35
|
+
totalProduced: number;
|
|
36
|
+
totalDropped: number;
|
|
37
|
+
readCursor: number;
|
|
38
|
+
stdoutDecoder: StringDecoder;
|
|
39
|
+
stderrDecoder: StringDecoder;
|
|
40
|
+
stdoutNormalizer: TerminalOutputNormalizer;
|
|
41
|
+
stderrNormalizer: TerminalOutputNormalizer;
|
|
42
|
+
stripAnsi: boolean;
|
|
43
|
+
killRequested: boolean;
|
|
44
|
+
processExited: boolean;
|
|
45
|
+
streamsFlushed: boolean;
|
|
46
|
+
terminalSettled: boolean;
|
|
47
|
+
terminalPromise: Promise<void>;
|
|
48
|
+
resolveTerminal: () => void;
|
|
49
|
+
terminationPromise?: Promise<BackgroundProcessTerminationResult>;
|
|
50
|
+
terminationSettled: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface BackgroundProcessReadResult {
|
|
53
|
+
output: string;
|
|
54
|
+
status: BackgroundProcessStatus;
|
|
55
|
+
exitCode: number | null;
|
|
56
|
+
signal: NodeJS.Signals | null;
|
|
57
|
+
error: string | null;
|
|
58
|
+
truncated: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface BackgroundProcessRegistryOptions {
|
|
61
|
+
maxConcurrent?: number;
|
|
62
|
+
maxEntries?: number;
|
|
63
|
+
capChars?: number;
|
|
64
|
+
platform?: NodeJS.Platform;
|
|
65
|
+
signalAdapter?: ProcessTreeSignalAdapter;
|
|
66
|
+
}
|
|
67
|
+
export declare class BackgroundProcessCleanupError extends Error {
|
|
68
|
+
readonly results: BackgroundProcessTerminationResult[];
|
|
69
|
+
constructor(results: BackgroundProcessTerminationResult[]);
|
|
70
|
+
}
|
|
71
|
+
export declare function isTerminalStatus(status: BackgroundProcessStatus): boolean;
|
|
72
|
+
export declare class BackgroundProcessRegistry {
|
|
73
|
+
private readonly entries;
|
|
74
|
+
private readonly reservations;
|
|
75
|
+
private readonly maxConcurrent;
|
|
76
|
+
private readonly maxEntries;
|
|
77
|
+
private readonly capChars;
|
|
78
|
+
private readonly platform;
|
|
79
|
+
private readonly signalAdapter;
|
|
80
|
+
private counter;
|
|
81
|
+
constructor(opts?: BackgroundProcessRegistryOptions);
|
|
82
|
+
reserve(): BackgroundProcessReservation;
|
|
83
|
+
release(reservation: BackgroundProcessReservation): void;
|
|
84
|
+
attach(reservation: BackgroundProcessReservation, opts: {
|
|
85
|
+
child: ChildProcess;
|
|
86
|
+
command: string;
|
|
87
|
+
cwd: string;
|
|
88
|
+
stripAnsi: boolean;
|
|
89
|
+
processGroupId?: number;
|
|
90
|
+
}): BackgroundProcessEntry;
|
|
91
|
+
/** Compatibility adapter for callers being migrated to reserve/attach. */
|
|
92
|
+
spawn(opts: {
|
|
93
|
+
child: ChildProcess;
|
|
94
|
+
command: string;
|
|
95
|
+
cwd: string;
|
|
96
|
+
stripAnsi: boolean;
|
|
97
|
+
}): BackgroundProcessEntry;
|
|
98
|
+
read(shellId: string, opts?: {
|
|
99
|
+
regex?: string;
|
|
100
|
+
}): BackgroundProcessReadResult;
|
|
101
|
+
list(): BackgroundProcessEntry[];
|
|
102
|
+
kill(shellId: string): Promise<BackgroundProcessTerminationResult>;
|
|
103
|
+
closeAll(): Promise<BackgroundProcessTerminationResult[]>;
|
|
104
|
+
reset(): Promise<BackgroundProcessTerminationResult[]>;
|
|
105
|
+
private terminate;
|
|
106
|
+
private confirmed;
|
|
107
|
+
private failed;
|
|
108
|
+
private result;
|
|
109
|
+
private waitForTerminal;
|
|
110
|
+
private appendDecoded;
|
|
111
|
+
private settleTerminal;
|
|
112
|
+
private flushStreams;
|
|
113
|
+
private append;
|
|
114
|
+
private evictIfNeeded;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=background-process-registry.d.ts.map
|
|
@@ -2,10 +2,10 @@ import type { BackgroundProcessRegistry } from "./background-process-registry.ts
|
|
|
2
2
|
export interface BashOutputToolOptions {
|
|
3
3
|
registry: BackgroundProcessRegistry;
|
|
4
4
|
}
|
|
5
|
-
export declare function createBashOutputTool(options: BashOutputToolOptions): import("
|
|
5
|
+
export declare function createBashOutputTool(options: BashOutputToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
6
6
|
shellId: string;
|
|
7
7
|
regex?: string | undefined;
|
|
8
|
-
}, never, import("
|
|
8
|
+
}, never, import("../../shared/types.ts").ToolOutputEnvelope, {
|
|
9
9
|
type: "object";
|
|
10
10
|
properties: {
|
|
11
11
|
shellId: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BashExecutionTarget, ToolExecutionContext } from "../../shared/types.ts";
|
|
1
2
|
import type { BackgroundProcessRegistry } from "./background-process-registry.ts";
|
|
2
3
|
export interface BashToolInput {
|
|
3
4
|
command: string;
|
|
@@ -18,17 +19,20 @@ export interface BashToolOptions {
|
|
|
18
19
|
shellPath?: string;
|
|
19
20
|
stripAnsi?: boolean;
|
|
20
21
|
scrubEnvKeys?: readonly string[];
|
|
22
|
+
scrubEnvPrefixes?: readonly string[];
|
|
21
23
|
backgroundRegistry?: BackgroundProcessRegistry;
|
|
24
|
+
verifyExecution?: (target: BashExecutionTarget, authorization: unknown, ctx: ToolExecutionContext) => Promise<void> | void;
|
|
22
25
|
}
|
|
23
|
-
export declare function
|
|
26
|
+
export declare function resolveBashExecutionTarget(input: Pick<BashToolInput, "command" | "cwd" | "runInBackground">, options?: Pick<BashToolOptions, "allowedDirs" | "defaultCwd" | "shellPath">): BashExecutionTarget;
|
|
27
|
+
export declare function createBashTool(options?: BashToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
24
28
|
description: string;
|
|
25
29
|
command: string;
|
|
26
30
|
timeoutMs?: number | undefined;
|
|
27
31
|
cwd?: string | undefined;
|
|
32
|
+
runInBackground?: boolean | undefined;
|
|
28
33
|
ignoreOutput?: boolean | undefined;
|
|
29
34
|
outputRegex?: string | undefined;
|
|
30
|
-
|
|
31
|
-
}, string, import("../shared/types.ts").ToolOutputEnvelope, {
|
|
35
|
+
}, string, import("../../shared/types.ts").ToolOutputEnvelope, {
|
|
32
36
|
type: "object";
|
|
33
37
|
properties: {
|
|
34
38
|
command: {
|
|
@@ -57,15 +61,15 @@ export declare function createBashTool(options?: BashToolOptions): import("../sh
|
|
|
57
61
|
};
|
|
58
62
|
required: readonly ["command", "description"];
|
|
59
63
|
}>;
|
|
60
|
-
export declare function createShellExecTool(options?: BashToolOptions): import("
|
|
64
|
+
export declare function createShellExecTool(options?: BashToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
61
65
|
description: string;
|
|
62
66
|
command: string;
|
|
63
67
|
timeoutMs?: number | undefined;
|
|
64
68
|
cwd?: string | undefined;
|
|
69
|
+
runInBackground?: boolean | undefined;
|
|
65
70
|
ignoreOutput?: boolean | undefined;
|
|
66
71
|
outputRegex?: string | undefined;
|
|
67
|
-
|
|
68
|
-
}, string, import("../shared/types.ts").ToolOutputEnvelope, {
|
|
72
|
+
}, string, import("../../shared/types.ts").ToolOutputEnvelope, {
|
|
69
73
|
type: "object";
|
|
70
74
|
properties: {
|
|
71
75
|
command: {
|
|
@@ -5,10 +5,10 @@ export interface CommandToolOptions<TRef extends CommandReference = CommandRefer
|
|
|
5
5
|
commands: TRef[];
|
|
6
6
|
loadCommand: (reference: TRef) => Promise<LoadedCommand>;
|
|
7
7
|
}
|
|
8
|
-
export declare function createInvokeCommandTool<TRef extends CommandReference>(options: CommandToolOptions<TRef>): import("
|
|
8
|
+
export declare function createInvokeCommandTool<TRef extends CommandReference>(options: CommandToolOptions<TRef>): import("../../shared/types.ts").ToolDefinition<{
|
|
9
9
|
name: string;
|
|
10
10
|
args?: string | undefined;
|
|
11
|
-
}, import("
|
|
11
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
12
12
|
type: "object";
|
|
13
13
|
properties: {
|
|
14
14
|
name: {
|
|
@@ -2,9 +2,9 @@ import type { BackgroundProcessRegistry } from "./background-process-registry.ts
|
|
|
2
2
|
export interface KillShellToolOptions {
|
|
3
3
|
registry: BackgroundProcessRegistry;
|
|
4
4
|
}
|
|
5
|
-
export declare function createKillShellTool(options: KillShellToolOptions): import("
|
|
5
|
+
export declare function createKillShellTool(options: KillShellToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
6
6
|
shellId: string;
|
|
7
|
-
}, never, import("
|
|
7
|
+
}, never, import("../../shared/types.ts").ToolOutputEnvelope, {
|
|
8
8
|
type: "object";
|
|
9
9
|
properties: {
|
|
10
10
|
shellId: {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { spawn as nodeSpawn } from "node:child_process";
|
|
2
|
+
export type ProcessTreeTerminationPhase = "graceful" | "force";
|
|
3
|
+
export interface ProcessTreeTarget {
|
|
4
|
+
rootPid: number | undefined;
|
|
5
|
+
processGroupId: number | undefined;
|
|
6
|
+
}
|
|
7
|
+
export type ProcessTreeSignalResult = {
|
|
8
|
+
outcome: "delivered";
|
|
9
|
+
} | {
|
|
10
|
+
outcome: "not-found";
|
|
11
|
+
error: string;
|
|
12
|
+
} | {
|
|
13
|
+
outcome: "failed";
|
|
14
|
+
error: string;
|
|
15
|
+
};
|
|
16
|
+
export interface ProcessTreeSignalAdapter {
|
|
17
|
+
signal(target: ProcessTreeTarget, phase: ProcessTreeTerminationPhase): Promise<ProcessTreeSignalResult>;
|
|
18
|
+
}
|
|
19
|
+
export interface ProcessTreeSignalAdapterOptions {
|
|
20
|
+
platform?: NodeJS.Platform;
|
|
21
|
+
kill?: typeof process.kill;
|
|
22
|
+
spawn?: typeof nodeSpawn;
|
|
23
|
+
}
|
|
24
|
+
export declare function createProcessTreeSignalAdapter(options?: ProcessTreeSignalAdapterOptions): ProcessTreeSignalAdapter;
|
|
25
|
+
//# sourceMappingURL=process-tree-termination.d.ts.map
|
|
@@ -5,10 +5,10 @@ export interface WebFetchToolOptions {
|
|
|
5
5
|
/** DNS resolver used by the SSRF guard. Injectable for tests. */
|
|
6
6
|
lookup?: SafeFetchLookup;
|
|
7
7
|
}
|
|
8
|
-
export declare function createWebFetchTool(options?: WebFetchToolOptions): import("
|
|
8
|
+
export declare function createWebFetchTool(options?: WebFetchToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
9
9
|
url: string;
|
|
10
10
|
description?: string | undefined;
|
|
11
|
-
}, import("
|
|
11
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
12
12
|
type: "object";
|
|
13
13
|
properties: {
|
|
14
14
|
description: {
|
|
@@ -18,7 +18,7 @@ export interface WebSearchToolOptions {
|
|
|
18
18
|
/** DNS resolver used by the SSRF guard when hydrating result pages. Injectable for tests. */
|
|
19
19
|
lookup?: SafeFetchLookup;
|
|
20
20
|
}
|
|
21
|
-
export declare function createWebSearchTool(options: WebSearchToolOptions): import("
|
|
21
|
+
export declare function createWebSearchTool(options: WebSearchToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
22
22
|
query: string;
|
|
23
23
|
type?: string | undefined;
|
|
24
24
|
description?: string | undefined;
|
|
@@ -30,7 +30,7 @@ export declare function createWebSearchTool(options: WebSearchToolOptions): impo
|
|
|
30
30
|
lang?: string | undefined;
|
|
31
31
|
region?: string | undefined;
|
|
32
32
|
hydrateMeta?: boolean | undefined;
|
|
33
|
-
}, import("
|
|
33
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
34
34
|
type: "object";
|
|
35
35
|
properties: {
|
|
36
36
|
description: {
|