@hop-top/kit 0.5.0-alpha.5 → 0.5.0-alpha.6

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 CHANGED
@@ -4,6 +4,13 @@ All notable changes to `@hop-top/kit` are documented in this file.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
5
5
  versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.5.0-alpha.6](https://github.com/hop-top/poly-kit/compare/kit-ts/v0.5.0-alpha.5...kit-ts/v0.5.0-alpha.6) (2026-10-29)
8
+
9
+
10
+ ### Features
11
+
12
+ * **ts:** publish log, completion and toolspec subpaths ([a349521](https://github.com/hop-top/poly-kit/commit/a3495219b223e25703df3da3f030813345d49525))
13
+
7
14
  ## [0.5.0-alpha.5](https://github.com/hop-top/poly-kit/compare/kit-ts/v0.5.0-alpha.4...kit-ts/v0.5.0-alpha.5) (2026-10-29)
8
15
 
9
16
  The hop-top team is happy to announce Kit's TS SDK 0.5.0-alpha.5. This release includes maintenance release with bug fixes.
package/README.md CHANGED
@@ -50,14 +50,14 @@ hidden completion command.
50
50
  | [`src/router/`](src/router/README.md) | RouteLLM strong/weak model routing and its Hono handler | a prompt must pick a model in-process |
51
51
  | [`src/triton/`](src/triton/README.md) | Triton Inference Server client, KServe v2 over HTTP | you call a model hosted on Triton |
52
52
 
53
- Non-directory subpaths: `cli` (CLI factory), `serve` (serve hierarchy
54
- and service lifecycle), `netpolicy` (`--offline` enforcement, guards
55
- `globalThis.fetch`), `xdg` (base directory paths), `config`
56
- (config-file loading), `sqlstore` (embedded SQLite key/value store),
57
- `upgrade` (semver upgrade detection), `llm`, `anthropic`, `openai`,
58
- `routellm`, `alias`, `uri` (facade over `@hop-top/cite`), `api`,
59
- `rpc`, `aim`, `scope`, `safety`, `provenance`, `stream`, `progress`,
60
- `auth`, `errcorrect`. See `package.json` `exports` for the full list.
53
+ Non-directory subpaths: `cli` (CLI factory), `serve` (serve hierarchy and
54
+ service lifecycle), `netpolicy` (`--offline` enforcement, guards
55
+ `globalThis.fetch`), `xdg` (base directory paths), `config` (config-file
56
+ loading), `sqlstore` (embedded SQLite key/value store), `upgrade` (semver
57
+ upgrade detection), `llm`, `anthropic`, `openai`, `routellm`, `alias`, `uri`
58
+ (facade over `@hop-top/cite`), `api`, `rpc`, `aim`, `scope`, `safety`,
59
+ `provenance`, `stream`, `progress`, `auth`, `errcorrect`, `log`,
60
+ `completion`, `toolspec`. See `package.json` `exports` for the full list.
61
61
 
62
62
  ## Contract
63
63
 
@@ -0,0 +1,128 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkR5U7XKVJjs = require('./chunk-R5U7XKVJ.js');
4
+
5
+ // src/completion.ts
6
+ var completion_exports = {};
7
+ _chunkR5U7XKVJjs.__export.call(void 0, completion_exports, {
8
+ completionCommand: () => completionCommand,
9
+ generateBashCompletion: () => generateBashCompletion,
10
+ generateFishCompletion: () => generateFishCompletion,
11
+ generateZshCompletion: () => generateZshCompletion
12
+ });
13
+ var _commander = require('commander');
14
+ function collectCommands(cmd) {
15
+ return cmd.commands.filter((c) => !c._hidden && c.name() !== "help").flatMap((c) => [c.name(), ...c.aliases()]);
16
+ }
17
+ function collectFlags(cmd) {
18
+ return cmd.options.map((o) => o.long).filter(Boolean);
19
+ }
20
+ function generateBashCompletion(program) {
21
+ const name = program.name();
22
+ const cmds = collectCommands(program);
23
+ const flags = collectFlags(program);
24
+ const words = [...cmds, ...flags].join(" ");
25
+ return `# bash completion for ${name}
26
+ # eval "$(${name} completion bash)"
27
+
28
+ _${name}_completions() {
29
+ local cur="\${COMP_WORDS[COMP_CWORD]}"
30
+ local commands="${words}"
31
+
32
+ COMPREPLY=( $(compgen -W "\${commands}" -- "\${cur}") )
33
+ }
34
+
35
+ complete -F _${name}_completions ${name}
36
+ `;
37
+ }
38
+ function generateZshCompletion(program) {
39
+ const name = program.name();
40
+ const cmds = collectCommands(program);
41
+ const flags = collectFlags(program);
42
+ const cmdEntries = cmds.map((c) => {
43
+ const sub = program.commands.find(
44
+ (s) => s.name() === c || s.aliases().includes(c)
45
+ );
46
+ const desc = _nullishCoalesce(_optionalChain([sub, 'optionalAccess', _ => _.description, 'call', _2 => _2()]), () => ( ""));
47
+ return ` '${c}:${desc}'`;
48
+ }).join("\n");
49
+ const flagEntries = flags.map((f) => ` '${f}[${f}]'`).join("\n");
50
+ return `#compdef ${name}
51
+ # eval "$(${name} completion zsh)"
52
+
53
+ _${name}() {
54
+ local -a commands flags
55
+
56
+ commands=(
57
+ ${cmdEntries}
58
+ )
59
+
60
+ flags=(
61
+ ${flagEntries}
62
+ )
63
+
64
+ _arguments -s \\
65
+ '1:command:->cmds' \\
66
+ '*::flags:->flags'
67
+
68
+ case "$state" in
69
+ cmds)
70
+ _describe -t commands 'commands' commands
71
+ ;;
72
+ flags)
73
+ _describe -t flags 'flags' flags
74
+ ;;
75
+ esac
76
+ }
77
+
78
+ compdef _${name} ${name}
79
+ `;
80
+ }
81
+ function generateFishCompletion(program) {
82
+ const name = program.name();
83
+ const cmds = collectCommands(program);
84
+ const flags = collectFlags(program);
85
+ const lines = [
86
+ `# fish completion for ${name}`,
87
+ `# ${name} completion fish | source`,
88
+ ""
89
+ ];
90
+ for (const c of cmds) {
91
+ const sub = program.commands.find(
92
+ (s) => s.name() === c || s.aliases().includes(c)
93
+ );
94
+ const desc = _nullishCoalesce(_optionalChain([sub, 'optionalAccess', _3 => _3.description, 'call', _4 => _4()]), () => ( ""));
95
+ lines.push(
96
+ `complete -c ${name} -n '__fish_use_subcommand' -a '${c}' -d '${desc}'`
97
+ );
98
+ }
99
+ for (const f of flags) {
100
+ const long = f.replace(/^--/, "");
101
+ lines.push(
102
+ `complete -c ${name} -l '${long}'`
103
+ );
104
+ }
105
+ lines.push("");
106
+ return lines.join("\n");
107
+ }
108
+ function completionCommand(program) {
109
+ const cmd = new (0, _commander.Command)("completion").description("Generate shell completion scripts");
110
+ cmd.command("bash").description("Generate bash completion script").action(() => {
111
+ process.stdout.write(generateBashCompletion(program));
112
+ });
113
+ cmd.command("zsh").description("Generate zsh completion script").action(() => {
114
+ process.stdout.write(generateZshCompletion(program));
115
+ });
116
+ cmd.command("fish").description("Generate fish completion script").action(() => {
117
+ process.stdout.write(generateFishCompletion(program));
118
+ });
119
+ return cmd;
120
+ }
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ exports.generateBashCompletion = generateBashCompletion; exports.generateZshCompletion = generateZshCompletion; exports.generateFishCompletion = generateFishCompletion; exports.completionCommand = completionCommand; exports.completion_exports = completion_exports;
@@ -0,0 +1,120 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkQPUCXQXTjs = require('./chunk-QPUCXQXT.js');
4
+
5
+
6
+ var _chunkR5U7XKVJjs = require('./chunk-R5U7XKVJ.js');
7
+
8
+ // src/log.ts
9
+ var log_exports = {};
10
+ _chunkR5U7XKVJjs.__export.call(void 0, log_exports, {
11
+ createLogger: () => createLogger,
12
+ quietLevel: () => quietLevel,
13
+ verbosityLevel: () => verbosityLevel,
14
+ withVerbose: () => withVerbose
15
+ });
16
+ var _pino = require('pino'); var _pino2 = _interopRequireDefault(_pino);
17
+ var CHERRY = [237, 74, 94];
18
+ var YAM = [229, 161, 78];
19
+ var SQUID = [133, 129, 131];
20
+ var SMOKE = [191, 188, 200];
21
+ function fg(rgb, text) {
22
+ return `\x1B[38;2;${rgb[0]};${rgb[1]};${rgb[2]}m${text}\x1B[0m`;
23
+ }
24
+ function bold(text) {
25
+ return `\x1B[1m${text}\x1B[22m`;
26
+ }
27
+ var LEVEL_STYLES = {
28
+ 10: { label: "TRAC", color: SMOKE, bold: false },
29
+ 20: { label: "DEBU", color: SMOKE, bold: false },
30
+ 30: { label: "INFO", color: SQUID, bold: false },
31
+ 40: { label: "WARN", color: YAM, bold: true },
32
+ 50: { label: "ERRO", color: CHERRY, bold: true },
33
+ 60: { label: "ERRO", color: CHERRY, bold: true }
34
+ };
35
+ function kitTransport(noColor) {
36
+ return {
37
+ write(chunk) {
38
+ try {
39
+ const obj = JSON.parse(chunk);
40
+ const style = _nullishCoalesce(LEVEL_STYLES[obj.level], () => ( LEVEL_STYLES[30]));
41
+ let prefix = noColor ? style.label : fg(style.color, style.label);
42
+ if (style.bold && !noColor) prefix = bold(prefix);
43
+ const msg = _nullishCoalesce(obj.msg, () => ( ""));
44
+ const kvParts = [];
45
+ for (const [k, v] of Object.entries(obj)) {
46
+ if (["level", "time", "pid", "hostname", "msg", "v"].includes(k)) continue;
47
+ const sv = String(v);
48
+ kvParts.push(sv.includes(" ") ? `${k}="${sv}"` : `${k}=${sv}`);
49
+ }
50
+ const kv = kvParts.length ? " " + kvParts.join(" ") : "";
51
+ process.stderr.write(`${prefix} ${msg}${kv}
52
+ `);
53
+ } catch (e) {
54
+ process.stderr.write(chunk);
55
+ }
56
+ }
57
+ };
58
+ }
59
+ function kvToObj(keyvals) {
60
+ const obj = {};
61
+ for (let i = 0; i < keyvals.length; i += 2) {
62
+ const key = String(keyvals[i]);
63
+ obj[key] = i + 1 < keyvals.length ? keyvals[i + 1] : "";
64
+ }
65
+ return obj;
66
+ }
67
+ var PINO_LEVELS = /* @__PURE__ */ new Set(["trace", "debug", "info", "warn", "error", "fatal"]);
68
+ function levelByName(name) {
69
+ return PINO_LEVELS.has(name) ? name : void 0;
70
+ }
71
+ function verbosityLevel(d, verbose) {
72
+ const levels = _nullishCoalesce(_optionalChain([d, 'access', _ => _.verbosity, 'optionalAccess', _2 => _2.levels]), () => ( {}));
73
+ let best = -1;
74
+ for (const key of Object.keys(levels)) {
75
+ const n = Number(key);
76
+ if (!Number.isInteger(n)) continue;
77
+ if (n <= verbose && n > best) best = n;
78
+ }
79
+ if (best < 0) return "info";
80
+ return _nullishCoalesce(levelByName(levels[String(best)]), () => ( "info"));
81
+ }
82
+ function quietLevel(d) {
83
+ return _nullishCoalesce(levelByName(_nullishCoalesce(_optionalChain([d, 'access', _3 => _3.verbosity, 'optionalAccess', _4 => _4.quiet_override]), () => ( ""))), () => ( "warn"));
84
+ }
85
+ function createLogger(opts) {
86
+ const quiet = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.quiet]), () => ( false));
87
+ const noColor = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _6 => _6.noColor]), () => ( false));
88
+ const p = _pino2.default.call(void 0, {
89
+ level: quiet ? quietLevel(_chunkQPUCXQXTjs.parity) : "debug"
90
+ }, kitTransport(noColor));
91
+ return {
92
+ info: (msg, ...kv) => p.info(kvToObj(kv), msg),
93
+ warn: (msg, ...kv) => p.warn(kvToObj(kv), msg),
94
+ error: (msg, ...kv) => p.error(kvToObj(kv), msg),
95
+ debug: (msg, ...kv) => p.debug(kvToObj(kv), msg),
96
+ trace: (msg, ...kv) => p.trace(kvToObj(kv), msg)
97
+ };
98
+ }
99
+ function withVerbose(opts) {
100
+ const quiet = _nullishCoalesce(opts.quiet, () => ( false));
101
+ const noColor = _nullishCoalesce(opts.noColor, () => ( false));
102
+ const v = _nullishCoalesce(opts.verbose, () => ( 0));
103
+ const level = quiet ? quietLevel(_chunkQPUCXQXTjs.parity) : verbosityLevel(_chunkQPUCXQXTjs.parity, v);
104
+ const p = _pino2.default.call(void 0, { level }, kitTransport(noColor));
105
+ return {
106
+ info: (msg, ...kv) => p.info(kvToObj(kv), msg),
107
+ warn: (msg, ...kv) => p.warn(kvToObj(kv), msg),
108
+ error: (msg, ...kv) => p.error(kvToObj(kv), msg),
109
+ debug: (msg, ...kv) => p.debug(kvToObj(kv), msg),
110
+ trace: (msg, ...kv) => p.trace(kvToObj(kv), msg)
111
+ };
112
+ }
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ exports.verbosityLevel = verbosityLevel; exports.quietLevel = quietLevel; exports.createLogger = createLogger; exports.withVerbose = withVerbose; exports.log_exports = log_exports;
@@ -0,0 +1,171 @@
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(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkR5U7XKVJjs = require('./chunk-R5U7XKVJ.js');
4
+
5
+ // src/toolspec.ts
6
+ var toolspec_exports = {};
7
+ _chunkR5U7XKVJjs.__export.call(void 0, toolspec_exports, {
8
+ findCommand: () => findCommand,
9
+ loadToolSpec: () => loadToolSpec,
10
+ validateToolSpec: () => validateToolSpec
11
+ });
12
+ var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
13
+ var _jsyaml = require('js-yaml'); var yaml = _interopRequireWildcard(_jsyaml);
14
+ function mapFlag(raw) {
15
+ return {
16
+ name: _nullishCoalesce(raw.name, () => ( "")),
17
+ short: raw.short,
18
+ type: raw.type,
19
+ description: raw.description,
20
+ deprecated: raw.deprecated,
21
+ replacedBy: raw.replaced_by
22
+ };
23
+ }
24
+ function mapProvenance(raw) {
25
+ if (!raw) return void 0;
26
+ return {
27
+ source: raw.source,
28
+ retrievedAt: raw.retrieved_at,
29
+ confidence: raw.confidence
30
+ };
31
+ }
32
+ function mapContract(raw) {
33
+ if (!raw) return void 0;
34
+ return {
35
+ idempotent: _nullishCoalesce(raw.idempotent, () => ( false)),
36
+ sideEffects: raw.side_effects,
37
+ retryable: _nullishCoalesce(raw.retryable, () => ( false)),
38
+ preConditions: raw.pre_conditions
39
+ };
40
+ }
41
+ function mapSafety(raw) {
42
+ if (!raw) return void 0;
43
+ return {
44
+ level: raw.level,
45
+ requiresConfirmation: raw.requires_confirmation,
46
+ permissions: raw.permissions
47
+ };
48
+ }
49
+ function mapOutputSchema(raw) {
50
+ if (!raw) return void 0;
51
+ return {
52
+ format: raw.format,
53
+ fields: raw.fields,
54
+ example: raw.example
55
+ };
56
+ }
57
+ function mapIntent(raw) {
58
+ if (!raw) return void 0;
59
+ return {
60
+ domain: raw.domain,
61
+ category: raw.category,
62
+ tags: raw.tags
63
+ };
64
+ }
65
+ function mapCommand(raw) {
66
+ return {
67
+ name: _nullishCoalesce(raw.name, () => ( "")),
68
+ aliases: raw.aliases,
69
+ flags: _optionalChain([raw, 'access', _ => _.flags, 'optionalAccess', _2 => _2.map, 'call', _3 => _3(mapFlag)]),
70
+ children: _optionalChain([raw, 'access', _4 => _4.children, 'optionalAccess', _5 => _5.map, 'call', _6 => _6(mapCommand)]),
71
+ contract: mapContract(raw.contract),
72
+ safety: mapSafety(raw.safety),
73
+ previewModes: raw.preview_modes,
74
+ outputSchema: mapOutputSchema(raw.output_schema),
75
+ deprecated: raw.deprecated,
76
+ deprecatedSince: raw.deprecated_since,
77
+ replacedBy: raw.replaced_by,
78
+ intent: mapIntent(raw.intent),
79
+ suggestedNext: raw.suggested_next
80
+ };
81
+ }
82
+ function mapStateIntrospection(raw) {
83
+ if (!raw) return void 0;
84
+ return {
85
+ configCommands: raw.config_commands,
86
+ envVars: raw.env_vars,
87
+ authCommands: raw.auth_commands
88
+ };
89
+ }
90
+ function mapErrorPattern(raw) {
91
+ return {
92
+ pattern: _nullishCoalesce(raw.pattern, () => ( "")),
93
+ fix: _nullishCoalesce(raw.fix, () => ( "")),
94
+ source: raw.source,
95
+ cause: raw.cause,
96
+ fixes: raw.fixes,
97
+ confidence: raw.confidence,
98
+ provenance: mapProvenance(raw.provenance)
99
+ };
100
+ }
101
+ function mapWorkflow(raw) {
102
+ return {
103
+ name: _nullishCoalesce(raw.name, () => ( "")),
104
+ steps: _nullishCoalesce(raw.steps, () => ( [])),
105
+ after: raw.after,
106
+ provenance: mapProvenance(raw.provenance)
107
+ };
108
+ }
109
+ function loadToolSpec(yamlPath) {
110
+ const content = fs.readFileSync(yamlPath, "utf-8");
111
+ const raw = yaml.load(content);
112
+ return {
113
+ name: _nullishCoalesce(raw.name, () => ( "")),
114
+ schemaVersion: _nullishCoalesce(raw.schema_version, () => ( "")),
115
+ commands: (_nullishCoalesce(raw.commands, () => ( []))).map(mapCommand),
116
+ flags: _optionalChain([raw, 'access', _7 => _7.flags, 'optionalAccess', _8 => _8.map, 'call', _9 => _9(mapFlag)]),
117
+ errorPatterns: _optionalChain([raw, 'access', _10 => _10.error_patterns, 'optionalAccess', _11 => _11.map, 'call', _12 => _12(mapErrorPattern)]),
118
+ workflows: _optionalChain([raw, 'access', _13 => _13.workflows, 'optionalAccess', _14 => _14.map, 'call', _15 => _15(mapWorkflow)]),
119
+ stateIntrospection: mapStateIntrospection(
120
+ raw.state_introspection
121
+ )
122
+ };
123
+ }
124
+ var VALID_SAFETY_LEVELS = /* @__PURE__ */ new Set([
125
+ "safe",
126
+ "caution",
127
+ "dangerous"
128
+ ]);
129
+ function validateToolSpec(spec) {
130
+ const errors = [];
131
+ if (!spec.name) errors.push("name is required");
132
+ if (!spec.schemaVersion) errors.push("schemaVersion is required");
133
+ if (!spec.commands || spec.commands.length === 0) {
134
+ errors.push("at least one command is required");
135
+ }
136
+ const validateCmd = (cmd, path) => {
137
+ if (!cmd.name) {
138
+ errors.push(`${path}: command name is required`);
139
+ }
140
+ if (cmd.safety && !VALID_SAFETY_LEVELS.has(cmd.safety.level)) {
141
+ errors.push(
142
+ `${path}: invalid safety level "${cmd.safety.level}" (must be safe|caution|dangerous)`
143
+ );
144
+ }
145
+ if (cmd.children) {
146
+ for (const child of cmd.children) {
147
+ validateCmd(child, `${path}/${child.name || "<unnamed>"}`);
148
+ }
149
+ }
150
+ };
151
+ for (const cmd of _nullishCoalesce(spec.commands, () => ( []))) {
152
+ validateCmd(cmd, cmd.name || "<unnamed>");
153
+ }
154
+ return errors;
155
+ }
156
+ function findCommand(spec, name) {
157
+ const queue = [...spec.commands];
158
+ while (queue.length > 0) {
159
+ const c = queue.shift();
160
+ if (c.name === name) return c;
161
+ if (c.children) queue.push(...c.children);
162
+ }
163
+ return void 0;
164
+ }
165
+
166
+
167
+
168
+
169
+
170
+
171
+ exports.loadToolSpec = loadToolSpec; exports.validateToolSpec = validateToolSpec; exports.findCommand = findCommand; exports.toolspec_exports = toolspec_exports;
@@ -1,68 +1,9 @@
1
1
  import { Command } from 'commander';
2
+ import { P as ParityData } from './parity-CvMuYcVI.js';
2
3
  import { E as ErrOffline, O as OfflineError, g as guardFetch, i as isOffline, a as isOfflineError, w as withOffline } from './netpolicy-Brx5XZUB.js';
3
4
  import { Writable } from 'node:stream';
4
5
  import { F as Format } from './output-CjZWmL8s.js';
5
6
 
6
- /**
7
- * @module tui/parity
8
- * @package @hop-top/kit
9
- *
10
- * Cross-language parity constants SoT. Values are read from the canonical
11
- * `contracts/parity/parity.json` at build time — tsup/esbuild inlines the
12
- * JSON into the emitted bundle, so the published package stays
13
- * self-contained without vendoring a second copy of the file.
14
- *
15
- * All TUI modules should import constants from here, not hardcode them.
16
- */
17
- /** Display metadata for a single help section. */
18
- interface SectionConfig {
19
- title: string;
20
- }
21
- /**
22
- * ParityData models every content block `parity.json` declares.
23
- *
24
- * A block present in the JSON but absent here is decoration: nothing loads
25
- * it, so no test and no consumer can see it drift. `PARITY_BLOCKS` below is
26
- * the machine-checkable half of that rule.
27
- */
28
- interface ParityData {
29
- description: string;
30
- status: {
31
- symbols: Record<'info' | 'success' | 'error' | 'warn', string>;
32
- };
33
- spinner: {
34
- frames: string[];
35
- interval_ms: number;
36
- };
37
- anim: {
38
- runes: string;
39
- interval_ms: number;
40
- default_width: number;
41
- };
42
- help: {
43
- /** Fang-vocabulary section names in render order. */
44
- section_order: string[];
45
- /** Display metadata keyed by fang section name. */
46
- sections: Record<string, SectionConfig>;
47
- };
48
- verbosity: {
49
- flag: string;
50
- /**
51
- * Maps the stacked `-V` count (as a decimal string) to a log level name.
52
- * Keys are strings because JSON object keys are.
53
- */
54
- levels: Record<string, string>;
55
- quiet_override: string;
56
- };
57
- streams: {
58
- flag: string;
59
- label_format: string;
60
- output: string;
61
- };
62
- /** Sibling contract files the parity suite also covers. */
63
- extends: string[];
64
- }
65
-
66
7
  /**
67
8
  * @module hint
68
9
  * @package @hop-top/kit
package/dist/cli.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import 'commander';
2
- export { C as CLIConfig, a as CLIResult, D as Dark, H as Hint, b as HintOptions, d as HintSet, N as Neon, P as Palette, T as Theme, e as active, f as applyHelpTheme, g as buildTheme, h as channel, i as createCLI, j as getCommandGroup, k as getStreamDefs, l as hintsEnabled, m as isQuiet, r as registerStream, n as registerUpgradeHints, o as registerVersionHints, p as renderHints, s as setCommandGroup, q as streamFlagName, t as streamLabel, u as streamOutput, v as verboseCount, w as verbosityFlagSpec, x as verbosityShorthand } from './cli-8rfITnv4.js';
2
+ import './parity-CvMuYcVI.js';
3
3
  export { E as ErrOffline, O as OfflineError, g as guardFetch, i as isOffline, a as isOfflineError, w as withOffline } from './netpolicy-Brx5XZUB.js';
4
+ export { C as CLIConfig, a as CLIResult, D as Dark, H as Hint, b as HintOptions, d as HintSet, N as Neon, P as Palette, T as Theme, e as active, f as applyHelpTheme, g as buildTheme, h as channel, i as createCLI, j as getCommandGroup, k as getStreamDefs, l as hintsEnabled, m as isQuiet, r as registerStream, n as registerUpgradeHints, o as registerVersionHints, p as renderHints, s as setCommandGroup, q as streamFlagName, t as streamLabel, u as streamOutput, v as verboseCount, w as verbosityFlagSpec, x as verbosityShorthand } from './cli-C5B5tnpA.js';
4
5
  import 'node:stream';
5
6
  import './output-CjZWmL8s.js';
6
7
  import './error-Do8Qji43.js';
package/dist/cli.js CHANGED
@@ -22,10 +22,8 @@
22
22
 
23
23
 
24
24
 
25
- var _chunkZC5TZYZJjs = require('./chunk-ZC5TZYZJ.js');
25
+ var _chunk7FDIN5KEjs = require('./chunk-7FDIN5KE.js');
26
26
  require('./chunk-QPUCXQXT.js');
27
- require('./chunk-72XZWQX7.js');
28
- require('./chunk-POR5L2DG.js');
29
27
 
30
28
 
31
29
 
@@ -34,6 +32,8 @@ require('./chunk-POR5L2DG.js');
34
32
 
35
33
 
36
34
  var _chunkKVG7YCTSjs = require('./chunk-KVG7YCTS.js');
35
+ require('./chunk-72XZWQX7.js');
36
+ require('./chunk-POR5L2DG.js');
37
37
  require('./chunk-R5U7XKVJ.js');
38
38
 
39
39
 
@@ -65,4 +65,4 @@ require('./chunk-R5U7XKVJ.js');
65
65
 
66
66
 
67
67
 
68
- exports.Dark = _chunkZC5TZYZJjs.Dark; exports.ErrOffline = _chunkKVG7YCTSjs.ErrOffline; exports.HintSet = _chunkZC5TZYZJjs.HintSet; exports.Neon = _chunkZC5TZYZJjs.Neon; exports.OfflineError = _chunkKVG7YCTSjs.OfflineError; exports.active = _chunkZC5TZYZJjs.active; exports.applyHelpTheme = _chunkZC5TZYZJjs.applyHelpTheme; exports.buildTheme = _chunkZC5TZYZJjs.buildTheme; exports.channel = _chunkZC5TZYZJjs.channel; exports.createCLI = _chunkZC5TZYZJjs.createCLI; exports.getCommandGroup = _chunkZC5TZYZJjs.getCommandGroup; exports.getStreamDefs = _chunkZC5TZYZJjs.getStreamDefs; exports.guardFetch = _chunkKVG7YCTSjs.guardFetch; exports.hintsEnabled = _chunkZC5TZYZJjs.hintsEnabled; exports.isOffline = _chunkKVG7YCTSjs.isOffline; exports.isOfflineError = _chunkKVG7YCTSjs.isOfflineError; exports.isQuiet = _chunkZC5TZYZJjs.isQuiet; exports.registerStream = _chunkZC5TZYZJjs.registerStream; exports.registerUpgradeHints = _chunkZC5TZYZJjs.registerUpgradeHints; exports.registerVersionHints = _chunkZC5TZYZJjs.registerVersionHints; exports.renderHints = _chunkZC5TZYZJjs.renderHints; exports.setCommandGroup = _chunkZC5TZYZJjs.setCommandGroup; exports.streamFlagName = _chunkZC5TZYZJjs.streamFlagName; exports.streamLabel = _chunkZC5TZYZJjs.streamLabel; exports.streamOutput = _chunkZC5TZYZJjs.streamOutput; exports.verboseCount = _chunkZC5TZYZJjs.verboseCount; exports.verbosityFlagSpec = _chunkZC5TZYZJjs.verbosityFlagSpec; exports.verbosityShorthand = _chunkZC5TZYZJjs.verbosityShorthand; exports.withOffline = _chunkKVG7YCTSjs.withOffline;
68
+ exports.Dark = _chunk7FDIN5KEjs.Dark; exports.ErrOffline = _chunkKVG7YCTSjs.ErrOffline; exports.HintSet = _chunk7FDIN5KEjs.HintSet; exports.Neon = _chunk7FDIN5KEjs.Neon; exports.OfflineError = _chunkKVG7YCTSjs.OfflineError; exports.active = _chunk7FDIN5KEjs.active; exports.applyHelpTheme = _chunk7FDIN5KEjs.applyHelpTheme; exports.buildTheme = _chunk7FDIN5KEjs.buildTheme; exports.channel = _chunk7FDIN5KEjs.channel; exports.createCLI = _chunk7FDIN5KEjs.createCLI; exports.getCommandGroup = _chunk7FDIN5KEjs.getCommandGroup; exports.getStreamDefs = _chunk7FDIN5KEjs.getStreamDefs; exports.guardFetch = _chunkKVG7YCTSjs.guardFetch; exports.hintsEnabled = _chunk7FDIN5KEjs.hintsEnabled; exports.isOffline = _chunkKVG7YCTSjs.isOffline; exports.isOfflineError = _chunkKVG7YCTSjs.isOfflineError; exports.isQuiet = _chunk7FDIN5KEjs.isQuiet; exports.registerStream = _chunk7FDIN5KEjs.registerStream; exports.registerUpgradeHints = _chunk7FDIN5KEjs.registerUpgradeHints; exports.registerVersionHints = _chunk7FDIN5KEjs.registerVersionHints; exports.renderHints = _chunk7FDIN5KEjs.renderHints; exports.setCommandGroup = _chunk7FDIN5KEjs.setCommandGroup; exports.streamFlagName = _chunk7FDIN5KEjs.streamFlagName; exports.streamLabel = _chunk7FDIN5KEjs.streamLabel; exports.streamOutput = _chunk7FDIN5KEjs.streamOutput; exports.verboseCount = _chunk7FDIN5KEjs.verboseCount; exports.verbosityFlagSpec = _chunk7FDIN5KEjs.verbosityFlagSpec; exports.verbosityShorthand = _chunk7FDIN5KEjs.verbosityShorthand; exports.withOffline = _chunkKVG7YCTSjs.withOffline;
@@ -0,0 +1,32 @@
1
+ import { Command } from 'commander';
2
+
3
+ /**
4
+ * @module completion
5
+ * @package @hop-top/kit
6
+ *
7
+ * Shell completion script generators for Commander-based CLIs.
8
+ * Extracts subcommand names and flag names from the program tree
9
+ * and generates bash/zsh/fish completion scripts.
10
+ */
11
+
12
+ /** Generate a bash completion script for the given program. */
13
+ declare function generateBashCompletion(program: Command): string;
14
+ /** Generate a zsh completion script for the given program. */
15
+ declare function generateZshCompletion(program: Command): string;
16
+ /** Generate a fish completion script for the given program. */
17
+ declare function generateFishCompletion(program: Command): string;
18
+ /**
19
+ * Create a hidden `completion` command with bash/zsh/fish subcommands.
20
+ * Each prints the completion script to stdout.
21
+ */
22
+ declare function completionCommand(program: Command): Command;
23
+
24
+ declare const completion_completionCommand: typeof completionCommand;
25
+ declare const completion_generateBashCompletion: typeof generateBashCompletion;
26
+ declare const completion_generateFishCompletion: typeof generateFishCompletion;
27
+ declare const completion_generateZshCompletion: typeof generateZshCompletion;
28
+ declare namespace completion {
29
+ export { completion_completionCommand as completionCommand, completion_generateBashCompletion as generateBashCompletion, completion_generateFishCompletion as generateFishCompletion, completion_generateZshCompletion as generateZshCompletion };
30
+ }
31
+
32
+ export { completionCommand as a, generateFishCompletion as b, completion as c, generateZshCompletion as d, generateBashCompletion as g };
@@ -0,0 +1,2 @@
1
+ import 'commander';
2
+ export { a as completionCommand, g as generateBashCompletion, b as generateFishCompletion, d as generateZshCompletion } from './completion-CVnPcWMZ.js';
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunk6RFRV4VPjs = require('./chunk-6RFRV4VP.js');
7
+ require('./chunk-R5U7XKVJ.js');
8
+
9
+
10
+
11
+
12
+
13
+ exports.completionCommand = _chunk6RFRV4VPjs.completionCommand; exports.generateBashCompletion = _chunk6RFRV4VPjs.generateBashCompletion; exports.generateFishCompletion = _chunk6RFRV4VPjs.generateFishCompletion; exports.generateZshCompletion = _chunk6RFRV4VPjs.generateZshCompletion;
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './cli-8rfITnv4.js';
1
+ import { T as Theme } from './cli-C5B5tnpA.js';
2
2
 
3
3
  /**
4
4
  * @module tui/badge
package/dist/index.d.ts CHANGED
@@ -3,11 +3,13 @@ export { a as alias } from './alias-BOj0-VAr.js';
3
3
  export { l as anthropic } from './llm-anthropic-Cd_I2xXB.js';
4
4
  export { a as api } from './api-DAexsu2H.js';
5
5
  export { a as auth } from './auth-2-jfgiHn.js';
6
- export { c as cli } from './cli-8rfITnv4.js';
6
+ export { c as cli } from './cli-C5B5tnpA.js';
7
+ export { c as completion } from './completion-CVnPcWMZ.js';
7
8
  export { c as config } from './config-Bm9fBXch.js';
8
9
  export { e as errcorrect } from './errcorrect-BcX1Ft0K.js';
9
10
  export { i as id } from './index-VLDcI5NF.js';
10
11
  export { l as llm } from './llm-DYuR7_uX.js';
12
+ export { l as log } from './log-uKjHsK-c.js';
11
13
  export { i as mcp } from './index-B-pqGHhU.js';
12
14
  export { n as netpolicy } from './netpolicy-Brx5XZUB.js';
13
15
  export { l as openai } from './llm-openai-DyFrucmV.js';
@@ -21,10 +23,12 @@ export { s as scope } from './scope-BrhYB4ij.js';
21
23
  export { s as serve } from './serve-D8yWMrTc.js';
22
24
  export { s as stream } from './stream-CrjeCp0M.js';
23
25
  export { i as telemetry } from './index-C3Zw4wDJ.js';
24
- export { i as tui } from './index-DEyjGoo2.js';
26
+ export { t as toolspec } from './toolspec-DPBr18Ub.js';
27
+ export { i as tui } from './index-DCe1boBz.js';
25
28
  export { u as upgrade } from './upgrade-p_zh3pvV.js';
26
29
  export { x as xdg } from './xdg-DB7Shoib.js';
27
30
  import 'commander';
31
+ import './parity-CvMuYcVI.js';
28
32
  import 'node:stream';
29
33
  import 'zod';
30
34
  import '@modelcontextprotocol/server';
package/dist/index.js CHANGED
@@ -1,5 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _chunkW7ERKNSQjs = require('./chunk-W7ERKNSQ.js');
4
+
5
+
6
+ var _chunkWWUKGJB5js = require('./chunk-WWUKGJB5.js');
7
+
8
+
3
9
  var _chunkL23O2FFEjs = require('./chunk-L23O2FFE.js');
4
10
 
5
11
 
@@ -12,6 +18,12 @@ var _chunkYOBAUCVNjs = require('./chunk-YOBAUCVN.js');
12
18
  var _chunkGGWJRWWAjs = require('./chunk-GGWJRWWA.js');
13
19
 
14
20
 
21
+ var _chunk6SVOHNICjs = require('./chunk-6SVOHNIC.js');
22
+
23
+
24
+ var _chunkMUIQVU6Ejs = require('./chunk-MUIQVU6E.js');
25
+
26
+
15
27
  var _chunkWUOAQVOAjs = require('./chunk-WUOAQVOA.js');
16
28
 
17
29
 
@@ -27,29 +39,23 @@ var _chunkMQXYDYRDjs = require('./chunk-MQXYDYRD.js');
27
39
  var _chunkBRNEKPWXjs = require('./chunk-BRNEKPWX.js');
28
40
 
29
41
 
30
- var _chunkWWUKGJB5js = require('./chunk-WWUKGJB5.js');
31
-
32
-
33
42
  var _chunkT46YPHKNjs = require('./chunk-T46YPHKN.js');
34
43
 
35
44
 
36
- var _chunkIXVQ62NZjs = require('./chunk-IXVQ62NZ.js');
37
-
38
-
39
- var _chunkBDNNPRX6js = require('./chunk-BDNNPRX6.js');
45
+ var _chunkABQSE7AIjs = require('./chunk-ABQSE7AI.js');
46
+ require('./chunk-YGYQUFGY.js');
40
47
 
41
48
 
42
- var _chunk6SVOHNICjs = require('./chunk-6SVOHNIC.js');
49
+ var _chunkPSFYJGDGjs = require('./chunk-PSFYJGDG.js');
43
50
 
44
51
 
45
- var _chunkMUIQVU6Ejs = require('./chunk-MUIQVU6E.js');
52
+ var _chunkGAZPYCQDjs = require('./chunk-GAZPYCQD.js');
46
53
 
47
54
 
48
- var _chunkABQSE7AIjs = require('./chunk-ABQSE7AI.js');
49
- require('./chunk-YGYQUFGY.js');
55
+ var _chunkIXVQ62NZjs = require('./chunk-IXVQ62NZ.js');
50
56
 
51
57
 
52
- var _chunkPSFYJGDGjs = require('./chunk-PSFYJGDG.js');
58
+ var _chunkBDNNPRX6js = require('./chunk-BDNNPRX6.js');
53
59
 
54
60
 
55
61
  var _chunkQJVSKKRQjs = require('./chunk-QJVSKKRQ.js');
@@ -67,13 +73,16 @@ var _chunkCSJWB6D3js = require('./chunk-CSJWB6D3.js');
67
73
  var _chunkUKZIAQA7js = require('./chunk-UKZIAQA7.js');
68
74
 
69
75
 
70
- var _chunkZC5TZYZJjs = require('./chunk-ZC5TZYZJ.js');
76
+ var _chunk7FDIN5KEjs = require('./chunk-7FDIN5KE.js');
71
77
  require('./chunk-QPUCXQXT.js');
78
+
79
+
80
+ var _chunkKVG7YCTSjs = require('./chunk-KVG7YCTS.js');
72
81
  require('./chunk-72XZWQX7.js');
73
82
  require('./chunk-POR5L2DG.js');
74
83
 
75
84
 
76
- var _chunkKVG7YCTSjs = require('./chunk-KVG7YCTS.js');
85
+ var _chunk6RFRV4VPjs = require('./chunk-6RFRV4VP.js');
77
86
 
78
87
 
79
88
  var _chunkIQXEISMCjs = require('./chunk-IQXEISMC.js');
@@ -108,4 +117,7 @@ require('./chunk-R5U7XKVJ.js');
108
117
 
109
118
 
110
119
 
111
- exports.aim = _chunkQJVSKKRQjs.aim_exports; exports.alias = _chunkS45UHXQFjs.alias_exports; exports.anthropic = _chunkT46YPHKNjs.llm_anthropic_exports; exports.api = _chunkCSJWB6D3js.api_exports; exports.auth = _chunkUKZIAQA7js.auth_exports; exports.cli = _chunkZC5TZYZJjs.cli_exports; exports.config = _chunkIQXEISMCjs.config_exports; exports.errcorrect = _chunk3FIKGFKIjs.errcorrect_exports; exports.id = _chunkL23O2FFEjs.id_exports; exports.llm = _chunkPSFYJGDGjs.llm_exports; exports.mcp = _chunkJTMPNXVQjs.mcp_exports; exports.netpolicy = _chunkKVG7YCTSjs.netpolicy_exports; exports.openai = _chunkABQSE7AIjs.llm_openai_exports; exports.output = _chunkIXVQ62NZjs.output_exports; exports.progress = _chunkBDNNPRX6js.progress_exports; exports.provenance = _chunk6SVOHNICjs.provenance_exports; exports.routellm = _chunkMUIQVU6Ejs.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.tui = _chunkGGWJRWWAjs.tui_exports; exports.upgrade = _chunkWWUKGJB5js.upgrade_exports; exports.xdg = _chunk4UE5TCMQjs.xdg_exports;
120
+
121
+
122
+
123
+ exports.aim = _chunkQJVSKKRQjs.aim_exports; exports.alias = _chunkS45UHXQFjs.alias_exports; exports.anthropic = _chunkT46YPHKNjs.llm_anthropic_exports; exports.api = _chunkCSJWB6D3js.api_exports; exports.auth = _chunkUKZIAQA7js.auth_exports; exports.cli = _chunk7FDIN5KEjs.cli_exports; exports.completion = _chunk6RFRV4VPjs.completion_exports; exports.config = _chunkIQXEISMCjs.config_exports; exports.errcorrect = _chunk3FIKGFKIjs.errcorrect_exports; exports.id = _chunkL23O2FFEjs.id_exports; exports.llm = _chunkPSFYJGDGjs.llm_exports; exports.log = _chunkGAZPYCQDjs.log_exports; exports.mcp = _chunkJTMPNXVQjs.mcp_exports; exports.netpolicy = _chunkKVG7YCTSjs.netpolicy_exports; exports.openai = _chunkABQSE7AIjs.llm_openai_exports; exports.output = _chunkIXVQ62NZjs.output_exports; exports.progress = _chunkBDNNPRX6js.progress_exports; exports.provenance = _chunk6SVOHNICjs.provenance_exports; exports.routellm = _chunkMUIQVU6Ejs.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 = _chunkW7ERKNSQjs.toolspec_exports; exports.tui = _chunkGGWJRWWAjs.tui_exports; exports.upgrade = _chunkWWUKGJB5js.upgrade_exports; exports.xdg = _chunk4UE5TCMQjs.xdg_exports;
@@ -0,0 +1,62 @@
1
+ import { P as ParityData } from './parity-CvMuYcVI.js';
2
+
3
+ /**
4
+ * Structured logger wrapping pino — applies kit's charmtone theme
5
+ * colors to stderr output.
6
+ *
7
+ * API: `logger.info('msg', 'key', val, 'key2', val2)` (variadic key-value)
8
+ * This matches Go's charm/log API, not pino's native object API.
9
+ * Pino handles transports, serialization, and performance under the hood.
10
+ *
11
+ * The `-V` count → level mapping and the `--quiet` override both come from
12
+ * the parity contract (`parity.json` verbosity block), so the level
13
+ * vocabulary stays identical across the Go, TypeScript and Python ports.
14
+ */
15
+
16
+ interface Logger {
17
+ info(msg: string, ...keyvals: any[]): void;
18
+ warn(msg: string, ...keyvals: any[]): void;
19
+ error(msg: string, ...keyvals: any[]): void;
20
+ debug(msg: string, ...keyvals: any[]): void;
21
+ trace(msg: string, ...keyvals: any[]): void;
22
+ }
23
+ interface LoggerOptions {
24
+ quiet?: boolean;
25
+ noColor?: boolean;
26
+ }
27
+ /**
28
+ * Resolve a `-V` count against a parity contract's `verbosity.levels`
29
+ * table. Counts above the highest declared key clamp to that key's level;
30
+ * an empty or unresolvable table falls back to `info`.
31
+ *
32
+ * Taking the contract as a parameter (rather than reading the module-level
33
+ * `parity`) keeps the mapping testable against a constructed `ParityData`
34
+ * without mutating the shared `parity.json`.
35
+ */
36
+ declare function verbosityLevel(d: ParityData, verbose: number): string;
37
+ /**
38
+ * Resolve a parity contract's `verbosity.quiet_override` to a pino level
39
+ * name. An unrecognized or absent override falls back to `warn`.
40
+ */
41
+ declare function quietLevel(d: ParityData): string;
42
+ declare function createLogger(opts?: LoggerOptions): Logger;
43
+ /**
44
+ * Map verbose count to a pino level through the parity contract's
45
+ * `verbosity.levels` table. Quiet overrides to the contract's
46
+ * `quiet_override` level regardless of verbose count.
47
+ */
48
+ declare function withVerbose(opts: LoggerOptions & {
49
+ verbose?: number;
50
+ }): Logger;
51
+
52
+ type log_Logger = Logger;
53
+ type log_LoggerOptions = LoggerOptions;
54
+ declare const log_createLogger: typeof createLogger;
55
+ declare const log_quietLevel: typeof quietLevel;
56
+ declare const log_verbosityLevel: typeof verbosityLevel;
57
+ declare const log_withVerbose: typeof withVerbose;
58
+ declare namespace log {
59
+ export { type log_Logger as Logger, type log_LoggerOptions as LoggerOptions, log_createLogger as createLogger, log_quietLevel as quietLevel, log_verbosityLevel as verbosityLevel, log_withVerbose as withVerbose };
60
+ }
61
+
62
+ export { type Logger as L, type LoggerOptions as a, createLogger as c, log as l, quietLevel as q, verbosityLevel as v, withVerbose as w };
package/dist/log.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import './parity-CvMuYcVI.js';
2
+ export { L as Logger, a as LoggerOptions, c as createLogger, q as quietLevel, v as verbosityLevel, w as withVerbose } from './log-uKjHsK-c.js';
package/dist/log.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkGAZPYCQDjs = require('./chunk-GAZPYCQD.js');
7
+ require('./chunk-QPUCXQXT.js');
8
+ require('./chunk-R5U7XKVJ.js');
9
+
10
+
11
+
12
+
13
+
14
+ exports.createLogger = _chunkGAZPYCQDjs.createLogger; exports.quietLevel = _chunkGAZPYCQDjs.quietLevel; exports.verbosityLevel = _chunkGAZPYCQDjs.verbosityLevel; exports.withVerbose = _chunkGAZPYCQDjs.withVerbose;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @module tui/parity
3
+ * @package @hop-top/kit
4
+ *
5
+ * Cross-language parity constants SoT. Values are read from the canonical
6
+ * `contracts/parity/parity.json` at build time — tsup/esbuild inlines the
7
+ * JSON into the emitted bundle, so the published package stays
8
+ * self-contained without vendoring a second copy of the file.
9
+ *
10
+ * All TUI modules should import constants from here, not hardcode them.
11
+ */
12
+ /** Display metadata for a single help section. */
13
+ interface SectionConfig {
14
+ title: string;
15
+ }
16
+ /**
17
+ * ParityData models every content block `parity.json` declares.
18
+ *
19
+ * A block present in the JSON but absent here is decoration: nothing loads
20
+ * it, so no test and no consumer can see it drift. `PARITY_BLOCKS` below is
21
+ * the machine-checkable half of that rule.
22
+ */
23
+ interface ParityData {
24
+ description: string;
25
+ status: {
26
+ symbols: Record<'info' | 'success' | 'error' | 'warn', string>;
27
+ };
28
+ spinner: {
29
+ frames: string[];
30
+ interval_ms: number;
31
+ };
32
+ anim: {
33
+ runes: string;
34
+ interval_ms: number;
35
+ default_width: number;
36
+ };
37
+ help: {
38
+ /** Fang-vocabulary section names in render order. */
39
+ section_order: string[];
40
+ /** Display metadata keyed by fang section name. */
41
+ sections: Record<string, SectionConfig>;
42
+ };
43
+ verbosity: {
44
+ flag: string;
45
+ /**
46
+ * Maps the stacked `-V` count (as a decimal string) to a log level name.
47
+ * Keys are strings because JSON object keys are.
48
+ */
49
+ levels: Record<string, string>;
50
+ quiet_override: string;
51
+ };
52
+ streams: {
53
+ flag: string;
54
+ label_format: string;
55
+ output: string;
56
+ };
57
+ /** Sibling contract files the parity suite also covers. */
58
+ extends: string[];
59
+ }
60
+
61
+ export type { ParityData as P };
@@ -0,0 +1,106 @@
1
+ type SafetyLevel = "safe" | "caution" | "dangerous";
2
+ interface Contract {
3
+ idempotent: boolean;
4
+ sideEffects?: string[];
5
+ retryable: boolean;
6
+ preConditions?: string[];
7
+ }
8
+ interface Safety {
9
+ level: SafetyLevel;
10
+ requiresConfirmation?: boolean;
11
+ permissions?: string[];
12
+ }
13
+ interface OutputSchema {
14
+ format?: string;
15
+ fields?: string[];
16
+ example?: string;
17
+ }
18
+ interface StateIntrospection {
19
+ configCommands?: string[];
20
+ envVars?: string[];
21
+ authCommands?: string[];
22
+ }
23
+ interface Provenance {
24
+ source?: string;
25
+ retrievedAt?: string;
26
+ confidence?: number;
27
+ }
28
+ interface Intent {
29
+ domain?: string;
30
+ category?: string;
31
+ tags?: string[];
32
+ }
33
+ interface Flag {
34
+ name: string;
35
+ short?: string;
36
+ type?: string;
37
+ description?: string;
38
+ deprecated?: boolean;
39
+ replacedBy?: string;
40
+ }
41
+ interface Command {
42
+ name: string;
43
+ aliases?: string[];
44
+ flags?: Flag[];
45
+ children?: Command[];
46
+ contract?: Contract;
47
+ safety?: Safety;
48
+ previewModes?: string[];
49
+ outputSchema?: OutputSchema;
50
+ deprecated?: boolean;
51
+ deprecatedSince?: string;
52
+ replacedBy?: string;
53
+ intent?: Intent;
54
+ suggestedNext?: string[];
55
+ }
56
+ interface ErrorPattern {
57
+ pattern: string;
58
+ fix: string;
59
+ source?: string;
60
+ cause?: string;
61
+ fixes?: string[];
62
+ confidence?: number;
63
+ provenance?: Provenance;
64
+ }
65
+ interface Workflow {
66
+ name: string;
67
+ steps: string[];
68
+ after?: Record<string, string[]>;
69
+ provenance?: Provenance;
70
+ }
71
+ interface ToolSpec {
72
+ name: string;
73
+ schemaVersion: string;
74
+ commands: Command[];
75
+ flags?: Flag[];
76
+ errorPatterns?: ErrorPattern[];
77
+ workflows?: Workflow[];
78
+ stateIntrospection?: StateIntrospection;
79
+ }
80
+ /** Parse a YAML toolspec file into a ToolSpec object. */
81
+ declare function loadToolSpec(yamlPath: string): ToolSpec;
82
+ /** Validate a ToolSpec, returning a list of error strings. */
83
+ declare function validateToolSpec(spec: ToolSpec): string[];
84
+ /** BFS search for a command by name (mirrors Go FindCommand). */
85
+ declare function findCommand(spec: ToolSpec, name: string): Command | undefined;
86
+
87
+ type toolspec_Command = Command;
88
+ type toolspec_Contract = Contract;
89
+ type toolspec_ErrorPattern = ErrorPattern;
90
+ type toolspec_Flag = Flag;
91
+ type toolspec_Intent = Intent;
92
+ type toolspec_OutputSchema = OutputSchema;
93
+ type toolspec_Provenance = Provenance;
94
+ type toolspec_Safety = Safety;
95
+ type toolspec_SafetyLevel = SafetyLevel;
96
+ type toolspec_StateIntrospection = StateIntrospection;
97
+ type toolspec_ToolSpec = ToolSpec;
98
+ type toolspec_Workflow = Workflow;
99
+ declare const toolspec_findCommand: typeof findCommand;
100
+ declare const toolspec_loadToolSpec: typeof loadToolSpec;
101
+ declare const toolspec_validateToolSpec: typeof validateToolSpec;
102
+ declare namespace toolspec {
103
+ export { type toolspec_Command as Command, type toolspec_Contract as Contract, type toolspec_ErrorPattern as ErrorPattern, type toolspec_Flag as Flag, type toolspec_Intent as Intent, type toolspec_OutputSchema as OutputSchema, type toolspec_Provenance as Provenance, type toolspec_Safety as Safety, type toolspec_SafetyLevel as SafetyLevel, type toolspec_StateIntrospection as StateIntrospection, type toolspec_ToolSpec as ToolSpec, type toolspec_Workflow as Workflow, toolspec_findCommand as findCommand, toolspec_loadToolSpec as loadToolSpec, toolspec_validateToolSpec as validateToolSpec };
104
+ }
105
+
106
+ export { type Command as C, type ErrorPattern as E, type Flag as F, type Intent as I, type OutputSchema as O, type Provenance as P, type Safety as S, type ToolSpec as T, type Workflow as W, type Contract as a, type SafetyLevel as b, type StateIntrospection as c, findCommand as f, loadToolSpec as l, toolspec as t, validateToolSpec as v };
@@ -0,0 +1 @@
1
+ export { C as Command, a as Contract, E as ErrorPattern, F as Flag, I as Intent, O as OutputSchema, P as Provenance, S as Safety, b as SafetyLevel, c as StateIntrospection, T as ToolSpec, W as Workflow, f as findCommand, l as loadToolSpec, v as validateToolSpec } from './toolspec-DPBr18Ub.js';
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkW7ERKNSQjs = require('./chunk-W7ERKNSQ.js');
6
+ require('./chunk-R5U7XKVJ.js');
7
+
8
+
9
+
10
+
11
+ exports.findCommand = _chunkW7ERKNSQjs.findCommand; exports.loadToolSpec = _chunkW7ERKNSQjs.loadToolSpec; exports.validateToolSpec = _chunkW7ERKNSQjs.validateToolSpec;
@@ -1,6 +1,7 @@
1
- export { A as Anim, a as AnimOpts, B as BadgeOpts, C as ConfirmOpts, L as ListItem, b as ListOpts, P as Progress, S as Spinner, c as StatusKind, d as anim, e as badge, f as clamp01, g as confirm, l as list, m as makeGradient, p as pills, h as progress, r as renderBarPlain, s as spinner, j as status } from '../index-DEyjGoo2.js';
2
- import '../cli-8rfITnv4.js';
1
+ export { A as Anim, a as AnimOpts, B as BadgeOpts, C as ConfirmOpts, L as ListItem, b as ListOpts, P as Progress, S as Spinner, c as StatusKind, d as anim, e as badge, f as clamp01, g as confirm, l as list, m as makeGradient, p as pills, h as progress, r as renderBarPlain, s as spinner, j as status } from '../index-DCe1boBz.js';
2
+ import '../cli-C5B5tnpA.js';
3
3
  import 'commander';
4
+ import '../parity-CvMuYcVI.js';
4
5
  import '../netpolicy-Brx5XZUB.js';
5
6
  import 'node:stream';
6
7
  import '../output-CjZWmL8s.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hop-top/kit",
3
- "version": "0.5.0-alpha.5",
3
+ "version": "0.5.0-alpha.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hop-top/poly-kit.git",
@@ -150,6 +150,21 @@
150
150
  "types": "./dist/mcp/index.d.ts",
151
151
  "require": "./dist/mcp/index.js",
152
152
  "default": "./dist/mcp/index.js"
153
+ },
154
+ "./log": {
155
+ "types": "./dist/log.d.ts",
156
+ "require": "./dist/log.js",
157
+ "default": "./dist/log.js"
158
+ },
159
+ "./completion": {
160
+ "types": "./dist/completion.d.ts",
161
+ "require": "./dist/completion.js",
162
+ "default": "./dist/completion.js"
163
+ },
164
+ "./toolspec": {
165
+ "types": "./dist/toolspec.d.ts",
166
+ "require": "./dist/toolspec.js",
167
+ "default": "./dist/toolspec.js"
153
168
  }
