@hop-top/kit 0.5.0-alpha.1 → 0.5.0-alpha.11
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 +275 -0
- package/LICENSE +1 -1
- package/LICENSE-cobra.txt +174 -0
- package/NOTICE +15 -0
- package/README.md +55 -259
- package/dist/aim-DZHwwiIc.d.ts +139 -0
- package/dist/aim.d.ts +1 -116
- package/dist/aim.js +13 -414
- package/dist/alias-D9_qFlyP.d.ts +174 -0
- package/dist/alias.d.ts +2 -73
- package/dist/alias.js +27 -207
- package/dist/api-DAexsu2H.d.ts +77 -0
- package/dist/api.d.ts +1 -62
- package/dist/api.js +10 -164
- package/dist/auth-2-jfgiHn.d.ts +34 -0
- package/dist/auth.d.ts +1 -26
- package/dist/auth.js +6 -40
- package/dist/chunk-3FIKGFKI.js +54 -0
- package/dist/chunk-4FMALWYB.js +669 -0
- package/dist/chunk-4GPCWBBA.js +143 -0
- package/dist/chunk-4UE5TCMQ.js +104 -0
- package/dist/chunk-65VPWMPV.js +1134 -0
- package/dist/chunk-6HFAEZ52.js +29 -0
- package/dist/chunk-6SVOHNIC.js +17 -0
- package/dist/chunk-BDNNPRX6.js +41 -0
- package/dist/chunk-BRNEKPWX.js +37 -0
- package/dist/chunk-BXJ2J27B.js +219 -0
- package/dist/chunk-CSJWB6D3.js +151 -0
- package/dist/chunk-CXBZTONY.js +65 -0
- package/dist/chunk-EE4M2UOF.js +818 -0
- package/dist/chunk-GFRAYYRD.js +817 -0
- package/dist/chunk-IVQHLI56.js +1890 -0
- package/dist/chunk-IZ6Q4SE3.js +178 -0
- package/dist/chunk-JKMQSAJP.js +174 -0
- package/dist/chunk-K7E34Q3A.js +1445 -0
- package/dist/chunk-KVG7YCTS.js +115 -0
- package/dist/chunk-L23O2FFE.js +51 -0
- package/dist/chunk-MFVUENZR.js +1549 -0
- package/dist/chunk-ML7D5DWY.js +263 -0
- package/dist/chunk-MQXYDYRD.js +968 -0
- package/dist/chunk-POR5L2DG.js +247 -0
- package/dist/chunk-QJVSKKRQ.js +369 -0
- package/dist/chunk-QQQYCWSC.js +240 -0
- package/dist/chunk-R5U7XKVJ.js +16 -0
- package/dist/chunk-RYKLVOVK.js +309 -0
- package/dist/chunk-SNVGDYX7.js +187 -0
- package/dist/chunk-T6OZMPPV.js +68 -0
- package/dist/chunk-UKZIAQA7.js +26 -0
- package/dist/chunk-VGOA5Y7S.js +251 -0
- package/dist/chunk-VWGP4NVJ.js +513 -0
- package/dist/chunk-WBVO43HU.js +355 -0
- package/dist/chunk-WUOAQVOA.js +86 -0
- package/dist/chunk-XJTRY453.js +868 -0
- package/dist/chunk-YOBAUCVN.js +583 -0
- package/dist/cli-RSRk1M36.d.ts +707 -0
- package/dist/cli.d.ts +7 -309
- package/dist/cli.js +125 -945
- package/dist/completion-csVun6SP.d.ts +112 -0
- package/dist/completion-values-By-mnjNt.d.ts +142 -0
- package/dist/completion-values.d.ts +1 -0
- package/dist/completion-values.js +29 -0
- package/dist/completion.d.ts +3 -0
- package/dist/completion.js +34 -0
- package/dist/compliance-AxFf-uMy.d.ts +60 -0
- package/dist/compliance.d.ts +1 -0
- package/dist/compliance.js +17 -0
- package/dist/config-CaK60ByQ.d.ts +241 -0
- package/dist/config.d.ts +1 -97
- package/dist/config.js +8 -78
- package/dist/errcorrect-BcX1Ft0K.d.ts +44 -0
- package/dist/errcorrect.d.ts +1 -37
- package/dist/errcorrect.js +8 -68
- package/dist/error-Do8Qji43.d.ts +231 -0
- package/dist/id/index.d.ts +2 -83
- package/dist/id/index.js +14 -65
- package/dist/index-BKJZClJx.d.ts +1486 -0
- package/dist/index-C3Zw4wDJ.d.ts +359 -0
- package/dist/index-CGE5yLBj.d.ts +328 -0
- package/dist/index-VLDcI5NF.d.ts +95 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +132 -0
- package/dist/llm-DYuR7_uX.d.ts +1069 -0
- package/dist/llm-anthropic-Cd_I2xXB.d.ts +67 -0
- package/dist/llm-anthropic.d.ts +2 -0
- package/dist/llm-anthropic.js +13 -0
- package/dist/llm-openai-DyFrucmV.d.ts +87 -0
- package/dist/llm-openai.d.ts +2 -0
- package/dist/llm-openai.js +19 -0
- package/dist/llm.d.ts +1 -188
- package/dist/llm.js +101 -356
- package/dist/log-CkaxMX3U.d.ts +115 -0
- package/dist/log.d.ts +2 -0
- package/dist/log.js +14 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.js +185 -0
- package/dist/netpolicy-Brx5XZUB.d.ts +151 -0
- package/dist/netpolicy.d.ts +1 -0
- package/dist/netpolicy.js +25 -0
- package/dist/output-CjZWmL8s.d.ts +420 -0
- package/dist/output.d.ts +3 -213
- package/dist/output.js +135 -447
- package/dist/parity-CvMuYcVI.d.ts +61 -0
- package/dist/progress-CAzyxeWl.d.ts +38 -0
- package/dist/progress.d.ts +1 -30
- package/dist/progress.js +6 -55
- package/dist/provenance-SMFHm5gx.d.ts +30 -0
- package/dist/provenance.d.ts +1 -24
- package/dist/provenance.js +6 -31
- package/dist/routellm-B0nv59mH.d.ts +111 -0
- package/dist/routellm.d.ts +2 -64
- package/dist/routellm.js +13 -255
- package/dist/rpc-D31Lg0Kc.d.ts +32 -0
- package/dist/rpc.d.ts +2 -25
- package/dist/rpc.js +4 -98
- package/dist/safety-CUaYEjZc.d.ts +30 -0
- package/dist/safety.d.ts +1 -24
- package/dist/safety.js +6 -43
- package/dist/scope-BrhYB4ij.d.ts +141 -0
- package/dist/scope.d.ts +1 -121
- package/dist/scope.js +20 -377
- package/dist/serve-D8yWMrTc.d.ts +646 -0
- package/dist/serve.d.ts +3 -0
- package/dist/serve.js +75 -0
- package/dist/sqlstore.js +6 -39
- package/dist/stream-CrjeCp0M.d.ts +44 -0
- package/dist/stream.d.ts +1 -35
- package/dist/stream.js +8 -51
- package/dist/telemetry/index.d.ts +1 -315
- package/dist/telemetry/index.js +26 -599
- package/dist/toolspec-DcPwwoAZ.d.ts +368 -0
- package/dist/toolspec.d.ts +2 -0
- package/dist/toolspec.js +37 -0
- package/dist/tui/index.d.ts +6 -298
- package/dist/tui/index.js +17 -381
- package/dist/upgrade-C3RWGwRi.d.ts +125 -0
- package/dist/upgrade.d.ts +1 -95
- package/dist/upgrade.js +6 -114
- package/dist/xdg-DB7Shoib.d.ts +179 -0
- package/dist/xdg.d.ts +1 -169
- package/dist/xdg.js +14 -128
- package/package.json +192 -24
- package/src/README.md +15 -0
- package/src/alias.conformance.test.ts +250 -0
- package/src/alias.test.ts +206 -2
- package/src/alias.ts +196 -21
- package/src/cli.help-command.test.ts +105 -0
- package/src/cli.offline.test.ts +93 -0
- package/src/cli.parity.test.ts +192 -0
- package/src/cli.root.conformance.test.ts +166 -0
- package/src/cli.test.ts +95 -1
- package/src/cli.ts +234 -25
- package/src/completion-scripts.ts +16 -0
- package/src/completion-values.test.ts +76 -16
- package/src/completion-values.ts +170 -66
- package/src/completion.conformance.test.ts +298 -0
- package/src/completion.test.ts +268 -145
- package/src/completion.ts +772 -121
- package/src/compliance.test.ts +196 -2
- package/src/compliance.ts +440 -20
- package/src/config-merge.test.ts +425 -0
- package/src/config.test.ts +228 -1
- package/src/config.ts +429 -16
- package/src/delegation.test.ts +299 -0
- package/src/delegation.ts +807 -0
- package/src/gen/crud_pb.ts +7 -7
- package/src/id/README.md +38 -0
- package/src/id/contract.test.ts +1 -1
- package/src/id/index.test.ts +1 -1
- package/src/id/index.ts +3 -2
- package/src/index.test.ts +71 -0
- package/src/index.ts +46 -0
- package/src/llm-anthropic.conformance.test.ts +1135 -0
- package/src/llm-anthropic.test.ts +152 -0
- package/src/llm-anthropic.ts +940 -0
- package/src/llm-choice-hermetic.test.ts +335 -0
- package/src/llm-config.test.ts +232 -0
- package/src/llm-config.ts +106 -0
- package/src/llm-endpoint.ts +254 -0
- package/src/llm-error.ts +17 -0
- package/src/llm-errors.ts +152 -0
- package/src/llm-file.ts +126 -0
- package/src/llm-http.ts +317 -0
- package/src/llm-keys.ts +167 -0
- package/src/llm-media.conformance.test.ts +87 -0
- package/src/llm-media.test.ts +279 -0
- package/src/llm-media.ts +322 -0
- package/src/llm-openai.conformance.test.ts +407 -0
- package/src/llm-openai.test.ts +510 -0
- package/src/llm-openai.ts +708 -0
- package/src/llm-payload.ts +155 -0
- package/src/llm-quote.ts +46 -0
- package/src/llm-routellm.conformance.test.ts +44 -0
- package/src/llm-toolnames.conformance.test.ts +112 -0
- package/src/llm-toolnames.test.ts +132 -0
- package/src/llm-toolnames.ts +298 -0
- package/src/llm-uri.ts +99 -0
- package/src/llm.test.ts +43 -15
- package/src/llm.toolcall.test.ts +175 -0
- package/src/llm.ts +602 -190
- package/src/log.parity.test.ts +105 -0
- package/src/log.test.ts +270 -1
- package/src/log.ts +228 -49
- package/src/mcp/README.md +63 -0
- package/src/mcp/args-separator.test.ts +164 -0
- package/src/mcp/args.test.ts +223 -0
- package/src/mcp/args.ts +160 -0
- package/src/mcp/audit.test.ts +520 -0
- package/src/mcp/audit.ts +70 -0
- package/src/mcp/bridge.test.ts +250 -0
- package/src/mcp/bridge.ts +286 -0
- package/src/mcp/conformance.test.ts +357 -0
- package/src/mcp/dispatch.ts +359 -0
- package/src/mcp/identity.test.ts +166 -0
- package/src/mcp/identity.ts +72 -0
- package/src/mcp/index.ts +176 -0
- package/src/mcp/legacy-notify.test.ts +59 -0
- package/src/mcp/legacy.ts +367 -0
- package/src/mcp/mcp.test.ts +707 -0
- package/src/mcp/modern-confirm.test.ts +520 -0
- package/src/mcp/modern-confirm.ts +484 -0
- package/src/mcp/modern.ts +788 -0
- package/src/mcp/stdio.test.ts +313 -0
- package/src/mcp/stdio.ts +254 -0
- package/src/mcp/tasks.ts +82 -0
- package/src/mcp/testtree.ts +250 -0
- package/src/mcp/toolname.test.ts +147 -0
- package/src/mcp/types.ts +689 -0
- package/src/netpolicy.test.ts +280 -0
- package/src/netpolicy.ts +256 -0
- package/src/output/README.md +46 -0
- package/src/output/builtins.ts +5 -5
- package/src/output/dispatch.ts +10 -2
- package/src/output/error.ts +459 -0
- package/src/output/formatter.ts +29 -5
- package/src/output/formatters/README.md +50 -0
- package/src/output/formatters/csv.ts +48 -12
- package/src/output/formatters/json.ts +4 -25
- package/src/output/formatters/project.ts +34 -0
- package/src/output/formatters/table.ts +8 -6
- package/src/output/formatters/text.ts +7 -3
- package/src/output/formatters/yaml.ts +5 -22
- package/src/output/projection.test.ts +298 -0
- package/src/output/projection.ts +33 -59
- package/src/output/template.ts +11 -21
- package/src/output.surface.test.ts +41 -0
- package/src/output.ts +64 -3
- package/src/plan.ts +89 -0
- package/src/policy.ts +472 -0
- package/src/published-types.test.ts +133 -0
- package/src/routellm.test.ts +209 -28
- package/src/routellm.toolcall.test.ts +521 -0
- package/src/routellm.ts +213 -177
- package/src/router/README.md +44 -0
- package/src/router/server.test.ts +41 -0
- package/src/router/server.ts +11 -0
- package/src/safety.test.ts +19 -9
- package/src/scope-defaults.json +29 -29
- package/src/serve.test.ts +1257 -0
- package/src/serve.ts +1665 -0
- package/src/sideeffect.ts +105 -0
- package/src/telemetry/README.md +48 -0
- package/src/telemetry/client.test.ts +31 -0
- package/src/telemetry/client.ts +12 -6
- package/src/telemetry/offline.test.ts +64 -0
- package/src/toolspec-internal.ts +279 -0
- package/src/toolspec-manifest.test.ts +167 -0
- package/src/toolspec-manifest.ts +415 -0
- package/src/toolspec-spec-schemas.ts +12 -0
- package/src/toolspec-spec.test.ts +273 -0
- package/src/toolspec-spec.ts +458 -0
- package/src/toolspec.from-command.test.ts +350 -0
- package/src/toolspec.test.ts +2 -2
- package/src/toolspec.ts +222 -0
- package/src/triton/README.md +34 -0
- package/src/tui/README.md +42 -0
- package/src/tui/parity.test.ts +120 -31
- package/src/tui/parity.ts +58 -7
- package/src/upgrade.test.ts +291 -0
- package/src/upgrade.ts +116 -7
- package/src/wizard.test.ts +7 -7
- package/test/llm/conformance-helpers.ts +100 -0
- package/test/output/csv.test.ts +164 -0
- package/test/output/dispatch.test.ts +1 -2
- package/test/output/error.test.ts +277 -0
- package/test/output/smoke-capture.ts +2 -2
- package/test/output/smoke.test.ts +2 -2
- package/test/output/taxonomy-contract.test.ts +148 -0
- package/test/setup-env.ts +16 -0
- package/test/toolspec/fixture.ts +79 -0
- package/tsconfig.json +3 -1
- package/tsconfig.test.json +10 -0
- package/vitest.config.ts +9 -0
- package/src/tui/parity.json +0 -74
package/src/gen/crud_pb.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v2.
|
|
1
|
+
// @generated by protoc-gen-es v2.15.0 with parameter "target=ts"
|
|
2
2
|
// @generated from file crud.proto (package crud.v1, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ import type { JsonObject, Message } from "@bufbuild/protobuf";
|
|
|
11
11
|
* Describes the file crud.proto.
|
|
12
12
|
*/
|
|
13
13
|
export const file_crud: GenFile = /*@__PURE__*/
|
|
14
|
-
fileDesc("
|
|
14
|
+
fileDesc("CgpjcnVkLnByb3RvEgdjcnVkLnYxIjgKDUNyZWF0ZVJlcXVlc3QSJwoGZW50aXR5GAEgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdCI5Cg5DcmVhdGVSZXNwb25zZRInCgZlbnRpdHkYASABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0IhgKCkdldFJlcXVlc3QSCgoCaWQYASABKAkiNgoLR2V0UmVzcG9uc2USJwoGZW50aXR5GAEgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdCJKCgtMaXN0UmVxdWVzdBINCgVsaW1pdBgBIAEoBRIOCgZvZmZzZXQYAiABKAUSDAoEc29ydBgDIAEoCRIOCgZzZWFyY2gYBCABKAkiOQoMTGlzdFJlc3BvbnNlEikKCGVudGl0aWVzGAEgAygLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdCI4Cg1VcGRhdGVSZXF1ZXN0EicKBmVudGl0eRgBIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QiOQoOVXBkYXRlUmVzcG9uc2USJwoGZW50aXR5GAEgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdCIbCg1EZWxldGVSZXF1ZXN0EgoKAmlkGAEgASgJIhAKDkRlbGV0ZVJlc3BvbnNlMqcCCg1FbnRpdHlTZXJ2aWNlEjkKBkNyZWF0ZRIWLmNydWQudjEuQ3JlYXRlUmVxdWVzdBoXLmNydWQudjEuQ3JlYXRlUmVzcG9uc2USMAoDR2V0EhMuY3J1ZC52MS5HZXRSZXF1ZXN0GhQuY3J1ZC52MS5HZXRSZXNwb25zZRIzCgRMaXN0EhQuY3J1ZC52MS5MaXN0UmVxdWVzdBoVLmNydWQudjEuTGlzdFJlc3BvbnNlEjkKBlVwZGF0ZRIWLmNydWQudjEuVXBkYXRlUmVxdWVzdBoXLmNydWQudjEuVXBkYXRlUmVzcG9uc2USOQoGRGVsZXRlEhYuY3J1ZC52MS5EZWxldGVSZXF1ZXN0GhcuY3J1ZC52MS5EZWxldGVSZXNwb25zZUKBAQoLY29tLmNydWQudjFCCUNydWRQcm90b1ABWipob3AudG9wL2tpdC9jb250cmFjdHMvcHJvdG8vY3J1ZC92MTtjcnVkdjGiAgNDWFiqAgdDcnVkLlYxygIHQ3J1ZFxWMeICE0NydWRcVjFcR1BCTWV0YWRhdGHqAghDcnVkOjpWMWIGcHJvdG8z", [file_google_protobuf_struct]);
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @generated from message crud.v1.CreateRequest
|
|
@@ -22,7 +22,7 @@ export type CreateRequest = Message<"crud.v1.CreateRequest"> & {
|
|
|
22
22
|
*
|
|
23
23
|
* @generated from field: google.protobuf.Struct entity = 1;
|
|
24
24
|
*/
|
|
25
|
-
entity?: JsonObject;
|
|
25
|
+
entity?: JsonObject | undefined;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -41,7 +41,7 @@ export type CreateResponse = Message<"crud.v1.CreateResponse"> & {
|
|
|
41
41
|
*
|
|
42
42
|
* @generated from field: google.protobuf.Struct entity = 1;
|
|
43
43
|
*/
|
|
44
|
-
entity?: JsonObject;
|
|
44
|
+
entity?: JsonObject | undefined;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -75,7 +75,7 @@ export type GetResponse = Message<"crud.v1.GetResponse"> & {
|
|
|
75
75
|
/**
|
|
76
76
|
* @generated from field: google.protobuf.Struct entity = 1;
|
|
77
77
|
*/
|
|
78
|
-
entity?: JsonObject;
|
|
78
|
+
entity?: JsonObject | undefined;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
/**
|
|
@@ -149,7 +149,7 @@ export type UpdateRequest = Message<"crud.v1.UpdateRequest"> & {
|
|
|
149
149
|
/**
|
|
150
150
|
* @generated from field: google.protobuf.Struct entity = 1;
|
|
151
151
|
*/
|
|
152
|
-
entity?: JsonObject;
|
|
152
|
+
entity?: JsonObject | undefined;
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
/**
|
|
@@ -166,7 +166,7 @@ export type UpdateResponse = Message<"crud.v1.UpdateResponse"> & {
|
|
|
166
166
|
/**
|
|
167
167
|
* @generated from field: google.protobuf.Struct entity = 1;
|
|
168
168
|
*/
|
|
169
|
-
entity?: JsonObject;
|
|
169
|
+
entity?: JsonObject | undefined;
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
/**
|
package/src/id/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# id
|
|
2
|
+
|
|
3
|
+
## What it answers
|
|
4
|
+
|
|
5
|
+
How to mint and parse kit entity IDs so that Go, Python, Rust and PHP produce the same string for the same `(prefix, uuid)`. Canonical wire form: `<prefix>_<26-char-base32>`, a Crockford-base32 UUIDv7 behind a lowercase prefix. Wrong module for URI composition such as `tlc://task/task_...`: use `@hop-top/cite`.
|
|
6
|
+
|
|
7
|
+
## Use it when
|
|
8
|
+
|
|
9
|
+
- new entity: `newId('task')`
|
|
10
|
+
- validate or split an incoming id: `parse(s)` returns `{ prefix, uuid }` and throws on malformed input
|
|
11
|
+
- compile-time prefix safety: `Typed<'task'>` with `newTyped` / `parseTyped`
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { newId, parse } from '@hop-top/kit/id';
|
|
17
|
+
|
|
18
|
+
const id = newId('task');
|
|
19
|
+
console.log(id, parse(id).uuid);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Contract
|
|
23
|
+
|
|
24
|
+
- Thin wrapper over `typeid-js`; the string returned by `newId` is the JSON wire form and round-trips losslessly through `parse`.
|
|
25
|
+
- Prefix grammar and length limit follow the typeid spec pinned in the fixture; a divergence is a wire-format break.
|
|
26
|
+
- No transitive dependency on the URI registry, by design.
|
|
27
|
+
- Parity: [`contracts/typeid-v1/fixtures.json`](../../../../contracts/typeid-v1/fixtures.json), replayed by [`contract.test.ts`](contract.test.ts).
|
|
28
|
+
|
|
29
|
+
## Neighbours
|
|
30
|
+
|
|
31
|
+
- `@hop-top/cite`: URI composition on top of the canonical string
|
|
32
|
+
- `@hop-top/kit/sqlstore`: persistence keyed by these ids
|
|
33
|
+
- Go reference: `go/core/id`; Python port: [`hop_top_kit/id`](../../../py/hop_top_kit/id/README.md)
|
|
34
|
+
|
|
35
|
+
## See also
|
|
36
|
+
|
|
37
|
+
- [`docs/announcements/2026-05-typeid-primitive.md`](../../../../docs/announcements/2026-05-typeid-primitive.md)
|
|
38
|
+
- [`docs/adopters/reference/go-primitives.md`](../../../../docs/adopters/reference/go-primitives.md)
|
package/src/id/contract.test.ts
CHANGED
package/src/id/index.test.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from './index';
|
|
11
11
|
|
|
12
12
|
// Canonical fixture set — these EXACT uuid inputs are shared with the
|
|
13
|
-
// other language SDKs so future cross-language parity work
|
|
13
|
+
// other language SDKs so future cross-language parity work
|
|
14
14
|
// finds matching outputs. Do not mutate without coordinating across
|
|
15
15
|
// sdk/{go,rs,py,php}.
|
|
16
16
|
const FIXTURES: ReadonlyArray<{ prefix: string; uuid: string }> = [
|
package/src/id/index.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @package @hop-top/kit
|
|
4
4
|
*
|
|
5
5
|
* TypeID primitive — thin wrapper around `typeid-js` (jetify-com)
|
|
6
|
-
* implementing the cross-language kit API SHAPE per
|
|
6
|
+
* implementing the cross-language kit API SHAPE per
|
|
7
|
+
* docs/announcements/2026-05-typeid-primitive.md.
|
|
7
8
|
*
|
|
8
9
|
* Canonical wire form: `<prefix>_<26-char-base32>` where the suffix is
|
|
9
10
|
* a Crockford-base32-encoded UUIDv7. The TS surface adds a
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
* URI composition (e.g. `tlc://task/task_…`) is NOT in this module —
|
|
14
15
|
* callers should use the `@hop-top/cite` package directly. This
|
|
15
16
|
* keeps `kit/id` free of any transitive dependency on the URI
|
|
16
|
-
* registry
|
|
17
|
+
* registry.
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
import { typeid, TypeID } from 'typeid-js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
import * as kit from './index.js';
|
|
6
|
+
|
|
7
|
+
const pkgDir = join(__dirname, '..');
|
|
8
|
+
const pkg = JSON.parse(readFileSync(join(pkgDir, 'package.json'), 'utf8')) as {
|
|
9
|
+
exports: Record<string, Record<string, string>>;
|
|
10
|
+
typesVersions?: Record<string, Record<string, string[]>>;
|
|
11
|
+
scripts: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** Map a dist target like './dist/foo/index.js' to its source entry 'src/foo/index.ts'. */
|
|
15
|
+
function srcEntryFor(distTarget: string): string {
|
|
16
|
+
return distTarget.replace(/^\.\/dist\//, 'src/').replace(/\.js$/, '.ts');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
describe('exports map contract', () => {
|
|
20
|
+
const subpaths = Object.entries(pkg.exports);
|
|
21
|
+
|
|
22
|
+
it('declares at least the root and one subpath', () => {
|
|
23
|
+
expect(subpaths.length).toBeGreaterThan(1);
|
|
24
|
+
expect(pkg.exports['.']).toBeDefined();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it.each(subpaths)('%s: every condition target is emitted by the build', (subpath, conditions) => {
|
|
28
|
+
const buildScript = pkg.scripts.build;
|
|
29
|
+
for (const [condition, target] of Object.entries(conditions)) {
|
|
30
|
+
// All runtime conditions must point into dist/.
|
|
31
|
+
expect(target, `${subpath} ${condition}`).toMatch(/^\.\/dist\//);
|
|
32
|
+
const entry = srcEntryFor(condition === 'types' ? target.replace(/\.d\.ts$/, '.js') : target);
|
|
33
|
+
// The source entry must exist on disk...
|
|
34
|
+
expect(existsSync(join(pkgDir, entry)), `${subpath} ${condition}: missing ${entry}`).toBe(true);
|
|
35
|
+
// ...and be listed as a tsup build entry, or the dist target dangles.
|
|
36
|
+
expect(buildScript, `${subpath} ${condition}: ${entry} not in build entries`).toContain(entry);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('root "." exposes the same condition set as the other entries', () => {
|
|
41
|
+
expect(Object.keys(pkg.exports['.']).sort()).toEqual(['default', 'require', 'types']);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// moduleResolution node10 ignores `exports`; `typesVersions` is its only
|
|
45
|
+
// route to subpath types, so every subpath needs a matching entry.
|
|
46
|
+
it('typesVersions maps every subpath to its exports types target', () => {
|
|
47
|
+
const expected = Object.fromEntries(
|
|
48
|
+
subpaths
|
|
49
|
+
.filter(([subpath]) => subpath !== '.')
|
|
50
|
+
.map(([subpath, conditions]) => [subpath.replace(/^\.\//, ''), [conditions.types]]),
|
|
51
|
+
);
|
|
52
|
+
expect(pkg.typesVersions).toEqual({ '*': expected });
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('root barrel', () => {
|
|
57
|
+
it('re-exports every public subpath except sqlstore as a namespace', () => {
|
|
58
|
+
// Kebab-case subpaths become camelCase namespaces (completion-values -> completionValues).
|
|
59
|
+
const expected = Object.keys(pkg.exports)
|
|
60
|
+
.filter((p) => p !== '.' && p !== './sqlstore')
|
|
61
|
+
.map((p) => p.replace(/^\.\//, '').replace(/-([a-z])/g, (_, c: string) => c.toUpperCase()));
|
|
62
|
+
for (const name of expected) {
|
|
63
|
+
expect(kit, name).toHaveProperty(name);
|
|
64
|
+
expect(typeof (kit as Record<string, unknown>)[name], name).toBe('object');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('does not eagerly expose sqlstore (native deps stay behind the subpath)', () => {
|
|
69
|
+
expect(kit).not.toHaveProperty('sqlstore');
|
|
70
|
+
});
|
|
71
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module index
|
|
3
|
+
* @package @hop-top/kit
|
|
4
|
+
*
|
|
5
|
+
* Root barrel: namespace re-exports of every public subpath, so
|
|
6
|
+
* `require('@hop-top/kit')` / `import ... from '@hop-top/kit'` resolve.
|
|
7
|
+
* Namespaces mirror the package exports map one-to-one; kebab-case
|
|
8
|
+
* subpaths become camelCase namespaces (`completion-values` ->
|
|
9
|
+
* `completionValues`).
|
|
10
|
+
*
|
|
11
|
+
* `sqlstore` is intentionally NOT re-exported here: an eager re-export
|
|
12
|
+
* would load better-sqlite3 native bindings on every bare import of the
|
|
13
|
+
* package. Use the dedicated subpath instead: `@hop-top/kit/sqlstore`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export * as aim from './aim.js';
|
|
17
|
+
export * as alias from './alias.js';
|
|
18
|
+
export * as anthropic from './llm-anthropic.js';
|
|
19
|
+
export * as api from './api.js';
|
|
20
|
+
export * as auth from './auth.js';
|
|
21
|
+
export * as cli from './cli.js';
|
|
22
|
+
export * as completion from './completion.js';
|
|
23
|
+
export * as completionValues from './completion-values.js';
|
|
24
|
+
export * as compliance from './compliance.js';
|
|
25
|
+
export * as config from './config.js';
|
|
26
|
+
export * as errcorrect from './errcorrect.js';
|
|
27
|
+
export * as id from './id/index.js';
|
|
28
|
+
export * as llm from './llm.js';
|
|
29
|
+
export * as log from './log.js';
|
|
30
|
+
export * as mcp from './mcp/index.js';
|
|
31
|
+
export * as netpolicy from './netpolicy.js';
|
|
32
|
+
export * as openai from './llm-openai.js';
|
|
33
|
+
export * as output from './output.js';
|
|
34
|
+
export * as progress from './progress.js';
|
|
35
|
+
export * as provenance from './provenance.js';
|
|
36
|
+
export * as routellm from './routellm.js';
|
|
37
|
+
export * as rpc from './rpc.js';
|
|
38
|
+
export * as safety from './safety.js';
|
|
39
|
+
export * as scope from './scope.js';
|
|
40
|
+
export * as serve from './serve.js';
|
|
41
|
+
export * as stream from './stream.js';
|
|
42
|
+
export * as telemetry from './telemetry/index.js';
|
|
43
|
+
export * as toolspec from './toolspec.js';
|
|
44
|
+
export * as tui from './tui/index.js';
|
|
45
|
+
export * as upgrade from './upgrade.js';
|
|
46
|
+
export * as xdg from './xdg.js';
|