@aisa-one/cli 0.3.0 → 0.5.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 (103) hide show
  1. package/CHANGELOG.md +165 -1
  2. package/LICENSE +21 -0
  3. package/README.md +164 -170
  4. package/dist/api.d.ts +10 -0
  5. package/dist/api.js +14 -3
  6. package/dist/catalog.d.ts +1 -18
  7. package/dist/catalog.js +1 -24
  8. package/dist/cli-error.d.ts +17 -0
  9. package/dist/cli-error.js +25 -0
  10. package/dist/cli-guidance.d.ts +14 -0
  11. package/dist/cli-guidance.js +55 -0
  12. package/dist/commands/account.d.ts +17 -0
  13. package/dist/commands/account.js +45 -1
  14. package/dist/commands/api.d.ts +0 -11
  15. package/dist/commands/api.js +6 -175
  16. package/dist/commands/auth.d.ts +2 -1
  17. package/dist/commands/auth.js +45 -11
  18. package/dist/commands/brand-logos.d.ts +6 -0
  19. package/dist/commands/brand-logos.js +21 -0
  20. package/dist/commands/configCmd.js +8 -3
  21. package/dist/commands/connect-shared.d.ts +136 -0
  22. package/dist/commands/connect-shared.js +143 -0
  23. package/dist/commands/connect-t2.d.ts +18 -0
  24. package/dist/commands/connect-t2.js +1599 -0
  25. package/dist/commands/connect-terminal.d.ts +65 -0
  26. package/dist/commands/connect-terminal.js +822 -0
  27. package/dist/commands/connect.d.ts +31 -0
  28. package/dist/commands/connect.js +3181 -0
  29. package/dist/commands/flow.d.ts +685 -0
  30. package/dist/commands/flow.js +697 -0
  31. package/dist/commands/install.d.ts +91 -0
  32. package/dist/commands/install.js +258 -0
  33. package/dist/commands/llm-config.d.ts +103 -0
  34. package/dist/commands/llm-config.js +452 -0
  35. package/dist/commands/manifest.d.ts +68 -0
  36. package/dist/commands/manifest.js +90 -0
  37. package/dist/commands/mcp.d.ts +59 -0
  38. package/dist/commands/mcp.js +122 -44
  39. package/dist/commands/oauth-login.d.ts +33 -0
  40. package/dist/commands/oauth-login.js +333 -0
  41. package/dist/commands/prompt.d.ts +96 -0
  42. package/dist/commands/prompt.js +397 -0
  43. package/dist/commands/serve-results.d.ts +61 -0
  44. package/dist/commands/serve-results.js +245 -0
  45. package/dist/commands/serve-signin.d.ts +28 -0
  46. package/dist/commands/serve-signin.js +90 -0
  47. package/dist/commands/signin-page.d.ts +49 -0
  48. package/dist/commands/signin-page.js +250 -0
  49. package/dist/commands/skills.js +87 -50
  50. package/dist/commands/tool-help.d.ts +69 -0
  51. package/dist/commands/tool-help.js +189 -0
  52. package/dist/commands/tool-input.d.ts +22 -0
  53. package/dist/commands/tool-input.js +220 -0
  54. package/dist/commands/tools.d.ts +12 -0
  55. package/dist/commands/tools.js +306 -0
  56. package/dist/commands/update.d.ts +11 -0
  57. package/dist/commands/update.js +92 -0
  58. package/dist/commands/vscode.d.ts +65 -0
  59. package/dist/commands/vscode.js +173 -0
  60. package/dist/commands/wrappers.d.ts +23 -0
  61. package/dist/commands/wrappers.js +102 -0
  62. package/dist/completion.js +3 -80
  63. package/dist/config.d.ts +3 -0
  64. package/dist/config.js +80 -3
  65. package/dist/constants.d.ts +51 -38
  66. package/dist/constants.js +53 -109
  67. package/dist/index.js +152 -355
  68. package/dist/json-text.d.ts +12 -0
  69. package/dist/json-text.js +60 -0
  70. package/dist/router.d.ts +39 -0
  71. package/dist/router.js +59 -0
  72. package/dist/skills-registry.js +12 -3
  73. package/dist/utils/banner.d.ts +9 -0
  74. package/dist/utils/banner.js +41 -0
  75. package/dist/utils/browser.d.ts +19 -0
  76. package/dist/utils/browser.js +31 -0
  77. package/dist/utils/exec.d.ts +43 -0
  78. package/dist/utils/exec.js +61 -0
  79. package/dist/utils/http.d.ts +53 -0
  80. package/dist/utils/http.js +124 -0
  81. package/dist/utils/install-method.d.ts +36 -0
  82. package/dist/utils/install-method.js +48 -0
  83. package/dist/utils/journal.d.ts +57 -0
  84. package/dist/utils/journal.js +188 -0
  85. package/dist/utils/key-check.d.ts +20 -0
  86. package/dist/utils/key-check.js +24 -0
  87. package/dist/utils/update-check.d.ts +23 -0
  88. package/dist/utils/update-check.js +116 -0
  89. package/dist/utils/width.d.ts +32 -0
  90. package/dist/utils/width.js +73 -0
  91. package/package.json +8 -4
  92. package/vscode-extension/README.md +6 -0
  93. package/vscode-extension/aisa-vscode.vsix +0 -0
  94. package/dist/commands/finance.d.ts +0 -17
  95. package/dist/commands/finance.js +0 -342
  96. package/dist/commands/run.d.ts +0 -28
  97. package/dist/commands/run.js +0 -182
  98. package/dist/commands/search.d.ts +0 -9
  99. package/dist/commands/search.js +0 -81
  100. package/dist/commands/twitter.d.ts +0 -138
  101. package/dist/commands/twitter.js +0 -374
  102. package/dist/commands/video.d.ts +0 -49
  103. package/dist/commands/video.js +0 -311
