@robota-sdk/agent-cli 3.3.0 → 3.3.2

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 (23) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +148 -28
  3. package/dist/node/bin.js +1 -1
  4. package/dist/node/desktop-host.js +1 -1
  5. package/dist/node/headless.js +1 -1
  6. package/dist/node/host.js +1 -1
  7. package/dist/node/index.js +1 -1
  8. package/dist/node/{process-hardening-DLMS7wKO.js → process-hardening-D1loSTNU.js} +408 -408
  9. package/dist/node/{product-host-Dfc3iv7V.js → product-host-f1Ibsm6P.js} +361 -361
  10. package/dist/node/{product-host-Dfc3iv7V.js.map → product-host-f1Ibsm6P.js.map} +1 -1
  11. package/dist/node/{src-CIATEueG-D0Us3rla.js → src-CIATEueG-BHHuA7t6.js} +2 -2
  12. package/dist/node/{src-CIATEueG-D0Us3rla.js.map → src-CIATEueG-BHHuA7t6.js.map} +1 -1
  13. package/dist/node/{src-CIATEueG-6FKmzCHd.js → src-CIATEueG-BzxSXRvB.js} +1 -1
  14. package/dist/node/{src-Da9AIPoA-C0lLeMsE.js → src-Da9AIPoA-B7GMxnSq.js} +2 -2
  15. package/dist/node/{src-Da9AIPoA-C0lLeMsE.js.map → src-Da9AIPoA-B7GMxnSq.js.map} +1 -1
  16. package/dist/node/{src-Da9AIPoA-OTBcxCiO.js → src-Da9AIPoA-CSuDfPiA.js} +1 -1
  17. package/dist/node/{src-DwAfU-9z-CSLE9sQR.js → src-DwAfU-9z-C51c1PTY.js} +1 -1
  18. package/dist/node/{src-DwAfU-9z-3R4kS2fi.js → src-DwAfU-9z-l3MknmH2.js} +2 -2
  19. package/dist/node/{src-DwAfU-9z-3R4kS2fi.js.map → src-DwAfU-9z-l3MknmH2.js.map} +1 -1
  20. package/dist/node/{src-eB41xezu-H4fUs8RS.js → src-eB41xezu-0MT3Iax0.js} +1 -1
  21. package/dist/node/{src-eB41xezu-DPi4q_fo.js → src-eB41xezu-BlX0zgXa.js} +2 -2
  22. package/dist/node/{src-eB41xezu-DPi4q_fo.js.map → src-eB41xezu-BlX0zgXa.js.map} +1 -1
  23. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @robota-sdk/agent-cli
2
2
 
3
+ ## 3.3.2
4
+ ### Patch Changes
5
+
6
+ - 4a7ec1c: `--help` and the errors for a missing or reused HTTP or observer token now name the environment variables the running product accepts (such as `ROBOTA_HTTP_TOKEN`) instead of the canonical `PRODUCT_*` names, which an installed product ignores.
7
+ - 03e7a16: `init` now writes the starter `AGENTS.md`, the project settings and the runtime-data ignore rules in a trusted folder. The stock command refused every time with "requires project mutation permission", because only an embedding host could supply that permission and the CLI never did; a host that supplies its own bounded capability keeps it. On a host that cannot prove a project write stays under the trusted root the write is still refused. `init` also asks before replacing `AGENTS.md` or the project settings when either one already exists, not only when both do; declining, and `--yes`, leave both files as they are.
8
+ - 5ea1361: `--serve --open` in an untrusted folder at a terminal now asks the trust question once. A person who answered "start Restricted" (or whose trust grant could not be recorded) was asked the same question a second time, because the startup check ran twice in a row.
9
+
10
+ ## 3.3.1
11
+ ### Patch Changes
12
+
13
+ - Refresh the package README so the npm page shows the current package layout, install steps and environment variable names.
14
+
3
15
  ## 3.3.0
4
16
  ### Minor Changes
5
17
 
package/README.md CHANGED
@@ -7,11 +7,11 @@ same TypeScript libraries you can embed. It is a coding-capable agent within the
7
7
  direction is [our agents developing and advancing our agents](../../VISION.md). Autonomous
8
8
  self-evolution remains an ambition; the behavior below describes the current CLI. It reads your
9
9
  project, edits files and runs commands under a permission system you control, and works with
10
- Anthropic, OpenAI, Gemini, DeepSeek, Qwen and local OpenAI-compatible models.
10
+ Anthropic, OpenAI, Gemini, DeepSeek, Qwen, OpenRouter and local OpenAI-compatible models.
11
11
 
12
12
  The CLI is assembled from the same packages you can use in your own app: `@robota-sdk/agent-framework`
13
- for the session, `@robota-sdk/agent-ui-terminal` for the terminal UI, and one package per model
14
- provider. To build your own agent rather than use this one, start with the
13
+ for the session, `@robota-sdk/agent-ui-terminal` for the terminal UI, and `@robota-sdk/agent-provider`
14
+ for the model providers. To build your own agent rather than use this one, start with the
15
15
  [SDK guide](../../content/guide/sdk.md).
16
16
 
17
17
  > **Beta.** Behavior may change before the stable release. Please
@@ -26,9 +26,64 @@ npm install -g @robota-sdk/agent-cli # installs the `robota` command
26
26
  npx @robota-sdk/agent-cli # or run it once without installing
