instavm 0.15.0 → 0.17.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 (50) hide show
  1. package/README.md +133 -9
  2. package/dist/InstaVM-DjkmUcaP.d.mts +1393 -0
  3. package/dist/InstaVM-DjkmUcaP.d.ts +1393 -0
  4. package/dist/_instavmToolsCore-34H4iqVZ.d.mts +26 -0
  5. package/dist/_instavmToolsCore-BuaJyxXB.d.ts +26 -0
  6. package/dist/cli.js +7973 -2227
  7. package/dist/cli.js.map +1 -1
  8. package/dist/index.d.mts +12 -919
  9. package/dist/index.d.ts +12 -919
  10. package/dist/index.js +1465 -141
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +1450 -136
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/integrations/azure-openai.d.mts +18 -0
  15. package/dist/integrations/azure-openai.d.ts +18 -0
  16. package/dist/integrations/azure-openai.js +332 -0
  17. package/dist/integrations/azure-openai.js.map +1 -0
  18. package/dist/integrations/azure-openai.mjs +299 -0
  19. package/dist/integrations/azure-openai.mjs.map +1 -0
  20. package/dist/integrations/langchain.d.mts +7 -0
  21. package/dist/integrations/langchain.d.ts +7 -0
  22. package/dist/integrations/langchain.js +364 -0
  23. package/dist/integrations/langchain.js.map +1 -0
  24. package/dist/integrations/langchain.mjs +327 -0
  25. package/dist/integrations/langchain.mjs.map +1 -0
  26. package/dist/integrations/llamaindex.d.mts +11 -0
  27. package/dist/integrations/llamaindex.d.ts +11 -0
  28. package/dist/integrations/llamaindex.js +415 -0
  29. package/dist/integrations/llamaindex.js.map +1 -0
  30. package/dist/integrations/llamaindex.mjs +378 -0
  31. package/dist/integrations/llamaindex.mjs.map +1 -0
  32. package/dist/integrations/ollama.d.mts +35 -0
  33. package/dist/integrations/ollama.d.ts +35 -0
  34. package/dist/integrations/ollama.js +421 -0
  35. package/dist/integrations/ollama.js.map +1 -0
  36. package/dist/integrations/ollama.mjs +391 -0
  37. package/dist/integrations/ollama.mjs.map +1 -0
  38. package/dist/integrations/openai.d.mts +19 -0
  39. package/dist/integrations/openai.d.ts +19 -0
  40. package/dist/integrations/openai.js +302 -0
  41. package/dist/integrations/openai.js.map +1 -0
  42. package/dist/integrations/openai.mjs +272 -0
  43. package/dist/integrations/openai.mjs.map +1 -0
  44. package/package.json +46 -4
  45. package/dist/integrations/openai/index.d.mts +0 -16
  46. package/dist/integrations/openai/index.d.ts +0 -16
  47. package/dist/integrations/openai/index.js +0 -38
  48. package/dist/integrations/openai/index.js.map +0 -1
  49. package/dist/integrations/openai/index.mjs +0 -12
  50. package/dist/integrations/openai/index.mjs.map +0 -1
package/README.md CHANGED
@@ -45,9 +45,18 @@ printf '%s' "$INSTAVM_API_KEY" | instavm auth set-key
45
45
  ```bash
46
46
  instavm whoami
47
47
  instavm ls
48
+ instavm ls -a
49
+ instavm ls --watch
48
50
  instavm create --type computer-use --memory 4096
49
51
  instavm connect vm_123
52
+ instavm deploy
53
+ instavm deploy --plan
50
54
  instavm snapshot ls
55
+ instavm snapshot get <snapshot_id> --watch
56
+ instavm egress get --session <session_id>
57
+ instavm exec --cmd "print('hello from instavm')"
58
+ instavm browser read https://example.com
59
+ instavm browser screenshot https://example.com --out page.png
51
60
  instavm volume ls
52
61
  instavm volume files upload <volume_id> ./README.md --path docs/README.md
53
62
  instavm share create vm_123 3000 --public
@@ -55,23 +64,80 @@ instavm share set-private <share_id>
55
64
  instavm ssh-key list
56
65
  instavm desktop viewer <session_id>
57
66
  instavm doc
58
- instavm billing
67
+ instavm billing portal
68
+ instavm login
69
+ instavm tape ls
70
+ instavm vault list
71
+ instavm desktop recordings ls
59
72
  ```
60
73
 