package/CHANGELOG.md CHANGED
@@ -7,6 +7,166 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.1] — 2026-09-10
11
+
12
+ Compatible patch on published `0.5.0`. Browser-login-first onboarding
13
+ guidance and an opt-in Quickstart Skill evaluation. No new commands, auth
14
+ mechanisms, or credential-precedence changes.
15
+
16
+ ### Changed
17
+
18
+ - README, missing-key errors, `whoami`, and Router help recommend `aisa login`
19
+ (browser; stores a CLI key) before pasting a key. `AISA_API_KEY` and
20
+ `aisa login --key` remain for CI. Resolution order is unchanged:
21
+ `AISA_API_KEY`, then `~/.aisa/key`, then legacy login.
22
+ - Quick Start covers login, discovery, catalog browse, and quote. It does not
23
+ copy `aisa chat` or `aisa call`. Quote is a price observation; approval and
24
+ whether to execute remain caller-owned guidance, not an enforced CLI gate.
25
+
26
+ ### Added
27
+
28
+ - Default-off `eval/agent-quickstart/` Skill ablation. Reuses the existing
29
+ Router stub and pack path. Excluded from the npm package; does not run in
30
+ default CI or against production AIsa credentials.
31
+
32
+ ## [0.5.0] — 2026-09-09
33
+
34
+ PR21 command-surface cleanup. Published to npm as `0.5.0`. Distinct from the
35
+ unpublished `0.4.0` main baseline (`0.4.0` was never tagged or published).
36
+
37
+ ### Breaking
38
+
39
+ - **Domain shortcuts and raw execution are removed.** These names are
40
+ unknown commands — not aliases and not auto-forwarded to `aisa call`:
41
+ `web-search`, `scholar`, `stock`, `crypto`, `screener`, `tweet`, `twitter`
42
+ (all children), `video` (all children), `run`, top-level `code`,
43
+ `api search`, and `api code`. Root help is 22 entries including implicit
44
+ `help` (21 explicit commands).
45
+ - **`aisa api list` and `aisa api show` stay** as the supported read-only
46
+ provider/endpoint catalog. They are not deprecated and are not a
47
+ substitute for `schema` / `quote`. Catalog paths and prices are browsing
48
+ metadata. `api show` is not equivalent to `aisa schema`. The `0.4.0`
49
+ deprecation of `api show` is withdrawn because the command is retained.
50
+
51
+ ### Changed
52
+
53
+ - Bundled `aisa skills init` templates may keep domain labels (`search`,
54
+ `finance`, `twitter`, `video`). Runnable steps use `search` / `schema` /
55
+ `quote` / `call` and optional `api list` / `api show`. They do not invent
56
+ tool names or treat Router as covering every removed domain function. The
57
+ `llm` template stays on `chat` / `models`.
58
+ - Root and Router help/manifest no longer document removed names. Router
59
+ `mcp` / `auth` / `exits` / `examples` still attach only to top-level
60
+ `search` / `schema` / `quote` / `call`, not nested `skills search`.
61
+
62
+ ## [0.4.0] — unpublished main baseline
63
+
64
+ Unpublished `main` candidate as of 2026-09-08. Not tagged and not on npm
65
+ (skipped between `0.3.0` and published `0.5.0`). Kept so the Router work and the
66
+ `api search` / `api show` / `run` deprecation history stay identifiable.
67
+
68
+ ### Breaking
69
+
70
+ - **`aisa search` is no longer an alias for `api search`.** It now calls the
71
+ Tool Router (`POST /v1/tool-router/aisa-search-tool`) and prints Router
72
+ results. The old catalog keyword search remains as `aisa api search`.
73
+
74
+ ### Added
75
+
76
+ - **`aisa search` / `schema` / `quote` / `call`** — Unix-oriented entries for
77
+ the same four Router operations as MCP. Accept `--input '<json>'` and
78
+ `-f/--file` (including `-f -` for stdin). `--json` writes the unmodified
79
+ application response, including integer tokens outside JavaScript's safe
80
+ range. Quote never executes; none of the four retry or fall back to
81
+ provider shortcuts. Router origin is `AISA_ROUTER_BASE_URL`, else config
82
+ `routerUrl`, else `https://tools.aisa.one`. The LLM/catalog host
83
+ `https://api.aisa.one` is unchanged and is not a Router fallback.
84
+
85
+ ### Fixed
86
+
87
+ - Router `search` / `schema` / `quote` / `call` do not follow HTTP redirects.
88
+ A 307/308 is a transport failure, so a quote response cannot become a use.
89
+ - Human quote/call print each result's own micro-USD token, including values
90
+ above 2^53. `--json` was already lossless.
91
+ - Full `--input` / `-f` envelopes reject unknown fields, duplicate `call_id`,
92
+ and non-unique or oversized `provider_filters` before dispatch.
93
+ - Human search prints a returned `plan` (`plan_ref`, steps, pitfalls) when
94
+ the Router includes one.
95
+ - Default Tool Router origin is `https://tools.aisa.one`. Anonymous
96
+ `/v1/tool-router/...` on `api.aisa.one` returns 404; the deployed nginx
97
+ front door is `tools.aisa.one`. Overrides (`AISA_ROUTER_BASE_URL`,
98
+ `routerUrl`) keep precedence. There is no origin fallback.
99
+
100
+ ### Changed
101
+
102
+ - Human Router guidance and displayed plan steps/pitfalls project the four
103
+ exact MCP identifiers onto `aisa search` / `schema` / `quote` / `call`.
104
+ Surrounding policy text is unchanged. `--json` still prints the unmodified
105
+ application body, including MCP identifiers.
106
+ - Root and Router command help include complete `--input` JSON examples
107
+ (`-f` / `-f -` too), configured-key resolution shared with `run`
108
+ (`AISA_API_KEY`, then `~/.aisa/key`, then legacy login), billable/approval
109
+ limits, and exits `0`/`2`/`1`/`3`. Manifest nodes for the four commands
110
+ include `mcp`, `auth`, `safety`, `exits`, and parseable `examples`; the
111
+ root node includes `router`. Shell `--input` examples use POSIX single
112
+ quotes. Help separates enforced key/input checks from caller instructions;
113
+ the CLI does not reject an unquoted call. Router `mcp` / `auth` / `exits` /
114
+ `examples` attach only to top-level `search` / `schema` / `quote` / `call`,
115
+ not nested `api search` / `twitter search` / `skills search`.
116
+
117
+ ### Deprecated
118
+
119
+ - **`aisa api search`, `aisa api show`, and `aisa run`** keep their previous
120
+ behavior, stdout, and exit semantics. Help, one stderr warning, and
121
+ manifest `deprecated` / `replacement` / `migration` fields mark them as
122
+ not drop-in replacements. `api list`, `api code`, and specialized commands
123
+ are unchanged. Removal will be a separately announced breaking release.
124
+
125
+ ### Added
126
+
127
+ - **`aisa connect`** — a one-shot local page (`npx @aisa-one/cli connect`) to
128
+ wire AIsa MCP servers into local coding agents. Detects Claude Code, Cursor,
129
+ Claude Desktop and Windsurf; Claude Code entries go through `claude mcp add`
130
+ (user scope), the rest through the same config writer as `mcp setup`. The
131
+ process serves one token-guarded page on 127.0.0.1, applies the selection,
132
+ drives the sign-in, and exits — no daemon left behind. With no key stored,
133
+ the run starts with one browser approval (the same flow as `aisa login`)
134
+ that mints the durable CLI key; every MCP entry and the model provider are
135
+ then written with it — no per-server authorization popups. Only if that
136
+ sign-in fails does connect fall back to each client's own OAuth machinery
137
+ (`claude mcp login` per server; `codex mcp add` runs its own flow). A
138
+ configured key skips the sign-in entirely.
139
+ The page follows the AIsa Console design (warm dot-grid, Inter, the
140
+ Console red), groups servers by category with their manifest descriptions,
141
+ shows per-server authorization progress live, and finishes by opening a
142
+ success page with copy-paste example prompts that name each `aisa-*`
143
+ server explicitly so the request routes to AIsa.
144
+ - **`aisa topup [amount]`** — opens the console billing page to add credit,
145
+ deep-linking `?amount=` when one is given and rejecting anything that is not
146
+ a positive number of dollars. Payment finishes in the browser by necessity
147
+ (Stripe's hosted page owns the card details; 3-D Secure needs a browser).
148
+ `aisa balance` now points at it when the account is out of credit.
149
+ - **`aisa login` signs in over OAuth and keeps a real key.** With no
150
+ arguments it opens the browser for one approval, then trades the access
151
+ token for the long-lived CLI key at `POST /v1/keys/mint` and stores only
152
+ the key. `--no-browser` prints the URL and reads the redirect back for
153
+ headless machines; `--key <key>` still stores one directly.
154
+ - **Codex MCP entries carry the key itself, not an env-var name.**
155
+ `codex mcp add --bearer-token-env-var` records only a variable name that
156
+ nothing guarantees a shell exports, so keyed entries could 401 at runtime.
157
+ After the add (which the flag keeps free of OAuth popups), the entry is
158
+ patched to a literal `http_headers` Authorization — the same thing the
159
+ Claude Code path stores via `--header`.
160
+ - The npm tarball includes the MIT `LICENSE` text (Copyright (c) 2026
161
+ AIsa Team). License policy is unchanged.
162
+ - CI on every push/PR builds, tests, and pack-smokes on Ubuntu Node
163
+ 18/20 (legacy compatibility), 22/24 (maintained), and 26 (current).
164
+ `engines` stay `>=18`.
165
+ The tag-triggered publish job uses Node 24. Trusted Publisher on npmjs.com
166
+ is a publish-time prerequisite — this repo has no historical `release.yml`
167
+ success. `prepack` builds the tarball so a clean `npm pack` includes
168
+ `dist` and `LICENSE`. `git push origin vX.Y.Z` is the publish button.
169
+
10
170
  ## [0.3.0] — 2026-08-18
11
171
 
12
172
  ### Fixed
@@ -246,7 +406,11 @@ supports today; nothing here depends on a backend change.
246
406
  - Config commands (`aisa config get|set|list|reset`) and auth
247
407
  (`aisa login|logout|whoami`).
248
408
 
249
- [Unreleased]: https://github.com/AIsa-team/cli/compare/v0.2.4...HEAD
409
+ [Unreleased]: https://github.com/AIsa-team/cli/compare/v0.5.1...HEAD
410
+ [0.5.1]: https://github.com/AIsa-team/cli/compare/v0.5.0...v0.5.1
411
+ [0.5.0]: https://github.com/AIsa-team/cli/compare/v0.3.0...v0.5.0
412
+ [0.4.0]: https://github.com/AIsa-team/cli/compare/v0.3.0...b5c0b04b2a7a2cb9efcb568be5ee5440d7f7d94d
413
+ [0.3.0]: https://github.com/AIsa-team/cli/compare/v0.2.4...v0.3.0
250
414
  [0.2.4]: https://github.com/AIsa-team/cli/compare/v0.2.3...v0.2.4
251
415
  [0.2.3]: https://github.com/AIsa-team/cli/compare/v0.2.2...v0.2.3
252
416
  [0.2.2]: https://github.com/AIsa-team/cli/compare/v0.2.1...v0.2.2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AIsa Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # @aisa-one/cli
2
2
 
3
- Command-line access to [AIsa](https://aisa.one): **one API key for 80+ LLMs and
4
- 950+ endpoints** across 29 API providers — finance, web search, social,
5
- research, and video generation.
3
+ Command-line access to [AIsa](https://aisa.one): **one API key** for
4
+ **Claude, GPT, Gemini, DeepSeek, Kimi, GLM** and published Tool Router
5
+ operations. Browse the public provider/endpoint catalog separately;
6
+ catalog metadata is not a substitute for `schema` or `quote`.
6
7
 
7
8
  ## Install
8
9
 
@@ -13,84 +14,137 @@ npm install -g @aisa-one/cli
13
14
  ## Quick Start
14
15
 
15
16
  ```bash
16
- # Authenticate (or set AISA_API_KEY)
17
- aisa login --key sk-your-api-key
17
+ # Sign in (browser; stores a CLI key — no key to copy)
18
+ aisa login
18
19
 
19
- # See what's available — no API key needed for this part
20
- aisa api list
21
- aisa api search "insider trades"
22
-
23
- # Chat with any model
24
- aisa chat "Explain quantum computing" --model claude-opus-4-6
20
+ # Discover published tools (Router; search/schema may be anonymous)
21
+ aisa search "company facts" --json
22
+ aisa schema get_financial_company_facts --json
25
23
 
26
- # Look up a stock
27
- aisa stock AAPL
24
+ # Browse the read-only provider/endpoint catalog
25
+ aisa api list
26
+ aisa api show financial
28
27
 
29
- # Search the web
30
- aisa web-search "latest AI research"
28
+ # Quote a published Router tool (does not execute)
29
+ aisa quote --input '{"calls":[{"call_id":"c1","tool":"get_financial_company_facts","arguments":{"ticker":"AAPL"}}]}' --json
30
+ ```
31
31
 
32
- # Call any endpoint in the catalog directly
33
- aisa run financial /insider-trades -q "ticker=AAPL"
32
+ `aisa login` opens a browser, signs you in, and stores a CLI key. You do not
33
+ need to create or paste a key from the console. For CI or scripts, set
34
+ `AISA_API_KEY` or run `aisa login --key <key>`. New accounts receive $5 in
35
+ free credits.
36
+
37
+ This first block does not run `aisa chat` or `aisa call`. Quote is a price
38
+ observation, not authorization to execute. See
39
+ [Published tools](#published-tools-tool-router) for the quote/approval
40
+ contract before a billable call.
41
+
42
+ Root help lists 21 explicit commands plus implicit `help`. Removed domain
43
+ shortcuts and raw execution names are unknown commands — not aliases and
44
+ not forwarded to `aisa call`.
45
+
46
+ ## Published tools (Tool Router)
47
+
48
+ These four commands are a thin HTTP client for the same Router service MCP
49
+ uses. They do not search the local catalog cache and do not call providers
50
+ directly.
51
+
52
+ | CLI | MCP identifier | POST path |
53
+ |---|---|---|
54
+ | `aisa search` | `AISA_SEARCH_TOOL` | `/v1/tool-router/aisa-search-tool` |
55
+ | `aisa schema` | `AISA_BATCH_GET_SCHEMA` | `/v1/tool-router/aisa-batch-get-schema` |
56
+ | `aisa quote` | `AISA_BATCH_QUOTE` | `/v1/tool-router/aisa-batch-quote` |
57
+ | `aisa call` | `AISA_BATCH_USE` | `/v1/tool-router/aisa-batch-use` |
58
+
59
+ `--json` prints the unmodified application body (MCP identifiers stay).
60
+ Human output maps only those four identifiers onto CLI names. `aisa manifest`
61
+ and `aisa manifest search` / `schema` / `quote` / `call` expose `mcp`, `auth`,
62
+ `enforced`, `safety`, `exits`, and parseable `examples`.
63
+
64
+ Recommended sequence: discover a tool → `aisa schema` when
65
+ `has_full_schema=false` → `aisa quote` → `aisa call`. Quote and call share
66
+ one request shape. **Enforced:** invalid local input exits 2 and is not sent;
67
+ quote and call refuse to run without a configured AIsa API key. **Not
68
+ enforced:** the CLI does not record quotes, approvals, or budget caps and
69
+ does not reject an unquoted call. **Instruction:** do not execute unquoted
70
+ calls; the caller must ensure a matching quote and approval. Quote is a
71
+ price observation, not authorization. A data request or credentials alone is
72
+ not spending approval. Do not invent tool names or guess required values.
73
+ `aisa call` is billable. A missing or failed quote is never free. Estimated
74
+ cost is not a limit. If a hard monetary cap is required, do not execute
75
+ calls with no guaranteed maximum. A partial quote is not a full-batch total;
76
+ call only an independently approved successful subset, and do not silently
77
+ retry. Without a configured AIsa API key, do not invent a business result.
78
+
79
+ `--input` is inline JSON (no file required). Documented shell examples use
80
+ POSIX single quotes so apostrophes, Unicode, `$()`, and backticks stay
81
+ literal.
82
+
83
+ `get_financial_company_facts` is a published tool whose schema includes
84
+ `ticker`. Do not invent unpublished tool names. Router search does not
85
+ guarantee every former domain-shortcut function.
86
+
87
+ ```sh
88
+ aisa search "company facts" --json
89
+ aisa search --input '{"query":"company facts","limit":5}' --json
90
+ aisa search --input '{"query":"company facts","known_fields":{"name":"O'\''Reilly — 苹果"}}' --json
91
+ aisa search -f request.json --json
92
+ aisa search -f - --json < request.json
93
+ aisa schema get_financial_company_facts --json
94
+ aisa schema --input '{"tools":["get_financial_company_facts"]}' --json
95
+ aisa quote --input '{"calls":[{"call_id":"c1","tool":"get_financial_company_facts","arguments":{"ticker":"AAPL"}}]}' --json
96
+ aisa quote -f request.json --json
97
+ aisa call --input '{"calls":[{"call_id":"c1","tool":"get_financial_company_facts","arguments":{"ticker":"AAPL"}}]}' --json
98
+ aisa call -f - --json < request.json
34
99
  ```
35
100
 
36
- Get your API key at
37
- [console.aisa.one/api-keys](https://console.aisa.one/api-keys). New accounts
38
- receive $5 in free credits.
101
+ `--json` keeps large integer tokens. Diagnostics go to stderr. Exit `2` means
102
+ local input was invalid and nothing was sent; `1` is transport, auth, or an
103
+ HTTP error; `3` means the Router returned a batch with at least one failed
104
+ item.
105
+
106
+ `search` and `schema` may be anonymous. `quote` and `call` require a
107
+ configured AIsa API key. Sign in with `aisa login` first; it mints and stores
108
+ a CLI key. Resolution order is unchanged: `AISA_API_KEY`, then `~/.aisa/key`,
109
+ then legacy login. `AISA_API_KEY` still takes precedence over the stored key.
110
+ For CI, set `AISA_API_KEY` or use `aisa login --key <key>`. The default Router
111
+ origin is `https://tools.aisa.one` (independent of `baseUrl` /
112
+ `https://api.aisa.one`). Point a test Router at `AISA_ROUTER_BASE_URL` (origin
113
+ or prefix before `/v1/tool-router/...`), or `aisa config set routerUrl`. There
114
+ is no origin fallback.
115
+
116
+ `quote` never executes. Router requests do not follow HTTP redirects, so a
117
+ 307/308 cannot turn quote into call. There is no automatic quote-to-call sequence and no
118
+ retry.
39
119
 
40
120
  ## API Catalog
41
121
 
42
- The catalog is the fastest way to find what the platform can do. It reads a
43
- public endpoint, so `list`, `show`, `search`, and `code` all work before you log
44
- in.
122
+ `api list` and `api show` are the supported read-only catalog. They browse
123
+ public provider and endpoint metadata (`--json`, `--refresh`, `--health`,
124
+ `--category`, path filters). They are not deprecated and are not Router
125
+ `search` / `schema`. Catalog paths and prices are browsing metadata, not a
126
+ substitute for schema or quote, and not a way to execute an endpoint.
45
127
 
46
128
  ```bash
47
- aisa api list # all 29 providers
129
+ aisa api list # all catalog providers
48
130
  aisa api list --category finance # finance, search, social, productivity, other
49
131
  aisa api list --health # include provider health
50
132
 
51
- aisa api show financial # every endpoint in one provider
52
- aisa api show financial /news # one endpoint: params, price, run command
53
- aisa api show dataforseo --all # 453 endpoints (truncated to 40 by default)
54
-
55
- aisa api search "stock screener" # search across all 950+ endpoints
56
- aisa api search rank --provider dataforseo
57
-
58
- aisa api code financial /news --lang curl # curl, python, node, typescript
133
+ aisa api show financial # endpoints in one provider
134
+ aisa api show financial /news # one endpoint: params and catalog price
135
+ aisa api show dataforseo --all # long lists truncate to 40 by default
59
136
  ```
60
137
 
61
- Two things worth knowing: a provider's **id is not always its URL slug** —
62
- `brave-search` serves `/apis/v1/brave/...`, and `api show` prints the path you
63
- actually call. And the catalog reports every method as `GET`; pass `--method` to
64
- `api code` when an endpoint takes a POST.
138
+ A provider **id is not always its URL slug** — `brave-search` serves
139
+ `/apis/v1/brave/...`, and `api show` prints the catalog path. The catalog
140
+ reports every method as `GET`; treat that as advisory.
65
141
 
66
142
  The catalog is cached in `~/.aisa/cache` (override with `AISA_CACHE_DIR`). Pass
67
143
  `--refresh` to any command to bypass it, or `aisa cache clear`.
68
144
 
69
- ## Execute Any Endpoint
70
-
71
- ```bash
72
- aisa run financial /insider-trades -q "ticker=AAPL"
73
- aisa run coingecko /simple/price -q "ids=bitcoin&vs_currencies=usd"
74
- aisa run brave /web/search -q "q=AI agents"
75
- aisa run tavily /search -d '{"query": "AI news"}'
76
- aisa run twitter /tweet/advanced_search -q "query=AI agents" --raw
77
- aisa run dataforseo /serp/google/organic/live -d '{...}' --show-cost
78
- ```
79
-
80
- `run` sends anything that isn't a known LLM gateway route to the integration
81
- APIs, so providers added to the platform work without a CLI upgrade. Use
82
- `--llm` or `--domain` to force a base.
83
-
84
- `--show-cost` prints the gateway's billing headers on stderr, so it stays out of
85
- the way of `--raw | jq`. Metered providers (DataForSEO, Jina) report the amount
86
- actually charged and the credits consumed — for those the catalog's flat
87
- per-request price is not what you pay. Other routes report only a price key, and
88
- the LLM gateway reports nothing; the output says so rather than implying a call
89
- was free.
90
-
91
145
  ## LLM Gateway
92
146
 
93
- 80+ models (GPT, Claude, Gemini, Qwen, Deepseek, Grok) behind one
147
+ GPT, Claude, Gemini, DeepSeek, Kimi, GLM, Qwen and the rest behind one
94
148
  OpenAI-compatible endpoint.
95
149
 
96
150
  ```bash
@@ -106,91 +160,19 @@ aisa models show gpt-4.1-mini # model details
106
160
 
107
161
  Streaming is on by default; pass `--no-stream` to disable it.
108
162
 
109
- ## Finance
110
-
111
- ```bash
112
- aisa stock AAPL # summary: company info + estimates + news
113
- aisa stock AAPL --field insider # insider trades
114
- aisa stock AAPL --field news # company news
115
- aisa stock TSLA --field filings # SEC filings
116
- aisa stock MSFT --field estimates # analyst EPS & revenue estimates
117
- aisa stock AAPL --field financials # balance sheets, income statements
118
-
119
- aisa crypto BTC # price, 24h change, market cap
120
- aisa crypto ETH --period 30d # historical
121
- aisa crypto --id render-token RNDR # exact CoinGecko id when a symbol is ambiguous
122
-
123
- aisa screener --sector "Information Technology"
124
- aisa screener --min-market-cap 1000000000000 --limit 10
125
- aisa screener --filter market_cap:gt:1e12 --filter sector:eq:Financials
126
- ```
127
-
128
- Sectors use GICS names; short forms like `Technology` are mapped automatically.
129
-
130
- ## Web Search
131
-
132
- ```bash
133
- aisa web-search "query" # Tavily (default)
134
- aisa web-search "query" --type youtube # YouTube search
135
- aisa scholar "transformer architecture" # academic papers
136
- ```
137
-
138
- `--type smart` and `--type full` are currently degraded upstream and return 404
139
- regardless of parameters. Use `tavily` until that is resolved.
140
-
141
- ## Twitter/X
142
-
143
- ```bash
144
- aisa twitter user elonmusk # user profile
145
- aisa twitter search "AI agents" --limit 20 # search tweets
146
- aisa twitter trends # trending topics
147
- aisa twitter user-tweets elonmusk # recent tweets
148
- aisa twitter thread <tweet-id> # full conversation
149
- ```
150
-
151
- Read operations work with just your API key. **Write operations** (`aisa tweet`,
152
- `like`, `retweet`, `follow`, `dm`) additionally require Twitter login cookies
153
- and a proxy — run `aisa twitter login --username <u> --password <p> --proxy <url>`
154
- first. Run `aisa twitter --help` for the full list of 30+ subcommands.
155
-
156
- ## Video Generation
157
-
158
- ```bash
159
- aisa video create "A sunset timelapse" # returns a task id
160
- aisa video create "Dancing robot" --wait # poll until done
161
- aisa video create "A cat" --output cat.mp4 # wait and download
162
- aisa video status <task-id>
163
-
164
- # image-to-video: --image is shorthand for --media first_frame=<url>
165
- aisa video create "the bird turns its head" --model wan2.7-i2v --image https://…/photo.jpg
166
- aisa video create "extend this clip" --model wan2.7-r2v --media first_clip=https://…/in.mp4
167
-
168
- # Seedance uses a different request shape; the CLI handles it
169
- aisa video create "a cat walking" --model dreamina-seedance-2-0-fast-260128
170
- ```
171
-
172
- | Model | Needs | Billing |
173
- |-------|-------|---------|
174
- | `wan2.7-t2v` (default), `happyhorse-1.1-t2v` | prompt only | per second |
175
- | `wan2.7-i2v`, `happyhorse-1.1-i2v` | `--image` / `--media first_frame=` | per second |
176
- | `wan2.7-r2v`, `happyhorse-1.1-r2v` | `--media first_clip=` | per second |
177
- | `dreamina-seedance-2-0-260128`, `…-fast-260128` | prompt only | per token |
178
-
179
- Media types: `first_frame`, `last_frame`, `driving_audio`, `first_clip`.
180
-
181
- The gateway forwards the request body to whichever vendor owns the model, so the
182
- shape differs per family — the CLI builds it for you and refuses up front if a
183
- model needs source media you did not supply (the upstream would otherwise accept
184
- the job, bill it, and fail a minute later). For a vendor or parameter the CLI
185
- does not model, `--body '<json>'` is sent verbatim.
186
-
187
163
  ## Account
188
164
 
189
165
  ```bash
190
166
  aisa balance # wallet and API key credit balance
191
167
  aisa balance --json
168
+ aisa topup # open the console billing page to add credit
169
+ aisa topup 20 # same, deep-linked to $20
192
170
  ```
193
171
 
172
+ Payment always finishes in the browser: card details belong to Stripe's hosted
173
+ page, not to us, and a bank's 3-D Secure step needs one. `topup` opens the
174
+ right page; `--no-open` prints the URL instead.
175
+
194
176
  `aisa usage` is not available yet — the gateway does not serve
195
177
  `GET /v1/credits/usage` (it 404s, while `/v1/credits/balance` on the same route
196
178
  group works). Use the [console](https://console.aisa.one/logs) for usage history
@@ -199,9 +181,8 @@ in the meantime.
199
181
  ## Skills
200
182
 
201
183
  Skills are markdown files that teach AI coding agents (Claude Code, Cursor,
202
- Copilot, …) how to use AIsa APIs. They come from the
203
- [agent-skills](https://github.com/AIsa-team/agent-skills) repository — 42 skills
204
- across six categories.
184
+ Copilot, …) how to use AIsa. They come from the
185
+ [agent-skills](https://github.com/AIsa-team/agent-skills) repository.
205
186
 
206
187
  ```bash
207
188
  aisa skills list # all skills
@@ -244,11 +225,37 @@ aisa skills init my-skill # default template
244
225
  aisa skills init my-skill --template finance # finance, llm, search, twitter, video
245
226
  ```
246
227
 
228
+ Bundled templates may keep those domain labels. Their runnable steps use
229
+ `search` / `schema` / `quote` / `call` (and optional `api list` / `api show`).
230
+ They do not invent tool names or treat Router as a replacement for every
231
+ removed shortcut. The `llm` template stays on `chat` / `models`.
232
+
247
233
  To publish a skill, open a pull request against
248
234
  [AIsa-team/agent-skills](https://github.com/AIsa-team/agent-skills).
249
235
 
250
236
  ## MCP Server
251
237
 
238
+ ### One-liner: `connect`
239
+
240
+ ```bash
241
+ npx @aisa-one/cli connect
242
+ ```
243
+
244
+ Opens a small local page (served by this process on `127.0.0.1`, shut down
245
+ when finished) where you tick the AIsa MCP servers you want and the coding
246
+ agents to install them into. Claude Code is configured through its own
247
+ `claude mcp add` (user scope), then signed in through its own OAuth: connect
248
+ runs `claude mcp login` per server, your browser opens the AIsa
249
+ authorization, and the tokens live in Claude Code's own store where it also
250
+ refreshes them — no API key, nothing pasted. Cursor, Claude Desktop and
251
+ Windsurf get config entries and run the same OAuth themselves on first use.
252
+ The page matches the AIsa Console style, reports authorization progress
253
+ live, and a success page with copy-paste try-it-now prompts opens when
254
+ everything is connected. No daemon stays behind. `--no-open` prints the URL
255
+ instead of launching a browser; `--dry-run` shows what would be written.
256
+
257
+ ### Scripted: `mcp setup`
258
+
252
259
  ```bash
253
260
  aisa mcp setup # configure the default servers for every detected client
254
261
  aisa mcp setup --all # every live server, not just the defaults
@@ -288,12 +295,10 @@ Completion covers commands, subcommands, and options, plus values pulled from
288
295
  the local cache:
289
296
 
290
297
  ```
291
- aisa run <TAB> → 29 provider slugs
292
- aisa run financial <TAB> → that provider's endpoints
293
298
  aisa api show <TAB> → provider ids
294
- aisa skills show <TAB> → 42 skill names
299
+ aisa api list --category <TAB> → finance, search, social, productivity, other
300
+ aisa skills show <TAB> → skill names
295
301
  aisa chat --model <TAB> → model ids
296
- aisa web-search --type <TAB> → tavily, youtube, scholar, …
297
302
  ```
298
303
 
299
304
  The cache-backed suggestions only appear once the relevant command has been run
@@ -314,11 +319,16 @@ Settings:
314
319
  - `defaultModel` — default model for `aisa chat` (default: `gpt-4.1-mini`)
315
320
  - `baseUrl` — platform root; the LLM (`/v1`), integration (`/apis/v1`), and
316
321
  catalog bases are all derived from it
322
+ - `routerUrl` — Tool Router origin (default `https://tools.aisa.one`,
323
+ independent of `baseUrl`); overridden by `AISA_ROUTER_BASE_URL`
317
324
  - `outputFormat` — `text` or `json`
318
325
 
319
- Environment variables: `AISA_API_KEY` takes precedence over the stored key.
320
- `AISA_CACHE_DIR` relocates the cache. `GITHUB_TOKEN` raises the GitHub rate
321
- limit for skills commands.
326
+ `aisa login` stores a CLI key in `~/.aisa/key`. Environment variables:
327
+ `AISA_API_KEY` takes precedence over the stored key.
328
+ `AISA_ROUTER_BASE_URL` is the Router origin/prefix before
329
+ `/v1/tool-router/...` and overrides the default `https://tools.aisa.one`.
330
+ `AISA_CACHE_DIR` relocates the cache. `GITHUB_TOKEN`
331
+ raises the GitHub rate limit for skills commands.
322
332
 
323
333
  ## Development
324
334
 
@@ -329,8 +339,12 @@ npm install
329
339
  npm run build # compile TypeScript
330
340
  npm run dev # watch mode
331
341
  npm test # run tests
342
+ npm run package:smoke # clean pack, isolated install, installed-bin checks
332
343
  ```
333
344
 
345
+ Release metadata and the exact merge/tag publish path (not an authorization
346
+ to publish) are in [`docs/release.md`](docs/release.md).
347
+
334
348
  ## Appendix: Notes for Contributors
335
349
 
336
350
  **Three bases, one root.** `resolveBases()` in `src/api.ts` derives the LLM base
@@ -339,12 +353,6 @@ configured `baseUrl`. It tolerates a value with either suffix already attached,
339
353
  because the shipped default has always included `/v1` and is persisted in every
340
354
  existing user's config.
341
355
 
342
- **Routing in `run`.** `resolveRunTarget()` (`src/commands/run.ts`) treats the LLM
343
- gateway routes as the whitelist and everything else as an integration API. That
344
- direction matters: gateway routes are hardcoded server-side and change roughly
345
- annually, while provider slugs are database rows that operations edit
346
- continuously.
347
-
348
356
  **The catalog's shape has three traps.** `endpoints[].method` is hardcoded to
349
357
  `GET` server-side. `endpoint_groups[].name` is an operator-entered label
350
358
  (`Zero`, `One`, `default`) with no business meaning, which is why `api show`
@@ -353,23 +361,9 @@ per-endpoint counts are one value repeated.
353
361
 
354
362
  **Parameter naming varies by endpoint.** Scholar uses `query`, finance uses
355
363
  `ticker` (not `symbol`), Twitter uses `userName`. `aisa api show <api> <path>`
356
- prints each endpoint's description and path parameters.
357
-
358
- **Video generation is async.** `POST /v1/video/generations` returns `202` with a
359
- gateway-local `video_task_<hex>` id. Poll `GET /v1/video/generations/:id` until
360
- `status` is one of `completed`, `failed`, or `cancelled`. The finished URL sits
361
- at a different place in `result` for each vendor, so `findVideoUrl()` searches
362
- for it.
363
-
364
- **Twitter write operations require login cookies.** `create_tweet_v2` and the
365
- other action endpoints need `login_cookies` and `proxy` in the body — the
366
- gateway does not hold your Twitter session.
367
-
368
- **Some financial endpoints return empty data.** `financial/prices` and
369
- `financial/financial-metrics/snapshot` return `{}` for all tickers. `aisa stock`
370
- uses `company/facts` + `analyst-estimates` + `news` instead. Working fields:
371
- `info`, `estimates`, `financials`, `filings`, `insider`, `institutional`, `news`.
364
+ prints each endpoint's description and path parameters. That listing is
365
+ catalog metadata, not an execution recipe.
372
366
 
373
367
  ## License
374
368
 
375
- MIT
369
+ MIT. See [LICENSE](LICENSE). Copyright (c) 2026 AIsa Team.
package/dist/api.d.ts CHANGED
@@ -33,6 +33,16 @@ export interface RequestOptions {
33
33
  headers?: Record<string, string>;
34
34
  /** Use domain API base URL (/apis/v1) instead of LLM base (/v1) */
35
35
  domain?: boolean;
36
+ /**
37
+ * Safe to send more than once, so a transient failure can be retried.
38
+ * Must be set deliberately: this CLI POSTs for reads and for writes alike,
39
+ * and a retried write posts a second tweet or bills a second video job.
40
+ * See utils/http.ts for why `chat` stays out of this even though a
41
+ * completion reads rather than writes.
42
+ */
43
+ idempotent?: boolean;
44
+ /** Overrides the default 30s budget for a slow endpoint. */
45
+ timeoutMs?: number;
36
46
  }
37
47
  export declare function apiRequest<T = unknown>(apiKey: string, endpoint: string, options?: RequestOptions): Promise<ApiResponse<T>>;
38
48
  export declare function apiRequestRaw(apiKey: string, endpoint: string, options?: RequestOptions): Promise<Response>;