@openrouter/agent 0.1.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/README.md +367 -0
- package/esm/api-shape-helpers/claude-message.d.ts +218 -0
- package/esm/api-shape-helpers/claude-message.d.ts.map +1 -0
- package/esm/api-shape-helpers/claude-message.js +6 -0
- package/esm/api-shape-helpers/claude-message.js.map +1 -0
- package/esm/index.d.ts +22 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +27 -0
- package/esm/index.js.map +1 -0
- package/esm/inner-loop/call-model.d.ts +67 -0
- package/esm/inner-loop/call-model.d.ts.map +1 -0
- package/esm/inner-loop/call-model.js +116 -0
- package/esm/inner-loop/call-model.js.map +1 -0
- package/esm/lib/anthropic-compat.d.ts +51 -0
- package/esm/lib/anthropic-compat.d.ts.map +1 -0
- package/esm/lib/anthropic-compat.js +216 -0
- package/esm/lib/anthropic-compat.js.map +1 -0
- package/esm/lib/anthropic-compat.test.d.ts +2 -0
- package/esm/lib/anthropic-compat.test.d.ts.map +1 -0
- package/esm/lib/anthropic-compat.test.js +668 -0
- package/esm/lib/anthropic-compat.test.js.map +1 -0
- package/esm/lib/async-params.d.ts +107 -0
- package/esm/lib/async-params.d.ts.map +1 -0
- package/esm/lib/async-params.js +94 -0
- package/esm/lib/async-params.js.map +1 -0
- package/esm/lib/chat-compat.d.ts +46 -0
- package/esm/lib/chat-compat.d.ts.map +1 -0
- package/esm/lib/chat-compat.js +111 -0
- package/esm/lib/chat-compat.js.map +1 -0
- package/esm/lib/chat-compat.test.d.ts +2 -0
- package/esm/lib/chat-compat.test.d.ts.map +1 -0
- package/esm/lib/chat-compat.test.js +405 -0
- package/esm/lib/chat-compat.test.js.map +1 -0
- package/esm/lib/claude-constants.d.ts +22 -0
- package/esm/lib/claude-constants.d.ts.map +1 -0
- package/esm/lib/claude-constants.js +20 -0
- package/esm/lib/claude-constants.js.map +1 -0
- package/esm/lib/claude-type-guards.d.ts +10 -0
- package/esm/lib/claude-type-guards.d.ts.map +1 -0
- package/esm/lib/claude-type-guards.js +68 -0
- package/esm/lib/claude-type-guards.js.map +1 -0
- package/esm/lib/conversation-state.d.ts +61 -0
- package/esm/lib/conversation-state.d.ts.map +1 -0
- package/esm/lib/conversation-state.js +230 -0
- package/esm/lib/conversation-state.js.map +1 -0
- package/esm/lib/model-result.d.ts +370 -0
- package/esm/lib/model-result.d.ts.map +1 -0
- package/esm/lib/model-result.js +1483 -0
- package/esm/lib/model-result.js.map +1 -0
- package/esm/lib/next-turn-params.d.ts +30 -0
- package/esm/lib/next-turn-params.d.ts.map +1 -0
- package/esm/lib/next-turn-params.js +129 -0
- package/esm/lib/next-turn-params.js.map +1 -0
- package/esm/lib/reusable-stream.d.ts +39 -0
- package/esm/lib/reusable-stream.d.ts.map +1 -0
- package/esm/lib/reusable-stream.js +192 -0
- package/esm/lib/reusable-stream.js.map +1 -0
- package/esm/lib/stop-conditions.d.ts +80 -0
- package/esm/lib/stop-conditions.d.ts.map +1 -0
- package/esm/lib/stop-conditions.js +104 -0
- package/esm/lib/stop-conditions.js.map +1 -0
- package/esm/lib/stream-transformers.d.ts +109 -0
- package/esm/lib/stream-transformers.d.ts.map +1 -0
- package/esm/lib/stream-transformers.js +856 -0
- package/esm/lib/stream-transformers.js.map +1 -0
- package/esm/lib/stream-type-guards.d.ts +29 -0
- package/esm/lib/stream-type-guards.d.ts.map +1 -0
- package/esm/lib/stream-type-guards.js +85 -0
- package/esm/lib/stream-type-guards.js.map +1 -0
- package/esm/lib/tool-context.d.ts +68 -0
- package/esm/lib/tool-context.d.ts.map +1 -0
- package/esm/lib/tool-context.js +188 -0
- package/esm/lib/tool-context.js.map +1 -0
- package/esm/lib/tool-event-broadcaster.d.ts +44 -0
- package/esm/lib/tool-event-broadcaster.d.ts.map +1 -0
- package/esm/lib/tool-event-broadcaster.js +162 -0
- package/esm/lib/tool-event-broadcaster.js.map +1 -0
- package/esm/lib/tool-executor.d.ts +73 -0
- package/esm/lib/tool-executor.d.ts.map +1 -0
- package/esm/lib/tool-executor.js +267 -0
- package/esm/lib/tool-executor.js.map +1 -0
- package/esm/lib/tool-orchestrator.d.ts +50 -0
- package/esm/lib/tool-orchestrator.d.ts.map +1 -0
- package/esm/lib/tool-orchestrator.js +180 -0
- package/esm/lib/tool-orchestrator.js.map +1 -0
- package/esm/lib/tool-types.d.ts +572 -0
- package/esm/lib/tool-types.d.ts.map +1 -0
- package/esm/lib/tool-types.js +80 -0
- package/esm/lib/tool-types.js.map +1 -0
- package/esm/lib/tool.d.ts +108 -0
- package/esm/lib/tool.d.ts.map +1 -0
- package/esm/lib/tool.js +84 -0
- package/esm/lib/tool.js.map +1 -0
- package/esm/lib/turn-context.d.ts +50 -0
- package/esm/lib/turn-context.d.ts.map +1 -0
- package/esm/lib/turn-context.js +61 -0
- package/esm/lib/turn-context.js.map +1 -0
- package/package.json +125 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { $ZodObject, $ZodShape, $ZodType, infer as zodInfer } from 'zod/v4/core';
|
|
2
|
+
import { type ManualTool, type NextTurnParamsFunctions, type Tool, type ToolApprovalCheck, type ToolExecuteContext, type ToolWithExecute, type ToolWithGenerator } from './tool-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for a regular tool with outputSchema
|
|
5
|
+
*/
|
|
6
|
+
type RegularToolConfigWithOutput<TInput extends $ZodObject<$ZodShape>, TOutput extends $ZodType, TContext extends Record<string, unknown> = Record<string, unknown>, TName extends string = string> = {
|
|
7
|
+
name: TName;
|
|
8
|
+
description?: string;
|
|
9
|
+
inputSchema: TInput;
|
|
10
|
+
outputSchema: TOutput;
|
|
11
|
+
eventSchema?: undefined;
|
|
12
|
+
/** Zod schema declaring the context data this tool needs */
|
|
13
|
+
contextSchema?: $ZodObject<$ZodShape>;
|
|
14
|
+
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
15
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
16
|
+
execute: (params: zodInfer<TInput>, context?: ToolExecuteContext<TName, TContext>) => Promise<zodInfer<TOutput>> | zodInfer<TOutput>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for a regular tool without outputSchema (infers return type from execute)
|
|
20
|
+
*/
|
|
21
|
+
type RegularToolConfigWithoutOutput<TInput extends $ZodObject<$ZodShape>, TReturn, TContext extends Record<string, unknown> = Record<string, unknown>, TName extends string = string> = {
|
|
22
|
+
name: TName;
|
|
23
|
+
description?: string;
|
|
24
|
+
inputSchema: TInput;
|
|
25
|
+
outputSchema?: undefined;
|
|
26
|
+
eventSchema?: undefined;
|
|
27
|
+
/** Zod schema declaring the context data this tool needs */
|
|
28
|
+
contextSchema?: $ZodObject<$ZodShape>;
|
|
29
|
+
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
30
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
31
|
+
execute: (params: zodInfer<TInput>, context?: ToolExecuteContext<TName, TContext>) => Promise<TReturn> | TReturn;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Configuration for a generator tool (with eventSchema)
|
|
35
|
+
*/
|
|
36
|
+
type GeneratorToolConfig<TInput extends $ZodObject<$ZodShape>, TEvent extends $ZodType, TOutput extends $ZodType, TContext extends Record<string, unknown> = Record<string, unknown>, TName extends string = string> = {
|
|
37
|
+
name: TName;
|
|
38
|
+
description?: string;
|
|
39
|
+
inputSchema: TInput;
|
|
40
|
+
eventSchema: TEvent;
|
|
41
|
+
outputSchema: TOutput;
|
|
42
|
+
/** Zod schema declaring the context data this tool needs */
|
|
43
|
+
contextSchema?: $ZodObject<$ZodShape>;
|
|
44
|
+
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
45
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
46
|
+
execute: (params: zodInfer<TInput>, context?: ToolExecuteContext<TName, TContext>) => AsyncGenerator<zodInfer<TEvent> | zodInfer<TOutput>>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Configuration for a manual tool (execute: false, no eventSchema or outputSchema)
|
|
50
|
+
*/
|
|
51
|
+
type ManualToolConfig<TInput extends $ZodObject<$ZodShape>> = {
|
|
52
|
+
name: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
inputSchema: TInput;
|
|
55
|
+
/** Zod schema declaring the context data this tool needs */
|
|
56
|
+
contextSchema?: $ZodObject<$ZodShape>;
|
|
57
|
+
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
58
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
59
|
+
execute: false;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Loose config type for the `tool<TShared>()` overload.
|
|
63
|
+
* Accepts any valid tool config while typing `ctx.shared` from TShared.
|
|
64
|
+
*/
|
|
65
|
+
type ToolConfigWithSharedContext<TShared extends Record<string, unknown>> = {
|
|
66
|
+
name: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
inputSchema: $ZodObject<$ZodShape>;
|
|
69
|
+
outputSchema?: $ZodType;
|
|
70
|
+
eventSchema?: $ZodType;
|
|
71
|
+
contextSchema?: $ZodObject<$ZodShape>;
|
|
72
|
+
nextTurnParams?: NextTurnParamsFunctions<Record<string, unknown>>;
|
|
73
|
+
requireApproval?: boolean | ToolApprovalCheck<Record<string, unknown>>;
|
|
74
|
+
execute: ((params: Record<string, unknown>, context?: ToolExecuteContext<string, Record<string, unknown>, TShared>) => unknown) | ((params: Record<string, unknown>, context?: ToolExecuteContext<string, Record<string, unknown>, TShared>) => AsyncGenerator<unknown>) | false;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Creates a tool with full type inference from Zod schemas.
|
|
78
|
+
*
|
|
79
|
+
* The tool type is automatically determined based on the configuration:
|
|
80
|
+
* - **Generator tool**: When `eventSchema` is provided
|
|
81
|
+
* - **Regular tool**: When `execute` is a function (no `eventSchema`)
|
|
82
|
+
* - **Manual tool**: When `execute: false` is set
|
|
83
|
+
*
|
|
84
|
+
* Shared context typing: Pass a type parameter to type `ctx.shared`
|
|
85
|
+
* in the execute callback. Runtime validation happens at callModel
|
|
86
|
+
* via `sharedContextSchema`.
|
|
87
|
+
*
|
|
88
|
+
* @example Regular tool with typed shared context:
|
|
89
|
+
* ```typescript
|
|
90
|
+
* type SharedCtx = z.infer<typeof SharedContextSchema>;
|
|
91
|
+
*
|
|
92
|
+
* const execTool = tool<SharedCtx>({
|
|
93
|
+
* name: "sandbox_exec",
|
|
94
|
+
* inputSchema: z.object({ command: z.string() }),
|
|
95
|
+
* execute: async (params, ctx) => {
|
|
96
|
+
* ctx?.shared._sessionId; // string | undefined
|
|
97
|
+
* return { output: '...' };
|
|
98
|
+
* },
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function tool<TInput extends $ZodObject<$ZodShape>, TEvent extends $ZodType, TOutput extends $ZodType, TContext extends Record<string, unknown> = Record<string, unknown>, TName extends string = string>(config: GeneratorToolConfig<TInput, TEvent, TOutput, TContext, TName>): ToolWithGenerator<TInput, TEvent, TOutput, TContext>;
|
|
103
|
+
export declare function tool<TInput extends $ZodObject<$ZodShape>>(config: ManualToolConfig<TInput>): ManualTool<TInput>;
|
|
104
|
+
export declare function tool<TInput extends $ZodObject<$ZodShape>, TOutput extends $ZodType, TContext extends Record<string, unknown> = Record<string, unknown>, TName extends string = string>(config: RegularToolConfigWithOutput<TInput, TOutput, TContext, TName>): ToolWithExecute<TInput, TOutput, TContext>;
|
|
105
|
+
export declare function tool<TInput extends $ZodObject<$ZodShape>, TReturn, TContext extends Record<string, unknown> = Record<string, unknown>, TName extends string = string>(config: RegularToolConfigWithoutOutput<TInput, TReturn, TContext, TName>): ToolWithExecute<TInput, $ZodType<TReturn>, TContext>;
|
|
106
|
+
export declare function tool<TShared extends Record<string, unknown>>(config: ToolConfigWithSharedContext<TShared>): Tool;
|
|
107
|
+
export {};
|
|
108
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/lib/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,uBAAuB,EAE5B,KAAK,IAAI,EACT,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AAIzB;;GAEG;AACH,KAAK,2BAA2B,CAC9B,MAAM,SAAS,UAAU,CAAC,SAAS,CAAC,EACpC,OAAO,SAAS,QAAQ,EACxB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,KAAK,SAAS,MAAM,GAAG,MAAM,IAC3B;IACF,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,eAAe,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,OAAO,EAAE,CACP,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,OAAO,CAAC,EAAE,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CA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,MAAM,SAAS,UAAU,CAAC,SAAS,CAAC,EACvD,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAC/B,UAAU,CAAC,MAAM,CAAC,CAAC;AAGtB,wBAAgB,IAAI,CAClB,MAAM,SAAS,UAAU,CAAC,SAAS,CAAC,EACpC,OAAO,SAAS,QAAQ,EACxB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,KAAK,SAAS,MAAM,GAAG,MAAM,EAE7B,MAAM,EAAE,2BAA2B,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,GACpE,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAG9C,wBAAgB,IAAI,CAClB,MAAM,SAAS,UAAU,CAAC,SAAS,CAAC,EACpC,OAAO,EACP,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,KAAK,SAAS,MAAM,GAAG,MAAM,EAE7B,MAAM,EAAE,8BAA8B,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,GACvE,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AAMxD,wBAAgB,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1D,MAAM,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAC3C,IAAI,CAAC"}
|
package/esm/lib/tool.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { SHARED_CONTEXT_KEY, ToolType, } from './tool-types.js';
|
|
2
|
+
// Implementation
|
|
3
|
+
export function tool(config) {
|
|
4
|
+
// 'shared' is reserved for shared context — forbid it as a tool name
|
|
5
|
+
if (config.name === SHARED_CONTEXT_KEY) {
|
|
6
|
+
throw new Error(`Tool name "${SHARED_CONTEXT_KEY}" is reserved for shared context. Choose a different name.`);
|
|
7
|
+
}
|
|
8
|
+
// Check for manual tool first (execute === false)
|
|
9
|
+
if (config.execute === false) {
|
|
10
|
+
const fn = {
|
|
11
|
+
name: config.name,
|
|
12
|
+
inputSchema: config.inputSchema,
|
|
13
|
+
};
|
|
14
|
+
if (config.description !== undefined) {
|
|
15
|
+
fn.description = config.description;
|
|
16
|
+
}
|
|
17
|
+
if (config.contextSchema !== undefined) {
|
|
18
|
+
fn.contextSchema = config.contextSchema;
|
|
19
|
+
}
|
|
20
|
+
if (config.nextTurnParams !== undefined) {
|
|
21
|
+
fn.nextTurnParams = config.nextTurnParams;
|
|
22
|
+
}
|
|
23
|
+
if (config.requireApproval !== undefined) {
|
|
24
|
+
fn.requireApproval = config.requireApproval;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
type: ToolType.Function,
|
|
28
|
+
function: fn,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// Check for generator tool (has eventSchema)
|
|
32
|
+
if ('eventSchema' in config && config.eventSchema !== undefined) {
|
|
33
|
+
const fn = {
|
|
34
|
+
name: config.name,
|
|
35
|
+
inputSchema: config.inputSchema,
|
|
36
|
+
eventSchema: config.eventSchema,
|
|
37
|
+
outputSchema: config.outputSchema,
|
|
38
|
+
execute: config.execute,
|
|
39
|
+
};
|
|
40
|
+
if (config.description !== undefined) {
|
|
41
|
+
fn.description = config.description;
|
|
42
|
+
}
|
|
43
|
+
if (config.contextSchema !== undefined) {
|
|
44
|
+
fn.contextSchema = config.contextSchema;
|
|
45
|
+
}
|
|
46
|
+
if (config.nextTurnParams !== undefined) {
|
|
47
|
+
fn.nextTurnParams = config.nextTurnParams;
|
|
48
|
+
}
|
|
49
|
+
if (config.requireApproval !== undefined) {
|
|
50
|
+
fn.requireApproval = config.requireApproval;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
type: ToolType.Function,
|
|
54
|
+
function: fn,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Regular tool (has execute function, no eventSchema)
|
|
58
|
+
const functionObj = {
|
|
59
|
+
name: config.name,
|
|
60
|
+
inputSchema: config.inputSchema,
|
|
61
|
+
execute: config.execute,
|
|
62
|
+
...(config.description !== undefined && {
|
|
63
|
+
description: config.description,
|
|
64
|
+
}),
|
|
65
|
+
...(config.outputSchema !== undefined && {
|
|
66
|
+
outputSchema: config.outputSchema,
|
|
67
|
+
}),
|
|
68
|
+
...(config.contextSchema !== undefined && {
|
|
69
|
+
contextSchema: config.contextSchema,
|
|
70
|
+
}),
|
|
71
|
+
...(config.nextTurnParams !== undefined && {
|
|
72
|
+
nextTurnParams: config.nextTurnParams,
|
|
73
|
+
}),
|
|
74
|
+
...(config.requireApproval !== undefined && {
|
|
75
|
+
requireApproval: config.requireApproval,
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
type: ToolType.Function,
|
|
80
|
+
function: functionObj,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/lib/tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,kBAAkB,EAIlB,QAAQ,GAGT,MAAM,iBAAiB,CAAC;AA+MzB,iBAAiB;AACjB,MAAM,UAAU,IAAI,CAClB,MAIwD;IAExD,qEAAqE;IACrE,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,cAAc,kBAAkB,4DAA4D,CAC7F,CAAC;IACJ,CAAC;IAED,kDAAkD;IAClD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC7B,MAAM,EAAE,GAAkD;YACxD,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE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cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,CAAC;QAED,IAAI,MAAM,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACzC,EAAE,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAC9C,CAAC;QAED,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,QAAQ;YACvB,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IAED,sDAAsD;IACtD,MAAM,WAAW,GAAG;QAClB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,GAAG,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS,IAAI;YACtC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,YAAY,KAAK,SAAS,IAAI;YACvC,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,aAAa,KAAK,SAAS,IAAI;YACxC,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,cAAc,KAAK,SAAS,IAAI;YACzC,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,eAAe,KAAK,SAAS,IAAI;YAC1C,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC,CAAC;KACH,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,QAAQ;QACvB,QAAQ,EAAE,WAAW;KACtB,CAAC;AACJ,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { TurnContext } from './tool-types.js';
|
|
2
|
+
import * as models from '@openrouter/sdk/models';
|
|
3
|
+
/**
|
|
4
|
+
* Options for building a turn context
|
|
5
|
+
*/
|
|
6
|
+
export interface BuildTurnContextOptions {
|
|
7
|
+
/** Number of turns so far (1-indexed for tool execution, 0 for initial request) */
|
|
8
|
+
numberOfTurns: number;
|
|
9
|
+
/** The specific tool call being executed (optional for initial/async resolution contexts) */
|
|
10
|
+
toolCall?: models.FunctionCallItem;
|
|
11
|
+
/** The full request being sent to the API (optional for initial/async resolution contexts) */
|
|
12
|
+
turnRequest?: models.ResponsesRequest;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Build a turn context for tool execution or async parameter resolution
|
|
16
|
+
*
|
|
17
|
+
* @param options - Options for building the context
|
|
18
|
+
* @returns A TurnContext object
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // For tool execution with full context
|
|
23
|
+
* const context = buildTurnContext({
|
|
24
|
+
* numberOfTurns: 1,
|
|
25
|
+
* toolCall: rawToolCall,
|
|
26
|
+
* turnRequest: currentRequest,
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* // For async parameter resolution (partial context)
|
|
30
|
+
* const context = buildTurnContext({
|
|
31
|
+
* numberOfTurns: 0,
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildTurnContext(options: BuildTurnContextOptions): TurnContext;
|
|
36
|
+
/**
|
|
37
|
+
* Normalize OpenResponsesInput to an array format
|
|
38
|
+
* Converts string input to array with single user message
|
|
39
|
+
*
|
|
40
|
+
* @param input - The input to normalize
|
|
41
|
+
* @returns Array format of the input
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const arrayInput = normalizeInputToArray("Hello!");
|
|
46
|
+
* // Returns: [{ role: "user", content: "Hello!" }]
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function normalizeInputToArray(input: models.InputsUnion): Array<models.BaseInputsUnion>;
|
|
50
|
+
//# sourceMappingURL=turn-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-context.d.ts","sourceRoot":"","sources":["../../src/lib/turn-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,mFAAmF;IACnF,aAAa,EAAE,MAAM,CAAC;IACtB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC;IACnC,8FAA8F;IAC9F,WAAW,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,WAAW,CAc9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAY9F"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as models from '@openrouter/sdk/models';
|
|
2
|
+
/**
|
|
3
|
+
* Build a turn context for tool execution or async parameter resolution
|
|
4
|
+
*
|
|
5
|
+
* @param options - Options for building the context
|
|
6
|
+
* @returns A TurnContext object
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // For tool execution with full context
|
|
11
|
+
* const context = buildTurnContext({
|
|
12
|
+
* numberOfTurns: 1,
|
|
13
|
+
* toolCall: rawToolCall,
|
|
14
|
+
* turnRequest: currentRequest,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // For async parameter resolution (partial context)
|
|
18
|
+
* const context = buildTurnContext({
|
|
19
|
+
* numberOfTurns: 0,
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function buildTurnContext(options) {
|
|
24
|
+
const context = {
|
|
25
|
+
numberOfTurns: options.numberOfTurns,
|
|
26
|
+
};
|
|
27
|
+
if (options.toolCall !== undefined) {
|
|
28
|
+
context.toolCall = options.toolCall;
|
|
29
|
+
}
|
|
30
|
+
if (options.turnRequest !== undefined) {
|
|
31
|
+
context.turnRequest = options.turnRequest;
|
|
32
|
+
}
|
|
33
|
+
return context;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalize OpenResponsesInput to an array format
|
|
37
|
+
* Converts string input to array with single user message
|
|
38
|
+
*
|
|
39
|
+
* @param input - The input to normalize
|
|
40
|
+
* @returns Array format of the input
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const arrayInput = normalizeInputToArray("Hello!");
|
|
45
|
+
* // Returns: [{ role: "user", content: "Hello!" }]
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function normalizeInputToArray(input) {
|
|
49
|
+
if (typeof input === 'string') {
|
|
50
|
+
// Construct object with all required fields - type is optional
|
|
51
|
+
const message = {
|
|
52
|
+
role: models.EasyInputMessageRoleUser.User,
|
|
53
|
+
content: input,
|
|
54
|
+
};
|
|
55
|
+
return [
|
|
56
|
+
message,
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
return input;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=turn-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-context.js","sourceRoot":"","sources":["../../src/lib/turn-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAcjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC;IAC/D,MAAM,OAAO,GAAgB;QAC3B,aAAa,EAAE,OAAO,CAAC,aAAa;KACrC,CAAC;IAEF,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACtC,CAAC;IAED,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAyB;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,+DAA+D;QAC/D,MAAM,OAAO,GAA4B;YACvC,IAAI,EAAE,MAAM,CAAC,wBAAwB,CAAC,IAAI;YAC1C,OAAO,EAAE,KAAK;SACf,CAAC;QACF,OAAO;YACL,OAAO;SACR,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openrouter/agent",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"author": "OpenRouter",
|
|
5
|
+
"description": "Agent toolkit for building AI applications with OpenRouter — tool orchestration, streaming, multi-turn conversations, and format compatibility.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"openrouter",
|
|
8
|
+
"agent",
|
|
9
|
+
"typescript",
|
|
10
|
+
"ai",
|
|
11
|
+
"tools",
|
|
12
|
+
"streaming",
|
|
13
|
+
"llm"
|
|
14
|
+
],
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "./esm/index.js",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./esm/index.d.ts",
|
|
21
|
+
"default": "./esm/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./call-model": {
|
|
24
|
+
"types": "./esm/inner-loop/call-model.d.ts",
|
|
25
|
+
"default": "./esm/inner-loop/call-model.js"
|
|
26
|
+
},
|
|
27
|
+
"./tool-types": {
|
|
28
|
+
"types": "./esm/lib/tool-types.d.ts",
|
|
29
|
+
"default": "./esm/lib/tool-types.js"
|
|
30
|
+
},
|
|
31
|
+
"./model-result": {
|
|
32
|
+
"types": "./esm/lib/model-result.d.ts",
|
|
33
|
+
"default": "./esm/lib/model-result.js"
|
|
34
|
+
},
|
|
35
|
+
"./async-params": {
|
|
36
|
+
"types": "./esm/lib/async-params.d.ts",
|
|
37
|
+
"default": "./esm/lib/async-params.js"
|
|
38
|
+
},
|
|
39
|
+
"./stop-conditions": {
|
|
40
|
+
"types": "./esm/lib/stop-conditions.d.ts",
|
|
41
|
+
"default": "./esm/lib/stop-conditions.js"
|
|
42
|
+
},
|
|
43
|
+
"./tool": {
|
|
44
|
+
"types": "./esm/lib/tool.d.ts",
|
|
45
|
+
"default": "./esm/lib/tool.js"
|
|
46
|
+
},
|
|
47
|
+
"./anthropic-compat": {
|
|
48
|
+
"types": "./esm/lib/anthropic-compat.d.ts",
|
|
49
|
+
"default": "./esm/lib/anthropic-compat.js"
|
|
50
|
+
},
|
|
51
|
+
"./chat-compat": {
|
|
52
|
+
"types": "./esm/lib/chat-compat.d.ts",
|
|
53
|
+
"default": "./esm/lib/chat-compat.js"
|
|
54
|
+
},
|
|
55
|
+
"./claude-constants": {
|
|
56
|
+
"types": "./esm/lib/claude-constants.d.ts",
|
|
57
|
+
"default": "./esm/lib/claude-constants.js"
|
|
58
|
+
},
|
|
59
|
+
"./claude-type-guards": {
|
|
60
|
+
"types": "./esm/lib/claude-type-guards.d.ts",
|
|
61
|
+
"default": "./esm/lib/claude-type-guards.js"
|
|
62
|
+
},
|
|
63
|
+
"./conversation-state": {
|
|
64
|
+
"types": "./esm/lib/conversation-state.d.ts",
|
|
65
|
+
"default": "./esm/lib/conversation-state.js"
|
|
66
|
+
},
|
|
67
|
+
"./next-turn-params": {
|
|
68
|
+
"types": "./esm/lib/next-turn-params.d.ts",
|
|
69
|
+
"default": "./esm/lib/next-turn-params.js"
|
|
70
|
+
},
|
|
71
|
+
"./stream-transformers": {
|
|
72
|
+
"types": "./esm/lib/stream-transformers.d.ts",
|
|
73
|
+
"default": "./esm/lib/stream-transformers.js"
|
|
74
|
+
},
|
|
75
|
+
"./tool-context": {
|
|
76
|
+
"types": "./esm/lib/tool-context.d.ts",
|
|
77
|
+
"default": "./esm/lib/tool-context.js"
|
|
78
|
+
},
|
|
79
|
+
"./tool-event-broadcaster": {
|
|
80
|
+
"types": "./esm/lib/tool-event-broadcaster.d.ts",
|
|
81
|
+
"default": "./esm/lib/tool-event-broadcaster.js"
|
|
82
|
+
},
|
|
83
|
+
"./turn-context": {
|
|
84
|
+
"types": "./esm/lib/turn-context.d.ts",
|
|
85
|
+
"default": "./esm/lib/turn-context.js"
|
|
86
|
+
},
|
|
87
|
+
"./package.json": "./package.json"
|
|
88
|
+
},
|
|
89
|
+
"sideEffects": false,
|
|
90
|
+
"repository": {
|
|
91
|
+
"type": "git",
|
|
92
|
+
"url": "https://github.com/OpenRouterTeam/typescript-agent.git"
|
|
93
|
+
},
|
|
94
|
+
"files": [
|
|
95
|
+
"esm",
|
|
96
|
+
"package.json",
|
|
97
|
+
"README.md",
|
|
98
|
+
"LICENSE"
|
|
99
|
+
],
|
|
100
|
+
"dependencies": {
|
|
101
|
+
"@openrouter/sdk": "git+https://github.com/OpenRouterTeam/typescript-sdk.git#add-prepare-script",
|
|
102
|
+
"zod": "^4.0.0"
|
|
103
|
+
},
|
|
104
|
+
"devDependencies": {
|
|
105
|
+
"@changesets/changelog-github": "^0.6.0",
|
|
106
|
+
"@changesets/cli": "^2.30.0",
|
|
107
|
+
"@eslint/js": "^9.19.0",
|
|
108
|
+
"@types/node": "^22.13.12",
|
|
109
|
+
"dotenv": "^16.4.7",
|
|
110
|
+
"eslint": "^9.19.0",
|
|
111
|
+
"globals": "^15.14.0",
|
|
112
|
+
"typescript": "~5.8.3",
|
|
113
|
+
"typescript-eslint": "^8.26.0",
|
|
114
|
+
"vitest": "^3.2.4"
|
|
115
|
+
},
|
|
116
|
+
"scripts": {
|
|
117
|
+
"lint": "eslint --cache --max-warnings=0 src",
|
|
118
|
+
"build": "tsc",
|
|
119
|
+
"test": "vitest --run --project unit",
|
|
120
|
+
"test:e2e": "vitest --run --project e2e",
|
|
121
|
+
"test:watch": "vitest --watch --project unit",
|
|
122
|
+
"typecheck": "tsc --noEmit",
|
|
123
|
+
"compile": "tsc"
|
|
124
|
+
}
|
|
125
|
+
}
|