@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
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.3.0";
1
+ export declare const VERSION = "0.5.1";
2
2
  /** Root of the platform. Per-surface bases are derived in api.ts#resolveBases. */
3
3
  export declare const BASE_URL = "https://api.aisa.one";
4
4
  export declare const ENV_VAR_NAME = "AISA_API_KEY";
@@ -7,15 +7,47 @@ export declare const ENV_VAR_NAME = "AISA_API_KEY";
7
7
  * exist and where they live. The CLI deliberately knows no server list of its
8
8
  * own: servers ship and retire on the platform side, and reading the manifest
9
9
  * at setup time means a new server works without a CLI release (the same
10
- * philosophy as LLM_ROUTE_PREFIXES below, applied to the fast-moving side).
10
+ * philosophy as live catalog/MCP discovery, applied to the fast-moving side).
11
11
  *
12
12
  * History: until v0.2.4 this file hardcoded MCP_URL = "https://docs.aisa.one/mcp",
13
13
  * a host that does not resolve — every `aisa mcp setup` wrote a dead entry into
14
14
  * users' configs, and nothing noticed because the command had no tests.
15
15
  */
16
16
  export declare const MCP_MANIFEST_URL = "https://aisa.one/.well-known/mcp.json";
17
+ /**
18
+ * The live server index, served by the MCP host itself.
19
+ *
20
+ * Preferred over the manifest above, which is generated offline and committed
21
+ * by hand: being a snapshot it drifts. Measured 2026-08-25 it named 11 servers
22
+ * and 188 tools while mcp.aisa.one was serving 14 and 260 — agentmail (49
23
+ * tools), seo (21) and creator-discovery (2) missing outright, so every user
24
+ * of this CLI was offered 72 fewer tools than exist.
25
+ *
26
+ * It is also 12 KB against the manifest's 137 KB. Most of that difference is
27
+ * tool names, of which this CLI uses exactly one thing: `tools.length`, to
28
+ * print a count. The index carries `toolCount` instead; a client that wants
29
+ * the names is about to connect anyway, and `tools/list` is authoritative.
30
+ *
31
+ * The manifest stays as the fallback — this endpoint is newer than some
32
+ * deployments — and as the public document for readers who want the roadmap
33
+ * of planned servers, which a running process cannot honestly report.
34
+ */
35
+ export declare const MCP_CATALOG_URL = "https://mcp.aisa.one/servers";
17
36
  /** Mintlify's docs-search MCP (3 tools: search/read/feedback). Unauthenticated. */
18
37
  export declare const DOCS_MCP_URL = "https://aisa.one/docs/mcp";
38
+ /** Where credit is added. Payment always finishes in a browser — Stripe's
39
+ * hosted page owns the card details, and 3-D Secure needs one. */
40
+ /** The account surface. Printed where someone can act on it, not linked. */
41
+ export declare const CONSOLE_URL = "https://console.aisa.one";
42
+ export declare const CONSOLE_BILLING_URL = "https://console.aisa.one/billing";
43
+ /** Anthropic-shaped base for Claude Code: it appends /v1/messages itself. */
44
+ export declare const LLM_BASE_URL = "https://api.aisa.one";
45
+ /** Codex speaks the Responses API and appends /responses, so it needs the
46
+ * /v1 root rather than the host. */
47
+ export declare const LLM_RESPONSES_BASE_URL = "https://api.aisa.one/v1";
48
+ /** The provider name written into Codex's config.toml. Frozen: renaming it
49
+ * orphans the block we would otherwise remove cleanly. */
50
+ export declare const AISA_PROVIDER_ID = "aisa";
19
51
  /**
20
52
  * Servers configured by default. Eleven entries per client is a lot of config;
21
53
  * these five cover the broadest agent needs, and `--all` configures everything
@@ -23,16 +55,15 @@ export declare const DOCS_MCP_URL = "https://aisa.one/docs/mcp";
23
55
  */
24
56
  export declare const MCP_DEFAULT_SLUGS: readonly string[];
25
57
  /**
26
- * First path segment of every route the LLM gateway serves under /v1 (plus
27
- * /v1beta for Gemini). Everything else is an integration API under /apis/v1.
58
+ * Why one and not five.
28
59
  *
29
- * This list is deliberately the whitelist rather than the provider slugs: the
30
- * gateway routes are hardcoded server-side and change about once a year, while
31
- * provider slugs are data that operations add and remove continuously. Keeping
32
- * the whitelist on the slow-moving side means a newly added provider works
33
- * without a CLI release.
60
+ * Each server is its own OAuth resource — the authorization URL carries
61
+ * `resource=https://mcp.aisa.one/<slug>/mcp` (RFC 8707) — so a keyless
62
+ * install authorises once per server. Defaulting to five meant five browser
63
+ * round trips before anything worked, observed 2026-08-20. Web search is the
64
+ * one every agent reaches for; the rest are one tick away, and a configured
65
+ * API key skips authorization for all of them anyway.
34
66
  */