27
27
  ```
28
28
 
29
+ Without Node.js, the installer scripts download the standalone binary for your platform (macOS and
30
+ Linux on arm64 or x64, Windows on x64) from the latest GitHub release, verify its SHA-256 and install
31
+ it to `<configured-user-state-dir>/bin`:
32
+
33
+ ```bash
34
+ curl -fsSL https://raw.githubusercontent.com/woojubb/robota/main/scripts/install.sh | bash # macOS and Linux
35
+ irm https://raw.githubusercontent.com/woojubb/robota/main/scripts/install.ps1 | iex # Windows PowerShell
36
+ ```
37
+
29
38
  On macOS, Korean and other CJK input methods can crash inside Terminal.app; use a terminal such as
30
39
  [iTerm2](https://iterm2.com/) instead.
31
40
 
41
+ ## Build a separate product from npm packages
42
+
43
+ An application can depend on the published `@robota-sdk/agent-cli` and
44
+ `@robota-sdk/product-config` packages, and own its entry, identity, assets and packaging. The
45
+ `/host` entry binds one executable to a build-fixed, non-secret identity. It is separate from the
46
+ installed `robota` binary; direct `startCli`/`startCliEntry` calls to that binary still enforce its
47
+ embedded identity. Supply a literal identity produced by `embeddedProductIdentity` from an explicit
48
+ build config. The host validates and snapshots it before any session starts.
49
+
50
+ ```ts
51
+ import { createProductCliHost } from '@robota-sdk/agent-cli/host';
52
+ import { productIdentity } from './product-identity.js';
53
+ import { productVersion } from './product-version.js';
54
+
55
+ const host = createProductCliHost({
56
+ identity: productIdentity,
57
+ version: productVersion,
58
+ update: false,
59
+ // webRoot: absolute path to this product's built browser assets, when --serve --open is used
60
+ });
61
+ await host.run();
62
+ ```
63
+
64
+ The same entry must run for ordinary invocations, daemon starts and self-forked workers. The host
65
+ derives separate state, cache and log roots from its identity unless `runtimeDefaults` supplies
66
+ validated home-relative paths. Operational settings remain selected at invocation time. Update
67
+ checks are disabled unless the artifact explicitly supplies its own npm package and registry.
68
+ Omitted `sourceVersion` uses the consumer artifact version; omitted build metadata is null.
69
+
70
+ `@robota-sdk/agent-cli/desktop-host` provides trust admission, a curated CLI child environment,
71
+ daemon start/reconnect, strict loopback endpoint parsing and a matching CSP. The consumer's Electron
72
+ main process owns the window, native trust prompt, child-process execution and CSP installation;
73
+ its preload owns IPC, and its renderer uses `@robota-sdk/agent-ui-web/client`. The desktop helper
74
+ returns an endpoint only after the CLI has answered the trust and daemon commands. The consumer
75
+ packages its own renderer files and the same product-bound CLI entry as the sidecar.
76
+
77
+ `@robota-sdk/agent-cli/native-build` exports `buildProductNativeBinary` for host-matching Bun
78
+ builds (this repository builds with Bun 1.4.2) from an absolute consumer entry. It qualifies Koffi's installed native addon before
79
+ compiling and requires an absolute consumer-maintained third-party notices file, which it copies
80
+ beside the binary. Native addon builds require a matching macOS, Linux or Windows host; a compiled
81
+ binary re-enters its embedded entry for workers and the daemon. The caller owns signing and desktop
82
+ packaging. The browser asset root, when provided, must be an absolute directory packaged by the
83
+ consumer; a consumer host without one does not serve the SDK's built-in monitor assets.
84
+ Install `e2b@2.51.0` alongside the CLI before calling the native builder. Native compilation embeds
85
+ the complete hosted capability, including E2B; the resulting binary needs no adjacent SDK package.
86
+
32
87
  ## First run
33
88
 
34
89
  Run `robota` inside a Git repository. It first asks whether to trust the folder: only a trusted
@@ -96,8 +151,9 @@ a schema, and `--system-prompt` / `--append-system-prompt` change the system pro
96
151
  exit code is `0` on success and `1` on an error; `-p` exits `3` when no usable provider is
97
152
  configured, and a `--goal` run that stops without reaching its goal exits `2`. In a Git repository
98
153
  you have not trusted, print mode, `--goal`, `--serve`, `robota mcp serve`, `robota daemon start` and
99
- `robota session start` refuse to start; with `--safe-mode` the first four run Restricted instead, and
100
- `robota daemon start --restricted-workspace` starts the daemon Restricted.
154
+ `robota session start` refuse to start; with `--safe-mode` or `--restricted-workspace` the first four
155
+ run Restricted instead, and `robota daemon start --restricted-workspace` and
156
+ `robota session start --restricted-workspace` start Restricted.
101
157
 
102
158
  ### Keep sessions, run them in the background, share a daemon
103
159
 
@@ -160,14 +216,28 @@ in any mode: `rm` on the root, home or working directory, and writes into `.git`
160
216
 
161
217
  Shell commands can also run inside an OS sandbox (bubblewrap on Linux, Seatbelt on macOS): `/sandbox`
162
218
  switches between `auto-allow`, `regular` and `off`, and the `sandbox` settings key configures it.
219
+ A confined command cannot read the credential-bearing files under `<configured-user-state-dir>`
220
+ (`settings.json`, `credentials/`, `mcp-credentials/`, `remote-host-identity.json`, `secure/`,
221
+ `secure-v1/`).
222
+
223
+ Commands the agent runs (tools, hooks, background shells, a skill's `!` commands, MCP header
224
+ helpers) do not inherit the variables your provider profiles use as credentials — `$ENV:` references
225
+ and each provider's default key variable such as `OPENAI_API_KEY`; the runtime still authenticates
226
+ with them. To let commands see one, list it in your user settings:
227
+ `"commandEnvAllow": ["OPENAI_API_KEY"]` (project settings cannot do this). A variable you reference
228
+ explicitly in an MCP server definition still resolves. A `$ENV:` reference added during a session is
229
+ withheld from the next start.
230
+
163
231
  When something misbehaves, `robota --safe-mode` starts with instruction files, skills, plugins, hooks
164
232
  and MCP servers all off.
165
233
 
166
- Workspace trust is granted per Git worktree and kept in `<configured-user-state-dir>/workspace-trust.json`:
234
+ The trust manager holds approval for the exact folder while it runs. Reopening the CLI does not
235
+ require another approval, but restarting the manager or computer does. The
236
+ `<configured-user-state-dir>/workspace-trust.json` file records history and does not restore approval:
167
237
 
168
238
  ```bash
169
239
  robota trust status # is this workspace trusted, and what would trust load? (--json: one line)
170
- robota trust --yes # trust the Git workspace you are in
240
+ robota trust --yes # request trust for this folder; confirm at the terminal
171
241
  robota trust revoke --yes
172
242
  ```
173
243
 
@@ -176,8 +246,8 @@ See [Permissions and hooks](../../content/guide/permissions-and-hooks.md).
176
246
  ### Choose providers and models
177
247
 
178
248
  Each provider profile in `providers` names a `type` (`anthropic`, `openai`, `gemini`, `deepseek`,
179
- `qwen`, `gemma`), a model, and optionally a base URL and API key; `currentProvider` picks the one to
180
- use. Setup fills the key in as a reference to an environment variable:
249
+ `qwen`, `gemma`, `openrouter`), a model, and optionally a base URL and API key; `currentProvider`
250
+ picks the one to use. Setup fills the key in as a reference to an environment variable:
181
251
 
182
252
  | Provider type | Default key variable | Notes |
183
253
  | ------------- | -------------------- | ------------------------------------------------------------------------------------ |
@@ -187,6 +257,7 @@ use. Setup fills the key in as a reference to an environment variable:
187
257
  | `deepseek` | `DEEPSEEK_API_KEY` | |
188
258
  | `qwen` | `DASHSCOPE_API_KEY` | Alibaba Cloud Model Studio |
189
259
  | `gemma` | none | a local Gemma model; the base URL defaults to LM Studio's `http://localhost:1234/v1` |
260
+ | `openrouter` | `OPENROUTER_API_KEY` | connect in the browser (`/provider add openrouter`) or with an API key |
190
261
 
