@openrouter/sdk 1.2.37 → 1.2.39
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/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/inputsunion.d.ts +5 -4
- package/esm/models/inputsunion.js +3 -0
- package/esm/models/openairesponsefunctiontoolcall.d.ts +17 -0
- package/esm/models/openairesponsefunctiontoolcall.js +12 -1
- package/esm/models/outputbashservertoolitem.d.ts +4 -4
- package/esm/models/outputbashservertoolitem.js +4 -4
- package/esm/models/outputfilesservertoolitem.d.ts +10 -0
- package/esm/models/outputfilesservertoolitem.js +6 -0
- package/esm/models/outputfunctioncallitem.d.ts +27 -0
- package/esm/models/outputfunctioncallitem.js +31 -1
- package/esm/models/outputitems.d.ts +3 -0
- package/esm/models/outputitems.js +2 -0
- package/esm/models/outputshellcallitem.d.ts +4 -0
- package/esm/models/outputshellcallitem.js +1 -0
- package/esm/models/outputshellcalloutputitem.d.ts +2 -27
- package/esm/models/outputshellcalloutputitem.js +2 -42
- package/esm/models/outputshellservertoolitem.d.ts +66 -0
- package/esm/models/outputshellservertoolitem.js +81 -0
- package/esm/models/outputsubagentservertoolitem.d.ts +5 -0
- package/esm/models/outputsubagentservertoolitem.js +4 -0
- package/esm/models/shellcallitem.d.ts +5 -0
- package/esm/models/shellcallitem.js +1 -0
- package/esm/models/shellcalloutputcontent.d.ts +74 -0
- package/esm/models/shellcalloutputcontent.js +109 -0
- package/esm/models/shellcalloutputitem.d.ts +3 -20
- package/esm/models/shellcalloutputitem.js +2 -19
- 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 +7 -7
|
@@ -5,54 +5,14 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ShellCallOutputContent$inboundSchema, } from "./shellcalloutputcontent.js";
|
|
9
9
|
import { ShellCallStatus$inboundSchema, } from "./shellcallstatus.js";
|
|
10
10
|
/** @internal */
|
|
11
|
-
export const OutcomeTimeout$inboundSchema = z.object({
|
|
12
|
-
type: z.literal("timeout"),
|
|
13
|
-
});
|
|
14
|
-
export function outcomeTimeoutFromJSON(jsonString) {
|
|
15
|
-
return safeParse(jsonString, (x) => OutcomeTimeout$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutcomeTimeout' from JSON`);
|
|
16
|
-
}
|
|
17
|
-
/** @internal */
|
|
18
|
-
export const OutcomeExit$inboundSchema = z
|
|
19
|
-
.object({
|
|
20
|
-
exit_code: z.int(),
|
|
21
|
-
type: z.literal("exit"),
|
|
22
|
-
}).transform((v) => {
|
|
23
|
-
return remap$(v, {
|
|
24
|
-
"exit_code": "exitCode",
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
export function outcomeExitFromJSON(jsonString) {
|
|
28
|
-
return safeParse(jsonString, (x) => OutcomeExit$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutcomeExit' from JSON`);
|
|
29
|
-
}
|
|
30
|
-
/** @internal */
|
|
31
|
-
export const Outcome$inboundSchema = discriminatedUnion("type", {
|
|
32
|
-
exit: z.lazy(() => OutcomeExit$inboundSchema),
|
|
33
|
-
timeout: z.lazy(() => OutcomeTimeout$inboundSchema),
|
|
34
|
-
});
|
|
35
|
-
export function outcomeFromJSON(jsonString) {
|
|
36
|
-
return safeParse(jsonString, (x) => Outcome$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Outcome' from JSON`);
|
|
37
|
-
}
|
|
38
|
-
/** @internal */
|
|
39
|
-
export const OutputShellCallOutputItemOutput$inboundSchema = z.object({
|
|
40
|
-
outcome: discriminatedUnion("type", {
|
|
41
|
-
exit: z.lazy(() => OutcomeExit$inboundSchema),
|
|
42
|
-
timeout: z.lazy(() => OutcomeTimeout$inboundSchema),
|
|
43
|
-
}),
|
|
44
|
-
stderr: z.string(),
|
|
45
|
-
stdout: z.string(),
|
|
46
|
-
});
|
|
47
|
-
export function outputShellCallOutputItemOutputFromJSON(jsonString) {
|
|
48
|
-
return safeParse(jsonString, (x) => OutputShellCallOutputItemOutput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputShellCallOutputItemOutput' from JSON`);
|
|
49
|
-
}
|
|
50
|
-
/** @internal */
|
|
51
11
|
export const OutputShellCallOutputItem$inboundSchema = z.object({
|
|
52
12
|
call_id: z.string(),
|
|
53
13
|
id: z.string(),
|
|
54
14
|
max_output_length: z.nullable(z.int()).optional(),
|
|
55
|
-
output: z.array(
|
|
15
|
+
output: z.array(ShellCallOutputContent$inboundSchema),
|
|
56
16
|
status: ShellCallStatus$inboundSchema,
|
|
57
17
|
type: z.literal("shell_call_output"),
|
|
58
18
|
}).transform((v) => {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
import { ShellCallOutputContent, ShellCallOutputContent$Outbound } from "./shellcalloutputcontent.js";
|
|
6
|
+
import { ToolCallStatus } from "./toolcallstatus.js";
|
|
7
|
+
export type OutputShellServerToolItemAction = {
|
|
8
|
+
commands: Array<string>;
|
|
9
|
+
maxOutputLength?: number | null | undefined;
|
|
10
|
+
timeoutMs?: number | null | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare const OutputShellServerToolItemType: {
|
|
13
|
+
readonly OpenrouterShell: "openrouter:shell";
|
|
14
|
+
};
|
|
15
|
+
export type OutputShellServerToolItemType = ClosedEnum<typeof OutputShellServerToolItemType>;
|
|
16
|
+
/**
|
|
17
|
+
* An openrouter:shell server tool output item
|
|
18
|
+
*/
|
|
19
|
+
export type OutputShellServerToolItem = {
|
|
20
|
+
action?: OutputShellServerToolItemAction | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The raw tool-call arguments string as emitted by the model.
|
|
23
|
+
*/
|
|
24
|
+
arguments?: string | null | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The model-generated tool call id from the originating turn.
|
|
27
|
+
*/
|
|
28
|
+
callId?: string | null | undefined;
|
|
29
|
+
id?: string | undefined;
|
|
30
|
+
output?: Array<ShellCallOutputContent> | undefined;
|
|
31
|
+
status: ToolCallStatus;
|
|
32
|
+
type: OutputShellServerToolItemType;
|
|
33
|
+
};
|
|
34
|
+
/** @internal */
|
|
35
|
+
export declare const OutputShellServerToolItemAction$inboundSchema: z.ZodType<OutputShellServerToolItemAction, unknown>;
|
|
36
|
+
/** @internal */
|
|
37
|
+
export type OutputShellServerToolItemAction$Outbound = {
|
|
38
|
+
commands: Array<string>;
|
|
39
|
+
max_output_length?: number | null | undefined;
|
|
40
|
+
timeout_ms?: number | null | undefined;
|
|
41
|
+
};
|
|
42
|
+
/** @internal */
|
|
43
|
+
export declare const OutputShellServerToolItemAction$outboundSchema: z.ZodType<OutputShellServerToolItemAction$Outbound, OutputShellServerToolItemAction>;
|
|
44
|
+
export declare function outputShellServerToolItemActionToJSON(outputShellServerToolItemAction: OutputShellServerToolItemAction): string;
|
|
45
|
+
export declare function outputShellServerToolItemActionFromJSON(jsonString: string): SafeParseResult<OutputShellServerToolItemAction, SDKValidationError>;
|
|
46
|
+
/** @internal */
|
|
47
|
+
export declare const OutputShellServerToolItemType$inboundSchema: z.ZodEnum<typeof OutputShellServerToolItemType>;
|
|
48
|
+
/** @internal */
|
|
49
|
+
export declare const OutputShellServerToolItemType$outboundSchema: z.ZodEnum<typeof OutputShellServerToolItemType>;
|
|
50
|
+
/** @internal */
|
|
51
|
+
export declare const OutputShellServerToolItem$inboundSchema: z.ZodType<OutputShellServerToolItem, unknown>;
|
|
52
|
+
/** @internal */
|
|
53
|
+
export type OutputShellServerToolItem$Outbound = {
|
|
54
|
+
action?: OutputShellServerToolItemAction$Outbound | undefined;
|
|
55
|
+
arguments?: string | null | undefined;
|
|
56
|
+
call_id?: string | null | undefined;
|
|
57
|
+
id?: string | undefined;
|
|
58
|
+
output?: Array<ShellCallOutputContent$Outbound> | undefined;
|
|
59
|
+
status: string;
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
/** @internal */
|
|
63
|
+
export declare const OutputShellServerToolItem$outboundSchema: z.ZodType<OutputShellServerToolItem$Outbound, OutputShellServerToolItem>;
|
|
64
|
+
export declare function outputShellServerToolItemToJSON(outputShellServerToolItem: OutputShellServerToolItem): string;
|
|
65
|
+
export declare function outputShellServerToolItemFromJSON(jsonString: string): SafeParseResult<OutputShellServerToolItem, SDKValidationError>;
|
|
66
|
+
//# sourceMappingURL=outputshellservertoolitem.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 369a1cd63f40
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { ShellCallOutputContent$inboundSchema, ShellCallOutputContent$outboundSchema, } from "./shellcalloutputcontent.js";
|
|
9
|
+
import { ToolCallStatus$inboundSchema, ToolCallStatus$outboundSchema, } from "./toolcallstatus.js";
|
|
10
|
+
export const OutputShellServerToolItemType = {
|
|
11
|
+
OpenrouterShell: "openrouter:shell",
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const OutputShellServerToolItemAction$inboundSchema = z.object({
|
|
15
|
+
commands: z.array(z.string()),
|
|
16
|
+
max_output_length: z.nullable(z.int()).optional(),
|
|
17
|
+
timeout_ms: z.nullable(z.int()).optional(),
|
|
18
|
+
}).transform((v) => {
|
|
19
|
+
return remap$(v, {
|
|
20
|
+
"max_output_length": "maxOutputLength",
|
|
21
|
+
"timeout_ms": "timeoutMs",
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const OutputShellServerToolItemAction$outboundSchema = z.object({
|
|
26
|
+
commands: z.array(z.string()),
|
|
27
|
+
maxOutputLength: z.nullable(z.int()).optional(),
|
|
28
|
+
timeoutMs: z.nullable(z.int()).optional(),
|
|
29
|
+
}).transform((v) => {
|
|
30
|
+
return remap$(v, {
|
|
31
|
+
maxOutputLength: "max_output_length",
|
|
32
|
+
timeoutMs: "timeout_ms",
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
export function outputShellServerToolItemActionToJSON(outputShellServerToolItemAction) {
|
|
36
|
+
return JSON.stringify(OutputShellServerToolItemAction$outboundSchema.parse(outputShellServerToolItemAction));
|
|
37
|
+
}
|
|
38
|
+
export function outputShellServerToolItemActionFromJSON(jsonString) {
|
|
39
|
+
return safeParse(jsonString, (x) => OutputShellServerToolItemAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputShellServerToolItemAction' from JSON`);
|
|
40
|
+
}
|
|
41
|
+
/** @internal */
|
|
42
|
+
export const OutputShellServerToolItemType$inboundSchema = z.enum(OutputShellServerToolItemType);
|
|
43
|
+
/** @internal */
|
|
44
|
+
export const OutputShellServerToolItemType$outboundSchema = OutputShellServerToolItemType$inboundSchema;
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const OutputShellServerToolItem$inboundSchema = z.object({
|
|
47
|
+
action: z.lazy(() => OutputShellServerToolItemAction$inboundSchema)
|
|
48
|
+
.optional(),
|
|
49
|
+
arguments: z.nullable(z.string()).optional(),
|
|
50
|
+
call_id: z.nullable(z.string()).optional(),
|
|
51
|
+
id: z.string().optional(),
|
|
52
|
+
output: z.array(ShellCallOutputContent$inboundSchema).optional(),
|
|
53
|
+
status: ToolCallStatus$inboundSchema,
|
|
54
|
+
type: OutputShellServerToolItemType$inboundSchema,
|
|
55
|
+
}).transform((v) => {
|
|
56
|
+
return remap$(v, {
|
|
57
|
+
"call_id": "callId",
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const OutputShellServerToolItem$outboundSchema = z.object({
|
|
62
|
+
action: z.lazy(() => OutputShellServerToolItemAction$outboundSchema)
|
|
63
|
+
.optional(),
|
|
64
|
+
arguments: z.nullable(z.string()).optional(),
|
|
65
|
+
callId: z.nullable(z.string()).optional(),
|
|
66
|
+
id: z.string().optional(),
|
|
67
|
+
output: z.array(ShellCallOutputContent$outboundSchema).optional(),
|
|
68
|
+
status: ToolCallStatus$outboundSchema,
|
|
69
|
+
type: OutputShellServerToolItemType$outboundSchema,
|
|
70
|
+
}).transform((v) => {
|
|
71
|
+
return remap$(v, {
|
|
72
|
+
callId: "call_id",
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
export function outputShellServerToolItemToJSON(outputShellServerToolItem) {
|
|
76
|
+
return JSON.stringify(OutputShellServerToolItem$outboundSchema.parse(outputShellServerToolItem));
|
|
77
|
+
}
|
|
78
|
+
export function outputShellServerToolItemFromJSON(jsonString) {
|
|
79
|
+
return safeParse(jsonString, (x) => OutputShellServerToolItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputShellServerToolItem' from JSON`);
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=outputshellservertoolitem.js.map
|
|
@@ -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",
|
|
@@ -15,6 +15,10 @@ export type ShellCallItemType = ClosedEnum<typeof ShellCallItemType>;
|
|
|
15
15
|
*/
|
|
16
16
|
export type ShellCallItem = {
|
|
17
17
|
action: ShellCallItemAction;
|
|
18
|
+
/**
|
|
19
|
+
* The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes.
|
|
20
|
+
*/
|
|
21
|
+
arguments?: string | null | undefined;
|
|
18
22
|
callId: string;
|
|
19
23
|
environment?: any | undefined;
|
|
20
24
|
id?: string | null | undefined;
|
|
@@ -35,6 +39,7 @@ export declare const ShellCallItemType$outboundSchema: z.ZodEnum<typeof ShellCal
|
|
|
35
39
|
/** @internal */
|
|
36
40
|
export type ShellCallItem$Outbound = {
|
|
37
41
|
action: ShellCallItemAction$Outbound;
|
|
42
|
+
arguments?: string | null | undefined;
|
|
38
43
|
call_id: string;
|
|
39
44
|
environment?: any | undefined;
|
|
40
45
|
id?: string | null | undefined;
|
|
@@ -27,6 +27,7 @@ export const ShellCallItemType$outboundSchema = z.enum(ShellCallItemType);
|
|
|
27
27
|
/** @internal */
|
|
28
28
|
export const ShellCallItem$outboundSchema = z.object({
|
|
29
29
|
action: z.lazy(() => ShellCallItemAction$outboundSchema),
|
|
30
|
+
arguments: z.nullable(z.string()).optional(),
|
|
30
31
|
callId: z.string(),
|
|
31
32
|
environment: z.any().optional(),
|
|
32
33
|
id: z.nullable(z.string()).optional(),
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export type OutcomeTimeout = {
|
|
6
|
+
type: "timeout";
|
|
7
|
+
additionalProperties?: {
|
|
8
|
+
[k: string]: any;
|
|
9
|
+
} | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type OutcomeExit = {
|
|
12
|
+
exitCode: number;
|
|
13
|
+
type: "exit";
|
|
14
|
+
additionalProperties?: {
|
|
15
|
+
[k: string]: any;
|
|
16
|
+
} | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type Outcome = OutcomeExit | OutcomeTimeout | discriminatedUnionTypes.Unknown<"type">;
|
|
19
|
+
/**
|
|
20
|
+
* Captured stdout and stderr for one command of a shell call, with its exit or timeout outcome.
|
|
21
|
+
*/
|
|
22
|
+
export type ShellCallOutputContent = {
|
|
23
|
+
outcome: OutcomeExit | OutcomeTimeout | discriminatedUnionTypes.Unknown<"type">;
|
|
24
|
+
stderr: string;
|
|
25
|
+
stdout: string;
|
|
26
|
+
additionalProperties?: {
|
|
27
|
+
[k: string]: any;
|
|
28
|
+
} | undefined;
|
|
29
|
+
};
|
|
30
|
+
/** @internal */
|
|
31
|
+
export declare const OutcomeTimeout$inboundSchema: z.ZodType<OutcomeTimeout, unknown>;
|
|
32
|
+
/** @internal */
|
|
33
|
+
export type OutcomeTimeout$Outbound = {
|
|
34
|
+
type: "timeout";
|
|
35
|
+
[additionalProperties: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
/** @internal */
|
|
38
|
+
export declare const OutcomeTimeout$outboundSchema: z.ZodType<OutcomeTimeout$Outbound, OutcomeTimeout>;
|
|
39
|
+
export declare function outcomeTimeoutToJSON(outcomeTimeout: OutcomeTimeout): string;
|
|
40
|
+
export declare function outcomeTimeoutFromJSON(jsonString: string): SafeParseResult<OutcomeTimeout, SDKValidationError>;
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const OutcomeExit$inboundSchema: z.ZodType<OutcomeExit, unknown>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
export type OutcomeExit$Outbound = {
|
|
45
|
+
exit_code: number;
|
|
46
|
+
type: "exit";
|
|
47
|
+
[additionalProperties: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
/** @internal */
|
|
50
|
+
export declare const OutcomeExit$outboundSchema: z.ZodType<OutcomeExit$Outbound, OutcomeExit>;
|
|
51
|
+
export declare function outcomeExitToJSON(outcomeExit: OutcomeExit): string;
|
|
52
|
+
export declare function outcomeExitFromJSON(jsonString: string): SafeParseResult<OutcomeExit, SDKValidationError>;
|
|
53
|
+
/** @internal */
|
|
54
|
+
export declare const Outcome$inboundSchema: z.ZodType<Outcome, unknown>;
|
|
55
|
+
/** @internal */
|
|
56
|
+
export type Outcome$Outbound = OutcomeExit$Outbound | OutcomeTimeout$Outbound;
|
|
57
|
+
/** @internal */
|
|
58
|
+
export declare const Outcome$outboundSchema: z.ZodType<Outcome$Outbound, Outcome>;
|
|
59
|
+
export declare function outcomeToJSON(outcome: Outcome): string;
|
|
60
|
+
export declare function outcomeFromJSON(jsonString: string): SafeParseResult<Outcome, SDKValidationError>;
|
|
61
|
+
/** @internal */
|
|
62
|
+
export declare const ShellCallOutputContent$inboundSchema: z.ZodType<ShellCallOutputContent, unknown>;
|
|
63
|
+
/** @internal */
|
|
64
|
+
export type ShellCallOutputContent$Outbound = {
|
|
65
|
+
outcome: OutcomeExit$Outbound | OutcomeTimeout$Outbound;
|
|
66
|
+
stderr: string;
|
|
67
|
+
stdout: string;
|
|
68
|
+
[additionalProperties: string]: unknown;
|
|
69
|
+
};
|
|
70
|
+
/** @internal */
|
|
71
|
+
export declare const ShellCallOutputContent$outboundSchema: z.ZodType<ShellCallOutputContent$Outbound, ShellCallOutputContent>;
|
|
72
|
+
export declare function shellCallOutputContentToJSON(shellCallOutputContent: ShellCallOutputContent): string;
|
|
73
|
+
export declare function shellCallOutputContentFromJSON(jsonString: string): SafeParseResult<ShellCallOutputContent, SDKValidationError>;
|
|
74
|
+
//# sourceMappingURL=shellcalloutputcontent.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: ec44d931b43f
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { collectExtraKeys as collectExtraKeys$, safeParse, } from "../lib/schemas.js";
|
|
8
|
+
import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const OutcomeTimeout$inboundSchema = collectExtraKeys$(z.object({
|
|
11
|
+
type: z.literal("timeout"),
|
|
12
|
+
}).catchall(z.any()), "additionalProperties", true);
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const OutcomeTimeout$outboundSchema = z.object({
|
|
15
|
+
type: z.literal("timeout"),
|
|
16
|
+
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
17
|
+
}).transform((v) => {
|
|
18
|
+
return {
|
|
19
|
+
...v.additionalProperties,
|
|
20
|
+
...remap$(v, {
|
|
21
|
+
additionalProperties: null,
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
export function outcomeTimeoutToJSON(outcomeTimeout) {
|
|
26
|
+
return JSON.stringify(OutcomeTimeout$outboundSchema.parse(outcomeTimeout));
|
|
27
|
+
}
|
|
28
|
+
export function outcomeTimeoutFromJSON(jsonString) {
|
|
29
|
+
return safeParse(jsonString, (x) => OutcomeTimeout$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutcomeTimeout' from JSON`);
|
|
30
|
+
}
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const OutcomeExit$inboundSchema = collectExtraKeys$(z.object({
|
|
33
|
+
exit_code: z.int(),
|
|
34
|
+
type: z.literal("exit"),
|
|
35
|
+
}).catchall(z.any()), "additionalProperties", true).transform((v) => {
|
|
36
|
+
return remap$(v, {
|
|
37
|
+
"exit_code": "exitCode",
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const OutcomeExit$outboundSchema = z.object({
|
|
42
|
+
exitCode: z.int(),
|
|
43
|
+
type: z.literal("exit"),
|
|
44
|
+
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
45
|
+
}).transform((v) => {
|
|
46
|
+
return {
|
|
47
|
+
...v.additionalProperties,
|
|
48
|
+
...remap$(v, {
|
|
49
|
+
exitCode: "exit_code",
|
|
50
|
+
additionalProperties: null,
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
export function outcomeExitToJSON(outcomeExit) {
|
|
55
|
+
return JSON.stringify(OutcomeExit$outboundSchema.parse(outcomeExit));
|
|
56
|
+
}
|
|
57
|
+
export function outcomeExitFromJSON(jsonString) {
|
|
58
|
+
return safeParse(jsonString, (x) => OutcomeExit$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutcomeExit' from JSON`);
|
|
59
|
+
}
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const Outcome$inboundSchema = discriminatedUnion("type", {
|
|
62
|
+
exit: z.lazy(() => OutcomeExit$inboundSchema),
|
|
63
|
+
timeout: z.lazy(() => OutcomeTimeout$inboundSchema),
|
|
64
|
+
});
|
|
65
|
+
/** @internal */
|
|
66
|
+
export const Outcome$outboundSchema = z
|
|
67
|
+
.union([
|
|
68
|
+
z.lazy(() => OutcomeExit$outboundSchema),
|
|
69
|
+
z.lazy(() => OutcomeTimeout$outboundSchema),
|
|
70
|
+
]);
|
|
71
|
+
export function outcomeToJSON(outcome) {
|
|
72
|
+
return JSON.stringify(Outcome$outboundSchema.parse(outcome));
|
|
73
|
+
}
|
|
74
|
+
export function outcomeFromJSON(jsonString) {
|
|
75
|
+
return safeParse(jsonString, (x) => Outcome$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Outcome' from JSON`);
|
|
76
|
+
}
|
|
77
|
+
/** @internal */
|
|
78
|
+
export const ShellCallOutputContent$inboundSchema = collectExtraKeys$(z.object({
|
|
79
|
+
outcome: discriminatedUnion("type", {
|
|
80
|
+
exit: z.lazy(() => OutcomeExit$inboundSchema),
|
|
81
|
+
timeout: z.lazy(() => OutcomeTimeout$inboundSchema),
|
|
82
|
+
}),
|
|
83
|
+
stderr: z.string(),
|
|
84
|
+
stdout: z.string(),
|
|
85
|
+
}).catchall(z.any()), "additionalProperties", true);
|
|
86
|
+
/** @internal */
|
|
87
|
+
export const ShellCallOutputContent$outboundSchema = z.object({
|
|
88
|
+
outcome: z.union([
|
|
89
|
+
z.lazy(() => OutcomeExit$outboundSchema),
|
|
90
|
+
z.lazy(() => OutcomeTimeout$outboundSchema),
|
|
91
|
+
]),
|
|
92
|
+
stderr: z.string(),
|
|
93
|
+
stdout: z.string(),
|
|
94
|
+
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
95
|
+
}).transform((v) => {
|
|
96
|
+
return {
|
|
97
|
+
...v.additionalProperties,
|
|
98
|
+
...remap$(v, {
|
|
99
|
+
additionalProperties: null,
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
export function shellCallOutputContentToJSON(shellCallOutputContent) {
|
|
104
|
+
return JSON.stringify(ShellCallOutputContent$outboundSchema.parse(shellCallOutputContent));
|
|
105
|
+
}
|
|
106
|
+
export function shellCallOutputContentFromJSON(jsonString) {
|
|
107
|
+
return safeParse(jsonString, (x) => ShellCallOutputContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ShellCallOutputContent' from JSON`);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=shellcalloutputcontent.js.map
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { ShellCallOutputContent, ShellCallOutputContent$Outbound } from "./shellcalloutputcontent.js";
|
|
3
4
|
import { ToolCallStatus } from "./toolcallstatus.js";
|
|
4
|
-
export type ShellCallOutputItemOutput = {
|
|
5
|
-
content?: string | null | undefined;
|
|
6
|
-
exitCode?: number | null | undefined;
|
|
7
|
-
type: string;
|
|
8
|
-
additionalProperties?: {
|
|
9
|
-
[k: string]: any;
|
|
10
|
-
} | undefined;
|
|
11
|
-
};
|
|
12
5
|
export declare const ShellCallOutputItemType: {
|
|
13
6
|
readonly ShellCallOutput: "shell_call_output";
|
|
14
7
|
};
|
|
@@ -20,28 +13,18 @@ export type ShellCallOutputItem = {
|
|
|
20
13
|
callId: string;
|
|
21
14
|
id?: string | null | undefined;
|
|
22
15
|
maxOutputLength?: number | null | undefined;
|
|
23
|
-
output: Array<
|
|
16
|
+
output: Array<ShellCallOutputContent>;
|
|
24
17
|
status?: ToolCallStatus | null | undefined;
|
|
25
18
|
type: ShellCallOutputItemType;
|
|
26
19
|
};
|
|
27
20
|
/** @internal */
|
|
28
|
-
export type ShellCallOutputItemOutput$Outbound = {
|
|
29
|
-
content?: string | null | undefined;
|
|
30
|
-
exit_code?: number | null | undefined;
|
|
31
|
-
type: string;
|
|
32
|
-
[additionalProperties: string]: unknown;
|
|
33
|
-
};
|
|
34
|
-
/** @internal */
|
|
35
|
-
export declare const ShellCallOutputItemOutput$outboundSchema: z.ZodType<ShellCallOutputItemOutput$Outbound, ShellCallOutputItemOutput>;
|
|
36
|
-
export declare function shellCallOutputItemOutputToJSON(shellCallOutputItemOutput: ShellCallOutputItemOutput): string;
|
|
37
|
-
/** @internal */
|
|
38
21
|
export declare const ShellCallOutputItemType$outboundSchema: z.ZodEnum<typeof ShellCallOutputItemType>;
|
|
39
22
|
/** @internal */
|
|
40
23
|
export type ShellCallOutputItem$Outbound = {
|
|
41
24
|
call_id: string;
|
|
42
25
|
id?: string | null | undefined;
|
|
43
26
|
max_output_length?: number | null | undefined;
|
|
44
|
-
output: Array<
|
|
27
|
+
output: Array<ShellCallOutputContent$Outbound>;
|
|
45
28
|
status?: string | null | undefined;
|
|
46
29
|
type: string;
|
|
47
30
|
};
|
|
@@ -4,36 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { ShellCallOutputContent$outboundSchema, } from "./shellcalloutputcontent.js";
|
|
7
8
|
import { ToolCallStatus$outboundSchema, } from "./toolcallstatus.js";
|
|
8
9
|
export const ShellCallOutputItemType = {
|
|
9
10
|
ShellCallOutput: "shell_call_output",
|
|
10
11
|
};
|
|
11
12
|
/** @internal */
|
|
12
|
-
export const ShellCallOutputItemOutput$outboundSchema = z.object({
|
|
13
|
-
content: z.nullable(z.string()).optional(),
|
|
14
|
-
exitCode: z.nullable(z.int()).optional(),
|
|
15
|
-
type: z.string(),
|
|
16
|
-
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
17
|
-
}).transform((v) => {
|
|
18
|
-
return {
|
|
19
|
-
...v.additionalProperties,
|
|
20
|
-
...remap$(v, {
|
|
21
|
-
exitCode: "exit_code",
|
|
22
|
-
additionalProperties: null,
|
|
23
|
-
}),
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
export function shellCallOutputItemOutputToJSON(shellCallOutputItemOutput) {
|
|
27
|
-
return JSON.stringify(ShellCallOutputItemOutput$outboundSchema.parse(shellCallOutputItemOutput));
|
|
28
|
-
}
|
|
29
|
-
/** @internal */
|
|
30
13
|
export const ShellCallOutputItemType$outboundSchema = z.enum(ShellCallOutputItemType);
|
|
31
14
|
/** @internal */
|
|
32
15
|
export const ShellCallOutputItem$outboundSchema = z.object({
|
|
33
16
|
callId: z.string(),
|
|
34
17
|
id: z.nullable(z.string()).optional(),
|
|
35
18
|
maxOutputLength: z.nullable(z.int()).optional(),
|
|
36
|
-
output: z.array(
|
|
19
|
+
output: z.array(ShellCallOutputContent$outboundSchema),
|
|
37
20
|
status: z.nullable(ToolCallStatus$outboundSchema).optional(),
|
|
38
21
|
type: ShellCallOutputItemType$outboundSchema,
|
|
39
22
|
}).transform((v) => {
|
|
@@ -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.39",
|
|
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
|
-
"
|
|
77
|
-
"test": "
|
|
76
|
+
"test:e2e": "vitest --run --project e2e",
|
|
77
|
+
"test:transit": "exit 0",
|
|
78
78
|
"test:watch": "vitest --watch --project unit",
|
|
79
79
|
"typecheck": "tsc --noEmit",
|
|
80
|
-
"typecheck:transit": "exit 0",
|
|
81
80
|
"compile": "tsc",
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
81
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
82
|
+
"typecheck:transit": "exit 0",
|
|
83
|
+
"prepare": "npm run build",
|
|
84
|
+
"test": "vitest --run --project unit"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|