@aivin-labs/cli 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.mjs +12 -7
- package/bin/lib/browserTui.mjs +6 -0
- package/bin/lib/codegen.mjs +61 -5
- package/bin/lib/connectors.mjs +55 -21
- package/bin/lib/deploy.mjs +25 -2
- package/bin/lib/mcpProxy.mjs +84 -20
- package/bin/lib/mission.mjs +13 -1
- package/bin/lib/missionStream.mjs +32 -1
- package/bin/lib/pluginAuthResolve.mjs +127 -0
- package/bin/lib/pluginTrigger.mjs +207 -90
- package/bin/lib/store.mjs +16 -2
- package/bin/lib/tasks.mjs +52 -8
- package/bin/lib/util.mjs +8 -0
- package/docs/CLI.md +25 -0
- package/package.json +1 -1
package/bin/lib/util.mjs
CHANGED
|
@@ -2,6 +2,14 @@ import chalk from 'chalk';
|
|
|
2
2
|
import readline from 'readline';
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
4
|
|
|
5
|
+
// ✅ FIX: several axios calls across the CLI (store.mjs, connectors.mjs, deploy.mjs's main deploy
|
|
6
|
+
// POST) had no `timeout` at all - a network glitch/overloaded backend left the spinner spinning
|
|
7
|
+
// forever with no way out short of Ctrl+C, which is especially costly for a call like `connector
|
|
8
|
+
// register` where the whole interactive form (including a typed-in OAuth client_secret) would have
|
|
9
|
+
// to be re-entered from scratch afterwards. A generous but finite default so a genuinely slow-but-
|
|
10
|
+
// alive backend still succeeds, while a truly hung connection eventually surfaces as a normal error.
|
|
11
|
+
export const DEFAULT_API_TIMEOUT_MS = 30000;
|
|
12
|
+
|
|
5
13
|
// Same spinner deployPlugin has always had, factored out so other long-running network calls
|
|
6
14
|
// (AI codegen, connector register) get the same "still working, not hung" feedback instead of a
|
|
7
15
|
// static line that just sits there for however many seconds the request takes.
|
package/docs/CLI.md
CHANGED
|
@@ -508,6 +508,8 @@ Options:
|
|
|
508
508
|
--agent <id> Agent id to run as, if the plugin needs one for
|
|
509
509
|
HIL/confirm behavior to be accurate
|
|
510
510
|
--watch-logs Also stream the chosen plugin's own live console output inline
|
|
511
|
+
--no-auth-prompt Don't offer to connect/configure a missing connector
|
|
512
|
+
interactively - just print the needs_auth result and exit
|
|
511
513
|
--save Write this run's result to .test/trigger/<ts>.json
|
|
512
514
|
--compare <file> Diff this run against a previously --save'd file
|
|
513
515
|
```
|
|
@@ -543,6 +545,8 @@ Options:
|
|
|
543
545
|
needed. Requires permission to view that plugin's logs;
|
|
544
546
|
most store plugins from other orgs just fall back to
|
|
545
547
|
the REST result only.
|
|
548
|
+
--no-auth-prompt Don't offer to connect/configure a missing connector
|
|
549
|
+
interactively - just print the needs_auth result and exit
|
|
546
550
|
--save Write this run's result to .test/trigger/<ts>.json
|
|
547
551
|
--compare <file> Diff this run against a previously --save'd file
|
|
548
552
|
```
|
|
@@ -599,6 +603,27 @@ print `(--watch-logs: no live console output - ...)` and fall back to the REST r
|
|
|
599
603
|
no way around that from the CLI, raw container stdout isn't something the platform exposes across
|
|
600
604
|
org boundaries.
|
|
601
605
|
|
|
606
|
+
### Missing a connector? `trigger` sets it up for you, right there
|
|
607
|
+
|
|
608
|
+
If the plugin needs a connector (OAuth account, or a plain credential form like SMTP
|
|
609
|
+
host/user/pass) that isn't configured yet, `/plugins/execute` comes back `needs_auth` instead of
|
|
610
|
+
running. In an interactive terminal, `trigger`/`ask` catch that and offer to fix it on the spot
|
|
611
|
+
instead of just printing the failure and making you go set it up in the web app:
|
|
612
|
+
|
|
613
|
+
- **OAuth connector** - asks "Open your browser to connect now?", then opens the same
|
|
614
|
+
authorize-flow the web app's "Connect" button uses (falls back to printing the URL if it can't
|
|
615
|
+
launch a browser), and polls in the background until you've finished. No timeout hunting - it
|
|
616
|
+
waits up to 3 minutes, then retries the trigger automatically.
|
|
617
|
+
- **Credential-form connector** (SMTP, or any custom `credential_form` connector registered via
|
|
618
|
+
`aivin connector register`) - prompts for each declared field right in the terminal (masked for
|
|
619
|
+
`secret` fields), saves it, then retries.
|
|
620
|
+
|
|
621
|
+
Either way, you get exactly one automatic retry after setup - if it still needs auth after that
|
|
622
|
+
(e.g. you declined, or the OAuth flow timed out), the `needs_auth` result just prints as-is. Pass
|
|
623
|
+
`--no-auth-prompt` to skip all of this and always just print the result (useful for scripts/CI,
|
|
624
|
+
where there's no one to answer the prompt anyway - it's also skipped automatically whenever stdin/
|
|
625
|
+
stdout isn't a real TTY).
|
|
626
|
+
|
|
602
627
|
### Turning ad-hoc tries into a regression check: `--save` / `--compare`
|
|
603
628
|
|
|
604
629
|
```bash
|