@hop-top/kit 0.5.0-alpha.12 → 0.5.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/README.md +5 -5
- package/dist/bus-D2bAOPYz.d.ts +55 -0
- package/dist/bus.d.ts +1 -0
- package/dist/bus.js +13 -0
- package/dist/chunk-74E6RNOI.js +82 -0
- package/dist/chunk-B7XTFDBB.js +17 -0
- package/dist/chunk-CAONBSPO.js +497 -0
- package/dist/chunk-F7RSL4N4.js +88 -0
- package/dist/chunk-I6XDPSXQ.js +75 -0
- package/dist/chunk-IDM6YZXN.js +204 -0
- package/dist/{chunk-BXJ2J27B.js → chunk-IGKBRNEW.js} +10 -10
- package/dist/{chunk-VWGP4NVJ.js → chunk-MDVGMOZO.js} +45 -39
- package/dist/{chunk-4FMALWYB.js → chunk-MEF7W3MG.js} +45 -45
- package/dist/{chunk-VGOA5Y7S.js → chunk-Q547MHNB.js} +11 -11
- package/dist/{chunk-K7E34Q3A.js → chunk-TUU2BY5I.js} +136 -47
- package/dist/chunk-VKQCOVKI.js +880 -0
- package/dist/cli.js +3 -3
- package/dist/index-BqZ7WGQf.d.ts +731 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +32 -18
- package/dist/{llm-DYuR7_uX.d.ts → llm-BazFKc_2.d.ts} +95 -9
- package/dist/{llm-anthropic-Cd_I2xXB.d.ts → llm-anthropic-BcAitoDV.d.ts} +1 -1
- package/dist/llm-anthropic.d.ts +2 -2
- package/dist/llm-anthropic.js +4 -4
- package/dist/{llm-openai-DyFrucmV.d.ts → llm-openai-CSDvuRH6.d.ts} +1 -1
- package/dist/llm-openai.d.ts +2 -2
- package/dist/llm-openai.js +4 -4
- package/dist/llm.d.ts +1 -1
- package/dist/llm.js +8 -2
- package/dist/{routellm-B0nv59mH.d.ts → routellm-B9UrONPr.d.ts} +1 -1
- package/dist/routellm.d.ts +2 -2
- package/dist/routellm.js +5 -5
- package/dist/upgrade/drivers/configfile.d.ts +45 -0
- package/dist/upgrade/drivers/configfile.js +78 -0
- package/dist/upgrade/drivers/fsdir.d.ts +61 -0
- package/dist/upgrade/drivers/fsdir.js +170 -0
- package/dist/upgrade/drivers/postgres.d.ts +121 -0
- package/dist/upgrade/drivers/postgres.js +195 -0
- package/dist/upgrade/drivers/sqlite.d.ts +101 -0
- package/dist/upgrade/drivers/sqlite.js +241 -0
- package/dist/upgrade/index.d.ts +2 -0
- package/dist/upgrade/index.js +73 -0
- package/dist/uri-IJ_AoY3d.d.ts +144 -0
- package/dist/uri.d.ts +1 -0
- package/dist/uri.js +37 -0
- package/dist/version-DEJ3pbiO.d.ts +10 -0
- package/dist/wizard-Bf_qHc31.d.ts +159 -0
- package/dist/wizard.d.ts +1 -0
- package/dist/wizard.js +39 -0
- package/package.json +76 -17
- package/skills/hop-top-kit-ts/.claude-plugin/plugin.json +19 -0
- package/skills/hop-top-kit-ts/SKILL.md +117 -0
- package/skills/hop-top-kit-ts/assets/snippets/mcp/mcp.expected +2 -0
- package/skills/hop-top-kit-ts/assets/snippets/mcp/mcp.ts +20 -0
- package/skills/hop-top-kit-ts/assets/snippets/quickstart/quickstart.expected +13 -0
- package/skills/hop-top-kit-ts/assets/snippets/quickstart/quickstart.ts +26 -0
- package/skills/hop-top-kit-ts/gym.json +5 -0
- package/skills/hop-top-kit-ts/references/ai-and-agents.md +45 -0
- package/skills/hop-top-kit-ts/references/cli-and-console.md +63 -0
- package/skills/hop-top-kit-ts/references/coverage.md +56 -0
- package/skills/hop-top-kit-ts/references/guardrails-and-trust.md +60 -0
- package/skills/hop-top-kit-ts/references/other-ports.md +31 -0
- package/skills/hop-top-kit-ts/references/serving-and-transports.md +49 -0
- package/skills/hop-top-kit-ts/scripts/detect-port.sh +168 -0
- package/src/index.test.ts +48 -2
- package/src/index.ts +6 -1
- package/src/llm-anthropic.conformance.test.ts +7 -0
- package/src/llm-boundkey.test.ts +260 -0
- package/src/llm-choice-hermetic.test.ts +1 -1
- package/src/llm-config.test.ts +2 -4
- package/src/llm-config.ts +5 -1
- package/src/llm-endpoint.ts +25 -5
- package/src/llm-keys.ts +47 -15
- package/src/llm-openai.test.ts +10 -4
- package/src/llm-openai.ts +7 -1
- package/src/llm-spec.test.ts +347 -0
- package/src/llm-spec.ts +80 -0
- package/src/llm-uri.ts +96 -12
- package/src/llm.test.ts +2 -2
- package/src/llm.ts +10 -0
- package/src/published-types.test.ts +8 -0
- package/src/serve.stopped-order.test.ts +156 -0
- package/src/upgrade/README.md +42 -0
- package/src/upgrade/backup.ts +174 -0
- package/src/upgrade/conformance.test.ts +310 -0
- package/src/upgrade/document.ts +229 -0
- package/src/upgrade/driver.ts +66 -0
- package/src/upgrade/drivers/README.md +47 -0
- package/src/upgrade/drivers/configfile.test.ts +112 -0
- package/src/upgrade/drivers/configfile.ts +107 -0
- package/src/upgrade/drivers/fsdir.test.ts +188 -0
- package/src/upgrade/drivers/fsdir.ts +216 -0
- package/src/upgrade/drivers/isolation.test.ts +18 -0
- package/src/upgrade/drivers/postgres.integration.test.ts +395 -0
- package/src/upgrade/drivers/postgres.test.ts +272 -0
- package/src/upgrade/drivers/postgres.ts +284 -0
- package/src/upgrade/drivers/sqlite.integration.test.ts +492 -0
- package/src/upgrade/drivers/sqlite.ts +300 -0
- package/src/upgrade/drivers/version.ts +21 -0
- package/src/upgrade/errors.ts +117 -0
- package/src/upgrade/events.ts +117 -0
- package/src/{upgrade.test.ts → upgrade/index.test.ts} +1 -1
- package/src/{upgrade.ts → upgrade/index.ts} +20 -0
- package/src/upgrade/migration.ts +89 -0
- package/src/upgrade/migrator.test.ts +391 -0
- package/src/upgrade/migrator.ts +527 -0
- package/src/upgrade/options.ts +59 -0
- package/src/upgrade/semver.ts +90 -0
- package/test/llm/conformance-helpers.ts +3 -0
- package/test/skill-snippets.test.ts +60 -0
- package/test/upgrade/conformance-migrator.ts +439 -0
- package/test/upgrade/conformance-support.ts +44 -0
- package/test/upgrade/driver-support.ts +44 -0
- package/test/upgrade/pg-container.ts +64 -0
- package/test/upgrade/pg-race-worker.ts +48 -0
- package/test/upgrade/race-helper.ts +36 -0
- package/test/upgrade/sqlite-support.ts +41 -0
- package/test/upgrade/testdata/go-fsdir-mydata.tar.gz +0 -0
- package/vitest.config.ts +26 -0
- package/dist/chunk-X4E5QGEB.js +0 -171
- package/dist/upgrade-BJ2z6Oqf.d.ts +0 -156
- package/dist/upgrade.d.ts +0 -1
- package/dist/upgrade.js +0 -9
- package/dist/{chunk-MFVUENZR.js → chunk-KV7FYEAF.js} +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { a as aim } from './aim-DZHwwiIc.js';
|
|
2
2
|
export { a as alias } from './alias-D9_qFlyP.js';
|
|
3
|
-
export { l as anthropic } from './llm-anthropic-
|
|
3
|
+
export { l as anthropic } from './llm-anthropic-BcAitoDV.js';
|
|
4
4
|
export { a as api } from './api-DAexsu2H.js';
|
|
5
5
|
export { a as auth } from './auth-2-jfgiHn.js';
|
|
6
|
+
export { b as bus } from './bus-D2bAOPYz.js';
|
|
6
7
|
export { c as cli } from './cli-RSRk1M36.js';
|
|
7
8
|
export { c as completion } from './completion-csVun6SP.js';
|
|
8
9
|
export { c as completionValues } from './completion-values-By-mnjNt.js';
|
|
@@ -10,15 +11,15 @@ export { c as compliance } from './compliance-AxFf-uMy.js';
|
|
|
10
11
|
export { c as config } from './config-CaK60ByQ.js';
|
|
11
12
|
export { e as errcorrect } from './errcorrect-BcX1Ft0K.js';
|
|
12
13
|
export { i as id } from './index-D9zpUrpE.js';
|
|
13
|
-
export { l as llm } from './llm-
|
|
14
|
+
export { l as llm } from './llm-BazFKc_2.js';
|
|
14
15
|
export { l as log } from './log-CkaxMX3U.js';
|
|
15
16
|
export { i as mcp } from './index-BKJZClJx.js';
|
|
16
17
|
export { n as netpolicy } from './netpolicy-Brx5XZUB.js';
|
|
17
|
-
export { l as openai } from './llm-openai-
|
|
18
|
+
export { l as openai } from './llm-openai-CSDvuRH6.js';
|
|
18
19
|
export { o as output } from './output-CjZWmL8s.js';
|
|
19
20
|
export { p as progress } from './progress-CAzyxeWl.js';
|
|
20
21
|
export { p as provenance } from './provenance-SMFHm5gx.js';
|
|
21
|
-
export { r as routellm } from './routellm-
|
|
22
|
+
export { r as routellm } from './routellm-B9UrONPr.js';
|
|
22
23
|
export { r as rpc } from './rpc-D31Lg0Kc.js';
|
|
23
24
|
export { s as safety } from './safety-CUaYEjZc.js';
|
|
24
25
|
export { s as scope } from './scope-BrhYB4ij.js';
|
|
@@ -27,7 +28,9 @@ export { s as stream } from './stream-CrjeCp0M.js';
|
|
|
27
28
|
export { i as telemetry } from './index-C3Zw4wDJ.js';
|
|
28
29
|
export { t as toolspec } from './toolspec-DcPwwoAZ.js';
|
|
29
30
|
export { i as tui } from './index-CGE5yLBj.js';
|
|
30
|
-
export {
|
|
31
|
+
export { i as upgrade } from './index-BqZ7WGQf.js';
|
|
32
|
+
export { u as uri } from './uri-IJ_AoY3d.js';
|
|
33
|
+
export { w as wizard } from './wizard-Bf_qHc31.js';
|
|
31
34
|
export { x as xdg } from './xdg-DB7Shoib.js';
|
|
32
35
|
import 'commander';
|
|
33
36
|
import './parity-CvMuYcVI.js';
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkIVQHLI56js = require('./chunk-IVQHLI56.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkYOBAUCVNjs = require('./chunk-YOBAUCVN.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkRYKLVOVKjs = require('./chunk-RYKLVOVK.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkVKQCOVKIjs = require('./chunk-VKQCOVKI.js');
|
|
13
|
+
require('./chunk-IDM6YZXN.js');
|
|
14
|
+
require('./chunk-I6XDPSXQ.js');
|
|
13
15
|
|
|
14
16
|
|
|
15
|
-
var
|
|
17
|
+
var _chunkMQXYDYRDjs = require('./chunk-MQXYDYRD.js');
|
|
16
18
|
|
|
17
19
|
|
|
18
|
-
var
|
|
20
|
+
var _chunkBRNEKPWXjs = require('./chunk-BRNEKPWX.js');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var _chunkEE4M2UOFjs = require('./chunk-EE4M2UOF.js');
|
|
19
24
|
require('./chunk-SNVGDYX7.js');
|
|
20
25
|
|
|
21
26
|
|
|
22
|
-
var
|
|
27
|
+
var _chunkF7RSL4N4js = require('./chunk-F7RSL4N4.js');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _chunkCAONBSPOjs = require('./chunk-CAONBSPO.js');
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var _chunkP3Y46PYFjs = require('./chunk-P3Y46PYF.js');
|
|
23
34
|
|
|
24
35
|
|
|
25
36
|
var _chunkBDNNPRX6js = require('./chunk-BDNNPRX6.js');
|
|
@@ -28,7 +39,7 @@ var _chunkBDNNPRX6js = require('./chunk-BDNNPRX6.js');
|
|
|
28
39
|
var _chunk6SVOHNICjs = require('./chunk-6SVOHNIC.js');
|
|
29
40
|
|
|
30
41
|
|
|
31
|
-
var
|
|
42
|
+
var _chunkQ547MHNBjs = require('./chunk-Q547MHNB.js');
|
|
32
43
|
|
|
33
44
|
|
|
34
45
|
var _chunkWUOAQVOAjs = require('./chunk-WUOAQVOA.js');
|
|
@@ -40,7 +51,7 @@ var _chunk6HFAEZ52js = require('./chunk-6HFAEZ52.js');
|
|
|
40
51
|
var _chunkWBVO43HUjs = require('./chunk-WBVO43HU.js');
|
|
41
52
|
|
|
42
53
|
|
|
43
|
-
var
|
|
54
|
+
var _chunkXJTRY453js = require('./chunk-XJTRY453.js');
|
|
44
55
|
|
|
45
56
|
|
|
46
57
|
var _chunkQQQYCWSCjs = require('./chunk-QQQYCWSC.js');
|
|
@@ -49,14 +60,14 @@ var _chunkQQQYCWSCjs = require('./chunk-QQQYCWSC.js');
|
|
|
49
60
|
var _chunk3FIKGFKIjs = require('./chunk-3FIKGFKI.js');
|
|
50
61
|
|
|
51
62
|
|
|
52
|
-
var
|
|
63
|
+
var _chunkMEF7W3MGjs = require('./chunk-MEF7W3MG.js');
|
|
53
64
|
|
|
54
65
|
|
|
55
|
-
var
|
|
56
|
-
require('./chunk-
|
|
66
|
+
var _chunkMDVGMOZOjs = require('./chunk-MDVGMOZO.js');
|
|
67
|
+
require('./chunk-IGKBRNEW.js');
|
|
57
68
|
|
|
58
69
|
|
|
59
|
-
var
|
|
70
|
+
var _chunkTUU2BY5Ijs = require('./chunk-TUU2BY5I.js');
|
|
60
71
|
|
|
61
72
|
|
|
62
73
|
var _chunkIZ6Q4SE3js = require('./chunk-IZ6Q4SE3.js');
|
|
@@ -74,16 +85,19 @@ var _chunkCSJWB6D3js = require('./chunk-CSJWB6D3.js');
|
|
|
74
85
|
var _chunkUKZIAQA7js = require('./chunk-UKZIAQA7.js');
|
|
75
86
|
|
|
76
87
|
|
|
77
|
-
var
|
|
88
|
+
var _chunk74E6RNOIjs = require('./chunk-74E6RNOI.js');
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
var _chunkKV7FYEAFjs = require('./chunk-KV7FYEAF.js');
|
|
78
92
|
require('./chunk-CXBZTONY.js');
|
|
79
93
|
|
|
80
94
|
|
|
81
95
|
var _chunkGFRAYYRDjs = require('./chunk-GFRAYYRD.js');
|
|
82
96
|
require('./chunk-POR5L2DG.js');
|
|
83
|
-
require('./chunk-T6OZMPPV.js');
|
|
84
97
|
|
|
85
98
|
|
|
86
99
|
var _chunkKVG7YCTSjs = require('./chunk-KVG7YCTS.js');
|
|
100
|
+
require('./chunk-T6OZMPPV.js');
|
|
87
101
|
|
|
88
102
|
|
|
89
103
|
var _chunk4UE5TCMQjs = require('./chunk-4UE5TCMQ.js');
|
|
@@ -93,10 +107,10 @@ var _chunk65VPWMPVjs = require('./chunk-65VPWMPV.js');
|
|
|
93
107
|
|
|
94
108
|
|
|
95
109
|
var _chunkJKMQSAJPjs = require('./chunk-JKMQSAJP.js');
|
|
110
|
+
require('./chunk-R5U7XKVJ.js');
|
|
111
|
+
|
|
96
112
|
|
|
97
113
|
|
|
98
|
-
var _chunkXJTRY453js = require('./chunk-XJTRY453.js');
|
|
99
|
-
require('./chunk-R5U7XKVJ.js');
|
|
100
114
|
|
|
101
115
|
|
|
102
116
|
|
|
@@ -129,4 +143,4 @@ require('./chunk-R5U7XKVJ.js');
|
|
|
129
143
|
|
|
130
144
|
|
|
131
145
|
|
|
132
|
-
exports.aim = _chunkQJVSKKRQjs.aim_exports; exports.alias = _chunkML7D5DWYjs.alias_exports; exports.anthropic =
|
|
146
|
+
exports.aim = _chunkQJVSKKRQjs.aim_exports; exports.alias = _chunkML7D5DWYjs.alias_exports; exports.anthropic = _chunkMEF7W3MGjs.llm_anthropic_exports; exports.api = _chunkCSJWB6D3js.api_exports; exports.auth = _chunkUKZIAQA7js.auth_exports; exports.bus = _chunk74E6RNOIjs.bus_exports; exports.cli = _chunkKV7FYEAFjs.cli_exports; exports.completion = _chunk65VPWMPVjs.completion_exports; exports.completionValues = _chunkJKMQSAJPjs.completion_values_exports; exports.compliance = _chunkXJTRY453js.compliance_exports; exports.config = _chunkQQQYCWSCjs.config_exports; exports.errcorrect = _chunk3FIKGFKIjs.errcorrect_exports; exports.id = _chunkP3Y46PYFjs.id_exports; exports.llm = _chunkTUU2BY5Ijs.llm_exports; exports.log = _chunkIZ6Q4SE3js.log_exports; exports.mcp = _chunkIVQHLI56js.mcp_exports; exports.netpolicy = _chunkKVG7YCTSjs.netpolicy_exports; exports.openai = _chunkMDVGMOZOjs.llm_openai_exports; exports.output = _chunkGFRAYYRDjs.output_exports; exports.progress = _chunkBDNNPRX6js.progress_exports; exports.provenance = _chunk6SVOHNICjs.provenance_exports; exports.routellm = _chunkQ547MHNBjs.routellm_exports; exports.rpc = _chunkWUOAQVOAjs.rpc_exports; exports.safety = _chunk6HFAEZ52js.safety_exports; exports.scope = _chunkWBVO43HUjs.scope_exports; exports.serve = _chunkMQXYDYRDjs.serve_exports; exports.stream = _chunkBRNEKPWXjs.stream_exports; exports.telemetry = _chunkYOBAUCVNjs.telemetry_exports; exports.toolspec = _chunkEE4M2UOFjs.toolspec_exports; exports.tui = _chunkRYKLVOVKjs.tui_exports; exports.upgrade = _chunkVKQCOVKIjs.upgrade_exports; exports.uri = _chunkF7RSL4N4js.uri_exports; exports.wizard = _chunkCAONBSPOjs.wizard_exports; exports.xdg = _chunk4UE5TCMQjs.xdg_exports;
|
|
@@ -289,6 +289,22 @@ interface ProviderKey {
|
|
|
289
289
|
interface Declaration {
|
|
290
290
|
endpoints?: string[];
|
|
291
291
|
key?: ProviderKey;
|
|
292
|
+
/** The scheme's default endpoint; see {@link keyBoundToDefault}. */
|
|
293
|
+
baseURL?: string;
|
|
294
|
+
/**
|
|
295
|
+
* Makes the scheme's ambient credentials (its provider variables and
|
|
296
|
+
* `LLM_API_KEY`) belong to {@link baseURL} alone. When the URI names
|
|
297
|
+
* another endpoint (a host or `base_url` param), or `LLM_BASE_URL` or
|
|
298
|
+
* the llm.yaml block's `base_url` does, none of them is lent: only a
|
|
299
|
+
* key the caller set for that endpoint resolves, namely the URI's
|
|
300
|
+
* `api_key`, llm.yaml `api_key`, or the variable llm.yaml
|
|
301
|
+
* `api_key_env` names. No key then is no error: a compatible server
|
|
302
|
+
* may take none. An endpoint sharing `baseURL`'s origin counts as the
|
|
303
|
+
* default; one that does not parse counts as custom. Needs
|
|
304
|
+
* `baseURL`; set it for adapters whose hosted key must not reach a
|
|
305
|
+
* self-hosted compatible server.
|
|
306
|
+
*/
|
|
307
|
+
keyBoundToDefault?: boolean;
|
|
292
308
|
}
|
|
293
309
|
/** The declaration `scheme` registered with, if any. */
|
|
294
310
|
declare function declarationOf(scheme: string): Declaration | undefined;
|
|
@@ -332,7 +348,11 @@ interface LoadOptions {
|
|
|
332
348
|
* variables (`<SCHEME>_API_KEY` unless its adapter declares others);
|
|
333
349
|
* `LLM_API_KEY` for a registered scheme that requires a key. Blank is
|
|
334
350
|
* unset everywhere; a blank `api_key` param is dropped. Found
|
|
335
|
-
* nowhere, it is left unset: the adapter reports it.
|
|
351
|
+
* nowhere, it is left unset: the adapter reports it. A scheme
|
|
352
|
+
* declaring `keyBoundToDefault` (the openai family) lends the last
|
|
353
|
+
* two only on its default endpoint: on any other, only the URI's
|
|
354
|
+
* `api_key`, llm.yaml `api_key` and `api_key_env` apply, and no key
|
|
355
|
+
* is no error.
|
|
336
356
|
* - baseURL: the URI's `base_url`; its host (`http://host:port`);
|
|
337
357
|
* `LLM_BASE_URL`; llm.yaml `base_url`.
|
|
338
358
|
* - model: the URI's; llm.yaml `model`. extras: the block's other keys.
|
|
@@ -363,16 +383,72 @@ declare function loadConfig(uriStr?: string, opts?: LoadOptions): ResolvedConfig
|
|
|
363
383
|
* `ollama://[::1]:11434/llama3`) when it splits as `host:port` with a
|
|
364
384
|
* non-empty port; otherwise the whole path is the model
|
|
365
385
|
* (`openrouter://openai/gpt-4.1-nano`). The query splits on `&`, each
|
|
366
|
-
* pair on its first
|
|
367
|
-
*
|
|
368
|
-
*
|
|
386
|
+
* pair on its first `=`; a param without `=` is `""`, one with an
|
|
387
|
+
* empty name is dropped. `params` is absent when none is left.
|
|
388
|
+
*
|
|
389
|
+
* The model and each param name and value are percent-decoded after
|
|
390
|
+
* the URI is split, so an escaped `?`, `&` or `#` is part of the text,
|
|
391
|
+
* never a separator: `x%3Fbase_url%3Dhttps%3A%2F%2Fevil` is a model of
|
|
392
|
+
* that literal text and sets no `base_url`. Only `%XX` is decoded; `+`
|
|
393
|
+
* stays `+`, so a key holding one survives. A malformed escape (or one
|
|
394
|
+
* that does not decode to UTF-8) is an error, as is a `base_url` or
|
|
395
|
+
* credential param (`api_key`, `token`, ...) named twice, whichever
|
|
396
|
+
* value would win; other params are last-wins. Build a URI from parts
|
|
397
|
+
* with {@link specURI}, never by concatenation: a raw `?` or `&` in a
|
|
398
|
+
* part still splits.
|
|
369
399
|
*
|
|
370
400
|
* Throws an {@link LLMError} (`empty URI`, `missing scheme in URI
|
|
371
|
-
* "..."`, `empty scheme in URI "..."
|
|
372
|
-
*
|
|
401
|
+
* "..."`, `empty scheme in URI "..."`, `malformed percent-escape in
|
|
402
|
+
* URI "..."`, `duplicate "name" param in URI "..."`) quoting `raw` with
|
|
403
|
+
* its credentials masked by {@link redactURI}.
|
|
373
404
|
*/
|
|
374
405
|
declare function parseURI(raw: string): URI;
|
|
375
406
|
|
|
407
|
+
/**
|
|
408
|
+
* A provider named by its parts, not by a URI string: Go `llm.Spec`.
|
|
409
|
+
* Re-exported from `@hop-top/kit/llm`.
|
|
410
|
+
*
|
|
411
|
+
* @internal
|
|
412
|
+
*/
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* A provider named by its parts. Building `"scheme://" + model +
|
|
416
|
+
* "?base_url=" + u` by hand lets a model name holding `?` or `&` add
|
|
417
|
+
* params of its own, among them a `base_url` that takes the API key to
|
|
418
|
+
* another host. A Spec keeps each part where it is: {@link specURI}
|
|
419
|
+
* escapes them, and `resolveSpec` and {@link loadConfigSpec} then run
|
|
420
|
+
* the same pipeline, with the same guards (key endpoint, hosted key
|
|
421
|
+
* bound to its default endpoint, base URL checks), as the URI they
|
|
422
|
+
* stand for.
|
|
423
|
+
*/
|
|
424
|
+
interface Spec {
|
|
425
|
+
scheme: string;
|
|
426
|
+
/** The model; absent or empty for none. */
|
|
427
|
+
model?: string;
|
|
428
|
+
/** The `base_url` param; absent or empty for the provider's own. */
|
|
429
|
+
baseURL?: string;
|
|
430
|
+
/** The `api_key` param; absent or empty to resolve it as `applyAPIKey` does. */
|
|
431
|
+
apiKey?: string;
|
|
432
|
+
/**
|
|
433
|
+
* The other params. `base_url` and `api_key` belong in `baseURL` and
|
|
434
|
+
* `apiKey`: naming either here is an error.
|
|
435
|
+
*/
|
|
436
|
+
params?: Record<string, string>;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Renders `s` as an escaped provider URI that `parseURI` reads back as
|
|
440
|
+
* the same parts. It holds the key when `apiKey` is set: never log it
|
|
441
|
+
* (see `redactURI`). Throws an {@link LLMError} for an empty or invalid
|
|
442
|
+
* scheme and for an empty, `base_url` or `api_key` param name; the
|
|
443
|
+
* error never carries the key.
|
|
444
|
+
*/
|
|
445
|
+
declare function specURI(s: Spec): string;
|
|
446
|
+
/**
|
|
447
|
+
* {@link loadConfig} for a {@link Spec}. A Spec with no scheme is not
|
|
448
|
+
* the default provider: it is an error.
|
|
449
|
+
*/
|
|
450
|
+
declare function loadConfigSpec(s: Spec, opts?: LoadOptions): ResolvedConfig;
|
|
451
|
+
|
|
376
452
|
/**
|
|
377
453
|
* Provider key resolution and the gate that keeps a key kit resolved
|
|
378
454
|
* itself off an endpoint only the URI names. Mirrors Go `llm`
|
|
@@ -391,7 +467,8 @@ declare function parseURI(raw: string): URI;
|
|
|
391
467
|
* names none. A required key found nowhere throws a
|
|
392
468
|
* {@link MissingKeyError}. Go `ApplyAPIKey` without a secret store.
|
|
393
469
|
*
|
|
394
|
-
* The
|
|
470
|
+
* The key is added escaped, as {@link parseURI} decodes it. The result
|
|
471
|
+
* holds the key: never log it. Errors never carry it.
|
|
395
472
|
*/
|
|
396
473
|
declare function applyAPIKey(uri: string): string;
|
|
397
474
|
|
|
@@ -925,6 +1002,11 @@ declare function register(scheme: string, factory: Factory, decl?: Declaration):
|
|
|
925
1002
|
* ambient (see {@link LoadOptions}).
|
|
926
1003
|
*/
|
|
927
1004
|
declare function resolve(uriStr: string, opts?: LoadOptions): Provider;
|
|
1005
|
+
/**
|
|
1006
|
+
* {@link resolve} for a {@link Spec}: the Spec's parts are escaped
|
|
1007
|
+
* into the URI, so no part can add a param of its own.
|
|
1008
|
+
*/
|
|
1009
|
+
declare function resolveSpec(s: Spec, opts?: LoadOptions): Provider;
|
|
928
1010
|
/** Clear the registry (for tests). */
|
|
929
1011
|
declare function clearRegistry(): void;
|
|
930
1012
|
interface ClientOptions extends LoadOptions {
|
|
@@ -1010,6 +1092,7 @@ type llm_Response = Response;
|
|
|
1010
1092
|
type llm_ResponseReceivedPayload = ResponseReceivedPayload;
|
|
1011
1093
|
type llm_ResponseTooLargeError = ResponseTooLargeError;
|
|
1012
1094
|
declare const llm_ResponseTooLargeError: typeof ResponseTooLargeError;
|
|
1095
|
+
type llm_Spec = Spec;
|
|
1013
1096
|
type llm_StreamOutcome = StreamOutcome;
|
|
1014
1097
|
type llm_StreamTruncatedError = StreamTruncatedError;
|
|
1015
1098
|
declare const llm_StreamTruncatedError: typeof StreamTruncatedError;
|
|
@@ -1052,18 +1135,21 @@ declare const llm_isFallbackable: typeof isFallbackable;
|
|
|
1052
1135
|
declare const llm_isPublicAddress: typeof isPublicAddress;
|
|
1053
1136
|
declare const llm_isValidToolName: typeof isValidToolName;
|
|
1054
1137
|
declare const llm_loadConfig: typeof loadConfig;
|
|
1138
|
+
declare const llm_loadConfigSpec: typeof loadConfigSpec;
|
|
1055
1139
|
declare const llm_parseURI: typeof parseURI;
|
|
1056
1140
|
declare const llm_redactURI: typeof redactURI;
|
|
1057
1141
|
declare const llm_register: typeof register;
|
|
1058
1142
|
declare const llm_requestStartedPayload: typeof requestStartedPayload;
|
|
1059
1143
|
declare const llm_resolve: typeof resolve;
|
|
1144
|
+
declare const llm_resolveSpec: typeof resolveSpec;
|
|
1060
1145
|
declare const llm_responseReceivedPayload: typeof responseReceivedPayload;
|
|
1061
1146
|
declare const llm_sanitizeToolName: typeof sanitizeToolName;
|
|
1147
|
+
declare const llm_specURI: typeof specURI;
|
|
1062
1148
|
declare const llm_toolNameModeOf: typeof toolNameModeOf;
|
|
1063
1149
|
declare const llm_urlSource: typeof urlSource;
|
|
1064
1150
|
declare const llm_usageCost: typeof usageCost;
|
|
1065
1151
|
declare namespace llm {
|
|
1066
|
-
export { llm_ANTHROPIC_TOOL_NAMES as ANTHROPIC_TOOL_NAMES, llm_APIError as APIError, llm_AuthError as AuthError, type llm_CacheControl as CacheControl, type llm_CallOp as CallOp, llm_CapabilityNotSupportedError as CapabilityNotSupportedError, type llm_Client as Client, type llm_ClientOptions as ClientOptions, type llm_Completer as Completer, type llm_ContentPart as ContentPart, llm_DEFAULT_MAX_MEDIA_BYTES as DEFAULT_MAX_MEDIA_BYTES, type llm_Declaration as Declaration, type llm_Factory as Factory, llm_FallbackExhaustedError as FallbackExhaustedError, llm_GEMINI_TOOL_NAMES as GEMINI_TOOL_NAMES, llm_HTTPStatusError as HTTPStatusError, llm_KeyEndpointError as KeyEndpointError, llm_LLMError as LLMError, type llm_LoadOptions as LoadOptions, type llm_MediaSource as MediaSource, llm_MediaTooLargeError as MediaTooLargeError, llm_MediaURLRefusedError as MediaURLRefusedError, type llm_Message as Message, llm_MissingKeyError as MissingKeyError, llm_ModelError as ModelError, llm_OPENAI_TOOL_NAMES as OPENAI_TOOL_NAMES, type llm_PartType as PartType, llm_PermissionDeniedError as PermissionDeniedError, type llm_Price as Price, type llm_Provider as Provider, type llm_ProviderConfig as ProviderConfig, type llm_ProviderKey as ProviderKey, llm_ProviderNotFoundError as ProviderNotFoundError, llm_RateLimitError as RateLimitError, type llm_Request as Request, type llm_RequestStartedPayload as RequestStartedPayload, type llm_ResolvedConfig as ResolvedConfig, type llm_Response as Response, type llm_ResponseReceivedPayload as ResponseReceivedPayload, llm_ResponseTooLargeError as ResponseTooLargeError, type llm_StreamOutcome as StreamOutcome, llm_StreamTruncatedError as StreamTruncatedError, type llm_Streamer as Streamer, llm_TOOL_NAMES_PARAM as TOOL_NAMES_PARAM, type llm_ThinkingBlock as ThinkingBlock, type llm_ThinkingConfig as ThinkingConfig, type llm_Token as Token, type llm_ToolCall as ToolCall, type llm_ToolCallEvent as ToolCallEvent, type llm_ToolCallEventKind as ToolCallEventKind, type llm_ToolCaller as ToolCaller, type llm_ToolChoice as ToolChoice, type llm_ToolChoiceMode as ToolChoiceMode, type llm_ToolDef as ToolDef, llm_ToolNameError as ToolNameError, type llm_ToolNameMode as ToolNameMode, type llm_ToolNameReason as ToolNameReason, type llm_ToolNameRule as ToolNameRule, llm_ToolNames as ToolNames, type llm_ToolResponse as ToolResponse, type llm_ToolStream as ToolStream, type llm_ToolStreamer as ToolStreamer, type llm_URI as URI, type llm_URLSourceOptions as URLSourceOptions, type llm_Usage as Usage, llm_applyAPIKey as applyAPIKey, llm_checkKeyEndpoint as checkKeyEndpoint, llm_checkToolChoice as checkToolChoice, llm_checkToolLinkage as checkToolLinkage, llm_clearRegistry as clearRegistry, llm_createLLM as createLLM, llm_credentialsTrusted as credentialsTrusted, llm_declarationOf as declarationOf, llm_fileSource as fileSource, llm_inlineSource as inlineSource, llm_isFallbackable as isFallbackable, llm_isPublicAddress as isPublicAddress, llm_isValidToolName as isValidToolName, llm_loadConfig as loadConfig, llm_parseURI as parseURI, llm_redactURI as redactURI, llm_register as register, llm_requestStartedPayload as requestStartedPayload, llm_resolve as resolve, llm_responseReceivedPayload as responseReceivedPayload, llm_sanitizeToolName as sanitizeToolName, llm_toolNameModeOf as toolNameModeOf, llm_urlSource as urlSource, llm_usageCost as usageCost };
|
|
1152
|
+
export { llm_ANTHROPIC_TOOL_NAMES as ANTHROPIC_TOOL_NAMES, llm_APIError as APIError, llm_AuthError as AuthError, type llm_CacheControl as CacheControl, type llm_CallOp as CallOp, llm_CapabilityNotSupportedError as CapabilityNotSupportedError, type llm_Client as Client, type llm_ClientOptions as ClientOptions, type llm_Completer as Completer, type llm_ContentPart as ContentPart, llm_DEFAULT_MAX_MEDIA_BYTES as DEFAULT_MAX_MEDIA_BYTES, type llm_Declaration as Declaration, type llm_Factory as Factory, llm_FallbackExhaustedError as FallbackExhaustedError, llm_GEMINI_TOOL_NAMES as GEMINI_TOOL_NAMES, llm_HTTPStatusError as HTTPStatusError, llm_KeyEndpointError as KeyEndpointError, llm_LLMError as LLMError, type llm_LoadOptions as LoadOptions, type llm_MediaSource as MediaSource, llm_MediaTooLargeError as MediaTooLargeError, llm_MediaURLRefusedError as MediaURLRefusedError, type llm_Message as Message, llm_MissingKeyError as MissingKeyError, llm_ModelError as ModelError, llm_OPENAI_TOOL_NAMES as OPENAI_TOOL_NAMES, type llm_PartType as PartType, llm_PermissionDeniedError as PermissionDeniedError, type llm_Price as Price, type llm_Provider as Provider, type llm_ProviderConfig as ProviderConfig, type llm_ProviderKey as ProviderKey, llm_ProviderNotFoundError as ProviderNotFoundError, llm_RateLimitError as RateLimitError, type llm_Request as Request, type llm_RequestStartedPayload as RequestStartedPayload, type llm_ResolvedConfig as ResolvedConfig, type llm_Response as Response, type llm_ResponseReceivedPayload as ResponseReceivedPayload, llm_ResponseTooLargeError as ResponseTooLargeError, type llm_Spec as Spec, type llm_StreamOutcome as StreamOutcome, llm_StreamTruncatedError as StreamTruncatedError, type llm_Streamer as Streamer, llm_TOOL_NAMES_PARAM as TOOL_NAMES_PARAM, type llm_ThinkingBlock as ThinkingBlock, type llm_ThinkingConfig as ThinkingConfig, type llm_Token as Token, type llm_ToolCall as ToolCall, type llm_ToolCallEvent as ToolCallEvent, type llm_ToolCallEventKind as ToolCallEventKind, type llm_ToolCaller as ToolCaller, type llm_ToolChoice as ToolChoice, type llm_ToolChoiceMode as ToolChoiceMode, type llm_ToolDef as ToolDef, llm_ToolNameError as ToolNameError, type llm_ToolNameMode as ToolNameMode, type llm_ToolNameReason as ToolNameReason, type llm_ToolNameRule as ToolNameRule, llm_ToolNames as ToolNames, type llm_ToolResponse as ToolResponse, type llm_ToolStream as ToolStream, type llm_ToolStreamer as ToolStreamer, type llm_URI as URI, type llm_URLSourceOptions as URLSourceOptions, type llm_Usage as Usage, llm_applyAPIKey as applyAPIKey, llm_checkKeyEndpoint as checkKeyEndpoint, llm_checkToolChoice as checkToolChoice, llm_checkToolLinkage as checkToolLinkage, llm_clearRegistry as clearRegistry, llm_createLLM as createLLM, llm_credentialsTrusted as credentialsTrusted, llm_declarationOf as declarationOf, llm_fileSource as fileSource, llm_inlineSource as inlineSource, llm_isFallbackable as isFallbackable, llm_isPublicAddress as isPublicAddress, llm_isValidToolName as isValidToolName, llm_loadConfig as loadConfig, llm_loadConfigSpec as loadConfigSpec, llm_parseURI as parseURI, llm_redactURI as redactURI, llm_register as register, llm_requestStartedPayload as requestStartedPayload, llm_resolve as resolve, llm_resolveSpec as resolveSpec, llm_responseReceivedPayload as responseReceivedPayload, llm_sanitizeToolName as sanitizeToolName, llm_specURI as specURI, llm_toolNameModeOf as toolNameModeOf, llm_urlSource as urlSource, llm_usageCost as usageCost };
|
|
1067
1153
|
}
|
|
1068
1154
|
|
|
1069
|
-
export { type
|
|
1155
|
+
export { type Token as $, ANTHROPIC_TOOL_NAMES as A, type ProviderConfig as B, type Completer as C, DEFAULT_MAX_MEDIA_BYTES as D, type ProviderKey as E, type Factory as F, GEMINI_TOOL_NAMES as G, HTTPStatusError as H, ProviderNotFoundError as I, RateLimitError as J, KeyEndpointError as K, LLMError as L, type MediaSource as M, type RequestStartedPayload as N, OPENAI_TOOL_NAMES as O, type PartType as P, type ResponseReceivedPayload as Q, type ResolvedConfig as R, type Streamer as S, type ToolCaller as T, ResponseTooLargeError as U, type Spec as V, type StreamOutcome as W, StreamTruncatedError as X, TOOL_NAMES_PARAM as Y, type ThinkingBlock as Z, type ThinkingConfig as _, type ToolStreamer as a, type ToolCall as a0, type ToolCallEvent as a1, type ToolCallEventKind as a2, type ToolChoice as a3, type ToolChoiceMode as a4, ToolNameError as a5, type ToolNameMode as a6, type ToolNameReason as a7, type ToolNameRule as a8, ToolNames as a9, specURI as aA, toolNameModeOf as aB, urlSource as aC, usageCost as aD, type URI as aa, type URLSourceOptions as ab, type Usage as ac, applyAPIKey as ad, checkKeyEndpoint as ae, checkToolChoice as af, checkToolLinkage as ag, clearRegistry as ah, createLLM as ai, credentialsTrusted as aj, declarationOf as ak, fileSource as al, inlineSource as am, isFallbackable as an, isPublicAddress as ao, isValidToolName as ap, loadConfig as aq, loadConfigSpec as ar, parseURI as as, redactURI as at, register as au, requestStartedPayload as av, resolve as aw, resolveSpec as ax, responseReceivedPayload as ay, sanitizeToolName as az, type Request as b, type Response as c, type ToolDef as d, type ToolResponse as e, type ToolStream as f, APIError as g, AuthError as h, type CacheControl as i, type CallOp as j, CapabilityNotSupportedError as k, llm as l, type Client as m, type ClientOptions as n, type ContentPart as o, type Declaration as p, FallbackExhaustedError as q, type LoadOptions as r, MediaTooLargeError as s, MediaURLRefusedError as t, type Message as u, MissingKeyError as v, ModelError as w, PermissionDeniedError as x, type Price as y, type Provider as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Completer, S as Streamer, T as ToolCaller, a as ToolStreamer, R as ResolvedConfig, b as Request, c as Response, d as ToolDef, e as ToolResponse, f as ToolStream } from './llm-
|
|
1
|
+
import { C as Completer, S as Streamer, T as ToolCaller, a as ToolStreamer, R as ResolvedConfig, b as Request, c as Response, d as ToolDef, e as ToolResponse, f as ToolStream } from './llm-BazFKc_2.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @packageDocumentation
|
package/dist/llm-anthropic.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './llm-
|
|
2
|
-
export { A as ANTHROPIC_DEFAULT_BASE_URL, a as AnthropicAdapter } from './llm-anthropic-
|
|
1
|
+
import './llm-BazFKc_2.js';
|
|
2
|
+
export { A as ANTHROPIC_DEFAULT_BASE_URL, a as AnthropicAdapter } from './llm-anthropic-BcAitoDV.js';
|
package/dist/llm-anthropic.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
4
|
+
var _chunkMEF7W3MGjs = require('./chunk-MEF7W3MG.js');
|
|
5
|
+
require('./chunk-IGKBRNEW.js');
|
|
6
|
+
require('./chunk-TUU2BY5I.js');
|
|
7
7
|
require('./chunk-KVG7YCTS.js');
|
|
8
8
|
require('./chunk-4UE5TCMQ.js');
|
|
9
9
|
require('./chunk-R5U7XKVJ.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.ANTHROPIC_DEFAULT_BASE_URL =
|
|
13
|
+
exports.ANTHROPIC_DEFAULT_BASE_URL = _chunkMEF7W3MGjs.ANTHROPIC_DEFAULT_BASE_URL; exports.AnthropicAdapter = _chunkMEF7W3MGjs.AnthropicAdapter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Completer, S as Streamer, T as ToolCaller, a as ToolStreamer, R as ResolvedConfig, b as Request, c as Response, d as ToolDef, e as ToolResponse, f as ToolStream } from './llm-
|
|
1
|
+
import { C as Completer, S as Streamer, T as ToolCaller, a as ToolStreamer, R as ResolvedConfig, b as Request, c as Response, d as ToolDef, e as ToolResponse, f as ToolStream } from './llm-BazFKc_2.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @packageDocumentation
|
package/dist/llm-openai.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './llm-
|
|
2
|
-
export { O as OPENAI_BASE_URLS, a as OPENAI_DEFAULT_BASE_URL, b as OPENAI_SCHEMES, c as OpenAIAdapter, d as OpenAIAdapterOptions, e as apiRootV1 } from './llm-openai-
|
|
1
|
+
import './llm-BazFKc_2.js';
|
|
2
|
+
export { O as OPENAI_BASE_URLS, a as OPENAI_DEFAULT_BASE_URL, b as OPENAI_SCHEMES, c as OpenAIAdapter, d as OpenAIAdapterOptions, e as apiRootV1 } from './llm-openai-CSDvuRH6.js';
|
package/dist/llm-openai.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
7
|
+
var _chunkMDVGMOZOjs = require('./chunk-MDVGMOZO.js');
|
|
8
|
+
require('./chunk-IGKBRNEW.js');
|
|
9
|
+
require('./chunk-TUU2BY5I.js');
|
|
10
10
|
require('./chunk-KVG7YCTS.js');
|
|
11
11
|
require('./chunk-4UE5TCMQ.js');
|
|
12
12
|
require('./chunk-R5U7XKVJ.js');
|
|
@@ -16,4 +16,4 @@ require('./chunk-R5U7XKVJ.js');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
exports.OPENAI_BASE_URLS =
|
|
19
|
+
exports.OPENAI_BASE_URLS = _chunkMDVGMOZOjs.OPENAI_BASE_URLS; exports.OPENAI_DEFAULT_BASE_URL = _chunkMDVGMOZOjs.OPENAI_DEFAULT_BASE_URL; exports.OPENAI_SCHEMES = _chunkMDVGMOZOjs.OPENAI_SCHEMES; exports.OpenAIAdapter = _chunkMDVGMOZOjs.OpenAIAdapter; exports.apiRootV1 = _chunkMDVGMOZOjs.apiRootV1;
|
package/dist/llm.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ANTHROPIC_TOOL_NAMES, g as APIError, h as AuthError, i as CacheControl, j as CallOp, k as CapabilityNotSupportedError, m as Client, n as ClientOptions, C as Completer, o as ContentPart, D as DEFAULT_MAX_MEDIA_BYTES, p as Declaration, F as Factory, q as FallbackExhaustedError, G as GEMINI_TOOL_NAMES, H as HTTPStatusError, K as KeyEndpointError, L as LLMError, r as LoadOptions, M as MediaSource, s as MediaTooLargeError, t as MediaURLRefusedError, u as Message, v as MissingKeyError, w as ModelError, O as OPENAI_TOOL_NAMES, P as PartType, x as PermissionDeniedError, y as Price, z as Provider, B as ProviderConfig, E as ProviderKey, I as ProviderNotFoundError, J as RateLimitError, b as Request, N as RequestStartedPayload, R as ResolvedConfig, c as Response, Q as ResponseReceivedPayload, U as ResponseTooLargeError, V as
|
|
1
|
+
export { A as ANTHROPIC_TOOL_NAMES, g as APIError, h as AuthError, i as CacheControl, j as CallOp, k as CapabilityNotSupportedError, m as Client, n as ClientOptions, C as Completer, o as ContentPart, D as DEFAULT_MAX_MEDIA_BYTES, p as Declaration, F as Factory, q as FallbackExhaustedError, G as GEMINI_TOOL_NAMES, H as HTTPStatusError, K as KeyEndpointError, L as LLMError, r as LoadOptions, M as MediaSource, s as MediaTooLargeError, t as MediaURLRefusedError, u as Message, v as MissingKeyError, w as ModelError, O as OPENAI_TOOL_NAMES, P as PartType, x as PermissionDeniedError, y as Price, z as Provider, B as ProviderConfig, E as ProviderKey, I as ProviderNotFoundError, J as RateLimitError, b as Request, N as RequestStartedPayload, R as ResolvedConfig, c as Response, Q as ResponseReceivedPayload, U as ResponseTooLargeError, V as Spec, W as StreamOutcome, X as StreamTruncatedError, S as Streamer, Y as TOOL_NAMES_PARAM, Z as ThinkingBlock, _ as ThinkingConfig, $ as Token, a0 as ToolCall, a1 as ToolCallEvent, a2 as ToolCallEventKind, T as ToolCaller, a3 as ToolChoice, a4 as ToolChoiceMode, d as ToolDef, a5 as ToolNameError, a6 as ToolNameMode, a7 as ToolNameReason, a8 as ToolNameRule, a9 as ToolNames, e as ToolResponse, f as ToolStream, a as ToolStreamer, aa as URI, ab as URLSourceOptions, ac as Usage, ad as applyAPIKey, ae as checkKeyEndpoint, af as checkToolChoice, ag as checkToolLinkage, ah as clearRegistry, ai as createLLM, aj as credentialsTrusted, ak as declarationOf, al as fileSource, am as inlineSource, an as isFallbackable, ao as isPublicAddress, ap as isValidToolName, aq as loadConfig, ar as loadConfigSpec, as as parseURI, at as redactURI, au as register, av as requestStartedPayload, aw as resolve, ax as resolveSpec, ay as responseReceivedPayload, az as sanitizeToolName, aA as specURI, aB as toolNameModeOf, aC as urlSource, aD as usageCost } from './llm-BazFKc_2.js';
|
package/dist/llm.js
CHANGED
|
@@ -46,7 +46,10 @@
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var _chunkTUU2BY5Ijs = require('./chunk-TUU2BY5I.js');
|
|
50
53
|
require('./chunk-KVG7YCTS.js');
|
|
51
54
|
require('./chunk-4UE5TCMQ.js');
|
|
52
55
|
require('./chunk-R5U7XKVJ.js');
|
|
@@ -98,4 +101,7 @@ require('./chunk-R5U7XKVJ.js');
|
|
|
98
101
|
|
|
99
102
|
|
|
100
103
|
|
|
101
|
-
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
exports.ANTHROPIC_TOOL_NAMES = _chunkTUU2BY5Ijs.ANTHROPIC_TOOL_NAMES; exports.APIError = _chunkTUU2BY5Ijs.APIError; exports.AuthError = _chunkTUU2BY5Ijs.AuthError; exports.CapabilityNotSupportedError = _chunkTUU2BY5Ijs.CapabilityNotSupportedError; exports.DEFAULT_MAX_MEDIA_BYTES = _chunkTUU2BY5Ijs.DEFAULT_MAX_MEDIA_BYTES; exports.FallbackExhaustedError = _chunkTUU2BY5Ijs.FallbackExhaustedError; exports.GEMINI_TOOL_NAMES = _chunkTUU2BY5Ijs.GEMINI_TOOL_NAMES; exports.HTTPStatusError = _chunkTUU2BY5Ijs.HTTPStatusError; exports.KeyEndpointError = _chunkTUU2BY5Ijs.KeyEndpointError; exports.LLMError = _chunkTUU2BY5Ijs.LLMError; exports.MediaTooLargeError = _chunkTUU2BY5Ijs.MediaTooLargeError; exports.MediaURLRefusedError = _chunkTUU2BY5Ijs.MediaURLRefusedError; exports.MissingKeyError = _chunkTUU2BY5Ijs.MissingKeyError; exports.ModelError = _chunkTUU2BY5Ijs.ModelError; exports.OPENAI_TOOL_NAMES = _chunkTUU2BY5Ijs.OPENAI_TOOL_NAMES; exports.PermissionDeniedError = _chunkTUU2BY5Ijs.PermissionDeniedError; exports.ProviderNotFoundError = _chunkTUU2BY5Ijs.ProviderNotFoundError; exports.RateLimitError = _chunkTUU2BY5Ijs.RateLimitError; exports.ResponseTooLargeError = _chunkTUU2BY5Ijs.ResponseTooLargeError; exports.StreamTruncatedError = _chunkTUU2BY5Ijs.StreamTruncatedError; exports.TOOL_NAMES_PARAM = _chunkTUU2BY5Ijs.TOOL_NAMES_PARAM; exports.ToolNameError = _chunkTUU2BY5Ijs.ToolNameError; exports.ToolNames = _chunkTUU2BY5Ijs.ToolNames; exports.applyAPIKey = _chunkTUU2BY5Ijs.applyAPIKey; exports.checkKeyEndpoint = _chunkTUU2BY5Ijs.checkKeyEndpoint; exports.checkToolChoice = _chunkTUU2BY5Ijs.checkToolChoice; exports.checkToolLinkage = _chunkTUU2BY5Ijs.checkToolLinkage; exports.clearRegistry = _chunkTUU2BY5Ijs.clearRegistry; exports.createLLM = _chunkTUU2BY5Ijs.createLLM; exports.credentialsTrusted = _chunkTUU2BY5Ijs.credentialsTrusted; exports.declarationOf = _chunkTUU2BY5Ijs.declarationOf; exports.fileSource = _chunkTUU2BY5Ijs.fileSource; exports.inlineSource = _chunkTUU2BY5Ijs.inlineSource; exports.isFallbackable = _chunkTUU2BY5Ijs.isFallbackable; exports.isPublicAddress = _chunkTUU2BY5Ijs.isPublicAddress; exports.isValidToolName = _chunkTUU2BY5Ijs.isValidToolName; exports.loadConfig = _chunkTUU2BY5Ijs.loadConfig; exports.loadConfigSpec = _chunkTUU2BY5Ijs.loadConfigSpec; exports.parseURI = _chunkTUU2BY5Ijs.parseURI; exports.redactURI = _chunkTUU2BY5Ijs.redactURI; exports.register = _chunkTUU2BY5Ijs.register; exports.requestStartedPayload = _chunkTUU2BY5Ijs.requestStartedPayload; exports.resolve = _chunkTUU2BY5Ijs.resolve; exports.resolveSpec = _chunkTUU2BY5Ijs.resolveSpec; exports.responseReceivedPayload = _chunkTUU2BY5Ijs.responseReceivedPayload; exports.sanitizeToolName = _chunkTUU2BY5Ijs.sanitizeToolName; exports.specURI = _chunkTUU2BY5Ijs.specURI; exports.toolNameModeOf = _chunkTUU2BY5Ijs.toolNameModeOf; exports.urlSource = _chunkTUU2BY5Ijs.urlSource; exports.usageCost = _chunkTUU2BY5Ijs.usageCost;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Completer, S as Streamer, T as ToolCaller, a as ToolStreamer, R as ResolvedConfig, b as Request, c as Response, f as ToolStream, d as ToolDef, e as ToolResponse } from './llm-
|
|
1
|
+
import { C as Completer, S as Streamer, T as ToolCaller, a as ToolStreamer, R as ResolvedConfig, b as Request, c as Response, f as ToolStream, d as ToolDef, e as ToolResponse } from './llm-BazFKc_2.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @packageDocumentation
|
package/dist/routellm.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './llm-
|
|
2
|
-
export { E as EvaConfig, P as ParsedModel, R as RouteLLMAdapter, a as RouterConfig, p as parseModelField, b as parseRouterConfig } from './routellm-
|
|
1
|
+
import './llm-BazFKc_2.js';
|
|
2
|
+
export { E as EvaConfig, P as ParsedModel, R as RouteLLMAdapter, a as RouterConfig, p as parseModelField, b as parseRouterConfig } from './routellm-B9UrONPr.js';
|
package/dist/routellm.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
5
|
+
var _chunkQ547MHNBjs = require('./chunk-Q547MHNB.js');
|
|
6
|
+
require('./chunk-MDVGMOZO.js');
|
|
7
|
+
require('./chunk-IGKBRNEW.js');
|
|
8
|
+
require('./chunk-TUU2BY5I.js');
|
|
9
9
|
require('./chunk-KVG7YCTS.js');
|
|
10
10
|
require('./chunk-4UE5TCMQ.js');
|
|
11
11
|
require('./chunk-R5U7XKVJ.js');
|
|
@@ -13,4 +13,4 @@ require('./chunk-R5U7XKVJ.js');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.RouteLLMAdapter =
|
|
16
|
+
exports.RouteLLMAdapter = _chunkQ547MHNBjs.RouteLLMAdapter; exports.parseModelField = _chunkQ547MHNBjs.parseModelField; exports.parseRouterConfig = _chunkQ547MHNBjs.parseRouterConfig;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { D as DriverOptions } from '../../version-DEJ3pbiO.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A {@link SchemaDriver} for configuration files, ported from Go
|
|
5
|
+
* `core/upgrade/driver/configfile`: backup copies each managed file into
|
|
6
|
+
* the backup directory, restore copies them back. The version lives in
|
|
7
|
+
* the Migrator's version file.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Options of a {@link ConfigFileDriver}. */
|
|
13
|
+
interface ConfigFileOptions extends DriverOptions {
|
|
14
|
+
/** The schema name (default `"config"`). */
|
|
15
|
+
name?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The backup file name of a managed path: the cleaned path with every
|
|
19
|
+
* separator turned into `_` (`/etc/foo/config.yaml` becomes
|
|
20
|
+
* `_etc_foo_config.yaml`), so two files named alike never collide.
|
|
21
|
+
*/
|
|
22
|
+
declare function backupFileName(p: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Backs up and restores one or more configuration files.
|
|
25
|
+
*
|
|
26
|
+
* A `SchemaDriver`; not declared with `implements` so the bundled declarations
|
|
27
|
+
* keep `SchemaDriver` out of a chunk shared with the root barrel (the tests
|
|
28
|
+
* check the fit).
|
|
29
|
+
*/
|
|
30
|
+
declare class ConfigFileDriver {
|
|
31
|
+
private readonly schema;
|
|
32
|
+
private readonly paths;
|
|
33
|
+
private readonly opts;
|
|
34
|
+
constructor(paths: readonly string[], options?: ConfigFileOptions);
|
|
35
|
+
name(): string;
|
|
36
|
+
version(): Promise<string>;
|
|
37
|
+
/** The Migrator writes the version file; nothing to do here. */
|
|
38
|
+
setVersion(): void;
|
|
39
|
+
/** Copies each managed file into `dest`; a file that does not exist is skipped. */
|
|
40
|
+
backup(dest: string): Promise<void>;
|
|
41
|
+
/** Copies each backed-up file back to its place; a file absent from `src` is skipped. */
|
|
42
|
+
restore(src: string): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { ConfigFileDriver, type ConfigFileOptions, backupFileName };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkB7XTFDBBjs = require('../../chunk-B7XTFDBB.js');
|
|
4
|
+
require('../../chunk-IDM6YZXN.js');
|
|
5
|
+
require('../../chunk-I6XDPSXQ.js');
|
|
6
|
+
require('../../chunk-4UE5TCMQ.js');
|
|
7
|
+
require('../../chunk-R5U7XKVJ.js');
|
|
8
|
+
|
|
9
|
+
// src/upgrade/drivers/configfile.ts
|
|
10
|
+
var _fs = require('fs');
|
|
11
|
+
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
12
|
+
var isMissing = (e) => e.code === "ENOENT";
|
|
13
|
+
var msg = (e) => e instanceof Error ? e.message : String(e);
|
|
14
|
+
function backupFileName(p) {
|
|
15
|
+
let clean = path.normalize(p);
|
|
16
|
+
if (clean.length > 1 && clean.endsWith(path.sep)) clean = clean.slice(0, -1);
|
|
17
|
+
return clean.split(path.sep).join("_");
|
|
18
|
+
}
|
|
19
|
+
var ConfigFileDriver = class {
|
|
20
|
+
constructor(paths, options = {}) {
|
|
21
|
+
this.paths = [...paths];
|
|
22
|
+
this.schema = _nullishCoalesce(options.name, () => ( "config"));
|
|
23
|
+
this.opts = { dataDir: options.dataDir, tool: options.tool };
|
|
24
|
+
}
|
|
25
|
+
name() {
|
|
26
|
+
return this.schema;
|
|
27
|
+
}
|
|
28
|
+
version() {
|
|
29
|
+
return _chunkB7XTFDBBjs.versionOf.call(void 0, this.opts, this.schema);
|
|
30
|
+
}
|
|
31
|
+
/** The Migrator writes the version file; nothing to do here. */
|
|
32
|
+
setVersion() {
|
|
33
|
+
}
|
|
34
|
+
/** Copies each managed file into `dest`; a file that does not exist is skipped. */
|
|
35
|
+
async backup(dest) {
|
|
36
|
+
try {
|
|
37
|
+
await _fs.promises.mkdir(dest, { recursive: true, mode: 488 });
|
|
38
|
+
} catch (e) {
|
|
39
|
+
throw new Error(`create backup dir: ${msg(e)}`, { cause: e });
|
|
40
|
+
}
|
|
41
|
+
for (const p of this.paths) {
|
|
42
|
+
const name = backupFileName(p);
|
|
43
|
+
try {
|
|
44
|
+
await copyFile(p, path.join(dest, name));
|
|
45
|
+
} catch (e) {
|
|
46
|
+
if (isMissing(e)) continue;
|
|
47
|
+
throw new Error(`backup ${name}: ${msg(e)}`, { cause: e });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** Copies each backed-up file back to its place; a file absent from `src` is skipped. */
|
|
52
|
+
async restore(src) {
|
|
53
|
+
for (const p of this.paths) {
|
|
54
|
+
const name = backupFileName(p);
|
|
55
|
+
const file = path.join(src, name);
|
|
56
|
+
try {
|
|
57
|
+
await _fs.promises.stat(file);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
if (isMissing(e)) continue;
|
|
60
|
+
throw new Error(`restore ${name}: ${msg(e)}`, { cause: e });
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
await copyFile(file, p);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
throw new Error(`restore ${name}: ${msg(e)}`, { cause: e });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
async function copyFile(src, dst) {
|
|
71
|
+
const data = await _fs.promises.readFile(src);
|
|
72
|
+
await _fs.promises.mkdir(path.dirname(dst), { recursive: true, mode: 488 });
|
|
73
|
+
await _fs.promises.writeFile(dst, data);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
exports.ConfigFileDriver = ConfigFileDriver; exports.backupFileName = backupFileName;
|