echopai 2.3.0 → 2.5.0

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 (54) hide show
  1. package/README.md +63 -348
  2. package/dist/bin.js +8388 -190
  3. package/package.json +11 -13
  4. package/dist/_generated/commands.js +0 -378
  5. package/dist/_generated/help.js +0 -295
  6. package/dist/_generated/operations.js +0 -2385
  7. package/dist/runtime/auth.js +0 -95
  8. package/dist/runtime/envelope.js +0 -52
  9. package/dist/runtime/errors.js +0 -186
  10. package/dist/runtime/filters.js +0 -153
  11. package/dist/runtime/format.js +0 -143
  12. package/dist/runtime/http.js +0 -65
  13. package/dist/runtime/idempotency.js +0 -18
  14. package/dist/runtime/invoker.js +0 -391
  15. package/dist/runtime/io.js +0 -16
  16. package/dist/runtime/paginator.js +0 -146
  17. package/dist/runtime/trace.js +0 -99
  18. package/dist/runtime/tty.js +0 -51
  19. package/dist/runtime/update_check.js +0 -120
  20. package/dist/runtime/update_worker.js +0 -63
  21. package/dist/runtime/verb_cmd.js +0 -72
  22. package/dist/runtime/verb_runner.js +0 -152
  23. package/dist/runtime/whoami_cache.js +0 -109
  24. package/dist/tools/api.js +0 -81
  25. package/dist/tools/completion.js +0 -116
  26. package/dist/tools/config.js +0 -123
  27. package/dist/tools/doctor.js +0 -183
  28. package/dist/tools/login.js +0 -99
  29. package/dist/tools/mcp.js +0 -141
  30. package/dist/tools/raw.js +0 -96
  31. package/dist/tools/schema.js +0 -58
  32. package/dist/tools/trace.js +0 -54
  33. package/dist/tools/upgrade.js +0 -103
  34. package/dist/tools/welcome.js +0 -225
  35. package/dist/tools/whoami.js +0 -132
  36. package/dist/verbs/_spec.js +0 -15
  37. package/dist/verbs/announcements.js +0 -195
  38. package/dist/verbs/bars_batch.js +0 -66
  39. package/dist/verbs/chart.js +0 -110
  40. package/dist/verbs/concepts.js +0 -393
  41. package/dist/verbs/digest.js +0 -351
  42. package/dist/verbs/financials.js +0 -212
  43. package/dist/verbs/hot.js +0 -29
  44. package/dist/verbs/index.js +0 -88
  45. package/dist/verbs/limit_up.js +0 -156
  46. package/dist/verbs/lookup.js +0 -72
  47. package/dist/verbs/market.js +0 -185
  48. package/dist/verbs/news.js +0 -81
  49. package/dist/verbs/quote.js +0 -53
  50. package/dist/verbs/scan.js +0 -42
  51. package/dist/verbs/search.js +0 -105
  52. package/dist/verbs/sentiment.js +0 -231
  53. package/dist/verbs/views.js +0 -85
  54. package/dist/version.js +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echopai",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "Command-line interface for the EchoPai Open Platform: stock-market data, news, analyst views, sentiment, signals, backtests.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://echopai.com",
@@ -25,18 +25,18 @@
25
25
  "echopai": "dist/bin.js"
26
26
  },
27
27
  "files": [
28
- "dist",
28
+ "dist/bin.js",
29
29
  "README.md"
30
30
  ],
