@openclaw/ai 2026.10.10 → 2026.11.5-beta.1
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 -1
- package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +1 -0
- package/dist/anthropic-CTND83W3.mjs +182 -0
- package/dist/{anthropic-payload-policy-rqCq9sT_.d.mts → anthropic-payload-policy-CXCJ5Pmj.d.mts} +21 -4
- package/dist/{anthropic-stream-reducer-C__ByTq1.mjs → anthropic-stream-lifecycle-rJe4OH5H.mjs} +845 -649
- package/dist/{anthropic-tool-projection-JTvMo4KG.d.mts → anthropic-tool-projection-D5DyrL6C.d.mts} +6 -7
- package/dist/{anthropic-tool-projection-DA_KeluM.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-DHzTwi-y.mjs → azure-openai-responses-BhoLtP4Z.mjs} +46 -52
- 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-Cv7cW3pS.mjs → diagnostics-CloVGQiK.mjs} +42 -19
- 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-CZ6uGVkV.mjs → google-1uObh-eI.mjs} +7 -8
- package/dist/{google-interactions-qd4flmND.mjs → google-interactions-CY8Xb87S.mjs} +208 -233
- package/dist/{google-messages-B-svbJuN.mjs → google-messages-CwBqSoa4.mjs} +16 -13
- package/dist/{google-provider-stream-DlhaCvCf.mjs → google-provider-stream-D30s9EZp.mjs} +17 -10
- package/dist/{google-shared-Cif7nve-.mjs → google-shared-li0lmEZK.mjs} +70 -42
- package/dist/{google-vertex-BZTcYnWU.mjs → google-vertex-B5CHglca.mjs} +3 -3
- package/dist/{host-rCxf5Tjd.mjs → host-DX7ORpeH.mjs} +57 -46
- package/dist/{host-jJOffdlW.d.mts → host-ccbwPC3A.d.mts} +17 -9
- package/dist/{host-policy-Ci1cKluf.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 +5 -1
- package/dist/internal/openai-completions-compat.mjs +3 -2
- 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-DzlRubwU.mjs → internal/reasoning-tag-text-partitioner.mjs} +313 -122
- package/dist/internal/retry-after.d.mts +2 -2
- package/dist/internal/retry-after.mjs +165 -27
- 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-F5_asrmU.mjs +3741 -0
- package/dist/mistral.LICENSE +201 -0
- 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-iGYDPbmc.mjs → openai-chatgpt-responses-BIK7HROH.mjs} +61 -80
- package/dist/{openai-completions-CDy5u1mv.mjs → openai-completions-ClJ7QHEB.mjs} +5 -5
- package/dist/{openai-completions-compat-CBvb2eld.d.mts → openai-completions-compat-CJ-NsDzg.d.mts} +12 -6
- package/dist/{openai-completions-compat-CJ0OXZgi.mjs → openai-completions-compat-CstlTQuF.mjs} +74 -50
- package/dist/openai-completions-reasoning-replay-BwT1xwRI.mjs +45 -0
- package/dist/{openai-completions-transport-DLrm5EWi.mjs → openai-completions-transport-C6J4_oGf.mjs} +501 -563
- package/dist/{openai-prompt-cache-DgjD-UL5.d.mts → openai-prompt-cache-BZGaIWYh.d.mts} +4 -4
- package/dist/{openai-prompt-cache-h8vXRiaH.mjs → openai-prompt-cache-CgDoFhO0.mjs} +5 -4
- package/dist/openai-responses-Beifmf1s.mjs +89 -0
- package/dist/{openai-responses-compaction-replay-DUBbsfku.d.mts → openai-responses-compaction-replay-CNHk6k53.d.mts} +4 -4
- package/dist/{openai-responses-contracts-gnl6ZRs1.d.mts → openai-responses-contracts-BXMcvO7F.d.mts} +4 -10
- package/dist/{openai-responses-contracts-DCG51Us0.mjs → openai-responses-contracts-xU-n9AJJ.mjs} +36 -37
- package/dist/{openai-responses-endpoint-JbBT8IDv.mjs → openai-responses-endpoint-DCkURKS0.mjs} +55 -8
- package/dist/{openai-responses-payload-policy-BzM52TTH.d.mts → openai-responses-payload-policy-DyE30gdD.d.mts} +7 -7
- package/dist/{openai-responses-request-lifecycle-DuMpdA6y.mjs → openai-responses-request-lifecycle-o-ODC_rF.mjs} +12 -26
- package/dist/{openai-responses-shared-CNfHudFg.mjs → openai-responses-shared-CrFDkZ0N.mjs} +637 -389
- package/dist/{openai-responses-terminal-usage-CpVjkqn-.d.mts → openai-responses-terminal-usage-D7IhRA6i.d.mts} +9 -3
- package/dist/{openai-tool-schema-CGhEl7ao.mjs → openai-tool-schema-CsoYgnWy.mjs} +97 -122
- package/dist/otel-D-BkX8bB.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-Bo8GzTGX.d.mts → provider-options-Mo8NM5d1.d.mts} +15 -4
- package/dist/{provider-replay-context-BC23HyZo.mjs → provider-replay-context-xyU7-CiT.mjs} +2 -2
- package/dist/provider-transcript-transform-BHq3Q4nc.mjs +32 -0
- package/dist/{provider-transport-turn-state-B11rmZpv.mjs → provider-transport-turn-state-DQd9K4Pd.mjs} +3 -3
- package/dist/{provider-types-ODq57rG_.d.mts → provider-types-B1e98js5.d.mts} +6 -4
- package/dist/provider-types.d.mts +7 -6
- package/dist/provider-types.mjs +2 -1
- 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-DnHBlFS2.d.mts +45 -0
- 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-BdJJbzZk.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-DQqGjhbq.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-B9f7K_Xe.mjs +582 -0
- package/dist/{tool-schema-json-projection-Cvq69Ajp.mjs → tool-schema-json-projection-BQpiJlXJ.mjs} +53 -69
- package/dist/{transport-stream-shared-DdnJGEj0.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-CcCAuFVS.mjs → transport-utils-Da_39MYi.mjs} +23 -38
- package/dist/transports.d.mts +39 -38
- package/dist/transports.mjs +214 -295
- 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-B54Ts1tV.mjs +0 -221
- package/dist/assistant-output-DbgdWAhJ.mjs +0 -47
- package/dist/event-stream-CDpFza-M.d.mts +0 -1
- package/dist/index-DSprYWaz.d.mts +0 -185
- package/dist/mistral-C_ImzxlK.mjs +0 -512
- package/dist/model-request-body-BD5vy4rP.d.mts +0 -17
- package/dist/openai-responses-Cp2QPq7K.mjs +0 -87
- package/dist/retry-after-sw-XX8aC.d.mts +0 -15
- package/dist/types-CBJthzJX.d.mts +0 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024 Mistral AI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under 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 };
|