154
169
  },
155
170
  "typesVersions": {
@@ -234,6 +249,15 @@
234
249
  ],
235
250
  "mcp": [
236
251
  "./dist/mcp/index.d.ts"
252
+ ],
253
+ "log": [
254
+ "./dist/log.d.ts"
255
+ ],
256
+ "completion": [
257
+ "./dist/completion.d.ts"
258
+ ],
259
+ "toolspec": [
260
+ "./dist/toolspec.d.ts"
237
261
  ]
238
262
  }
239
263
  },
@@ -284,7 +308,7 @@
284
308
  },
285
309
  "license": "MIT",
286
310
  "scripts": {
287
- "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 --format cjs --splitting --dts",
311
+ "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 --format cjs --splitting --dts",
288
312
  "lint": "eslint src/",
289
313
  "lint:fix": "eslint src/ --fix",
290
314
  "typecheck": "tsc --noEmit -p tsconfig.json && tsc -p tsconfig.test.json",
package/src/index.ts CHANGED
@@ -17,10 +17,12 @@ export * as anthropic from './llm-anthropic.js';
17
17
  export * as api from './api.js';
18
18
  export * as auth from './auth.js';
19
19
  export * as cli from './cli.js';
20
+ export * as completion from './completion.js';
20
21
  export * as config from './config.js';
21
22
  export * as errcorrect from './errcorrect.js';
22
23
  export * as id from './id/index.js';
23
24
  export * as llm from './llm.js';
25
+ export * as log from './log.js';
24
26
  export * as mcp from './mcp/index.js';
25
27
  export * as netpolicy from './netpolicy.js';
26
28
  export * as openai from './llm-openai.js';
@@ -34,6 +36,7 @@ export * as scope from './scope.js';
34
36
  export * as serve from './serve.js';
35
37
  export * as stream from './stream.js';
36
38
  export * as telemetry from './telemetry/index.js';
39
+ export * as toolspec from './toolspec.js';
37
40
  export * as tui from './tui/index.js';
38
41
  export * as upgrade from './upgrade.js';
39
42
  export * as xdg from './xdg.js';
@@ -3,20 +3,20 @@
3
3
  var _chunkQPUCXQXTjs = require('./chunk-QPUCXQXT.js');
4
4
 
5
5
 
6
- var _chunk72XZWQX7js = require('./chunk-72XZWQX7.js');
7
6
 
8
7
 
9
- var _chunkPOR5L2DGjs = require('./chunk-POR5L2DG.js');
10
8
 
11
9
 
12
10
 
13
11
 
14
12
 
13
+ var _chunkKVG7YCTSjs = require('./chunk-KVG7YCTS.js');
15
14
 
16
15
 
16
+ var _chunk72XZWQX7js = require('./chunk-72XZWQX7.js');
17
17
 
18
18
 
19
- var _chunkKVG7YCTSjs = require('./chunk-KVG7YCTS.js');
19
+ var _chunkPOR5L2DGjs = require('./chunk-POR5L2DG.js');
20
20
 
21
21
 
22
22
  var _chunkR5U7XKVJjs = require('./chunk-R5U7XKVJ.js');