@zergai/ztc 0.4.0-beta.1 → 0.4.1-dev.36919234045

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.
Files changed (92) hide show
  1. package/README.md +8 -1
  2. package/THIRD_PARTY_NOTICES.md +4 -0
  3. package/dist/App.js +2 -2
  4. package/dist/agent/agent.js +41 -5
  5. package/dist/agent/backends/anthropic.js +5 -10
  6. package/dist/agent/backends/gemini.js +2 -0
  7. package/dist/agent/backends/index.d.ts +1 -0
  8. package/dist/agent/backends/index.js +10 -1
  9. package/dist/agent/backends/openai.d.ts +0 -6
  10. package/dist/agent/backends/openai.js +5 -2
  11. package/dist/agent/backends/openai_compatible.d.ts +2 -0
  12. package/dist/agent/backends/openai_compatible.js +18 -8
  13. package/dist/agent/backends/provider_ids.d.ts +1 -0
  14. package/dist/agent/backends/provider_ids.js +4 -0
  15. package/dist/agent/backends/types.d.ts +1 -0
  16. package/dist/agent/backends/zrouter_stream.d.ts +5 -1
  17. package/dist/agent/backends/zrouter_stream.js +141 -37
  18. package/dist/agent/commands/compact.js +6 -5
  19. package/dist/agent/commands/config.js +4 -1
  20. package/dist/agent/commands/context.js +6 -1
  21. package/dist/agent/commands/effort.js +14 -6
  22. package/dist/agent/commands/model.js +12 -2
  23. package/dist/agent/commands/profile.js +21 -2
  24. package/dist/agent/commands/provider_selection.js +14 -1
  25. package/dist/agent/commands/settings.js +45 -7
  26. package/dist/agent/commands/types.d.ts +19 -0
  27. package/dist/agent/factory.js +14 -68
  28. package/dist/agent/subagent.d.ts +0 -10
  29. package/dist/agent/subagent.js +22 -0
  30. package/dist/agent/tool_response_store.d.ts +1 -1
  31. package/dist/agent/tool_response_store.js +4 -2
  32. package/dist/agent/tools/pane.d.ts +0 -7
  33. package/dist/agent/tools/pane.js +5 -4
  34. package/dist/app/command_context.js +33 -10
  35. package/dist/app/model_catalog_cache.d.ts +5 -0
  36. package/dist/app/model_catalog_cache.js +138 -0
  37. package/dist/app/restart.d.ts +1 -1
  38. package/dist/app/restart.js +16 -5
  39. package/dist/app/selection_completion.d.ts +17 -2
  40. package/dist/app/selection_completion.js +74 -6
  41. package/dist/app/session_manager.js +13 -8
  42. package/dist/cli_args.js +2 -16
  43. package/dist/cli_main.js +25 -6
  44. package/dist/cli_ratatui.js +70 -33
  45. package/dist/config/defaults.d.ts +2 -1
  46. package/dist/config/defaults.js +9 -2
  47. package/dist/config/resolved.d.ts +2 -2
  48. package/dist/config.d.ts +35 -3
  49. package/dist/config.js +227 -29
  50. package/dist/headless.js +2 -0
  51. package/dist/onboarding/first_run.js +5 -1
  52. package/dist/panes/model_catalog.d.ts +3 -3
  53. package/dist/panes/model_catalog.js +28 -4
  54. package/dist/panes/pane_registry.js +6 -2
  55. package/dist/panes/types.d.ts +2 -0
  56. package/dist/panes/ztc_launch.js +12 -0
  57. package/dist/session.d.ts +6 -2
  58. package/dist/session.js +65 -10
  59. package/dist/ui/views/completion_menu.js +10 -5
  60. package/dist/ui/views/status_bar.js +9 -5
  61. package/dist/ui/widgets/resume_panel.d.ts +2 -0
  62. package/dist/ui/widgets/resume_panel.js +17 -15
  63. package/dist/utils/compaction.d.ts +1 -1
  64. package/dist/utils/compaction.js +2 -2
  65. package/dist/utils/context.d.ts +4 -4
  66. package/dist/utils/context.js +14 -12
  67. package/dist/utils/deepseek.d.ts +2 -2
  68. package/dist/utils/deepseek.js +13 -5
  69. package/dist/utils/model_cache.d.ts +15 -0
  70. package/dist/utils/model_cache.js +143 -0
  71. package/dist/utils/models.d.ts +4 -2
  72. package/dist/utils/models.js +12 -16
  73. package/dist/utils/reasoning.d.ts +8 -1
  74. package/dist/utils/reasoning.js +31 -11
  75. package/dist/utils/router_catalog.d.ts +47 -0
  76. package/dist/utils/router_catalog.js +222 -0
  77. package/dist/zlm-embed.mjs +1180 -514
  78. package/node_modules/@zerg/model-contracts/LICENSE.md +375 -0
  79. package/node_modules/@zerg/model-contracts/README.md +78 -0
  80. package/node_modules/@zerg/model-contracts/index.d.ts +18 -0
  81. package/node_modules/@zerg/model-contracts/index.js +220 -0
  82. package/node_modules/@zerg/model-contracts/package.json +8 -0
  83. package/node_modules/glob/node_modules/brace-expansion/index.js +78 -22
  84. package/node_modules/glob/node_modules/brace-expansion/package.json +1 -1
  85. package/node_modules/readdir-glob/node_modules/brace-expansion/index.js +78 -22
  86. package/node_modules/readdir-glob/node_modules/brace-expansion/package.json +1 -1
  87. package/package.json +9 -6
  88. package/packages/model-contracts/LICENSE.md +375 -0
  89. package/packages/model-contracts/README.md +78 -0
  90. package/packages/model-contracts/index.d.ts +18 -0
  91. package/packages/model-contracts/index.js +220 -0
  92. package/packages/model-contracts/package.json +8 -0
