@openrouter/sdk 1.2.36 → 1.2.38
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/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/functioncallitem.d.ts +24 -0
- package/esm/models/functioncallitem.js +19 -0
- package/esm/models/openairesponsefunctiontoolcall.d.ts +17 -0
- package/esm/models/openairesponsefunctiontoolcall.js +12 -1
- package/esm/models/outputfunctioncallitem.d.ts +27 -0
- package/esm/models/outputfunctioncallitem.js +31 -1
- package/esm/models/outputfusionservertoolitem.d.ts +1 -1
- package/esm/models/outputsubagentservertoolitem.d.ts +5 -0
- package/esm/models/outputsubagentservertoolitem.js +4 -0
- package/esm/models/subagentreasoning.d.ts +1 -1
- package/esm/models/subagentservertoolconfig.d.ts +11 -1
- package/esm/models/subagentservertoolconfig.js +4 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "1.2.
|
|
52
|
+
readonly sdkVersion: "1.2.38";
|
|
53
53
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.38 2.914.0 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "1.2.
|
|
29
|
+
sdkVersion: "1.2.38",
|
|
30
30
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 1.2.38 2.914.0 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { ClosedEnum } from "../types/enums.js";
|
|
3
3
|
import { ToolCallStatus } from "./toolcallstatus.js";
|
|
4
|
+
export type FunctionCallItemSubagentItem = {
|
|
5
|
+
type: string;
|
|
6
|
+
additionalProperties?: {
|
|
7
|
+
[k: string]: any;
|
|
8
|
+
} | undefined;
|
|
9
|
+
};
|
|
4
10
|
export declare const FunctionCallItemType: {
|
|
5
11
|
readonly FunctionCall: "function_call";
|
|
6
12
|
};
|
|
@@ -18,9 +24,25 @@ export type FunctionCallItem = {
|
|
|
18
24
|
*/
|
|
19
25
|
namespace?: string | undefined;
|
|
20
26
|
status?: ToolCallStatus | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls.
|
|
29
|
+
*/
|
|
30
|
+
subagentId?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool.
|
|
33
|
+
*/
|
|
34
|
+
subagentItems?: Array<FunctionCallItemSubagentItem> | undefined;
|
|
21
35
|
type: FunctionCallItemType;
|
|
22
36
|
};
|
|
23
37
|
/** @internal */
|
|
38
|
+
export type FunctionCallItemSubagentItem$Outbound = {
|
|
39
|
+
type: string;
|
|
40
|
+
[additionalProperties: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
/** @internal */
|
|
43
|
+
export declare const FunctionCallItemSubagentItem$outboundSchema: z.ZodType<FunctionCallItemSubagentItem$Outbound, FunctionCallItemSubagentItem>;
|
|
44
|
+
export declare function functionCallItemSubagentItemToJSON(functionCallItemSubagentItem: FunctionCallItemSubagentItem): string;
|
|
45
|
+
/** @internal */
|
|
24
46
|
export declare const FunctionCallItemType$outboundSchema: z.ZodEnum<typeof FunctionCallItemType>;
|
|
25
47
|
/** @internal */
|
|
26
48
|
export type FunctionCallItem$Outbound = {
|
|
@@ -30,6 +52,8 @@ export type FunctionCallItem$Outbound = {
|
|
|
30
52
|
name: string;
|
|
31
53
|
namespace?: string | undefined;
|
|
32
54
|
status?: string | undefined;
|
|
55
|
+
subagent_id?: string | undefined;
|
|
56
|
+
subagent_items?: Array<FunctionCallItemSubagentItem$Outbound> | undefined;
|
|
33
57
|
type: string;
|
|
34
58
|
};
|
|
35
59
|
/** @internal */
|
|
@@ -9,6 +9,21 @@ export const FunctionCallItemType = {
|
|
|
9
9
|
FunctionCall: "function_call",
|
|
10
10
|
};
|
|
11
11
|
/** @internal */
|
|
12
|
+
export const FunctionCallItemSubagentItem$outboundSchema = z.object({
|
|
13
|
+
type: z.string(),
|
|
14
|
+
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
15
|
+
}).transform((v) => {
|
|
16
|
+
return {
|
|
17
|
+
...v.additionalProperties,
|
|
18
|
+
...remap$(v, {
|
|
19
|
+
additionalProperties: null,
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
export function functionCallItemSubagentItemToJSON(functionCallItemSubagentItem) {
|
|
24
|
+
return JSON.stringify(FunctionCallItemSubagentItem$outboundSchema.parse(functionCallItemSubagentItem));
|
|
25
|
+
}
|
|
26
|
+
/** @internal */
|
|
12
27
|
export const FunctionCallItemType$outboundSchema = z.enum(FunctionCallItemType);
|
|
13
28
|
/** @internal */
|
|
14
29
|
export const FunctionCallItem$outboundSchema = z.object({
|
|
@@ -18,10 +33,14 @@ export const FunctionCallItem$outboundSchema = z.object({
|
|
|
18
33
|
name: z.string(),
|
|
19
34
|
namespace: z.string().optional(),
|
|
20
35
|
status: ToolCallStatus$outboundSchema.optional(),
|
|
36
|
+
subagentId: z.string().optional(),
|
|
37
|
+
subagentItems: z.array(z.lazy(() => FunctionCallItemSubagentItem$outboundSchema)).optional(),
|
|
21
38
|
type: FunctionCallItemType$outboundSchema,
|
|
22
39
|
}).transform((v) => {
|
|
23
40
|
return remap$(v, {
|
|
24
41
|
callId: "call_id",
|
|
42
|
+
subagentId: "subagent_id",
|
|
43
|
+
subagentItems: "subagent_items",
|
|
25
44
|
});
|
|
26
45
|
});
|
|
27
46
|
export function functionCallItemToJSON(functionCallItem) {
|
|
@@ -3,6 +3,12 @@ import { ClosedEnum } from "../types/enums.js";
|
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
5
|
import { ToolCallStatus } from "./toolcallstatus.js";
|
|
6
|
+
export type OpenAIResponseFunctionToolCallSubagentItem = {
|
|
7
|
+
type: string;
|
|
8
|
+
additionalProperties?: {
|
|
9
|
+
[k: string]: any;
|
|
10
|
+
} | undefined;
|
|
11
|
+
};
|
|
6
12
|
export declare const OpenAIResponseFunctionToolCallType: {
|
|
7
13
|
readonly FunctionCall: "function_call";
|
|
8
14
|
};
|
|
@@ -17,9 +23,20 @@ export type OpenAIResponseFunctionToolCall = {
|
|
|
17
23
|
*/
|
|
18
24
|
namespace?: string | undefined;
|
|
19
25
|
status?: ToolCallStatus | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls.
|
|
28
|
+
*/
|
|
29
|
+
subagentId?: string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool.
|
|
32
|
+
*/
|
|
33
|
+
subagentItems?: Array<OpenAIResponseFunctionToolCallSubagentItem> | undefined;
|
|
20
34
|
type: OpenAIResponseFunctionToolCallType;
|
|
21
35
|
};
|
|
22
36
|
/** @internal */
|
|
37
|
+
export declare const OpenAIResponseFunctionToolCallSubagentItem$inboundSchema: z.ZodType<OpenAIResponseFunctionToolCallSubagentItem, unknown>;
|
|
38
|
+
export declare function openAIResponseFunctionToolCallSubagentItemFromJSON(jsonString: string): SafeParseResult<OpenAIResponseFunctionToolCallSubagentItem, SDKValidationError>;
|
|
39
|
+
/** @internal */
|
|
23
40
|
export declare const OpenAIResponseFunctionToolCallType$inboundSchema: z.ZodEnum<typeof OpenAIResponseFunctionToolCallType>;
|
|
24
41
|
/** @internal */
|
|
25
42
|
export declare const OpenAIResponseFunctionToolCall$inboundSchema: z.ZodType<OpenAIResponseFunctionToolCall, unknown>;
|
|
@@ -4,12 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { collectExtraKeys as collectExtraKeys$, safeParse, } from "../lib/schemas.js";
|
|
8
8
|
import { ToolCallStatus$inboundSchema, } from "./toolcallstatus.js";
|
|
9
9
|
export const OpenAIResponseFunctionToolCallType = {
|
|
10
10
|
FunctionCall: "function_call",
|
|
11
11
|
};
|
|
12
12
|
/** @internal */
|
|
13
|
+
export const OpenAIResponseFunctionToolCallSubagentItem$inboundSchema = collectExtraKeys$(z.object({
|
|
14
|
+
type: z.string(),
|
|
15
|
+
}).catchall(z.any()), "additionalProperties", true);
|
|
16
|
+
export function openAIResponseFunctionToolCallSubagentItemFromJSON(jsonString) {
|
|
17
|
+
return safeParse(jsonString, (x) => OpenAIResponseFunctionToolCallSubagentItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIResponseFunctionToolCallSubagentItem' from JSON`);
|
|
18
|
+
}
|
|
19
|
+
/** @internal */
|
|
13
20
|
export const OpenAIResponseFunctionToolCallType$inboundSchema = z.enum(OpenAIResponseFunctionToolCallType);
|
|
14
21
|
/** @internal */
|
|
15
22
|
export const OpenAIResponseFunctionToolCall$inboundSchema = z.object({
|
|
@@ -19,10 +26,14 @@ export const OpenAIResponseFunctionToolCall$inboundSchema = z.object({
|
|
|
19
26
|
name: z.string(),
|
|
20
27
|
namespace: z.string().optional(),
|
|
21
28
|
status: ToolCallStatus$inboundSchema.optional(),
|
|
29
|
+
subagent_id: z.string().optional(),
|
|
30
|
+
subagent_items: z.array(z.lazy(() => OpenAIResponseFunctionToolCallSubagentItem$inboundSchema)).optional(),
|
|
22
31
|
type: OpenAIResponseFunctionToolCallType$inboundSchema,
|
|
23
32
|
}).transform((v) => {
|
|
24
33
|
return remap$(v, {
|
|
25
34
|
"call_id": "callId",
|
|
35
|
+
"subagent_id": "subagentId",
|
|
36
|
+
"subagent_items": "subagentItems",
|
|
26
37
|
});
|
|
27
38
|
});
|
|
28
39
|
export function openAIResponseFunctionToolCallFromJSON(jsonString) {
|
|
@@ -19,6 +19,12 @@ export declare const OutputFunctionCallItemType: {
|
|
|
19
19
|
readonly FunctionCall: "function_call";
|
|
20
20
|
};
|
|
21
21
|
export type OutputFunctionCallItemType = ClosedEnum<typeof OutputFunctionCallItemType>;
|
|
22
|
+
export type OutputFunctionCallItemSubagentItem = {
|
|
23
|
+
type: string;
|
|
24
|
+
additionalProperties?: {
|
|
25
|
+
[k: string]: any;
|
|
26
|
+
} | undefined;
|
|
27
|
+
};
|
|
22
28
|
export type OutputFunctionCallItem = {
|
|
23
29
|
arguments: string;
|
|
24
30
|
callId: string;
|
|
@@ -30,6 +36,14 @@ export type OutputFunctionCallItem = {
|
|
|
30
36
|
namespace?: string | undefined;
|
|
31
37
|
status?: OutputFunctionCallItemStatusCompleted | OutputFunctionCallItemStatusIncomplete | OutputFunctionCallItemStatusInProgress | undefined;
|
|
32
38
|
type: OutputFunctionCallItemType;
|
|
39
|
+
/**
|
|
40
|
+
* EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls.
|
|
41
|
+
*/
|
|
42
|
+
subagentId?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool.
|
|
45
|
+
*/
|
|
46
|
+
subagentItems?: Array<OutputFunctionCallItemSubagentItem> | undefined;
|
|
33
47
|
};
|
|
34
48
|
/** @internal */
|
|
35
49
|
export declare const OutputFunctionCallItemStatusInProgress$inboundSchema: z.ZodEnum<typeof OutputFunctionCallItemStatusInProgress>;
|
|
@@ -56,6 +70,17 @@ export declare const OutputFunctionCallItemType$inboundSchema: z.ZodEnum<typeof
|
|
|
56
70
|
/** @internal */
|
|
57
71
|
export declare const OutputFunctionCallItemType$outboundSchema: z.ZodEnum<typeof OutputFunctionCallItemType>;
|
|
58
72
|
/** @internal */
|
|
73
|
+
export declare const OutputFunctionCallItemSubagentItem$inboundSchema: z.ZodType<OutputFunctionCallItemSubagentItem, unknown>;
|
|
74
|
+
/** @internal */
|
|
75
|
+
export type OutputFunctionCallItemSubagentItem$Outbound = {
|
|
76
|
+
type: string;
|
|
77
|
+
[additionalProperties: string]: unknown;
|
|
78
|
+
};
|
|
79
|
+
/** @internal */
|
|
80
|
+
export declare const OutputFunctionCallItemSubagentItem$outboundSchema: z.ZodType<OutputFunctionCallItemSubagentItem$Outbound, OutputFunctionCallItemSubagentItem>;
|
|
81
|
+
export declare function outputFunctionCallItemSubagentItemToJSON(outputFunctionCallItemSubagentItem: OutputFunctionCallItemSubagentItem): string;
|
|
82
|
+
export declare function outputFunctionCallItemSubagentItemFromJSON(jsonString: string): SafeParseResult<OutputFunctionCallItemSubagentItem, SDKValidationError>;
|
|
83
|
+
/** @internal */
|
|
59
84
|
export declare const OutputFunctionCallItem$inboundSchema: z.ZodType<OutputFunctionCallItem, unknown>;
|
|
60
85
|
/** @internal */
|
|
61
86
|
export type OutputFunctionCallItem$Outbound = {
|
|
@@ -66,6 +91,8 @@ export type OutputFunctionCallItem$Outbound = {
|
|
|
66
91
|
namespace?: string | undefined;
|
|
67
92
|
status?: string | string | string | undefined;
|
|
68
93
|
type: string;
|
|
94
|
+
subagent_id?: string | undefined;
|
|
95
|
+
subagent_items?: Array<OutputFunctionCallItemSubagentItem$Outbound> | undefined;
|
|
69
96
|
};
|
|
70
97
|
/** @internal */
|
|
71
98
|
export declare const OutputFunctionCallItem$outboundSchema: z.ZodType<OutputFunctionCallItem$Outbound, OutputFunctionCallItem>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { collectExtraKeys as collectExtraKeys$, safeParse, } from "../lib/schemas.js";
|
|
8
8
|
export const OutputFunctionCallItemStatusInProgress = {
|
|
9
9
|
InProgress: "in_progress",
|
|
10
10
|
};
|
|
@@ -52,6 +52,28 @@ export const OutputFunctionCallItemType$inboundSchema = z.enum(OutputFunctionCal
|
|
|
52
52
|
/** @internal */
|
|
53
53
|
export const OutputFunctionCallItemType$outboundSchema = OutputFunctionCallItemType$inboundSchema;
|
|
54
54
|
/** @internal */
|
|
55
|
+
export const OutputFunctionCallItemSubagentItem$inboundSchema = collectExtraKeys$(z.object({
|
|
56
|
+
type: z.string(),
|
|
57
|
+
}).catchall(z.any()), "additionalProperties", true);
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const OutputFunctionCallItemSubagentItem$outboundSchema = z.object({
|
|
60
|
+
type: z.string(),
|
|
61
|
+
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
62
|
+
}).transform((v) => {
|
|
63
|
+
return {
|
|
64
|
+
...v.additionalProperties,
|
|
65
|
+
...remap$(v, {
|
|
66
|
+
additionalProperties: null,
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
export function outputFunctionCallItemSubagentItemToJSON(outputFunctionCallItemSubagentItem) {
|
|
71
|
+
return JSON.stringify(OutputFunctionCallItemSubagentItem$outboundSchema.parse(outputFunctionCallItemSubagentItem));
|
|
72
|
+
}
|
|
73
|
+
export function outputFunctionCallItemSubagentItemFromJSON(jsonString) {
|
|
74
|
+
return safeParse(jsonString, (x) => OutputFunctionCallItemSubagentItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputFunctionCallItemSubagentItem' from JSON`);
|
|
75
|
+
}
|
|
76
|
+
/** @internal */
|
|
55
77
|
export const OutputFunctionCallItem$inboundSchema = z.object({
|
|
56
78
|
arguments: z.string(),
|
|
57
79
|
call_id: z.string(),
|
|
@@ -64,9 +86,13 @@ export const OutputFunctionCallItem$inboundSchema = z.object({
|
|
|
64
86
|
OutputFunctionCallItemStatusInProgress$inboundSchema,
|
|
65
87
|
]).optional(),
|
|
66
88
|
type: OutputFunctionCallItemType$inboundSchema,
|
|
89
|
+
subagent_id: z.string().optional(),
|
|
90
|
+
subagent_items: z.array(z.lazy(() => OutputFunctionCallItemSubagentItem$inboundSchema)).optional(),
|
|
67
91
|
}).transform((v) => {
|
|
68
92
|
return remap$(v, {
|
|
69
93
|
"call_id": "callId",
|
|
94
|
+
"subagent_id": "subagentId",
|
|
95
|
+
"subagent_items": "subagentItems",
|
|
70
96
|
});
|
|
71
97
|
});
|
|
72
98
|
/** @internal */
|
|
@@ -82,9 +108,13 @@ export const OutputFunctionCallItem$outboundSchema = z.object({
|
|
|
82
108
|
OutputFunctionCallItemStatusInProgress$outboundSchema,
|
|
83
109
|
]).optional(),
|
|
84
110
|
type: OutputFunctionCallItemType$outboundSchema,
|
|
111
|
+
subagentId: z.string().optional(),
|
|
112
|
+
subagentItems: z.array(z.lazy(() => OutputFunctionCallItemSubagentItem$outboundSchema)).optional(),
|
|
85
113
|
}).transform((v) => {
|
|
86
114
|
return remap$(v, {
|
|
87
115
|
callId: "call_id",
|
|
116
|
+
subagentId: "subagent_id",
|
|
117
|
+
subagentItems: "subagent_items",
|
|
88
118
|
});
|
|
89
119
|
});
|
|
90
120
|
export function outputFunctionCallItemToJSON(outputFunctionCallItem) {
|
|
@@ -44,7 +44,7 @@ export type OutputFusionServerToolItem = {
|
|
|
44
44
|
*/
|
|
45
45
|
failedModels?: Array<FailedModel> | undefined;
|
|
46
46
|
/**
|
|
47
|
-
* Typed failure reason when the fusion run failed. Possible values include: all_panels_failed, insufficient_credits, rate_limited, invalid_model, judge_not_valid_json, judge_schema_mismatch, judge_upstream_error, judge_empty_completion. The four analysis-stage codes keep their pre-rename `judge_` spelling so existing consumers keep matching.
|
|
47
|
+
* Typed failure reason when the fusion run failed. Possible values include: all_panels_failed, insufficient_credits, rate_limited, invalid_model, judge_not_valid_json, judge_schema_mismatch, judge_upstream_error, judge_empty_completion. The four analysis-stage codes keep their pre-rename `judge_` spelling so existing consumers keep matching. The consumer-cancellation code is `cancelled`.
|
|
48
48
|
*/
|
|
49
49
|
failureReason?: string | undefined;
|
|
50
50
|
id?: string | undefined;
|
|
@@ -11,6 +11,10 @@ export type OutputSubagentServerToolItemType = ClosedEnum<typeof OutputSubagentS
|
|
|
11
11
|
* An openrouter:subagent server tool output item
|
|
12
12
|
*/
|
|
13
13
|
export type OutputSubagentServerToolItem = {
|
|
14
|
+
/**
|
|
15
|
+
* EXPERIMENTAL — subject to change without notice. The `call_id` of the tool call that spawned this subagent. This id will also be included as the `subagent_id` on any `function_call` items created by the subagent. This must be returned in the request so the `function_call` can be matched with the correct subagent. A suspended `in_progress` item is announced once and never re-emitted or terminally closed — completion arrives as a new item with the same `call_id`.
|
|
16
|
+
*/
|
|
17
|
+
callId?: string | undefined;
|
|
14
18
|
/**
|
|
15
19
|
* Error message when the subagent task did not produce an outcome.
|
|
16
20
|
*/
|
|
@@ -51,6 +55,7 @@ export declare const OutputSubagentServerToolItemType$outboundSchema: z.ZodEnum<
|
|
|
51
55
|
export declare const OutputSubagentServerToolItem$inboundSchema: z.ZodType<OutputSubagentServerToolItem, unknown>;
|
|
52
56
|
/** @internal */
|
|
53
57
|
export type OutputSubagentServerToolItem$Outbound = {
|
|
58
|
+
call_id?: string | undefined;
|
|
54
59
|
error?: string | undefined;
|
|
55
60
|
id?: string | undefined;
|
|
56
61
|
instance_name?: string | undefined;
|
|
@@ -15,6 +15,7 @@ export const OutputSubagentServerToolItemType$inboundSchema = z.enum(OutputSubag
|
|
|
15
15
|
export const OutputSubagentServerToolItemType$outboundSchema = OutputSubagentServerToolItemType$inboundSchema;
|
|
16
16
|
/** @internal */
|
|
17
17
|
export const OutputSubagentServerToolItem$inboundSchema = z.object({
|
|
18
|
+
call_id: z.string().optional(),
|
|
18
19
|
error: z.string().optional(),
|
|
19
20
|
id: z.string().optional(),
|
|
20
21
|
instance_name: z.string().optional(),
|
|
@@ -27,6 +28,7 @@ export const OutputSubagentServerToolItem$inboundSchema = z.object({
|
|
|
27
28
|
type: OutputSubagentServerToolItemType$inboundSchema,
|
|
28
29
|
}).transform((v) => {
|
|
29
30
|
return remap$(v, {
|
|
31
|
+
"call_id": "callId",
|
|
30
32
|
"instance_name": "instanceName",
|
|
31
33
|
"task_description": "taskDescription",
|
|
32
34
|
"task_name": "taskName",
|
|
@@ -34,6 +36,7 @@ export const OutputSubagentServerToolItem$inboundSchema = z.object({
|
|
|
34
36
|
});
|
|
35
37
|
/** @internal */
|
|
36
38
|
export const OutputSubagentServerToolItem$outboundSchema = z.object({
|
|
39
|
+
callId: z.string().optional(),
|
|
37
40
|
error: z.string().optional(),
|
|
38
41
|
id: z.string().optional(),
|
|
39
42
|
instanceName: z.string().optional(),
|
|
@@ -46,6 +49,7 @@ export const OutputSubagentServerToolItem$outboundSchema = z.object({
|
|
|
46
49
|
type: OutputSubagentServerToolItemType$outboundSchema,
|
|
47
50
|
}).transform((v) => {
|
|
48
51
|
return remap$(v, {
|
|
52
|
+
callId: "call_id",
|
|
49
53
|
instanceName: "instance_name",
|
|
50
54
|
taskDescription: "task_description",
|
|
51
55
|
taskName: "task_name",
|
|
@@ -25,7 +25,7 @@ export type SubagentReasoning = {
|
|
|
25
25
|
*/
|
|
26
26
|
effort?: SubagentReasoningEffort | undefined;
|
|
27
27
|
/**
|
|
28
|
-
* Maximum number of reasoning tokens the subagent may use.
|
|
28
|
+
* Maximum number of reasoning tokens the subagent may use. Forwarded to the subagent call as `reasoning.max_tokens`.
|
|
29
29
|
*/
|
|
30
30
|
maxTokens?: number | undefined;
|
|
31
31
|
};
|
|
@@ -5,6 +5,14 @@ import { SubagentReasoning, SubagentReasoning$Outbound } from "./subagentreasoni
|
|
|
5
5
|
* Configuration for one openrouter:subagent server tool entry.
|
|
6
6
|
*/
|
|
7
7
|
export type SubagentServerToolConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* EXPERIMENTAL — subject to change without notice. When true, the subagent inherits every client function defined in the request's top-level `tools` list. Supported on the Responses API (`/api/v1/responses`) only; other APIs reject it with a `400`.
|
|
10
|
+
*/
|
|
11
|
+
inheritFunctions?: boolean | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* EXPERIMENTAL — subject to change without notice. Names of the top-level function tools that the subagent will inherit. Any tool that matches by name will be copied fully into the tools array of the subagent. When `inherit_functions` is `true`, this list does nothing, because every client function will be inherited by default. Names are trimmed before validation, so a whitespace-only name is rejected with a `400`. Supported on the Responses API (`/api/v1/responses`) only; other APIs reject it with a `400`.
|
|
14
|
+
*/
|
|
15
|
+
inheritedFunctionNames?: Array<string> | undefined;
|
|
8
16
|
/**
|
|
9
17
|
* System instructions for the subagent. When omitted, the subagent responds with no system prompt of its own.
|
|
10
18
|
*/
|
|
@@ -14,7 +22,7 @@ export type SubagentServerToolConfig = {
|
|
|
14
22
|
*/
|
|
15
23
|
maxCompletionTokens?: number | undefined;
|
|
16
24
|
/**
|
|
17
|
-
* Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools.
|
|
25
|
+
* Maximum number of tool-calling steps the subagent may take during its agentic loop. Capped at 25. Only relevant when the subagent is given tools. Forwarded to the subagent call as `max_tool_calls`.
|
|
18
26
|
*/
|
|
19
27
|
maxToolCalls?: number | undefined;
|
|
20
28
|
/**
|
|
@@ -40,6 +48,8 @@ export type SubagentServerToolConfig = {
|
|
|
40
48
|
};
|
|
41
49
|
/** @internal */
|
|
42
50
|
export type SubagentServerToolConfig$Outbound = {
|
|
51
|
+
inherit_functions?: boolean | undefined;
|
|
52
|
+
inherited_function_names?: Array<string> | undefined;
|
|
43
53
|
instructions?: string | undefined;
|
|
44
54
|
max_completion_tokens?: number | undefined;
|
|
45
55
|
max_tool_calls?: number | undefined;
|
|
@@ -8,6 +8,8 @@ import { SubagentNestedTool$outboundSchema, } from "./subagentnestedtool.js";
|
|
|
8
8
|
import { SubagentReasoning$outboundSchema, } from "./subagentreasoning.js";
|
|
9
9
|
/** @internal */
|
|
10
10
|
export const SubagentServerToolConfig$outboundSchema = z.object({
|
|
11
|
+
inheritFunctions: z.boolean().optional(),
|
|
12
|
+
inheritedFunctionNames: z.array(z.string()).optional(),
|
|
11
13
|
instructions: z.string().optional(),
|
|
12
14
|
maxCompletionTokens: z.int().optional(),
|
|
13
15
|
maxToolCalls: z.int().optional(),
|
|
@@ -18,6 +20,8 @@ export const SubagentServerToolConfig$outboundSchema = z.object({
|
|
|
18
20
|
tools: z.array(SubagentNestedTool$outboundSchema).optional(),
|
|
19
21
|
}).transform((v) => {
|
|
20
22
|
return remap$(v, {
|
|
23
|
+
inheritFunctions: "inherit_functions",
|
|
24
|
+
inheritedFunctionNames: "inherited_function_names",
|
|
21
25
|
maxCompletionTokens: "max_completion_tokens",
|
|
22
26
|
maxToolCalls: "max_tool_calls",
|
|
23
27
|
});
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.38",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"test:watch": "vitest --watch --project unit",
|
|
77
|
-
"typecheck": "tsc --noEmit",
|
|
78
|
-
"typecheck:transit": "exit 0",
|
|
79
76
|
"compile": "tsc",
|
|
80
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
81
77
|
"prepare": "npm run build",
|
|
82
78
|
"test": "vitest --run --project unit",
|
|
83
79
|
"test:e2e": "vitest --run --project e2e",
|
|
84
|
-
"test:transit": "exit 0"
|
|
80
|
+
"test:transit": "exit 0",
|
|
81
|
+
"typecheck:transit": "exit 0",
|
|
82
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
83
|
+
"test:watch": "vitest --watch --project unit",
|
|
84
|
+
"typecheck": "tsc --noEmit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|