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

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.
Files changed (188) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/LICENSE +1 -1
  3. package/README.md +47 -575
  4. package/dist/{aim-CTp-kJW2.d.ts → aim-DZHwwiIc.d.ts} +1 -1
  5. package/dist/aim.d.ts +1 -1
  6. package/dist/aim.js +13 -414
  7. package/dist/{alias-dhhr08Ei.d.ts → alias-BOj0-VAr.d.ts} +1 -1
  8. package/dist/alias.d.ts +1 -1
  9. package/dist/alias.js +18 -206
  10. package/dist/{api-miiso81x.d.ts → api-DAexsu2H.d.ts} +1 -1
  11. package/dist/api.d.ts +1 -1
  12. package/dist/api.js +10 -164
  13. package/dist/auth.js +6 -40
  14. package/dist/chunk-3FIKGFKI.js +54 -0
  15. package/dist/chunk-4UE5TCMQ.js +104 -0
  16. package/dist/chunk-6HFAEZ52.js +29 -0
  17. package/dist/chunk-6SVOHNIC.js +17 -0
  18. package/dist/chunk-72XZWQX7.js +504 -0
  19. package/dist/chunk-ABQSE7AI.js +513 -0
  20. package/dist/chunk-BDNNPRX6.js +41 -0
  21. package/dist/chunk-BRNEKPWX.js +37 -0
  22. package/dist/chunk-CSJWB6D3.js +151 -0
  23. package/dist/chunk-GGWJRWWA.js +309 -0
  24. package/dist/chunk-IQXEISMC.js +142 -0
  25. package/dist/chunk-IXVQ62NZ.js +334 -0
  26. package/dist/chunk-JTMPNXVQ.js +1491 -0
  27. package/dist/chunk-KVG7YCTS.js +115 -0
  28. package/dist/chunk-L23O2FFE.js +51 -0
  29. package/dist/chunk-MQXYDYRD.js +968 -0
  30. package/dist/chunk-MUIQVU6E.js +251 -0
  31. package/dist/chunk-POR5L2DG.js +247 -0
  32. package/dist/chunk-PSFYJGDG.js +1445 -0
  33. package/dist/chunk-QJVSKKRQ.js +369 -0
  34. package/dist/chunk-QPUCXQXT.js +67 -0
  35. package/dist/chunk-R5U7XKVJ.js +16 -0
  36. package/dist/chunk-S45UHXQF.js +182 -0
  37. package/dist/chunk-T46YPHKN.js +669 -0
  38. package/dist/chunk-UKZIAQA7.js +26 -0
  39. package/dist/chunk-WBVO43HU.js +355 -0
  40. package/dist/chunk-WUOAQVOA.js +86 -0
  41. package/dist/chunk-WWUKGJB5.js +90 -0
  42. package/dist/chunk-YGYQUFGY.js +219 -0
  43. package/dist/chunk-YOBAUCVN.js +583 -0
  44. package/dist/chunk-ZC5TZYZJ.js +609 -0
  45. package/dist/{cli-DLygZLi9.d.ts → cli-8rfITnv4.d.ts} +13 -4
  46. package/dist/cli.d.ts +4 -4
  47. package/dist/cli.js +51 -1057
  48. package/dist/{config-BUY7_W2n.d.ts → config-Bm9fBXch.d.ts} +35 -4
  49. package/dist/config.d.ts +1 -1
  50. package/dist/config.js +6 -78
  51. package/dist/errcorrect.js +8 -68
  52. package/dist/{error-DISJKeDu.d.ts → error-Do8Qji43.d.ts} +88 -1
  53. package/dist/id/index.d.ts +1 -1
  54. package/dist/id/index.js +14 -65
  55. package/dist/{index-MLrRDvEG.d.ts → index-B-pqGHhU.d.ts} +113 -19
  56. package/dist/{index-Bc5c7Ty5.d.ts → index-DEyjGoo2.d.ts} +1 -1
  57. package/dist/{index-QSffbLnj.d.ts → index-VLDcI5NF.d.ts} +3 -2
  58. package/dist/index.d.ts +18 -15
  59. package/dist/index.js +39 -6722
  60. package/dist/llm-DYuR7_uX.d.ts +1069 -0
  61. package/dist/llm-anthropic-Cd_I2xXB.d.ts +67 -0
  62. package/dist/llm-anthropic.d.ts +2 -0
  63. package/dist/llm-anthropic.js +13 -0
  64. package/dist/llm-openai-DyFrucmV.d.ts +87 -0
  65. package/dist/llm-openai.d.ts +2 -0
  66. package/dist/llm-openai.js +19 -0
  67. package/dist/llm.d.ts +1 -1
  68. package/dist/llm.js +101 -356
  69. package/dist/mcp/index.d.ts +2 -1
  70. package/dist/mcp/index.js +155 -1453
  71. package/dist/{netpolicy-asvCfwi8.d.ts → netpolicy-Brx5XZUB.d.ts} +16 -3
  72. package/dist/netpolicy.d.ts +1 -1
  73. package/dist/netpolicy.js +25 -118
  74. package/dist/{output-4aXs91GY.d.ts → output-CjZWmL8s.d.ts} +28 -4
  75. package/dist/output.d.ts +2 -2
  76. package/dist/output.js +137 -971
  77. package/dist/progress.js +6 -55
  78. package/dist/provenance.js +6 -31
  79. package/dist/routellm-B0nv59mH.d.ts +111 -0
  80. package/dist/routellm.d.ts +2 -2
  81. package/dist/routellm.js +13 -255
  82. package/dist/{rpc-D5xLEf8V.d.ts → rpc-D31Lg0Kc.d.ts} +1 -1
  83. package/dist/rpc.d.ts +2 -2
  84. package/dist/rpc.js +4 -98
  85. package/dist/safety.js +6 -43
  86. package/dist/scope.js +20 -377
  87. package/dist/{serve-DE-jscpb.d.ts → serve-D8yWMrTc.d.ts} +2 -2
  88. package/dist/serve.d.ts +2 -2
  89. package/dist/serve.js +75 -1019
  90. package/dist/sqlstore.js +6 -39
  91. package/dist/stream.js +8 -51
  92. package/dist/telemetry/index.js +24 -608
  93. package/dist/tui/index.d.ts +5 -5
  94. package/dist/tui/index.js +17 -374
  95. package/dist/upgrade.js +6 -114
  96. package/dist/xdg.js +14 -128
  97. package/package.json +130 -25
  98. package/src/README.md +15 -0
  99. package/src/cli.help-command.test.ts +105 -0
  100. package/src/cli.test.ts +95 -1
  101. package/src/cli.ts +78 -13
  102. package/src/completion-values.test.ts +10 -10
  103. package/src/compliance.test.ts +196 -2
  104. package/src/compliance.ts +440 -20
  105. package/src/config.test.ts +187 -1
  106. package/src/config.ts +173 -7
  107. package/src/gen/crud_pb.ts +7 -7
  108. package/src/id/README.md +38 -0
  109. package/src/id/contract.test.ts +1 -1
  110. package/src/id/index.test.ts +1 -1
  111. package/src/id/index.ts +3 -2
  112. package/src/index.test.ts +12 -0
  113. package/src/index.ts +2 -0
  114. package/src/llm-anthropic.conformance.test.ts +1135 -0
  115. package/src/llm-anthropic.test.ts +152 -0
  116. package/src/llm-anthropic.ts +940 -0
  117. package/src/llm-choice-hermetic.test.ts +335 -0
  118. package/src/llm-config.test.ts +232 -0
  119. package/src/llm-config.ts +106 -0
  120. package/src/llm-endpoint.ts +254 -0
  121. package/src/llm-error.ts +17 -0
  122. package/src/llm-errors.ts +152 -0
  123. package/src/llm-file.ts +126 -0
  124. package/src/llm-http.ts +317 -0
  125. package/src/llm-keys.ts +167 -0
  126. package/src/llm-media.conformance.test.ts +87 -0
  127. package/src/llm-media.test.ts +279 -0
  128. package/src/llm-media.ts +322 -0
  129. package/src/llm-openai.conformance.test.ts +407 -0
  130. package/src/llm-openai.test.ts +510 -0
  131. package/src/llm-openai.ts +708 -0
  132. package/src/llm-payload.ts +155 -0
  133. package/src/llm-quote.ts +46 -0
  134. package/src/llm-routellm.conformance.test.ts +44 -0
  135. package/src/llm-toolnames.conformance.test.ts +112 -0
  136. package/src/llm-toolnames.test.ts +132 -0
  137. package/src/llm-toolnames.ts +298 -0
  138. package/src/llm-uri.ts +99 -0
  139. package/src/llm.test.ts +43 -15
  140. package/src/llm.toolcall.test.ts +175 -0
  141. package/src/llm.ts +602 -190
  142. package/src/mcp/README.md +57 -0
  143. package/src/mcp/conformance.test.ts +24 -3
  144. package/src/mcp/dispatch.ts +4 -4
  145. package/src/mcp/identity.test.ts +166 -0
  146. package/src/mcp/identity.ts +72 -0
  147. package/src/mcp/index.ts +6 -0
  148. package/src/mcp/legacy.ts +21 -8
  149. package/src/mcp/mcp.test.ts +14 -4
  150. package/src/mcp/modern-confirm.ts +1 -1
  151. package/src/mcp/modern.ts +12 -11
  152. package/src/mcp/tasks.ts +1 -1
  153. package/src/mcp/types.ts +80 -8
  154. package/src/netpolicy.test.ts +78 -0
  155. package/src/netpolicy.ts +28 -3
  156. package/src/output/README.md +46 -0
  157. package/src/output/builtins.ts +5 -5
  158. package/src/output/error.ts +144 -1
  159. package/src/output/formatters/README.md +50 -0
  160. package/src/output.ts +24 -1
  161. package/src/published-types.test.ts +115 -0
  162. package/src/routellm.test.ts +209 -28
  163. package/src/routellm.toolcall.test.ts +521 -0
  164. package/src/routellm.ts +213 -177
  165. package/src/router/README.md +44 -0
  166. package/src/router/server.test.ts +41 -0
  167. package/src/router/server.ts +11 -0
  168. package/src/safety.test.ts +19 -9
  169. package/src/scope-defaults.json +29 -29
  170. package/src/serve.ts +1 -1
  171. package/src/telemetry/README.md +48 -0
  172. package/src/telemetry/client.ts +5 -5
  173. package/src/toolspec.test.ts +2 -2
  174. package/src/triton/README.md +34 -0
  175. package/src/tui/README.md +42 -0
  176. package/src/wizard.test.ts +7 -7
  177. package/test/llm/conformance-helpers.ts +100 -0
  178. package/test/output/dispatch.test.ts +1 -2
  179. package/test/output/error.test.ts +33 -2
  180. package/test/output/smoke-capture.ts +2 -2
  181. package/test/output/smoke.test.ts +2 -2
  182. package/test/output/taxonomy-contract.test.ts +148 -0
  183. package/test/setup-env.ts +16 -0
  184. package/tsconfig.json +3 -1
  185. package/tsconfig.test.json +10 -0
  186. package/vitest.config.ts +9 -0
  187. package/dist/llm-B5XUWH8T.d.ts +0 -231
  188. package/dist/routellm-PGSt2D1y.d.ts +0 -75