31
31
  "scripts": {
32
32
  "codegen": "cd .. && (test -x scripts/codegen/.venv/bin/python || (python3 -m venv scripts/codegen/.venv && scripts/codegen/.venv/bin/pip install -q -r scripts/codegen/requirements.txt)) && scripts/codegen/.venv/bin/python scripts/codegen/generate_cli_v2.py --in docs/api-contract/openapi.yaml --out cli/src/_generated",
33
- "prebuild": "npm run codegen",
34
- "build": "tsc",
35
- "pretest": "npm run codegen",
36
- "test": "vitest run",
37
- "test:watch": "vitest",
38
- "dev": "npm run codegen && tsx src/bin.ts",
39
- "prepublishOnly": "npm run build"
33
+ "typecheck": "tsc --noEmit",
34
+ "build": "bun run codegen && bun build src/bin.ts --target=node --packages=external --outfile=dist/bin.js",
35
+ "compile": "bun run codegen && bun run scripts/compile.ts",
36
+ "test": "bun run codegen && bun test",
37
+ "test:watch": "bun test --watch",
38
+ "dev": "bun run codegen && bun run src/bin.ts",
39
+ "prepublishOnly": "bun run build"
40
40
  },
41
41
  "dependencies": {
42
42
  "@modelcontextprotocol/sdk": "^1.29.0",
@@ -45,14 +45,12 @@
45
45
  "commander": "^12.1.0",
46
46
  "jmespath": "^0.16.0",
47
47
  "smol-toml": "^1.4.2",
48
- "undici": "^7.16.0",
49
48
  "zod": "^4.4.3"
50
49
  },
51
50
  "devDependencies": {
51
+ "@types/bun": "^1.1.14",
52
52
  "@types/jmespath": "^0.15.2",
53
53
  "@types/node": "^20.0.0",
54
- "tsx": "^4.20.6",
55
- "typescript": "^5.6.3",
56
- "vitest": "^2.1.9"
54
+ "typescript": "^5.6.3"
57
55
  }
58
56
  }