35
- export declare const LLM_ROUTE_PREFIXES: readonly string[];
36
67
  export declare const AGENT_DIRS: Record<string, string>;
37
68
  /**
38
69
  * Per-client config shape. This is the part v0.2.4 got wrong even apart from
@@ -47,37 +78,19 @@ export declare const MCP_CONFIGS: Record<string, {
47
78
  shape: "url" | "stdio";
48
79
  }>;
49
80
  /**
50
- * Ticker symbol → CoinGecko coin id.
51
- *
52
- * CoinGecko keys everything by id ("bitcoin"), not symbol ("BTC"), and dozens
53
- * of unrelated tokens share popular symbols — resolving by symbol alone would
54
- * happily return the price of the wrong coin. This table covers the symbols
55
- * people actually type; anything else falls back to an explicit lookup.
56
- */
57
- export declare const COINGECKO_IDS: Record<string, string>;
58
- /**
59
- * Models routed to /v1/video/generations, and the request body each one wants.
81
+ * Windsurf was here until 2026-08-25 and was removed, not because it cannot be
82
+ * configured but because being listed did harm on a machine without it.
60
83
  *
61
- * The gateway only rewrites the top-level `model` and passes the rest through,
62
- * so the body shape belongs to whichever vendor owns the model — a Bailian-style
63
- * `{input, parameters}` sent to Seedance is rejected outright with a 400.
84
+ * `detectClients()` decides a client is present by whether the parent of its
85
+ * config path exists. `aisa mcp setup` with no --agent wrote to every entry in
86
+ * this table regardless of what was installed — so on a machine with no
87
+ * Windsurf it created ~/.codeium/windsurf/, and the next `aisa connect`
88
+ * offered a Windsurf card for an editor that was never there. A stale entry in
89
+ * this table is not inert: it is an input to detection.
64
90
  *
65
- * `requiresMedia` records the `input.media[].type` an image/clip-driven model
66
- * needs. Without it the upstream accepts the submission and only fails a minute
67
- * later, after billing, so the CLI refuses up front instead.
91
+ * The T2 page had already been filtering it out by hand, which was the same
92
+ * observation reached one layer too late.
68
93
  */
69
- export type VideoFamily = "bailian" | "seedance";
70
- export interface VideoModelSpec {
71
- family: VideoFamily;
72
- requiresMedia?: MediaType;
73
- }
74
- /** Accepted values for `input.media[].type` (enumerated by the upstream error). */
75
- export declare const MEDIA_TYPES: readonly ["first_frame", "last_frame", "driving_audio", "first_clip"];
76
- export type MediaType = (typeof MEDIA_TYPES)[number];
77
- export declare const VIDEO_MODELS: Record<string, VideoModelSpec>;
78
- export declare const DEFAULT_VIDEO_MODEL = "wan2.7-t2v";
79
- /** Model families are matched by prefix so new revisions work without a release. */
80
- export declare function videoModelSpec(model: string): VideoModelSpec;
81
94
  /**
82
95
  * Client-side grouping of integration providers.
83
96
  *
package/dist/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = "0.3.0";
1
+ export const VERSION = "0.5.1";
2
2
  /** Root of the platform. Per-surface bases are derived in api.ts#resolveBases. */
3
3
  export const BASE_URL = "https://api.aisa.one";
4
4
  export const ENV_VAR_NAME = "AISA_API_KEY";
@@ -7,50 +7,63 @@ export const ENV_VAR_NAME = "AISA_API_KEY";
7
7
  * exist and where they live. The CLI deliberately knows no server list of its
8
8
  * own: servers ship and retire on the platform side, and reading the manifest
9
9
  * at setup time means a new server works without a CLI release (the same
10
- * philosophy as LLM_ROUTE_PREFIXES below, applied to the fast-moving side).
10
+ * philosophy as live catalog/MCP discovery, applied to the fast-moving side).
11
11
  *
12
12
  * History: until v0.2.4 this file hardcoded MCP_URL = "https://docs.aisa.one/mcp",
13
13
  * a host that does not resolve — every `aisa mcp setup` wrote a dead entry into
14
14
  * users' configs, and nothing noticed because the command had no tests.