@@ -0,0 +1,375 @@
1
+ # Zerg Source Available License 1.0
2
+
3
+ Copyright (c) 2026 Epoch AI, Inc. d/b/a Zerg AI. All rights reserved.
4
+
5
+ This Zerg Source Available License 1.0 (the "License") is an agreement between
6
+ Epoch AI, Inc. d/b/a Zerg AI (the "Licensor") and each person or organization
7
+ that exercises a permission stated in this License ("You"). By installing,
8
+ using, reproducing, modifying, or distributing the Licensed Work under a
9
+ permission in this License, You accept all of its terms. If You do not accept
10
+ them, You may not exercise those permissions.
11
+
12
+ The limitations in Sections 2 through 5 and the notice, source-availability,
13
+ and redistribution requirements in Section 4 are express conditions of every
14
+ copyright license granted under this License. The limitations in Sections 2
15
+ through 5 are also conditions of the patent license in Section 7. Other terms
16
+ of this License are contractual obligations where applicable law permits.
17
+
18
+ This is a source-available license, not an open-source license. It permits
19
+ evaluation and specified personal, educational, research, and nonprofit use.
20
+ Commercial development, commercial or governmental operations, and other uses
21
+ identified in Section 5 require a separate signed agreement with the Licensor.
22
+
23
+ ## 1. Definitions
24
+
25
+ **Licensed Work** means the source code, object code, executable files,
26
+ documentation, and other first-party materials that a NOTICE file or package
27
+ metadata identifies as covered by this License. It includes portions of the
28
+ Licensed Work contained in Your Modifications and derivative portions in which
29
+ the Licensor owns copyright. It does not include Third-Party Materials, Your
30
+ Input, Your Output, or Your original contributions to Your Modifications.
31
+
32
+ **Your Modifications** means additions to or changes of the Licensed Work that
33
+ You create. The term does not alter ownership of either the Licensed Work or
34
+ Your original contributions.
35
+
36
+ **Input** means prompts, source code, specifications, credentials, data, and
37
+ other materials that You or Your Authorized Users supply to the Licensed Work.
38
+
39
+ **Output** means code, files, patches, text, plans, and other material generated
40
+ through operation of the Licensed Work. Output excludes any portion of the
41
+ Licensed Work or Third-Party Materials reproduced in that material. Output is
42
+ not part of the Licensed Work solely because the Licensed Work generated it.
43
+
44
+ **Evaluation Use** means installing, running, testing, benchmarking, reviewing,
45
+ and modifying the Licensed Work solely to evaluate its capabilities or to
46
+ determine whether to enter into a commercial license with the Licensor.
47
+ Evaluation Use may include a temporary proof of concept, provided neither the
48
+ Licensed Work, the proof of concept, nor any Output from it is used to develop,
49
+ maintain, test, secure, operate, or support an ongoing internal function,
50
+ commercial product, customer deliverable, or production system. Recurring
51
+ productive work is not Evaluation Use, even if the Licensed Work runs only on a
52
+ developer laptop, test environment, or continuous-integration system.
53
+
54
+ **Commercial Use** means use that is undertaken by or for a for-profit entity,
55
+ for monetary compensation, for a customer or client, to support an internal
56
+ business function, to generate revenue, or to obtain a direct commercial
57
+ advantage. Use of the Licensed Work to design, create, modify, test, maintain,
58
+ secure, or support software or other work used by or for a for-profit entity is
59
+ Commercial Use, regardless of whether the Licensed Work itself is installed or
60
+ executed in a production environment.
61
+
62
+ **Noncommercial** means an activity that is not Commercial Use. Incidental
63
+ reputational benefit, resume or résumé use, donations, grants, sponsorships,
64
+ awards, or prizes do not alone make an otherwise qualifying activity
65
+ commercial, provided no for-profit entity directs the activity, receives its
66
+ work product, or obtains a material commercial benefit from it. A project must
67
+ obtain a commercial license before it begins Commercial Use or commercialization.
68
+
69
+ **Qualifying Mission Organization** means a nonprofit organization recognized
70
+ as nonprofit or tax-exempt in its jurisdiction, an accredited educational
71
+ institution, or a nonprofit, public, or educational research institution. It
72
+ includes a public educational institution solely for teaching or Noncommercial
73
+ academic research. It does not include a for-profit entity or an organization
74
+ acting primarily for the commercial benefit of another person. A governmental
75
+ or government-controlled organization qualifies only for the public educational
76
+ use stated in this definition and not for governmental administration,
77
+ public-service operations, defense, law enforcement, regulatory functions, or
78
+ delivery of an operational government service.
79
+
80
+ **Competing General-Purpose Platform** means a product or service made available
81
+ to third parties whose principal marketed function is to provide an embeddable,
82
+ general-purpose autonomous coding-agent runtime or framework substantially
83
+ similar to the core functionality of the Licensed Work. Research papers,
84
+ benchmarks, interoperability layers, plugins, and domain-specific end-user
85
+ applications are not Competing General-Purpose Platforms merely because they
86
+ study, interoperate with, extend, or invoke the Licensed Work.
87
+
88
+ **Corresponding Source** means the preferred form of the modified portions of
89
+ the Licensed Work for making modifications, together with scripts and files
90
+ reasonably necessary to build and install those modified portions. It does not
91
+ include source code for a separate work that is not part of the Licensed Work.
92
+
93
+ **Authorized Users** means, when You are an organization, Your employees and
94
+ individual contractors who act on Your behalf, under Your control, and subject
95
+ to obligations at least as protective of the Licensed Work as this License.
96
+ "You" does not include a parent, subsidiary, affiliate, customer, or other
97
+ entity unless a separate signed agreement expressly includes it.
98
+
99
+ **Control** means ownership of substantially all assets of an entity or the
100
+ direct or indirect power to direct its management and policies by ownership,
101
+ vote, contract, or otherwise.
102
+
103
+ **Third-Party Materials** means materials governed by terms other than this
104
+ License, including dependencies and separately identified code or content.
105
+
106
+ ## 2. Copyright License for Evaluation Use
107
+
108
+ Subject to this License, the Licensor grants You a worldwide, royalty-free,
109
+ non-exclusive, non-sublicensable, and non-transferable copyright license to
110
+ use, reproduce, display, perform, and modify the Licensed Work solely for
111
+ Evaluation Use. An organization may exercise this permission through its
112
+ Authorized Users, including when the organization is for-profit.
113
+
114
+ This permission does not authorize ongoing engineering or other productive
115
+ work for an organization. Personal, educational, research, and nonprofit uses
116
+ that go beyond Evaluation Use are governed by Section 3, not this section.
117
+
118
+ ## 3. Permitted Noncommercial Use
119
+
120
+ Subject to this License, the Licensor grants the following additional
121
+ worldwide, royalty-free, non-exclusive, non-sublicensable, and non-transferable
122
+ copyright permissions:
123
+
124
+ 1. An individual may use and modify the Licensed Work for that individual's
125
+ personal, hobby, educational, or other Noncommercial purposes, provided the
126
+ use is not performed for an employer, customer, client, or other organization.
127
+ 2. A Qualifying Mission Organization may use and modify the Licensed Work solely
128
+ to carry out its nonprofit, educational, or Noncommercial research mission,
129
+ provided the use is not a paid service or paid client engagement, does not
130
+ primarily benefit a for-profit entity, and is not a Competing
131
+ General-Purpose Platform.
132
+
133
+ The incidental benefits listed in the Noncommercial definition do not end these
134
+ permissions. A later commercialization does not retroactively change earlier
135
+ compliant use, but a commercial license is required before Commercial Use begins.
136
+
137
+ These permissions do not extend to governmental operational use. Public
138
+ educational institutions qualify only for the teaching and Noncommercial
139
+ academic-research uses stated in Section 1.
140
+
141
+ ## 4. Noncommercial Redistribution and Limited Excerpts
142
+
143
+ Subject to this License, You may reproduce and distribute unmodified or
144
+ modified copies of the Licensed Work in source or object form only when all of
145
+ the following conditions are met:
146
+
147
+ 1. the distribution itself is Noncommercial and is not part of a paid product,
148
+ service, engagement, managed service, or transaction for commercial advantage;
149
+ 2. each copy includes this same unmodified License and no additional term that
150
+ restricts or expands the permissions stated here;
151
+ 3. You conspicuously preserve this License, all copyright and attribution
152
+ notices, the NOTICE file, and applicable third-party notices;
153
+ 4. You state prominently that You modified the Licensed Work, if applicable,
154
+ and do not imply that the Licensor created, endorses, or supports Your changes;
155
+ 5. recipients of a modified object-code distribution receive access to the
156
+ Corresponding Source on the same Noncommercial terms and without a fee beyond
157
+ reasonable reproduction or transfer costs; and
158
+ 6. the distribution is not a Competing General-Purpose Platform.
159
+
160
+ Use of an otherwise qualifying public package registry or mirror does not by
161
+ itself make a distribution commercial merely because the registry or mirror is
162
+ operated by a for-profit entity. This does not permit a paid marketplace
163
+ listing, paid bundle, or other Commercial Use of the Licensed Work.
164
+
165
+ Each recipient receives the permissions in this License directly from the
166
+ Licensor, subject to the recipient accepting and complying with this License.
167
+ You do not grant a sublicense.
168
+
169
+ The Licensor additionally grants You permission to reproduce reasonable,
170
+ non-substantial excerpts of the documentation and individual pieces of example
171
+ code in truthful reviews, tutorials, interoperability materials, or separate
172
+ works, including commercial materials, provided You preserve attribution where
173
+ practicable and do not reproduce a substantial portion or core implementation
174
+ of the Licensed Work. This limited permission does not authorize a Competing
175
+ General-Purpose Platform or copying other Licensed Work code.
176
+
177
+ ## 5. Uses Requiring a Commercial License
178
+
179
+ Except as expressly permitted in Sections 2 through 4, and unless the Licensor
180
+ grants the applicable rights in a separate signed agreement, You may not use,
181
+ reproduce, modify, distribute, or make the Licensed Work available for:
182
+
183
+ 1. any Commercial Use, including ongoing software development, testing,
184
+ maintenance, security, or support by or for a for-profit entity;
185
+ 2. internal business operations, including engineering, security, support,
186
+ sales, finance, human-resources, analytics, or administrative work;
187
+ 3. a customer-facing product or service, paid client work, consulting,
188
+ contracting, or professional services;
189
+ 4. a hosted, managed, outsourced, or software-as-a-service offering;
190
+ 5. commercial redistribution, resale, bundling, OEM distribution, or inclusion
191
+ in a paid product, service, marketplace listing, or customer deliverable;
192
+ 6. operational use by or for a government, governmental agency,
193
+ government-controlled entity, or government contractor performing a
194
+ governmental function; or
195
+ 7. developing, operating, distributing, or offering a Competing
196
+ General-Purpose Platform.
197
+
198
+ Generating, obtaining, or using Output in connection with a commercial product,
199
+ internal business function, paid service, customer engagement, or other
200
+ Commercial Use requires a commercial license. This is a condition on the
201
+ license to operate the Licensed Work for that workflow; it does not make Output
202
+ part of the Licensed Work or assert copyright ownership in Output.
203
+
204
+ The list above clarifies, but does not limit, the rule that Commercial Use and
205
+ non-qualifying operational use require a separate signed agreement.
206
+
207
+ ## 6. Commercial Agreements and Existing Rights
208
+
209
+ Only a separate written agreement signed by an authorized representative of the
210
+ Licensor can grant Commercial Use, governmental operational use, or other rights
211
+ not expressly granted by this License. A purchase order, email, public price,
212
+ website statement, delivery, access, possession, support, acceptance, payment
213
+ for services, custom integration, or `COMMERCIAL-LICENSING.md` file does not
214
+ grant additional rights by implication, estoppel, or otherwise.
215
+
216
+ If a signed commercial agreement specifically governs the Licensed Work, that
217
+ agreement controls the scope, term, and termination of the commercial rights it
218
+ grants. This public License does not expand those commercial rights. Nothing in
219
+ this License retroactively changes rights previously granted under another
220
+ agreement or under a license that accompanied an earlier package version.
221
+
222
+ For commercial licensing inquiries, contact licensing@zergai.com.
223
+
224
+ ## 7. Limited Patent License and Patent Defense
225
+
226
+ Subject to this License, the Licensor grants You a worldwide, royalty-free,
227
+ non-exclusive, non-sublicensable, and non-transferable patent license, only to
228
+ the extent necessary to exercise the permissions expressly granted by this
229
+ License, under patent claims the Licensor can license that would necessarily be
230
+ infringed by using the unmodified Licensed Work as the Licensor distributed it.
231
+ This patent license does not cover claims caused by Your Modifications, Output,
232
+ or combinations with other technology, and it grants no right for a use that
233
+ Section 5 reserves for a commercial agreement.
234
+
235
+ If You or an entity that Controls, is Controlled by, or is under common Control
236
+ with You makes a written patent claim alleging that the Licensed Work infringes
237
+ or contributes to infringement, the patent license granted by this section
238
+ terminates immediately. No patent rights are granted by implication or estoppel
239
+ beyond the express license in this section.
240
+
241
+ ## 8. No Trademark License
242
+
243
+ This License does not grant permission to use the names, trademarks, service
244
+ marks, logos, or trade dress of the Licensor or its affiliates, except to make
245
+ truthful factual statements identifying the origin of the Licensed Work and to
246
+ preserve required notices. You may not suggest sponsorship, endorsement, or
247
+ affiliation without prior written permission.
248
+
249
+ ## 9. Ownership, Modifications, Input, Output, and Feedback
250
+
251
+ The Licensor and its licensors retain all right, title, and interest in the
252
+ Licensed Work and all Licensor technology embodied in Your Modifications,
253
+ except for the limited permissions expressly granted by this License. You retain
254
+ ownership of Your original contributions to Your Modifications, subject to the
255
+ conditions and restrictions of this License. No ownership transfers merely
256
+ because You create or distribute a modification.
257
+
258
+ A separate work does not become part of the Licensed Work solely because it
259
+ communicates with the Licensed Work through documented interfaces, imports the
260
+ Licensed Work as a dependency, or is distributed alongside it. This sentence
261
+ does not grant permission to copy code from the Licensed Work into that separate
262
+ work.
263
+
264
+ As between You and the Licensor, the Licensor does not claim ownership of Your
265
+ Input or Output. This statement does not grant rights in Third-Party Materials
266
+ or in any Licensed Work reproduced in Output, and it does not change the
267
+ commercial-workflow condition in Section 5.
268
+
269
+ If You voluntarily provide suggestions or feedback about the Licensed Work,
270
+ You grant the Licensor a worldwide, perpetual, irrevocable, royalty-free right
271
+ to use that feedback without restriction or obligation to You. Feedback does
272
+ not include Your Confidential Information, personal data, Input, Output, or
273
+ source-code contributions submitted under a separate contribution agreement.
274
+
275
+ ## 10. Third-Party Materials and Other Legal Rights
276
+
277
+ Third-Party Materials remain subject to their respective terms, as identified
278
+ in applicable third-party notices or distributions. This License does not
279
+ reduce, replace, or expand rights granted for Third-Party Materials.
280
+
281
+ This License does not restrict any right You have under applicable law without
282
+ a license, including fair use, fair dealing, or another statutory exception.
283
+
284
+ ## 11. Compliance, Certification, and Termination
285
+
286
+ You are responsible for ensuring that Your use complies with this License. If
287
+ You are an organization or redistribute the Licensed Work, the Licensor may, no
288
+ more than once in any twelve-month period and on reasonable written notice,
289
+ request a written certification reasonably describing the basis on which Your
290
+ use or redistribution qualifies under Sections 2 through 4. The Licensor may
291
+ make such a request of an individual using solely under Section 3(1) only when
292
+ it has a reasonable, documented basis to suspect a material breach.
293
+
294
+ A certification request may not require disclosure of privileged information,
295
+ personal data, unrelated source code, or third-party confidential information.
296
+ The Licensor must keep nonpublic information received in a certification
297
+ confidential and use it only to evaluate compliance or enforce this License,
298
+ except as disclosure is required by law.
299
+
300
+ Any exercise outside the scope of the copyright or patent licenses in this
301
+ License is unlicensed. Your rights under this License terminate automatically
302
+ when You materially breach it. If this is Your first breach of this License for
303
+ the applicable package identified in its NOTICE, and the breach is curable,
304
+ Your rights are reinstated automatically and reinstated retroactively to the
305
+ date of termination when You fully cure the breach within 30 days after
306
+ receiving written notice from the Licensor.
307
+
308
+ A later breach for that applicable package, an uncured breach, or a breach that
309
+ cannot be cured may be reinstated only in a writing signed by the Licensor. Upon
310
+ termination, You must stop all use and distribution and delete copies in Your
311
+ possession or control, except copies retained solely as required by law and not
312
+ used for any other purpose. Sections that by their nature should survive
313
+ termination, including Sections 6 through 15, survive.
314
+
315
+ ## 12. Disclaimer of Warranties
316
+
317
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE LICENSED WORK IS PROVIDED "AS IS"
318
+ AND "AS AVAILABLE," WITH ALL FAULTS AND WITHOUT WARRANTIES OR CONDITIONS OF
319
+ ANY KIND. THE LICENSOR DISCLAIMS ALL EXPRESS, IMPLIED, AND STATUTORY WARRANTIES
320
+ AND CONDITIONS, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
321
+ TITLE, NONINFRINGEMENT, ACCURACY, SECURITY, AND WARRANTIES ARISING FROM COURSE
322
+ OF DEALING OR USAGE OF TRADE. YOU BEAR ALL RISK ARISING FROM USE OF THE LICENSED
323
+ WORK.
324
+
325
+ ## 13. Limitation of Liability
326
+
327
+ TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE LICENSOR AND ITS AFFILIATES,
328
+ DIRECTORS, OFFICERS, EMPLOYEES, CONTRACTORS, AND LICENSORS WILL NOT BE LIABLE
329
+ FOR ANY INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
330
+ DAMAGES, OR FOR LOST PROFITS, REVENUE, DATA, GOODWILL, OR BUSINESS
331
+ INTERRUPTION, ARISING OUT OF OR RELATED TO THE LICENSED WORK OR THIS LICENSE,
332
+ UNDER ANY THEORY OF LIABILITY, EVEN IF ADVISED OF THE POSSIBILITY. THEIR TOTAL
333
+ AGGREGATE LIABILITY ARISING OUT OF OR RELATED TO THE LICENSED WORK OR THIS
334
+ LICENSE WILL NOT EXCEED ONE HUNDRED U.S. DOLLARS (US $100). THESE LIMITATIONS
335
+ APPLY TO THE MAXIMUM EXTENT PERMITTED BY LAW.
336
+
337
+ ## 14. Governing Law and Venue
338
+
339
+ This License is governed by the laws of the State of Delaware, excluding its
340
+ conflict-of-laws rules. Except as stated below, the state and federal courts
341
+ located in Delaware have exclusive jurisdiction over a dispute arising out of
342
+ or related to this License or the Licensed Work, and You consent to their
343
+ personal jurisdiction and venue.
344
+
345
+ The Licensor may bring an action for infringement or misappropriation, or seek
346
+ provisional or injunctive relief, in any court having jurisdiction. Nothing in
347
+ this section requires a consumer to waive a forum, remedy, or protection that
348
+ applicable law does not permit the consumer to waive. The United Nations
349
+ Convention on Contracts for the International Sale of Goods does not apply.
350
+
351
+ ## 15. General Terms and Version Stewardship
352
+
353
+ You may not assign or transfer this License or any right under it without the
354
+ Licensor's prior written consent. The Licensor may assign this License in
355
+ connection with a merger, reorganization, sale of assets, or by operation of
356
+ law. If any provision is unenforceable, it will be modified only to the minimum
357
+ extent necessary to make it enforceable, and the remaining provisions will
358
+ remain in effect. A waiver must be in writing and signed by the party granting
359
+ it. Headings are for convenience only.
360
+
361
+ This License is the entire agreement governing the public source-available
362
+ permissions for the Licensed Work, but a signed commercial agreement may govern
363
+ the rights it expressly covers as stated in Section 6. The terms applicable to
364
+ a released version are irrevocable by the Licensor and will not be changed for
365
+ that version, except that a licensee's permissions may terminate as expressly
366
+ provided in Section 11. There is no change date, conversion date, or automatic
367
+ transition to another license.
368
+
369
+ The Licensor may release future versions of the Licensed Work under different
370
+ terms and may publish revised license texts under distinct version numbers.
371
+ Doing so does not alter the terms applicable to a version already received.
372
+ You may reproduce the unmodified text of this License to identify the terms
373
+ applicable to the Licensed Work. You may not publish a modified license using
374
+ the name "Zerg Source Available License" or imply that the Licensor approved a
375
+ modified license text without the Licensor's written permission.
@@ -0,0 +1,78 @@
1
+ # Provider model contracts
2
+
3
+ This dependency-free package owns optional model controls for ZTC and
4
+ ZergRouter. Provider adapters own API syntax. Exact model entries own which
5
+ controls are effective. Provider membership alone does not prove a thinking
6
+ toggle, depth tier, output limit, or fallback contract.
7
+
8
+ ZTC's effort picker and `/effort` use `modelContract`. Hosted Router settings
9
+ validation, catalog capabilities, route normalization, and dispatch use the
10
+ same data. A model without a reviewed contract has no optional controls. It
11
+ can still run with its provider default when the catalog admits it. Media and
12
+ embedding providers never acquire reasoning controls through a model name.
13
+
14
+ The Router chat envelope uses `reasoning_effort`. Each hosted attempt discards
15
+ inherited native reasoning fields and rebuilds the selection from persisted
16
+ thread settings. Translation happens at the provider boundary:
17
+
18
+ | Provider | Native reasoning controls |
19
+ | --- | --- |
20
+ | OpenAI | Chat `reasoning_effort`; direct Responses `reasoning.effort` |
21
+ | Codex | Existing app-server effort contract |
22
+ | Fireworks | `reasoning_effort`; never combined with `thinking` |
23
+ | DeepSeek | `thinking.type`, plus `reasoning_effort` when enabled |
24
+ | Anthropic | `output_config.effort` |
25
+ | Gemini 2.5 | `generationConfig.thinkingConfig.thinkingBudget` |
26
+ | Gemini 3 | `generationConfig.thinkingConfig.thinkingLevel` |
27
+ | Kimi | Exact K3 depth ladder; no invented depth control for K2.6 |
28
+ | Z.AI | `thinking.type`; graded effort only on reviewed GLM 5.2+ models |
29
+ | Cohere | `thinking.type` on Command A Reasoning |
30
+ | Modal | Reviewed endpoint-specific `reasoning_effort` contracts |
31
+ | Self-hosted, custom compatible | No inferred controls for unknown endpoints |
32
+ | Voyage, ElevenLabs, Replicate, Fal, TypeSafe | No chat reasoning controls |
33
+
34
+ Gemini 2.5 low/medium/high are ZTC budget presets, not vendor named levels:
35
+ 1,024 / 8,192 / 24,576 tokens (32,768 for Pro high). `none` sets zero only
36
+ where the model permits it. Existing hosted output caps remain conservative;
37
+ they are Router policy, not a claim that every cap is the vendor's maximum.
38
+
39
+ GPT-5.4 and newer reviewed OpenAI models expose only `none` on Chat tool
40
+ requests. Direct OpenAI uses the existing Responses backend for graded effort
41
+ with tools. The capability projection follows the resolved authentication route,
42
+ including auto mode. An incompatible explicit Chat grade fails before dispatch.
43
+
44
+ Fireworks' public Router namespace and direct upstream namespace are separate.
45
+ The package normalizes reviewed IDs without weakening Router's serverless
46
+ allowlist. A direct key can retain its own `accounts/...` deployment ID.
47
+
48
+ ## Evidence and extension
49
+
50
+ Reviewed on September 30, 2026:
51
+
52
+ - [Fireworks chat API](https://docs.fireworks.ai/api-reference/post-chatcompletions)
53
+ and [reasoning guide](https://docs.fireworks.ai/guides/reasoning).
54
+ - [DeepSeek thinking](https://api-docs.deepseek.com/guides/thinking_mode/).
55
+ - [Anthropic effort](https://platform.claude.com/docs/en/build-with-claude/effort).
56
+ - [Gemini thinking](https://ai.google.dev/gemini-api/docs/generate-content/thinking).
57
+ - [OpenAI reasoning](https://developers.openai.com/api/docs/guides/reasoning)
58
+ and [Chat tool limitations](https://developers.openai.com/api/docs/guides/migrate-to-responses).
59
+ - [Z.AI thinking](https://docs.z.ai/guides/capabilities/thinking).
60
+ - [Cohere reasoning](https://docs.cohere.com/v2/docs/reasoning).
61
+ - Kimi K3 and Modal's reviewed contracts retain the existing integration's
62
+ validated endpoint settings. They are not inherited by other hosted models.
63
+
64
+ Bounded live Fireworks probes confirmed thinking-off and thinking-on for
65
+ Ember-1, MiniMax M3, and Nemotron Lightning. These expose only that toggle.
66
+ Inkling accepted `none` but still emitted reasoning, so it exposes no toggle.
67
+ No optional claim is made for an unverified template or unavailable deployment.
68
+
69
+ To add a model, add its exact provider contract and test the public picker,
70
+ settings validation, and captured upstream request. Test unsupported values,
71
+ omission, namespace aliases, and fallback. An HTTP 200 alone does not prove
72
+ that a setting changes inference. Keep provider availability, parameter
73
+ acceptance, observed thinking behavior, and quality evaluation separate.
74
+
75
+ The initial implementation was preceded by failing regression tests in
76
+ `provider-reasoning-contract.test.ts` and `fireworks_reasoning_contract.test.ts`.
77
+ Behavioral and property tests cover contract agreement, provider-native fields,
78
+ namespace idempotence, mutation isolation, and fallback cleanup.
@@ -0,0 +1,18 @@
1
+ export type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'ultra';
2
+ export type ReasoningWireSurface = 'native_api' | 'chat_tools';
3
+ export type ModelContract = {
4
+ reasoningEfforts: readonly ReasoningEffort[];
5
+ chatToolReasoningEfforts?: readonly ReasoningEffort[];
6
+ maxOutputTokens: Readonly<{ min: number; max: number }> | null;
7
+ fallbackRouting: boolean;
8
+ };
9
+ export const CONTRACT_PROVIDERS: readonly string[];
10
+ export function normalizeContractProvider(provider: string): string;
11
+ export function normalizeContractModel(provider: string, model: string): string;
12
+ export function modelContract(provider: string, model: string, surface?: ReasoningWireSurface): ModelContract | undefined;
13
+ /** Native fields for a supported selection. Omission retains the provider default. */
14
+ export function reasoningRequestParams(provider: string, model: string, effort?: string | null): Record<string, unknown>;
15
+ /** Remove controls belonging to the previous attempt and rebuild from trusted settings. */
16
+ export function applyReasoningSettings(body: Record<string, unknown>, provider: string, model: string, effort?: string | null): void;
17
+ /** Fireworks direct-key namespace, separate from Router's public addressing. */
18
+ export function fireworksRequestModel(model: string): string;