@openclaw/ai 2026.11.3 → 2026.11.5-beta.2
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/README.md +11 -8
- package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +1 -0
- package/dist/anthropic-DEKgalVg.mjs +182 -0
- package/dist/{anthropic-payload-policy-C0ki72BT.d.mts → anthropic-payload-policy-CXCJ5Pmj.d.mts} +21 -4
- package/dist/{anthropic-stream-reducer-yWDb5Cct.mjs → anthropic-stream-lifecycle-DF2qVvg1.mjs} +845 -649
- package/dist/{anthropic-tool-projection-C2-d1eZ3.d.mts → anthropic-tool-projection-D5DyrL6C.d.mts} +6 -7
- package/dist/{anthropic-tool-projection-DZOKfAmL.mjs → anthropic-tool-projection-dGRfr4iT.mjs} +22 -32
- package/dist/{api-registry-gDt0faai.d.mts → api-registry-DY2MLUyg.d.mts} +2 -2
- package/dist/assistant-output-CD4kY9gu.mjs +16 -0
- package/dist/{azure-openai-responses-BvvXzZbi.mjs → azure-openai-responses-DbQV5RTx.mjs} +47 -53
- package/dist/{cloudflare-Dttf8jKq.mjs → cloudflare-BJ2_Xabx.mjs} +1 -1
- package/dist/{credential-redaction-XvsPf7Yi.d.mts → credential-redaction-DrgndwTJ.d.mts} +5 -3
- package/dist/{deferred-event-buffer-DAvyP7qA.mjs → deferred-event-buffer-tIGkTkTm.mjs} +1 -2
- package/dist/{diagnostics-v7oVEW59.mjs → diagnostics-CloVGQiK.mjs} +27 -20
- package/dist/{diagnostics-DzrF1h4J.mjs → diagnostics-o1PrVNQb.mjs} +11 -4
- package/dist/diagnostics.d.mts +6 -7
- package/dist/diagnostics.mjs +4 -4
- package/dist/{env-api-keys-Xd8dm_aV.mjs → env-api-keys-BuHc86ya.mjs} +1 -26
- package/dist/event-stream-B4ZcSvsu.d.mts +1 -0
- package/dist/{event-stream-CzpE1g_o.d.mts → event-stream-BYmtRe8-.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -2
- package/dist/expect-lbe3Hgrh.mjs +8 -0
- package/dist/{github-copilot-request-facts-F-EmvkpW.mjs → github-copilot-request-facts-BZ_EMo7X.mjs} +1 -1
- package/dist/{google-Cpi_cLKZ.mjs → google-B1g82bn4.mjs} +7 -8
- package/dist/{google-interactions-CGINbsjO.mjs → google-interactions-Ckr0Z99Z.mjs} +243 -269
- package/dist/{google-messages-DQMgG5yG.mjs → google-messages-A-9d3y5V.mjs} +52 -18
- package/dist/{google-provider-stream-BHd0cST9.mjs → google-provider-stream-CNVh4gpm.mjs} +19 -11
- package/dist/{google-shared-vtag8bj5.mjs → google-shared-WNM86ZcW.mjs} +72 -42
- package/dist/{google-vertex-eKoUnW7N.mjs → google-vertex-CXjleC6g.mjs} +3 -3
- package/dist/{google-video-slots-D8tPH8wX.mjs → google-video-slots-Bxt-OXO8.mjs} +1 -1
- package/dist/{host-CWt55nnF.mjs → host-DX7ORpeH.mjs} +46 -39
- package/dist/{host-jJOffdlW.d.mts → host-ccbwPC3A.d.mts} +17 -9
- package/dist/{host-policy-Dm7PM6AD.mjs → host-policy-jCZebuXx.mjs} +2 -2
- package/dist/index-Bczt0MnO.d.mts +17 -0
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +9 -7
- package/dist/internal/anthropic.d.mts +21 -26
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/google-model-family.mjs +1 -1
- package/dist/internal/google.d.mts +15 -0
- package/dist/internal/google.mjs +1 -0
- package/dist/internal/model-request-body.d.mts +37 -0
- package/dist/internal/model-request-body.mjs +106 -0
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +14 -12
- package/dist/internal/openai.mjs +11 -10
- package/dist/internal/reasoning-tag-text-partitioner.d.mts +26 -0
- package/dist/{reasoning-tag-text-partitioner-CU9A4Lg8.mjs → internal/reasoning-tag-text-partitioner.mjs} +313 -111
- package/dist/internal/retry-after.d.mts +2 -2
- package/dist/internal/retry-after.mjs +96 -32
- package/dist/internal/runtime.d.mts +15 -41
- package/dist/internal/runtime.mjs +9 -10
- package/dist/internal/shared.d.mts +21 -25
- package/dist/internal/shared.mjs +9 -98
- package/dist/internal/tool-schema.d.mts +10 -10
- package/dist/internal/tool-schema.mjs +4 -4
- package/dist/{llm-request-activity-CfMuh5cC.mjs → llm-request-activity-DzaHoRAU.mjs} +2 -2
- package/dist/mistral-CjHkvsqR.mjs +3741 -0
- package/dist/{openai.LICENSE → mistral.LICENSE} +1 -1
- package/dist/{model-transport-url-BrsjjdjR.d.mts → model-transport-url-BdksnBqu.d.mts} +6 -8
- package/dist/{number-coercion-37gmNkuA.mjs → number-coercion-C7HsBgUL.mjs} +7 -2
- package/dist/observe-async-iterator-AlARO5wS.d.mts +178 -0
- package/dist/observe-async-iterator-DgmegcZR.mjs +181 -0
- package/dist/{openai-chatgpt-responses-BZa3SySh.mjs → openai-chatgpt-responses-CwS5JP7A.mjs} +61 -80
- package/dist/{openai-completions-compat-CBvb2eld.d.mts → openai-completions-compat-CJ-NsDzg.d.mts} +12 -6
- package/dist/{openai-completions-compat-bNQXF1y9.mjs → openai-completions-compat-CstlTQuF.mjs} +74 -50
- package/dist/{openai-completions-CCZ_UHCk.mjs → openai-completions-sj4S-RXQ.mjs} +5 -5
- package/dist/openai-completions-transport-BDAIA0_P.mjs +3406 -0
- package/dist/{openai-prompt-cache-DgjD-UL5.d.mts → openai-prompt-cache-BZGaIWYh.d.mts} +4 -4
- package/dist/{openai-prompt-cache-B9AvdoEo.mjs → openai-prompt-cache-CgDoFhO0.mjs} +5 -4
- package/dist/{openai-responses-compaction-replay-_sUXtcwU.d.mts → openai-responses-compaction-replay-CNHk6k53.d.mts} +4 -4
- package/dist/{openai-responses-contracts-B1nkeLL6.d.mts → openai-responses-contracts-BXMcvO7F.d.mts} +4 -10
- package/dist/{openai-responses-contracts-B5mGAbR6.mjs → openai-responses-contracts-xU-n9AJJ.mjs} +36 -37
- package/dist/{openai-responses-endpoint-CfKR6N5f.mjs → openai-responses-endpoint-DCkURKS0.mjs} +55 -8
- package/dist/openai-responses-ev_c6oTy.mjs +89 -0
- package/dist/{openai-responses-payload-policy-BzM52TTH.d.mts → openai-responses-payload-policy-DyE30gdD.d.mts} +7 -7
- package/dist/{openai-responses-request-lifecycle-CTqHc02t.mjs → openai-responses-request-lifecycle-BuOs0mwI.mjs} +12 -26
- package/dist/{openai-responses-shared-wx9v1MCn.mjs → openai-responses-shared-BmRQnUPP.mjs} +633 -1493
- package/dist/{openai-responses-terminal-usage-CpVjkqn-.d.mts → openai-responses-terminal-usage-D7IhRA6i.d.mts} +9 -3
- package/dist/{openai-tool-schema-BTEU2xmN.mjs → openai-tool-schema-CsoYgnWy.mjs} +97 -122
- package/dist/otel-Buswj0Mf.mjs +766 -0
- package/dist/{overflow-OF3PgPbw.mjs → overflow-CpApyjG2.mjs} +1 -1
- package/dist/{positive-integer-Bb4Evc7L.mjs → positive-integer-DiqE5vNi.mjs} +2 -3
- package/dist/{prompt-cache-stability-D_MeCQFI.mjs → prompt-cache-stability-w-ICeyOI.mjs} +1 -1
- package/dist/{provider-error-qtZD2inE.mjs → provider-error-DD-fo4Rz.mjs} +71 -234
- package/dist/{provider-options-DAzsyi49.d.mts → provider-options-Mo8NM5d1.d.mts} +16 -5
- package/dist/{provider-replay-context-4vxI7p4V.mjs → provider-replay-context-xyU7-CiT.mjs} +2 -2
- package/dist/provider-transcript-transform-DtaxNcC1.mjs +32 -0
- package/dist/{provider-transport-turn-state-D_GjPJHe.mjs → provider-transport-turn-state-BIS8maBK.mjs} +4 -4
- package/dist/{provider-types-CWl4VXvE.d.mts → provider-types-B1e98js5.d.mts} +3 -3
- package/dist/provider-types.d.mts +7 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +26 -29
- package/dist/{record-coerce-CNDovvft.mjs → record-coerce-BQaoiN3r.mjs} +4 -1
- package/dist/request-headers-DO4Mqhw1.mjs +10 -0
- package/dist/{required-api-key-D088S4Cd.mjs → required-api-key-2zZTkmsi.mjs} +1 -1
- package/dist/{retry-after-BrmTv0jL.d.mts → retry-after-DnHBlFS2.d.mts} +21 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/{sanitize-unicode-ZqVLLEKC.d.mts → sanitize-unicode-BISmUlUv.d.mts} +2 -2
- package/dist/{simple-options-xJkqrG_E.mjs → simple-options-tLSeECry.mjs} +108 -82
- package/dist/src-BUsVkrNt.mjs +105 -0
- package/dist/{src-CyA0zJnt.mjs → src-CQ7nH2mL.mjs} +4 -7
- package/dist/stable-stringify-CchQEmeA.mjs +84 -0
- package/dist/{stream-C4YDqhFj.mjs → stream-DrtAWu7c.mjs} +2 -6
- package/dist/{stream-first-event-timeout-D_TfJHRJ.mjs → stream-first-event-timeout-B7RcufAV.mjs} +16 -13
- package/dist/{string-coerce-Cj8sqWHx.mjs → string-coerce-BCuWMIrk.mjs} +1 -1
- package/dist/string-normalization-B8TDDBX_.mjs +32 -0
- package/dist/telemetry-CvK1yQg7.mjs +582 -0
- package/dist/{tool-schema-json-projection-B1sTYwfH.mjs → tool-schema-json-projection-BQpiJlXJ.mjs} +53 -69
- package/dist/{transport-stream-shared-lhgkTOz3.mjs → transport-stream-shared-D2uFMhMc.mjs} +177 -93
- package/dist/{transport-stream-shared-8ru8eX4s.d.mts → transport-stream-shared-D3IAU4jn.d.mts} +29 -15
- package/dist/{transport-utils-DwOpuTjL.mjs → transport-utils-Da_39MYi.mjs} +23 -38
- package/dist/transports.d.mts +42 -39
- package/dist/transports.mjs +215 -296
- package/dist/{types-CVYzKrMl.d.mts → types-BVdTf0YV.d.mts} +38 -3
- package/dist/types-Cb3-5WM9.d.mts +1 -0
- package/dist/{types-BXd0kI8-.mjs → types-OVEWUaDh.mjs} +3 -1
- package/dist/types.d.mts +7 -6
- package/dist/types.mjs +7 -5
- package/dist/{validation-9FSkE8T-.mjs → validation-DGXqfvkj.mjs} +45 -27
- package/dist/{validation-BQ5u20Ru.d.mts → validation-QmyD0E5A.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -2
- package/package.json +40 -6
- package/dist/anthropic-lueA8LUg.mjs +0 -221
- package/dist/assistant-output-BnQm3fov.mjs +0 -47
- package/dist/event-stream-CDpFza-M.d.mts +0 -1
- package/dist/index-DSprYWaz.d.mts +0 -185
- package/dist/mistral-CQ7aoWg2.mjs +0 -512
- package/dist/model-request-body-BD5vy4rP.d.mts +0 -17
- package/dist/openai-CiRi-nVE.mjs +0 -20077
- package/dist/openai-completions-transport-DFvSBbUT.mjs +0 -10881
- package/dist/openai-responses-DQsZKUoI.mjs +0 -87
- package/dist/rolldown-runtime-B4iAMlE-.mjs +0 -35
- package/dist/types-CBJthzJX.d.mts +0 -1
- package/dist/ws.LICENSE +0 -20
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2024 Mistral AI
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
//#region packages/ai/src/transports/model-transport-debug.d.ts
|
|
2
2
|
type SubsystemLogger = {
|
|
3
|
+
isEnabled?(level: "debug" | "info" | "warn"): boolean;
|
|
3
4
|
info(message: string): void;
|
|
4
5
|
debug(message: string): void;
|
|
6
|
+
debugLazy?(build: () => string): void;
|
|
5
7
|
};
|
|
6
8
|
type ModelTransportDebugEnv = NodeJS.ProcessEnv;
|
|
7
|
-
/** Payload debug detail levels accepted by `OPENCLAW_DEBUG_MODEL_PAYLOAD`. */
|
|
8
|
-
type ModelPayloadDebugMode = "off" | "summary" | "tools" | "full-redacted";
|
|
9
|
-
/** SSE debug detail levels accepted by `OPENCLAW_DEBUG_SSE`. */
|
|
10
|
-
type ModelSseDebugMode = "off" | "events" | "peek";
|
|
11
9
|
/** Resolves model payload debug verbosity from `OPENCLAW_DEBUG_MODEL_PAYLOAD`. */
|
|
12
|
-
declare function resolveModelPayloadDebugMode(env?: ModelTransportDebugEnv):
|
|
10
|
+
declare function resolveModelPayloadDebugMode(env?: ModelTransportDebugEnv): "off" | "summary" | "tools" | "full-redacted";
|
|
13
11
|
/** Resolves SSE stream debug verbosity from `OPENCLAW_DEBUG_SSE`. */
|
|
14
|
-
declare function resolveModelSseDebugMode(env?: ModelTransportDebugEnv):
|
|
12
|
+
declare function resolveModelSseDebugMode(env?: ModelTransportDebugEnv): "off" | "events" | "peek";
|
|
15
13
|
/** Emits transport diagnostics at debug, promoted to info by explicit debug flags. */
|
|
16
|
-
declare function emitModelTransportDebug(log: SubsystemLogger, message: string): void;
|
|
14
|
+
declare function emitModelTransportDebug(log: SubsystemLogger, message: string | (() => string)): void;
|
|
17
15
|
/** The requesting layer owns AbortError classification; deadlines remain failures here. */
|
|
18
16
|
declare function emitModelTransportError(log: SubsystemLogger & {
|
|
19
17
|
warn(message: string): void;
|
|
20
|
-
}, label: string, detail: string, signal?: AbortSignal): void;
|
|
18
|
+
}, label: string, detail: string | (() => string), signal?: AbortSignal): void;
|
|
21
19
|
//#endregion
|
|
22
20
|
//#region packages/ai/src/transports/model-transport-url.d.ts
|
|
23
21
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as normalizeOptionalString } from "./string-coerce-
|
|
1
|
+
import { o as normalizeOptionalString } from "./string-coerce-BCuWMIrk.mjs";
|
|
2
2
|
//#region packages/normalization-core/src/number-coercion.ts
|
|
3
3
|
function asFiniteNumber(value) {
|
|
4
4
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
@@ -7,6 +7,11 @@ function asPositiveFiniteNumber(value) {
|
|
|
7
7
|
const number = asFiniteNumber(value);
|
|
8
8
|
return number && number > 0 ? number : void 0;
|
|
9
9
|
}
|
|
10
|
+
/** Floors positive finite input; fractions below one become zero. */
|
|
11
|
+
function floorPositiveFiniteNumber(value) {
|
|
12
|
+
const number = asPositiveFiniteNumber(value);
|
|
13
|
+
return number === void 0 ? void 0 : Math.floor(number);
|
|
14
|
+
}
|
|
10
15
|
function asNonNegativeFiniteNumber(value) {
|
|
11
16
|
const number = asFiniteNumber(value);
|
|
12
17
|
return number && number < 0 ? void 0 : number;
|
|
@@ -45,4 +50,4 @@ function parseStrictPositiveInteger(value) {
|
|
|
45
50
|
return parsed !== void 0 && parsed > 0 ? parsed : void 0;
|
|
46
51
|
}
|
|
47
52
|
//#endregion
|
|
48
|
-
export { clampTimerTimeoutMs as a, clampPositiveTimerTimeoutMs as i, asNonNegativeFiniteNumber as n,
|
|
53
|
+
export { clampTimerTimeoutMs as a, parseStrictPositiveInteger as c, clampPositiveTimerTimeoutMs as i, asNonNegativeFiniteNumber as n, floorPositiveFiniteNumber as o, asPositiveFiniteNumber as r, parseStrictFiniteNumber as s, asFiniteNumber as t };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
//#region packages/llm-core/src/model-contracts/anthropic.d.ts
|
|
2
|
+
type ClaudeModelRef = {
|
|
3
|
+
id?: string;
|
|
4
|
+
params?: Record<string, unknown>;
|
|
5
|
+
};
|
|
6
|
+
declare const CLAUDE_FABLE_5_THINKING_PROFILE: {
|
|
7
|
+
readonly levels: readonly [{
|
|
8
|
+
readonly id: "low";
|
|
9
|
+
}, {
|
|
10
|
+
readonly id: "medium";
|
|
11
|
+
}, {
|
|
12
|
+
readonly id: "high";
|
|
13
|
+
}, {
|
|
14
|
+
readonly id: "xhigh";
|
|
15
|
+
}, {
|
|
16
|
+
readonly id: "max";
|
|
17
|
+
}];
|
|
18
|
+
readonly defaultLevel: "medium";
|
|
19
|
+
readonly preserveWhenCatalogReasoningFalse: true;
|
|
20
|
+
};
|
|
21
|
+
declare const CLAUDE_SONNET_5_THINKING_PROFILE: {
|
|
22
|
+
readonly levels: readonly [{
|
|
23
|
+
readonly id: "off";
|
|
24
|
+
}, {
|
|
25
|
+
readonly id: "minimal";
|
|
26
|
+
}, {
|
|
27
|
+
readonly id: "low";
|
|
28
|
+
}, {
|
|
29
|
+
readonly id: "medium";
|
|
30
|
+
}, {
|
|
31
|
+
readonly id: "high";
|
|
32
|
+
}, {
|
|
33
|
+
readonly id: "xhigh";
|
|
34
|
+
}, {
|
|
35
|
+
readonly id: "adaptive";
|
|
36
|
+
}, {
|
|
37
|
+
readonly id: "max";
|
|
38
|
+
}];
|
|
39
|
+
readonly defaultLevel: "high";
|
|
40
|
+
};
|
|
41
|
+
declare const CLAUDE_OPUS_5_THINKING_PROFILE: {
|
|
42
|
+
readonly levels: readonly [{
|
|
43
|
+
readonly id: "off";
|
|
44
|
+
}, {
|
|
45
|
+
readonly id: "minimal";
|
|
46
|
+
}, {
|
|
47
|
+
readonly id: "low";
|
|
48
|
+
}, {
|
|
49
|
+
readonly id: "medium";
|
|
50
|
+
}, {
|
|
51
|
+
readonly id: "high";
|
|
52
|
+
}, {
|
|
53
|
+
readonly id: "xhigh";
|
|
54
|
+
}, {
|
|
55
|
+
readonly id: "adaptive";
|
|
56
|
+
}, {
|
|
57
|
+
readonly id: "max";
|
|
58
|
+
}];
|
|
59
|
+
readonly defaultLevel: "high";
|
|
60
|
+
};
|
|
61
|
+
declare const CLAUDE_OPUS_55_THINKING_PROFILE: {
|
|
62
|
+
readonly levels: readonly [{
|
|
63
|
+
readonly id: "low";
|
|
64
|
+
}, {
|
|
65
|
+
readonly id: "medium";
|
|
66
|
+
}, {
|
|
67
|
+
readonly id: "high";
|
|
68
|
+
}, {
|
|
69
|
+
readonly id: "xhigh";
|
|
70
|
+
}, {
|
|
71
|
+
readonly id: "max";
|
|
72
|
+
}];
|
|
73
|
+
readonly defaultLevel: "medium";
|
|
74
|
+
readonly preserveWhenCatalogReasoningFalse: true;
|
|
75
|
+
};
|
|
76
|
+
declare const CLAUDE_SONNET_55_THINKING_PROFILE: {
|
|
77
|
+
readonly levels: readonly [{
|
|
78
|
+
readonly id: "off";
|
|
79
|
+
}, {
|
|
80
|
+
readonly id: "low";
|
|
81
|
+
}, {
|
|
82
|
+
readonly id: "medium";
|
|
83
|
+
}, {
|
|
84
|
+
readonly id: "high";
|
|
85
|
+
}, {
|
|
86
|
+
readonly id: "xhigh";
|
|
87
|
+
}, {
|
|
88
|
+
readonly id: "max";
|
|
89
|
+
}];
|
|
90
|
+
readonly defaultLevel: "high";
|
|
91
|
+
};
|
|
92
|
+
declare const CLAUDE_HAIKU_55_THINKING_PROFILE: {
|
|
93
|
+
readonly levels: readonly [{
|
|
94
|
+
readonly id: "off";
|
|
95
|
+
}, {
|
|
96
|
+
readonly id: "low";
|
|
97
|
+
}, {
|
|
98
|
+
readonly id: "medium";
|
|
99
|
+
}, {
|
|
100
|
+
readonly id: "high";
|
|
101
|
+
}, {
|
|
102
|
+
readonly id: "xhigh";
|
|
103
|
+
}, {
|
|
104
|
+
readonly id: "max";
|
|
105
|
+
}];
|
|
106
|
+
readonly defaultLevel: "medium";
|
|
107
|
+
};
|
|
108
|
+
/** Resolve Haiku 5.5 through direct ids, cloud ids, aliases, or deployment metadata. */
|
|
109
|
+
declare function resolveClaudeHaiku55ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
110
|
+
/** Resolve the canonical normalized Claude model id for one runtime model ref. */
|
|
111
|
+
declare function resolveClaudeModelIdentity(ref: ClaudeModelRef): string;
|
|
112
|
+
/** Resolve Claude Fable 5 through direct ids, cloud ids, or deployment metadata. */
|
|
113
|
+
declare function resolveClaudeFable5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
114
|
+
/** Resolve Claude Mythos 5 through direct ids, cloud ids, or deployment metadata. */
|
|
115
|
+
declare function resolveClaudeMythos5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Opus 5.5, Sonnet 5.5, Haiku 5.5, and Fable 5.1 require append-only runtime context.
|
|
118
|
+
* Extend only with live replay proof (Mythos 5.1 remains unproven).
|
|
119
|
+
*/
|
|
120
|
+
declare function bindsClaudeThinkingPrefix(ref: ClaudeModelRef): boolean;
|
|
121
|
+
/** Return whether Claude accepts operator instructions within conversation history. */
|
|
122
|
+
declare function supportsClaudeInHistorySystemMessages(ref: ClaudeModelRef): boolean;
|
|
123
|
+
/** Return whether a Claude model requires adaptive thinking instead of manual budgets. */
|
|
124
|
+
declare function requiresClaudeMandatoryAdaptiveThinking(ref: ClaudeModelRef): boolean;
|
|
125
|
+
/** Resolve Claude Sonnet 5 through aliases, direct ids, cloud ids, or deployment metadata. */
|
|
126
|
+
declare function resolveClaudeSonnet5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
127
|
+
/** Resolve the Sonnet 5.5 contract without matching other Sonnet 5 generations. */
|
|
128
|
+
declare function resolveClaudeSonnet55ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
129
|
+
/** Sonnet 5.5 replaces disabled thinking with between-tool progress updates. */
|
|
130
|
+
declare function requiresClaudeBetweenToolsThinking(ref: ClaudeModelRef): boolean;
|
|
131
|
+
/** Resolve Claude Opus 5 through aliases, direct ids, cloud ids, or deployment metadata. */
|
|
132
|
+
declare function resolveClaudeOpus5ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
133
|
+
/** Resolve the Opus 5.5 contract without matching other Opus 5 generations. */
|
|
134
|
+
declare function resolveClaudeOpus55ModelIdentity(ref: ClaudeModelRef): string | undefined;
|
|
135
|
+
/** Return whether a Claude model supports adaptive thinking. */
|
|
136
|
+
declare function supportsClaudeAdaptiveThinking(ref: ClaudeModelRef): boolean;
|
|
137
|
+
/** Return whether a Claude model has a native 1M-token context window. */
|
|
138
|
+
declare function supportsClaude1MContext(ref: ClaudeModelRef): boolean;
|
|
139
|
+
/** Return whether Anthropic documents threshold compaction (`compact_20260112`) for a Claude model. */
|
|
140
|
+
declare function supportsClaudeServerCompaction(ref: ClaudeModelRef): boolean;
|
|
141
|
+
/** Return whether a Claude model supports Anthropic's native fast mode. */
|
|
142
|
+
declare function supportsClaudeFastMode(ref: ClaudeModelRef): boolean;
|
|
143
|
+
/** Return whether a Claude model supports native max effort. */
|
|
144
|
+
declare function supportsClaudeNativeMaxEffort(ref: ClaudeModelRef): boolean;
|
|
145
|
+
/** Return whether a Claude model supports native xhigh effort. */
|
|
146
|
+
declare function supportsClaudeNativeXhighEffort(ref: ClaudeModelRef): boolean;
|
|
147
|
+
/** Return whether a Claude model rejects caller-selected sampling parameters. */
|
|
148
|
+
declare function requiresClaudeDefaultSampling(ref: ClaudeModelRef): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Fill native Claude effort mappings only when the provider did not publish a
|
|
151
|
+
* narrower route-specific contract.
|
|
152
|
+
*/
|
|
153
|
+
declare function resolveClaudeNativeThinkingLevelMap(ref: ClaudeModelRef & {
|
|
154
|
+
thinkingLevelMap?: Record<string, string | null | undefined>;
|
|
155
|
+
}): Record<string, string | null | undefined> | undefined;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region packages/llm-core/src/utils/observe-async-iterator.d.ts
|
|
158
|
+
type CloseReason = "return" | "throw" | "observer";
|
|
159
|
+
/**
|
|
160
|
+
* Observe without a forwarding generator's per-event promises. Serial reads use
|
|
161
|
+
* one stable continuation; overlapping operations retain generator FIFO/context.
|
|
162
|
+
* The default close uses AsyncIteratorClose: source errors do not close, while
|
|
163
|
+
* consumer/observer throws call return() and take precedence over cleanup errors.
|
|
164
|
+
* onClose can retain a caller-owned cleanup policy; onFinally runs once after start.
|
|
165
|
+
*/
|
|
166
|
+
declare function observeAsyncIterator<T>(options: {
|
|
167
|
+
iterator: () => AsyncIterator<T>;
|
|
168
|
+
onStart?: () => void;
|
|
169
|
+
onEvent: (event: T) => void;
|
|
170
|
+
onDone?: () => void;
|
|
171
|
+
onError?: (error: unknown) => void;
|
|
172
|
+
onClose?: (iterator: AsyncIterator<T> | undefined, reason: CloseReason) => Promise<unknown> | void;
|
|
173
|
+
onFinally?: () => void;
|
|
174
|
+
/** Eagerly acquired iterators may need cleanup even before the first read. */
|
|
175
|
+
onUnopenedReturn?: (value: unknown) => Promise<IteratorResult<T>>;
|
|
176
|
+
}): Required<AsyncIterableIterator<T>>;
|
|
177
|
+
//#endregion
|
|
178
|
+
export { supportsClaudeFastMode as C, supportsClaudeServerCompaction as D, supportsClaudeNativeXhighEffort as E, supportsClaudeAdaptiveThinking as S, supportsClaudeNativeMaxEffort as T, resolveClaudeOpus55ModelIdentity as _, CLAUDE_OPUS_5_THINKING_PROFILE as a, resolveClaudeSonnet5ModelIdentity as b, bindsClaudeThinkingPrefix as c, requiresClaudeMandatoryAdaptiveThinking as d, resolveClaudeFable5ModelIdentity as f, resolveClaudeNativeThinkingLevelMap as g, resolveClaudeMythos5ModelIdentity as h, CLAUDE_OPUS_55_THINKING_PROFILE as i, requiresClaudeBetweenToolsThinking as l, resolveClaudeModelIdentity as m, CLAUDE_FABLE_5_THINKING_PROFILE as n, CLAUDE_SONNET_55_THINKING_PROFILE as o, resolveClaudeHaiku55ModelIdentity as p, CLAUDE_HAIKU_55_THINKING_PROFILE as r, CLAUDE_SONNET_5_THINKING_PROFILE as s, observeAsyncIterator as t, requiresClaudeDefaultSampling as u, resolveClaudeOpus5ModelIdentity as v, supportsClaudeInHistorySystemMessages as w, supportsClaude1MContext as x, resolveClaudeSonnet55ModelIdentity as y };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
//#region packages/llm-core/src/utils/observe-async-iterator.ts
|
|
2
|
+
/**
|
|
3
|
+
* Observe without a forwarding generator's per-event promises. Serial reads use
|
|
4
|
+
* one stable continuation; overlapping operations retain generator FIFO/context.
|
|
5
|
+
* The default close uses AsyncIteratorClose: source errors do not close, while
|
|
6
|
+
* consumer/observer throws call return() and take precedence over cleanup errors.
|
|
7
|
+
* onClose can retain a caller-owned cleanup policy; onFinally runs once after start.
|
|
8
|
+
*/
|
|
9
|
+
function observeAsyncIterator(options) {
|
|
10
|
+
let source;
|
|
11
|
+
let nextSource;
|
|
12
|
+
let started = false;
|
|
13
|
+
let closed = false;
|
|
14
|
+
let reading = false;
|
|
15
|
+
let active;
|
|
16
|
+
const queue = [];
|
|
17
|
+
function enqueue(operation) {
|
|
18
|
+
if (!reading) {
|
|
19
|
+
reading = true;
|
|
20
|
+
return active = operation();
|
|
21
|
+
}
|
|
22
|
+
let resolve;
|
|
23
|
+
let reject;
|
|
24
|
+
const promise = new Promise((resolvePending, rejectPending) => {
|
|
25
|
+
resolve = resolvePending;
|
|
26
|
+
reject = rejectPending;
|
|
27
|
+
});
|
|
28
|
+
queue.push({
|
|
29
|
+
operation,
|
|
30
|
+
promise,
|
|
31
|
+
resolve,
|
|
32
|
+
reject
|
|
33
|
+
});
|
|
34
|
+
return promise;
|
|
35
|
+
}
|
|
36
|
+
function settled() {
|
|
37
|
+
const pending = queue.shift();
|
|
38
|
+
if (pending) {
|
|
39
|
+
const advance = () => {
|
|
40
|
+
active = pending.promise;
|
|
41
|
+
pending.operation().then(pending.resolve, pending.reject);
|
|
42
|
+
};
|
|
43
|
+
active.then(advance, advance);
|
|
44
|
+
} else reading = false;
|
|
45
|
+
}
|
|
46
|
+
function finish() {
|
|
47
|
+
try {
|
|
48
|
+
if (started) options.onFinally?.();
|
|
49
|
+
} finally {
|
|
50
|
+
settled();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function close(reason) {
|
|
54
|
+
return options.onClose ? options.onClose(source, reason) : source?.return?.();
|
|
55
|
+
}
|
|
56
|
+
async function fail(error, reason) {
|
|
57
|
+
closed = true;
|
|
58
|
+
try {
|
|
59
|
+
if (reason) try {
|
|
60
|
+
const closing = close(reason);
|
|
61
|
+
if (closing !== void 0) await closing;
|
|
62
|
+
} catch {}
|
|
63
|
+
options.onError?.(error);
|
|
64
|
+
throw error;
|
|
65
|
+
} finally {
|
|
66
|
+
finish();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const rejectRead = (error) => fail(error);
|
|
70
|
+
function observeNext(result) {
|
|
71
|
+
let done;
|
|
72
|
+
try {
|
|
73
|
+
done = result.done;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
return rejectRead(error);
|
|
76
|
+
}
|
|
77
|
+
if (done) {
|
|
78
|
+
closed = true;
|
|
79
|
+
try {
|
|
80
|
+
options.onDone?.();
|
|
81
|
+
return {
|
|
82
|
+
done: true,
|
|
83
|
+
value: void 0
|
|
84
|
+
};
|
|
85
|
+
} catch (error) {
|
|
86
|
+
options.onError?.(error);
|
|
87
|
+
throw error;
|
|
88
|
+
} finally {
|
|
89
|
+
finish();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
let value;
|
|
93
|
+
try {
|
|
94
|
+
value = result.value;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
return rejectRead(error);
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
options.onEvent(value);
|
|
100
|
+
settled();
|
|
101
|
+
return {
|
|
102
|
+
done: false,
|
|
103
|
+
value
|
|
104
|
+
};
|
|
105
|
+
} catch (error) {
|
|
106
|
+
return fail(error, "observer");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function read() {
|
|
110
|
+
if (closed) {
|
|
111
|
+
settled();
|
|
112
|
+
return Promise.resolve({
|
|
113
|
+
done: true,
|
|
114
|
+
value: void 0
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
if (!started) {
|
|
119
|
+
options.onStart?.();
|
|
120
|
+
started = true;
|
|
121
|
+
source = options.iterator();
|
|
122
|
+
nextSource = source.next.bind(source);
|
|
123
|
+
}
|
|
124
|
+
return Promise.resolve(nextSource()).then(observeNext, rejectRead);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
return rejectRead(error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function end(reason, value) {
|
|
130
|
+
if (!started && !closed && reason === "return" && options.onUnopenedReturn) {
|
|
131
|
+
closed = true;
|
|
132
|
+
try {
|
|
133
|
+
return await options.onUnopenedReturn(value);
|
|
134
|
+
} finally {
|
|
135
|
+
settled();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
let resolved = value;
|
|
139
|
+
if (reason === "return") try {
|
|
140
|
+
resolved = await value;
|
|
141
|
+
} catch (error) {
|
|
142
|
+
return end("throw", error);
|
|
143
|
+
}
|
|
144
|
+
if (closed || !started) {
|
|
145
|
+
closed = true;
|
|
146
|
+
settled();
|
|
147
|
+
if (reason === "throw") throw resolved;
|
|
148
|
+
return {
|
|
149
|
+
done: true,
|
|
150
|
+
value: resolved
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (reason === "throw") return fail(resolved, reason);
|
|
154
|
+
closed = true;
|
|
155
|
+
try {
|
|
156
|
+
await close(reason);
|
|
157
|
+
return {
|
|
158
|
+
done: true,
|
|
159
|
+
value: resolved
|
|
160
|
+
};
|
|
161
|
+
} finally {
|
|
162
|
+
finish();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
[Symbol.asyncIterator]() {
|
|
167
|
+
return this;
|
|
168
|
+
},
|
|
169
|
+
next() {
|
|
170
|
+
return enqueue(read);
|
|
171
|
+
},
|
|
172
|
+
return(value) {
|
|
173
|
+
return enqueue(() => end("return", value));
|
|
174
|
+
},
|
|
175
|
+
throw(error) {
|
|
176
|
+
return enqueue(() => end("throw", error));
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
export { observeAsyncIterator as t };
|