@dogpile/sdk 0.2.2 → 0.3.1
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 +15 -0
- package/dist/browser/index.js +1044 -507
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime/broadcast.d.ts +1 -0
- package/dist/runtime/broadcast.d.ts.map +1 -1
- package/dist/runtime/broadcast.js +28 -19
- package/dist/runtime/broadcast.js.map +1 -1
- package/dist/runtime/coordinator.d.ts +1 -0
- package/dist/runtime/coordinator.d.ts.map +1 -1
- package/dist/runtime/coordinator.js +46 -21
- package/dist/runtime/coordinator.js.map +1 -1
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +5 -0
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/ids.d.ts +19 -0
- package/dist/runtime/ids.d.ts.map +1 -0
- package/dist/runtime/ids.js +36 -0
- package/dist/runtime/ids.js.map +1 -0
- package/dist/runtime/logger.d.ts +61 -0
- package/dist/runtime/logger.d.ts.map +1 -0
- package/dist/runtime/logger.js +114 -0
- package/dist/runtime/logger.js.map +1 -0
- package/dist/runtime/retry.d.ts +99 -0
- package/dist/runtime/retry.d.ts.map +1 -0
- package/dist/runtime/retry.js +181 -0
- package/dist/runtime/retry.js.map +1 -0
- package/dist/runtime/sequential.d.ts +1 -0
- package/dist/runtime/sequential.d.ts.map +1 -1
- package/dist/runtime/sequential.js +25 -16
- package/dist/runtime/sequential.js.map +1 -1
- package/dist/runtime/shared.d.ts +1 -0
- package/dist/runtime/shared.d.ts.map +1 -1
- package/dist/runtime/shared.js +25 -19
- package/dist/runtime/shared.js.map +1 -1
- package/dist/runtime/termination.d.ts +6 -1
- package/dist/runtime/termination.d.ts.map +1 -1
- package/dist/runtime/termination.js +75 -0
- package/dist/runtime/termination.js.map +1 -1
- package/dist/runtime/tools/built-in.d.ts +99 -0
- package/dist/runtime/tools/built-in.d.ts.map +1 -0
- package/dist/runtime/tools/built-in.js +577 -0
- package/dist/runtime/tools/built-in.js.map +1 -0
- package/dist/runtime/tools/vercel-ai.d.ts +67 -0
- package/dist/runtime/tools/vercel-ai.d.ts.map +1 -0
- package/dist/runtime/tools/vercel-ai.js +148 -0
- package/dist/runtime/tools/vercel-ai.js.map +1 -0
- package/dist/runtime/tools.d.ts +5 -268
- package/dist/runtime/tools.d.ts.map +1 -1
- package/dist/runtime/tools.js +7 -770
- package/dist/runtime/tools.js.map +1 -1
- package/dist/runtime/validation.d.ts.map +1 -1
- package/dist/runtime/validation.js +22 -0
- package/dist/runtime/validation.js.map +1 -1
- package/dist/runtime/wrap-up.d.ts +26 -0
- package/dist/runtime/wrap-up.d.ts.map +1 -0
- package/dist/runtime/wrap-up.js +178 -0
- package/dist/runtime/wrap-up.js.map +1 -0
- package/dist/types/benchmark.d.ts +276 -0
- package/dist/types/benchmark.d.ts.map +1 -0
- package/dist/types/benchmark.js +2 -0
- package/dist/types/benchmark.js.map +1 -0
- package/dist/types/events.d.ts +495 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +2 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/replay.d.ts +169 -0
- package/dist/types/replay.d.ts.map +1 -0
- package/dist/types/replay.js +2 -0
- package/dist/types/replay.js.map +1 -0
- package/dist/types.d.ts +74 -935
- package/dist/types.d.ts.map +1 -1
- package/package.json +28 -1
- package/src/index.ts +7 -1
- package/src/runtime/broadcast.ts +50 -35
- package/src/runtime/coordinator.ts +84 -43
- package/src/runtime/engine.ts +6 -0
- package/src/runtime/ids.ts +41 -0
- package/src/runtime/logger.ts +152 -0
- package/src/runtime/retry.ts +270 -0
- package/src/runtime/sequential.ts +46 -31
- package/src/runtime/shared.ts +46 -35
- package/src/runtime/termination.ts +100 -0
- package/src/runtime/tools/built-in.ts +875 -0
- package/src/runtime/tools/vercel-ai.ts +269 -0
- package/src/runtime/tools.ts +60 -1255
- package/src/runtime/validation.ts +25 -0
- package/src/runtime/wrap-up.ts +257 -0
- package/src/types/benchmark.ts +300 -0
- package/src/types/events.ts +544 -0
- package/src/types/replay.ts +201 -0
- package/src/types.ts +174 -994
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../src/runtime/tools/vercel-ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,2BAA2B,EAE3B,sBAAsB,EAEvB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,oBAAoB,EAAE,2BAA2B,CAAC;CAC5D,CAAC;AAEF,KAAK,2BAA2B,CAAC,KAAK,EAAE,MAAM,IAAI,CAChD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,0BAA0B,KAChC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAG1D,KAAK,wBAAwB,CAAC,KAAK,IAAI,OAAO,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EAAE,MAAM,SAAS,SAAS,GAAG,SAAS;IACvG,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,2BAA2B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1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QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC;CAC3E;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,SAAS,MAAM,EACnB,KAAK,SAAS,UAAU,EACxB,MAAM,SAAS,SAAS,EACxB,UAAU,EAAE,sBAAsB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAgD9F;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,eAAe,EACtB,OAAO,GAAE,mCAAwC,GAChD,OAAO,CAAC,SAAS,WAAW,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,CAAC,CAgBxD"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { DogpileError } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Normalize one Vercel AI SDK tool into Dogpile's shared runtime tool interface.
|
|
4
|
+
*/
|
|
5
|
+
export async function normalizeVercelAITool(definition) {
|
|
6
|
+
if (!definition.tool.execute) {
|
|
7
|
+
throw new DogpileError({
|
|
8
|
+
code: "invalid-configuration",
|
|
9
|
+
message: `Vercel AI tool "${definition.name}" must define execute() to run inside Dogpile.`,
|
|
10
|
+
detail: { toolName: definition.name }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
const identity = vercelAIToolIdentity(definition);
|
|
14
|
+
const inputSchema = definition.inputSchema ?? (await vercelAIInputSchema(definition.tool, definition.name));
|
|
15
|
+
const execute = definition.tool.execute;
|
|
16
|
+
return {
|
|
17
|
+
identity,
|
|
18
|
+
inputSchema,
|
|
19
|
+
async execute(input, context) {
|
|
20
|
+
try {
|
|
21
|
+
const output = await resolveVercelAIToolOutput(execute(input, {
|
|
22
|
+
toolCallId: context.toolCallId,
|
|
23
|
+
messages: Array.from(definition.messages ?? []),
|
|
24
|
+
...(context.abortSignal ? { abortSignal: context.abortSignal } : {}),
|
|
25
|
+
experimental_context: context
|
|
26
|
+
}));
|
|
27
|
+
return {
|
|
28
|
+
type: "success",
|
|
29
|
+
toolCallId: context.toolCallId,
|
|
30
|
+
tool: identity,
|
|
31
|
+
output
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
type: "error",
|
|
37
|
+
toolCallId: context.toolCallId,
|
|
38
|
+
tool: identity,
|
|
39
|
+
error: {
|
|
40
|
+
code: "vercel-ai-tool-error",
|
|
41
|
+
message: error instanceof Error ? error.message : "Vercel AI tool execution failed.",
|
|
42
|
+
retryable: false,
|
|
43
|
+
detail: errorDetail(error)
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Normalize a Vercel AI SDK tool set into runtime tools in caller-defined key order.
|
|
52
|
+
*/
|
|
53
|
+
export async function normalizeVercelAITools(tools, options = {}) {
|
|
54
|
+
return Promise.all(Object.entries(tools).map(([name, tool]) => {
|
|
55
|
+
const identity = removeUndefinedIdentityFields({
|
|
56
|
+
...(options.namespace !== undefined ? { namespace: options.namespace } : {}),
|
|
57
|
+
...(options.version !== undefined ? { version: options.version } : {}),
|
|
58
|
+
...options.identity?.[name]
|
|
59
|
+
});
|
|
60
|
+
return normalizeVercelAITool({
|
|
61
|
+
name,
|
|
62
|
+
tool: asJsonRuntimeVercelAITool(tool),
|
|
63
|
+
...(options.messages ? { messages: options.messages } : {}),
|
|
64
|
+
...(identity ? { identity } : {})
|
|
65
|
+
});
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
async function vercelAIInputSchema(tool, name) {
|
|
69
|
+
const schema = await resolveCompatibleSchema(tool.inputSchema);
|
|
70
|
+
const jsonSchema = asJsonObject(schema, `Vercel AI tool "${name}" input schema`);
|
|
71
|
+
return {
|
|
72
|
+
kind: "json-schema",
|
|
73
|
+
schema: jsonSchema,
|
|
74
|
+
...(tool.description ? { description: tool.description } : {})
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async function resolveCompatibleSchema(schema) {
|
|
78
|
+
if (isJsonSchemaWrapper(schema)) {
|
|
79
|
+
return await schema.jsonSchema;
|
|
80
|
+
}
|
|
81
|
+
return schema;
|
|
82
|
+
}
|
|
83
|
+
function isJsonSchemaWrapper(schema) {
|
|
84
|
+
return typeof schema === "object" && schema !== null && "jsonSchema" in schema;
|
|
85
|
+
}
|
|
86
|
+
function vercelAIToolIdentity(definition) {
|
|
87
|
+
return {
|
|
88
|
+
id: definition.identity?.id ?? `vercel-ai.tools.${definition.name}`,
|
|
89
|
+
name: definition.name,
|
|
90
|
+
namespace: definition.identity?.namespace ?? "vercel-ai",
|
|
91
|
+
...(definition.identity?.version ? { version: definition.identity.version } : {}),
|
|
92
|
+
...(definition.identity?.description ?? definition.tool.description
|
|
93
|
+
? { description: definition.identity?.description ?? definition.tool.description }
|
|
94
|
+
: {})
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function resolveVercelAIToolOutput(output) {
|
|
98
|
+
if (isAsyncIterable(output)) {
|
|
99
|
+
let lastOutput;
|
|
100
|
+
for await (const chunk of output) {
|
|
101
|
+
lastOutput = chunk;
|
|
102
|
+
}
|
|
103
|
+
if (lastOutput === undefined) {
|
|
104
|
+
throw new DogpileError({
|
|
105
|
+
code: "provider-invalid-response",
|
|
106
|
+
message: "Vercel AI tool async iterable completed without an output."
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return lastOutput;
|
|
110
|
+
}
|
|
111
|
+
return await output;
|
|
112
|
+
}
|
|
113
|
+
function isAsyncIterable(value) {
|
|
114
|
+
return typeof value === "object" && value !== null && Symbol.asyncIterator in value;
|
|
115
|
+
}
|
|
116
|
+
function asJsonObject(value, label) {
|
|
117
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
118
|
+
throw new DogpileError({
|
|
119
|
+
code: "provider-invalid-response",
|
|
120
|
+
message: `${label} must resolve to a JSON object.`,
|
|
121
|
+
detail: { label }
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
function errorDetail(error) {
|
|
127
|
+
if (error instanceof Error) {
|
|
128
|
+
return { name: error.name };
|
|
129
|
+
}
|
|
130
|
+
return { valueType: typeof error };
|
|
131
|
+
}
|
|
132
|
+
function removeUndefinedIdentityFields(identity) {
|
|
133
|
+
const normalized = {
|
|
134
|
+
...(identity.id !== undefined ? { id: identity.id } : {}),
|
|
135
|
+
...(identity.namespace !== undefined ? { namespace: identity.namespace } : {}),
|
|
136
|
+
...(identity.version !== undefined ? { version: identity.version } : {}),
|
|
137
|
+
...(identity.description !== undefined ? { description: identity.description } : {})
|
|
138
|
+
};
|
|
139
|
+
return Object.keys(normalized).length > 0 ? normalized : undefined;
|
|
140
|
+
}
|
|
141
|
+
function asJsonRuntimeVercelAITool(tool) {
|
|
142
|
+
// Structural narrowing: the runtime treats every Vercel-AI tool as having a
|
|
143
|
+
// JSON-shaped (input, output) pair — the upstream `ai` generics are nominal
|
|
144
|
+
// and don't survive without an unsafe widening. Pinned here as the single
|
|
145
|
+
// bridge point so future provider migrations only touch one cast.
|
|
146
|
+
return tool;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=vercel-ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-ai.js","sourceRoot":"","sources":["../../../src/runtime/tools/vercel-ai.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA2E9C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAIzC,UAAuD;IACvD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,YAAY,CAAC;YACrB,IAAI,EAAE,uBAAuB;YAC7B,OAAO,EAAE,mBAAmB,UAAU,C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AErC,MAAM,UAAU,GAAgC;QAC9C,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,GAAG,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,GAAG,CAAC,QAAQ,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,GAAG,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrF,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACrE,CAAC;AAED,SAAS,yBAAyB,CAAC,IAA0B;IAC3D,4EAA4E;IAC5E,4EAA4E;IAC5E,0EAA0E;IAC1E,kEAAkE;IAClE,OAAO,IAAsD,CAAC;AAChE,CAAC"}
|
package/dist/runtime/tools.d.ts
CHANGED
|
@@ -1,207 +1,8 @@
|
|
|
1
|
-
import type { JsonObject, JsonValue,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly experimental_context: RuntimeToolExecutionContext;
|
|
7
|
-
};
|
|
8
|
-
type VercelAIToolExecuteFunction<Input, Output> = (input: Input, options: VercelAIToolExecuteOptions) => Output | PromiseLike<Output> | AsyncIterable<Output>;
|
|
9
|
-
type VercelAICompatibleSchema<Input> = unknown;
|
|
10
|
-
/**
|
|
11
|
-
* Built-in Dogpile tool names with stable protocol-facing semantics.
|
|
12
|
-
*/
|
|
13
|
-
export type DogpileBuiltInToolName = "webSearch" | "codeExec";
|
|
14
|
-
/**
|
|
15
|
-
* Input accepted by the built-in web search tool contract.
|
|
16
|
-
*/
|
|
17
|
-
export interface WebSearchToolInput extends JsonObject {
|
|
18
|
-
readonly query: string;
|
|
19
|
-
readonly maxResults?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* One normalized web search result.
|
|
23
|
-
*/
|
|
24
|
-
export interface WebSearchToolResult extends JsonObject {
|
|
25
|
-
readonly title: string;
|
|
26
|
-
readonly url: string;
|
|
27
|
-
readonly snippet?: string;
|
|
28
|
-
readonly metadata?: JsonObject;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Output returned by the built-in web search tool contract.
|
|
32
|
-
*/
|
|
33
|
-
export interface WebSearchToolOutput extends JsonObject {
|
|
34
|
-
readonly results: WebSearchToolResult[];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Fetch implementation accepted by the built-in web search adapter.
|
|
38
|
-
*/
|
|
39
|
-
export type WebSearchFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
40
|
-
/**
|
|
41
|
-
* Request data produced before the built-in web search adapter calls `fetch`.
|
|
42
|
-
*/
|
|
43
|
-
export interface WebSearchFetchRequest {
|
|
44
|
-
readonly url: string | URL;
|
|
45
|
-
readonly init?: RequestInit;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Build a search backend request from normalized web search input.
|
|
49
|
-
*/
|
|
50
|
-
export type WebSearchFetchRequestBuilder = (input: Readonly<WebSearchToolInput>, context: RuntimeToolExecutionContext) => WebSearchFetchRequest;
|
|
51
|
-
/**
|
|
52
|
-
* Parse a search backend response into Dogpile's stable web search output.
|
|
53
|
-
*/
|
|
54
|
-
export type WebSearchFetchResponseParser = (response: Response, input: Readonly<WebSearchToolInput>, context: RuntimeToolExecutionContext) => WebSearchToolOutput | Promise<WebSearchToolOutput>;
|
|
55
|
-
/**
|
|
56
|
-
* Options for the built-in fetch-based web search adapter.
|
|
57
|
-
*/
|
|
58
|
-
export interface WebSearchToolAdapterOptions {
|
|
59
|
-
readonly endpoint: string | URL;
|
|
60
|
-
readonly fetch?: WebSearchFetch;
|
|
61
|
-
readonly headers?: HeadersInit;
|
|
62
|
-
readonly defaultMaxResults?: number;
|
|
63
|
-
readonly identity?: BuiltInDogpileToolIdentityOptions;
|
|
64
|
-
readonly permissions?: readonly RuntimeToolPermission[];
|
|
65
|
-
readonly buildRequest?: WebSearchFetchRequestBuilder;
|
|
66
|
-
readonly parseResponse?: WebSearchFetchResponseParser;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Options for the built-in code execution adapter.
|
|
70
|
-
*/
|
|
71
|
-
export interface CodeExecToolAdapterOptions {
|
|
72
|
-
readonly execute: CodeExecSandboxExecutor;
|
|
73
|
-
readonly defaultTimeoutMs?: number;
|
|
74
|
-
readonly maxTimeoutMs?: number;
|
|
75
|
-
readonly languages?: readonly CodeExecToolLanguage[];
|
|
76
|
-
readonly allowNetwork?: boolean;
|
|
77
|
-
readonly identity?: BuiltInDogpileToolIdentityOptions;
|
|
78
|
-
readonly permissions?: readonly RuntimeToolPermission[];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Input accepted by the built-in code execution tool contract.
|
|
82
|
-
*
|
|
83
|
-
* @remarks
|
|
84
|
-
* Dogpile core does not provide a sandbox implementation. Callers supply the
|
|
85
|
-
* executor while Dogpile normalizes the public tool identity and schema.
|
|
86
|
-
*/
|
|
87
|
-
export interface CodeExecToolInput extends JsonObject {
|
|
88
|
-
readonly language: "javascript" | "typescript" | "python" | "bash" | "shell";
|
|
89
|
-
readonly code: string;
|
|
90
|
-
readonly timeoutMs?: number;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Output returned by the built-in code execution tool contract.
|
|
94
|
-
*/
|
|
95
|
-
export interface CodeExecToolOutput extends JsonObject {
|
|
96
|
-
readonly stdout: string;
|
|
97
|
-
readonly stderr: string;
|
|
98
|
-
readonly exitCode: number;
|
|
99
|
-
readonly metadata?: JsonObject;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Language identifiers accepted by Dogpile's built-in code execution contract.
|
|
103
|
-
*/
|
|
104
|
-
export type CodeExecToolLanguage = CodeExecToolInput["language"];
|
|
105
|
-
/**
|
|
106
|
-
* Executor signature for the built-in web search contract.
|
|
107
|
-
*/
|
|
108
|
-
export type WebSearchToolExecutor = (input: Readonly<WebSearchToolInput>, context: RuntimeToolExecutionContext) => RuntimeToolResult<WebSearchToolOutput> | Promise<RuntimeToolResult<WebSearchToolOutput>>;
|
|
109
|
-
/**
|
|
110
|
-
* Executor signature for the built-in code execution contract.
|
|
111
|
-
*/
|
|
112
|
-
export type CodeExecToolExecutor = (input: Readonly<CodeExecToolInput>, context: RuntimeToolExecutionContext) => RuntimeToolResult<CodeExecToolOutput> | Promise<RuntimeToolResult<CodeExecToolOutput>>;
|
|
113
|
-
/**
|
|
114
|
-
* Caller-owned sandbox implementation used by Dogpile's built-in code execution adapter.
|
|
115
|
-
*/
|
|
116
|
-
export type CodeExecSandboxExecutor = (input: Readonly<CodeExecToolInput>, context: RuntimeToolExecutionContext) => CodeExecToolOutput | Promise<CodeExecToolOutput>;
|
|
117
|
-
/**
|
|
118
|
-
* Optional identity fields callers may layer onto built-in Dogpile tools.
|
|
119
|
-
*/
|
|
120
|
-
export interface BuiltInDogpileToolIdentityOptions {
|
|
121
|
-
readonly namespace?: string;
|
|
122
|
-
readonly version?: string;
|
|
123
|
-
readonly description?: string;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Definition used to normalize Dogpile's built-in web search tool.
|
|
127
|
-
*/
|
|
128
|
-
export interface WebSearchDogpileToolDefinition {
|
|
129
|
-
readonly name: "webSearch";
|
|
130
|
-
readonly execute: WebSearchToolExecutor;
|
|
131
|
-
readonly identity?: BuiltInDogpileToolIdentityOptions;
|
|
132
|
-
readonly inputSchema?: RuntimeToolInputSchema;
|
|
133
|
-
readonly permissions?: readonly RuntimeToolPermission[];
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Definition used to normalize Dogpile's built-in code execution tool.
|
|
137
|
-
*/
|
|
138
|
-
export interface CodeExecDogpileToolDefinition {
|
|
139
|
-
readonly name: "codeExec";
|
|
140
|
-
readonly execute: CodeExecToolExecutor;
|
|
141
|
-
readonly identity?: BuiltInDogpileToolIdentityOptions;
|
|
142
|
-
readonly inputSchema?: RuntimeToolInputSchema;
|
|
143
|
-
readonly permissions?: readonly RuntimeToolPermission[];
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Built-in Dogpile tool definitions accepted by the normalization helper.
|
|
147
|
-
*/
|
|
148
|
-
export type BuiltInDogpileToolDefinition = WebSearchDogpileToolDefinition | CodeExecDogpileToolDefinition;
|
|
149
|
-
/**
|
|
150
|
-
* Caller-supplied built-in tool executors keyed by Dogpile's stable built-in names.
|
|
151
|
-
*/
|
|
152
|
-
export interface BuiltInDogpileToolExecutors {
|
|
153
|
-
readonly webSearch?: WebSearchToolExecutor | WebSearchDogpileToolDefinition;
|
|
154
|
-
readonly codeExec?: CodeExecToolExecutor | CodeExecDogpileToolDefinition;
|
|
155
|
-
}
|
|
156
|
-
export type BuiltInDogpileRuntimeTool = RuntimeToolAdapterContract<WebSearchToolInput, WebSearchToolOutput> | RuntimeToolAdapterContract<CodeExecToolInput, CodeExecToolOutput>;
|
|
157
|
-
/**
|
|
158
|
-
* Vercel AI SDK tool shape accepted by Dogpile's normalization adapter.
|
|
159
|
-
*/
|
|
160
|
-
export interface VercelAITool<Input extends JsonObject = JsonObject, Output extends JsonValue = JsonValue> {
|
|
161
|
-
readonly description?: string;
|
|
162
|
-
readonly inputSchema: VercelAICompatibleSchema<Input>;
|
|
163
|
-
readonly execute?: VercelAIToolExecuteFunction<Input, Output>;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Optional identity fields callers may layer onto normalized Vercel AI tools.
|
|
167
|
-
*/
|
|
168
|
-
export interface VercelAIToolIdentityOptions {
|
|
169
|
-
readonly id?: string;
|
|
170
|
-
readonly namespace?: string;
|
|
171
|
-
readonly version?: string;
|
|
172
|
-
readonly description?: string;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Definition used to normalize one Vercel AI SDK tool into Dogpile's runtime tool interface.
|
|
176
|
-
*/
|
|
177
|
-
export interface VercelAIToolDefinition<Name extends string = string, Input extends JsonObject = JsonObject, Output extends JsonValue = JsonValue> {
|
|
178
|
-
readonly name: Name;
|
|
179
|
-
readonly tool: VercelAITool<Input, Output>;
|
|
180
|
-
readonly identity?: VercelAIToolIdentityOptions;
|
|
181
|
-
readonly inputSchema?: RuntimeToolInputSchema;
|
|
182
|
-
readonly messages?: readonly ModelMessage[];
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Caller-supplied Vercel AI SDK tool set keyed by model-visible tool name.
|
|
186
|
-
*/
|
|
187
|
-
export interface VercelAIToolSetEntry {
|
|
188
|
-
readonly description?: string;
|
|
189
|
-
readonly inputSchema: VercelAICompatibleSchema<unknown>;
|
|
190
|
-
readonly execute?: VercelAIToolExecuteFunction<never, JsonValue>;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Caller-supplied Vercel AI SDK tool set keyed by model-visible tool name.
|
|
194
|
-
*/
|
|
195
|
-
export type VercelAIToolSet = Readonly<Record<string, VercelAIToolSetEntry>>;
|
|
196
|
-
/**
|
|
197
|
-
* Options shared while normalizing a Vercel AI SDK tool set.
|
|
198
|
-
*/
|
|
199
|
-
export interface VercelAIToolSetNormalizationOptions {
|
|
200
|
-
readonly namespace?: string;
|
|
201
|
-
readonly version?: string;
|
|
202
|
-
readonly messages?: readonly ModelMessage[];
|
|
203
|
-
readonly identity?: Readonly<Record<string, VercelAIToolIdentityOptions>>;
|
|
204
|
-
}
|
|
1
|
+
import type { JsonObject, JsonValue, ModelResponse, RuntimeTool, RuntimeToolExecutionContext, RuntimeToolExecutor, RuntimeToolIdentity, RuntimeToolTraceContext, TranscriptToolCall, RunEvent } from "../types.js";
|
|
2
|
+
export { builtInDogpileToolIdentity, builtInDogpileToolInputSchema, builtInDogpileToolPermissions, createCodeExecToolAdapter, createWebSearchToolAdapter, normalizeBuiltInDogpileTool, normalizeBuiltInDogpileTools, normalizeRuntimeToolAdapterError, validateBuiltInDogpileToolInput } from "./tools/built-in.js";
|
|
3
|
+
export type { BuiltInDogpileRuntimeTool, BuiltInDogpileToolDefinition, BuiltInDogpileToolExecutors, BuiltInDogpileToolIdentityOptions, CodeExecDogpileToolDefinition, CodeExecSandboxExecutor, CodeExecToolAdapterOptions, CodeExecToolExecutor, CodeExecToolInput, CodeExecToolLanguage, CodeExecToolOutput, DogpileBuiltInToolName, WebSearchDogpileToolDefinition, WebSearchFetch, WebSearchFetchRequest, WebSearchFetchRequestBuilder, WebSearchFetchResponseParser, WebSearchToolAdapterOptions, WebSearchToolExecutor, WebSearchToolInput, WebSearchToolOutput, WebSearchToolResult } from "./tools/built-in.js";
|
|
4
|
+
export { normalizeVercelAITool, normalizeVercelAITools } from "./tools/vercel-ai.js";
|
|
5
|
+
export type { VercelAITool, VercelAIToolDefinition, VercelAIToolIdentityOptions, VercelAIToolSet, VercelAIToolSetEntry, VercelAIToolSetNormalizationOptions } from "./tools/vercel-ai.js";
|
|
205
6
|
/**
|
|
206
7
|
* Options for the shared protocol-agnostic runtime tool executor.
|
|
207
8
|
*/
|
|
@@ -216,26 +17,6 @@ export interface RuntimeToolExecutorOptions {
|
|
|
216
17
|
readonly abortSignal?: AbortSignal;
|
|
217
18
|
readonly makeToolCallId?: (tool: RuntimeToolIdentity, callIndex: number) => string;
|
|
218
19
|
}
|
|
219
|
-
/**
|
|
220
|
-
* Return the default Dogpile identity for one built-in tool name.
|
|
221
|
-
*/
|
|
222
|
-
export declare function builtInDogpileToolIdentity(name: "webSearch"): RuntimeToolIdentity;
|
|
223
|
-
export declare function builtInDogpileToolIdentity(name: "codeExec"): RuntimeToolIdentity;
|
|
224
|
-
/**
|
|
225
|
-
* Return the default Dogpile input schema for one built-in tool name.
|
|
226
|
-
*/
|
|
227
|
-
export declare function builtInDogpileToolInputSchema(name: "webSearch"): RuntimeToolInputSchema;
|
|
228
|
-
export declare function builtInDogpileToolInputSchema(name: "codeExec"): RuntimeToolInputSchema;
|
|
229
|
-
/**
|
|
230
|
-
* Return the default permission declarations for one built-in tool name.
|
|
231
|
-
*/
|
|
232
|
-
export declare function builtInDogpileToolPermissions(name: DogpileBuiltInToolName): readonly RuntimeToolPermission[];
|
|
233
|
-
/**
|
|
234
|
-
* Validate one built-in Dogpile tool input before adapter execution.
|
|
235
|
-
*/
|
|
236
|
-
export declare function validateBuiltInDogpileToolInput(name: "webSearch", input: Readonly<Partial<WebSearchToolInput>>): RuntimeToolValidationResult;
|
|
237
|
-
export declare function validateBuiltInDogpileToolInput(name: "codeExec", input: Readonly<Partial<CodeExecToolInput>>): RuntimeToolValidationResult;
|
|
238
|
-
export declare function validateBuiltInDogpileToolInput(name: DogpileBuiltInToolName, input: Readonly<Partial<WebSearchToolInput> | Partial<CodeExecToolInput>>): RuntimeToolValidationResult;
|
|
239
20
|
/**
|
|
240
21
|
* Create the shared runtime tool executor used by every first-party protocol.
|
|
241
22
|
*
|
|
@@ -267,48 +48,4 @@ export declare function executeModelResponseToolRequests(options: {
|
|
|
267
48
|
readonly turn: number;
|
|
268
49
|
readonly metadata?: JsonObject;
|
|
269
50
|
}): Promise<readonly TranscriptToolCall[]>;
|
|
270
|
-
/**
|
|
271
|
-
* Convert an unknown adapter failure into Dogpile's serializable error data.
|
|
272
|
-
*/
|
|
273
|
-
export declare function normalizeRuntimeToolAdapterError(error: unknown): RuntimeToolAdapterError;
|
|
274
|
-
/**
|
|
275
|
-
* Create Dogpile's built-in fetch-based web search adapter.
|
|
276
|
-
*
|
|
277
|
-
* @remarks
|
|
278
|
-
* The adapter is backend-neutral: by default it sends a GET request with
|
|
279
|
-
* `q` and `limit` query parameters, then accepts either `{ results: [...] }`
|
|
280
|
-
* or a bare array of result objects from the response JSON. Callers can replace
|
|
281
|
-
* request construction or response parsing for a specific search API while
|
|
282
|
-
* keeping Dogpile's shared runtime tool contract, identity, permissions, input
|
|
283
|
-
* validation, and serializable errors.
|
|
284
|
-
*/
|
|
285
|
-
export declare function createWebSearchToolAdapter(options: WebSearchToolAdapterOptions): RuntimeToolAdapterContract<WebSearchToolInput, WebSearchToolOutput>;
|
|
286
|
-
/**
|
|
287
|
-
* Create Dogpile's built-in code execution adapter around a caller-owned sandbox.
|
|
288
|
-
*
|
|
289
|
-
* @remarks
|
|
290
|
-
* Dogpile core stays runtime-portable and never evaluates code itself. This
|
|
291
|
-
* adapter supplies the stable `codeExec` identity, schema, permissions,
|
|
292
|
-
* validation, timeout defaults, abort handling, and serializable errors while
|
|
293
|
-
* the host application owns the sandbox boundary.
|
|
294
|
-
*/
|
|
295
|
-
export declare function createCodeExecToolAdapter(options: CodeExecToolAdapterOptions): RuntimeToolAdapterContract<CodeExecToolInput, CodeExecToolOutput>;
|
|
296
|
-
/**
|
|
297
|
-
* Normalize one built-in Dogpile tool definition into the shared runtime tool interface.
|
|
298
|
-
*/
|
|
299
|
-
export declare function normalizeBuiltInDogpileTool(definition: WebSearchDogpileToolDefinition): RuntimeToolAdapterContract<WebSearchToolInput, WebSearchToolOutput>;
|
|
300
|
-
export declare function normalizeBuiltInDogpileTool(definition: CodeExecDogpileToolDefinition): RuntimeToolAdapterContract<CodeExecToolInput, CodeExecToolOutput>;
|
|
301
|
-
/**
|
|
302
|
-
* Normalize configured built-in Dogpile tool executors into runtime tools.
|
|
303
|
-
*/
|
|
304
|
-
export declare function normalizeBuiltInDogpileTools(tools: BuiltInDogpileToolExecutors): readonly BuiltInDogpileRuntimeTool[];
|
|
305
|
-
/**
|
|
306
|
-
* Normalize one Vercel AI SDK tool into Dogpile's shared runtime tool interface.
|
|
307
|
-
*/
|
|
308
|
-
export declare function normalizeVercelAITool<Name extends string, Input extends JsonObject, Output extends JsonValue>(definition: VercelAIToolDefinition<Name, Input, Output>): Promise<RuntimeTool<Input, Output>>;
|
|
309
|
-
/**
|
|
310
|
-
* Normalize a Vercel AI SDK tool set into runtime tools in caller-defined key order.
|
|
311
|
-
*/
|
|
312
|
-
export declare function normalizeVercelAITools(tools: VercelAIToolSet, options?: VercelAIToolSetNormalizationOptions): Promise<readonly RuntimeTool<JsonObject, JsonValue>[]>;
|
|
313
|
-
export {};
|
|
314
51
|
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/runtime/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/runtime/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,WAAW,EACX,2BAA2B,EAE3B,mBAAmB,EACnB,mBAAmB,EAGnB,uBAAuB,EACvB,kBAAkB,EAClB,QAAQ,EACT,MAAM,aAAa,CAAC;AAMrB,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,EAC3B,iCAAiC,EACjC,6BAA6B,EAC7B,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,8BAA8B,EAC9B,cAAc,EACd,qBAAqB,EACrB,4BAA4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