191
262
  ```json
192
263
  {
@@ -331,7 +402,7 @@ daemon; it is not published to npm. See [The GUI and the Desktop App](../../cont
331
402
 
332
403
  `robota --serve --http-port <port>` also serves the agent over HTTP on `127.0.0.1:<port>`, so another
333
404
  application or service can use it without a Robota client library. Every request presents the
334
- bearer you choose in `PRODUCT_HTTP_TOKEN` (at least 32 characters); the runtime removes it from its
405
+ bearer you choose in `ROBOTA_HTTP_TOKEN` (at least 32 characters); the runtime removes it from its
335
406
  environment, so the commands it runs do not inherit it. A command running as the same OS user can
336
407
  still read the server's launch environment unless the OS sandbox confines it (or the server runs
337
408
  as a separate user), so enable the sandbox on a server. With the bearer it binds loopback only.
@@ -339,24 +410,24 @@ as a separate user), so enable the sandbox on a server. With the bearer it binds
339
410
  To reach it from elsewhere, either put your own reverse proxy or tunnel in front, or serve it as an
340
411
  OAuth resource server, the same way `robota mcp serve` does: give `--http-public-url`, `--oauth-issuer`,
341
412
  `--oauth-scopes` and `--oauth-allowed-subjects` (optionally `--http-host <ip>` and `--trusted-proxy`)
342
- and no `PRODUCT_HTTP_TOKEN`. Clients then present access tokens from that issuer whose audience is the
413
+ and no `ROBOTA_HTTP_TOKEN`. Clients then present access tokens from that issuer whose audience is the
343
414
  public URL, which carry the scopes and name an allowed subject. The routes below are served under the
344
415
  public URL's path, and its RFC 9728 metadata at `/.well-known/oauth-protected-resource<path>`.
345
416
 
346
417
  ```bash
347
- PRODUCT_HTTP_TOKEN="$(openssl rand -hex 32)" robota --serve --http-port 8787
418
+ ROBOTA_HTTP_TOKEN="$(openssl rand -hex 32)" robota --serve --http-port 8787
348
419
  robota --serve --http-port 8787 --http-host 0.0.0.0 \
349
420
  --http-public-url https://agents.example.com/agent --oauth-issuer https://auth.example.com \
350
421
  --oauth-scopes agent.run --oauth-allowed-subjects client-a
351
422
  ```
352
423
 
353
- | Request | Does |
354
- | --- | --- |
424
+ | Request | Does |
425
+ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
355
426
  | `POST /submit` `{"prompt": "...", "receivePrompts"?: true}` | Runs a turn and streams it as SSE (`text_delta`, `complete`, `error`; with `receivePrompts`, also `permission_request`, `ask_request`, `prompt_resolved`); `409` while a turn is running |
356
- | `GET /prompts` · `POST /prompts/<id>` `{"result": true}` | Lists the open permission/ask prompts · answers one (`{"response": ...}` for an ask) |
357
- | `POST /command` `{"name": "help", "args": ""}` | Runs a slash command |
358
- | `POST /abort` · `POST /cancel-queue` | Aborts the running turn · drops the queued prompt |
359
- | `GET /messages` · `/context` · `/executing` · `/pending` | Reads the conversation and its state |
427
+ | `GET /prompts` · `POST /prompts/<id>` `{"result": true}` | Lists the open permission/ask prompts · answers one (`{"response": ...}` for an ask) |
428
+ | `POST /command` `{"name": "help", "args": ""}` | Runs a slash command |
429
+ | `POST /abort` · `POST /cancel-queue` | Aborts the running turn · drops the queued prompt |
430
+ | `GET /messages` · `/context` · `/executing` · `/pending` | Reads the conversation and its state |
360
431
 
361
432
  A client that submits with `receivePrompts: true` answers the permission and ask prompts its turn
362
433
  raises; without it, a question no other client answers is denied, so choose the permission mode and
@@ -372,15 +443,15 @@ would. See [Editors](../../content/guide/cli.md#editors-agent-client-protocol).
372
443
 
373
444
  `robota --serve --observer-port <port>` also opens a second WebSocket listener on
374
445
  `127.0.0.1:<port>` that only watches. It has its own token, which you choose in
375
- `PRODUCT_OBSERVER_TOKEN` (at least 32 characters); nothing is minted, and the runtime prints only
446
+ `ROBOTA_OBSERVER_TOKEN` (at least 32 characters); nothing is minted, and the runtime prints only
376
447
  `Observer listening on ws://127.0.0.1:<port> (read-only)` on stderr. A client presents the token as
377
448
  `?token=` or as the WebSocket subprotocol, as on the driver listener. The token and the port must
378
- differ from the driver listener's and from `PRODUCT_HTTP_TOKEN` and `--http-port`: a shared
449
+ differ from the driver listener's and from `ROBOTA_HTTP_TOKEN` and `--http-port`: a shared
379
450
  credential would let the holder of the read-only token drive through the other listener. A busy
380
451
  port fails the start instead of moving to the next one.
381
452
 
382
453
  ```bash
383
- PRODUCT_OBSERVER_TOKEN="$(openssl rand -hex 32)" robota --serve --observer-port 7171
454
+ ROBOTA_OBSERVER_TOKEN="$(openssl rand -hex 32)" robota --serve --observer-port 7171
384
455
  ```
385
456
 
386
457
  An observer reads the session's conversation and state and the host's list of sessions. It cannot
@@ -411,6 +482,8 @@ robota secure setup # create the keyring; the recovery key is shown
411
482
  robota secure status # the keyring file, its slots and its key fingerprint (no passphrase)
412
483
  robota secure verify # unlock and check the stored key (--recovery: use the recovery key)
413
484
  robota secure change-passphrase # set a new passphrase (--recovery: reset a forgotten one)
485
+ robota secure enable # migrate existing conversations, then turn secure mode on
486
+ robota secure disable # turn secure mode off for new conversations
414
487
  ```
415
488
 
416
489
  The passphrase and the recovery key are typed at the terminal when asked, never given as an argument
@@ -420,6 +493,20 @@ so the passphrase (at least 12 characters, not one short pattern repeated) is wh
420
493
  keyring file is the only copy of your keys, and changing the passphrase does not lock out a copy
421
494
  someone already took. Creating a keyring does not by itself change how sessions are saved.
422
495
 
496
+ Secure conversations are optional. After `secure setup`, run `secure enable` at an interactive
497
+ terminal with all Robota sessions closed. It verifies the keyring, migrates supported existing
498
+ conversation data, and refuses activation if plaintext conversation data remains. Resolve anything
499
+ it reports before trying again; it never silently discards a conversation or a forked worktree.
500
+ Secure CLI conversations are available on macOS and Linux. Windows keeps plaintext
501
+ CLI conversations; `secure enable` and secure session startup refuse there. Secure desktop
502
+ conversations are available on macOS.
503
+ While secure mode is on, new conversations use the dedicated `secure-v1` storage area. The desktop
504
+ app requires **File → Unlock Secure Conversation…** after opening; closing or reloading its window
505
+ locks the session and discards unsent drafts and attachment paths. `secure disable` requires terminal
506
+ confirmation and all current-version sessions to exit. New conversations then use plaintext storage;
507
+ the sealed archive and keyring stay in place. Do not run an older Robota version against this state
508
+ while secure mode is on: older versions cannot honor the secure mode choice.
509
+
423
510
  ### Check your setup and usage
424
511
 
425
512
  ```bash
