@linxiraos/pi-ai 1.1.5 → 1.1.6
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/CHANGELOG.md +4 -0
- package/README.md +4 -5
- package/dist/types/auth-broker/remote-store.d.ts +5 -2
- package/dist/types/auth-gateway/http.d.ts +14 -0
- package/dist/types/auth-storage.d.ts +18 -2
- package/dist/types/providers/claude-code-fingerprint.d.ts +4 -2
- package/dist/types/providers/openai-data-uri.d.ts +11 -0
- package/dist/types/providers/openai-responses-server-schema.d.ts +220 -76
- package/dist/types/providers/openai-shared.d.ts +19 -1
- package/dist/types/registry/cloudflare-ai-gateway.d.ts +8 -8
- package/dist/types/registry/registry.d.ts +5 -0
- package/dist/types/registry/types.d.ts +3 -0
- package/dist/types/types.d.ts +6 -0
- package/dist/types/usage/google-antigravity.d.ts +12 -1
- package/dist/types/usage.d.ts +29 -10
- package/package.json +5 -5
- package/src/auth/sqlite-credential-store.ts +36 -10
- package/src/auth-broker/remote-store.ts +49 -31
- package/src/auth-broker/wire-schemas.ts +3 -1
- package/src/auth-gateway/http.ts +28 -0
- package/src/auth-gateway/server.ts +62 -1
- package/src/auth-storage.ts +63 -18
- package/src/providers/amazon-bedrock.ts +9 -0
- package/src/providers/anthropic.ts +5 -2
- package/src/providers/claude-code-fingerprint.ts +3 -1
- package/src/providers/cursor.ts +61 -29
- package/src/providers/openai-chat-server.ts +1 -12
- package/src/providers/openai-completions.ts +43 -0
- package/src/providers/openai-data-uri.ts +22 -0
- package/src/providers/openai-responses-server-schema.ts +22 -12
- package/src/providers/openai-responses-server.ts +64 -23
- package/src/providers/openai-shared.ts +72 -51
- package/src/providers/pi-native-client.ts +9 -1
- package/src/registry/cloudflare-ai-gateway.ts +120 -16
- package/src/registry/oauth/anthropic.ts +2 -2
- package/src/registry/oauth/oauth.html +8 -2
- package/src/registry/types.ts +3 -0
- package/src/stream.ts +9 -7
- package/src/types.ts +6 -0
- package/src/usage/google-antigravity.ts +25 -13
- package/src/usage/openai-codex.ts +5 -2
- package/src/usage/zai.ts +50 -4
- package/src/usage.ts +30 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ Unified LLM API with automatic model discovery, provider configuration, token an
|
|
|
76
76
|
- **Qwen Portal** (supports `QWEN_OAUTH_TOKEN` or `QWEN_PORTAL_API_KEY`)
|
|
77
77
|
- **QwenCloud Token Plan** (supports `/login alibaba-token-plan`, `ALIBABA_TOKEN_PLAN_API_KEY`, or `BAILIAN_TOKEN_PLAN_API_KEY`; interactive login first selects a region — International (Singapore, default), China (Beijing) for 百炼 Token Plan keys, or a custom base URL — since region keys are non-interchangeable, then optionally stores a `home.qwencloud.com` Cookie request header for best-effort 5-hour and 7-day quota reporting)
|
|
78
78
|
To enable quota reporting, sign in to the Token Plan dashboard, copy the `Cookie` request-header value from a `home.qwencloud.com` request in browser developer tools, and paste it at the second login prompt. Press Enter to skip; the Cookie is sensitive and session-lived, so rerun login when it expires.
|
|
79
|
-
- **Cloudflare AI Gateway** (
|
|
79
|
+
- **Cloudflare AI Gateway** (supports `/login cloudflare-ai-gateway`, or `CLOUDFLARE_AI_GATEWAY_API_KEY` with `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_GATEWAY_ID`)
|
|
80
80
|
- **Ollama** (local OpenAI-compatible runtime; optional `OLLAMA_API_KEY`)
|
|
81
81
|
- **Ollama Cloud** (hosted native Ollama API; requires `OLLAMA_CLOUD_API_KEY`)
|
|
82
82
|
- **llama.cpp** (local OpenAI and Anthropic compatible inference server)
|
|
@@ -960,11 +960,10 @@ In Node.js environments, you can set environment variables to avoid passing API
|
|
|
960
960
|
| Xiaomi MiMo | `XIAOMI_API_KEY` |
|
|
961
961
|
| ZenMux | `ZENMUX_API_KEY` |
|
|
962
962
|
| vLLM | `VLLM_API_KEY` |
|
|
963
|
-
| Cloudflare AI Gateway | `CLOUDFLARE_AI_GATEWAY_API_KEY`
|
|
963
|
+
| Cloudflare AI Gateway | `CLOUDFLARE_AI_GATEWAY_API_KEY` + `CLOUDFLARE_ACCOUNT_ID` + `CLOUDFLARE_GATEWAY_ID` |
|
|
964
964
|
| GitHub Copilot | `COPILOT_GITHUB_TOKEN` or `GH_TOKEN` or `GITHUB_TOKEN` |
|
|
965
965
|
|
|
966
|
-
For Cloudflare
|
|
967
|
-
`https://gateway.ai.cloudflare.com/v1/<account>/<gateway>/anthropic`.
|
|
966
|
+
`/login cloudflare-ai-gateway` collects and stores the gateway token, account ID, and gateway ID. For environment configuration, set all three Cloudflare values above. OMP derives provider endpoints from the account and gateway IDs.
|
|
968
967
|
|
|
969
968
|
For Anthropic Foundry routing, set `CLAUDE_CODE_USE_FOUNDRY=true` plus:
|
|
970
969
|
`FOUNDRY_BASE_URL`, `ANTHROPIC_FOUNDRY_API_KEY`, optional `ANTHROPIC_CUSTOM_HEADERS`,
|
|
@@ -996,7 +995,7 @@ Provider endpoint defaults for the current OpenAI-compatible integrations:
|
|
|
996
995
|
- Ollama: local OpenAI-compatible runtime (`http://127.0.0.1:11434/v1`)
|
|
997
996
|
- Ollama Cloud: native Ollama API host (`https://ollama.com/api`, configured here as base URL `https://ollama.com`)
|
|
998
997
|
- LiteLLM: `http://localhost:4000/v1`
|
|
999
|
-
- Cloudflare AI Gateway: `https://gateway.ai.cloudflare.com/v1/<account>/<gateway
|
|
998
|
+
- Cloudflare AI Gateway: native Anthropic, OpenAI, and Workers AI routes under `https://gateway.ai.cloudflare.com/v1/<account>/<gateway>`
|
|
1000
999
|
- Qwen Portal: `https://portal.qwen.ai/v1`
|
|
1001
1000
|
When set, the library automatically uses these keys:
|
|
1002
1001
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AuthCredential, type AuthCredentialStore, type DisabledCredentialSummary, type OAuthCredential, type StoredAuthCredential, type StoredCredentialBlock } from "../auth-storage.js";
|
|
2
2
|
import type { OAuthCredentials } from "../registry/oauth/types.js";
|
|
3
3
|
import type { Provider } from "../types.js";
|
|
4
|
-
import type { ObservedUsageEntry, UsageReport } from "../usage.js";
|
|
4
|
+
import type { ClientUsageIdentity, ObservedUsageEntry, UsageReport } from "../usage.js";
|
|
5
5
|
import { type AuthBrokerClient } from "./client.js";
|
|
6
6
|
import type { SnapshotResponse } from "./types.js";
|
|
7
7
|
/**
|
|
@@ -138,7 +138,10 @@ export declare class RemoteAuthCredentialStore implements AuthCredentialStore {
|
|
|
138
138
|
* a flush. One `POST /v1/usage/observed` at most per flush interval; on
|
|
139
139
|
* failure the batch is retained and retried with the next flush. A 404
|
|
140
140
|
* (pre-endpoint broker) disables reporting for the life of this store.
|
|
141
|
+
*
|
|
142
|
+
* `client` overrides the reporting identity — the auth-gateway attributes
|
|
143
|
+
* each request to the originating install/app instead of the gateway host.
|
|
141
144
|
*/
|
|
142
|
-
recordObservedUsage(entries: ObservedUsageEntry[]): void;
|
|
145
|
+
recordObservedUsage(entries: ObservedUsageEntry[], client?: ClientUsageIdentity): void;
|
|
143
146
|
close(): void;
|
|
144
147
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Api, AssistantMessage, Model } from "../types.js";
|
|
2
|
+
import type { ClientUsageIdentity } from "../usage.js";
|
|
2
3
|
export declare function json(status: number, body: unknown, headers?: Record<string, string>): Response;
|
|
3
4
|
/**
|
|
4
5
|
* Diagnostic response headers for translated inference requests, mirroring the
|
|
@@ -30,6 +31,19 @@ export declare function isAuthorized(req: Request, tokens: ReadonlySet<string>):
|
|
|
30
31
|
* `handleFormatEndpoint`; parsers then read `options.headers`.
|
|
31
32
|
*/
|
|
32
33
|
export declare function captureRequestHeaders(headers: Headers): Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the usage-attribution identity for an inbound gateway request.
|
|
36
|
+
*
|
|
37
|
+
* pi-native omp clients send `x-omp-install-id` / `x-omp-hostname` /
|
|
38
|
+
* `x-omp-app` (see `providers/pi-native-client.ts`); any client may set them.
|
|
39
|
+
* Requests without an install id fall back to the gateway host's identity
|
|
40
|
+
* under the `gateway` app label, so unlabeled foreign-SDK traffic (llm-git,
|
|
41
|
+
* openai/anthropic SDKs) still lands in per-client burn tracking instead of
|
|
42
|
+
* vanishing. These headers are attribution-only — they are deliberately
|
|
43
|
+
* absent from {@link captureRequestHeaders}'s allow-list and never reach the
|
|
44
|
+
* upstream provider.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveClientIdentity(headers: Headers): ClientUsageIdentity;
|
|
33
47
|
/**
|
|
34
48
|
* Resolve a prompt-cache identity from inbound request body + headers.
|
|
35
49
|
* Order of precedence (first wins):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApiKeyResolver } from "./auth-retry.js";
|
|
2
2
|
import type { OAuthAuthInfo, OAuthController, OAuthCredentials, OAuthProviderId } from "./registry/oauth/types.js";
|
|
3
3
|
import type { Provider } from "./types.js";
|
|
4
|
-
import type { ClientUsageReport, ClientUsageSummary, CredentialRankingStrategy, ObservedUsageEntry, UsageHistoryEntry, UsageHistoryQuery, UsageLogger, UsageProvider, UsageReport } from "./usage.js";
|
|
4
|
+
import type { ClientUsageIdentity, ClientUsageReport, ClientUsageSummary, CredentialRankingStrategy, ObservedUsageEntry, UsageHistoryEntry, UsageHistoryQuery, UsageLogger, UsageProvider, UsageReport } from "./usage.js";
|
|
5
5
|
import { type CodexResetConsumeCode, type CodexResetCredit } from "./usage/openai-codex-reset.js";
|
|
6
6
|
export { isSqliteBusyError, isSqliteCorruptionError, SqliteAuthCredentialStore, } from "./auth/sqlite-credential-store.js";
|
|
7
7
|
export type ApiKeyCredential = {
|
|
@@ -317,8 +317,10 @@ export interface AuthCredentialStore {
|
|
|
317
317
|
* Client hook: forward locally observed request usage. Remote broker stores
|
|
318
318
|
* batch these to the broker so it can attribute token burn per install;
|
|
319
319
|
* local stores omit it and observation is skipped.
|
|
320
|
+
* `client` overrides the reporting identity (gateway requests attribute to
|
|
321
|
+
* the originating client, not the gateway host).
|
|
320
322
|
*/
|
|
321
|
-
recordObservedUsage?(entries: ObservedUsageEntry[]): void;
|
|
323
|
+
recordObservedUsage?(entries: ObservedUsageEntry[], client?: ClientUsageIdentity): void;
|
|
322
324
|
/** Broker host: persist one client's observed-usage report. */
|
|
323
325
|
recordClientUsage?(report: ClientUsageReport): void;
|
|
324
326
|
/** Broker host: aggregate recorded per-client usage since a timestamp. */
|
|
@@ -819,6 +821,18 @@ export declare class AuthStorage {
|
|
|
819
821
|
* `XAI_API_KEY` does not auto-select SuperGrok (`xai-oauth`).
|
|
820
822
|
*/
|
|
821
823
|
hasAuth(provider: string): boolean;
|
|
824
|
+
/**
|
|
825
|
+
* Like {@link hasAuth} but excludes providers whose only credential is the
|
|
826
|
+
* self-resolving {@link AUTHENTICATED_SENTINEL} — the marker AWS/Vertex
|
|
827
|
+
* transports return when a credential *source* merely exists (a stray
|
|
828
|
+
* `~/.aws` profile, an EC2 instance role, Application Default Credentials)
|
|
829
|
+
* without a usable key resolved yet. Default-model auto-selection uses this
|
|
830
|
+
* so an ambiently-available provider (e.g. `amazon-bedrock` via an unrelated
|
|
831
|
+
* AWS profile) does not win the startup default over a provider the user
|
|
832
|
+
* actually signed into and then 403 on the first turn. Explicit selection
|
|
833
|
+
* and picker visibility still go through {@link hasAuth}. See issue #9967.
|
|
834
|
+
*/
|
|
835
|
+
hasConcreteAuth(provider: string): boolean;
|
|
822
836
|
/**
|
|
823
837
|
* Whether a request could resolve a key for this provider, including
|
|
824
838
|
* cross-provider env aliases (`xai-oauth` borrowing `XAI_API_KEY`).
|
|
@@ -915,6 +929,8 @@ export declare class AuthStorage {
|
|
|
915
929
|
};
|
|
916
930
|
costUsd?: number;
|
|
917
931
|
at?: number;
|
|
932
|
+
/** Attribution override; defaults to this process's install identity. */
|
|
933
|
+
client?: ClientUsageIdentity;
|
|
918
934
|
}): void;
|
|
919
935
|
/** Broker host: persist one client's observed-usage report (per-install token burn). */
|
|
920
936
|
recordClientUsage(report: ClientUsageReport): boolean;
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* provider module.
|
|
9
9
|
*/
|
|
10
10
|
/** Claude runtime version bundled by the current Cowork desktop release. */
|
|
11
|
-
export declare const claudeCodeVersion = "2.1.
|
|
11
|
+
export declare const claudeCodeVersion = "2.1.246";
|
|
12
|
+
/** `@anthropic-ai/sdk` version bundled by the current Cowork desktop release. */
|
|
13
|
+
export declare const claudeCodeSdkVersion = "0.112.1";
|
|
12
14
|
/** User-Agent emitted by Cowork's `claude-desktop` inference entrypoint. */
|
|
13
|
-
export declare const coworkUserAgent = "claude-cli/2.1.
|
|
15
|
+
export declare const coworkUserAgent = "claude-cli/2.1.246 (external, claude-desktop)";
|
|
14
16
|
/** Prefix used to isolate custom Anthropic OAuth tools from built-in tools. */
|
|
15
17
|
export declare const claudeToolPrefix: string;
|
|
16
18
|
/** Identity block prepended by Cowork's Claude runtime. */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Base64 payload and media type decoded from a data URI. */
|
|
2
|
+
export interface DecodedDataUri {
|
|
3
|
+
data: string;
|
|
4
|
+
mimeType: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Decodes base64 and percent-encoded `data:` URIs.
|
|
8
|
+
*
|
|
9
|
+
* Returns `undefined` for non-data URLs and data URIs without a comma separator.
|
|
10
|
+
*/
|
|
11
|
+
export declare function decodeDataUri(url: string): DecodedDataUri | undefined;
|
|
@@ -9,27 +9,29 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { EasyInputMessage, ResponseCreateParams, ResponseFunctionToolCall, ResponseInputContent, ResponseInputItem, ResponseOutputMessage, ResponseReasoningItem, Tool as ResponsesTool } from "./openai-responses-wire.js";
|
|
11
11
|
declare const inputImageBlockSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
12
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
13
|
-
file_id?: string | undefined;
|
|
14
|
-
image_url?: string | undefined;
|
|
12
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
13
|
+
file_id?: string | null | undefined;
|
|
14
|
+
image_url?: string | null | undefined;
|
|
15
15
|
type: "input_image";
|
|
16
16
|
}, {
|
|
17
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
18
|
-
file_id?: string | undefined;
|
|
19
|
-
image_url?: string | undefined;
|
|
17
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
18
|
+
file_id?: string | null | undefined;
|
|
19
|
+
image_url?: string | null | undefined;
|
|
20
20
|
type: "input_image";
|
|
21
21
|
}>;
|
|
22
22
|
declare const inputFileBlockSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
detail?: "high" | "low" | undefined;
|
|
24
|
+
file_data?: string | null | undefined;
|
|
25
|
+
file_id?: string | null | undefined;
|
|
26
|
+
file_url?: string | null | undefined;
|
|
27
|
+
filename?: string | null | undefined;
|
|
27
28
|
type: "input_file";
|
|
28
29
|
}, {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
detail?: "high" | "low" | undefined;
|
|
31
|
+
file_data?: string | null | undefined;
|
|
32
|
+
file_id?: string | null | undefined;
|
|
33
|
+
file_url?: string | null | undefined;
|
|
34
|
+
filename?: string | null | undefined;
|
|
33
35
|
type: "input_file";
|
|
34
36
|
}>;
|
|
35
37
|
declare const outputRefusalSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
@@ -54,11 +56,45 @@ declare const customToolCallItemSchema: import("@linxiraos/pi-omptype").FluentTy
|
|
|
54
56
|
}>;
|
|
55
57
|
declare const customToolCallOutputItemSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
56
58
|
call_id: string;
|
|
57
|
-
output: string
|
|
59
|
+
output: string | ({
|
|
60
|
+
text: string;
|
|
61
|
+
type: "input_text";
|
|
62
|
+
} | {
|
|
63
|
+
text: string;
|
|
64
|
+
type: "text";
|
|
65
|
+
} | {
|
|
66
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
67
|
+
file_id?: string | null | undefined;
|
|
68
|
+
image_url?: string | null | undefined;
|
|
69
|
+
type: "input_image";
|
|
70
|
+
} | {
|
|
71
|
+
text: string;
|
|
72
|
+
type: "output_text";
|
|
73
|
+
} | {
|
|
74
|
+
refusal: string;
|
|
75
|
+
type: "refusal";
|
|
76
|
+
})[];
|
|
58
77
|
type: "custom_tool_call_output";
|
|
59
78
|
}, {
|
|
60
79
|
call_id: string;
|
|
61
|
-
output: string
|
|
80
|
+
output: string | ({
|
|
81
|
+
text: string;
|
|
82
|
+
type: "input_text";
|
|
83
|
+
} | {
|
|
84
|
+
text: string;
|
|
85
|
+
type: "text";
|
|
86
|
+
} | {
|
|
87
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
88
|
+
file_id?: string | null | undefined;
|
|
89
|
+
image_url?: string | null | undefined;
|
|
90
|
+
type: "input_image";
|
|
91
|
+
} | {
|
|
92
|
+
text: string;
|
|
93
|
+
type: "output_text";
|
|
94
|
+
} | {
|
|
95
|
+
refusal: string;
|
|
96
|
+
type: "refusal";
|
|
97
|
+
})[];
|
|
62
98
|
type: "custom_tool_call_output";
|
|
63
99
|
}>;
|
|
64
100
|
declare const computerCallItemSchema: import("@linxiraos/pi-omptype").FluentType<{
|
|
@@ -292,15 +328,16 @@ export declare const inputItemSchema: import("@linxiraos/pi-omptype").FluentType
|
|
|
292
328
|
text: string;
|
|
293
329
|
type: "text";
|
|
294
330
|
} | {
|
|
295
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
296
|
-
file_id?: string | undefined;
|
|
297
|
-
image_url?: string | undefined;
|
|
331
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
332
|
+
file_id?: string | null | undefined;
|
|
333
|
+
image_url?: string | null | undefined;
|
|
298
334
|
type: "input_image";
|
|
299
335
|
} | {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
336
|
+
detail?: "high" | "low" | undefined;
|
|
337
|
+
file_data?: string | null | undefined;
|
|
338
|
+
file_id?: string | null | undefined;
|
|
339
|
+
file_url?: string | null | undefined;
|
|
340
|
+
filename?: string | null | undefined;
|
|
304
341
|
type: "input_file";
|
|
305
342
|
})[] | undefined;
|
|
306
343
|
role: "developer" | "user";
|
|
@@ -313,15 +350,16 @@ export declare const inputItemSchema: import("@linxiraos/pi-omptype").FluentType
|
|
|
313
350
|
text: string;
|
|
314
351
|
type: "text";
|
|
315
352
|
} | {
|
|
316
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
317
|
-
file_id?: string | undefined;
|
|
318
|
-
image_url?: string | undefined;
|
|
353
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
354
|
+
file_id?: string | null | undefined;
|
|
355
|
+
image_url?: string | null | undefined;
|
|
319
356
|
type: "input_image";
|
|
320
357
|
} | {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
358
|
+
detail?: "high" | "low" | undefined;
|
|
359
|
+
file_data?: string | null | undefined;
|
|
360
|
+
file_id?: string | null | undefined;
|
|
361
|
+
file_url?: string | null | undefined;
|
|
362
|
+
filename?: string | null | undefined;
|
|
325
363
|
type: "input_file";
|
|
326
364
|
})[] | undefined;
|
|
327
365
|
role: "system";
|
|
@@ -362,8 +400,16 @@ export declare const inputItemSchema: import("@linxiraos/pi-omptype").FluentType
|
|
|
362
400
|
} | {
|
|
363
401
|
call_id: string;
|
|
364
402
|
output?: string | ({
|
|
403
|
+
text: string;
|
|
404
|
+
type: "input_text";
|
|
405
|
+
} | {
|
|
365
406
|
text: string;
|
|
366
407
|
type: "text";
|
|
408
|
+
} | {
|
|
409
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
410
|
+
file_id?: string | null | undefined;
|
|
411
|
+
image_url?: string | null | undefined;
|
|
412
|
+
type: "input_image";
|
|
367
413
|
} | {
|
|
368
414
|
text: string;
|
|
369
415
|
type: "output_text";
|
|
@@ -380,7 +426,24 @@ export declare const inputItemSchema: import("@linxiraos/pi-omptype").FluentType
|
|
|
380
426
|
type: "custom_tool_call";
|
|
381
427
|
} | {
|
|
382
428
|
call_id: string;
|
|
383
|
-
output: string
|
|
429
|
+
output: string | ({
|
|
430
|
+
text: string;
|
|
431
|
+
type: "input_text";
|
|
432
|
+
} | {
|
|
433
|
+
text: string;
|
|
434
|
+
type: "text";
|
|
435
|
+
} | {
|
|
436
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
437
|
+
file_id?: string | null | undefined;
|
|
438
|
+
image_url?: string | null | undefined;
|
|
439
|
+
type: "input_image";
|
|
440
|
+
} | {
|
|
441
|
+
text: string;
|
|
442
|
+
type: "output_text";
|
|
443
|
+
} | {
|
|
444
|
+
refusal: string;
|
|
445
|
+
type: "refusal";
|
|
446
|
+
})[];
|
|
384
447
|
type: "custom_tool_call_output";
|
|
385
448
|
} | {
|
|
386
449
|
action?: {
|
|
@@ -501,15 +564,16 @@ export declare const inputItemSchema: import("@linxiraos/pi-omptype").FluentType
|
|
|
501
564
|
text: string;
|
|
502
565
|
type: "text";
|
|
503
566
|
} | {
|
|
504
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
505
|
-
file_id?: string | undefined;
|
|
506
|
-
image_url?: string | undefined;
|
|
567
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
568
|
+
file_id?: string | null | undefined;
|
|
569
|
+
image_url?: string | null | undefined;
|
|
507
570
|
type: "input_image";
|
|
508
571
|
} | {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
572
|
+
detail?: "high" | "low" | undefined;
|
|
573
|
+
file_data?: string | null | undefined;
|
|
574
|
+
file_id?: string | null | undefined;
|
|
575
|
+
file_url?: string | null | undefined;
|
|
576
|
+
filename?: string | null | undefined;
|
|
513
577
|
type: "input_file";
|
|
514
578
|
})[] | undefined;
|
|
515
579
|
role: "developer" | "user";
|
|
@@ -522,15 +586,16 @@ export declare const inputItemSchema: import("@linxiraos/pi-omptype").FluentType
|
|
|
522
586
|
text: string;
|
|
523
587
|
type: "text";
|
|
524
588
|
} | {
|
|
525
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
526
|
-
file_id?: string | undefined;
|
|
527
|
-
image_url?: string | undefined;
|
|
589
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
590
|
+
file_id?: string | null | undefined;
|
|
591
|
+
image_url?: string | null | undefined;
|
|
528
592
|
type: "input_image";
|
|
529
593
|
} | {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
594
|
+
detail?: "high" | "low" | undefined;
|
|
595
|
+
file_data?: string | null | undefined;
|
|
596
|
+
file_id?: string | null | undefined;
|
|
597
|
+
file_url?: string | null | undefined;
|
|
598
|
+
filename?: string | null | undefined;
|
|
534
599
|
type: "input_file";
|
|
535
600
|
})[] | undefined;
|
|
536
601
|
role: "system";
|
|
@@ -571,8 +636,16 @@ export declare const inputItemSchema: import("@linxiraos/pi-omptype").FluentType
|
|
|
571
636
|
} | {
|
|
572
637
|
call_id: string;
|
|
573
638
|
output?: string | ({
|
|
639
|
+
text: string;
|
|
640
|
+
type: "input_text";
|
|
641
|
+
} | {
|
|
574
642
|
text: string;
|
|
575
643
|
type: "text";
|
|
644
|
+
} | {
|
|
645
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
646
|
+
file_id?: string | null | undefined;
|
|
647
|
+
image_url?: string | null | undefined;
|
|
648
|
+
type: "input_image";
|
|
576
649
|
} | {
|
|
577
650
|
text: string;
|
|
578
651
|
type: "output_text";
|
|
@@ -589,7 +662,24 @@ export declare const inputItemSchema: import("@linxiraos/pi-omptype").FluentType
|
|
|
589
662
|
type: "custom_tool_call";
|
|
590
663
|
} | {
|
|
591
664
|
call_id: string;
|
|
592
|
-
output: string
|
|
665
|
+
output: string | ({
|
|
666
|
+
text: string;
|
|
667
|
+
type: "input_text";
|
|
668
|
+
} | {
|
|
669
|
+
text: string;
|
|
670
|
+
type: "text";
|
|
671
|
+
} | {
|
|
672
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
673
|
+
file_id?: string | null | undefined;
|
|
674
|
+
image_url?: string | null | undefined;
|
|
675
|
+
type: "input_image";
|
|
676
|
+
} | {
|
|
677
|
+
text: string;
|
|
678
|
+
type: "output_text";
|
|
679
|
+
} | {
|
|
680
|
+
refusal: string;
|
|
681
|
+
type: "refusal";
|
|
682
|
+
})[];
|
|
593
683
|
type: "custom_tool_call_output";
|
|
594
684
|
} | {
|
|
595
685
|
action?: {
|
|
@@ -781,15 +871,16 @@ export declare const openaiResponsesRequestSchema: import("@linxiraos/pi-omptype
|
|
|
781
871
|
text: string;
|
|
782
872
|
type: "text";
|
|
783
873
|
} | {
|
|
784
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
785
|
-
file_id?: string | undefined;
|
|
786
|
-
image_url?: string | undefined;
|
|
874
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
875
|
+
file_id?: string | null | undefined;
|
|
876
|
+
image_url?: string | null | undefined;
|
|
787
877
|
type: "input_image";
|
|
788
878
|
} | {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
879
|
+
detail?: "high" | "low" | undefined;
|
|
880
|
+
file_data?: string | null | undefined;
|
|
881
|
+
file_id?: string | null | undefined;
|
|
882
|
+
file_url?: string | null | undefined;
|
|
883
|
+
filename?: string | null | undefined;
|
|
793
884
|
type: "input_file";
|
|
794
885
|
})[] | undefined;
|
|
795
886
|
role: "developer" | "user";
|
|
@@ -802,15 +893,16 @@ export declare const openaiResponsesRequestSchema: import("@linxiraos/pi-omptype
|
|
|
802
893
|
text: string;
|
|
803
894
|
type: "text";
|
|
804
895
|
} | {
|
|
805
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
806
|
-
file_id?: string | undefined;
|
|
807
|
-
image_url?: string | undefined;
|
|
896
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
897
|
+
file_id?: string | null | undefined;
|
|
898
|
+
image_url?: string | null | undefined;
|
|
808
899
|
type: "input_image";
|
|
809
900
|
} | {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
901
|
+
detail?: "high" | "low" | undefined;
|
|
902
|
+
file_data?: string | null | undefined;
|
|
903
|
+
file_id?: string | null | undefined;
|
|
904
|
+
file_url?: string | null | undefined;
|
|
905
|
+
filename?: string | null | undefined;
|
|
814
906
|
type: "input_file";
|
|
815
907
|
})[] | undefined;
|
|
816
908
|
role: "system";
|
|
@@ -851,8 +943,16 @@ export declare const openaiResponsesRequestSchema: import("@linxiraos/pi-omptype
|
|
|
851
943
|
} | {
|
|
852
944
|
call_id: string;
|
|
853
945
|
output?: string | ({
|
|
946
|
+
text: string;
|
|
947
|
+
type: "input_text";
|
|
948
|
+
} | {
|
|
854
949
|
text: string;
|
|
855
950
|
type: "text";
|
|
951
|
+
} | {
|
|
952
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
953
|
+
file_id?: string | null | undefined;
|
|
954
|
+
image_url?: string | null | undefined;
|
|
955
|
+
type: "input_image";
|
|
856
956
|
} | {
|
|
857
957
|
text: string;
|
|
858
958
|
type: "output_text";
|
|
@@ -869,7 +969,24 @@ export declare const openaiResponsesRequestSchema: import("@linxiraos/pi-omptype
|
|
|
869
969
|
type: "custom_tool_call";
|
|
870
970
|
} | {
|
|
871
971
|
call_id: string;
|
|
872
|
-
output: string
|
|
972
|
+
output: string | ({
|
|
973
|
+
text: string;
|
|
974
|
+
type: "input_text";
|
|
975
|
+
} | {
|
|
976
|
+
text: string;
|
|
977
|
+
type: "text";
|
|
978
|
+
} | {
|
|
979
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
980
|
+
file_id?: string | null | undefined;
|
|
981
|
+
image_url?: string | null | undefined;
|
|
982
|
+
type: "input_image";
|
|
983
|
+
} | {
|
|
984
|
+
text: string;
|
|
985
|
+
type: "output_text";
|
|
986
|
+
} | {
|
|
987
|
+
refusal: string;
|
|
988
|
+
type: "refusal";
|
|
989
|
+
})[];
|
|
873
990
|
type: "custom_tool_call_output";
|
|
874
991
|
} | {
|
|
875
992
|
action?: {
|
|
@@ -1046,15 +1163,16 @@ export declare const openaiResponsesRequestSchema: import("@linxiraos/pi-omptype
|
|
|
1046
1163
|
text: string;
|
|
1047
1164
|
type: "text";
|
|
1048
1165
|
} | {
|
|
1049
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
1050
|
-
file_id?: string | undefined;
|
|
1051
|
-
image_url?: string | undefined;
|
|
1166
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
1167
|
+
file_id?: string | null | undefined;
|
|
1168
|
+
image_url?: string | null | undefined;
|
|
1052
1169
|
type: "input_image";
|
|
1053
1170
|
} | {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1171
|
+
detail?: "high" | "low" | undefined;
|
|
1172
|
+
file_data?: string | null | undefined;
|
|
1173
|
+
file_id?: string | null | undefined;
|
|
1174
|
+
file_url?: string | null | undefined;
|
|
1175
|
+
filename?: string | null | undefined;
|
|
1058
1176
|
type: "input_file";
|
|
1059
1177
|
})[] | undefined;
|
|
1060
1178
|
role: "developer" | "user";
|
|
@@ -1067,15 +1185,16 @@ export declare const openaiResponsesRequestSchema: import("@linxiraos/pi-omptype
|
|
|
1067
1185
|
text: string;
|
|
1068
1186
|
type: "text";
|
|
1069
1187
|
} | {
|
|
1070
|
-
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
1071
|
-
file_id?: string | undefined;
|
|
1072
|
-
image_url?: string | undefined;
|
|
1188
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
1189
|
+
file_id?: string | null | undefined;
|
|
1190
|
+
image_url?: string | null | undefined;
|
|
1073
1191
|
type: "input_image";
|
|
1074
1192
|
} | {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1193
|
+
detail?: "high" | "low" | undefined;
|
|
1194
|
+
file_data?: string | null | undefined;
|
|
1195
|
+
file_id?: string | null | undefined;
|
|
1196
|
+
file_url?: string | null | undefined;
|
|
1197
|
+
filename?: string | null | undefined;
|
|
1079
1198
|
type: "input_file";
|
|
1080
1199
|
})[] | undefined;
|
|
1081
1200
|
role: "system";
|
|
@@ -1116,8 +1235,16 @@ export declare const openaiResponsesRequestSchema: import("@linxiraos/pi-omptype
|
|
|
1116
1235
|
} | {
|
|
1117
1236
|
call_id: string;
|
|
1118
1237
|
output?: string | ({
|
|
1238
|
+
text: string;
|
|
1239
|
+
type: "input_text";
|
|
1240
|
+
} | {
|
|
1119
1241
|
text: string;
|
|
1120
1242
|
type: "text";
|
|
1243
|
+
} | {
|
|
1244
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
1245
|
+
file_id?: string | null | undefined;
|
|
1246
|
+
image_url?: string | null | undefined;
|
|
1247
|
+
type: "input_image";
|
|
1121
1248
|
} | {
|
|
1122
1249
|
text: string;
|
|
1123
1250
|
type: "output_text";
|
|
@@ -1134,7 +1261,24 @@ export declare const openaiResponsesRequestSchema: import("@linxiraos/pi-omptype
|
|
|
1134
1261
|
type: "custom_tool_call";
|
|
1135
1262
|
} | {
|
|
1136
1263
|
call_id: string;
|
|
1137
|
-
output: string
|
|
1264
|
+
output: string | ({
|
|
1265
|
+
text: string;
|
|
1266
|
+
type: "input_text";
|
|
1267
|
+
} | {
|
|
1268
|
+
text: string;
|
|
1269
|
+
type: "text";
|
|
1270
|
+
} | {
|
|
1271
|
+
detail?: "auto" | "high" | "low" | "original" | null | undefined;
|
|
1272
|
+
file_id?: string | null | undefined;
|
|
1273
|
+
image_url?: string | null | undefined;
|
|
1274
|
+
type: "input_image";
|
|
1275
|
+
} | {
|
|
1276
|
+
text: string;
|
|
1277
|
+
type: "output_text";
|
|
1278
|
+
} | {
|
|
1279
|
+
refusal: string;
|
|
1280
|
+
type: "refusal";
|
|
1281
|
+
})[];
|
|
1138
1282
|
type: "custom_tool_call_output";
|
|
1139
1283
|
} | {
|
|
1140
1284
|
action?: {
|
|
@@ -493,7 +493,25 @@ export interface BuildResponsesInputOptions<TApi extends Api> {
|
|
|
493
493
|
export declare function escapeReplayedControlTokens(items: ResponseInput): ResponseInput;
|
|
494
494
|
export declare function buildResponsesInput<TApi extends Api>(options: BuildResponsesInputOptions<TApi>): ResponseInput;
|
|
495
495
|
export declare function convertResponsesAssistantMessage<TApi extends Api>(assistantMsg: AssistantMessage, model: Model<TApi>, msgIndex: number, knownCallIds: Set<string>, includeThinkingSignatures?: boolean, customCallIds?: Set<string>, preserveMessageIds?: boolean, supportsCustomToolCalls?: boolean, customToolWireNameMap?: ReadonlyMap<string, string>, computerCallIds?: Set<string>, requiresReasoningReplayForAllTurns?: boolean, requiresReasoningReplayForToolCalls?: boolean): ResponseInput;
|
|
496
|
-
/**
|
|
496
|
+
/**
|
|
497
|
+
* Responses wire output for a tool result plus its text-only fallback.
|
|
498
|
+
*
|
|
499
|
+
* `output` preserves native image blocks for paired function/custom outputs.
|
|
500
|
+
* `outputText` feeds orphan and unsupported-computer fallback messages, which
|
|
501
|
+
* cannot carry the native output array.
|
|
502
|
+
*/
|
|
503
|
+
export interface ResponsesToolResultOutputEncoding {
|
|
504
|
+
output: string | ResponseInputContent[];
|
|
505
|
+
outputText: string;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Encodes one canonical tool result for OpenAI Responses replay.
|
|
509
|
+
*
|
|
510
|
+
* Image-capable models receive an ordered native content array; text-only
|
|
511
|
+
* models and callers without images receive the compatible string form.
|
|
512
|
+
*/
|
|
513
|
+
export declare function encodeResponsesToolResultOutput<TApi extends Api>(toolResult: ToolResultMessage, model: Model<TApi>, supportsImageDetailOriginal: boolean): ResponsesToolResultOutputEncoding;
|
|
514
|
+
/** Appends one Responses tool result. */
|
|
497
515
|
export declare function appendResponsesToolResultMessages<TApi extends Api>(messages: ResponseInput, toolResult: ToolResultMessage, model: Model<TApi>, strictResponsesPairing: boolean, supportsImageDetailOriginal: boolean, knownCallIds: ReadonlySet<string>, customCallIds?: ReadonlySet<string>, supportsCustomToolCalls?: boolean, computerCallIds?: ReadonlySet<string>): void;
|
|
498
516
|
/**
|
|
499
517
|
* Per-block accumulation helpers shared by the two Responses decode loops —
|