@hop-top/kit 0.5.0-alpha.1 → 0.5.0-alpha.2
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 +87 -0
- package/README.md +237 -9
- package/dist/aim-CTp-kJW2.d.ts +139 -0
- package/dist/aim.d.ts +1 -116
- package/dist/alias-dhhr08Ei.d.ts +88 -0
- package/dist/alias.d.ts +2 -73
- package/dist/api-miiso81x.d.ts +77 -0
- package/dist/api.d.ts +1 -62
- package/dist/auth-2-jfgiHn.d.ts +34 -0
- package/dist/auth.d.ts +1 -26
- package/dist/cli-DgOEOsPB.d.ts +450 -0
- package/dist/cli.d.ts +5 -309
- package/dist/cli.js +190 -62
- package/dist/config-BUY7_W2n.d.ts +103 -0
- package/dist/config.d.ts +1 -97
- package/dist/errcorrect-BcX1Ft0K.d.ts +44 -0
- package/dist/errcorrect.d.ts +1 -37
- package/dist/id/index.d.ts +2 -83
- package/dist/index--C7Mtsmm.d.ts +328 -0
- package/dist/index-C3Zw4wDJ.d.ts +359 -0
- package/dist/index-MLrRDvEG.d.ts +1073 -0
- package/dist/index-QSffbLnj.d.ts +94 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +5863 -0
- package/dist/llm-B5XUWH8T.d.ts +231 -0
- package/dist/llm.d.ts +1 -188
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +1453 -0
- package/dist/netpolicy-asvCfwi8.d.ts +138 -0
- package/dist/netpolicy.d.ts +1 -0
- package/dist/netpolicy.js +118 -0
- package/dist/output-VFFLqor9.d.ts +521 -0
- package/dist/output.d.ts +2 -213
- package/dist/output.js +554 -43
- package/dist/progress-CAzyxeWl.d.ts +38 -0
- package/dist/progress.d.ts +1 -30
- package/dist/provenance-SMFHm5gx.d.ts +30 -0
- package/dist/provenance.d.ts +1 -24
- package/dist/routellm-PGSt2D1y.d.ts +75 -0
- package/dist/routellm.d.ts +2 -64
- package/dist/rpc-D5xLEf8V.d.ts +32 -0
- package/dist/rpc.d.ts +2 -25
- package/dist/safety-CUaYEjZc.d.ts +30 -0
- package/dist/safety.d.ts +1 -24
- package/dist/scope-BrhYB4ij.d.ts +141 -0
- package/dist/scope.d.ts +1 -121
- package/dist/stream-CrjeCp0M.d.ts +44 -0
- package/dist/stream.d.ts +1 -35
- package/dist/telemetry/index.d.ts +1 -315
- package/dist/telemetry/index.js +12 -1
- package/dist/tui/index.d.ts +4 -298
- package/dist/tui/index.js +1 -9
- package/dist/upgrade-p_zh3pvV.d.ts +102 -0
- package/dist/upgrade.d.ts +1 -95
- package/dist/xdg-DB7Shoib.d.ts +179 -0
- package/dist/xdg.d.ts +1 -169
- package/package.json +21 -3
- package/src/cli.offline.test.ts +93 -0
- package/src/cli.parity.test.ts +192 -0
- package/src/cli.ts +112 -12
- package/src/index.test.ts +58 -0
- package/src/index.ts +36 -0
- package/src/log.parity.test.ts +105 -0
- package/src/log.ts +64 -13
- package/src/mcp/bridge.test.ts +150 -0
- package/src/mcp/bridge.ts +246 -0
- package/src/mcp/conformance.test.ts +336 -0
- package/src/mcp/dispatch.ts +313 -0
- package/src/mcp/index.ts +138 -0
- package/src/mcp/legacy.ts +314 -0
- package/src/mcp/mcp.test.ts +697 -0
- package/src/mcp/modern-confirm.test.ts +520 -0
- package/src/mcp/modern-confirm.ts +452 -0
- package/src/mcp/modern.ts +723 -0
- package/src/mcp/tasks.ts +82 -0
- package/src/mcp/testtree.ts +250 -0
- package/src/mcp/types.ts +504 -0
- package/src/netpolicy.test.ts +202 -0
- package/src/netpolicy.ts +231 -0
- package/src/output/dispatch.ts +10 -2
- package/src/output/error.ts +293 -0
- package/src/output/formatter.ts +29 -5
- 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 +39 -3
- package/src/telemetry/client.test.ts +31 -0
- package/src/telemetry/client.ts +7 -1
- package/src/telemetry/offline.test.ts +64 -0
- package/src/tui/parity.test.ts +120 -31
- package/src/tui/parity.ts +58 -7
- package/test/output/csv.test.ts +164 -0
- package/test/output/error.test.ts +241 -0
- package/src/tui/parity.json +0 -74
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @module id
|
|
5
|
+
* @package @hop-top/kit
|
|
6
|
+
*
|
|
7
|
+
* TypeID primitive — thin wrapper around `typeid-js` (jetify-com)
|
|
8
|
+
* implementing the cross-language kit API SHAPE per ADR 0001.
|
|
9
|
+
*
|
|
10
|
+
* Canonical wire form: `<prefix>_<26-char-base32>` where the suffix is
|
|
11
|
+
* a Crockford-base32-encoded UUIDv7. The TS surface adds a
|
|
12
|
+
* template-literal `Typed<P>` for compile-time prefix safety on top of
|
|
13
|
+
* the runtime guarantees provided by `typeid-js`.
|
|
14
|
+
*
|
|
15
|
+
* URI composition (e.g. `tlc://task/task_…`) is NOT in this module —
|
|
16
|
+
* callers should use the `@hop-top/cite` package directly. This
|
|
17
|
+
* keeps `kit/id` free of any transitive dependency on the URI
|
|
18
|
+
* registry, per the ADR's scope boundary.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Compile-time-typed canonical TypeID string for prefix `P`.
|
|
23
|
+
*
|
|
24
|
+
* The template-literal `${P}_${string}` form means a `Typed<'task'>`
|
|
25
|
+
* is statically distinguishable from a `Typed<'invoice'>` even though
|
|
26
|
+
* both are runtime `string`s. Pair with {@link newTyped} or
|
|
27
|
+
* {@link parseTyped} to mint values whose prefix is enforced both at
|
|
28
|
+
* compile time and at runtime.
|
|
29
|
+
*/
|
|
30
|
+
type Typed<P extends string> = `${P}_${string}`;
|
|
31
|
+
/** Parsed components of a canonical TypeID string. */
|
|
32
|
+
interface Parsed {
|
|
33
|
+
/** Prefix segment (everything before the final underscore). */
|
|
34
|
+
prefix: string;
|
|
35
|
+
/** Backing UUID in canonical 8-4-4-4-12 hyphenated form. */
|
|
36
|
+
uuid: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generate a new TypeID with the given prefix, returning the canonical
|
|
40
|
+
* string `<prefix>_<26-char-base32>`.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* newId('task') // => 'task_01h2e8kqv8000000000000000'
|
|
44
|
+
*/
|
|
45
|
+
declare function newId(prefix: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Parse a canonical TypeID string into its prefix and backing UUID.
|
|
48
|
+
*
|
|
49
|
+
* @throws {Error} when the input is not a syntactically valid TypeID
|
|
50
|
+
* (e.g. malformed suffix, illegal prefix characters).
|
|
51
|
+
*/
|
|
52
|
+
declare function parse(s: string): Parsed;
|
|
53
|
+
/**
|
|
54
|
+
* Typed variant of {@link newId}. Returns a `Typed<P>` whose static
|
|
55
|
+
* type carries the literal prefix, enabling compile-time discrimination
|
|
56
|
+
* between e.g. `TaskId` and `InvoiceId`.
|
|
57
|
+
*/
|
|
58
|
+
declare function newTyped<P extends string>(prefix: P): Typed<P>;
|
|
59
|
+
/**
|
|
60
|
+
* Typed variant of {@link parse}. Validates that the parsed prefix
|
|
61
|
+
* matches the expected `prefix` argument at runtime; returns the
|
|
62
|
+
* canonical string narrowed to `Typed<P>`.
|
|
63
|
+
*
|
|
64
|
+
* @throws {Error} when the parsed prefix does not match `prefix`, or
|
|
65
|
+
* when the input is not a syntactically valid TypeID.
|
|
66
|
+
*/
|
|
67
|
+
declare function parseTyped<P extends string>(prefix: P, s: string): Typed<P>;
|
|
68
|
+
/**
|
|
69
|
+
* Zod schema for runtime validation of a `${prefix}_<26-char-base32>`
|
|
70
|
+
* canonical TypeID string.
|
|
71
|
+
*
|
|
72
|
+
* The schema only validates structure (prefix match + 26-char Crockford
|
|
73
|
+
* base32 suffix with the spec's leading-bit constraint). It does not
|
|
74
|
+
* decode the UUIDv7 timestamp; use {@link parse} if you need the
|
|
75
|
+
* underlying UUID.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* const TaskIdSchema = typeIdSchema('task');
|
|
79
|
+
* TaskIdSchema.parse('task_01h2e8kqv8000000000000000');
|
|
80
|
+
*/
|
|
81
|
+
declare function typeIdSchema(prefix: string): z.ZodString;
|
|
82
|
+
|
|
83
|
+
type index_Parsed = Parsed;
|
|
84
|
+
type index_Typed<P extends string> = Typed<P>;
|
|
85
|
+
declare const index_newId: typeof newId;
|
|
86
|
+
declare const index_newTyped: typeof newTyped;
|
|
87
|
+
declare const index_parse: typeof parse;
|
|
88
|
+
declare const index_parseTyped: typeof parseTyped;
|
|
89
|
+
declare const index_typeIdSchema: typeof typeIdSchema;
|
|
90
|
+
declare namespace index {
|
|
91
|
+
export { type index_Parsed as Parsed, type index_Typed as Typed, index_newId as newId, index_newTyped as newTyped, index_parse as parse, index_parseTyped as parseTyped, index_typeIdSchema as typeIdSchema };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { type Parsed as P, type Typed as T, newTyped as a, parseTyped as b, index as i, newId as n, parse as p, typeIdSchema as t };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { g as aim } from './aim-CTp-kJW2.js';
|
|
2
|
+
export { c as alias } from './alias-dhhr08Ei.js';
|
|
3
|
+
export { e as api } from './api-miiso81x.js';
|
|
4
|
+
export { a as auth } from './auth-2-jfgiHn.js';
|
|
5
|
+
export { h as cli } from './cli-DgOEOsPB.js';
|
|
6
|
+
export { c as config } from './config-BUY7_W2n.js';
|
|
7
|
+
export { e as errcorrect } from './errcorrect-BcX1Ft0K.js';
|
|
8
|
+
export { i as id } from './index-QSffbLnj.js';
|
|
9
|
+
export { s as llm } from './llm-B5XUWH8T.js';
|
|
10
|
+
export { ao as mcp } from './index-MLrRDvEG.js';
|
|
11
|
+
export { n as netpolicy } from './netpolicy-asvCfwi8.js';
|
|
12
|
+
export { I as output } from './output-VFFLqor9.js';
|
|
13
|
+
export { p as progress } from './progress-CAzyxeWl.js';
|
|
14
|
+
export { p as provenance } from './provenance-SMFHm5gx.js';
|
|
15
|
+
export { r as routellm } from './routellm-PGSt2D1y.js';
|
|
16
|
+
export { r as rpc } from './rpc-D5xLEf8V.js';
|
|
17
|
+
export { s as safety } from './safety-CUaYEjZc.js';
|
|
18
|
+
export { s as scope } from './scope-BrhYB4ij.js';
|
|
19
|
+
export { s as stream } from './stream-CrjeCp0M.js';
|
|
20
|
+
export { i as telemetry } from './index-C3Zw4wDJ.js';
|
|
21
|
+
export { i as tui } from './index--C7Mtsmm.js';
|
|
22
|
+
export { u as upgrade } from './upgrade-p_zh3pvV.js';
|
|
23
|
+
export { x as xdg } from './xdg-DB7Shoib.js';
|
|
24
|
+
import 'commander';
|
|
25
|
+
import 'node:stream';
|
|
26
|
+
import 'zod';
|