@@ -447,25 +534,39 @@ Other files the CLI keeps under `<configured-user-state-dir>/`:
447
534
 
448
535
  | Path | Contents |
449
536
  | ---------------------- | ---------------------------------------------------------------------------------------------- |
450
- | `workspace-trust.json` | workspaces you have trusted |
537
+ | `workspace-trust.json` | approval history; live grants stay with the trust manager |
451
538
  | `sessions/` | saved sessions (a trusted project may keep them in `<configured-project-state-dir>/sessions/`) |
452
539
  | `history.jsonl` | prompts you typed, for `Ctrl+R` (`"promptHistory": false` turns it off) |
453
540
  | `keybindings.json` | key bindings |
454
541
  | `themes/` | your own `/theme` themes |
455
542
  | `plugins/` | installed plugins (a project may have its own `<configured-project-state-dir>/plugins/`) |
456
543
  | `mcp-credentials/` | OAuth tokens for MCP servers, readable by you only |
457
- | `secure/keyring.json` | your keyring for secure conversations, protected by your passphrase and recovery key |
544
+ | `secure/keyring.json` | your keyring for secure conversations, protected by your passphrase and recovery key |
458
545
 
459
546
  ## Use it from code
460
547
 
461
- The package also exports `startCli`, the function the `robota` executable runs, and its options
462
- type `IStartCliOptions`. The package is ESM-only: load it with `import`, not `require()`.
548
+ The package exports `startCliEntry`, the complete entry the executable runs, and its options
549
+ type `IStartCliOptions`. It installs configured diagnostics, the interactive crash policy and
550
+ startup error handling, then calls `startCli`. Use `startCli` directly when the host owns those
551
+ process policies. The package is ESM-only: load it with `import`, not `require()`.
463
552
 
464
553
  A subagent runs in a child process that starts your entry script again with a worker flag; when
465
- `startCli()` sees that flag it runs the subagent instead of the CLI, and the returned promise never
466
- settles (the worker ends the process). So call `startCli()` from the script Node started, and put
554
+ `startCliEntry()` or `startCli()` sees that flag it runs the subagent instead of the CLI, and the
555
+ returned promise never settles (the worker ends the process). Call the entry from the script Node
556
+ started, and put
467
557
  nothing before it that must not run once per subagent.
468
558
 
559
+ The ordinary built-in entry keeps its own identity when another product's canonical variables are
560
+ present. Installed entries accept canonical operational values only with a matching `PRODUCT_ID`;
561
+ product-prefixed aliases and explicit host file selection remain available. The unembedded library's
562
+ explicit `environment`, `productConfig`, or `productConfigFile` options are host construction inputs.
563
+ Before execution, product variables in the process environment are replaced by the resolved
564
+ invocation so spawned tools and workers inherit that product. Embedding hosts that run multiple
565
+ invocations must keep and pass their own environment snapshots.
566
+
567
+ A headless Restricted start reports its ignored configured project settings files on stderr.
568
+ An untrusted refusal names the configured `<cli> trust --yes` command.
569
+
469
570
  ### Hosted task-worker execution
470
571
 
471
572
  The library also exports `HostedOrganizationControl` and `createHostedOrganizationGateway` for
@@ -506,7 +607,26 @@ while physical containment, provider billing and independent remote custody requ
506
607
  measurements.
507
608
 
508
609
  Hosted posture requires current signed admission for a separate task worker and company broker.
509
- The installed E2B executor runs the stock CLI inside that worker. The runtime forwards arguments,
610
+ The stock E2B executor is an explicitly installed capability for the npm/Node CLI. Local npm
611
+ installation does not install or load the E2B SDK. Enable stock hosting in the same project:
612
+
613
+ ```sh
614
+ npm install @robota-sdk/agent-cli e2b@2.51.0
615
+ ```
616
+
617
+ For a global CLI installation, install both into the same global prefix:
618
+
619
+ ```sh
620
+ npm install --global @robota-sdk/agent-cli e2b@2.51.0
621
+ ```
622
+
623
+ Existing E2B helpers remain exported from the CLI package; their asynchronous provider operations
624
+ require that explicit SDK installation. A missing SDK refuses stock hosted startup before admission
625
+ requests, with installation guidance, and never runs the task on the host. A host supplying its own
626
+ `hostedRuntimeExecutorFactory` does not need E2B. Stock standalone full/headless binaries and the
627
+ desktop's bundled runtime embed E2B support.
628
+
629
+ The executor runs the stock CLI inside the admitted worker. The runtime forwards arguments,
510
630
  input and output and owns cancellation, credential expiry and provider deletion; it does not run
511
631
  task tools against its own filesystem. Direct `--api-key` configuration is refused.
512
632
 
