@openrouter/sdk 1.2.136 → 1.2.138
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/funcs/internsChat.d.ts +34 -0
- package/esm/funcs/internsChat.js +133 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/agentmessageitem.d.ts +3 -1
- package/esm/models/agentmessageitem.js +2 -0
- package/esm/models/customtoolcalloutputitem.d.ts +3 -1
- package/esm/models/customtoolcalloutputitem.js +2 -0
- package/esm/models/easyinputmessage.d.ts +3 -1
- package/esm/models/easyinputmessage.js +2 -0
- package/esm/models/errors/index.d.ts +1 -0
- package/esm/models/errors/index.js +1 -0
- package/esm/models/errors/internchaterrorresponse.d.ts +31 -0
- package/esm/models/errors/internchaterrorresponse.js +35 -0
- package/esm/models/functioncalloutputitem.d.ts +3 -1
- package/esm/models/functioncalloutputitem.js +2 -0
- package/esm/models/incompletedetails.d.ts +4 -4
- package/esm/models/incompletedetails.js +3 -4
- package/esm/models/index.d.ts +23 -0
- package/esm/models/index.js +23 -0
- package/esm/models/inputimage.d.ts +3 -1
- package/esm/models/inputimage.js +4 -0
- package/esm/models/inputmessageitem.d.ts +3 -1
- package/esm/models/inputmessageitem.js +2 -0
- package/esm/models/internapprovalmode.d.ts +16 -0
- package/esm/models/internapprovalmode.js +15 -0
- package/esm/models/internchatassistantmessage.d.ts +24 -0
- package/esm/models/internchatassistantmessage.js +22 -0
- package/esm/models/internchatchoice.d.ts +37 -0
- package/esm/models/internchatchoice.js +33 -0
- package/esm/models/internchatcompletionchunk.d.ts +48 -0
- package/esm/models/internchatcompletionchunk.js +34 -0
- package/esm/models/internchatcompletionrequest.d.ts +40 -0
- package/esm/models/internchatcompletionrequest.js +25 -0
- package/esm/models/internchatdelta.d.ts +24 -0
- package/esm/models/internchatdelta.js +28 -0
- package/esm/models/internchatdevelopermessage.d.ts +21 -0
- package/esm/models/internchatdevelopermessage.js +15 -0
- package/esm/models/internchatechoedtoolcall.d.ts +21 -0
- package/esm/models/internchatechoedtoolcall.js +15 -0
- package/esm/models/internchatechoedtoolcallfunction.d.ts +17 -0
- package/esm/models/internchatechoedtoolcallfunction.js +14 -0
- package/esm/models/internchaterror.d.ts +22 -0
- package/esm/models/internchaterror.js +17 -0
- package/esm/models/internchaterrormetadata.d.ts +44 -0
- package/esm/models/internchaterrormetadata.js +38 -0
- package/esm/models/internchatmessage.d.ts +16 -0
- package/esm/models/internchatmessage.js +22 -0
- package/esm/models/internchatmessagecontent.d.ts +12 -0
- package/esm/models/internchatmessagecontent.js +12 -0
- package/esm/models/internchatprompttokensdetails.d.ts +13 -0
- package/esm/models/internchatprompttokensdetails.js +19 -0
- package/esm/models/internchatstreamerror.d.ts +22 -0
- package/esm/models/internchatstreamerror.js +17 -0
- package/esm/models/internchatstreamingresponse.d.ts +17 -0
- package/esm/models/internchatstreamingresponse.js +29 -0
- package/esm/models/internchatsystemmessage.d.ts +21 -0
- package/esm/models/internchatsystemmessage.js +15 -0
- package/esm/models/internchattextpart.d.ts +24 -0
- package/esm/models/internchattextpart.js +19 -0
- package/esm/models/internchattoolcall.d.ts +30 -0
- package/esm/models/internchattoolcall.js +23 -0
- package/esm/models/internchattoolcallfunction.d.ts +24 -0
- package/esm/models/internchattoolcallfunction.js +20 -0
- package/esm/models/internchattoolmessage.d.ts +23 -0
- package/esm/models/internchattoolmessage.js +21 -0
- package/esm/models/internchatusage.d.ts +24 -0
- package/esm/models/internchatusage.js +27 -0
- package/esm/models/internchatusermessage.d.ts +21 -0
- package/esm/models/internchatusermessage.js +15 -0
- package/esm/models/operations/createinternchatcompletion.d.ts +61 -0
- package/esm/models/operations/createinternchatcompletion.js +24 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/sdk/interns.d.ts +20 -0
- package/esm/sdk/interns.js +22 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { InternChatEchoedToolCall, InternChatEchoedToolCall$Outbound } from "./internchatechoedtoolcall.js";
|
|
3
|
+
import { InternChatMessageContent, InternChatMessageContent$Outbound } from "./internchatmessagecontent.js";
|
|
4
|
+
/**
|
|
5
|
+
* An assistant message from an earlier response. When answering an interaction, echo the streamed `tool_calls` here before the `tool` message.
|
|
6
|
+
*/
|
|
7
|
+
export type InternChatAssistantMessage = {
|
|
8
|
+
/**
|
|
9
|
+
* Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.
|
|
10
|
+
*/
|
|
11
|
+
content: InternChatMessageContent | null;
|
|
12
|
+
role: "assistant";
|
|
13
|
+
toolCalls?: Array<InternChatEchoedToolCall> | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export type InternChatAssistantMessage$Outbound = {
|
|
17
|
+
content: InternChatMessageContent$Outbound | null;
|
|
18
|
+
role: "assistant";
|
|
19
|
+
tool_calls?: Array<InternChatEchoedToolCall$Outbound> | undefined;
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const InternChatAssistantMessage$outboundSchema: z.ZodType<InternChatAssistantMessage$Outbound, InternChatAssistantMessage>;
|
|
23
|
+
export declare function internChatAssistantMessageToJSON(internChatAssistantMessage: InternChatAssistantMessage): string;
|
|
24
|
+
//# sourceMappingURL=internchatassistantmessage.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: db891c763d46
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { InternChatEchoedToolCall$outboundSchema, } from "./internchatechoedtoolcall.js";
|
|
8
|
+
import { InternChatMessageContent$outboundSchema, } from "./internchatmessagecontent.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const InternChatAssistantMessage$outboundSchema = z.object({
|
|
11
|
+
content: z.nullable(InternChatMessageContent$outboundSchema),
|
|
12
|
+
role: z.literal("assistant"),
|
|
13
|
+
toolCalls: z.array(InternChatEchoedToolCall$outboundSchema).optional(),
|
|
14
|
+
}).transform((v) => {
|
|
15
|
+
return remap$(v, {
|
|
16
|
+
toolCalls: "tool_calls",
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
export function internChatAssistantMessageToJSON(internChatAssistantMessage) {
|
|
20
|
+
return JSON.stringify(InternChatAssistantMessage$outboundSchema.parse(internChatAssistantMessage));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=internchatassistantmessage.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
import { InternChatDelta } from "./internchatdelta.js";
|
|
6
|
+
/**
|
|
7
|
+
* `null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FinishReason: {
|
|
10
|
+
readonly Error: "error";
|
|
11
|
+
readonly Stop: "stop";
|
|
12
|
+
readonly ToolCalls: "tool_calls";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* `null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk.
|
|
16
|
+
*/
|
|
17
|
+
export type FinishReason = OpenEnum<typeof FinishReason>;
|
|
18
|
+
/**
|
|
19
|
+
* The single choice this endpoint streams.
|
|
20
|
+
*/
|
|
21
|
+
export type InternChatChoice = {
|
|
22
|
+
/**
|
|
23
|
+
* The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry.
|
|
24
|
+
*/
|
|
25
|
+
delta: InternChatDelta;
|
|
26
|
+
/**
|
|
27
|
+
* `null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk.
|
|
28
|
+
*/
|
|
29
|
+
finishReason: FinishReason | null;
|
|
30
|
+
index: number;
|
|
31
|
+
};
|
|
32
|
+
/** @internal */
|
|
33
|
+
export declare const FinishReason$inboundSchema: z.ZodType<FinishReason, unknown>;
|
|
34
|
+
/** @internal */
|
|
35
|
+
export declare const InternChatChoice$inboundSchema: z.ZodType<InternChatChoice, unknown>;
|
|
36
|
+
export declare function internChatChoiceFromJSON(jsonString: string): SafeParseResult<InternChatChoice, SDKValidationError>;
|
|
37
|
+
//# sourceMappingURL=internchatchoice.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f10a43356b30
|
|
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 * as openEnums from "../types/enums.js";
|
|
9
|
+
import { InternChatDelta$inboundSchema, } from "./internchatdelta.js";
|
|
10
|
+
/**
|
|
11
|
+
* `null` while streaming. `stop` when the run completed, `tool_calls` when the run is waiting for the caller to answer the streamed tool call, `error` on the terminal error chunk.
|
|
12
|
+
*/
|
|
13
|
+
export const FinishReason = {
|
|
14
|
+
Error: "error",
|
|
15
|
+
Stop: "stop",
|
|
16
|
+
ToolCalls: "tool_calls",
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const FinishReason$inboundSchema = openEnums.inboundSchema(FinishReason);
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const InternChatChoice$inboundSchema = z.object({
|
|
22
|
+
delta: InternChatDelta$inboundSchema,
|
|
23
|
+
finish_reason: z.nullable(FinishReason$inboundSchema),
|
|
24
|
+
index: z.int(),
|
|
25
|
+
}).transform((v) => {
|
|
26
|
+
return remap$(v, {
|
|
27
|
+
"finish_reason": "finishReason",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
export function internChatChoiceFromJSON(jsonString) {
|
|
31
|
+
return safeParse(jsonString, (x) => InternChatChoice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatChoice' from JSON`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=internchatchoice.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { InternChatChoice } from "./internchatchoice.js";
|
|
6
|
+
import { InternChatStreamError } from "./internchatstreamerror.js";
|
|
7
|
+
import { InternChatUsage } from "./internchatusage.js";
|
|
8
|
+
export declare const InternChatCompletionChunkObject: {
|
|
9
|
+
readonly ChatCompletionChunk: "chat.completion.chunk";
|
|
10
|
+
};
|
|
11
|
+
export type InternChatCompletionChunkObject = ClosedEnum<typeof InternChatCompletionChunkObject>;
|
|
12
|
+
/**
|
|
13
|
+
* One `data:` line of the stream. A run streams a role chunk, content and reasoning chunks, then a finish chunk: `stop`, `tool_calls` (the run is paused for input) or `error` (with an `error` object). A final chunk with empty `choices` follows in every case, carrying `session_id` and `usage` (`null` unless the daemon reported usage, and always `null` after `tool_calls`). Every stream ends with `[DONE]`.
|
|
14
|
+
*/
|
|
15
|
+
export type InternChatCompletionChunk = {
|
|
16
|
+
/**
|
|
17
|
+
* One choice on content, tool-call and error chunks. Empty on the final chunk that carries `session_id`.
|
|
18
|
+
*/
|
|
19
|
+
choices: Array<InternChatChoice>;
|
|
20
|
+
created: number;
|
|
21
|
+
/**
|
|
22
|
+
* A failure after the response headers were sent. The chunk that carries it has `finish_reason: "error"`, then the final empty-`choices` chunk and `[DONE]` follow. Reasons here are `attachment_failed`, `busy`, `client_closed_request`, `interaction_not_pending`, `interaction_unknown`, `intern_unreachable`, `run_ended`, `stream_severed`, `timeout` or `turn_failed`. `run_ended` reports an ending the intern confirmed, such as a cancellation or a deadline, while `stream_severed` reports a connection lost without that confirmation.
|
|
23
|
+
*/
|
|
24
|
+
error?: InternChatStreamError | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The completion id, constant for the whole response.
|
|
27
|
+
*/
|
|
28
|
+
id: string;
|
|
29
|
+
/**
|
|
30
|
+
* The request `model` when given, or `openrouter/intern`. The final chunk may carry the model the intern reported for the run instead.
|
|
31
|
+
*/
|
|
32
|
+
model: string;
|
|
33
|
+
object: InternChatCompletionChunkObject;
|
|
34
|
+
/**
|
|
35
|
+
* On the final chunk of every response, the daemon session to continue with, or `null` when the run failed before the intern reported one. Send it as `session_id` on the next request, including the `tool` reply to an interaction.
|
|
36
|
+
*/
|
|
37
|
+
sessionId?: string | null | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Token usage for the run as the daemon reported it, on the final chunk before `[DONE]`. `null` when the daemon reported none, and always `null` after `tool_calls` because the turn is not over.
|
|
40
|
+
*/
|
|
41
|
+
usage?: InternChatUsage | null | undefined;
|
|
42
|
+
};
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare const InternChatCompletionChunkObject$inboundSchema: z.ZodEnum<typeof InternChatCompletionChunkObject>;
|
|
45
|
+
/** @internal */
|
|
46
|
+
export declare const InternChatCompletionChunk$inboundSchema: z.ZodType<InternChatCompletionChunk, unknown>;
|
|
47
|
+
export declare function internChatCompletionChunkFromJSON(jsonString: string): SafeParseResult<InternChatCompletionChunk, SDKValidationError>;
|
|
48
|
+
//# sourceMappingURL=internchatcompletionchunk.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 3492df914b61
|
|
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 { InternChatChoice$inboundSchema, } from "./internchatchoice.js";
|
|
9
|
+
import { InternChatStreamError$inboundSchema, } from "./internchatstreamerror.js";
|
|
10
|
+
import { InternChatUsage$inboundSchema, } from "./internchatusage.js";
|
|
11
|
+
export const InternChatCompletionChunkObject = {
|
|
12
|
+
ChatCompletionChunk: "chat.completion.chunk",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const InternChatCompletionChunkObject$inboundSchema = z.enum(InternChatCompletionChunkObject);
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const InternChatCompletionChunk$inboundSchema = z.object({
|
|
18
|
+
choices: z.array(InternChatChoice$inboundSchema),
|
|
19
|
+
created: z.int(),
|
|
20
|
+
error: InternChatStreamError$inboundSchema.optional(),
|
|
21
|
+
id: z.string(),
|
|
22
|
+
model: z.string(),
|
|
23
|
+
object: InternChatCompletionChunkObject$inboundSchema,
|
|
24
|
+
session_id: z.nullable(z.string()).optional(),
|
|
25
|
+
usage: z.nullable(InternChatUsage$inboundSchema).optional(),
|
|
26
|
+
}).transform((v) => {
|
|
27
|
+
return remap$(v, {
|
|
28
|
+
"session_id": "sessionId",
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
export function internChatCompletionChunkFromJSON(jsonString) {
|
|
32
|
+
return safeParse(jsonString, (x) => InternChatCompletionChunk$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatCompletionChunk' from JSON`);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=internchatcompletionchunk.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { InternApprovalMode } from "./internapprovalmode.js";
|
|
3
|
+
import { InternChatMessage, InternChatMessage$Outbound } from "./internchatmessage.js";
|
|
4
|
+
/**
|
|
5
|
+
* An OpenAI-compatible streaming chat completion request for one intern. Other OpenAI fields such as `temperature` or `tools` are ignored. The intern owns its sampling and its tools.
|
|
6
|
+
*/
|
|
7
|
+
export type InternChatCompletionRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.
|
|
10
|
+
*/
|
|
11
|
+
approvalMode?: InternApprovalMode | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`.
|
|
14
|
+
*/
|
|
15
|
+
messages: Array<InternChatMessage>;
|
|
16
|
+
/**
|
|
17
|
+
* Echoed as `model` on the streamed chunks; the final chunk may carry the model the intern reported instead. The intern chooses its own model, so this value does not change what runs.
|
|
18
|
+
*/
|
|
19
|
+
model?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. Required when the last message has role `tool`.
|
|
22
|
+
*/
|
|
23
|
+
sessionId?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Must be `true`. This endpoint only streams.
|
|
26
|
+
*/
|
|
27
|
+
stream: true;
|
|
28
|
+
};
|
|
29
|
+
/** @internal */
|
|
30
|
+
export type InternChatCompletionRequest$Outbound = {
|
|
31
|
+
approval_mode?: string | undefined;
|
|
32
|
+
messages: Array<InternChatMessage$Outbound>;
|
|
33
|
+
model?: string | undefined;
|
|
34
|
+
session_id?: string | undefined;
|
|
35
|
+
stream: true;
|
|
36
|
+
};
|
|
37
|
+
/** @internal */
|
|
38
|
+
export declare const InternChatCompletionRequest$outboundSchema: z.ZodType<InternChatCompletionRequest$Outbound, InternChatCompletionRequest>;
|
|
39
|
+
export declare function internChatCompletionRequestToJSON(internChatCompletionRequest: InternChatCompletionRequest): string;
|
|
40
|
+
//# sourceMappingURL=internchatcompletionrequest.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 46664fa50bff
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { InternApprovalMode$outboundSchema, } from "./internapprovalmode.js";
|
|
8
|
+
import { InternChatMessage$outboundSchema, } from "./internchatmessage.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const InternChatCompletionRequest$outboundSchema = z.object({
|
|
11
|
+
approvalMode: InternApprovalMode$outboundSchema.optional(),
|
|
12
|
+
messages: z.array(InternChatMessage$outboundSchema),
|
|
13
|
+
model: z.string().optional(),
|
|
14
|
+
sessionId: z.string().optional(),
|
|
15
|
+
stream: z.literal(true),
|
|
16
|
+
}).transform((v) => {
|
|
17
|
+
return remap$(v, {
|
|
18
|
+
approvalMode: "approval_mode",
|
|
19
|
+
sessionId: "session_id",
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
export function internChatCompletionRequestToJSON(internChatCompletionRequest) {
|
|
23
|
+
return JSON.stringify(InternChatCompletionRequest$outboundSchema.parse(internChatCompletionRequest));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=internchatcompletionrequest.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { InternChatToolCall } from "./internchattoolcall.js";
|
|
6
|
+
export declare const InternChatDeltaRole: {
|
|
7
|
+
readonly Assistant: "assistant";
|
|
8
|
+
};
|
|
9
|
+
export type InternChatDeltaRole = ClosedEnum<typeof InternChatDeltaRole>;
|
|
10
|
+
/**
|
|
11
|
+
* The incremental content of one chunk. The first chunk carries `role`, text chunks carry `content`, reasoning chunks carry `reasoning`, and an interaction chunk carries one complete `tool_calls` entry.
|
|
12
|
+
*/
|
|
13
|
+
export type InternChatDelta = {
|
|
14
|
+
content?: string | undefined;
|
|
15
|
+
reasoning?: string | undefined;
|
|
16
|
+
role?: InternChatDeltaRole | undefined;
|
|
17
|
+
toolCalls?: Array<InternChatToolCall> | undefined;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const InternChatDeltaRole$inboundSchema: z.ZodEnum<typeof InternChatDeltaRole>;
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const InternChatDelta$inboundSchema: z.ZodType<InternChatDelta, unknown>;
|
|
23
|
+
export declare function internChatDeltaFromJSON(jsonString: string): SafeParseResult<InternChatDelta, SDKValidationError>;
|
|
24
|
+
//# sourceMappingURL=internchatdelta.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: c2dc1f33e1df
|
|
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 { InternChatToolCall$inboundSchema, } from "./internchattoolcall.js";
|
|
9
|
+
export const InternChatDeltaRole = {
|
|
10
|
+
Assistant: "assistant",
|
|
11
|
+
};
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const InternChatDeltaRole$inboundSchema = z.enum(InternChatDeltaRole);
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const InternChatDelta$inboundSchema = z.object({
|
|
16
|
+
content: z.string().optional(),
|
|
17
|
+
reasoning: z.string().optional(),
|
|
18
|
+
role: InternChatDeltaRole$inboundSchema.optional(),
|
|
19
|
+
tool_calls: z.array(InternChatToolCall$inboundSchema).optional(),
|
|
20
|
+
}).transform((v) => {
|
|
21
|
+
return remap$(v, {
|
|
22
|
+
"tool_calls": "toolCalls",
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
export function internChatDeltaFromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => InternChatDelta$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatDelta' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=internchatdelta.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { InternChatMessageContent, InternChatMessageContent$Outbound } from "./internchatmessagecontent.js";
|
|
3
|
+
/**
|
|
4
|
+
* A developer message. Accepted for client compatibility and not forwarded.
|
|
5
|
+
*/
|
|
6
|
+
export type InternChatDeveloperMessage = {
|
|
7
|
+
/**
|
|
8
|
+
* Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.
|
|
9
|
+
*/
|
|
10
|
+
content: InternChatMessageContent | null;
|
|
11
|
+
role: "developer";
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type InternChatDeveloperMessage$Outbound = {
|
|
15
|
+
content: InternChatMessageContent$Outbound | null;
|
|
16
|
+
role: "developer";
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const InternChatDeveloperMessage$outboundSchema: z.ZodType<InternChatDeveloperMessage$Outbound, InternChatDeveloperMessage>;
|
|
20
|
+
export declare function internChatDeveloperMessageToJSON(internChatDeveloperMessage: InternChatDeveloperMessage): string;
|
|
21
|
+
//# sourceMappingURL=internchatdevelopermessage.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 42bfc57a5f4f
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { InternChatMessageContent$outboundSchema, } from "./internchatmessagecontent.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const InternChatDeveloperMessage$outboundSchema = z.object({
|
|
9
|
+
content: z.nullable(InternChatMessageContent$outboundSchema),
|
|
10
|
+
role: z.literal("developer"),
|
|
11
|
+
});
|
|
12
|
+
export function internChatDeveloperMessageToJSON(internChatDeveloperMessage) {
|
|
13
|
+
return JSON.stringify(InternChatDeveloperMessage$outboundSchema.parse(internChatDeveloperMessage));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=internchatdevelopermessage.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { InternChatEchoedToolCallFunction, InternChatEchoedToolCallFunction$Outbound } from "./internchatechoedtoolcallfunction.js";
|
|
3
|
+
/**
|
|
4
|
+
* The `openrouter.provide_input` tool call from the previous response, echoed back unchanged. Its `id` is the interaction the following `tool` message answers.
|
|
5
|
+
*/
|
|
6
|
+
export type InternChatEchoedToolCall = {
|
|
7
|
+
/**
|
|
8
|
+
* The function name and JSON arguments string exactly as streamed.
|
|
9
|
+
*/
|
|
10
|
+
function: InternChatEchoedToolCallFunction;
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type InternChatEchoedToolCall$Outbound = {
|
|
15
|
+
function: InternChatEchoedToolCallFunction$Outbound;
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const InternChatEchoedToolCall$outboundSchema: z.ZodType<InternChatEchoedToolCall$Outbound, InternChatEchoedToolCall>;
|
|
20
|
+
export declare function internChatEchoedToolCallToJSON(internChatEchoedToolCall: InternChatEchoedToolCall): string;
|
|
21
|
+
//# sourceMappingURL=internchatechoedtoolcall.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 28fd4d113f6d
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { InternChatEchoedToolCallFunction$outboundSchema, } from "./internchatechoedtoolcallfunction.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const InternChatEchoedToolCall$outboundSchema = z.object({
|
|
9
|
+
function: InternChatEchoedToolCallFunction$outboundSchema,
|
|
10
|
+
id: z.string(),
|
|
11
|
+
});
|
|
12
|
+
export function internChatEchoedToolCallToJSON(internChatEchoedToolCall) {
|
|
13
|
+
return JSON.stringify(InternChatEchoedToolCall$outboundSchema.parse(internChatEchoedToolCall));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=internchatechoedtoolcall.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* The function name and JSON arguments string exactly as streamed.
|
|
4
|
+
*/
|
|
5
|
+
export type InternChatEchoedToolCallFunction = {
|
|
6
|
+
arguments: string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
/** @internal */
|
|
10
|
+
export type InternChatEchoedToolCallFunction$Outbound = {
|
|
11
|
+
arguments: string;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const InternChatEchoedToolCallFunction$outboundSchema: z.ZodType<InternChatEchoedToolCallFunction$Outbound, InternChatEchoedToolCallFunction>;
|
|
16
|
+
export declare function internChatEchoedToolCallFunctionToJSON(internChatEchoedToolCallFunction: InternChatEchoedToolCallFunction): string;
|
|
17
|
+
//# sourceMappingURL=internchatechoedtoolcallfunction.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 427820de46b3
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const InternChatEchoedToolCallFunction$outboundSchema = z.object({
|
|
8
|
+
arguments: z.string(),
|
|
9
|
+
name: z.string(),
|
|
10
|
+
});
|
|
11
|
+
export function internChatEchoedToolCallFunctionToJSON(internChatEchoedToolCallFunction) {
|
|
12
|
+
return JSON.stringify(InternChatEchoedToolCallFunction$outboundSchema.parse(internChatEchoedToolCallFunction));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=internchatechoedtoolcallfunction.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
import { InternChatErrorMetadata } from "./internchaterrormetadata.js";
|
|
5
|
+
/**
|
|
6
|
+
* The OpenAI-compatible error object. `metadata` is present on refusals from the chat route. Authentication refusals (`401`), the departed-creator `403` and the programme `404` carry only `code` and `message`.
|
|
7
|
+
*/
|
|
8
|
+
export type InternChatError = {
|
|
9
|
+
/**
|
|
10
|
+
* The HTTP status of the response.
|
|
11
|
+
*/
|
|
12
|
+
code: number;
|
|
13
|
+
message: string;
|
|
14
|
+
/**
|
|
15
|
+
* Machine-readable detail for the failure.
|
|
16
|
+
*/
|
|
17
|
+
metadata?: InternChatErrorMetadata | undefined;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const InternChatError$inboundSchema: z.ZodType<InternChatError, unknown>;
|
|
21
|
+
export declare function internChatErrorFromJSON(jsonString: string): SafeParseResult<InternChatError, SDKValidationError>;
|
|
22
|
+
//# sourceMappingURL=internchaterror.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 9bf0417c1e10
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { InternChatErrorMetadata$inboundSchema, } from "./internchaterrormetadata.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const InternChatError$inboundSchema = z.object({
|
|
10
|
+
code: z.int(),
|
|
11
|
+
message: z.string(),
|
|
12
|
+
metadata: InternChatErrorMetadata$inboundSchema.optional(),
|
|
13
|
+
});
|
|
14
|
+
export function internChatErrorFromJSON(jsonString) {
|
|
15
|
+
return safeParse(jsonString, (x) => InternChatError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatError' from JSON`);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=internchaterror.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* A stable reason a client can branch on.
|
|
7
|
+
*/
|
|
8
|
+
export declare const InternChatErrorMetadataReason: {
|
|
9
|
+
readonly AttachmentFailed: "attachment_failed";
|
|
10
|
+
readonly BadRequest: "bad_request";
|
|
11
|
+
readonly Busy: "busy";
|
|
12
|
+
readonly ClientClosedRequest: "client_closed_request";
|
|
13
|
+
readonly InteractionNotPending: "interaction_not_pending";
|
|
14
|
+
readonly InteractionUnknown: "interaction_unknown";
|
|
15
|
+
readonly InternNotReady: "intern_not_ready";
|
|
16
|
+
readonly InternRejected: "intern_rejected";
|
|
17
|
+
readonly InternUnreachable: "intern_unreachable";
|
|
18
|
+
readonly NotFound: "not_found";
|
|
19
|
+
readonly PayloadTooLarge: "payload_too_large";
|
|
20
|
+
readonly RateLimited: "rate_limited";
|
|
21
|
+
readonly RunEnded: "run_ended";
|
|
22
|
+
readonly StreamSevered: "stream_severed";
|
|
23
|
+
readonly Timeout: "timeout";
|
|
24
|
+
readonly TurnFailed: "turn_failed";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A stable reason a client can branch on.
|
|
28
|
+
*/
|
|
29
|
+
export type InternChatErrorMetadataReason = OpenEnum<typeof InternChatErrorMetadataReason>;
|
|
30
|
+
/**
|
|
31
|
+
* Machine-readable detail for the failure.
|
|
32
|
+
*/
|
|
33
|
+
export type InternChatErrorMetadata = {
|
|
34
|
+
/**
|
|
35
|
+
* A stable reason a client can branch on.
|
|
36
|
+
*/
|
|
37
|
+
reason: InternChatErrorMetadataReason;
|
|
38
|
+
};
|
|
39
|
+
/** @internal */
|
|
40
|
+
export declare const InternChatErrorMetadataReason$inboundSchema: z.ZodType<InternChatErrorMetadataReason, unknown>;
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const InternChatErrorMetadata$inboundSchema: z.ZodType<InternChatErrorMetadata, unknown>;
|
|
43
|
+
export declare function internChatErrorMetadataFromJSON(jsonString: string): SafeParseResult<InternChatErrorMetadata, SDKValidationError>;
|
|
44
|
+
//# sourceMappingURL=internchaterrormetadata.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 3a4e9b3de0d5
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
/**
|
|
9
|
+
* A stable reason a client can branch on.
|
|
10
|
+
*/
|
|
11
|
+
export const InternChatErrorMetadataReason = {
|
|
12
|
+
AttachmentFailed: "attachment_failed",
|
|
13
|
+
BadRequest: "bad_request",
|
|
14
|
+
Busy: "busy",
|
|
15
|
+
ClientClosedRequest: "client_closed_request",
|
|
16
|
+
InteractionNotPending: "interaction_not_pending",
|
|
17
|
+
InteractionUnknown: "interaction_unknown",
|
|
18
|
+
InternNotReady: "intern_not_ready",
|
|
19
|
+
InternRejected: "intern_rejected",
|
|
20
|
+
InternUnreachable: "intern_unreachable",
|
|
21
|
+
NotFound: "not_found",
|
|
22
|
+
PayloadTooLarge: "payload_too_large",
|
|
23
|
+
RateLimited: "rate_limited",
|
|
24
|
+
RunEnded: "run_ended",
|
|
25
|
+
StreamSevered: "stream_severed",
|
|
26
|
+
Timeout: "timeout",
|
|
27
|
+
TurnFailed: "turn_failed",
|
|
28
|
+
};
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const InternChatErrorMetadataReason$inboundSchema = openEnums.inboundSchema(InternChatErrorMetadataReason);
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const InternChatErrorMetadata$inboundSchema = z.object({
|
|
33
|
+
reason: InternChatErrorMetadataReason$inboundSchema,
|
|
34
|
+
});
|
|
35
|
+
export function internChatErrorMetadataFromJSON(jsonString) {
|
|
36
|
+
return safeParse(jsonString, (x) => InternChatErrorMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatErrorMetadata' from JSON`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=internchaterrormetadata.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { InternChatAssistantMessage, InternChatAssistantMessage$Outbound } from "./internchatassistantmessage.js";
|
|
3
|
+
import { InternChatDeveloperMessage, InternChatDeveloperMessage$Outbound } from "./internchatdevelopermessage.js";
|
|
4
|
+
import { InternChatSystemMessage, InternChatSystemMessage$Outbound } from "./internchatsystemmessage.js";
|
|
5
|
+
import { InternChatToolMessage, InternChatToolMessage$Outbound } from "./internchattoolmessage.js";
|
|
6
|
+
import { InternChatUserMessage, InternChatUserMessage$Outbound } from "./internchatusermessage.js";
|
|
7
|
+
/**
|
|
8
|
+
* One OpenAI-compatible chat message, discriminated by `role`.
|
|
9
|
+
*/
|
|
10
|
+
export type InternChatMessage = InternChatAssistantMessage | InternChatDeveloperMessage | InternChatSystemMessage | InternChatToolMessage | InternChatUserMessage;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export type InternChatMessage$Outbound = InternChatAssistantMessage$Outbound | InternChatDeveloperMessage$Outbound | InternChatSystemMessage$Outbound | InternChatToolMessage$Outbound | InternChatUserMessage$Outbound;
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const InternChatMessage$outboundSchema: z.ZodType<InternChatMessage$Outbound, InternChatMessage>;
|
|
15
|
+
export declare function internChatMessageToJSON(internChatMessage: InternChatMessage): string;
|
|
16
|
+
//# sourceMappingURL=internchatmessage.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b5080dcf9c97
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { InternChatAssistantMessage$outboundSchema, } from "./internchatassistantmessage.js";
|
|
7
|
+
import { InternChatDeveloperMessage$outboundSchema, } from "./internchatdevelopermessage.js";
|
|
8
|
+
import { InternChatSystemMessage$outboundSchema, } from "./internchatsystemmessage.js";
|
|
9
|
+
import { InternChatToolMessage$outboundSchema, } from "./internchattoolmessage.js";
|
|
10
|
+
import { InternChatUserMessage$outboundSchema, } from "./internchatusermessage.js";
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const InternChatMessage$outboundSchema = z.union([
|
|
13
|
+
InternChatAssistantMessage$outboundSchema,
|
|
14
|
+
InternChatDeveloperMessage$outboundSchema,
|
|
15
|
+
InternChatSystemMessage$outboundSchema,
|
|
16
|
+
InternChatToolMessage$outboundSchema,
|
|
17
|
+
InternChatUserMessage$outboundSchema,
|
|
18
|
+
]);
|
|
19
|
+
export function internChatMessageToJSON(internChatMessage) {
|
|
20
|
+
return JSON.stringify(InternChatMessage$outboundSchema.parse(internChatMessage));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=internchatmessage.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { InternChatTextPart, InternChatTextPart$Outbound } from "./internchattextpart.js";
|
|
3
|
+
/**
|
|
4
|
+
* Message text as a string or a list of text parts. Assistant history may carry null. Only the last message is read; earlier messages are accepted so ordinary clients can resend history.
|
|
5
|
+
*/
|
|
6
|
+
export type InternChatMessageContent = string | Array<InternChatTextPart>;
|
|
7
|
+
/** @internal */
|
|
8
|
+
export type InternChatMessageContent$Outbound = string | Array<InternChatTextPart$Outbound>;
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const InternChatMessageContent$outboundSchema: z.ZodType<InternChatMessageContent$Outbound, InternChatMessageContent>;
|
|
11
|
+
export declare function internChatMessageContentToJSON(internChatMessageContent: InternChatMessageContent): string;
|
|
12
|
+
//# sourceMappingURL=internchatmessagecontent.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 98b91b7e9488
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { InternChatTextPart$outboundSchema, } from "./internchattextpart.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const InternChatMessageContent$outboundSchema = z.union([z.string(), z.array(InternChatTextPart$outboundSchema)]);
|
|
9
|
+
export function internChatMessageContentToJSON(internChatMessageContent) {
|
|
10
|
+
return JSON.stringify(InternChatMessageContent$outboundSchema.parse(internChatMessageContent));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=internchatmessagecontent.js.map
|