@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/wizard.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkCAONBSPOjs = require('./chunk-CAONBSPO.js');
|
|
20
|
+
require('./chunk-R5U7XKVJ.js');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
exports.ActionError = _chunkCAONBSPOjs.ActionError; exports.ActionRequest = _chunkCAONBSPOjs.ActionRequest; exports.ErrorAction = _chunkCAONBSPOjs.ErrorAction; exports.Step = _chunkCAONBSPOjs.Step; exports.StepKind = _chunkCAONBSPOjs.StepKind; exports.ValidationError = _chunkCAONBSPOjs.ValidationError; exports.Wizard = _chunkCAONBSPOjs.Wizard; exports.action = _chunkCAONBSPOjs.action; exports.confirm = _chunkCAONBSPOjs.confirm; exports.multiSelect = _chunkCAONBSPOjs.multiSelect; exports.resultBool = _chunkCAONBSPOjs.resultBool; exports.resultChoice = _chunkCAONBSPOjs.resultChoice; exports.resultString = _chunkCAONBSPOjs.resultString; exports.resultStrings = _chunkCAONBSPOjs.resultStrings; exports.select = _chunkCAONBSPOjs.select; exports.summary = _chunkCAONBSPOjs.summary; exports.textInput = _chunkCAONBSPOjs.textInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hop-top/kit",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.14",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/hop-top/poly-kit.git",
|
|
@@ -42,9 +42,29 @@
|
|
|
42
42
|
"default": "./dist/sqlstore.js"
|
|
43
43
|
},
|
|
44
44
|
"./upgrade": {
|
|
45
|
-
"types": "./dist/upgrade.d.ts",
|
|
46
|
-
"require": "./dist/upgrade.js",
|
|
47
|
-
"default": "./dist/upgrade.js"
|
|
45
|
+
"types": "./dist/upgrade/index.d.ts",
|
|
46
|
+
"require": "./dist/upgrade/index.js",
|
|
47
|
+
"default": "./dist/upgrade/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./upgrade/drivers/configfile": {
|
|
50
|
+
"types": "./dist/upgrade/drivers/configfile.d.ts",
|
|
51
|
+
"require": "./dist/upgrade/drivers/configfile.js",
|
|
52
|
+
"default": "./dist/upgrade/drivers/configfile.js"
|
|
53
|
+
},
|
|
54
|
+
"./upgrade/drivers/fsdir": {
|
|
55
|
+
"types": "./dist/upgrade/drivers/fsdir.d.ts",
|
|
56
|
+
"require": "./dist/upgrade/drivers/fsdir.js",
|
|
57
|
+
"default": "./dist/upgrade/drivers/fsdir.js"
|
|
58
|
+
},
|
|
59
|
+
"./upgrade/drivers/sqlite": {
|
|
60
|
+
"types": "./dist/upgrade/drivers/sqlite.d.ts",
|
|
61
|
+
"require": "./dist/upgrade/drivers/sqlite.js",
|
|
62
|
+
"default": "./dist/upgrade/drivers/sqlite.js"
|
|
63
|
+
},
|
|
64
|
+
"./upgrade/drivers/postgres": {
|
|
65
|
+
"types": "./dist/upgrade/drivers/postgres.d.ts",
|
|
66
|
+
"require": "./dist/upgrade/drivers/postgres.js",
|
|
67
|
+
"default": "./dist/upgrade/drivers/postgres.js"
|
|
48
68
|
},
|
|
49
69
|
"./llm": {
|
|
50
70
|
"types": "./dist/llm.d.ts",
|
|
@@ -175,6 +195,21 @@
|
|
|
175
195
|
"types": "./dist/compliance.d.ts",
|
|
176
196
|
"require": "./dist/compliance.js",
|
|
177
197
|
"default": "./dist/compliance.js"
|
|
198
|
+
},
|
|
199
|
+
"./uri": {
|
|
200
|
+
"types": "./dist/uri.d.ts",
|
|
201
|
+
"require": "./dist/uri.js",
|
|
202
|
+
"default": "./dist/uri.js"
|
|
203
|
+
},
|
|
204
|
+
"./wizard": {
|
|
205
|
+
"types": "./dist/wizard.d.ts",
|
|
206
|
+
"require": "./dist/wizard.js",
|
|
207
|
+
"default": "./dist/wizard.js"
|
|
208
|
+
},
|
|
209
|
+
"./bus": {
|
|
210
|
+
"types": "./dist/bus.d.ts",
|
|
211
|
+
"require": "./dist/bus.js",
|
|
212
|
+
"default": "./dist/bus.js"
|
|
178
213
|
}
|
|
179
214
|
},
|
|
180
215
|
"typesVersions": {
|
|
@@ -195,7 +230,19 @@
|
|
|
195
230
|
"./dist/sqlstore.d.ts"
|
|
196
231
|
],
|
|
197
232
|
"upgrade": [
|
|
198
|
-
"./dist/upgrade.d.ts"
|
|
233
|
+
"./dist/upgrade/index.d.ts"
|
|
234
|
+
],
|
|
235
|
+
"upgrade/drivers/configfile": [
|
|
236
|
+
"./dist/upgrade/drivers/configfile.d.ts"
|
|
237
|
+
],
|
|
238
|
+
"upgrade/drivers/fsdir": [
|
|
239
|
+
"./dist/upgrade/drivers/fsdir.d.ts"
|
|
240
|
+
],
|
|
241
|
+
"upgrade/drivers/sqlite": [
|
|
242
|
+
"./dist/upgrade/drivers/sqlite.d.ts"
|
|
243
|
+
],
|
|
244
|
+
"upgrade/drivers/postgres": [
|
|
245
|
+
"./dist/upgrade/drivers/postgres.d.ts"
|
|
199
246
|
],
|
|
200
247
|
"llm": [
|
|
201
248
|
"./dist/llm.d.ts"
|
|
@@ -274,6 +321,15 @@
|
|
|
274
321
|
],
|
|
275
322
|
"compliance": [
|
|
276
323
|
"./dist/compliance.d.ts"
|
|
324
|
+
],
|
|
325
|
+
"uri": [
|
|
326
|
+
"./dist/uri.d.ts"
|
|
327
|
+
],
|
|
328
|
+
"wizard": [
|
|
329
|
+
"./dist/wizard.d.ts"
|
|
330
|
+
],
|
|
331
|
+
"bus": [
|
|
332
|
+
"./dist/bus.d.ts"
|
|
277
333
|
]
|
|
278
334
|
}
|
|
279
335
|
},
|
|
@@ -286,45 +342,48 @@
|
|
|
286
342
|
}
|
|
287
343
|
},
|
|
288
344
|
"dependencies": {
|
|
289
|
-
"@bufbuild/protobuf": "^2.
|
|
290
|
-
"@clack/prompts": "^1.
|
|
291
|
-
"@connectrpc/connect": "^2.
|
|
292
|
-
"@connectrpc/connect-web": "^2.
|
|
345
|
+
"@bufbuild/protobuf": "^2.17.0",
|
|
346
|
+
"@clack/prompts": "^1.9.0",
|
|
347
|
+
"@connectrpc/connect": "^2.3.0",
|
|
348
|
+
"@connectrpc/connect-web": "^2.3.0",
|
|
293
349
|
"@hop-top/cite": "^0.1.2",
|
|
294
350
|
"@modelcontextprotocol/core": "2.4.0",
|
|
295
351
|
"@modelcontextprotocol/server": "2.4.0",
|
|
296
352
|
"better-sqlite3": "^12.11.1",
|
|
297
|
-
"commander": "15.
|
|
353
|
+
"commander": "15.1.0",
|
|
298
354
|
"csv-stringify": "^6.9.0",
|
|
299
355
|
"eta": "^4.6.0",
|
|
300
|
-
"hono": "^4.13.
|
|
356
|
+
"hono": "^4.13.18",
|
|
301
357
|
"js-yaml": "^4.3.2",
|
|
302
358
|
"picomatch": "^4.0.7",
|
|
303
359
|
"pino": "^10.4.0",
|
|
304
|
-
"semver": "^7.8.
|
|
360
|
+
"semver": "^7.8.6",
|
|
361
|
+
"tar": "7.5.23",
|
|
305
362
|
"zod": "^4.6.7"
|
|
306
363
|
},
|
|
307
364
|
"devDependencies": {
|
|
308
365
|
"@types/better-sqlite3": "^7.6.13",
|
|
309
366
|
"@types/js-yaml": "^4.0.9",
|
|
310
367
|
"@types/node": "^24",
|
|
368
|
+
"@types/pg": "^8.23.1",
|
|
311
369
|
"@types/picomatch": "^4.0.3",
|
|
312
370
|
"@types/semver": "^7.8.0",
|
|
313
371
|
"esbuild": "^0.28.2",
|
|
314
|
-
"eslint": "^10.
|
|
372
|
+
"eslint": "^10.14.0",
|
|
373
|
+
"pg": "^8.23.1",
|
|
315
374
|
"tsup": "^8",
|
|
316
375
|
"typeid-js": "^1.2.0",
|
|
317
376
|
"typescript": "^5",
|
|
318
|
-
"typescript-eslint": "^8.72.
|
|
319
|
-
"vite": "^8.3.
|
|
320
|
-
"vitest": "^5.0
|
|
377
|
+
"typescript-eslint": "^8.72.2",
|
|
378
|
+
"vite": "^8.3.8",
|
|
379
|
+
"vitest": "^5.1.0"
|
|
321
380
|
},
|
|
322
381
|
"engines": {
|
|
323
382
|
"node": ">=22.12"
|
|
324
383
|
},
|
|
325
384
|
"license": "MIT",
|
|
326
385
|
"scripts": {
|
|
327
|
-
"build": "tsup src/index.ts src/alias.ts src/cli.ts src/output.ts src/xdg.ts src/config.ts src/sqlstore.ts src/upgrade.ts src/llm.ts src/llm-anthropic.ts src/llm-openai.ts src/routellm.ts src/tui/index.ts src/errcorrect.ts src/safety.ts src/provenance.ts src/stream.ts src/progress.ts src/auth.ts src/api.ts src/rpc.ts src/aim.ts src/netpolicy.ts src/scope.ts src/serve.ts src/telemetry/index.ts src/id/index.ts src/mcp/index.ts src/log.ts src/completion.ts src/toolspec.ts src/completion-values.ts src/compliance.ts --format cjs --splitting --dts",
|
|
386
|
+
"build": "tsup src/index.ts src/alias.ts src/cli.ts src/output.ts src/xdg.ts src/config.ts src/sqlstore.ts src/upgrade/index.ts src/upgrade/drivers/configfile.ts src/upgrade/drivers/fsdir.ts src/upgrade/drivers/sqlite.ts src/upgrade/drivers/postgres.ts src/llm.ts src/llm-anthropic.ts src/llm-openai.ts src/routellm.ts src/tui/index.ts src/errcorrect.ts src/safety.ts src/provenance.ts src/stream.ts src/progress.ts src/auth.ts src/api.ts src/rpc.ts src/aim.ts src/netpolicy.ts src/scope.ts src/serve.ts src/telemetry/index.ts src/id/index.ts src/mcp/index.ts src/log.ts src/completion.ts src/toolspec.ts src/completion-values.ts src/compliance.ts src/uri.ts src/wizard.ts src/bus.ts --format cjs --splitting --dts",
|
|
328
387
|
"lint": "eslint src/",
|
|
329
388
|
"lint:fix": "eslint src/ --fix",
|
|
330
389
|
"typecheck": "tsc --noEmit -p tsconfig.json && tsc -p tsconfig.test.json",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hop-top-kit-ts",
|
|
3
|
+
"version": "0.5.0-alpha.14",
|
|
4
|
+
"description": "Build CLIs and services in TypeScript or JavaScript with the kit SDK `@hop-top/kit`, covering createCLI, output formats, layered config, MCP serving, safety guards, LLM adapters. Use when code imports `@hop-top/kit`, when adding kit to a Node project, or when a task needs a kit capability in TypeScript and you must check this port covers it. Not for choosing a language; the router skill does that.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "hop-top",
|
|
7
|
+
"url": "https://github.com/hop-top"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/hop-top/kit-ts/blob/main/skills/hop-top-kit-ts/SKILL.md",
|
|
10
|
+
"repository": "https://github.com/hop-top/kit-ts",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"hop-top",
|
|
14
|
+
"kit",
|
|
15
|
+
"agent-skill",
|
|
16
|
+
"typescript",
|
|
17
|
+
"node"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hop-top-kit-ts
|
|
3
|
+
description: Build CLIs and services in TypeScript or JavaScript with the kit SDK `@hop-top/kit`, covering createCLI, output formats, layered config, MCP serving, safety guards, LLM adapters. Use when code imports `@hop-top/kit`, when adding kit to a Node project, or when a task needs a kit capability in TypeScript and you must check this port covers it. Not for choosing a language; the router skill does that.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
version: "0.5.0-alpha.14" # x-release-please-version
|
|
7
|
+
min_version: "0.5.0-alpha.12"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# hop-top-kit-ts
|
|
11
|
+
|
|
12
|
+
kit's TypeScript port: package `@hop-top/kit`, CommonJS, Node 22.12 or newer (`engines` in its
|
|
13
|
+
package.json). Commander-based. Public API is subpath imports only (see Imports).
|
|
14
|
+
|
|
15
|
+
## Use another port when
|
|
16
|
+
|
|
17
|
+
- The task needs the `kit` binary, or a capability listed below as lacking: switch to Go or run the
|
|
18
|
+
binary as a sidecar. Choose with the
|
|
19
|
+
[router](https://github.com/hop-top/kit/blob/main/skills/hop-top-kit/SKILL.md) and
|
|
20
|
+
[other ports](references/other-ports.md).
|
|
21
|
+
- The project or the user is in another language (Python only, say): stay in that language when its
|
|
22
|
+
port covers the task. Counts across ports are in [other ports](references/other-ports.md); do not
|
|
23
|
+
pick TypeScript for coverage alone.
|
|
24
|
+
|
|
25
|
+
<!-- skills-sync:begin coverage -->
|
|
26
|
+
Tier: supported.
|
|
27
|
+
|
|
28
|
+
- CLI and console. Lacks: Markdown rendering, Config path commands, Fuzzy matching, Process status.
|
|
29
|
+
- Config, storage and secrets. Has only: Layered config, XDG paths, SQLite JSON store.
|
|
30
|
+
- Serving and transports. Lacks: Service command group, Transport service seam, Unix socket, Served authentication, Served observability, Bridge payloads.
|
|
31
|
+
- Events, jobs and runtime. Has only: Event bus, Telemetry.
|
|
32
|
+
- Guardrails and trust. Lacks: Breaker, Event policy engine, Operating mode, Audit log, Identity, Utilities, Avatars.
|
|
33
|
+
- AI and agents. Lacks: Command reflection, Agent CLI invocation, Extensions.
|
|
34
|
+
- Conformance and integrations. Has only: nothing.
|
|
35
|
+
<!-- skills-sync:end coverage -->
|
|
36
|
+
|
|
37
|
+
Per-capability status and evidence: [coverage](references/coverage.md). Find the capability there
|
|
38
|
+
before promising it. Matrix cell `partial`: the Evidence names the gap; stay only if the task avoids
|
|
39
|
+
it. `unverified`: the module exists and nothing pins it to Go; tell the user and test the behaviour
|
|
40
|
+
(check Telemetry here before relying on it). `none`: use Go or the sidecar.
|
|
41
|
+
|
|
42
|
+
`kit init` scaffolds a TypeScript project from the Go binary (`kit init <name> --runtime ts`, see
|
|
43
|
+
[kit init](https://github.com/hop-top/poly-kit/blob/next/docs/adopters/guides/kit-init.md)); this
|
|
44
|
+
port cannot scaffold, and the binary needs no Go toolchain when taken from a release or Homebrew
|
|
45
|
+
(see its [README](https://github.com/hop-top/poly-kit/blob/next/cmd/kit/README.md)).
|
|
46
|
+
|
|
47
|
+
## Install and first program
|
|
48
|
+
|
|
49
|
+
`pnpm add @hop-top/kit`. `assets/snippets/quickstart/` is the smallest program: `createCLI` from
|
|
50
|
+
`@hop-top/kit/cli`, one command, rows through `dispatch` from `@hop-top/kit/output`, so `--format`,
|
|
51
|
+
`--cols`, `-o` and `--template` work with no more code. Its expected output is checked in.
|
|
52
|
+
|
|
53
|
+
- `createCLI` returns `{ program, theme }`, not the Commander command.
|
|
54
|
+
- Async actions: end with `await program.parseAsync()`, not `parse()`.
|
|
55
|
+
- `ColumnSpec` needs `header` equal to `key`; `--cols` selects and reorders.
|
|
56
|
+
- Layered config: `load` from `@hop-top/kit/config`; see the CLI reference.
|
|
57
|
+
- Tests: `make test-ts-sdk` runs the snippets in the kit repo; in your project use your own runner.
|
|
58
|
+
|
|
59
|
+
## Imports
|
|
60
|
+
|
|
61
|
+
- Only keys of the `exports` map in kit's package.json (inside `node_modules`) resolve, as
|
|
62
|
+
`@hop-top/kit/<sub>`; a file under `src/` with no key does not. The package README names subpaths
|
|
63
|
+
the map lacks: trust package.json.
|
|
64
|
+
- The root `@hop-top/kit` is a barrel of namespaces (`import { output } from '@hop-top/kit'`;
|
|
65
|
+
`completion-values` becomes `completionValues`). Prefer subpaths: they load one module.
|
|
66
|
+
- Off the barrel on purpose, import by full subpath: `sqlstore` and the upgrade drivers
|
|
67
|
+
`configfile`, `fsdir`, `sqlite`, `postgres`. `sqlstore` and `sqlite` load native `better-sqlite3`,
|
|
68
|
+
`fsdir` loads `tar`; `postgres` keeps the root and `upgrade` free of any database client.
|
|
69
|
+
- Upgrade migrations: `Migrator` from `@hop-top/kit/upgrade`, a driver per backend. Postgres:
|
|
70
|
+
`@hop-top/kit/upgrade/drivers/postgres`, you pass the `pg` Pool; kit depends on no Postgres
|
|
71
|
+
client.
|
|
72
|
+
- Install with scripts disabled (`--ignore-scripts`) leaves `better-sqlite3` unbuilt: `sqlstore` and
|
|
73
|
+
the sqlite driver fail at load.
|
|
74
|
+
- Subpath names by area: cli, output, completion, completion-values, alias, tui, errcorrect, log,
|
|
75
|
+
progress, stream; config, xdg, sqlstore; serve, mcp, api, rpc, netpolicy, auth; safety, scope,
|
|
76
|
+
provenance, telemetry, id, upgrade; llm, anthropic, openai, routellm, toolspec, aim, compliance.
|
|
77
|
+
|
|
78
|
+
## Gotchas
|
|
79
|
+
|
|
80
|
+
- Delegation gates (`--confirm`, `--max-ops`, `--policy`, `--dry-run`) are reserved root flags; a
|
|
81
|
+
leaf named `delete`, `remove`, `rm`, `destroy`, `purge` or `drop` is gated as destructive and
|
|
82
|
+
blocked on MCP unless annotated.
|
|
83
|
+
- MCP exposure is default-closed, and `commanderBridge` needs your `run`.
|
|
84
|
+
- Telemetry records nothing without granted consent and a mode other than off.
|
|
85
|
+
- `--offline` guards `globalThis.fetch`; own clients wrap `guardFetch`.
|
|
86
|
+
- Importing `anthropic`, `openai` or `routellm` registers their URI schemes.
|
|
87
|
+
|
|
88
|
+
<!-- skills-sync:begin version -->
|
|
89
|
+
## Versions
|
|
90
|
+
|
|
91
|
+
Written for 0.5.0-alpha.14 # x-release-please-version
|
|
92
|
+
Expects 0.5.0-alpha.12 or newer.
|
|
93
|
+
|
|
94
|
+
Installed: `npm ls @hop-top/kit` or `pnpm ls @hop-top/kit`; `scripts/detect-port.sh` shows what the
|
|
95
|
+
manifest pins. Older than expected: tell the user, upgrade (`pnpm add @hop-top/kit@latest`). Newer
|
|
96
|
+
than written for: this copy may be stale; update it, then re-read it. Update by install channel,
|
|
97
|
+
then restart the harness: Claude Code plugin `claude plugin marketplace update hop-top`, then
|
|
98
|
+
`claude plugin update hop-top-kit-ts@hop-top` (marketplace repository `hop-top/skillset`);
|
|
99
|
+
`npx skills` from a GitHub source `npx skills update -g -y` (project scope
|
|
100
|
+
`npx skills update -p -y`), from any other source run the same `npx skills add` again; gym
|
|
101
|
+
`gym update`, then `gym train`; by hand: take `skills/hop-top-kit-ts` again from `hop-top/kit-ts` at
|
|
102
|
+
`main`.
|
|
103
|
+
<!-- skills-sync:end version -->
|
|
104
|
+
|
|
105
|
+
## Open when
|
|
106
|
+
|
|
107
|
+
| File | Open when |
|
|
108
|
+
|------|-----------|
|
|
109
|
+
| `references/coverage.md` | a capability's status or Evidence is needed (is it pinned to Go?) before promising it |
|
|
110
|
+
| `references/other-ports.md` | switching port, or the router and ports table are needed |
|
|
111
|
+
| `references/cli-and-console.md` | wiring commands, output flags, completion, aliases, logging, layered config or XDG paths |
|
|
112
|
+
| `references/serving-and-transports.md` | serving a service lifecycle, MCP, REST or ConnectRPC |
|
|
113
|
+
| `references/guardrails-and-trust.md` | adding safety, scope, netpolicy, telemetry, TypeID or upgrade migrations |
|
|
114
|
+
| `references/ai-and-agents.md` | calling an LLM, routing models, emitting a toolspec or running compliance |
|
|
115
|
+
| `assets/snippets/quickstart/` | starting a CLI that renders rows in several formats |
|
|
116
|
+
| `assets/snippets/mcp/` | exposing a command tree as MCP tools |
|
|
117
|
+
| `scripts/detect-port.sh` | the kit version a project pins is unknown |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createMcpHandler, commanderBridge } from '@hop-top/kit/mcp';
|
|
3
|
+
|
|
4
|
+
const root = new Command('app');
|
|
5
|
+
root.command('ping').description('Ping the server');
|
|
6
|
+
|
|
7
|
+
const bridge = commanderBridge(root, {
|
|
8
|
+
run: async () => ({ stdout: 'pong\n', exitCode: 0 }),
|
|
9
|
+
});
|
|
10
|
+
const handler = createMcpHandler(bridge, {
|
|
11
|
+
serverInfo: { name: 'app', version: '0.1' },
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const res = await handler({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: { 'content-type': 'application/json' },
|
|
17
|
+
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/list' }),
|
|
18
|
+
});
|
|
19
|
+
console.log(res.status);
|
|
20
|
+
console.log(JSON.parse(String(res.body)).result.tools.map((t: { name: string }) => t.name));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createCLI } from '@hop-top/kit/cli';
|
|
2
|
+
import { dispatch } from '@hop-top/kit/output';
|
|
3
|
+
|
|
4
|
+
const { program } = createCLI({
|
|
5
|
+
name: 'mytool',
|
|
6
|
+
version: '1.0',
|
|
7
|
+
description: 'does things',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const rows = [
|
|
11
|
+
{ id: '1', name: 'Alice' },
|
|
12
|
+
{ id: '2', name: 'Bob' },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
program.command('list').action(async () => {
|
|
16
|
+
await dispatch(program, rows, {
|
|
17
|
+
columns: [
|
|
18
|
+
{ header: 'id', key: 'id' },
|
|
19
|
+
{ header: 'name', key: 'name' },
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// A real tool ends with `program.parse()`; the snippet passes its argv.
|
|
25
|
+
await program.parseAsync(['list', '--format', 'json'], { from: 'user' });
|
|
26
|
+
await program.parseAsync(['list'], { from: 'user' });
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# AI and agents
|
|
2
|
+
|
|
3
|
+
Open when calling an LLM, routing between models, emitting a capability manifest or running the
|
|
4
|
+
12-factor check. Status per capability: [coverage](coverage.md). Depth:
|
|
5
|
+
[TypeScript API reference](https://github.com/hop-top/poly-kit/blob/next/docs/adopters/reference/ts-api-reference.md)
|
|
6
|
+
(sections LLM adapters, LLM tool calling, Capability manifest).
|
|
7
|
+
|
|
8
|
+
## Modules
|
|
9
|
+
|
|
10
|
+
| Import | Use for | Cue |
|
|
11
|
+
|--------|---------|-----|
|
|
12
|
+
| `@hop-top/kit/llm` | client, registry, fallback, tool calling | `createLLM(uri, { fallback })`, `parseURI`, `loadConfig` |
|
|
13
|
+
| `@hop-top/kit/anthropic` | `anthropic://` scheme | import for its side effect, then `createLLM` |
|
|
14
|
+
| `@hop-top/kit/openai` | `openai://` and OpenAI-compatible schemes | same; `lmstudio://` needs no key |
|
|
15
|
+
| `@hop-top/kit/routellm` | `routellm://` strong/weak routing server | adapter over the openai one |
|
|
16
|
+
| `@hop-top/kit/toolspec` | `<tool> spec` capability manifest | `registerSpecCommand(program, '1.0')` after all commands |
|
|
17
|
+
| `@hop-top/kit/compliance` | 12-factor CLI check | `Factor` enum; static and runtime checks |
|
|
18
|
+
| `@hop-top/kit/aim` | model registry (models.dev source, cache) | `Registry`, `ModelsDevSource`, `Cache` |
|
|
19
|
+
|
|
20
|
+
Matrix cell `unverified`: LLM routing (`@hop-top/kit/routellm`). The LLM client and providers
|
|
21
|
+
are `partial`: Evidence names the gap (no Google or Ollama adapter here). Read it in coverage.
|
|
22
|
+
|
|
23
|
+
## LLM
|
|
24
|
+
|
|
25
|
+
- An adapter registers its URI schemes when imported: forget the import and `createLLM` has no
|
|
26
|
+
provider for the scheme.
|
|
27
|
+
- Key order: the URI's `api_key`, then `llm.yaml` (under the `hop` config dir), then the scheme's
|
|
28
|
+
env var (`ANTHROPIC_API_KEY`, `<SCHEME>_API_KEY`), then `LLM_API_KEY`. A key found nowhere
|
|
29
|
+
throws `MissingKeyError`, listing the variables consulted.
|
|
30
|
+
- `stream` and `streamWithTools` return a `ToolStream`: iterate tokens, then `outcome()` holds
|
|
31
|
+
content, tool calls and usage; it is undefined before the stream ends.
|
|
32
|
+
- `{ hermetic: true }` on `createLLM` reads nothing ambient (no env keys, no `llm.yaml`): the
|
|
33
|
+
URI alone configures the provider.
|
|
34
|
+
- The client corpus is shared with Go, Rust and Python; behaviour beyond it is this port's.
|
|
35
|
+
- The in-process RouteLLM controller and the Triton client have source under `src/` but no
|
|
36
|
+
entry in the package `exports` map when this was written: import `routellm` for the server
|
|
37
|
+
adapter; the controller and Triton are not importable.
|
|
38
|
+
|
|
39
|
+
## Toolspec
|
|
40
|
+
|
|
41
|
+
- Commands describe themselves with `kit/*` annotations (`kit/side-effect`, `kit/args`,
|
|
42
|
+
`kit/exit-codes`, `kit/output-schema`). Register once, after every command exists.
|
|
43
|
+
- `spec --format kit-manifest` emits Go's manifest byte for byte; `spec coverage --min N`
|
|
44
|
+
exits 4 below `N`. The `mcp` format and Go's curation options are not ported.
|
|
45
|
+
- Reflecting a command tree at runtime and invoking other agent CLIs are Go-only (coverage).
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# CLI and console
|
|
2
|
+
|
|
3
|
+
Open when wiring a command tree, output flags, completion, aliases, styled terminal output,
|
|
4
|
+
logging, layered config or XDG paths. Status per capability: [coverage](coverage.md). Depth:
|
|
5
|
+
[TypeScript API reference](https://github.com/hop-top/poly-kit/blob/next/docs/adopters/reference/ts-api-reference.md).
|
|
6
|
+
|
|
7
|
+
## Modules
|
|
8
|
+
|
|
9
|
+
| Import | Use for | Cue |
|
|
10
|
+
|--------|---------|-----|
|
|
11
|
+
| `@hop-top/kit/cli` | `createCLI`, command groups, delegation gates | `setCommandGroup`, `verboseCount`, `isQuiet`, `isDryRun`, `renderPlan`, `buildTheme` |
|
|
12
|
+
| `@hop-top/kit/output` | five formatters behind `--format` | `registerOutputFlags`, `dispatch`, `newRegistry`; `render` is the legacy shim |
|
|
13
|
+
| `@hop-top/kit/completion` | `completion bash\|zsh\|fish\|powershell` | `completionCommand(program)`; `bindFlag`, `bindArgs` attach completers |
|
|
14
|
+
| `@hop-top/kit/completion-values` | completer building blocks | used with `bindFlag` and `bindArgs` |
|
|
15
|
+
| `@hop-top/kit/alias` | user aliases for subcommands | `AliasStore`, `Expander`, `bridgeAliases` |
|
|
16
|
+
| `@hop-top/kit/tui` | status, badge, spinner, progress, prompts | `status(theme, text, level)`; theme from `buildTheme()` |
|
|
17
|
+
|
|
18
|
+
Matrix cell `unverified` (module exists, no Go pin): `@hop-top/kit/log` (`createLogger`),
|
|
19
|
+
`@hop-top/kit/progress` (`ProgressReporter`), `@hop-top/kit/errcorrect`
|
|
20
|
+
(`createCorrectedError`), `@hop-top/kit/config`, `@hop-top/kit/xdg`, `@hop-top/kit/sqlstore`.
|
|
21
|
+
Check each in coverage, tell the user, and test the behaviour you rely on.
|
|
22
|
+
|
|
23
|
+
URI scheme handlers, the wizard and flag helpers also sit under `unverified`, but their source
|
|
24
|
+
files have no key in the package `exports` map when this was written: you cannot import them.
|
|
25
|
+
Check the map.
|
|
26
|
+
|
|
27
|
+
## Output flags
|
|
28
|
+
|
|
29
|
+
- `createCLI` registers the suite; `--format` default is `table`. `-o report.csv` infers the
|
|
30
|
+
formatter from the extension; `--format json -o report.csv` is a hard error.
|
|
31
|
+
- `--template` takes eta syntax (`<%= %>`), not Go's `{{ }}`; it excludes `--cols`.
|
|
32
|
+
- Pass `columns` to `dispatch` for a fixed order; without it, rows print in key order.
|
|
33
|
+
- A formatter option goes `--format-opt key=value`; `--format-help` lists them.
|
|
34
|
+
|
|
35
|
+
## Layered config and paths
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { load } from '@hop-top/kit/config';
|
|
39
|
+
import { configDir } from '@hop-top/kit/xdg';
|
|
40
|
+
import { join } from 'node:path';
|
|
41
|
+
|
|
42
|
+
const cfg = load<{ host?: string }>({ host: 'localhost' }, {
|
|
43
|
+
userConfigPath: join(configDir('mytool'), 'config.yaml'),
|
|
44
|
+
projectConfigPath: '.mytool.yaml',
|
|
45
|
+
envOverride: (c) => { if (process.env.MYTOOL_HOST) c.host = process.env.MYTOOL_HOST; },
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- Order, lowest first: system, user, project, `envOverride`. A missing file is skipped.
|
|
50
|
+
- `load` fills and returns `dst`. Objects merge deeply; arrays and scalars replace. Go differs
|
|
51
|
+
on map entries and kind mismatches: do not share one config file contract with Go unchecked.
|
|
52
|
+
- `configDir` is `XDG_CONFIG_HOME` when set; otherwise macOS `~/Library/Preferences/<tool>`,
|
|
53
|
+
not `~/.config`. Pin `XDG_CONFIG_HOME` in tests.
|
|
54
|
+
- Merge options (`nullPolicy`, `arrayPolicy`, `maxDepth`) and `mergeLayers` for parsed objects:
|
|
55
|
+
see the API reference, "Layer merge rules".
|
|
56
|
+
|
|
57
|
+
## Traps
|
|
58
|
+
|
|
59
|
+
- `program.command('x').action(async ...)` needs `await program.parseAsync()`.
|
|
60
|
+
- Do not name your own leaf flag `--policy`, `--confirm`, `--max-ops` or `--dry-run` for another
|
|
61
|
+
meaning: the root owns them (a leaf's own flag of that name is the leaf's).
|
|
62
|
+
- Not in this port (coverage lists them): markdown rendering, config path commands, fuzzy
|
|
63
|
+
matching, process status. Use Go or the sidecar.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# TypeScript coverage
|
|
2
|
+
|
|
3
|
+
Generated by `make skills-sync` from the capability parity page. Do not edit by hand.
|
|
4
|
+
|
|
5
|
+
Tier: supported. Needs Node 22.12+. Source of truth: [capability parity](https://github.com/hop-top/poly-kit/blob/next/docs/adopters/reference/capability-parity.md).
|
|
6
|
+
|
|
7
|
+
## done (11)
|
|
8
|
+
|
|
9
|
+
A parity contract, shared corpus or cross-language test pins the SDK's behavior to Go.
|
|
10
|
+
|
|
11
|
+
- CLI and console: CLI factory, Output and errors, Shell completion, Aliases, Help rendering
|
|
12
|
+
- Serving and transports: Serve lifecycle, MCP server
|
|
13
|
+
- Guardrails and trust: Path scope, TypeID
|
|
14
|
+
- AI and agents: Toolspec, 12-factor compliance check
|
|
15
|
+
|
|
16
|
+
## partial (9)
|
|
17
|
+
|
|
18
|
+
The SDK ships a subset: a documented gap, one leg of the capability, or a stub.
|
|
19
|
+
|
|
20
|
+
- TUI components (CLI and console): parity.json blocks (status, spinner, anim, help, verbosity, streams); ts:tui/ py:tui/ rs:tui/ (progress, bar, spinner, status, confirm, app shell; no list or dialog); php Tui.php is an empty placeholder
|
|
21
|
+
- Command surface bridge (Serving and transports): MCP leg only: ts:mcp/bridge.ts py:mcp/bridge.py rs:mcp/bridge.rs php:Mcp/Bridge.php
|
|
22
|
+
- Redaction (Guardrails and trust): make test-parity-redact (Go/Rs); ts:telemetry/redact.ts py:telemetry/redact.py php:Telemetry/Redactor.php cover telemetry only
|
|
23
|
+
- Consent grants (Guardrails and trust): make test-parity-consent (Go/Rs, contracts/consent-v1); ts:telemetry/consent.ts py:telemetry/consent.py php:Telemetry/Consent.php are telemetry consent only
|
|
24
|
+
- Side-effect seams (Guardrails and trust): ts:sideeffect.ts py:sideeffect.py rs:sideeffect/ (--dry-run flag and per-command tiers not wired) php:Cli/SideEffect.php; shared annotation tiers, no corpus
|
|
25
|
+
- Upgrade and migrations (Guardrails and trust): make test-parity-upgrade (Go/Rs/Py/TS/PHP), every runner on all three corpus files; rs:upgrade/ is migrations plus the offline-aware release check (download and replace not ported); py:upgrade/ and ts:upgrade/ have the release check, lenient semver, Migration, Registry, the document migrator and the Migrator; php:Upgrade/ has the same without the release check; drivers: py configfile, fsdir, sqlite, postgres; ts configfile, fsdir, sqlite, postgres; php configfile, fsdir, sqlite, postgres; rs configfile, fsdir, sqlite, postgres; no port has the migrate command tree or a tidb driver
|
|
26
|
+
- LLM client (AI and agents): make test-parity-llm (Go/Rs/Py/TS, contracts/llm-v1); ts:llm.ts py:llm.py rs:llm/
|
|
27
|
+
- LLM providers (AI and agents): ts:llm-anthropic.ts llm-openai.ts (a Triton client exists in `src/triton/` but is not exported); py:llm_anthropic.py llm_openai.py rs:llm/ (anthropic, openai, google, ollama, triton); ts and py have no Google or Ollama adapter
|
|
28
|
+
- LLM routing (AI and agents): ts:routellm.ts (the RouteLLM adapter; the native router in `src/router/` exists but is not exported) py:routellm_adapter.py routellm_grpc.py rs:llm/router/ rs:llm/routellm/
|
|
29
|
+
|
|
30
|
+
## unverified (17)
|
|
31
|
+
|
|
32
|
+
A module exists but nothing in the repo pins it to Go; depth not checked.
|
|
33
|
+
|
|
34
|
+
- CLI and console: Logging, Flag helpers, Autocorrect, URI scheme handlers, Wizard, Progress events
|
|
35
|
+
- Config, storage and secrets: Layered config, XDG paths, SQLite JSON store
|
|
36
|
+
- Serving and transports: REST API toolkit, ConnectRPC, Served middleware
|
|
37
|
+
- Events, jobs and runtime: Event bus, Telemetry
|
|
38
|
+
- Guardrails and trust: Network policy, Delegation safety, Provenance
|
|
39
|
+
|
|
40
|
+
## none (36)
|
|
41
|
+
|
|
42
|
+
No module for the capability in the SDK tree.
|
|
43
|
+
|
|
44
|
+
- CLI and console: Markdown rendering, Config path commands, Fuzzy matching, Process status
|
|
45
|
+
- Config, storage and secrets: Project registry, Key-value store, Blob store, SQLite connections, HTTP cache, Secrets
|
|
46
|
+
- Serving and transports: Service command group, Transport service seam, Unix socket, Served authentication, Served observability, Bridge payloads
|
|
47
|
+
- Events, jobs and runtime: Job queue, Notifications, Domain building blocks, Entity sync, Peer mesh
|
|
48
|
+
- Guardrails and trust: Breaker, Event policy engine, Operating mode, Audit log, Identity, Utilities, Avatars
|
|
49
|
+
- AI and agents: Command reflection, Agent CLI invocation, Extensions
|
|
50
|
+
- Conformance and integrations: Conformance assertions, Conformance harness, Scenario and story DSL, Cassettes and grading client, Repo host drivers
|
|
51
|
+
|
|
52
|
+
## n/a (1)
|
|
53
|
+
|
|
54
|
+
The capability is a language seam that has no counterpart in that SDK.
|
|
55
|
+
|
|
56
|
+
- CLI and console: Command annotations
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Guardrails and trust
|
|
2
|
+
|
|
3
|
+
Open when adding delegation safety, path scope, offline enforcement, provenance, telemetry,
|
|
4
|
+
TypeIDs or upgrade migrations. Status per capability: [coverage](coverage.md). Depth:
|
|
5
|
+
[TypeScript API reference](https://github.com/hop-top/poly-kit/blob/next/docs/adopters/reference/ts-api-reference.md).
|
|
6
|
+
|
|
7
|
+
## Modules
|
|
8
|
+
|
|
9
|
+
| Import | Use for | Cue |
|
|
10
|
+
|--------|---------|-----|
|
|
11
|
+
| `@hop-top/kit/safety` | `--force` guard for destructive work | `safetyGuard(level, { force })`; levels `read`, `caution`, `dangerous` |
|
|
12
|
+
| `@hop-top/kit/scope` | filesystem path policy | `Default().check(path, Op.Read)`; deny list shared with Go |
|
|
13
|
+
| `@hop-top/kit/netpolicy` | `--offline` enforcement | `guardFetch`, `isOffline`, `isOfflineError` |
|
|
14
|
+
| `@hop-top/kit/provenance` | origin metadata on payloads | `withProvenance(data, { source, timestamp, method })` gives `{ data, _meta }` |
|
|
15
|
+
| `@hop-top/kit/telemetry` | consent-gated usage events | `Client`, `resolveMode`, `redact` |
|
|
16
|
+
| `@hop-top/kit/id` | TypeID primitive | mint and parse prefixed ids |
|
|
17
|
+
| `@hop-top/kit/upgrade` | release check, migrations | `createChecker`, `Migrator`, `migrateDocument` |
|
|
18
|
+
|
|
19
|
+
Matrix cell `unverified`: `@hop-top/kit/safety`, `@hop-top/kit/netpolicy`,
|
|
20
|
+
`@hop-top/kit/provenance`, `@hop-top/kit/telemetry`, and the event bus (no `exports` key for it
|
|
21
|
+
when this was written: not importable). Redaction, consent and side-effect seams
|
|
22
|
+
are `partial`; read their Evidence in coverage. Tell the user what is unpinned and test it.
|
|
23
|
+
|
|
24
|
+
## Delegation gates (in `cli`)
|
|
25
|
+
|
|
26
|
+
- Root `--confirm`, `--confirm-token`, `--max-ops`, `--policy`, `--dry-run` enforce a leaf's
|
|
27
|
+
`kit/side-effect` annotation, set on `annotations` of the command.
|
|
28
|
+
- An unannotated leaf named `delete`, `remove`, `rm`, `destroy`, `purge` or `drop` is gated as
|
|
29
|
+
destructive. A value outside the tier set is refused before the handler runs.
|
|
30
|
+
- Handlers under `--dry-run` call `isDryRun(cmd)` and `renderPlan`.
|
|
31
|
+
- Permission rules and per-caller budgets are loaded but never evaluated here.
|
|
32
|
+
- Guide: [guard destructive commands](https://github.com/hop-top/poly-kit/blob/next/docs/adopters/guides/guard-destructive-commands.md).
|
|
33
|
+
|
|
34
|
+
## Telemetry
|
|
35
|
+
|
|
36
|
+
- Default-denied: `record` does nothing without a granted consent decision and a mode other
|
|
37
|
+
than `off` (`KIT_TELEMETRY_MODE`). This port reads consent; granting it is the `kit` binary.
|
|
38
|
+
- `record` never throws and returns at once; end with `await client.shutdown(ms)`.
|
|
39
|
+
- Redaction and consent here cover telemetry only, and the Go parity targets named for them are
|
|
40
|
+
Go and Rust. The envelope names events freely (`event` plus `attrs`), unlike Go's command
|
|
41
|
+
path. Read the Telemetry cell in coverage before saying it matches Go.
|
|
42
|
+
|
|
43
|
+
## Offline
|
|
44
|
+
|
|
45
|
+
`createCLI` installs `guardFetch` on `globalThis.fetch` for `--offline`; loopback stays open.
|
|
46
|
+
It does not cover `node:net`, `http.request`, database drivers or a client built with its own
|
|
47
|
+
`fetch`: those call `isOffline()` themselves or wrap their transport with `guardFetch`.
|
|
48
|
+
|
|
49
|
+
## Upgrade migrations
|
|
50
|
+
|
|
51
|
+
- `Migrator` from `@hop-top/kit/upgrade`; one driver per backend, each its own import:
|
|
52
|
+
`@hop-top/kit/upgrade/drivers/configfile`, `.../fsdir`, `.../sqlite`, `.../postgres`.
|
|
53
|
+
- Postgres: `await openPostgresDriver({ db: pool, connect: () => pool.connect(), table })`;
|
|
54
|
+
you own the `pg` Pool (at least two connections); no backup or restore.
|
|
55
|
+
- Same Postgres table and lock key as Go, so Go and TypeScript Migrators exclude each other.
|
|
56
|
+
`SqliteDriver` locks with `BEGIN EXCLUSIVE` on `.lock.db`, which does not exclude other ports.
|
|
57
|
+
- Drivers take your `dataDir`; the Migrator keeps versions under it.
|
|
58
|
+
- In the kit repo, `make test-ts-upgrade-integration` runs driver tests that need native
|
|
59
|
+
`better-sqlite3` or Docker; `make test-ts-sdk` does not.
|
|
60
|
+
- Not here: self-update (download and replace) and a migrate command tree: Go or the sidecar.
|