@@ -6,9 +6,38 @@
6
6
  * Merges configuration from up to three file layers in priority order:
7
7
  * system → user → project → envOverride
8
8
  *
9
- * Each later layer's values overwrite earlier ones via {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign | Object.assign}.
9
+ * Each layer merges into `dst` with these rules:
10
+ *
11
+ * - Plain objects merge recursively, key by key, so a later layer only
12
+ * overrides the keys it sets (`db: {port: 2}` keeps an earlier `db.host`).
13
+ * - Arrays and scalars are replaced wholesale.
14
+ * - `null` clears an object or array; it leaves a scalar untouched.
15
+ * - On a type conflict (object vs non-object) the later value replaces the
16
+ * earlier one.
17
+ * - Non-plain objects (`Date`, `Map`, class instances) are never merged
18
+ * into; a later value replaces them.
19
+ *
20
+ * This matches Go's `kit/core/config` for struct fields. Go differs where its
21
+ * target type differs: a `map[...]` value or an `any` field is replaced
22
+ * whole rather than merged, and a type conflict on a typed field is a decode
23
+ * error rather than a replacement.
24
+ *
10
25
  * Missing files are silently skipped. A file that exists but contains invalid
11
- * YAML causes {@link load} to throw.
26
+ * YAML causes {@link load} to throw. A document whose root is not a mapping
27
+ * is ignored.
28
+ *
29
+ * Each file is checked before it merges, with aliases expanded, and
30
+ * {@link load} throws `config: failed to parse <path>: <reason>` when:
31
+ *
32
+ * - its aliases expand past Go yaml.v3's budget: more than 100 nodes inside
33
+ * alias expansions and more than 1000 in total, with the share inside
34
+ * aliases above 0.99 (up to 400k nodes), falling linearly to 0.10 at 4M
35
+ * (`document contains excessive aliasing`). Go counts only the keys its
36
+ * target struct reads; TS has no target, so it counts every key, and a
37
+ * file Go accepts because the aliases sit under ignored keys fails here.
38
+ * - collections nest deeper than 100, counted through aliases
39
+ * (`nesting exceeded maxDepth (100)`). Go allows 10000 levels of text
40
+ * nesting and caps alias chains only through the budget above.
12
41
  *
