@openrouter/sdk 1.2.135 → 1.2.137
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/containersListContainerFiles.d.ts +1 -1
- package/esm/funcs/containersListContainerFiles.js +1 -1
- 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/containerfilelistresponse.d.ts +4 -1
- 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/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/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/models/operations/listcontainerfiles.d.ts +1 -1
- package/esm/sdk/containers.d.ts +1 -1
- package/esm/sdk/containers.js +1 -1
- package/esm/sdk/interns.d.ts +20 -0
- package/esm/sdk/interns.js +22 -0
- package/jsr.json +1 -1
- package/package.json +4 -4
|
@@ -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
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Prompt tokens served from cache, when the daemon reported them.
|
|
6
|
+
*/
|
|
7
|
+
export type InternChatPromptTokensDetails = {
|
|
8
|
+
cachedTokens: number;
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const InternChatPromptTokensDetails$inboundSchema: z.ZodType<InternChatPromptTokensDetails, unknown>;
|
|
12
|
+
export declare function internChatPromptTokensDetailsFromJSON(jsonString: string): SafeParseResult<InternChatPromptTokensDetails, SDKValidationError>;
|
|
13
|
+
//# sourceMappingURL=internchatprompttokensdetails.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f7f08da9ab18
|
|
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
|
+
/** @internal */
|
|
9
|
+
export const InternChatPromptTokensDetails$inboundSchema = z.object({
|
|
10
|
+
cached_tokens: z.int(),
|
|
11
|
+
}).transform((v) => {
|
|
12
|
+
return remap$(v, {
|
|
13
|
+
"cached_tokens": "cachedTokens",
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
export function internChatPromptTokensDetailsFromJSON(jsonString) {
|
|
17
|
+
return safeParse(jsonString, (x) => InternChatPromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatPromptTokensDetails' from JSON`);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=internchatprompttokensdetails.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
|
+
* 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.
|
|
7
|
+
*/
|
|
8
|
+
export type InternChatStreamError = {
|
|
9
|
+
/**
|
|
10
|
+
* The HTTP status this failure would have had before the stream opened.
|
|
11
|
+
*/
|
|
12
|
+
code: number;
|
|
13
|
+
message: string;
|
|
14
|
+
/**
|
|
15
|
+
* Machine-readable detail for the failure.
|
|
16
|
+
*/
|
|
17
|
+
metadata: InternChatErrorMetadata;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const InternChatStreamError$inboundSchema: z.ZodType<InternChatStreamError, unknown>;
|
|
21
|
+
export declare function internChatStreamErrorFromJSON(jsonString: string): SafeParseResult<InternChatStreamError, SDKValidationError>;
|
|
22
|
+
//# sourceMappingURL=internchatstreamerror.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: c9734c01b14b
|
|
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 InternChatStreamError$inboundSchema = z.object({
|
|
10
|
+
code: z.int(),
|
|
11
|
+
message: z.string(),
|
|
12
|
+
metadata: InternChatErrorMetadata$inboundSchema,
|
|
13
|
+
});
|
|
14
|
+
export function internChatStreamErrorFromJSON(jsonString) {
|
|
15
|
+
return safeParse(jsonString, (x) => InternChatStreamError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatStreamError' from JSON`);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=internchatstreamerror.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
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 { InternChatCompletionChunk } from "./internchatcompletionchunk.js";
|
|
5
|
+
/**
|
|
6
|
+
* A server-sent event carrying one chunk. The stream ends with `data: [DONE]`.
|
|
7
|
+
*/
|
|
8
|
+
export type InternChatStreamingResponse = {
|
|
9
|
+
/**
|
|
10
|
+
* 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]`.
|
|
11
|
+
*/
|
|
12
|
+
data: InternChatCompletionChunk;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const InternChatStreamingResponse$inboundSchema: z.ZodType<InternChatStreamingResponse, unknown>;
|
|
16
|
+
export declare function internChatStreamingResponseFromJSON(jsonString: string): SafeParseResult<InternChatStreamingResponse, SDKValidationError>;
|
|
17
|
+
//# sourceMappingURL=internchatstreamingresponse.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: c322164c222e
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { InternChatCompletionChunk$inboundSchema, } from "./internchatcompletionchunk.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const InternChatStreamingResponse$inboundSchema = z.object({
|
|
10
|
+
data: z.unknown().transform((v, ctx) => {
|
|
11
|
+
if (typeof v !== "string")
|
|
12
|
+
return v;
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(v);
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
ctx.addIssue({
|
|
18
|
+
input: v,
|
|
19
|
+
code: "custom",
|
|
20
|
+
message: `malformed json: ${err}`,
|
|
21
|
+
});
|
|
22
|
+
return z.NEVER;
|
|
23
|
+
}
|
|
24
|
+
}).pipe(InternChatCompletionChunk$inboundSchema),
|
|
25
|
+
});
|
|
26
|
+
export function internChatStreamingResponseFromJSON(jsonString) {
|
|
27
|
+
return safeParse(jsonString, (x) => InternChatStreamingResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InternChatStreamingResponse' from JSON`);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=internchatstreamingresponse.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { InternChatMessageContent, InternChatMessageContent$Outbound } from "./internchatmessagecontent.js";
|
|
3
|
+
/**
|
|
4
|
+
* A system message. Accepted for client compatibility and not forwarded.
|
|
5
|
+
*/
|
|
6
|
+
export type InternChatSystemMessage = {
|
|
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: "system";
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type InternChatSystemMessage$Outbound = {
|
|
15
|
+
content: InternChatMessageContent$Outbound | null;
|
|
16
|
+
role: "system";
|
|
17
|
+
};
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const InternChatSystemMessage$outboundSchema: z.ZodType<InternChatSystemMessage$Outbound, InternChatSystemMessage>;
|
|
20
|
+
export declare function internChatSystemMessageToJSON(internChatSystemMessage: InternChatSystemMessage): string;
|
|
21
|
+
//# sourceMappingURL=internchatsystemmessage.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4d16d7aadf85
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { InternChatMessageContent$outboundSchema, } from "./internchatmessagecontent.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const InternChatSystemMessage$outboundSchema = z.object({
|
|
9
|
+
content: z.nullable(InternChatMessageContent$outboundSchema),
|
|
10
|
+
role: z.literal("system"),
|
|
11
|
+
});
|
|
12
|
+
export function internChatSystemMessageToJSON(internChatSystemMessage) {
|
|
13
|
+
return JSON.stringify(InternChatSystemMessage$outboundSchema.parse(internChatSystemMessage));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=internchatsystemmessage.js.map
|