@techis/ai-runtime 0.0.0-stage → 0.3.0-rc.16
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/LICENSE +122 -0
- package/README.md +56 -3
- package/THIRD_PARTY_NOTICES +34 -0
- package/dist/adapters/gemini.d.ts +3 -0
- package/dist/adapters/gemini.d.ts.map +1 -0
- package/dist/adapters/gemini.js +85 -0
- package/dist/adapters/gemini.js.map +1 -0
- package/dist/adapters/http.d.ts +21 -0
- package/dist/adapters/http.d.ts.map +1 -0
- package/dist/adapters/http.js +86 -0
- package/dist/adapters/http.js.map +1 -0
- package/dist/adapters/mock.d.ts +40 -0
- package/dist/adapters/mock.d.ts.map +1 -0
- package/dist/adapters/mock.js +48 -0
- package/dist/adapters/mock.js.map +1 -0
- package/dist/adapters/moonshot.d.ts +3 -0
- package/dist/adapters/moonshot.d.ts.map +1 -0
- package/dist/adapters/moonshot.js +46 -0
- package/dist/adapters/moonshot.js.map +1 -0
- package/dist/adapters/openai.d.ts +4 -0
- package/dist/adapters/openai.d.ts.map +1 -0
- package/dist/adapters/openai.js +110 -0
- package/dist/adapters/openai.js.map +1 -0
- package/dist/adapters/registry.d.ts +6 -0
- package/dist/adapters/registry.d.ts.map +1 -0
- package/dist/adapters/registry.js +39 -0
- package/dist/adapters/registry.js.map +1 -0
- package/dist/adapters/types.d.ts +60 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +2 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/adapters/zai.d.ts +27 -0
- package/dist/adapters/zai.d.ts.map +1 -0
- package/dist/adapters/zai.js +111 -0
- package/dist/adapters/zai.js.map +1 -0
- package/dist/bundle-source-factory.d.ts +4 -0
- package/dist/bundle-source-factory.d.ts.map +1 -0
- package/dist/bundle-source-factory.js +5 -0
- package/dist/bundle-source-factory.js.map +1 -0
- package/dist/bundle-source.d.ts +40 -0
- package/dist/bundle-source.d.ts.map +1 -0
- package/dist/bundle-source.js +167 -0
- package/dist/bundle-source.js.map +1 -0
- package/dist/catalog-delivery.d.ts +53 -0
- package/dist/catalog-delivery.d.ts.map +1 -0
- package/dist/catalog-delivery.js +148 -0
- package/dist/catalog-delivery.js.map +1 -0
- package/dist/client.d.ts +33 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +238 -0
- package/dist/client.js.map +1 -0
- package/dist/cost.d.ts +28 -0
- package/dist/cost.d.ts.map +1 -0
- package/dist/cost.js +92 -0
- package/dist/cost.js.map +1 -0
- package/dist/deadline.d.ts +3 -0
- package/dist/deadline.d.ts.map +1 -0
- package/dist/deadline.js +37 -0
- package/dist/deadline.js.map +1 -0
- package/dist/errors.d.ts +64 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +116 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/package-updates.d.ts +24 -0
- package/dist/package-updates.d.ts.map +1 -0
- package/dist/package-updates.js +56 -0
- package/dist/package-updates.js.map +1 -0
- package/dist/reasoning-resolution.d.ts +33 -0
- package/dist/reasoning-resolution.d.ts.map +1 -0
- package/dist/reasoning-resolution.js +89 -0
- package/dist/reasoning-resolution.js.map +1 -0
- package/dist/resolution.d.ts +17 -0
- package/dist/resolution.d.ts.map +1 -0
- package/dist/resolution.js +94 -0
- package/dist/resolution.js.map +1 -0
- package/dist/run.d.ts +45 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +803 -0
- package/dist/run.js.map +1 -0
- package/dist/scoped-source.d.ts +20 -0
- package/dist/scoped-source.d.ts.map +1 -0
- package/dist/scoped-source.js +112 -0
- package/dist/scoped-source.js.map +1 -0
- package/dist/snapshot.d.ts +40 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +234 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/types.d.ts +244 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +9 -0
- package/dist/version.js.map +1 -0
- package/package.json +24 -4
- package/third-party-licenses/ajv-formats@3.0.1/LICENSE +21 -0
- package/third-party-licenses/ajv@8.20.0/LICENSE +22 -0
- package/third-party-licenses/fast-deep-equal@3.1.3/LICENSE +21 -0
- package/third-party-licenses/fast-uri@3.1.7/LICENSE +30 -0
- package/third-party-licenses/json-schema-traverse@1.0.0/LICENSE +21 -0
- package/third-party-licenses/require-from-string@2.0.2/license +21 -0
- package/third-party-licenses/typescript@5.9.3/LICENSE.txt +55 -0
- package/third-party-licenses/typescript@5.9.3/ThirdPartyNoticeText.txt +193 -0
- package/third-party-licenses.json +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# TECHIS Developer Integration License
|
|
2
|
+
|
|
3
|
+
Copyright (c) **2026 TECH-IS INC.** All rights reserved except as expressly granted below.
|
|
4
|
+
|
|
5
|
+
## 1. Parties, scope and acceptance
|
|
6
|
+
|
|
7
|
+
TECH-IS INC. ("TECHIS"), Ontario, Canada, offers this licence to each person or entity exercising its permissions
|
|
8
|
+
("you"). If you act for an entity, you must have authority to bind it. By exercising permissions under this licence,
|
|
9
|
+
you accept its terms. If you do not accept them, this licence grants you no permission to use or distribute the Software.
|
|
10
|
+
|
|
11
|
+
"Software" means only TECHIS-owned material supplied in `@techis/ai-runtime` and `@techis/ai-contracts`, including
|
|
12
|
+
their TECHIS-owned documentation and package-carried catalog data. This licence does not cover Studio, management,
|
|
13
|
+
management-api, advisor, usage, config-ui or unrelated tools. Additional TECHIS packages are not automatically covered.
|
|
14
|
+
"Integrated Application" means your application that incorporates the Software to provide its application functionality,
|
|
15
|
+
rather than offering the Software itself as a standalone package or substitute. Third-party material is governed by section 6.
|
|
16
|
+
|
|
17
|
+
## 2. Ownership and free integration rights
|
|
18
|
+
|
|
19
|
+
TECHIS retains ownership of the Software and its existing intellectual property. You retain ownership of your independently
|
|
20
|
+
created applications and original additions. Integration transfers neither party's underlying ownership to the other.
|
|
21
|
+
|
|
22
|
+
Subject to this licence, TECHIS grants you a worldwide, non-exclusive, royalty-free right to download, install, inspect,
|
|
23
|
+
execute and copy the Software as reasonably necessary to develop, test and operate Integrated Applications, commercially
|
|
24
|
+
or otherwise. No package-use fee or royalty is payable to TECHIS under this grant. Provider inference, API, hosting and
|
|
25
|
+
other external services are separate and may have their own charges and terms; no provider account or service access is granted.
|
|
26
|
+
|
|
27
|
+
The rights for each version you lawfully acquire continue indefinitely unless terminated under section 8. TECHIS may
|
|
28
|
+
offer future versions under different terms; doing so does not retroactively change this licence for previously acquired versions.
|
|
29
|
+
|
|
30
|
+
## 3. Distribution within applications
|
|
31
|
+
|
|
32
|
+
You may distribute copies reasonably necessary to run your Integrated Application, including copies embedded in browser
|
|
33
|
+
JavaScript bundles. You may charge for your application. Make this licence and the Software's copyright, ownership and
|
|
34
|
+
required third-party notices accessible with distributed copies, for example in accompanying files or an application notices view.
|
|
35
|
+
Do not remove those notices from retained source or package files.
|
|
36
|
+
|
|
37
|
+
Each recipient receives directly from TECHIS, subject to this licence, the limited right to install, copy and execute those
|
|
38
|
+
copies as necessary to use the Integrated Application. Recipients may make necessary backup copies. This direct grant does
|
|
39
|
+
not authorize standalone redistribution or further development except where that recipient independently complies with the
|
|
40
|
+
developer permissions in this licence. You may not purport to grant broader rights in TECHIS material or impose terms that
|
|
41
|
+
remove the recipient's direct rights under this licence. Your own application may have separate terms.
|
|
42
|
+
|
|
43
|
+
## 4. Integration and bug-fix changes
|
|
44
|
+
|
|
45
|
+
You may modify the Software for integration or to correct defects. Identify changed files or, where bundling removes file
|
|
46
|
+
boundaries, provide an accessible record identifying the changes. Retain original notices and do not represent that TECHIS
|
|
47
|
+
authored, approved or supports your modifications. You own your original additions, subject to TECHIS's rights in its underlying
|
|
48
|
+
work; no assignment of your intellectual property to TECHIS is required. Distribute modified Software only within the permissions
|
|
49
|
+
of section 3, with the same required notices and without limiting rights in underlying TECHIS material granted by this licence.
|
|
50
|
+
|
|
51
|
+
## 5. Standalone distribution and registry operations
|
|
52
|
+
|
|
53
|
+
Separate written permission from TECHIS is required to republish, relicense or resell the Software as a standalone product,
|
|
54
|
+
including a modified substitute. The application distribution allowed by section 3 is not standalone resale.
|
|
55
|
+
|
|
56
|
+
This restriction does not prohibit npm's hosting and distribution of TECHIS-authorized packages, ordinary package-manager
|
|
57
|
+
installation and caching, or internal build mirrors reasonably necessary for permitted integration. To the extent of its rights,
|
|
58
|
+
TECHIS permits the registry and its service providers to make and deliver the copies necessary for that authorized hosting and
|
|
59
|
+
distribution. This clause does not authorize unrelated public republication or override third-party rights.
|
|
60
|
+
|
|
61
|
+
## 6. Third-party material and external services
|
|
62
|
+
|
|
63
|
+
Third-party software, data and other material remain subject to their own applicable licences and notices. Those independent
|
|
64
|
+
permissions are not restricted by this licence. Preserve their required attribution, copyright and licence notices, including
|
|
65
|
+
when required in redistributed browser bundles. Consult the supplied THIRD_PARTY_NOTICES and accompanying third-party licence
|
|
66
|
+
files. This licence grants no rights in provider brands, accounts or services and makes no promise that a model will remain available.
|
|
67
|
+
|
|
68
|
+
## 7. Patents and branding
|
|
69
|
+
|
|
70
|
+
To the extent TECHIS controls the necessary rights, TECHIS grants a worldwide, non-exclusive, royalty-free licence under patent
|
|
71
|
+
claims necessarily infringed by permitted use of the Software as supplied by TECHIS, solely to exercise the permissions in this
|
|
72
|
+
licence. No grant extends to claims infringed only because of your modifications or combinations with other products. This grant
|
|
73
|
+
does not represent that TECHIS owns any patent or grant third-party patent rights, and includes no assurance of non-infringement.
|
|
74
|
+
|
|
75
|
+
No TECHIS trademark or endorsement rights are granted beyond accurate identification and attribution of the Software. No support,
|
|
76
|
+
service or provider entitlement arises by implication. Rights not expressly granted remain reserved, subject to mandatory law.
|
|
77
|
+
|
|
78
|
+
## 8. Material breach and termination
|
|
79
|
+
|
|
80
|
+
TECHIS may terminate your rights for a material breach that you do not cure within 30 days after receiving written notice
|
|
81
|
+
identifying the breach. Until termination, the other conditions of this licence continue to apply. Following termination,
|
|
82
|
+
stop new use and distribution and remove copies you retain, except archival copies required by law, which may not be used
|
|
83
|
+
for further development or operation.
|
|
84
|
+
|
|
85
|
+
Termination of a developer's rights does not terminate the direct rights of compliant recipients in copies already lawfully
|
|
86
|
+
delivered to them. Those recipients may continue using their Integrated Applications under section 3. Their own material breach
|
|
87
|
+
is separately subject to this section's notice and cure process. Sections addressing ownership, restrictions, third-party rights,
|
|
88
|
+
disclaimers, liability and disputes survive termination to the extent relevant; lawful recipient rights remain as stated above.
|
|
89
|
+
|
|
90
|
+
## 9. Warranty and support
|
|
91
|
+
|
|
92
|
+
To the fullest extent permitted by applicable law, the Software is provided "as is" and "as available", without express,
|
|
93
|
+
implied or statutory warranties, including merchantability, fitness for a particular purpose and non-infringement. TECHIS does
|
|
94
|
+
not promise uninterrupted or error-free operation, continued provider availability, updates or support. You are responsible for
|
|
95
|
+
evaluating suitability for your application. Nothing in this licence excludes a warranty or right that applicable law does not
|
|
96
|
+
permit to be excluded.
|
|
97
|
+
|
|
98
|
+
## 10. Liability
|
|
99
|
+
|
|
100
|
+
To the fullest extent permitted by applicable law, TECHIS is not liable for indirect, incidental, special or consequential
|
|
101
|
+
losses, or lost profits, arising from or relating to the Software or this licence. TECHIS's aggregate liability for direct
|
|
102
|
+
claims arising from or relating to this free Software or this licence will not exceed **CAD 100**, regardless of the theory
|
|
103
|
+
of liability and even if advised of the possibility of loss. These exclusions and limits do not apply to liability that
|
|
104
|
+
applicable law prohibits excluding or limiting. This section does not reduce mandatory rights.
|
|
105
|
+
|
|
106
|
+
## 11. Governing law and disputes
|
|
107
|
+
|
|
108
|
+
This licence is governed by Ontario law and the federal laws of Canada applicable there, subject to mandatory protections
|
|
109
|
+
that cannot be displaced by agreement. Disputes are to be brought in courts of competent jurisdiction in Ontario, except
|
|
110
|
+
where mandatory law requires another forum. No arbitration requirement is imposed.
|
|
111
|
+
|
|
112
|
+
## 12. Notices, permissions and administration
|
|
113
|
+
|
|
114
|
+
Send permission requests and legal notices to TECHIS at **arinze@techinceptions.com**. Written electronic
|
|
115
|
+
communications are permitted. A breach notice must identify the material breach; its cure period begins on receipt,
|
|
116
|
+
not merely on attempted delivery. For notices to you, TECHIS may use contact details you have supplied. This clause does not
|
|
117
|
+
replace any legally required method for service of court documents. No postal address is specified by this licence.
|
|
118
|
+
|
|
119
|
+
Any additional permission or change to this licence for an acquired version requires written authorization from TECHIS.
|
|
120
|
+
Failure to enforce a term on one occasion does not itself waive that term. If a provision cannot lawfully be enforced,
|
|
121
|
+
the remainder continues to the extent it can operate consistently with applicable law. This licence states the permissions
|
|
122
|
+
for the covered TECHIS material; separate third-party licences and separate written agreements retain their own scope.
|
package/README.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @techis/ai-runtime
|
|
2
|
+
|
|
3
|
+
Release 0.3.0-rc.15. Registry installation is available after this version is published.
|
|
4
|
+
|
|
5
|
+
TECHIS AI Runtime executes application-defined AI work through versioned configuration. It resolves a persona to an execution profile, applies model-specific reasoning controls, follows bounded retries and ordered fallbacks, and returns a terminal execution receipt.
|
|
6
|
+
|
|
7
|
+
## Install the approved prerelease
|
|
8
|
+
|
|
9
|
+
Once published:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @techis/ai-runtime@0.3.0-rc.15
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
npm installs the exactly matching `@techis/ai-contracts` dependency automatically. Node.js 20.19 or later is required; qualification used Node.js 24.20.0. This package does not require Studio or the management packages.
|
|
16
|
+
|
|
17
|
+
## Inspect the packaged catalog without a model call
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import { getInstalledCatalogDelivery, RUNTIME_VERSION } from '@techis/ai-runtime';
|
|
21
|
+
|
|
22
|
+
const delivery = getInstalledCatalogDelivery();
|
|
23
|
+
console.log(RUNTIME_VERSION);
|
|
24
|
+
console.log(delivery.release.catalog.models.map(model => model.displayName));
|
|
25
|
+
console.log(delivery.profiles.map(offer => offer.name));
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Catalog inspection does not contact a provider, select a profile or change application configuration. A package update makes its reviewed catalog available; adoption and exact profile selection remain explicit application decisions. Existing captured workflows keep their pinned configuration.
|
|
29
|
+
|
|
30
|
+
## Execute application work
|
|
31
|
+
|
|
32
|
+
Create a client with `createAIClient`, your application/environment identity and a validated configuration source. The source supplies catalog, profiles, personas, assignments and manifest references; a catalog by itself is not a complete execution configuration. Supported sources include an inline snapshot and an exported bundle via `bundleSource({ directory })`. Supply a host-owned credential resolver and appropriate provider access. Capture a workflow or start a run for a configured persona, then call `generate` with your input and operation ID. Exported TypeScript declarations describe configuration and receipt interfaces.
|
|
33
|
+
|
|
34
|
+
The configured profile determines primary/fallback order and independent reasoning settings. Provider availability, entitlements and charges remain the application's responsibility. Do not expose provider credentials in client-side code. Model/API calls are not free merely because runtime use is free.
|
|
35
|
+
|
|
36
|
+
## Caller-owned timing and cancellation
|
|
37
|
+
|
|
38
|
+
Pass a workflow AbortSignal to every generation. Opt in per call with:
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
await run.generate({ input, operationId: 'research.synthesize', signal: workflowSignal,
|
|
42
|
+
execution: { timingPolicy: 'caller', deadlineMs: 300_000 } });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Each call starts its own total budget, including queue waits, credential resolution, attempts, backoff and fallback.
|
|
46
|
+
Set attemptTimeoutMs to add a per-attempt bound; omit it to use the remaining total budget without a hidden 60-second ceiling.
|
|
47
|
+
Omit both timers in caller mode to rely on cancellation and provider/transport limits. Cancellation rejects queued/late work,
|
|
48
|
+
stops HTTP, discards late results and prevents subsequent retry/fallback. Custom transports must honour AbortSignal to stop their own work.
|
|
49
|
+
Omitting timingPolicy retains legacy profile/default timing. No profile identity, history or saved selection is rewritten.
|
|
50
|
+
|
|
51
|
+
## Licensing and notices
|
|
52
|
+
|
|
53
|
+
TECH-IS INC. licenses its material under the included [TECHIS Developer Integration License](LICENSE): free integration,
|
|
54
|
+
including commercial applications, subject to its terms. Third-party dependencies retain their own licences; see
|
|
55
|
+
[THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES) and accompanying full texts. Compiled JavaScript is inspectable.
|
|
56
|
+
Provider/API charges remain separate. Legal and permission enquiries: arinze@techinceptions.com.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
THIRD-PARTY NOTICES
|
|
2
|
+
|
|
3
|
+
The TECHIS Developer Integration License covers only TECHIS-owned material in runtime/contracts. Third-party rights remain independent. These archives do not bundle the dependency implementations. The following full upstream licence texts are included for the locked dependency versions and downstream bundling. Semver ranges can resolve other versions; preserve the notices for the versions actually distributed. TypeScript is a compiler reference only, not a runtime dependency or TECHIS-owned code.
|
|
4
|
+
|
|
5
|
+
ajv@8.20.0 - MIT
|
|
6
|
+
external npm dependency; not bundled in the runtime/contracts archives
|
|
7
|
+
third-party-licenses/ajv@8.20.0/LICENSE
|
|
8
|
+
|
|
9
|
+
fast-deep-equal@3.1.3 - MIT
|
|
10
|
+
external npm dependency; not bundled in the runtime/contracts archives
|
|
11
|
+
third-party-licenses/fast-deep-equal@3.1.3/LICENSE
|
|
12
|
+
|
|
13
|
+
fast-uri@3.1.7 - BSD-3-Clause
|
|
14
|
+
external npm dependency; not bundled in the runtime/contracts archives
|
|
15
|
+
third-party-licenses/fast-uri@3.1.7/LICENSE
|
|
16
|
+
|
|
17
|
+
json-schema-traverse@1.0.0 - MIT
|
|
18
|
+
external npm dependency; not bundled in the runtime/contracts archives
|
|
19
|
+
third-party-licenses/json-schema-traverse@1.0.0/LICENSE
|
|
20
|
+
|
|
21
|
+
require-from-string@2.0.2 - MIT
|
|
22
|
+
external npm dependency; not bundled in the runtime/contracts archives
|
|
23
|
+
third-party-licenses/require-from-string@2.0.2/license
|
|
24
|
+
|
|
25
|
+
ajv-formats@3.0.1 - MIT
|
|
26
|
+
external npm dependency; not bundled in the runtime/contracts archives
|
|
27
|
+
third-party-licenses/ajv-formats@3.0.1/LICENSE
|
|
28
|
+
|
|
29
|
+
typescript@5.9.3 - Apache-2.0
|
|
30
|
+
compiler reference only; not shipped
|
|
31
|
+
third-party-licenses/typescript@5.9.3/LICENSE.txt
|
|
32
|
+
third-party-licenses/typescript@5.9.3/ThirdPartyNoticeText.txt
|
|
33
|
+
|
|
34
|
+
See third-party-licenses.json for exact notice hashes and scope.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../src/adapters/gemini.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmD,eAAe,EAAE,MAAM,YAAY,CAAC;AA0BnG,wBAAgB,kCAAkC,IAAI,eAAe,CAiEpE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { UnsupportedCapabilityError } from "../errors.js";
|
|
2
|
+
import { callProviderHttp } from "./http.js";
|
|
3
|
+
/** Gemini generateContent adapter. thinkingBudget: 0 = disabled, omitted = provider dynamic default. */
|
|
4
|
+
function translate(model, control) {
|
|
5
|
+
switch (control.mode) {
|
|
6
|
+
case "provider-default":
|
|
7
|
+
return {};
|
|
8
|
+
case "disabled":
|
|
9
|
+
return { reasoning: { thinkingConfig: { thinkingBudget: 0 } } };
|
|
10
|
+
case "token-budget":
|
|
11
|
+
return { reasoning: { thinkingConfig: { thinkingBudget: control.budgetTokens } } };
|
|
12
|
+
case "effort":
|
|
13
|
+
case "thinking":
|
|
14
|
+
throw new UnsupportedCapabilityError(`${model.catalogId} exposes token-budget reasoning only on the generateContent protocol`);
|
|
15
|
+
case "combined":
|
|
16
|
+
throw new UnsupportedCapabilityError(`${model.catalogId} cannot combine reasoning controls on the generateContent protocol`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function createGeminiGenerateContentAdapter() {
|
|
20
|
+
return {
|
|
21
|
+
id: "gemini-generate-content",
|
|
22
|
+
version: "0.1.0",
|
|
23
|
+
providers: ["gemini"],
|
|
24
|
+
defaultEndpoint: "https://generativelanguage.googleapis.com/v1beta",
|
|
25
|
+
supportedInputModalities: ["text", "image"],
|
|
26
|
+
supportsStructuredOutput: true,
|
|
27
|
+
translateReasoning: translate,
|
|
28
|
+
async execute(request, fetchImpl) {
|
|
29
|
+
const url = `${request.endpoint.replace(/\/$/, "")}/models/${request.model.providerModelId}:generateContent`;
|
|
30
|
+
let headers = {};
|
|
31
|
+
let query = "";
|
|
32
|
+
if (request.credential.kind === "api-key") {
|
|
33
|
+
headers = { "x-goog-api-key": request.credential.key };
|
|
34
|
+
}
|
|
35
|
+
else if (request.credential.kind === "query-param") {
|
|
36
|
+
query = `?${request.credential.name}=${encodeURIComponent(request.credential.value)}`;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
headers = { "x-goog-api-key": request.credential.token };
|
|
40
|
+
}
|
|
41
|
+
const inputText = typeof request.input === "string" ? request.input : (request.input.text ?? "");
|
|
42
|
+
const images = typeof request.input === "string" ? [] : request.input.images ?? [];
|
|
43
|
+
const parts = [{ text: inputText }];
|
|
44
|
+
for (const image of images) {
|
|
45
|
+
parts.push({ inlineData: { mimeType: image.mimeType, data: image.dataBase64 } });
|
|
46
|
+
}
|
|
47
|
+
const generationConfig = {
|
|
48
|
+
...(request.nativeSettings.reasoning ?? {}),
|
|
49
|
+
...(request.maxOutputTokens !== undefined ? { maxOutputTokens: request.maxOutputTokens } : {}),
|
|
50
|
+
...(request.temperature !== undefined ? { temperature: request.temperature } : {}),
|
|
51
|
+
...(request.outputSchema ? { responseMimeType: "application/json", responseJsonSchema: request.outputSchema } : {})
|
|
52
|
+
};
|
|
53
|
+
const body = {
|
|
54
|
+
systemInstruction: { parts: [{ text: request.systemInstructions }] },
|
|
55
|
+
contents: [{ role: "user", parts }],
|
|
56
|
+
generationConfig
|
|
57
|
+
};
|
|
58
|
+
const raw = await callProviderHttp(fetchImpl, {
|
|
59
|
+
url: `${url}${query}`,
|
|
60
|
+
headers,
|
|
61
|
+
body,
|
|
62
|
+
timeoutMs: request.timeoutMs,
|
|
63
|
+
signal: request.signal,
|
|
64
|
+
description: "gemini-generate-content"
|
|
65
|
+
});
|
|
66
|
+
const response = raw;
|
|
67
|
+
const candidate = response.candidates?.[0];
|
|
68
|
+
if (candidate?.finishReason && candidate.finishReason !== "STOP") {
|
|
69
|
+
return { output: { kind: "refusal", message: `Gemini finishReason: ${candidate.finishReason}` } };
|
|
70
|
+
}
|
|
71
|
+
const text = (candidate?.content?.parts ?? []).filter(part => !part.thought).map((part) => part.text ?? "").join("\n");
|
|
72
|
+
const usage = response.usageMetadata;
|
|
73
|
+
return {
|
|
74
|
+
output: { kind: "text", text },
|
|
75
|
+
usage: usage ? {
|
|
76
|
+
inputTokens: usage.promptTokenCount,
|
|
77
|
+
outputTokens: usage.candidatesTokenCount === undefined ? undefined : usage.candidatesTokenCount + (usage.thoughtsTokenCount ?? 0),
|
|
78
|
+
reasoningTokens: usage.thoughtsTokenCount,
|
|
79
|
+
cachedInputTokens: usage.cachedContentTokenCount
|
|
80
|
+
} : undefined
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../src/adapters/gemini.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,wGAAwG;AACxG,SAAS,SAAS,CAAC,KAAsB,EAAE,OAA+B;IACxE,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,kBAAkB;YACrB,OAAO,EAAE,CAAC;QACZ,KAAK,UAAU;YACb,OAAO,EAAE,SAAS,EAAE,E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a,CAAC;YACrC,OAAO;gBACL,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;gBAC9B,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;oBACb,WAAW,EAAE,KAAK,CAAC,gBAAgB;oBACnC,YAAY,EAAE,KAAK,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,oBAAoB,GAAG,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,CAAC;oBACjI,eAAe,EAAE,KAAK,CAAC,kBAAkB;oBACzC,iBAAiB,EAAE,KAAK,CAAC,uBAAuB;iBACjD,CAAC,CAAC,CAAC,SAAS;aACd,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FetchImpl } from "../types.js";
|
|
2
|
+
export interface HttpCallOptions {
|
|
3
|
+
url: string;
|
|
4
|
+
method?: string;
|
|
5
|
+
headers: Record<string, string>;
|
|
6
|
+
body?: unknown;
|
|
7
|
+
timeoutMs: number;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
/** Short label used in sanitized error messages. */
|
|
10
|
+
description: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Shared provider HTTP wrapper: injectable fetch, single timeout budget combining the
|
|
14
|
+
* caller's signal, and error classification by status/network outcome. Never includes
|
|
15
|
+
* request or response bodies in error messages.
|
|
16
|
+
*/
|
|
17
|
+
export declare function callProviderHttp(fetchImpl: FetchImpl, options: HttpCallOptions): Promise<unknown>;
|
|
18
|
+
export declare function requireCredentialKind(credential: {
|
|
19
|
+
kind: string;
|
|
20
|
+
}, expected: string, description: string): void;
|
|
21
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/adapters/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;CACrB;AAID;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAQvG;AAgED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAI/G"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ProviderCallError } from "../errors.js";
|
|
2
|
+
import { withDeadline } from "../deadline.js";
|
|
3
|
+
const RETRYABLE_4XX = new Set([408, 429]);
|
|
4
|
+
/**
|
|
5
|
+
* Shared provider HTTP wrapper: injectable fetch, single timeout budget combining the
|
|
6
|
+
* caller's signal, and error classification by status/network outcome. Never includes
|
|
7
|
+
* request or response bodies in error messages.
|
|
8
|
+
*/
|
|
9
|
+
export async function callProviderHttp(fetchImpl, options) {
|
|
10
|
+
try {
|
|
11
|
+
return await withDeadline(signal => callProviderHttpWithinDeadline(fetchImpl, options, signal), options.timeoutMs, () => new ProviderCallError("provider-timeout", `${options.description} request deadline exceeded`, true), options.signal);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (options.signal?.aborted)
|
|
15
|
+
throw new ProviderCallError("provider-timeout", `${options.description} aborted by caller`, false);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function callProviderHttpWithinDeadline(fetchImpl, options, signal) {
|
|
20
|
+
let response;
|
|
21
|
+
try {
|
|
22
|
+
if (signal.aborted)
|
|
23
|
+
throw new ProviderCallError("provider-timeout", `${options.description} aborted before dispatch`, false);
|
|
24
|
+
response = await fetchImpl(options.url, {
|
|
25
|
+
method: options.method ?? "POST",
|
|
26
|
+
headers: { "content-type": "application/json", ...options.headers },
|
|
27
|
+
body: options.body === undefined ? undefined : JSON.stringify(options.body),
|
|
28
|
+
signal
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (options.signal?.aborted) {
|
|
33
|
+
throw new ProviderCallError("provider-timeout", `${options.description} aborted by caller`, false);
|
|
34
|
+
}
|
|
35
|
+
if (error instanceof Error && error.name === "TimeoutError") {
|
|
36
|
+
throw new ProviderCallError("provider-timeout", `${options.description} timed out after ${options.timeoutMs}ms`, true);
|
|
37
|
+
}
|
|
38
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
39
|
+
throw new ProviderCallError("provider-timeout", `${options.description} aborted`, false);
|
|
40
|
+
}
|
|
41
|
+
throw new ProviderCallError("network-error", `${options.description} network failure`, true);
|
|
42
|
+
}
|
|
43
|
+
if (response.status === 429) {
|
|
44
|
+
throw new ProviderCallError("provider-rate-limit", `${options.description} rate limited (429)`, true, 429, { retryAfterHeader: response.headers.get("retry-after") ?? undefined });
|
|
45
|
+
}
|
|
46
|
+
if (response.status === 404) {
|
|
47
|
+
// Only an explicit model-unavailability/retirement signal counts as the model being
|
|
48
|
+
// gone (record and move forward). A generic 404 is an endpoint/config problem and is
|
|
49
|
+
// NOT automatically model retirement.
|
|
50
|
+
let bodyText = "";
|
|
51
|
+
try {
|
|
52
|
+
bodyText = await response.text();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
bodyText = "";
|
|
56
|
+
}
|
|
57
|
+
const lower = bodyText.toLowerCase();
|
|
58
|
+
const explicitModelGone = /model_not_found|model_not_found_error|deactivated_model|model_deprecated|model_(does_not_exist|unavailable)/.test(lower.replace(/["\s]/g, "")) ||
|
|
59
|
+
(lower.includes("model") && /(not found|no longer|deactivated|deprecated|retired|does not exist)/.test(lower));
|
|
60
|
+
if (explicitModelGone) {
|
|
61
|
+
throw new ProviderCallError("model-unavailable", `${options.description} reports the model as unavailable or retired`, true, 404);
|
|
62
|
+
}
|
|
63
|
+
throw new ProviderCallError("provider-invalid-request", `${options.description} rejected the request (404)`, false, 404);
|
|
64
|
+
}
|
|
65
|
+
if (RETRYABLE_4XX.has(response.status)) {
|
|
66
|
+
throw new ProviderCallError("provider-timeout", `${options.description} request timeout (${response.status})`, true, response.status);
|
|
67
|
+
}
|
|
68
|
+
if (response.status >= 500) {
|
|
69
|
+
throw new ProviderCallError("provider-server-error", `${options.description} server error (${response.status})`, true, response.status);
|
|
70
|
+
}
|
|
71
|
+
if (!response.ok) {
|
|
72
|
+
throw new ProviderCallError("provider-invalid-request", `${options.description} rejected the request (${response.status})`, false, response.status);
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
return await response.json();
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
throw new ProviderCallError("provider-server-error", `${options.description} returned a non-JSON body`, true, response.status);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export function requireCredentialKind(credential, expected, description) {
|
|
82
|
+
if (credential.kind !== expected) {
|
|
83
|
+
throw new ProviderCallError("provider-invalid-request", `${description} requires a ${expected} credential`, false);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/adapters/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAa9C,MAAM,aAAa,GAAG,IAAI,GAAG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AQ,CAAC,MAAM,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtJ,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,iBAAiB,CAAC,uBAAuB,EAAE,GAAG,OAAO,CAAC,WAAW,2BAA2B,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjI,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,UAA4B,EAAE,QAAgB,EAAE,WAAmB;IACvG,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,iBAAiB,CAAC,0BAA0B,EAAE,GAAG,WAAW,eAAe,QAAQ,aAAa,EAAE,KAAK,CAAC,CAAC;IACrH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { UsageDimensions } from "@techis/ai-contracts";
|
|
2
|
+
import type { ProviderAdapter } from "./types.js";
|
|
3
|
+
export type MockBehavior = {
|
|
4
|
+
outcome: "success";
|
|
5
|
+
text?: string;
|
|
6
|
+
value?: unknown;
|
|
7
|
+
usage?: UsageDimensions;
|
|
8
|
+
latencyMs?: number;
|
|
9
|
+
} | {
|
|
10
|
+
outcome: "error";
|
|
11
|
+
error: "provider-rate-limit" | "provider-timeout" | "provider-server-error" | "provider-invalid-request";
|
|
12
|
+
latencyMs?: number;
|
|
13
|
+
} | {
|
|
14
|
+
outcome: "refusal";
|
|
15
|
+
message: string;
|
|
16
|
+
latencyMs?: number;
|
|
17
|
+
};
|
|
18
|
+
export interface MockStep {
|
|
19
|
+
/** Consume this step only when the executing model's catalogId matches. */
|
|
20
|
+
matchCatalogId?: string;
|
|
21
|
+
behavior: MockBehavior;
|
|
22
|
+
}
|
|
23
|
+
export interface MockAdapterOptions {
|
|
24
|
+
id?: string;
|
|
25
|
+
version?: string;
|
|
26
|
+
/** Provider-hosted tools this mock can carry, e.g. ["web_search"]. */
|
|
27
|
+
supportedProviderTools?: string[];
|
|
28
|
+
steps?: MockStep[];
|
|
29
|
+
/** Behavior once the scripted steps are exhausted; default: echo success. */
|
|
30
|
+
defaultBehavior?: MockBehavior;
|
|
31
|
+
providers?: string[];
|
|
32
|
+
supportedInputModalities?: ("text" | "image" | "audio" | "video")[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Deterministic mock adapter for tests and local development. Participates in the real
|
|
36
|
+
* execution pipeline (attempt accounting, receipts, fallback) so mock evidence is clearly
|
|
37
|
+
* distinguishable from live evidence.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createMockAdapter(options?: MockAdapterOptions): ProviderAdapter;
|
|
40
|
+
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../src/adapters/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2C,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAErG,OAAO,KAAK,EAAmD,eAAe,EAAE,MAAM,YAAY,CAAC;AAEnG,MAAM,MAAM,YAAY,GACpB;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,eAAe,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACnG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,qBAAqB,GAAG,kBAAkB,GAAG,uBAAuB,GAAG,0BAA0B,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAClJ;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,MAAM,WAAW,QAAQ;IACvB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,wBAAwB,CAAC,EAAE,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC;CACrE;AAWD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,eAAe,CAgCnF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ProviderCallError } from "../errors.js";
|
|
2
|
+
const sleep = (ms, signal) => new Promise((resolve, reject) => {
|
|
3
|
+
const timer = setTimeout(resolve, ms);
|
|
4
|
+
signal?.addEventListener("abort", () => {
|
|
5
|
+
clearTimeout(timer);
|
|
6
|
+
reject(new ProviderCallError("provider-timeout", "mock adapter aborted by caller", false));
|
|
7
|
+
}, { once: true });
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Deterministic mock adapter for tests and local development. Participates in the real
|
|
11
|
+
* execution pipeline (attempt accounting, receipts, fallback) so mock evidence is clearly
|
|
12
|
+
* distinguishable from live evidence.
|
|
13
|
+
*/
|
|
14
|
+
export function createMockAdapter(options = {}) {
|
|
15
|
+
// Live reference: steps appended after adapter creation are still consumed.
|
|
16
|
+
const steps = options.steps ?? [];
|
|
17
|
+
const id = options.id ?? "mock-chat";
|
|
18
|
+
return {
|
|
19
|
+
id,
|
|
20
|
+
version: options.version ?? "0.1.0",
|
|
21
|
+
providers: (options.providers ?? ["mock"]),
|
|
22
|
+
defaultEndpoint: "mock://local",
|
|
23
|
+
supportedInputModalities: options.supportedInputModalities ?? ["text", "image"],
|
|
24
|
+
supportedProviderTools: options.supportedProviderTools ?? [],
|
|
25
|
+
supportsStructuredOutput: true,
|
|
26
|
+
translateReasoning(_model, control) {
|
|
27
|
+
return { notes: [`mock passthrough of ${control.mode} control`] };
|
|
28
|
+
},
|
|
29
|
+
async execute(request) {
|
|
30
|
+
const index = steps.findIndex((step) => step.matchCatalogId === undefined || step.matchCatalogId === request.model.catalogId);
|
|
31
|
+
const behavior = index >= 0 ? steps.splice(index, 1)[0].behavior : options.defaultBehavior ?? { outcome: "success", text: "{}" };
|
|
32
|
+
if (behavior.latencyMs)
|
|
33
|
+
await sleep(behavior.latencyMs, request.signal);
|
|
34
|
+
if (behavior.outcome === "error") {
|
|
35
|
+
const retryable = behavior.error !== "provider-invalid-request";
|
|
36
|
+
throw new ProviderCallError(behavior.error, `mock ${behavior.error} for ${request.model.catalogId}`, retryable);
|
|
37
|
+
}
|
|
38
|
+
if (behavior.outcome === "refusal") {
|
|
39
|
+
return { output: { kind: "refusal", message: behavior.message } };
|
|
40
|
+
}
|
|
41
|
+
if (behavior.value !== undefined) {
|
|
42
|
+
return { output: { kind: "structured", value: behavior.value }, usage: behavior.usage, providerRequestId: `mock-${id}` };
|
|
43
|
+
}
|
|
44
|
+
return { output: { kind: "text", text: behavior.text ?? "" }, usage: behavior.usage, providerRequestId: `mock-${id}` };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=mock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../../src/adapters/mock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AA0BjD,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,MAAoB,EAAE,EAAE,CACjD,I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AE,QAAQ,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QACzH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moonshot.d.ts","sourceRoot":"","sources":["../../src/adapters/moonshot.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmD,eAAe,EAAE,MAAM,YAAY,CAAC;AAsBnG,wBAAgB,oCAAoC,IAAI,eAAe,CAsBtE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { UnsupportedCapabilityError } from "../errors.js";
|
|
2
|
+
import { callProviderHttp, requireCredentialKind } from "./http.js";
|
|
3
|
+
import { buildChatCompletionsBody, parseChatCompletions } from "./zai.js";
|
|
4
|
+
/**
|
|
5
|
+
* Moonshot/Kimi chat-completions adapter. Kimi K3 effort levels (low/high/max) observed in
|
|
6
|
+
* CSF. Wire contract unverified against live API; flagged for verification before live enablement.
|
|
7
|
+
*/
|
|
8
|
+
function translate(model, control) {
|
|
9
|
+
switch (control.mode) {
|
|
10
|
+
case "provider-default":
|
|
11
|
+
return {};
|
|
12
|
+
case "disabled":
|
|
13
|
+
throw new UnsupportedCapabilityError(`${model.catalogId} cannot represent explicitly disabled reasoning (provider default only)`);
|
|
14
|
+
case "effort":
|
|
15
|
+
return { reasoning: { reasoning_effort: control.level } };
|
|
16
|
+
case "thinking":
|
|
17
|
+
case "token-budget":
|
|
18
|
+
throw new UnsupportedCapabilityError(`${model.catalogId} exposes effort-based reasoning only`);
|
|
19
|
+
case "combined":
|
|
20
|
+
throw new UnsupportedCapabilityError(`${model.catalogId} cannot combine reasoning controls`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function createMoonshotChatCompletionsAdapter() {
|
|
24
|
+
return {
|
|
25
|
+
id: "moonshot-chat-completions",
|
|
26
|
+
version: "0.1.0",
|
|
27
|
+
providers: ["moonshot"],
|
|
28
|
+
defaultEndpoint: "https://api.moonshot.ai/v1/chat/completions",
|
|
29
|
+
supportedInputModalities: ["text"],
|
|
30
|
+
supportsStructuredOutput: true,
|
|
31
|
+
translateReasoning: translate,
|
|
32
|
+
async execute(request, fetchImpl) {
|
|
33
|
+
requireCredentialKind(request.credential, "bearer", "moonshot-chat-completions");
|
|
34
|
+
const raw = await callProviderHttp(fetchImpl, {
|
|
35
|
+
url: request.endpoint,
|
|
36
|
+
headers: { authorization: `Bearer ${request.credential.token}` },
|
|
37
|
+
body: buildChatCompletionsBody(request),
|
|
38
|
+
timeoutMs: request.timeoutMs,
|
|
39
|
+
signal: request.signal,
|
|
40
|
+
description: "moonshot-chat-completions"
|
|
41
|
+
});
|
|
42
|
+
return parseChatCompletions(raw);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=moonshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moonshot.js","sourceRoot":"","sources":["../../src/adapters/moonshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAG1E;;;GAGG;AACH,SAAS,SAAS,CAAC,KAAsB,EAAE,OAA+B;IACxE,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,kBAAkB;YACrB,OAAO,EAAE,CAAC;QACZ,KAAK,UAAU;YACb,MAAM,IAAI,0BAA0B,CAAC,GAAG,KAAK,CAAC,SAAS,yEAAyE,CAAC,CAAC;QACpI,KAAK,QAAQ;YACX,OAAO,EAAE,SAAS,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QAC5D,KAAK,UAAU,CAAC;QAChB,KAAK,cAAc;YACjB,MAAM,IAAI,0BAA0B,CAAC,GAAG,KAAK,CAAC,SAAS,sCAAsC,CAAC,CAAC;QACjG,KAAK,UAAU;YACb,MAAM,IAAI,0BAA0B,CAAC,GAAG,KAAK,CAAC,SAAS,oCAAoC,CAAC,CAAC;IACjG,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oCAAoC;IAClD,OAAO;QACL,EAAE,EAAE,2BAA2B;QAC/B,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,CAAC,UAAU,CAAC;QACvB,eAAe,EAAE,6CAA6C;QAC9D,wBAAwB,EAAE,CAAC,MAAM,CAAC;QAClC,wBAAwB,EAAE,IAAI;QAC9B,kBAAkB,EAAE,SAAS;QAC7B,KAAK,CAAC,OAAO,CAAC,OAAuB,EAAE,SAAS;YAC9C,qBAAqB,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,2BAA2B,CAAC,CAAC;YACjF,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,SAAS,EAAE;gBAC5C,GAAG,EAAE,OAAO,CAAC,QAAQ;gBACrB,OAAO,EAAE,EAAE,aAAa,EAAE,UAAW,OAAO,CAAC,UAAgC,CAAC,KAAK,EAAE,EAAE;gBACvF,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC;gBACvC,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,WAAW,EAAE,2BAA2B;aACzC,CAAC,CAAC;YACH,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProviderAdapter } from "./types.js";
|
|
2
|
+
/** OpenAI Responses API adapter. Wire contract unverified against live API; flagged for verification before live enablement. */
|
|
3
|
+
export declare function createOpenAiResponsesAdapter(): ProviderAdapter;
|
|
4
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/adapters/openai.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmD,eAAe,EAAE,MAAM,YAAY,CAAC;AAoCnG,gIAAgI;AAChI,wBAAgB,4BAA4B,IAAI,eAAe,CA0E9D"}
|