13
42
  * @example
14
43
  * ```ts
@@ -50,12 +79,12 @@ interface Options<T extends object = object> {
50
79
  systemConfigPath?: string;
51
80
  /**
52
81
  * Path to the per-user config file, e.g. `~/.config/mytool/config.yaml`.
53
- * Applied second; overwrites system values for shared keys.
82
+ * Applied second; merges over system values (see the module merge rules).
54
83
  */
55
84
  userConfigPath?: string;
56
85
  /**
57
86
  * Path to the project-level config file, e.g. `.mytool.yaml`.
58
- * Applied third; overwrites system and user values for shared keys.
87
+ * Applied third; merges over system and user values.
59
88
  */
60
89
  projectConfigPath?: string;
61
90
  /**
@@ -73,6 +102,8 @@ interface Options<T extends object = object> {
73
102
  * Merge order: `systemConfigPath` → `userConfigPath` → `projectConfigPath` →
74
103
  * `envOverride`.
75
104
  *
105
+ * - Objects merge recursively; arrays and scalars replace; `null` clears
106
+ * objects and arrays but not scalars (see the module docs for details).
76
107
  * - Missing files (ENOENT) are silently skipped.
77
108
  * - A file that exists but is not valid YAML causes this function to throw
78
109
  * a descriptive error wrapping the parse failure.
package/dist/config.d.ts CHANGED
@@ -1 +1 @@
1
- export { O as Options, l as load } from './config-BUY7_W2n.js';
1
+ export { O as Options, l as load } from './config-Bm9fBXch.js';
package/dist/config.js CHANGED
@@ -1,79 +1,7 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
29
2
 
30
- // src/config.ts
31
- var config_exports = {};
32
- __export(config_exports, {
33
- load: () => load2
34
- });
35
- module.exports = __toCommonJS(config_exports);
36
- var fs = __toESM(require("fs"));
37
- var yaml = __toESM(require("js-yaml"));
38
- function load2(dst, opts = {}) {
39
- const paths = [
40
- opts.systemConfigPath,
41
- opts.userConfigPath,
42
- opts.projectConfigPath
43
- ];
44
- for (const p of paths) {
45
- if (!p) continue;
46
- mergeFile(dst, p);
47
- }
48
- if (opts.envOverride) {
49
- opts.envOverride(dst);
50
- }
51
- return dst;
52
- }
53
- function mergeFile(dst, filePath) {
54
- let raw;
55
- try {
56
- raw = fs.readFileSync(filePath, "utf8");
57
- } catch (err) {
58
- if (isEnoent(err)) return;
59
- throw err;
60
- }
61
- let parsed;
62
- try {
63
- parsed = yaml.load(raw);
64
- } catch (err) {
65
- throw new Error(
66
- `config: failed to parse ${filePath}: ${err instanceof Error ? err.message : String(err)}`
67
- );
68
- }
69
- if (parsed !== null && parsed !== void 0 && typeof parsed === "object") {
70
- Object.assign(dst, parsed);
71
- }
72
- }
73
- function isEnoent(err) {
74
- return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
75
- }
76
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {
78
- load
79
- });
3
+ var _chunkIQXEISMCjs = require('./chunk-IQXEISMC.js');
4
+ require('./chunk-R5U7XKVJ.js');
5
+
6
+
7
+ exports.load = _chunkIQXEISMCjs.load;
@@ -1,69 +1,9 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
19
2
 
20
- // src/errcorrect.ts
21
- var errcorrect_exports = {};
22
- __export(errcorrect_exports, {
23
- createCorrectedError: () => createCorrectedError,
24
- formatError: () => formatError
25
- });
26
- module.exports = __toCommonJS(errcorrect_exports);
27
- function createCorrectedError(opts) {
28
- const err = new Error(opts.message);
29
- err.code = opts.code;
30
- if (opts.cause !== void 0) err.cause = opts.cause;
31
- if (opts.fix !== void 0) err.fix = opts.fix;
32
- if (opts.alternatives !== void 0) err.alternatives = opts.alternatives;
33
- if (opts.retryable !== void 0) err.retryable = opts.retryable;
34
- err.toJSON = () => {
35
- const o = {
36
- code: err.code,
37
- message: err.message
38
- };
39
- if (err.cause !== void 0) o.cause = err.cause;
40
- if (err.fix !== void 0) o.fix = err.fix;
41
- if (err.alternatives !== void 0) o.alternatives = err.alternatives;
42
- if (err.retryable !== void 0) o.retryable = err.retryable;
43
- return o;
44
- };
45
- return err;
46
- }
47
- function formatError(err, opts) {
48
- const red = opts?.noColor ? (s) => s : (s) => `\x1B[31m${s}\x1B[0m`;
49
- const bold = opts?.noColor ? (s) => s : (s) => `\x1B[1m${s}\x1B[0m`;
50
- const lines = [];
51
- lines.push(` ${red(bold("ERROR"))} ${err.message}`);
52
- if (err.cause) {
53
- lines.push(` Cause: ${err.cause}`);
54
- }
55
- if (err.fix) {
56
- lines.push(` Fix: ${err.fix}`);
57
- }
58
- if (err.alternatives && err.alternatives.length > 0) {
59
- for (const alt of err.alternatives) {
60
- lines.push(` Try: ${alt}`);
61
- }
62
- }
63
- return lines.join("\n");
64
- }
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- createCorrectedError,
68
- formatError
69
- });
3
+
4
+ var _chunk3FIKGFKIjs = require('./chunk-3FIKGFKI.js');
5
+ require('./chunk-R5U7XKVJ.js');
6
+
7
+
8
+
9
+ exports.createCorrectedError = _chunk3FIKGFKIjs.createCorrectedError; exports.formatError = _chunk3FIKGFKIjs.formatError;
@@ -30,8 +30,15 @@ declare const CODE_NOT_FOUND = "NOT_FOUND";
30
30
  declare const CODE_CONFLICT = "CONFLICT";
31
31
  declare const CODE_UNAUTHORIZED = "UNAUTHORIZED";
32
32
  declare const CODE_TRANSIENT = "TRANSIENT";
33
+ declare const CODE_CONSENT_REFUSED = "CONSENT_REFUSED";
33
34
  declare const CODE_PROVENANCE_MISSING = "PROVENANCE_MISSING";
34
35
  declare const CODE_RATE_LIMITED = "RATE_LIMITED";
36
+ declare const CODE_PREREQUISITE = "PREREQUISITE";
37
+ /**
38
+ * Success. Present for completeness so a table of the full taxonomy can
39
+ * be written without a bare 0.
40
+ */
41
+ declare const EXIT_OK = 0;
35
42
  /**
36
43
  * Spec-assigned exit code for the generic failure class: the command
37
44
  * failed and no narrower code applies. Pair it with {@link genericError}
@@ -39,12 +46,41 @@ declare const CODE_RATE_LIMITED = "RATE_LIMITED";
39
46
  * class.
40
47
  */
41
48
  declare const EXIT_GENERIC = 1;
49
+ /**
50
+ * The caller's invocation being wrong: an unknown flag, a missing
51
+ * argument, a value the command cannot parse. Permanent by
52
+ * construction — the same argv fails identically.
53
+ */
54
+ declare const EXIT_USAGE = 2;
55
+ /** A named resource the command could not locate. */
56
+ declare const EXIT_NOT_FOUND = 3;
57
+ /**
58
+ * A request that cannot be satisfied against the current state: a
59
+ * precondition failed, a write raced, an identifier is already taken.
60
+ */
61
+ declare const EXIT_CONFLICT = 4;
62
+ /**
63
+ * An authentication or authorization refusal. Permanent: the caller
64
+ * needs new credentials or a different policy, not a retry. Distinct
65
+ * from {@link EXIT_CONSENT_REFUSED}, which a re-invocation with
66
+ * `--confirm=yes` clears.
67
+ */
68
+ declare const EXIT_UNAUTHORIZED = 5;
42
69
  /**
43
70
  * Spec-assigned exit code for transient/retryable failures (Factor 11).
44
71
  * Agents branch on it before parsing stderr: exit 6 means a retry may
45
72
  * clear the failure.
46
73
  */
47
74
  declare const EXIT_TRANSIENT = 6;
75
+ /**
76
+ * Exit code for a confirmation gate that declined to run a destructive
77
+ * operation (`--confirm=no`, the non-TTY default, a missing or
78
+ * mismatched `--confirm-token`, or `N` at the prompt). Classified
79
+ * transient: re-invoking with `--confirm=yes` clears it. Distinct from
80
+ * {@link CODE_UNAUTHORIZED} at exit 5, which is permanent because no
81
+ * confirmation can clear a policy denial.
82
+ */
83
+ declare const EXIT_CONSENT_REFUSED = 7;
48
84
  /** Conventional exit code for Factor-10 rate-limit refusals. */
49
85
  declare const EXIT_RATE_LIMITED = 64;
50
86
  /**
@@ -54,6 +90,16 @@ declare const EXIT_RATE_LIMITED = 64;
54
90
  * codes, and kit as a library stays out of the low per-tool range.
55
91
  */
56
92
  declare const EXIT_PROVENANCE_MISSING = 65;
93
+ /**
94
+ * Exit code for a declared external dependency kit could not contact:
95
+ * nothing listening on the configured endpoint, connection refused,
96
+ * dial timeout. Separates a correct invocation whose logic never ran
97
+ * from the uncharacterized failures on exit 1. Classified transient,
98
+ * but deliberately not {@link CODE_TRANSIENT}: a dependency that is not
99
+ * running never comes up on its own, so the caller repairs the
100
+ * environment instead of backing off.
101
+ */
102
+ declare const EXIT_PREREQUISITE = 70;
57
103
  /**
58
104
  * Structured-error envelope rendered to stderr when `--format json|yaml`
59
105
  * is set. Keys are the on-wire snake_case names.
@@ -79,6 +125,24 @@ interface CliError {
79
125
  * (or use {@link withTransience}) to classify their own codes.
80
126
  */
81
127
  declare function transienceForCode(code: string): string;
128
+ /**
129
+ * Resolves a standard class symbol to its numeric exit code, or
130
+ * `undefined` for adopter-defined and tool-specific codes.
131
+ *
132
+ * Callers that must produce a number for an unknown class decide their
133
+ * own fallback. This function does not pick one: a built-in fallback
134
+ * turns "this class was added to kit and never copied here" into an
135
+ * assertion against exit 1 that looks like a real failure rather than a
136
+ * stale table.
137
+ */
138
+ declare function exitCodeForClass(code: string): number | undefined;
139
+ /**
140
+ * The class symbols kit defines, in ascending exit-code order (ties
141
+ * broken by symbol). Callers rendering the taxonomy iterate this rather
142
+ * than hard-coding rows, so a class added above appears without a
143
+ * second edit.
144
+ */
145
+ declare function exitClasses(): string[];
82
146
  /**
83
147
  * Builds an envelope from `err`, retaining it for {@link unwrapError}
84
148
  * while rendering as `code` and message. Transience defaults from the
@@ -121,6 +185,29 @@ declare function usageError(message: string): CliError;
121
185
  * service-unavailable responses.
122
186
  */
123
187
  declare function transientError(message: string): CliError;
188
+ /**
189
+ * CODE_CONSENT_REFUSED envelope with exit code 7. Use it when a
190
+ * confirmation gate declines to run a destructive operation:
191
+ * `--confirm=no`, the non-TTY default, a missing or mismatched
192
+ * `--confirm-token`, or `N` at the prompt.
193
+ *
194
+ * Classified transient: the caller clears it by re-invoking with
195
+ * `--confirm=yes` (or the matching token). Do not use it for policy
196
+ * denials, which no confirmation can clear — those stay
197
+ * {@link unauthorizedError} and permanent.
198
+ */
199
+ declare function consentRefusedError(message: string): CliError;
200
+ /**
201
+ * CODE_PREREQUISITE envelope with exit code 70. Use it when a declared
202
+ * external dependency could not be contacted: nothing listening on the
203
+ * configured endpoint, connection refused, dial timeout.
204
+ *
205
+ * Classified transient: the operator starts the dependency and the same
206
+ * command succeeds. Do not use it for a dependency that answered and
207
+ * then misbehaved — that is {@link genericError} — nor for one that was
208
+ * never configured, which is {@link usageError}.
209
+ */
210
+ declare function prerequisiteError(message: string): CliError;
124
211
  /** CODE_RATE_LIMITED envelope with exit code 64 (Factor 10). */
125
212
  declare function rateLimitedError(message: string): CliError;
126
213
  /**
@@ -141,4 +228,4 @@ declare function renderError(w: {
141
228
  write(chunk: string): unknown;
142
229
  }, format: string, err: CliError | null | undefined): void;
143
230
 
144
- export { wrapError as A, CODE_CONFLICT as C, EXIT_GENERIC as E, TRANSIENCE_PERMANENT as T, CODE_GENERIC as a, CODE_NOT_FOUND as b, CODE_OK as c, CODE_PROVENANCE_MISSING as d, CODE_RATE_LIMITED as e, CODE_TRANSIENT as f, CODE_UNAUTHORIZED as g, CODE_USAGE as h, type CliError as i, EXIT_PROVENANCE_MISSING as j, EXIT_RATE_LIMITED as k, EXIT_TRANSIENT as l, TRANSIENCE_TRANSIENT as m, TRANSIENCE_UNKNOWN as n, conflictError as o, genericError as p, notFoundError as q, provenanceMissingError as r, rateLimitedError as s, renderError as t, transienceForCode as u, transientError as v, unauthorizedError as w, unwrapError as x, usageError as y, withTransience as z };
231
+ export { exitCodeForClass as A, genericError as B, type CliError as C, notFoundError as D, EXIT_CONFLICT as E, prerequisiteError as F, provenanceMissingError as G, rateLimitedError as H, renderError as I, transienceForCode as J, transientError as K, unauthorizedError as L, unwrapError as M, usageError as N, withTransience as O, wrapError as P, TRANSIENCE_PERMANENT as T, CODE_TRANSIENT as a, CODE_CONFLICT as b, CODE_CONSENT_REFUSED as c, CODE_GENERIC as d, CODE_NOT_FOUND as e, CODE_OK as f, CODE_PREREQUISITE as g, CODE_PROVENANCE_MISSING as h, CODE_RATE_LIMITED as i, CODE_UNAUTHORIZED as j, CODE_USAGE as k, EXIT_CONSENT_REFUSED as l, EXIT_GENERIC as m, EXIT_NOT_FOUND as n, EXIT_OK as o, EXIT_PREREQUISITE as p, EXIT_PROVENANCE_MISSING as q, EXIT_RATE_LIMITED as r, EXIT_TRANSIENT as s, EXIT_UNAUTHORIZED as t, EXIT_USAGE as u, TRANSIENCE_TRANSIENT as v, TRANSIENCE_UNKNOWN as w, conflictError as x, consentRefusedError as y, exitClasses as z };
@@ -1,2 +1,2 @@
1
1
  import 'zod';
2
- export { P as Parsed, T as Typed, n as newId, a as newTyped, p as parse, b as parseTyped, t as typeIdSchema } from '../index-QSffbLnj.js';
2
+ export { P as Parsed, T as Typed, n as newId, a as newTyped, p as parse, b as parseTyped, t as typeIdSchema } from '../index-VLDcI5NF.js';
package/dist/id/index.js CHANGED
@@ -1,66 +1,15 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
19
2
 
20
- // src/id/index.ts
21
- var id_exports = {};
22
- __export(id_exports, {
23
- newId: () => newId,
24
- newTyped: () => newTyped,
25
- parse: () => parse,
26
- parseTyped: () => parseTyped,
27
- typeIdSchema: () => typeIdSchema
28
- });
29
- module.exports = __toCommonJS(id_exports);
30
- var import_typeid_js = require("typeid-js");
31
- var import_zod = require("zod");
32
- function newId(prefix) {
33
- return (0, import_typeid_js.typeid)(prefix).toString();
34
- }
35
- function parse(s) {
36
- const tid = import_typeid_js.TypeID.fromString(s);
37
- return {
38
- prefix: tid.getType(),
39
- uuid: tid.toUUID()
40
- };
41
- }
42
- function newTyped(prefix) {
43
- return (0, import_typeid_js.typeid)(prefix).toString();
44
- }
45
- function parseTyped(prefix, s) {
46
- const tid = import_typeid_js.TypeID.fromString(s, prefix);
47
- return tid.toString();
48
- }
49
- var SUFFIX_RE = /^[0-7][0-9a-hjkmnp-tv-z]{25}$/;
50
- function typeIdSchema(prefix) {
51
- const pattern = new RegExp(
52
- `^${escapeRegExp(prefix)}_${SUFFIX_RE.source.slice(1, -1)}$`
53
- );
54
- return import_zod.z.string().regex(pattern, `invalid typeid for prefix '${prefix}'`);
55
- }
56
- function escapeRegExp(s) {
57
- return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
58
- }
59
- // Annotate the CommonJS export names for ESM import in node:
60
- 0 && (module.exports = {
61
- newId,
62
- newTyped,
63
- parse,
64
- parseTyped,
65
- typeIdSchema
66
- });
3
+
4
+
5
+
6
+
7
+ var _chunkL23O2FFEjs = require('../chunk-L23O2FFE.js');
8
+ require('../chunk-R5U7XKVJ.js');
9
+
10
+
11
+
12
+
13
+
14
+
15
+ exports.newId = _chunkL23O2FFEjs.newId; exports.newTyped = _chunkL23O2FFEjs.newTyped; exports.parse = _chunkL23O2FFEjs.parse; exports.parseTyped = _chunkL23O2FFEjs.parseTyped; exports.typeIdSchema = _chunkL23O2FFEjs.typeIdSchema;