15
15
  */
16
16
  export const MCP_MANIFEST_URL = "https://aisa.one/.well-known/mcp.json";
17
+ /**
18
+ * The live server index, served by the MCP host itself.
19
+ *
20
+ * Preferred over the manifest above, which is generated offline and committed
21
+ * by hand: being a snapshot it drifts. Measured 2026-08-25 it named 11 servers
22
+ * and 188 tools while mcp.aisa.one was serving 14 and 260 — agentmail (49
23
+ * tools), seo (21) and creator-discovery (2) missing outright, so every user
24
+ * of this CLI was offered 72 fewer tools than exist.
25
+ *
26
+ * It is also 12 KB against the manifest's 137 KB. Most of that difference is
27
+ * tool names, of which this CLI uses exactly one thing: `tools.length`, to
28
+ * print a count. The index carries `toolCount` instead; a client that wants
29
+ * the names is about to connect anyway, and `tools/list` is authoritative.
30
+ *
31
+ * The manifest stays as the fallback — this endpoint is newer than some
32
+ * deployments — and as the public document for readers who want the roadmap
33
+ * of planned servers, which a running process cannot honestly report.
34
+ */
35
+ export const MCP_CATALOG_URL = "https://mcp.aisa.one/servers";
17
36
  /** Mintlify's docs-search MCP (3 tools: search/read/feedback). Unauthenticated. */
18
37
  export const DOCS_MCP_URL = "https://aisa.one/docs/mcp";
38
+ /** Where credit is added. Payment always finishes in a browser — Stripe's
39
+ * hosted page owns the card details, and 3-D Secure needs one. */
40
+ /** The account surface. Printed where someone can act on it, not linked. */
41
+ export const CONSOLE_URL = "https://console.aisa.one";
42
+ export const CONSOLE_BILLING_URL = "https://console.aisa.one/billing";
43
+ /** Anthropic-shaped base for Claude Code: it appends /v1/messages itself. */
44
+ export const LLM_BASE_URL = "https://api.aisa.one";
45
+ /** Codex speaks the Responses API and appends /responses, so it needs the
46
+ * /v1 root rather than the host. */
47
+ export const LLM_RESPONSES_BASE_URL = "https://api.aisa.one/v1";
48
+ /** The provider name written into Codex's config.toml. Frozen: renaming it
49
+ * orphans the block we would otherwise remove cleanly. */
50
+ export const AISA_PROVIDER_ID = "aisa";
19
51
  /**
20
52
  * Servers configured by default. Eleven entries per client is a lot of config;
21
53
  * these five cover the broadest agent needs, and `--all` configures everything
22
54
  * the manifest lists as live.
23
55
  */
24
- export const MCP_DEFAULT_SLUGS = [
25
- "web-search",
26
- "twitter-api",
27
- "crypto-market-data",
28
- "marketpulse",
29
- "stock-pulse",
30
- ];
56
+ export const MCP_DEFAULT_SLUGS = ["web-search"];
31
57
  /**
32
- * First path segment of every route the LLM gateway serves under /v1 (plus
33
- * /v1beta for Gemini). Everything else is an integration API under /apis/v1.
58
+ * Why one and not five.
34
59
  *
35
- * This list is deliberately the whitelist rather than the provider slugs: the
36
- * gateway routes are hardcoded server-side and change about once a year, while
37
- * provider slugs are data that operations add and remove continuously. Keeping
38
- * the whitelist on the slow-moving side means a newly added provider works
39
- * without a CLI release.
60
+ * Each server is its own OAuth resource — the authorization URL carries
61
+ * `resource=https://mcp.aisa.one/<slug>/mcp` (RFC 8707) — so a keyless
62
+ * install authorises once per server. Defaulting to five meant five browser
63
+ * round trips before anything worked, observed 2026-08-20. Web search is the
64
+ * one every agent reaches for; the rest are one tick away, and a configured
65
+ * API key skips authorization for all of them anyway.
40
66
  */
41
- export const LLM_ROUTE_PREFIXES = [
42
- "chat",
43
- "responses",
44
- "embeddings",
45
- "messages",
46
- "models",
47
- "rerank",
48
- "classify",
49
- "images",
50
- "credits",
51
- "video",
52
- "v1beta",
53
- ];
54
67
  export const AGENT_DIRS = {
55
68
  claude: "~/.claude/skills/",
56
69
  cursor: "~/.cursor/skills/",
@@ -74,90 +87,21 @@ export const MCP_CONFIGS = {
74
87
  key: "mcpServers",
75
88
  shape: "stdio",
76
89
  },
77
- windsurf: {
78
- path: "~/.codeium/windsurf/mcp_config.json",
79
- key: "mcpServers",
80
- shape: "stdio",
81
- },
82
90
  };
