@hop-top/kit 0.4.0-alpha.1

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 (174) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/LICENSE +25 -0
  3. package/README.md +189 -0
  4. package/dist/aim.d.ts +116 -0
  5. package/dist/aim.js +417 -0
  6. package/dist/alias.d.ts +73 -0
  7. package/dist/alias.js +207 -0
  8. package/dist/api.d.ts +62 -0
  9. package/dist/api.js +165 -0
  10. package/dist/auth.d.ts +26 -0
  11. package/dist/auth.js +41 -0
  12. package/dist/cli.d.ts +309 -0
  13. package/dist/cli.js +885 -0
  14. package/dist/config.d.ts +97 -0
  15. package/dist/config.js +79 -0
  16. package/dist/errcorrect.d.ts +37 -0
  17. package/dist/errcorrect.js +69 -0
  18. package/dist/llm.d.ts +188 -0
  19. package/dist/llm.js +356 -0
  20. package/dist/output.d.ts +213 -0
  21. package/dist/output.js +447 -0
  22. package/dist/progress.d.ts +30 -0
  23. package/dist/progress.js +56 -0
  24. package/dist/provenance.d.ts +24 -0
  25. package/dist/provenance.js +32 -0
  26. package/dist/routellm.d.ts +64 -0
  27. package/dist/routellm.js +258 -0
  28. package/dist/rpc.d.ts +25 -0
  29. package/dist/rpc.js +101 -0
  30. package/dist/safety.d.ts +24 -0
  31. package/dist/safety.js +44 -0
  32. package/dist/scope.d.ts +121 -0
  33. package/dist/scope.js +380 -0
  34. package/dist/sqlstore.d.ts +84 -0
  35. package/dist/sqlstore.js +85 -0
  36. package/dist/stream.d.ts +35 -0
  37. package/dist/stream.js +52 -0
  38. package/dist/tui/index.d.ts +300 -0
  39. package/dist/tui/index.js +332 -0
  40. package/dist/upgrade.d.ts +95 -0
  41. package/dist/upgrade.js +115 -0
  42. package/dist/xdg.d.ts +169 -0
  43. package/dist/xdg.js +129 -0
  44. package/eslint.config.mjs +17 -0
  45. package/package.json +133 -0
  46. package/src/README.md +3 -0
  47. package/src/aim.test.ts +331 -0
  48. package/src/aim.ts +388 -0
  49. package/src/alias.test.ts +423 -0
  50. package/src/alias.ts +256 -0
  51. package/src/api.test.ts +190 -0
  52. package/src/api.ts +214 -0
  53. package/src/auth.test.ts +24 -0
  54. package/src/auth.ts +37 -0
  55. package/src/bus.test.ts +178 -0
  56. package/src/bus.ts +114 -0
  57. package/src/cli.test.ts +690 -0
  58. package/src/cli.ts +741 -0
  59. package/src/completion-values.test.ts +202 -0
  60. package/src/completion-values.ts +173 -0
  61. package/src/completion.test.ts +212 -0
  62. package/src/completion.ts +158 -0
  63. package/src/compliance.test.ts +134 -0
  64. package/src/compliance.ts +669 -0
  65. package/src/config.test.ts +110 -0
  66. package/src/config.ts +164 -0
  67. package/src/errcorrect.test.ts +134 -0
  68. package/src/errcorrect.ts +84 -0
  69. package/src/flagregister.test.ts +103 -0
  70. package/src/flagregister.ts +78 -0
  71. package/src/gen/crud_connect.ts +76 -0
  72. package/src/gen/crud_pb.ts +269 -0
  73. package/src/hint.test.ts +315 -0
  74. package/src/hint.ts +178 -0
  75. package/src/llm.test.ts +612 -0
  76. package/src/llm.ts +577 -0
  77. package/src/log.test.ts +145 -0
  78. package/src/log.ts +155 -0
  79. package/src/output/builtins.ts +34 -0
  80. package/src/output/dispatch.ts +195 -0
  81. package/src/output/flags.ts +151 -0
  82. package/src/output/format_help.ts +80 -0
  83. package/src/output/formatter.ts +167 -0
  84. package/src/output/formatters/csv.ts +72 -0
  85. package/src/output/formatters/json.ts +44 -0
  86. package/src/output/formatters/table.ts +44 -0
  87. package/src/output/formatters/text.ts +109 -0
  88. package/src/output/formatters/yaml.ts +47 -0
  89. package/src/output/projection.ts +126 -0
  90. package/src/output/registry.ts +88 -0
  91. package/src/output/template.ts +63 -0
  92. package/src/output.test.ts +117 -0
  93. package/src/output.ts +90 -0
  94. package/src/progress.test.ts +93 -0
  95. package/src/progress.ts +58 -0
  96. package/src/provenance.test.ts +59 -0
  97. package/src/provenance.ts +26 -0
  98. package/src/routellm.test.ts +179 -0
  99. package/src/routellm.ts +365 -0
  100. package/src/router/bert.test.ts +180 -0
  101. package/src/router/bert.ts +145 -0
  102. package/src/router/controller.test.ts +183 -0
  103. package/src/router/controller.ts +165 -0
  104. package/src/router/integration.test.ts +309 -0
  105. package/src/router/intent.test.ts +187 -0
  106. package/src/router/intent.ts +208 -0
  107. package/src/router/mf.test.ts +66 -0
  108. package/src/router/mf.ts +52 -0
  109. package/src/router/random.test.ts +23 -0
  110. package/src/router/random.ts +13 -0
  111. package/src/router/router.test.ts +31 -0
  112. package/src/router/router.ts +62 -0
  113. package/src/router/server.test.ts +193 -0
  114. package/src/router/server.ts +134 -0
  115. package/src/router/sw.test.ts +199 -0
  116. package/src/router/sw.ts +232 -0
  117. package/src/rpc.test.ts +47 -0
  118. package/src/rpc.ts +91 -0
  119. package/src/safety.test.ts +53 -0
  120. package/src/safety.ts +42 -0
  121. package/src/scope-defaults.json +72 -0
  122. package/src/scope.test.ts +177 -0
  123. package/src/scope.ts +382 -0
  124. package/src/setflag.test.ts +110 -0
  125. package/src/setflag.ts +102 -0
  126. package/src/sqlstore.test.ts +110 -0
  127. package/src/sqlstore.ts +144 -0
  128. package/src/stream.test.ts +69 -0
  129. package/src/stream.ts +47 -0
  130. package/src/textflag.test.ts +105 -0
  131. package/src/textflag.ts +68 -0
  132. package/src/toolspec.test.ts +187 -0
  133. package/src/toolspec.ts +279 -0
  134. package/src/triton/client.test.ts +205 -0
  135. package/src/triton/client.ts +261 -0
  136. package/src/tui/anim.test.ts +146 -0
  137. package/src/tui/anim.ts +134 -0
  138. package/src/tui/badge.test.ts +41 -0
  139. package/src/tui/badge.ts +55 -0
  140. package/src/tui/confirm.test.ts +68 -0
  141. package/src/tui/confirm.ts +49 -0
  142. package/src/tui/index.ts +29 -0
  143. package/src/tui/list.test.ts +84 -0
  144. package/src/tui/list.ts +72 -0
  145. package/src/tui/parity.ts +41 -0
  146. package/src/tui/pills.test.ts +40 -0
  147. package/src/tui/pills.ts +43 -0
  148. package/src/tui/progress.test.ts +164 -0
  149. package/src/tui/progress.ts +120 -0
  150. package/src/tui/spinner.test.ts +111 -0
  151. package/src/tui/spinner.ts +96 -0
  152. package/src/tui/status.test.ts +68 -0
  153. package/src/tui/status.ts +66 -0
  154. package/src/upgrade.test.ts +298 -0
  155. package/src/upgrade.ts +205 -0
  156. package/src/uri.ts +199 -0
  157. package/src/wizard.test.ts +441 -0
  158. package/src/wizard.ts +662 -0
  159. package/src/xdg.test.ts +202 -0
  160. package/src/xdg.ts +280 -0
  161. package/test/output/cols.test.ts +148 -0
  162. package/test/output/csv.test.ts +129 -0
  163. package/test/output/dispatch.test.ts +194 -0
  164. package/test/output/format_help.test.ts +131 -0
  165. package/test/output/formatter.test.ts +137 -0
  166. package/test/output/output_flag.test.ts +124 -0
  167. package/test/output/registry.test.ts +127 -0
  168. package/test/output/smoke-capture.ts +83 -0
  169. package/test/output/smoke.test.ts +142 -0
  170. package/test/output/template.test.ts +95 -0
  171. package/test/output/text.test.ts +75 -0
  172. package/test/testdata/api-fixture.json +115 -0
  173. package/test/testdata/query-vectors.json +187 -0
  174. package/tsconfig.json +12 -0
