@kuralle-agents/core 0.6.0 → 0.6.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/dist/capabilities/adapters/gemini.js +2 -2
- package/dist/flow/choiceMatch.d.ts +1 -1
- package/dist/memory/blocks/memoryBlockTool.d.ts +3 -3
- package/dist/tools/effect/wrapAiSdkTool.d.ts +17 -2
- package/dist/tools/effect/wrapAiSdkTool.js +8 -2
- package/dist/tools/handoff.d.ts +1 -1
- package/dist/tools/http.js +1 -1
- package/dist/utils/chrono.d.ts +1 -9
- package/package.json +5 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
3
|
* Convert ToolDeclarations to Gemini FunctionDeclarations.
|
|
4
4
|
*
|
|
@@ -11,7 +11,7 @@ export function toGeminiDeclarations(tools) {
|
|
|
11
11
|
name: tool.name,
|
|
12
12
|
description: tool.description,
|
|
13
13
|
parameters: tool.parameters
|
|
14
|
-
? stripUnsupported(
|
|
14
|
+
? stripUnsupported(z.toJSONSchema(tool.parameters, { target: 'openapi-3.0' }))
|
|
15
15
|
: { type: 'object', properties: {} },
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
@@ -10,7 +10,7 @@ export declare function isChoiceFieldSchema(schema: unknown): schema is z.ZodObj
|
|
|
10
10
|
choice: z.ZodString;
|
|
11
11
|
}>;
|
|
12
12
|
export declare function buildChoiceEnumSchema(choices: ChoiceOption[]): z.ZodObject<{
|
|
13
|
-
choice: z.ZodEnum<
|
|
13
|
+
choice: z.ZodEnum<Record<string, string>>;
|
|
14
14
|
}>;
|
|
15
15
|
export declare function latestUserMessageText(messages: ModelMessage[]): string | undefined;
|
|
16
16
|
export declare function matchChoiceFromInput(input: string, choices: ChoiceOption[]): string | undefined;
|
|
@@ -9,11 +9,11 @@ export interface MemoryBlockToolOptions {
|
|
|
9
9
|
scanForInjection?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export declare function buildMemoryBlockTool(opts: MemoryBlockToolOptions): import("ai").Tool<{
|
|
12
|
-
block: string;
|
|
13
12
|
action: "replace" | "view" | "add" | "remove";
|
|
14
|
-
|
|
15
|
-
content?: string | undefined;
|
|
13
|
+
block: string;
|
|
16
14
|
scope?: "user" | "agent" | "shared" | undefined;
|
|
15
|
+
content?: string | undefined;
|
|
16
|
+
match?: string | undefined;
|
|
17
17
|
}, {
|
|
18
18
|
block: string;
|
|
19
19
|
scope: MemoryBlockScope;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
import type { Tool as AiTool } from 'ai';
|
|
2
1
|
import type { AnyTool } from '../../types/effectTool.js';
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Structural shape of an AI SDK `tool()` result. Intentionally decoupled from the
|
|
4
|
+
* nominal `import('ai').Tool` type so a tool produced by *any* `ai` instance/version
|
|
5
|
+
* in the consumer's tree is accepted (avoids cross-instance nominal mismatches).
|
|
6
|
+
*/
|
|
7
|
+
interface AiSdkToolLike {
|
|
8
|
+
description?: string;
|
|
9
|
+
inputSchema?: unknown;
|
|
10
|
+
execute?: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Adapt a third-party AI SDK tool into a durable Kuralle effect tool so its `execute`
|
|
14
|
+
* runs through the journal (exactly-once on replay). Throws on a schema-only tool
|
|
15
|
+
* (no `execute`) — use `defineTool` for those.
|
|
16
|
+
*/
|
|
17
|
+
export declare function wrapAiSdkTool(name: string, aiTool: AiSdkToolLike): AnyTool;
|
|
18
|
+
export {};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapt a third-party AI SDK tool into a durable Kuralle effect tool so its `execute`
|
|
3
|
+
* runs through the journal (exactly-once on replay). Throws on a schema-only tool
|
|
4
|
+
* (no `execute`) — use `defineTool` for those.
|
|
5
|
+
*/
|
|
1
6
|
export function wrapAiSdkTool(name, aiTool) {
|
|
2
7
|
const exec = aiTool.execute;
|
|
3
8
|
if (typeof exec !== 'function') {
|
|
4
9
|
throw new Error(`wrapAiSdkTool("${name}"): AI SDK tool has no execute; use defineTool for schema-only tools.`);
|
|
5
10
|
}
|
|
11
|
+
const run = exec;
|
|
6
12
|
return {
|
|
7
13
|
name,
|
|
8
|
-
description: aiTool.description
|
|
14
|
+
description: typeof aiTool.description === 'string' ? aiTool.description : name,
|
|
9
15
|
input: aiTool.inputSchema,
|
|
10
|
-
execute: (args, ctx) =>
|
|
16
|
+
execute: (args, ctx) => run(args, ctx),
|
|
11
17
|
};
|
|
12
18
|
}
|
package/dist/tools/handoff.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface HandoffResult {
|
|
|
7
7
|
summary?: string;
|
|
8
8
|
message?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function createHandoffTool(availableAgents: AgentConfig[], currentAgentId?: string): import("ai").Tool<
|
|
10
|
+
export declare function createHandoffTool(availableAgents: AgentConfig[], currentAgentId?: string): import("ai").Tool<Record<string, never>, {
|
|
11
11
|
error: string;
|
|
12
12
|
}> | import("ai").Tool<{
|
|
13
13
|
targetAgentId: string;
|
package/dist/tools/http.js
CHANGED
package/dist/utils/chrono.d.ts
CHANGED
|
@@ -16,15 +16,7 @@ declare const dateParserInputSchema: z.ZodObject<{
|
|
|
16
16
|
text: z.ZodString;
|
|
17
17
|
referenceDate: z.ZodOptional<z.ZodString>;
|
|
18
18
|
timezone: z.ZodOptional<z.ZodString>;
|
|
19
|
-
},
|
|
20
|
-
text: string;
|
|
21
|
-
referenceDate?: string | undefined;
|
|
22
|
-
timezone?: string | undefined;
|
|
23
|
-
}, {
|
|
24
|
-
text: string;
|
|
25
|
-
referenceDate?: string | undefined;
|
|
26
|
-
timezone?: string | undefined;
|
|
27
|
-
}>;
|
|
19
|
+
}, z.core.$strip>;
|
|
28
20
|
type DateParserInput = z.infer<typeof dateParserInputSchema>;
|
|
29
21
|
type DateParserOutput = {
|
|
30
22
|
success: true;
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "git+https://github.com/kuralle/kuralle-agents.git",
|
|
7
7
|
"directory": "packages/kuralle-core"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.6.
|
|
9
|
+
"version": "0.6.1",
|
|
10
10
|
"description": "A framework for structured conversational AI agents",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"ai": "^6.0.0",
|
|
94
|
-
"zod": "^
|
|
94
|
+
"zod": "^4.0.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@cloudflare/vitest-pool-workers": "^0.12.7",
|
|
@@ -102,12 +102,11 @@
|
|
|
102
102
|
"dotenv": "^16.4.0",
|
|
103
103
|
"typescript": "^5.3.0",
|
|
104
104
|
"vitest": "^3.2.4",
|
|
105
|
-
"zod": "^
|
|
106
|
-
"@kuralle-agents/realtime-audio": "0.6.
|
|
105
|
+
"zod": "^4.0.0",
|
|
106
|
+
"@kuralle-agents/realtime-audio": "0.6.1"
|
|
107
107
|
},
|
|
108
108
|
"dependencies": {
|
|
109
|
-
"chrono-node": "^2.6.0"
|
|
110
|
-
"zod-to-json-schema": "^3.24.0"
|
|
109
|
+
"chrono-node": "^2.6.0"
|
|
111
110
|
},
|
|
112
111
|
"scripts": {
|
|
113
112
|
"prebuild": "rm -rf dist",
|