83
91
  /**
84
- * Ticker symbol → CoinGecko coin id.
92
+ * Windsurf was here until 2026-08-25 and was removed, not because it cannot be
93
+ * configured but because being listed did harm on a machine without it.
94
+ *
95
+ * `detectClients()` decides a client is present by whether the parent of its
96
+ * config path exists. `aisa mcp setup` with no --agent wrote to every entry in
97
+ * this table regardless of what was installed — so on a machine with no
98
+ * Windsurf it created ~/.codeium/windsurf/, and the next `aisa connect`
99
+ * offered a Windsurf card for an editor that was never there. A stale entry in
100
+ * this table is not inert: it is an input to detection.
85
101
  *
86
- * CoinGecko keys everything by id ("bitcoin"), not symbol ("BTC"), and dozens
87
- * of unrelated tokens share popular symbols — resolving by symbol alone would
88
- * happily return the price of the wrong coin. This table covers the symbols
89
- * people actually type; anything else falls back to an explicit lookup.
102
+ * The T2 page had already been filtering it out by hand, which was the same
103
+ * observation reached one layer too late.
90
104
  */
91
- export const COINGECKO_IDS = {
92
- btc: "bitcoin",
93
- eth: "ethereum",
94
- usdt: "tether",
95
- bnb: "binancecoin",
96
- sol: "solana",
97
- usdc: "usd-coin",
98
- xrp: "ripple",
99
- doge: "dogecoin",
100
- ada: "cardano",
101
- trx: "tron",
102
- avax: "avalanche-2",
103
- shib: "shiba-inu",
104
- dot: "polkadot",
105
- link: "chainlink",
106
- bch: "bitcoin-cash",
107
- near: "near",
108
- matic: "matic-network",
109
- ltc: "litecoin",
110
- icp: "internet-computer",
111
- uni: "uniswap",
112
- leo: "leo-token",
113
- dai: "dai",
114
- etc: "ethereum-classic",
115
- apt: "aptos",
116
- render: "render-token",
117
- hbar: "hedera-hashgraph",
118
- fil: "filecoin",
119
- arb: "arbitrum",
120
- atom: "cosmos",
121
- imx: "immutable-x",
122
- op: "optimism",
123
- vet: "vechain",
124
- inj: "injective-protocol",
125
- sui: "sui",
126
- ton: "the-open-network",
127
- pepe: "pepe",
128
- tao: "bittensor",
129
- sei: "sei-network",
130
- aave: "aave",
131
- algo: "algorand",
132
- xlm: "stellar",
133
- cro: "crypto-com-chain",
134
- mnt: "mantle",
135
- wld: "worldcoin-wld",
136
- };
137
- /** Accepted values for `input.media[].type` (enumerated by the upstream error). */
138
- export const MEDIA_TYPES = ["first_frame", "last_frame", "driving_audio", "first_clip"];
139
- export const VIDEO_MODELS = {
140
- "wan2.7-t2v": { family: "bailian" },
141
- "wan2.7-i2v": { family: "bailian", requiresMedia: "first_frame" },
142
- "wan2.7-r2v": { family: "bailian", requiresMedia: "first_clip" },
143
- "happyhorse-1.1-t2v": { family: "bailian" },
144
- "happyhorse-1.1-i2v": { family: "bailian", requiresMedia: "first_frame" },
145
- "happyhorse-1.1-r2v": { family: "bailian", requiresMedia: "first_clip" },
146
- "dreamina-seedance-2-0-260128": { family: "seedance" },
147
- "dreamina-seedance-2-0-fast-260128": { family: "seedance" },
148
- };
149
- export const DEFAULT_VIDEO_MODEL = "wan2.7-t2v";
150
- /** Model families are matched by prefix so new revisions work without a release. */
151
- export function videoModelSpec(model) {
152
- if (VIDEO_MODELS[model])
153
- return VIDEO_MODELS[model];
154
- const family = model.startsWith("dreamina-seedance") ? "seedance" : "bailian";
155
- if (/-i2v\b|-i2v$/.test(model))
156
- return { family, requiresMedia: "first_frame" };
157
- if (/-r2v\b|-r2v$/.test(model))
158
- return { family, requiresMedia: "first_clip" };
159
- return { family };
160
- }
161
105
  /**
162
106
  * Client-side grouping of integration providers.
163
107
  *