@@ -1,378 +0,0 @@
1
- /**
2
- * AUTO-GENERATED — DO NOT EDIT BY HAND.
3
- *
4
- * Source: docs/api-contract/openapi.yaml
5
- * Generator: scripts/codegen/generate_cli_v2.py
6
- */
7
- import { Option } from "commander";
8
- import { OPERATIONS } from "./operations.js";
9
- /**
10
- * commander v12 把 --since-hours 自动 camelCase 成 sinceHours,但 OpenAPI 这
11
- * 边期待 snake_case (since_hours)。一次性 camelCase → snake_case 反转。
12
- */
13
- function camelToSnake(s) {
14
- return s.replace(/[A-Z]/g, (m) => "_" + m.toLowerCase());
15
- }
16
- function attachOperation(cmd, op, dispatch) {
17
- cmd.description(op.summary || op.description);
18
- // positional args
19
- for (const pname of op.positional) {
20
- const required = (op.inputSchema.required || []).includes(pname);
21
- cmd.argument(required ? `<${pname}>` : `[${pname}]`, String(op.inputSchema.properties[pname]?.description ?? ""));
22
- }
23
- // remaining params → --flag (dashes for ergonomics; reverse camelCase later)
24
- for (const [pname, pschema] of Object.entries(op.inputSchema.properties)) {
25
- if (op.positional.includes(pname))
26
- continue;
27
- const required = (op.inputSchema.required || []).includes(pname);
28
- const flagName = `--${pname.replace(/_/g, "-")} <value>`;
29
- const desc = String(pschema?.description ?? "");
30
- const opt = new Option(flagName, desc);
31
- if (required)
32
- opt.makeOptionMandatory(true);
33
- cmd.addOption(opt);
34
- }
35
- cmd.addOption(new Option("--output <format>", "Output format: json|ndjson|table|csv|tsv|yaml").choices(["json", "ndjson", "table", "csv", "tsv", "yaml"]).default(op.outputDefault));
36
- if (op.pagination !== 'none') {
37
- cmd.addOption(new Option("--all", "Fetch all pages and stream NDJSON"));
38
- cmd.addOption(new Option("--max-pages <n>", "Stop after N pages (default 1000)"));
39
- cmd.addOption(new Option("--max-items <n>", "Stop after N items (default 100000)"));
40
- }
41
- if (op.idempotencyRequired) {
42
- cmd.addOption(new Option("--idempotency-key <uuid>", "Override auto-generated Idempotency-Key (debug / replay)"));
43
- }
44
- // WS stream options removed (--reconnect / --max-frames). CLI no longer
45
- // exposes /v1/ws/{news,views} as commands; codegen now drops x-cli-key
46
- // for those ops so `op.stream` is always false here.
47
- cmd.action(async (...rawArgs) => {
48
- const opts = cmd.opts();
49
- // reverse commander's camelCase: sinceHours → since_hours
50
- const args = {};
51
- for (const [k, v] of Object.entries(opts)) {
52
- args[camelToSnake(k)] = v;
53
- }
54
- op.positional.forEach((pname, i) => {
55
- if (rawArgs[i] !== undefined)
56
- args[pname] = rawArgs[i];
57
- });
58
- await dispatch(op, args);
59
- });
60
- }
61
- export function buildCommandTree(program, dispatch) {
62
- {
63
- const noun = program.command("agent");
64
- noun.description("agent commands");
65
- {
66
- const cmd = noun.command("session-end");
67
- attachOperation(cmd, OPERATIONS["agent.session-end"], dispatch);
68
- }
69
- {
70
- const cmd = noun.command("session-start");
71
- attachOperation(cmd, OPERATIONS["agent.session-start"], dispatch);
72
- }
73
- {
74
- const cmd = noun.command("session-usage");
75
- attachOperation(cmd, OPERATIONS["agent.session-usage"], dispatch);
76
- }
77
- }
78
- {
79
- const noun = program.command("announcements");
80
- noun.description("announcements commands");
81
- {
82
- const cmd = noun.command("detail");
83
- attachOperation(cmd, OPERATIONS["announcements.detail"], dispatch);
84
- }
85
- {
86
- const cmd = noun.command("feed");
87
- attachOperation(cmd, OPERATIONS["announcements.feed"], dispatch);
88
- }
89
- {
90
- const cmd = noun.command("stock");
91
- attachOperation(cmd, OPERATIONS["announcements.stock"], dispatch);
92
- }
93
- }
94
- {
95
- const noun = program.command("auth");
96
- noun.description("auth commands");
97
- {
98
- const cmd = noun.command("whoami");
99
- attachOperation(cmd, OPERATIONS["auth.whoami"], dispatch);
100
- }
101
- }
102
- {
103
- const noun = program.command("bars");
104
- noun.description("bars commands");
105
- {
106
- const cmd = noun.command("daily");
107
- attachOperation(cmd, OPERATIONS["bars.daily"], dispatch);
108
- }
109
- {
110
- const cmd = noun.command("daily-batch");
111
- attachOperation(cmd, OPERATIONS["bars.daily-batch"], dispatch);
112
- }
113
- {
114
- const cmd = noun.command("minute");
115
- attachOperation(cmd, OPERATIONS["bars.minute"], dispatch);
116
- }
117
- {
118
- const cmd = noun.command("minute-batch");
119
- attachOperation(cmd, OPERATIONS["bars.minute-batch"], dispatch);
120
- }
121
- }
122
- {
123
- const noun = program.command("concepts");
124
- noun.description("concepts commands");
125
- {
126
- const cmd = noun.command("alerts");
127
- attachOperation(cmd, OPERATIONS["concepts.alerts"], dispatch);
128
- }
129
- {
130
- const cmd = noun.command("alerts-history");
131
- attachOperation(cmd, OPERATIONS["concepts.alerts-history"], dispatch);
132
- }
133
- {
134
- const cmd = noun.command("daily-bars");
135
- attachOperation(cmd, OPERATIONS["concepts.daily-bars"], dispatch);
136
- }
137
- {
138
- const cmd = noun.command("list");
139
- attachOperation(cmd, OPERATIONS["concepts.list"], dispatch);
140
- }
141
- {
142
- const cmd = noun.command("minute-bars");
143
- attachOperation(cmd, OPERATIONS["concepts.minute-bars"], dispatch);
144
- }
145
- {
146
- const cmd = noun.command("news");
147
- attachOperation(cmd, OPERATIONS["concepts.news"], dispatch);
148
- }
149
- {
150
- const cmd = noun.command("show");
151
- attachOperation(cmd, OPERATIONS["concepts.show"], dispatch);
152
- }
153
- {
154
- const cmd = noun.command("snapshot");
155
- attachOperation(cmd, OPERATIONS["concepts.snapshot"], dispatch);
156
- }
157
- {
158
- const cmd = noun.command("views");
159
- attachOperation(cmd, OPERATIONS["concepts.views"], dispatch);
160
- }
161
- }
162
- {
163
- const noun = program.command("digest");
164
- noun.description("digest commands");
165
- {
166
- const cmd = noun.command("get");
167
- attachOperation(cmd, OPERATIONS["digest.get"], dispatch);
168
- }
169
- }
170
- {
171
- const noun = program.command("financials");
172
- noun.description("financials commands");
173
- {
174
- const cmd = noun.command("pit");
175
- attachOperation(cmd, OPERATIONS["financials.pit"], dispatch);
176
- }
177
- {
178
- const cmd = noun.command("quote-snapshot");
179
- attachOperation(cmd, OPERATIONS["financials.quote-snapshot"], dispatch);
180
- }
181
- {
182
- const cmd = noun.command("reports");
183
- attachOperation(cmd, OPERATIONS["financials.reports"], dispatch);
184
- }
185
- {
186
- const cmd = noun.command("series");
187
- attachOperation(cmd, OPERATIONS["financials.series"], dispatch);
188
- }
189
- }
190
- {
191
- const noun = program.command("index");
192
- noun.description("index commands");
193
- {
194
- const cmd = noun.command("daily-bars");
195
- attachOperation(cmd, OPERATIONS["index.daily-bars"], dispatch);
196
- }
197
- {
198
- const cmd = noun.command("minute-bars");
199
- attachOperation(cmd, OPERATIONS["index.minute-bars"], dispatch);
200
- }
201
- {
202
- const cmd = noun.command("snapshot");
203
- attachOperation(cmd, OPERATIONS["index.snapshot"], dispatch);
204
- }
205
- }
206
- {
207
- const noun = program.command("industries");
208
- noun.description("industries commands");
209
- {
210
- const cmd = noun.command("alerts");
211
- attachOperation(cmd, OPERATIONS["industries.alerts"], dispatch);
212
- }
213
- {
214
- const cmd = noun.command("daily-bars");
215
- attachOperation(cmd, OPERATIONS["industries.daily-bars"], dispatch);
216
- }
217
- {
218
- const cmd = noun.command("list");
219
- attachOperation(cmd, OPERATIONS["industries.list"], dispatch);
220
- }
221
- {
222
- const cmd = noun.command("show");
223
- attachOperation(cmd, OPERATIONS["industries.show"], dispatch);
224
- }
225
- {
226
- const cmd = noun.command("snapshot");
227
- attachOperation(cmd, OPERATIONS["industries.snapshot"], dispatch);
228
- }
229
- }
230
- {
231
- const noun = program.command("limit-up");
232
- noun.description("limit-up commands");
233
- {
234
- const cmd = noun.command("history");
235
- attachOperation(cmd, OPERATIONS["limit-up.history"], dispatch);
236
- }
237
- {
238
- const cmd = noun.command("pool");
239
- attachOperation(cmd, OPERATIONS["limit-up.pool"], dispatch);
240
- }
241
- {
242
- const cmd = noun.command("summary");
243
- attachOperation(cmd, OPERATIONS["limit-up.summary"], dispatch);
244
- }
245
- }
246
- {
247
- const noun = program.command("market");
248
- noun.description("market commands");
249
- {
250
- const cmd = noun.command("status");
251
- attachOperation(cmd, OPERATIONS["market.status"], dispatch);
252
- }
253
- }
254
- {
255
- const noun = program.command("news");
256
- noun.description("news commands");
257
- {
258
- const cmd = noun.command("feed");
259
- attachOperation(cmd, OPERATIONS["news.feed"], dispatch);
260
- }
261
- {
262
- const cmd = noun.command("get");
263
- attachOperation(cmd, OPERATIONS["news.get"], dispatch);
264
- }
265
- {
266
- const cmd = noun.command("list");
267
- attachOperation(cmd, OPERATIONS["news.list"], dispatch);
268
- }
269
- {
270
- const cmd = noun.command("search");
271
- attachOperation(cmd, OPERATIONS["news.search"], dispatch);
272
- }
273
- }
274
- {
275
- const noun = program.command("payment");
276
- noun.description("payment commands");
277
- {
278
- const cmd = noun.command("plans");
279
- attachOperation(cmd, OPERATIONS["payment.plans"], dispatch);
280
- }
281
- }
282
- {
283
- const noun = program.command("quote");
284
- noun.description("quote commands");
285
- {
286
- const cmd = noun.command("quote");
287
- attachOperation(cmd, OPERATIONS["quote"], dispatch);
288
- }
289
- {
290
- const cmd = noun.command("scan");
291
- attachOperation(cmd, OPERATIONS["quote.scan"], dispatch);
292
- }
293
- }
294
- {
295
- const noun = program.command("search");
296
- noun.description("search commands");
297
- {
298
- const cmd = noun.command("semantic");
299
- attachOperation(cmd, OPERATIONS["search.semantic"], dispatch);
300
- }
301
- }
302
- {
303
- const noun = program.command("securities");
304
- noun.description("securities commands");
305
- {
306
- const cmd = noun.command("industry");
307
- attachOperation(cmd, OPERATIONS["securities.industry"], dispatch);
308
- }
309
- }
310
- {
311
- const noun = program.command("semantic");
312
- noun.description("semantic commands");
313
- {
314
- const cmd = noun.command("find");
315
- attachOperation(cmd, OPERATIONS["semantic.find"], dispatch);
316
- }
317
- }
318
- {
319
- const noun = program.command("sentiment");
320
- noun.description("sentiment commands");
321
- {
322
- const cmd = noun.command("breadth");
323
- attachOperation(cmd, OPERATIONS["sentiment.breadth"], dispatch);
324
- }
325
- {
326
- const cmd = noun.command("overview");
327
- attachOperation(cmd, OPERATIONS["sentiment.overview"], dispatch);
328
- }
329
- {
330
- const cmd = noun.command("pct-distribution");
331
- attachOperation(cmd, OPERATIONS["sentiment.pct-distribution"], dispatch);
332
- }
333
- {
334
- const cmd = noun.command("turnover");
335
- attachOperation(cmd, OPERATIONS["sentiment.turnover"], dispatch);
336
- }
337
- }
338
- {
339
- const noun = program.command("squawk");
340
- noun.description("squawk commands");
341
- {
342
- const cmd = noun.command("audio");
343
- attachOperation(cmd, OPERATIONS["squawk.audio"], dispatch);
344
- }
345
- {
346
- const cmd = noun.command("waveform");
347
- attachOperation(cmd, OPERATIONS["squawk.waveform"], dispatch);
348
- }
349
- }
350
- {
351
- const noun = program.command("stocks");
352
- noun.description("stocks commands");
353
- {
354
- const cmd = noun.command("hot");
355
- attachOperation(cmd, OPERATIONS["stocks.hot"], dispatch);
356
- }
357
- {
358
- const cmd = noun.command("social-hot");
359
- attachOperation(cmd, OPERATIONS["stocks.social-hot"], dispatch);
360
- }
361
- }
362
- {
363
- const noun = program.command("views");
364
- noun.description("views commands");
365
- {
366
- const cmd = noun.command("feed");
367
- attachOperation(cmd, OPERATIONS["views.feed"], dispatch);
368
- }
369
- {
370
- const cmd = noun.command("get");
371
- attachOperation(cmd, OPERATIONS["views.get"], dispatch);
372
- }
373
- {
374
- const cmd = noun.command("recent");
375
- attachOperation(cmd, OPERATIONS["views.recent"], dispatch);
376
- }
377
- }
378
- }