package/dist/node/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  ;(function(){var v=parseInt(process.versions.node.split('.')[0],10);if(v<22){process.stderr.write('\n✗ Node.js 22+ is required (current: '+process.version+')\n\nUpgrade:\n nvm: nvm install 22 && nvm use 22\n Volta: volta install node@22\n Download: https://nodejs.org/en/download\n\n');process.exit(1);}})();
3
- import{_ as e}from"./node-JgR00lP7.js";import{A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,K as u,L as d,M as f,N as p,O as m,P as h,R as g,S as _,T as v,U as y,V as b,W as x,b as ee,d as te,f as S,g as C,h as w,j as T,k as E,m as D,n as O,p as k,t as A,v as j,w as M,x as N,y as P,z as F}from"./process-hardening-DLMS7wKO.js";import{join as I}from"node:path";let L=null,R=!1,z=`robota`;function B(){return R}const ne=[`string-width`,`setCursorPosition`,`getStringWidth`,`slice`,`charCodeAt`];function V(e,t){if(!t)return`rethrow`;let n=e.message??``;return ne.some(e=>n.includes(e))?`ime-hint`:`guard-owned`}function H(e){L=e}function U(e,t){try{if(L){L.getSession().reportBackgroundError(e,t);return}}catch{}process.stderr.write(`\n[${z}] ${t}: ${e.message}\n`)}function W(e=`robota`){z=e,!R&&(R=!0,process.on(`unhandledRejection`,e=>{U(e instanceof Error?e:Error(String(e)),`unhandled rejection`)}),process.on(`uncaughtException`,e=>{U(e instanceof Error?e:Error(String(e)),`uncaught exception`)}))}let G=!1,K=`CLI`;function q(e){return`\n[${e}] CJK/IME input error — this is a known issue with macOS Terminal.app.\n Workaround: use iTerm2 (https://iterm2.com) or input your prompt in English.
3
+ import{_ as e}from"./node-JgR00lP7.js";import{A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,K as u,L as d,M as f,N as p,O as m,P as h,R as g,S as _,T as v,U as y,V as b,W as x,b as ee,d as te,f as S,g as C,h as w,j as T,k as E,m as D,n as O,p as k,t as A,v as j,w as M,x as N,y as P,z as F}from"./process-hardening-D1loSTNU.js";import{join as I}from"node:path";let L=null,R=!1,z=`robota`;function B(){return R}const ne=[`string-width`,`setCursorPosition`,`getStringWidth`,`slice`,`charCodeAt`];function V(e,t){if(!t)return`rethrow`;let n=e.message??``;return ne.some(e=>n.includes(e))?`ime-hint`:`guard-owned`}function H(e){L=e}function U(e,t){try{if(L){L.getSession().reportBackgroundError(e,t);return}}catch{}process.stderr.write(`\n[${z}] ${t}: ${e.message}\n`)}function W(e=`robota`){z=e,!R&&(R=!0,process.on(`unhandledRejection`,e=>{U(e instanceof Error?e:Error(String(e)),`unhandled rejection`)}),process.on(`uncaughtException`,e=>{U(e instanceof Error?e:Error(String(e)),`uncaught exception`)}))}let G=!1,K=`CLI`;function q(e){return`\n[${e}] CJK/IME input error — this is a known issue with macOS Terminal.app.\n Workaround: use iTerm2 (https://iterm2.com) or input your prompt in English.
4
4
  Alternatively, use headless mode: -p "your prompt here"
5
5
 
6
6
  `}function J(t){K=t,!G&&(G=!0,process.on(`uncaughtException`,t=>{let n=V(t,B());if(n===`ime-hint`){process.stderr.write(q(K));return}if(n!==`guard-owned`)throw e(),t}))}function Y(e){if(e===`1`)return!0;if(e===`0`)return!1}function X(e){if(e.flag!==void 0)return{reducedMotion:e.flag,override:`flag`};let t=Y(e.env);return t===void 0?{reducedMotion:e.settings}:{reducedMotion:t,override:`environment`}}function Z(e,t,r){let i=n(e??{}),a=X({settings:i.reducedMotion,flag:t,env:r.PRODUCT_REDUCED_MOTION});return{appearance:i,reducedMotion:a.reducedMotion,...a.override===void 0?{}:{reducedMotionOverride:a.override}}}const Q=RegExp(`^[A-Za-z0-9._-]{1,24}$`,`u`);function re(e,t,n){return e.listDirectory(t,n).filter(e=>e.kind===`file`&&e.name.endsWith(`.json`)).map(r=>({fileName:r.name,text:e.readText(I(t,r.name),n)}))}function $(e,t){let n=`load ${t.source} themes`,r=s(t.root);for(let i of re(r,t.directory,n)){let n=i.fileName.slice(0,-5);if(!Q.test(n)){let n=p(i.fileName);e.skipped.push({id:`${t.idPrefix}${n}`,fileName:m(i.fileName),reason:`$: the file name ${n} cannot be a theme id — use at most 24 characters from letters, digits, dot, dash and underscore`});continue}let r=`${t.idPrefix}${n}`;if(e.claimed.has(r)){e.skipped.push({id:r,fileName:i.fileName,reason:`$: the id "${r}" is already taken by a theme loaded earlier`});continue}if(i.text===void 0){e.skipped.push({id:r,fileName:i.fileName,reason:`$: the file could not be read`});continue}let a=v({id:r,fileName:i.fileName,source:t.source,text:i.text});a.ok?(e.claimed.add(r),e.themes.push(a.theme)):e.skipped.push({id:r,fileName:i.fileName,reason:a.error})}}function ie(e,t,n,r){let i=ee(e,t,r);try{return b(i,{settingsPath:N(t),fs:new c}).map(e=>({name:e.manifest.name,pluginDir:e.pluginDir}))}catch(e){let t=M(i.join(`, `)),r=M(e instanceof Error?e.message:String(e));return n.skipped.push({id:`custom:<plugins>`,fileName:t,reason:`$: the plugin scopes could not be read — ${r}`}),[]}}function ae(e){let t={themes:[],skipped:[],claimed:new Set};$(t,{root:e.productRuntime.layout.userRoot,directory:`themes`,source:`user`,idPrefix:`custom:`});let n=e.plugins??ie(e.cwd,e.productRuntime,t,e.projectAccess);for(let e of n){if(!Q.test(e.name)){let n=p(e.name);t.skipped.push({id:`custom:${n}`,fileName:m(e.name),reason:`$: the plugin name ${n} cannot be part of a theme id — its themes are not loaded`});continue}$(t,{root:e.pluginDir,directory:`themes`,source:`plugin`,idPrefix:`custom:${e.name}:`})}return{themes:t.themes,skipped:t.skipped}}function oe(e){let t=Z(e.settings,e.reducedMotionFlag,e.env),n={reducedMotion:t.reducedMotion,...t.reducedMotionOverride===void 0?{}:{reducedMotionOverride:t.reducedMotionOverride}};if(!e.enabled)return{registry:void 0,cataloguePort:void 0,skipped:[],...n};let i=ae({cwd:e.cwd,productRuntime:e.productRuntime,userHome:e.userHome,...e.projectAccess===void 0?{}:{projectAccess:e.projectAccess}}),a=E([...r(),...i.themes],i.skipped);return{registry:a,cataloguePort:_({registry:a,readAppearance:()=>Z(y(N(e.productRuntime)),void 0,{}).appearance,...t.reducedMotionOverride===void 0?{}:{reducedMotionPin:{tier:t.reducedMotionOverride,reducedMotion:t.reducedMotion}}}),skipped:i.skipped,...n}}async function se(e={}){let n=P(e);l(n,process.argv),o(n),h(n);let r={...e,productRuntime:n};return F(D(process.argv))?(j(n.environment),g(te(n)),new Promise(()=>void 0)):O(r,x({createDefaultTools:S}),u,{renderApp:a,renderSupervisedSessionView:t,renderAttachedApp:i,createDefaultTuiCliAdapter:T,createNodeKeybindingsSource:f,createThemeSurface:oe,installTuiProcessGuards:W,setLiveChannel:H})}async function ce(e={}){try{let t=process.argv.length-4;if(t>=1&&process.argv[t]===`--internal-root-broker`&&process.argv[t+1]!==void 0){await C(w[`control-socket`],P(e),()=>k(process.argv[t+1],process.argv[t+2],process.argv[t+3])),process.send?.(`ready`);return}let n=P(e);d(n.config.identity.cliName),J(n.config.identity.cliName),await se({...e,productRuntime:n})}catch(e){process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),F(D(process.argv))?process.exitCode=1:process.exit(1)}}A(),ce();export{};
@@ -1,2 +1,2 @@
1
- import{G as e,H as t,J as n,K as r,S as i,U as a,W as o,Y as s,a as c,b as l,c as u,d,i as f,l as p,o as m,q as h,s as g,t as _,u as v,x as y}from"./product-host-Dfc3iv7V.js";import{realpathSync as b}from"node:fs";import{join as x}from"node:path";function S(e){return t(e.storage.userRoot)}async function C(e){if(S(e.config)!==`secure`)throw Error(`Secure conversations are not active for this product state.`);if(e.signal.aborted)throw Error(`The desktop window is no longer available.`);let t=b(e.workspace),r=g(t);if(e.restricted&&!e.restrictedHold)throw Error(`A live native Restricted folder choice is required.`);let i=a(e.config,e.environment,void 0,`secure`),o=h({path:i.layout.userPaths.keyring,root:i.layout.userRoot}),_=o.load();if(_.status!==`present`)throw Error(`The secure conversation keyring is missing.`);let y=s(_.keyring),x=e.secret.type===`passphrase`?{type:`passphrase`,passphrase:e.secret.value}:{type:`recoveryKey`,recoveryKey:e.secret.value},C=await n(_.keyring,x),w;try{w=new u(r,await l(i),!e.restricted,e.restrictedHold);let n=o.load();if(e.signal.aborted||S(e.config)!==`secure`||n.status!==`present`||s(n.keyring)!==y)throw Error(`The secure conversation choice or keyring changed during unlock.`);let a=d(i),h=await p(t,a,{cliName:i.vocabulary.cliName}),g;try{if(e.signal.aborted)throw Error(`The desktop window is no longer available.`);let n=await f({root:a,workspace:t,candidates:await v(a,void 0,{includeGeneration:!0}),handover:C});if(n){if(n.restricted===!0!==e.restricted)throw Error(`The secure daemon uses a different workspace access choice.`);g={id:n.id,generation:n.generation}}else{if(e.signal.aborted)throw Error(`The desktop window is no longer available.`);g=await c(t,{productRuntime:i,root:a,env:e.childEnvironment,handover:C,daemonRole:!0,launchCommand:e.launchCommand,...e.restricted?{restricted:!0}:{}})}}finally{h()}if(e.signal.aborted)throw Error(`The desktop window is no longer available.`);let{link:_,grantNeeded:b}=await m({root:a,...g,handover:C,signal:e.signal});if(e.signal.aborted)throw _.close(),Error(`The desktop window is no longer available.`);try{let e=await _.control({command:`workspace-root-proof`,fields:{}}),t=w.proof();if(e.status!==`root-proof`||e.tag!==t.tag||e.generation!==t.generation||e.trustTag!==t.trustTag)throw Error(`The secure runtime workspace root does not match the desktop root.`);if((await _.control({command:`desktop-activity-mode`,fields:{}})).status!==`native`)throw Error(`The runtime did not accept native desktop activity.`)}catch(e){throw _.close(),e}return{link:_,grantNeeded:b,selected:{runtimeId:g.id,generation:g.generation},assertWorkspace:()=>w?.assertCurrent(),release:()=>{try{w?.close()}finally{C.dispose()}}}}catch(e){try{w?.close()}finally{C.dispose()}throw e}}async function w(e,t,n,r){return(await i(y(a(e,t)),{op:`approve`,candidate:r,root:n.folder})).status===`trusted`}const T=(e,t)=>y(a(e,t));async function E(e,t,n){let r=await i(T(e,t),{op:`prepare`,root:n});return r.status===`prepared`?r.candidate:void 0}async function D(e,t,n,r){let a=await i(T(e,t),{op:`retainRestricted`,root:n,candidate:r});return a.status===`restricted-held`?a.hold:void 0}async function O(e,t,n,r){let a=await i(T(e,t),{op:`assertRestricted`,root:n,hold:r});if(a.status!==`restricted-root`)throw Error(`The Restricted folder changed after approval.`);return a.tag}async function k(e,t,n){if((await i(T(e,t),{op:`releaseRestricted`,hold:n})).status!==`released`)throw Error(`The Restricted folder hold could not be released.`)}const A=[`PATH`,`HOME`,`USERPROFILE`,`SystemRoot`,`TEMP`,`TMP`,`LANG`,`LC_ALL`,`XDG_RUNTIME_DIR`,`DISPLAY`,`WAYLAND_DISPLAY`,`XAUTHORITY`,`DBUS_SESSION_BUS_ADDRESS`,`APPDATA`,`LOCALAPPDATA`,`PROGRAMDATA`],j=/^ws:\/\/127\.0\.0\.1:([0-9]{1,5})\/?\?token=([A-Za-z0-9%._~-]+)$/u;function M(e){let t=e.split(/\r?\n/u).filter(e=>e.trim()!==``);if(t.length===1)try{let e=JSON.parse(t[0]);return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}catch{return}}function N(e){let t=M(e);if(t===void 0)return;let n=t.providerEnvRefs;if(!(n!==void 0&&(!Array.isArray(n)||n.length>128||!n.every(e=>typeof e==`string`&&/^[A-Za-z_][A-Za-z0-9_]*$/u.test(e))))){if(t.state===`trusted`)return t.askable===!1?{trusted:!0,providerEnvRefs:Object.freeze([...new Set(n??[])])}:void 0;if(t.askable===!0&&typeof t.workspace==`string`&&t.workspace.trim()!==``){let e=Array.isArray(t.loads)?t.loads.filter(e=>typeof e==`string`):[];return{trusted:!1,question:{folder:t.workspace,loads:e.slice(0,64)},...typeof t.candidate==`string`?{candidate:t.candidate}:{},providerEnvRefs:[]}}return{trusted:!1,providerEnvRefs:[]}}}function P(e){let t=M(e);if(typeof t?.id!=`string`||t.id.trim()===``||typeof t.url!=`string`)return;let n=j.exec(t.url);if(!n)return;let r=Number(n[1]);return Number.isInteger(r)&&r>0&&r<=65535?{id:t.id,url:t.url,port:r}:void 0}function F(e){return`default-src 'self'; connect-src ${e===void 0?`'none'`:`ws://127.0.0.1:${e}`}; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'`}function I(t){let n=Object.freeze({...t.environment}),i=_(t.artifact).resolveRuntime({environment:n}).config,a=r(n,o(i)),s=null,c=null,l,u=!1,d=(t=[])=>{let n={};for(let e of A)a[e]!==void 0&&(n[e]=a[e]);for(let e of t)a[e]!==void 0&&(n[e]=a[e]);for(let{section:t,field:r,descriptor:a}of e()){if(a.exposure===`private`||!a.consumers.includes(`cli`))continue;let e=i[t][r];e!==void 0&&(n[a.variable]=typeof e==`string`?e:JSON.stringify(e))}return a.PRODUCT_CONFIG_FILE!==void 0&&(n.PRODUCT_CONFIG_FILE=a.PRODUCT_CONFIG_FILE),n};async function f(){let e=[],r=u?void 0:await t.execute([`trust`,`status`,`--json`],d()),a=r?.exitCode===0?N(r.stdout):void 0;if(!u&&a?.question!==void 0){let r=await t.chooseTrust(a.question);if(r!==`trust`&&r!==`restricted`&&r!==`quit`)return{ok:!1,detail:`Desktop trust answer was invalid.`};if(r===`quit`)return{ok:!1,detail:`Desktop launch cancelled.`};if(r===`restricted`&&(u=!0),r===`trust`){if(a.candidate===void 0)return{ok:!1,detail:`The prepared workspace approval is unavailable.`};if(!(t.approveTrust===void 0?await w(i,n,a.question,a.candidate):await t.approveTrust(a.question.folder,a.candidate)))return{ok:!1,detail:`Workspace trust grant failed.`};let r=await t.execute([`trust`,`status`,`--json`],d()),o=r.exitCode===0?N(r.stdout):void 0;if(o?.trusted!==!0)return{ok:!1,detail:`Workspace trust could not be confirmed after grant.`};e=o.providerEnvRefs}}else e=a?.providerEnvRefs??[];let o=await t.execute([`daemon`,`start`,`--json`,...u?[`--restricted-workspace`]:[]],d(u?[]:e)),s=o.exitCode===0?P(o.stdout):void 0;return s===void 0?{ok:!1,detail:o.stderr.trim()||`Desktop daemon did not return a loopback endpoint.`}:{ok:!0,endpoint:s}}let p=()=>{if(c!==null)return c;let e=f().then(e=>(l=e.ok?e.endpoint.port:void 0,c=null,e),e=>{throw l=void 0,c=null,e});return s=c=e,e};return Object.freeze({config:i,userDataPath:x(i.storage.userRoot,`desktop`),start:p,reconnect:p,current:()=>s,port:()=>l,csp:()=>F(l)})}export{w as approveDesktopTrustCandidate,O as assertDesktopRestrictedRoot,I as createDesktopCliController,F as desktopContentSecurityPolicy,S as desktopConversationMode,C as openDesktopSecureOwner,P as parseDesktopDaemonStart,N as parseDesktopTrustStatus,E as prepareDesktopRestrictedRoot,k as releaseDesktopRestrictedRoot,D as retainDesktopRestrictedRoot};
1
+ import{G as e,H as t,J as n,K as r,S as i,U as a,W as o,Y as s,a as c,b as l,c as u,d,i as f,l as p,o as m,q as h,s as g,t as _,u as v,x as y}from"./product-host-f1Ibsm6P.js";import{realpathSync as b}from"node:fs";import{join as x}from"node:path";function S(e){return t(e.storage.userRoot)}async function C(e){if(S(e.config)!==`secure`)throw Error(`Secure conversations are not active for this product state.`);if(e.signal.aborted)throw Error(`The desktop window is no longer available.`);let t=b(e.workspace),r=g(t);if(e.restricted&&!e.restrictedHold)throw Error(`A live native Restricted folder choice is required.`);let i=a(e.config,e.environment,void 0,`secure`),o=h({path:i.layout.userPaths.keyring,root:i.layout.userRoot}),_=o.load();if(_.status!==`present`)throw Error(`The secure conversation keyring is missing.`);let y=s(_.keyring),x=e.secret.type===`passphrase`?{type:`passphrase`,passphrase:e.secret.value}:{type:`recoveryKey`,recoveryKey:e.secret.value},C=await n(_.keyring,x),w;try{w=new u(r,await l(i),!e.restricted,e.restrictedHold);let n=o.load();if(e.signal.aborted||S(e.config)!==`secure`||n.status!==`present`||s(n.keyring)!==y)throw Error(`The secure conversation choice or keyring changed during unlock.`);let a=d(i),h=await p(t,a,{cliName:i.vocabulary.cliName}),g;try{if(e.signal.aborted)throw Error(`The desktop window is no longer available.`);let n=await f({root:a,workspace:t,candidates:await v(a,void 0,{includeGeneration:!0}),handover:C});if(n){if(n.restricted===!0!==e.restricted)throw Error(`The secure daemon uses a different workspace access choice.`);g={id:n.id,generation:n.generation}}else{if(e.signal.aborted)throw Error(`The desktop window is no longer available.`);g=await c(t,{productRuntime:i,root:a,env:e.childEnvironment,handover:C,daemonRole:!0,launchCommand:e.launchCommand,...e.restricted?{restricted:!0}:{}})}}finally{h()}if(e.signal.aborted)throw Error(`The desktop window is no longer available.`);let{link:_,grantNeeded:b}=await m({root:a,...g,handover:C,signal:e.signal});if(e.signal.aborted)throw _.close(),Error(`The desktop window is no longer available.`);try{let e=await _.control({command:`workspace-root-proof`,fields:{}}),t=w.proof();if(e.status!==`root-proof`||e.tag!==t.tag||e.generation!==t.generation||e.trustTag!==t.trustTag)throw Error(`The secure runtime workspace root does not match the desktop root.`);if((await _.control({command:`desktop-activity-mode`,fields:{}})).status!==`native`)throw Error(`The runtime did not accept native desktop activity.`)}catch(e){throw _.close(),e}return{link:_,grantNeeded:b,selected:{runtimeId:g.id,generation:g.generation},assertWorkspace:()=>w?.assertCurrent(),release:()=>{try{w?.close()}finally{C.dispose()}}}}catch(e){try{w?.close()}finally{C.dispose()}throw e}}async function w(e,t,n,r){return(await i(y(a(e,t)),{op:`approve`,candidate:r,root:n.folder})).status===`trusted`}const T=(e,t)=>y(a(e,t));async function E(e,t,n){let r=await i(T(e,t),{op:`prepare`,root:n});return r.status===`prepared`?r.candidate:void 0}async function D(e,t,n,r){let a=await i(T(e,t),{op:`retainRestricted`,root:n,candidate:r});return a.status===`restricted-held`?a.hold:void 0}async function O(e,t,n,r){let a=await i(T(e,t),{op:`assertRestricted`,root:n,hold:r});if(a.status!==`restricted-root`)throw Error(`The Restricted folder changed after approval.`);return a.tag}async function k(e,t,n){if((await i(T(e,t),{op:`releaseRestricted`,hold:n})).status!==`released`)throw Error(`The Restricted folder hold could not be released.`)}const A=[`PATH`,`HOME`,`USERPROFILE`,`SystemRoot`,`TEMP`,`TMP`,`LANG`,`LC_ALL`,`XDG_RUNTIME_DIR`,`DISPLAY`,`WAYLAND_DISPLAY`,`XAUTHORITY`,`DBUS_SESSION_BUS_ADDRESS`,`APPDATA`,`LOCALAPPDATA`,`PROGRAMDATA`],j=/^ws:\/\/127\.0\.0\.1:([0-9]{1,5})\/?\?token=([A-Za-z0-9%._~-]+)$/u;function M(e){let t=e.split(/\r?\n/u).filter(e=>e.trim()!==``);if(t.length===1)try{let e=JSON.parse(t[0]);return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}catch{return}}function N(e){let t=M(e);if(t===void 0)return;let n=t.providerEnvRefs;if(!(n!==void 0&&(!Array.isArray(n)||n.length>128||!n.every(e=>typeof e==`string`&&/^[A-Za-z_][A-Za-z0-9_]*$/u.test(e))))){if(t.state===`trusted`)return t.askable===!1?{trusted:!0,providerEnvRefs:Object.freeze([...new Set(n??[])])}:void 0;if(t.askable===!0&&typeof t.workspace==`string`&&t.workspace.trim()!==``){let e=Array.isArray(t.loads)?t.loads.filter(e=>typeof e==`string`):[];return{trusted:!1,question:{folder:t.workspace,loads:e.slice(0,64)},...typeof t.candidate==`string`?{candidate:t.candidate}:{},providerEnvRefs:[]}}return{trusted:!1,providerEnvRefs:[]}}}function P(e){let t=M(e);if(typeof t?.id!=`string`||t.id.trim()===``||typeof t.url!=`string`)return;let n=j.exec(t.url);if(!n)return;let r=Number(n[1]);return Number.isInteger(r)&&r>0&&r<=65535?{id:t.id,url:t.url,port:r}:void 0}function F(e){return`default-src 'self'; connect-src ${e===void 0?`'none'`:`ws://127.0.0.1:${e}`}; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'`}function I(t){let n=Object.freeze({...t.environment}),i=_(t.artifact).resolveRuntime({environment:n}).config,a=r(n,o(i)),s=null,c=null,l,u=!1,d=(t=[])=>{let n={};for(let e of A)a[e]!==void 0&&(n[e]=a[e]);for(let e of t)a[e]!==void 0&&(n[e]=a[e]);for(let{section:t,field:r,descriptor:a}of e()){if(a.exposure===`private`||!a.consumers.includes(`cli`))continue;let e=i[t][r];e!==void 0&&(n[a.variable]=typeof e==`string`?e:JSON.stringify(e))}return a.PRODUCT_CONFIG_FILE!==void 0&&(n.PRODUCT_CONFIG_FILE=a.PRODUCT_CONFIG_FILE),n};async function f(){let e=[],r=u?void 0:await t.execute([`trust`,`status`,`--json`],d()),a=r?.exitCode===0?N(r.stdout):void 0;if(!u&&a?.question!==void 0){let r=await t.chooseTrust(a.question);if(r!==`trust`&&r!==`restricted`&&r!==`quit`)return{ok:!1,detail:`Desktop trust answer was invalid.`};if(r===`quit`)return{ok:!1,detail:`Desktop launch cancelled.`};if(r===`restricted`&&(u=!0),r===`trust`){if(a.candidate===void 0)return{ok:!1,detail:`The prepared workspace approval is unavailable.`};if(!(t.approveTrust===void 0?await w(i,n,a.question,a.candidate):await t.approveTrust(a.question.folder,a.candidate)))return{ok:!1,detail:`Workspace trust grant failed.`};let r=await t.execute([`trust`,`status`,`--json`],d()),o=r.exitCode===0?N(r.stdout):void 0;if(o?.trusted!==!0)return{ok:!1,detail:`Workspace trust could not be confirmed after grant.`};e=o.providerEnvRefs}}else e=a?.providerEnvRefs??[];let o=await t.execute([`daemon`,`start`,`--json`,...u?[`--restricted-workspace`]:[]],d(u?[]:e)),s=o.exitCode===0?P(o.stdout):void 0;return s===void 0?{ok:!1,detail:o.stderr.trim()||`Desktop daemon did not return a loopback endpoint.`}:{ok:!0,endpoint:s}}let p=()=>{if(c!==null)return c;let e=f().then(e=>(l=e.ok?e.endpoint.port:void 0,c=null,e),e=>{throw l=void 0,c=null,e});return s=c=e,e};return Object.freeze({config:i,userDataPath:x(i.storage.userRoot,`desktop`),start:p,reconnect:p,current:()=>s,port:()=>l,csp:()=>F(l)})}export{w as approveDesktopTrustCandidate,O as assertDesktopRestrictedRoot,I as createDesktopCliController,F as desktopContentSecurityPolicy,S as desktopConversationMode,C as openDesktopSecureOwner,P as parseDesktopDaemonStart,N as parseDesktopTrustStatus,E as prepareDesktopRestrictedRoot,k as releaseDesktopRestrictedRoot,D as retainDesktopRestrictedRoot};
2
2
  //# sourceMappingURL=desktop-host.js.map
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  ;(function(){var v=parseInt(process.versions.node.split('.')[0],10);if(v<22){process.stderr.write('\n✗ Node.js 22+ is required (current: '+process.version+')\n\nUpgrade:\n nvm: nvm install 22 && nvm use 22\n Volta: volta install node@22\n Download: https://nodejs.org/en/download\n\n');process.exit(1);}})();
3
- import{F as e,I as t,K as n,L as r,P as i,R as a,W as o,_ as s,d as c,f as l,m as u,n as d,t as f,v as p,y as m,z as h}from"./process-hardening-DLMS7wKO.js";if(f(),h(u(process.argv)))try{let n=m({});t(n,process.argv),e(n),i(n),r(n.config.identity.cliName),p(n.environment),a(c(n))}catch(e){process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1}else try{let a=m({});t(a,process.argv),e(a),i(a),r(a.config.identity.cliName);let c=s();!c.serve||c.printMode||c.goal!==void 0||c.positional.length>0||c.reset||c.configure||c.configureProvider!==void 0||c.checkUpdate||c.help||c.version?(process.stderr.write(`This headless runtime accepts only --serve.
3
+ import{F as e,I as t,K as n,L as r,P as i,R as a,W as o,_ as s,d as c,f as l,m as u,n as d,t as f,v as p,y as m,z as h}from"./process-hardening-D1loSTNU.js";if(f(),h(u(process.argv)))try{let n=m({});t(n,process.argv),e(n),i(n),r(n.config.identity.cliName),p(n.environment),a(c(n))}catch(e){process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1}else try{let a=m({});t(a,process.argv),e(a),i(a),r(a.config.identity.cliName);let c=s();!c.serve||c.printMode||c.goal!==void 0||c.positional.length>0||c.reset||c.configure||c.configureProvider!==void 0||c.checkUpdate||c.help||c.version?(process.stderr.write(`This headless runtime accepts only --serve.
4
4
  `),process.exitCode=2):d({productRuntime:a},o({createDefaultTools:l}),n).catch(e=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),process.exitCode=1})}catch(e){process.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),process.exitCode=2}export{};
package/dist/node/host.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./product-host-Dfc3iv7V.js";export{e as createProductCliHost};
1
+ import{t as e}from"./product-host-f1Ibsm6P.js";export{e as createProductCliHost};