@gugacoder/agentic-sdk 0.2.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/dist/agent.d.ts +2 -0
- package/dist/agent.js +463 -0
- package/dist/context/compaction.d.ts +27 -0
- package/dist/context/compaction.js +219 -0
- package/dist/context/models.d.ts +6 -0
- package/dist/context/models.js +41 -0
- package/dist/context/tokenizer.d.ts +5 -0
- package/dist/context/tokenizer.js +11 -0
- package/dist/context/usage.d.ts +11 -0
- package/dist/context/usage.js +49 -0
- package/dist/display-schemas.d.ts +1865 -0
- package/dist/display-schemas.js +219 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +28 -0
- package/dist/middleware/logging.d.ts +2 -0
- package/dist/middleware/logging.js +32 -0
- package/dist/prompts/assembly.d.ts +13 -0
- package/dist/prompts/assembly.js +229 -0
- package/dist/providers.d.ts +19 -0
- package/dist/providers.js +44 -0
- package/dist/proxy.d.ts +2 -0
- package/dist/proxy.js +103 -0
- package/dist/schemas.d.ts +228 -0
- package/dist/schemas.js +51 -0
- package/dist/session.d.ts +7 -0
- package/dist/session.js +102 -0
- package/dist/structured.d.ts +18 -0
- package/dist/structured.js +38 -0
- package/dist/tool-repair.d.ts +21 -0
- package/dist/tool-repair.js +72 -0
- package/dist/tools/api-spec.d.ts +4 -0
- package/dist/tools/api-spec.js +123 -0
- package/dist/tools/apply-patch.d.ts +484 -0
- package/dist/tools/apply-patch.js +157 -0
- package/dist/tools/ask-user.d.ts +14 -0
- package/dist/tools/ask-user.js +27 -0
- package/dist/tools/bash.d.ts +550 -0
- package/dist/tools/bash.js +43 -0
- package/dist/tools/batch.d.ts +13 -0
- package/dist/tools/batch.js +84 -0
- package/dist/tools/brave-search.d.ts +6 -0
- package/dist/tools/brave-search.js +19 -0
- package/dist/tools/code-search.d.ts +20 -0
- package/dist/tools/code-search.js +42 -0
- package/dist/tools/diagnostics.d.ts +4 -0
- package/dist/tools/diagnostics.js +69 -0
- package/dist/tools/display.d.ts +483 -0
- package/dist/tools/display.js +77 -0
- package/dist/tools/edit.d.ts +682 -0
- package/dist/tools/edit.js +47 -0
- package/dist/tools/glob.d.ts +4 -0
- package/dist/tools/glob.js +42 -0
- package/dist/tools/grep.d.ts +6 -0
- package/dist/tools/grep.js +69 -0
- package/dist/tools/http-request.d.ts +7 -0
- package/dist/tools/http-request.js +98 -0
- package/dist/tools/index.d.ts +1611 -0
- package/dist/tools/index.js +46 -0
- package/dist/tools/job-tools.d.ts +24 -0
- package/dist/tools/job-tools.js +67 -0
- package/dist/tools/list-dir.d.ts +5 -0
- package/dist/tools/list-dir.js +79 -0
- package/dist/tools/multi-edit.d.ts +814 -0
- package/dist/tools/multi-edit.js +57 -0
- package/dist/tools/read.d.ts +5 -0
- package/dist/tools/read.js +33 -0
- package/dist/tools/task.d.ts +21 -0
- package/dist/tools/task.js +51 -0
- package/dist/tools/todo.d.ts +14 -0
- package/dist/tools/todo.js +60 -0
- package/dist/tools/web-fetch.d.ts +4 -0
- package/dist/tools/web-fetch.js +126 -0
- package/dist/tools/web-search.d.ts +22 -0
- package/dist/tools/web-search.js +48 -0
- package/dist/tools/write.d.ts +550 -0
- package/dist/tools/write.js +30 -0
- package/dist/types.d.ts +201 -0
- package/dist/types.js +1 -0
- package/package.json +43 -0
- package/src/agent.ts +520 -0
- package/src/context/compaction.ts +265 -0
- package/src/context/models.ts +42 -0
- package/src/context/tokenizer.ts +12 -0
- package/src/context/usage.ts +65 -0
- package/src/display-schemas.ts +276 -0
- package/src/index.ts +43 -0
- package/src/middleware/logging.ts +37 -0
- package/src/prompts/assembly.ts +263 -0
- package/src/prompts/identity.md +10 -0
- package/src/prompts/patterns.md +7 -0
- package/src/prompts/safety.md +7 -0
- package/src/prompts/tool-guide.md +9 -0
- package/src/prompts/tools/bash.md +7 -0
- package/src/prompts/tools/edit.md +7 -0
- package/src/prompts/tools/glob.md +7 -0
- package/src/prompts/tools/grep.md +7 -0
- package/src/prompts/tools/read.md +7 -0
- package/src/prompts/tools/write.md +7 -0
- package/src/providers.ts +58 -0
- package/src/proxy.ts +101 -0
- package/src/schemas.ts +58 -0
- package/src/session.ts +110 -0
- package/src/structured.ts +65 -0
- package/src/tool-repair.ts +92 -0
- package/src/tools/api-spec.ts +158 -0
- package/src/tools/apply-patch.ts +188 -0
- package/src/tools/ask-user.ts +40 -0
- package/src/tools/bash.ts +51 -0
- package/src/tools/batch.ts +103 -0
- package/src/tools/brave-search.ts +24 -0
- package/src/tools/code-search.ts +69 -0
- package/src/tools/diagnostics.ts +93 -0
- package/src/tools/display.ts +105 -0
- package/src/tools/edit.ts +55 -0
- package/src/tools/glob.ts +46 -0
- package/src/tools/grep.ts +68 -0
- package/src/tools/http-request.ts +103 -0
- package/src/tools/index.ts +48 -0
- package/src/tools/job-tools.ts +84 -0
- package/src/tools/list-dir.ts +102 -0
- package/src/tools/multi-edit.ts +65 -0
- package/src/tools/read.ts +40 -0
- package/src/tools/task.ts +71 -0
- package/src/tools/todo.ts +82 -0
- package/src/tools/web-fetch.ts +155 -0
- package/src/tools/web-search.ts +75 -0
- package/src/tools/write.ts +34 -0
- package/src/types.ts +145 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { tool } from "ai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const MAX_SPEC_SIZE = 512 * 1024; // 512KB
|
|
4
|
+
function extractEndpoints(spec) {
|
|
5
|
+
const endpoints = [];
|
|
6
|
+
const paths = spec.paths ?? {};
|
|
7
|
+
for (const [path, methods] of Object.entries(paths)) {
|
|
8
|
+
if (typeof methods !== "object" || methods === null)
|
|
9
|
+
continue;
|
|
10
|
+
for (const [method, op] of Object.entries(methods)) {
|
|
11
|
+
if (["get", "post", "put", "patch", "delete", "head", "options"].indexOf(method) === -1)
|
|
12
|
+
continue;
|
|
13
|
+
const endpoint = {
|
|
14
|
+
method: method.toUpperCase(),
|
|
15
|
+
path,
|
|
16
|
+
summary: op.summary ?? op.description?.slice(0, 120),
|
|
17
|
+
};
|
|
18
|
+
// Parameters
|
|
19
|
+
if (Array.isArray(op.parameters) && op.parameters.length > 0) {
|
|
20
|
+
endpoint.parameters = op.parameters.map((p) => ({
|
|
21
|
+
name: p.name,
|
|
22
|
+
in: p.in,
|
|
23
|
+
required: p.required,
|
|
24
|
+
type: p.schema?.type ?? p.type,
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
// Request body
|
|
28
|
+
if (op.requestBody) {
|
|
29
|
+
const content = op.requestBody.content;
|
|
30
|
+
if (content) {
|
|
31
|
+
const mediaType = Object.keys(content)[0];
|
|
32
|
+
endpoint.requestBody = mediaType;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Responses
|
|
36
|
+
if (op.responses) {
|
|
37
|
+
endpoint.responses = {};
|
|
38
|
+
for (const [code, resp] of Object.entries(op.responses)) {
|
|
39
|
+
endpoint.responses[code] = resp.description?.slice(0, 80) ?? "";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
endpoints.push(endpoint);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return endpoints;
|
|
46
|
+
}
|
|
47
|
+
function extractAuth(spec) {
|
|
48
|
+
const auth = [];
|
|
49
|
+
const schemes = spec.components?.securitySchemes ?? spec.securityDefinitions ?? {};
|
|
50
|
+
for (const [name, scheme] of Object.entries(schemes)) {
|
|
51
|
+
const type = scheme.type ?? "unknown";
|
|
52
|
+
const loc = scheme.in ? ` (in ${scheme.in})` : "";
|
|
53
|
+
const flow = scheme.flows ? ` [${Object.keys(scheme.flows).join(", ")}]` : "";
|
|
54
|
+
auth.push(`${name}: ${type}${loc}${flow}`);
|
|
55
|
+
}
|
|
56
|
+
return auth;
|
|
57
|
+
}
|
|
58
|
+
function extractBaseUrl(spec) {
|
|
59
|
+
// OpenAPI 3.x
|
|
60
|
+
if (Array.isArray(spec.servers) && spec.servers.length > 0) {
|
|
61
|
+
return spec.servers[0].url;
|
|
62
|
+
}
|
|
63
|
+
// Swagger 2.x
|
|
64
|
+
if (spec.host) {
|
|
65
|
+
const scheme = spec.schemes?.[0] ?? "https";
|
|
66
|
+
const basePath = spec.basePath ?? "";
|
|
67
|
+
return `${scheme}://${spec.host}${basePath}`;
|
|
68
|
+
}
|
|
69
|
+
return "unknown";
|
|
70
|
+
}
|
|
71
|
+
export const apiSpecTool = tool({
|
|
72
|
+
description: "Fetches and parses an API specification (OpenAPI/Swagger JSON or YAML). Returns a structured summary of available endpoints, methods, parameters, and authentication requirements.",
|
|
73
|
+
inputSchema: z.object({
|
|
74
|
+
url: z
|
|
75
|
+
.string()
|
|
76
|
+
.describe("URL to the OpenAPI/Swagger spec (JSON or YAML)"),
|
|
77
|
+
format: z
|
|
78
|
+
.enum(["openapi", "auto"])
|
|
79
|
+
.optional()
|
|
80
|
+
.default("auto")
|
|
81
|
+
.describe("Spec format (default: auto-detect)"),
|
|
82
|
+
}),
|
|
83
|
+
execute: async ({ url }) => {
|
|
84
|
+
try {
|
|
85
|
+
const controller = new AbortController();
|
|
86
|
+
const timer = setTimeout(() => controller.abort(), 30_000);
|
|
87
|
+
const response = await fetch(url, {
|
|
88
|
+
signal: controller.signal,
|
|
89
|
+
headers: { Accept: "application/json, application/yaml, text/yaml, */*" },
|
|
90
|
+
});
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
return `Error: HTTP ${response.status} ${response.statusText}`;
|
|
94
|
+
}
|
|
95
|
+
const text = await response.text();
|
|
96
|
+
if (text.length > MAX_SPEC_SIZE) {
|
|
97
|
+
return `Error: Spec too large (${text.length} bytes, max ${MAX_SPEC_SIZE})`;
|
|
98
|
+
}
|
|
99
|
+
// Parse JSON (YAML support would require a dependency — JSON covers most use cases)
|
|
100
|
+
let spec;
|
|
101
|
+
try {
|
|
102
|
+
spec = JSON.parse(text);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return "Error: Could not parse spec as JSON. Provide a JSON-format OpenAPI/Swagger spec URL.";
|
|
106
|
+
}
|
|
107
|
+
const summary = {
|
|
108
|
+
title: spec.info?.title ?? "Untitled API",
|
|
109
|
+
version: spec.info?.version ?? "unknown",
|
|
110
|
+
baseUrl: extractBaseUrl(spec),
|
|
111
|
+
auth: extractAuth(spec),
|
|
112
|
+
endpoints: extractEndpoints(spec),
|
|
113
|
+
};
|
|
114
|
+
return JSON.stringify(summary, null, 2);
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
if (err.name === "AbortError") {
|
|
118
|
+
return "Error: Request timed out after 30s";
|
|
119
|
+
}
|
|
120
|
+
return `Error: ${err.message}`;
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
});
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
export declare function createApplyPatchTool(opts?: {
|
|
2
|
+
autoApprove?: boolean;
|
|
3
|
+
}): ({
|
|
4
|
+
description?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
7
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
8
|
+
patch: string;
|
|
9
|
+
}>;
|
|
10
|
+
inputExamples?: {
|
|
11
|
+
input: NoInfer<{
|
|
12
|
+
patch: string;
|
|
13
|
+
}>;
|
|
14
|
+
}[] | undefined;
|
|
15
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
16
|
+
patch: string;
|
|
17
|
+
}> | undefined;
|
|
18
|
+
strict?: boolean;
|
|
19
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
20
|
+
onInputDelta?: (options: {
|
|
21
|
+
inputTextDelta: string;
|
|
22
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
23
|
+
onInputAvailable?: ((options: {
|
|
24
|
+
input: {
|
|
25
|
+
patch: string;
|
|
26
|
+
};
|
|
27
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
28
|
+
} & {
|
|
29
|
+
outputSchema: import("ai").FlexibleSchema<string>;
|
|
30
|
+
execute?: never;
|
|
31
|
+
} & {
|
|
32
|
+
toModelOutput?: ((options: {
|
|
33
|
+
toolCallId: string;
|
|
34
|
+
input: {
|
|
35
|
+
patch: string;
|
|
36
|
+
};
|
|
37
|
+
output: string;
|
|
38
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
type?: undefined | "function";
|
|
41
|
+
}) | ({
|
|
42
|
+
description?: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
45
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
46
|
+
patch: string;
|
|
47
|
+
}>;
|
|
48
|
+
inputExamples?: {
|
|
49
|
+
input: NoInfer<{
|
|
50
|
+
patch: string;
|
|
51
|
+
}>;
|
|
52
|
+
}[] | undefined;
|
|
53
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
54
|
+
patch: string;
|
|
55
|
+
}> | undefined;
|
|
56
|
+
strict?: boolean;
|
|
57
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
58
|
+
onInputDelta?: (options: {
|
|
59
|
+
inputTextDelta: string;
|
|
60
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
61
|
+
onInputAvailable?: ((options: {
|
|
62
|
+
input: {
|
|
63
|
+
patch: string;
|
|
64
|
+
};
|
|
65
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
66
|
+
} & {
|
|
67
|
+
outputSchema: import("ai").FlexibleSchema<string>;
|
|
68
|
+
execute?: never;
|
|
69
|
+
} & {
|
|
70
|
+
toModelOutput?: ((options: {
|
|
71
|
+
toolCallId: string;
|
|
72
|
+
input: {
|
|
73
|
+
patch: string;
|
|
74
|
+
};
|
|
75
|
+
output: string;
|
|
76
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
77
|
+
} & {
|
|
78
|
+
type: "dynamic";
|
|
79
|
+
}) | ({
|
|
80
|
+
description?: string;
|
|
81
|
+
title?: string;
|
|
82
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
83
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
84
|
+
patch: string;
|
|
85
|
+
}>;
|
|
86
|
+
inputExamples?: {
|
|
87
|
+
input: NoInfer<{
|
|
88
|
+
patch: string;
|
|
89
|
+
}>;
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
92
|
+
patch: string;
|
|
93
|
+
}> | undefined;
|
|
94
|
+
strict?: boolean;
|
|
95
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
96
|
+
onInputDelta?: (options: {
|
|
97
|
+
inputTextDelta: string;
|
|
98
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
99
|
+
onInputAvailable?: ((options: {
|
|
100
|
+
input: {
|
|
101
|
+
patch: string;
|
|
102
|
+
};
|
|
103
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
104
|
+
} & {
|
|
105
|
+
outputSchema: import("ai").FlexibleSchema<string>;
|
|
106
|
+
execute?: never;
|
|
107
|
+
} & {
|
|
108
|
+
toModelOutput?: ((options: {
|
|
109
|
+
toolCallId: string;
|
|
110
|
+
input: {
|
|
111
|
+
patch: string;
|
|
112
|
+
};
|
|
113
|
+
output: string;
|
|
114
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
115
|
+
} & {
|
|
116
|
+
type: "provider";
|
|
117
|
+
id: `${string}.${string}`;
|
|
118
|
+
args: Record<string, unknown>;
|
|
119
|
+
supportsDeferredResults?: boolean;
|
|
120
|
+
}) | ({
|
|
121
|
+
description?: string;
|
|
122
|
+
title?: string;
|
|
123
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
124
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
125
|
+
patch: string;
|
|
126
|
+
}>;
|
|
127
|
+
inputExamples?: {
|
|
128
|
+
input: NoInfer<{
|
|
129
|
+
patch: string;
|
|
130
|
+
}>;
|
|
131
|
+
}[] | undefined;
|
|
132
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
133
|
+
patch: string;
|
|
134
|
+
}> | undefined;
|
|
135
|
+
strict?: boolean;
|
|
136
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
137
|
+
onInputDelta?: (options: {
|
|
138
|
+
inputTextDelta: string;
|
|
139
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
140
|
+
onInputAvailable?: ((options: {
|
|
141
|
+
input: {
|
|
142
|
+
patch: string;
|
|
143
|
+
};
|
|
144
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
145
|
+
} & {
|
|
146
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
147
|
+
patch: string;
|
|
148
|
+
}, string>;
|
|
149
|
+
outputSchema?: import("ai").FlexibleSchema<string> | undefined;
|
|
150
|
+
} & {
|
|
151
|
+
toModelOutput?: ((options: {
|
|
152
|
+
toolCallId: string;
|
|
153
|
+
input: {
|
|
154
|
+
patch: string;
|
|
155
|
+
};
|
|
156
|
+
output: string;
|
|
157
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
158
|
+
} & {
|
|
159
|
+
type?: undefined | "function";
|
|
160
|
+
}) | ({
|
|
161
|
+
description?: string;
|
|
162
|
+
title?: string;
|
|
163
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
164
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
165
|
+
patch: string;
|
|
166
|
+
}>;
|
|
167
|
+
inputExamples?: {
|
|
168
|
+
input: NoInfer<{
|
|
169
|
+
patch: string;
|
|
170
|
+
}>;
|
|
171
|
+
}[] | undefined;
|
|
172
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
173
|
+
patch: string;
|
|
174
|
+
}> | undefined;
|
|
175
|
+
strict?: boolean;
|
|
176
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
177
|
+
onInputDelta?: (options: {
|
|
178
|
+
inputTextDelta: string;
|
|
179
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
180
|
+
onInputAvailable?: ((options: {
|
|
181
|
+
input: {
|
|
182
|
+
patch: string;
|
|
183
|
+
};
|
|
184
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
185
|
+
} & {
|
|
186
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
187
|
+
patch: string;
|
|
188
|
+
}, string>;
|
|
189
|
+
outputSchema?: import("ai").FlexibleSchema<string> | undefined;
|
|
190
|
+
} & {
|
|
191
|
+
toModelOutput?: ((options: {
|
|
192
|
+
toolCallId: string;
|
|
193
|
+
input: {
|
|
194
|
+
patch: string;
|
|
195
|
+
};
|
|
196
|
+
output: string;
|
|
197
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
198
|
+
} & {
|
|
199
|
+
type: "dynamic";
|
|
200
|
+
}) | ({
|
|
201
|
+
description?: string;
|
|
202
|
+
title?: string;
|
|
203
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
204
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
205
|
+
patch: string;
|
|
206
|
+
}>;
|
|
207
|
+
inputExamples?: {
|
|
208
|
+
input: NoInfer<{
|
|
209
|
+
patch: string;
|
|
210
|
+
}>;
|
|
211
|
+
}[] | undefined;
|
|
212
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
213
|
+
patch: string;
|
|
214
|
+
}> | undefined;
|
|
215
|
+
strict?: boolean;
|
|
216
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
217
|
+
onInputDelta?: (options: {
|
|
218
|
+
inputTextDelta: string;
|
|
219
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
220
|
+
onInputAvailable?: ((options: {
|
|
221
|
+
input: {
|
|
222
|
+
patch: string;
|
|
223
|
+
};
|
|
224
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
225
|
+
} & {
|
|
226
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
227
|
+
patch: string;
|
|
228
|
+
}, string>;
|
|
229
|
+
outputSchema?: import("ai").FlexibleSchema<string> | undefined;
|
|
230
|
+
} & {
|
|
231
|
+
toModelOutput?: ((options: {
|
|
232
|
+
toolCallId: string;
|
|
233
|
+
input: {
|
|
234
|
+
patch: string;
|
|
235
|
+
};
|
|
236
|
+
output: string;
|
|
237
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
238
|
+
} & {
|
|
239
|
+
type: "provider";
|
|
240
|
+
id: `${string}.${string}`;
|
|
241
|
+
args: Record<string, unknown>;
|
|
242
|
+
supportsDeferredResults?: boolean;
|
|
243
|
+
});
|
|
244
|
+
export declare const applyPatchTool: ({
|
|
245
|
+
description?: string;
|
|
246
|
+
title?: string;
|
|
247
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
248
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
249
|
+
patch: string;
|
|
250
|
+
}>;
|
|
251
|
+
inputExamples?: {
|
|
252
|
+
input: NoInfer<{
|
|
253
|
+
patch: string;
|
|
254
|
+
}>;
|
|
255
|
+
}[] | undefined;
|
|
256
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
257
|
+
patch: string;
|
|
258
|
+
}> | undefined;
|
|
259
|
+
strict?: boolean;
|
|
260
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
261
|
+
onInputDelta?: (options: {
|
|
262
|
+
inputTextDelta: string;
|
|
263
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
264
|
+
onInputAvailable?: ((options: {
|
|
265
|
+
input: {
|
|
266
|
+
patch: string;
|
|
267
|
+
};
|
|
268
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
269
|
+
} & {
|
|
270
|
+
outputSchema: import("ai").FlexibleSchema<string>;
|
|
271
|
+
execute?: never;
|
|
272
|
+
} & {
|
|
273
|
+
toModelOutput?: ((options: {
|
|
274
|
+
toolCallId: string;
|
|
275
|
+
input: {
|
|
276
|
+
patch: string;
|
|
277
|
+
};
|
|
278
|
+
output: string;
|
|
279
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
280
|
+
} & {
|
|
281
|
+
type?: undefined | "function";
|
|
282
|
+
}) | ({
|
|
283
|
+
description?: string;
|
|
284
|
+
title?: string;
|
|
285
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
286
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
287
|
+
patch: string;
|
|
288
|
+
}>;
|
|
289
|
+
inputExamples?: {
|
|
290
|
+
input: NoInfer<{
|
|
291
|
+
patch: string;
|
|
292
|
+
}>;
|
|
293
|
+
}[] | undefined;
|
|
294
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
295
|
+
patch: string;
|
|
296
|
+
}> | undefined;
|
|
297
|
+
strict?: boolean;
|
|
298
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
299
|
+
onInputDelta?: (options: {
|
|
300
|
+
inputTextDelta: string;
|
|
301
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
302
|
+
onInputAvailable?: ((options: {
|
|
303
|
+
input: {
|
|
304
|
+
patch: string;
|
|
305
|
+
};
|
|
306
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
307
|
+
} & {
|
|
308
|
+
outputSchema: import("ai").FlexibleSchema<string>;
|
|
309
|
+
execute?: never;
|
|
310
|
+
} & {
|
|
311
|
+
toModelOutput?: ((options: {
|
|
312
|
+
toolCallId: string;
|
|
313
|
+
input: {
|
|
314
|
+
patch: string;
|
|
315
|
+
};
|
|
316
|
+
output: string;
|
|
317
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
318
|
+
} & {
|
|
319
|
+
type: "dynamic";
|
|
320
|
+
}) | ({
|
|
321
|
+
description?: string;
|
|
322
|
+
title?: string;
|
|
323
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
324
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
325
|
+
patch: string;
|
|
326
|
+
}>;
|
|
327
|
+
inputExamples?: {
|
|
328
|
+
input: NoInfer<{
|
|
329
|
+
patch: string;
|
|
330
|
+
}>;
|
|
331
|
+
}[] | undefined;
|
|
332
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
333
|
+
patch: string;
|
|
334
|
+
}> | undefined;
|
|
335
|
+
strict?: boolean;
|
|
336
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
337
|
+
onInputDelta?: (options: {
|
|
338
|
+
inputTextDelta: string;
|
|
339
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
340
|
+
onInputAvailable?: ((options: {
|
|
341
|
+
input: {
|
|
342
|
+
patch: string;
|
|
343
|
+
};
|
|
344
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
345
|
+
} & {
|
|
346
|
+
outputSchema: import("ai").FlexibleSchema<string>;
|
|
347
|
+
execute?: never;
|
|
348
|
+
} & {
|
|
349
|
+
toModelOutput?: ((options: {
|
|
350
|
+
toolCallId: string;
|
|
351
|
+
input: {
|
|
352
|
+
patch: string;
|
|
353
|
+
};
|
|
354
|
+
output: string;
|
|
355
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
356
|
+
} & {
|
|
357
|
+
type: "provider";
|
|
358
|
+
id: `${string}.${string}`;
|
|
359
|
+
args: Record<string, unknown>;
|
|
360
|
+
supportsDeferredResults?: boolean;
|
|
361
|
+
}) | ({
|
|
362
|
+
description?: string;
|
|
363
|
+
title?: string;
|
|
364
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
365
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
366
|
+
patch: string;
|
|
367
|
+
}>;
|
|
368
|
+
inputExamples?: {
|
|
369
|
+
input: NoInfer<{
|
|
370
|
+
patch: string;
|
|
371
|
+
}>;
|
|
372
|
+
}[] | undefined;
|
|
373
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
374
|
+
patch: string;
|
|
375
|
+
}> | undefined;
|
|
376
|
+
strict?: boolean;
|
|
377
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
378
|
+
onInputDelta?: (options: {
|
|
379
|
+
inputTextDelta: string;
|
|
380
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
381
|
+
onInputAvailable?: ((options: {
|
|
382
|
+
input: {
|
|
383
|
+
patch: string;
|
|
384
|
+
};
|
|
385
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
386
|
+
} & {
|
|
387
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
388
|
+
patch: string;
|
|
389
|
+
}, string>;
|
|
390
|
+
outputSchema?: import("ai").FlexibleSchema<string> | undefined;
|
|
391
|
+
} & {
|
|
392
|
+
toModelOutput?: ((options: {
|
|
393
|
+
toolCallId: string;
|
|
394
|
+
input: {
|
|
395
|
+
patch: string;
|
|
396
|
+
};
|
|
397
|
+
output: string;
|
|
398
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
399
|
+
} & {
|
|
400
|
+
type?: undefined | "function";
|
|
401
|
+
}) | ({
|
|
402
|
+
description?: string;
|
|
403
|
+
title?: string;
|
|
404
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
405
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
406
|
+
patch: string;
|
|
407
|
+
}>;
|
|
408
|
+
inputExamples?: {
|
|
409
|
+
input: NoInfer<{
|
|
410
|
+
patch: string;
|
|
411
|
+
}>;
|
|
412
|
+
}[] | undefined;
|
|
413
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
414
|
+
patch: string;
|
|
415
|
+
}> | undefined;
|
|
416
|
+
strict?: boolean;
|
|
417
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
418
|
+
onInputDelta?: (options: {
|
|
419
|
+
inputTextDelta: string;
|
|
420
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
421
|
+
onInputAvailable?: ((options: {
|
|
422
|
+
input: {
|
|
423
|
+
patch: string;
|
|
424
|
+
};
|
|
425
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
426
|
+
} & {
|
|
427
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
428
|
+
patch: string;
|
|
429
|
+
}, string>;
|
|
430
|
+
outputSchema?: import("ai").FlexibleSchema<string> | undefined;
|
|
431
|
+
} & {
|
|
432
|
+
toModelOutput?: ((options: {
|
|
433
|
+
toolCallId: string;
|
|
434
|
+
input: {
|
|
435
|
+
patch: string;
|
|
436
|
+
};
|
|
437
|
+
output: string;
|
|
438
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
439
|
+
} & {
|
|
440
|
+
type: "dynamic";
|
|
441
|
+
}) | ({
|
|
442
|
+
description?: string;
|
|
443
|
+
title?: string;
|
|
444
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
445
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
446
|
+
patch: string;
|
|
447
|
+
}>;
|
|
448
|
+
inputExamples?: {
|
|
449
|
+
input: NoInfer<{
|
|
450
|
+
patch: string;
|
|
451
|
+
}>;
|
|
452
|
+
}[] | undefined;
|
|
453
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
454
|
+
patch: string;
|
|
455
|
+
}> | undefined;
|
|
456
|
+
strict?: boolean;
|
|
457
|
+
onInputStart?: (options: import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
458
|
+
onInputDelta?: (options: {
|
|
459
|
+
inputTextDelta: string;
|
|
460
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>;
|
|
461
|
+
onInputAvailable?: ((options: {
|
|
462
|
+
input: {
|
|
463
|
+
patch: string;
|
|
464
|
+
};
|
|
465
|
+
} & import("ai").ToolExecutionOptions) => void | PromiseLike<void>) | undefined;
|
|
466
|
+
} & {
|
|
467
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
468
|
+
patch: string;
|
|
469
|
+
}, string>;
|
|
470
|
+
outputSchema?: import("ai").FlexibleSchema<string> | undefined;
|
|
471
|
+
} & {
|
|
472
|
+
toModelOutput?: ((options: {
|
|
473
|
+
toolCallId: string;
|
|
474
|
+
input: {
|
|
475
|
+
patch: string;
|
|
476
|
+
};
|
|
477
|
+
output: string;
|
|
478
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
479
|
+
} & {
|
|
480
|
+
type: "provider";
|
|
481
|
+
id: `${string}.${string}`;
|
|
482
|
+
args: Record<string, unknown>;
|
|
483
|
+
supportsDeferredResults?: boolean;
|
|
484
|
+
});
|