74
+ `instavm ls` shows active VMs only. Use `-a` or `--all` to include terminated VM records. On ANSI terminals the human-readable list uses colored status badges, and both `instavm ls` and `instavm snapshot get` support `--watch` for periodic refreshes.
75
+
76
+ ### Cookbooks
77
+
78
+ `instavm cookbook` pulls curated starter apps from the public [`instavm/cookbooks`](https://github.com/instavm/cookbooks) catalog, creates a VM, starts the service, creates the share, and returns the public URL.
79
+
80
+ ```bash
81
+ instavm cookbook list
82
+ instavm cookbook info neon-city-webgl
83
+ instavm cookbook deploy neon-city-webgl
84
+ instavm cookbook deploy hello-fastapi
85
+ instavm cookbook deploy my-app --vault vault_a --vault vault_b
86
+ instavm deploy ./app --no-vault
87
+ ```
88
+
89
+ The CLI syncs the cookbook repo into `~/.instavm/cookbooks/`, checks for `git`, `ssh`, `scp`, and `tar`, prompts for any required secrets, and auto-registers a local public SSH key if your account does not already have one.
90
+
91
+ ### Deploy
92
+
93
+ `instavm deploy` tries to deploy the app in the current directory without asking you to create an `instavm.yaml` first. It detects a simple Node.js or Python web app, creates a VM, uploads the project, starts the service, and gives you a share URL.
94
+
95
+ ```bash
96
+ instavm deploy
97
+ instavm deploy --plan
98
+ instavm deploy ./path/to/app
99
+ ```
100
+
101
+ `--plan` shows the detected runtime, install command, start command, port, and secrets without creating a VM.
102
+
103
+ `instavm deploy` is experimental right now. The zero-config path is working best for straightforward Node.js and Python apps. Some runtimes and projects still need follow-up fixes or backend support.
104
+
61
105
  ### Command Reference
62
106
 
63
107
  - `auth`: `set-key`, `status`, `logout`
108
+ - `login`: browser PKCE login (writes profile API key)
64
109
  - `whoami`: show account details and SSH keys
65
- - `create`/`new`, `ls`/`list`, `rm`/`delete`, `clone`, `connect`: core VM workflows
110
+ - `ls`/`list`: show active VMs by default; use `-a` or `--all` for all VM records
111
+ - `cookbook`: `list`, `info`, `deploy` for curated starter apps from `instavm/cookbooks`
112
+ - `deploy`: experimental zero-config deploy for the current app directory
113
+ - `create`/`new`, `rm`/`delete`, `clone`, `connect`: core VM workflows
66
114
  - `snapshot`: `ls`, `create`, `build`, `get`, `rm`
67
- - `desktop`: `status`, `start`, `stop`, `viewer`
115
+ - `egress`: `get`, `set` for VM and session egress policies
116
+ - `exec`: run inline commands, local files, or fetch async task results
117
+ - `browser`: `read`, `screenshot`; `browser session` (`create`, `close`, `ls`); `navigate`, `click`, `type`, `fill`, `scroll`, `wait`, `extract`
118
+ - `desktop`: `status`, `start`, `stop`, `viewer`; `desktop recordings` (`ls`, `get`, `download`, `rm`)
119
+ - `vm`/`vms`: includes `vm update` (memory, snapshot-on-terminate, snapshot name)
120
+ - `tape`: `ls`, `get`, `start`, `stop`, `events`, `diff`, `branch`, `play`, `lanes`, `export`, `rm`
121
+ - `vault` / `secrets` / `secret`: vault CRUD, secrets, services, `setup`, `catalog`, `logs`, `discover`
122
+ - `pty`: attach PTY shell to a VM over WebSocket
123
+ - `billing`: `portal`, `status`, `allocation`, `usage`, `usage-history`, `check`, `rates`, `trends`, `forecast`
68
124
  - `volume`: `ls`, `get`, `create`, `update`, `rm`, `checkpoint`, `files`
69
125
  - `share`: `create`, `set-public`, `set-private`, `revoke`
70
126
  - `ssh-key`: `list`, `add`, `remove`
71
- - `doc`/`docs`, `billing`: docs and billing links
127
+ - `doc`/`docs`: docs links
72
128
 
73
129
  All leaf commands support `--json`. Share visibility updates use `share_id`, which matches the public API.
74
130
 
131
+ Examples:
132
+
133
+ ```bash
134
+ instavm egress set --session <session_id> --no-allow-package-managers --deny-http --domain pypi.org
135
+ instavm exec ./script.py
136
+ instavm exec result <task_id>
137
+ instavm browser read --session <browser_session_id>
138
+ instavm browser screenshot https://example.com --out ./page.png
139
+ ```
140
+
75
141
  ## Library Quick Start
76
142
 
77
143
  ```typescript
@@ -88,13 +154,44 @@ console.log(me.email);
88
154
  console.log(vms.length);
89
155
  ```
90
156
 
157
+ ## Parity with Python `sandbox_client`
158
+
159
+ This package tracks **API and CLI parity** with the official Python distribution **`instavm`** in **[sandbox_client](https://github.com/BandarLabs/sandbox_client)** (baseline **~0.23.0**: `instavm/sandbox_client.py`, `instavm/cli.py`, `instavm/_cookbook.py`). The **npm semver line is independent** of Python’s `pyproject.toml` version—see [Changelog](#changelog).
160
+
161
+ **Naming:** the JS `InstaVM` client uses **camelCase** methods; several Python-style operations are also exposed as thin delegators on `InstaVM` (for example vault helpers) for readability across languages.
162
+
163
+ **Not available in this JS SDK** (by design; tied to the Python ecosystem or deferred):
164
+
165
+ - `instavm.integrations.openai_agents` (`InstaVMSandboxClient`)
166
+ - `instavm.integrations.mounts` (`InstaVMCloudBucketMountStrategy`)
167
+ - `cassette_replay`–style HTTP transports
168
+
169
+ ### Optional LLM integrations
170
+
171
+ Subpath exports match the Python integration modules. Install **optional peers** only for the stack you use:
172
+
173
+ | Import path | Purpose | Typical optional deps |
174
+ |-------------|---------|------------------------|
175
+ | `instavm/integrations/openai` | `getOpenAITools`, `executeToolCall` | none (uses your OpenAI client) |
176
+ | `instavm/integrations/azure-openai` | Same tools + `getSystemPrompt` | — |
177
+ | `instavm/integrations/langchain` | `getLangchainTools()` | `@langchain/core` |
178
+ | `instavm/integrations/llamaindex` | `getLlamaIndexTools()` | `llamaindex`, `zod` |
179
+ | `instavm/integrations/ollama` | `getOllamaTools`, `executeOllamaTool`, `OllamaAgent` | none (uses `fetch` to Ollama) |
180
+
181
+ ```typescript
182
+ import { getOpenAITools, executeToolCall } from 'instavm/integrations/openai';
183
+ ```
184
+
91
185
  ## Table of Contents
92
186
 
93
187
  - [CLI](#cli)
94
188
  - [Auth & Config](#auth--config)
95
189
  - [Common Commands](#common-commands)
190
+ - [Cookbooks](#cookbooks)
191
+ - [Deploy](#deploy)
96
192
  - [Command Reference](#command-reference)
97
193
  - [Library Quick Start](#library-quick-start)
194
+ - [Parity with Python `sandbox_client`](#parity-with-python-sandbox_client)
98
195
  - [Code Execution](#code-execution)
99
196
  - [Cloud Mode](#cloud-mode)
100
197
  - [Local Mode](#local-mode)
@@ -468,12 +565,16 @@ try {
468
565
  ## Development & Testing
469
566
 
470
567
  ```bash
471
- npm install # Install dependencies
472
- npm run test:unit # Unit tests
473
- npm test # Full test suite
474
- npm run build # Build package
568
+ npm install # Install dependencies
569
+ npm run test:unit # Unit tests (includes a repo scan for accidental secret patterns)
570
+ npm run build && npm run test:smoke # After a build: CLI + dist SDK smoke checks
571
+ npm test # Full vitest default suite
572
+ npm run test:e2e # Live API tests — only when INSTAVM_API_KEY is set (see tests/integration/README.md)
573
+ npm run build # Build package
475
574
  ```
476
575
 
576
+ Do **not** commit real API keys or `.env` files. Use placeholders in docs/tests (`your_api_key`, `instavm_sk_test`, `test-api-key`) and keep production keys in environment variables or GitHub Actions **secrets**.
577
+
477
578
  ---
478
579
 
479
580
  ## Further Reading
@@ -489,7 +590,30 @@ npm run build # Build package
489
590
 
490
591
  ## Changelog
491
592
 
492
- Current package version: **0.15.0**
593
+ When checking **SDK / CLI parity** with the official Python client, use a checkout of **[sandbox_client](https://github.com/BandarLabs/sandbox_client)** (for example `~/Documents/projects/sandbox_client` — there is typically no `Documents/project/` path). Treat **`[project] version` in that repo’s `pyproject.toml`** as the API parity baseline. Diff `instavm/sandbox_client.py` and `instavm/cli.py` against this SDK when adding or reviewing APIs.
594
+
595
+ **npm semver is independent** of the Python package version: this JS library advances on its own minor/patch line (for example **0.16.x → 0.17.0**) and does not mirror Python’s `pyproject.toml` version number.
596
+
597
+ Current npm package version: **0.17.0**
598
+
599
+ ### 0.17.0
600
+
601
+ - Broad parity with Python **sandbox_client ~0.23.0**: tapes, vaults, PTY, recordings, credits, session/usage helpers, client-level browser APIs, cookbook/deploy vault flags (`--vault`, `--no-vault`, `--no-setup-vault`), expanded CLI (`login`, `billing`, `tape`, `vault`, `pty`, `vm update`, browser subcommands, `desktop recordings`), and integration entry points (`integrations/openai`, `azure-openai`, `langchain`, `llamaindex`, `ollama`)
602
+ - Added colored VM status badges, `--watch` refreshes for `ls` and `snapshot get`, and snapshot-build spinner coverage (from earlier 0.17 work)
603
+
604
+ ### 0.16.1
605
+
606
+ - Fixed deploy and cookbook uploads through the SSH gateway by forcing legacy SCP mode
607
+
608
+ ### 0.16.0
609
+
610
+ - Expanded CLI docs for `instavm cookbook`
611
+ - Added experimental `instavm deploy` for zero-config app deploys from the current directory
612
+
613
+ ### 0.15.1
614
+
615
+ - `ls` now matches the SSH gateway: active VMs by default, `-a` or `--all` for all VM records
616
+ - `whoami` now uses the live `/v1/users/me` endpoint
493
617
 
494
618
  ### 0.15.0
495
619