@@ -0,0 +1,115 @@
1
+ {
2
+ "anthropic": {
3
+ "id": "anthropic",
4
+ "name": "Anthropic",
5
+ "models": {
6
+ "claude-3-5-sonnet": {
7
+ "id": "claude-3-5-sonnet",
8
+ "name": "Claude 3.5 Sonnet",
9
+ "provider": "anthropic",
10
+ "family": "claude",
11
+ "modalities": {"input": ["text", "image"], "output": ["text"]},
12
+ "limit": {"context": 200000, "output": 8192},
13
+ "cost": {"input": 3.0, "output": 15.0},
14
+ "tool_call": true,
15
+ "reasoning": false,
16
+ "open_weights": false
17
+ },
18
+ "claude-3-5-haiku": {
19
+ "id": "claude-3-5-haiku",
20
+ "name": "Claude 3.5 Haiku",
21
+ "provider": "anthropic",
22
+ "family": "claude",
23
+ "modalities": {"input": ["text", "image"], "output": ["text"]},
24
+ "limit": {"context": 200000, "output": 8192},
25
+ "cost": {"input": 0.8, "output": 4.0},
26
+ "tool_call": true,
27
+ "reasoning": false,
28
+ "open_weights": false
29
+ },
30
+ "claude-3-7-sonnet": {
31
+ "id": "claude-3-7-sonnet",
32
+ "name": "Claude 3.7 Sonnet",
33
+ "provider": "anthropic",
34
+ "family": "claude",
35
+ "modalities": {"input": ["text", "image"], "output": ["text"]},
36
+ "limit": {"context": 200000, "output": 16384},
37
+ "cost": {"input": 3.0, "output": 15.0},
38
+ "tool_call": true,
39
+ "reasoning": true,
40
+ "open_weights": false
41
+ }
42
+ }
43
+ },
44
+ "openai": {
45
+ "id": "openai",
46
+ "name": "OpenAI",
47
+ "models": {
48
+ "gpt-4o": {
49
+ "id": "gpt-4o",
50
+ "name": "GPT-4o",
51
+ "provider": "openai",
52
+ "family": "gpt",
53
+ "modalities": {"input": ["text", "image"], "output": ["text"]},
54
+ "limit": {"context": 128000, "output": 4096},
55
+ "cost": {"input": 2.5, "output": 10.0},
56
+ "tool_call": true,
57
+ "reasoning": false,
58
+ "open_weights": false
59
+ },
60
+ "dall-e-3": {
61
+ "id": "dall-e-3",
62
+ "name": "DALL-E 3",
63
+ "provider": "openai",
64
+ "family": "dall-e",
65
+ "modalities": {"input": ["text"], "output": ["image"]},
66
+ "limit": {"context": 0, "output": 0},
67
+ "tool_call": false,
68
+ "reasoning": false,
69
+ "open_weights": false
70
+ },
71
+ "o1": {
72
+ "id": "o1",
73
+ "name": "o1",
74
+ "provider": "openai",
75
+ "family": "o1",
76
+ "modalities": {"input": ["text"], "output": ["text"]},
77
+ "limit": {"context": 200000, "output": 100000},
78
+ "cost": {"input": 15.0, "output": 60.0},
79
+ "tool_call": false,
80
+ "reasoning": true,
81
+ "open_weights": false
82
+ }
83
+ }
84
+ },
85
+ "meta": {
86
+ "id": "meta",
87
+ "name": "Meta",
88
+ "models": {
89
+ "llama-3-70b": {
90
+ "id": "llama-3-70b",
91
+ "name": "Llama 3 70B",
92
+ "provider": "meta",
93
+ "family": "llama",
94
+ "modalities": {"input": ["text"], "output": ["text"]},
95
+ "limit": {"context": 128000, "output": 4096},
96
+ "tool_call": true,
97
+ "reasoning": false,
98
+ "open_weights": true
99
+ },
100
+ "llama-3-8b": {
101
+ "id": "llama-3-8b",
102
+ "name": "Llama 3 8B",
103
+ "provider": "meta",
104
+ "family": "llama",
105
+ "modalities": {"input": ["text"], "output": ["text"]},
106
+ "limit": {"context": 128000, "output": 4096},
107
+ "tool_call": false,
108
+ "reasoning": false,
109
+ "open_weights": true,
110
+ "quantization": "fp16",
111
+ "future_field": 42
112
+ }
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,187 @@
1
+ [
2
+ {
3
+ "input": "",
4
+ "expected": {},
5
+ "description": "empty input → empty filter"
6
+ },
7
+ {
8
+ "input": "provider:anthropic",
9
+ "expected": {"Provider": "anthropic"},
10
+ "description": "single tag — provider"
11
+ },
12
+ {
13
+ "input": "family:llama",
14
+ "expected": {"Family": "llama"},
15
+ "description": "single tag — family"
16
+ },
17
+ {
18
+ "input": "in:text",
19
+ "expected": {"Input": "text"},
20
+ "description": "single tag — input modality"
21
+ },
22
+ {
23
+ "input": "out:image",
24
+ "expected": {"Output": "image"},
25
+ "description": "single tag — output modality"
26
+ },
27
+ {
28
+ "input": "provider:openai reasoning:true",
29
+ "expected": {"Provider": "openai", "Reasoning": true},
30
+ "description": "multi-tag — provider + bool"
31
+ },
32
+ {
33
+ "input": "provider:anthropic family:claude toolcall:true",
34
+ "expected": {"Provider": "anthropic", "Family": "claude", "ToolCall": true},
35
+ "description": "multi-tag — three fields"
36
+ },
37
+ {
38
+ "input": "reasoning:true",
39
+ "expected": {"Reasoning": true},
40
+ "description": "bool tag — true"
41
+ },
42
+ {
43
+ "input": "reasoning:false",
44
+ "expected": {"Reasoning": false},
45
+ "description": "bool tag — false"
46
+ },
47
+ {
48
+ "input": "openweights:true",
49
+ "expected": {"OpenWeights": true},
50
+ "description": "bool tag — openweights true"
51
+ },
52
+ {
53
+ "input": "toolcall:false",
54
+ "expected": {"ToolCall": false},
55
+ "description": "bool tag — toolcall false"
56
+ },
57
+ {
58
+ "input": "reasoning:yes",
59
+ "error": "invalid bool value \"yes\" for tag \"reasoning\": must be true or false",
60
+ "description": "bool tag — reject yes"
61
+ },
62
+ {
63
+ "input": "toolcall:1",
64
+ "error": "invalid bool value \"1\" for tag \"toolcall\": must be true or false",
65
+ "description": "bool tag — reject numeric 1"
66
+ },
67
+ {
68
+ "input": "openweights:maybe",
69
+ "error": "invalid bool value \"maybe\" for tag \"openweights\": must be true or false",
70
+ "description": "bool tag — reject maybe"
71
+ },
72
+ {
73
+ "input": "reasoning:TRUE",
74
+ "error": "invalid bool value \"TRUE\" for tag \"reasoning\": must be true or false",
75
+ "description": "bool tag — reject uppercase TRUE"
76
+ },
77
+ {
78
+ "input": "in:image,video",
79
+ "expected": {"Input": "image,video"},
80
+ "description": "multi-value modality — comma-separated"
81
+ },
82
+ {
83
+ "input": "out:text,code,json",
84
+ "expected": {"Output": "text,code,json"},
85
+ "description": "multi-value modality — three values"
86
+ },
87
+ {
88
+ "input": "in:image,video out:text",
89
+ "expected": {"Input": "image,video", "Output": "text"},
90
+ "description": "multi-value modality combined with single-value"
91
+ },
92
+ {
93
+ "input": "provider:openai provider:anthropic",
94
+ "expected": {"Provider": "openai,anthropic"},
95
+ "description": "repeated key — append with comma"
96
+ },
97
+ {
98
+ "input": "claude",
99
+ "expected": {"Query": "claude"},
100
+ "description": "free-text — single word"
101
+ },
102
+ {
103
+ "input": "gpt 4o",
104
+ "expected": {"Query": "gpt 4o"},
105
+ "description": "free-text — multi-word"
106
+ },
107
+ {
108
+ "input": "provider:openai gpt",
109
+ "expected": {"Provider": "openai", "Query": "gpt"},
110
+ "description": "mixed — tag + free-text"
111
+ },
112
+ {
113
+ "input": "fast reasoning:true provider:anthropic",
114
+ "expected": {"Reasoning": true, "Provider": "anthropic", "Query": "fast"},
115
+ "description": "mixed — free-text surrounded by tags"
116
+ },
117
+ {
118
+ "input": "\"provider:anthropic\"",
119
+ "expected": {"Query": "provider:anthropic"},
120
+ "description": "quoted string — colon treated as literal"
121
+ },
122
+ {
123
+ "input": "\"hello world\"",
124
+ "expected": {"Query": "hello world"},
125
+ "description": "quoted string — multi-word literal"
126
+ },
127
+ {
128
+ "input": "provider:openai \"big model\" reasoning:true",
129
+ "expected": {"Provider": "openai", "Reasoning": true, "Query": "big model"},
130
+ "description": "quoted string mixed with tags"
131
+ },
132
+ {
133
+ "input": "foo:bar",
134
+ "error": "unknown tag \"foo\"",
135
+ "description": "unknown tag — parse error"
136
+ },
137
+ {
138
+ "input": "provider:openai size:large",
139
+ "error": "unknown tag \"size\"",
140
+ "description": "unknown tag — mixed with valid tag"
141
+ },
142
+ {
143
+ "input": " provider:anthropic ",
144
+ "expected": {"Provider": "anthropic"},
145
+ "description": "whitespace — leading/trailing trimmed"
146
+ },
147
+ {
148
+ "input": "provider:anthropic reasoning:true",
149
+ "expected": {"Provider": "anthropic", "Reasoning": true},
150
+ "description": "whitespace — multiple spaces between tokens"
151
+ },
152
+ {
153
+ "input": "provider:",
154
+ "error": "empty value for tag \"provider\"",
155
+ "description": "malformed — tag with empty value"
156
+ },
157
+ {
158
+ "input": ":anthropic",
159
+ "error": "malformed tag \":anthropic\": missing key",
160
+ "description": "malformed — missing key"
161
+ },
162
+ {
163
+ "input": "in:text out:code reasoning:true openweights:false provider:meta family:llama",
164
+ "expected": {
165
+ "Input": "text",
166
+ "Output": "code",
167
+ "Reasoning": true,
168
+ "OpenWeights": false,
169
+ "Provider": "meta",
170
+ "Family": "llama"
171
+ },
172
+ "description": "kitchen sink — all fields set"
173
+ },
174
+ {
175
+ "input": "in:text out:code reasoning:true openweights:false provider:meta family:llama coder",
176
+ "expected": {
177
+ "Input": "text",
178
+ "Output": "code",
179
+ "Reasoning": true,
180
+ "OpenWeights": false,
181
+ "Provider": "meta",
182
+ "Family": "llama",
183
+ "Query": "coder"
184
+ },
185
+ "description": "kitchen sink — all fields + free-text"
186
+ }
187
+ ]
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "declaration": true,
6
+ "outDir": "./dist",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "resolveJsonModule": true
10
+ },
11
+ "include": ["src"]
12
+ }