Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
docs(cloudflare): record the cf 1.0 move across the docs
trohitge473c0bfb106
diff --git a/CLAUDE.md b/CLAUDE.mdindex b574402b..e115a69c 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -35,7 +35,7 @@ This is a React Flow-based workflow automation platform implementing n8n-inspire| **[Vercel Service](./docs-internal/vercel_service.md)** | Vercel CLI integration — `vercelAction` (deploy / inspect / list + `custom` CLI passthrough; AI tool `vercel`). Second reference for the CLI-managed-auth pattern: the **device-flow variant** (`vercel login` is one blocking process — no two-step `--complete`; direct `create_subprocess_exec` + chunk-based banner read for the code-embedding URL, pumps drain pipes for the process lifetime, success gate = auth.json mtime advance + sniff). Dual auth: optional `vercel_token` field (injected as `VERCEL_TOKEN` env, never argv) OR CLI login with marker tokens. All invocations pin `--global-config <DATA_DIR>/vercel/` (the `CLAUDE_CONFIG_DIR` isolation idiom). `bun add` into the shared packages tree (pinned version, via `core/js_runtime.add_package`; the CLI runs on bun). First-deploy project guard raises `NodeUserError` instead of letting Vercel derive an invalid name from the workspace dir. Shipped with the generic OAuthConnect change: Login gates on **required** fields only, so optional fields never block CLI login. || **[GitHub Service](./docs-internal/github_service.md)** | GitHub CLI integration — `githubAction` (repo_clone / pr_create / pr_list / pr_merge / issue_create / issue_list + `custom` passthrough; AI tool `github`). **Strict Stripe pattern: the gh CLI owns its own auth** — no token stored/injected by OpenCompany, no auth pre-flight (gh's own error surfaces), marker OAuth row for the modal badge, fieldless catalogue entry. Login = spawned `gh auth login --hostname github.com --git-protocol https --web` — source-verified: headless takes the `isInteractive=false` branch (no Press-Enter), prints one-time code + `github.com/login/device` URL on stderr; the modal shows the code via the generic `verificationCode` plumbing (`useCredentialPanel` → `OAuthConnect`). `login_env()` strips `GH_TOKEN`/`GITHUB_TOKEN` (login aborts otherwise). Success gate = `gh auth status` exit 0, then best-effort **`gh auth setup-git`** (official bridge — the future git node needs zero auth code). gh binary: **project-local, pooch-driven** (temporal `_install.py` idiom) — pinned release under `package_dir("gh")`, system gh never consulted (auth state still shared: gh config paths are user-level). Palette group `vcs`. || **[Cloudflare Service](./docs-internal/cloudflare_service.md)** | Cloudflare CLI integration — `cloudflareAction` (whoami / `search_commands` (`cf cli search`) / zones_list / DNS records list-create-edit-delete / `graphql_query` / `custom` passthrough; AI tool `cloudflare`) wrapping the official `cf` CLI (npm `[email protected]`, open beta — "the next version of Wrangler"). **Pin enforced, not just installed once**: `ensure_cf_cli` compares `core.js_runtime.installed_version("cf")` with the pin and re-runs `bun add` on a mismatch (clearing the login marker, since a new version may not see the old login). **Login = gh's device-flow shape**: `cf auth login --force --device --no-browser` prints a URL + one-time code on stderr that the handler relays to the modal (works from any machine; the old fixed-port-8877 loopback flow is `--no-device` only) — single flight (a repeat click returns the same code), install before any login (no invisible codes), never-kill-the-shim (killing bun's `cf.exe` launcher orphans the child), success gate = `cf auth whoami` JSON (`authenticated: true` — cf exits 0 in BOTH auth states). **cf contract traps**: destructive commands without `--force` print "Aborted." and **exit 0** (delete always passes it; `custom` turns it into an error); no `--account-id` flag on most commands (account = `CLOUDFLARE_ACCOUNT_ID`, from the `account_id` param — several accounts fail non-interactively without it); cf resolves a domain `--zone` only in the first page of the selected account, so the node resolves domains itself via `zones list --name`; no output-format flag (unknown flags rejected); cf reads `.env` files from its working directory and fails under bun on a `cloudflare.config.ts` found above it, so typed ops run from a neutral `<DATA_DIR>/cloudflare` (`custom` from the workspace) with `CF_DELEGATION=1` (otherwise bun lets cf hand off to another cached cf copy) and telemetry off. The optional `apiKey` field (an API token) rides `CLOUDFLARE_API_TOKEN` and beats the login; cf does NOT accept a Global API Key, so a `cfk_` key (with `cloudflare_email`) serves only `graphql_query`, which POSTs the official `client/v4/graphql` endpoint directly (no cf GraphQL command; the cf login's token never leaves the CLI) — needs `Account > Account Analytics > Read`. System cf never consulted. Palette group `deployment`. |-| **[Google Cloud Service](./docs-internal/gcloud_service.md)** | Google Cloud CLI integration — `gcloudAction` (auth/config/projects + set_project / Compute Engine instances list-start-stop-describe / Cloud Run deploy-list-describe / Cloud Storage ls-cp-rm / `custom` passthrough; AI tool `gcloud`) wrapping the official gcloud CLI (pinned versioned archive via pooch into `package_dir("gcloud")` — NOT npm; the Windows bundled-python zip keeps the legacy `google-cloud-sdk-` filename prefix, the `-cli-` spelling 404s, locked by test). Cloudflare login variant (CLI opens the browser itself, random loopback port — no fixed-port hazard) + the gh marker-token pattern; success gate = `gcloud auth list --filter=status:ACTIVE --format=json` non-empty (exit codes never trusted). **Config isolation divergence from gh**: every invocation pins `CLOUDSDK_CONFIG=<DATA_DIR>/gcloud/`, so terminal logins against the operator's global gcloud are deliberately NOT visible to the node. ADC note: node login mints gcloud USER creds only (CLI commands never read ADC); client-library code gets ADC via the `custom` op `auth application-default login` (lands isolated in the pinned dir). Cold install ~100 MB → login answers `pending: True` within the 22 s WS budget. Provider id `gcloud` is orthogonal to the Workspace `google` OAuth2 provider. Palette group `deployment`. |+| **[Google Cloud Service](./docs-internal/gcloud_service.md)** | Google Cloud CLI integration — `gcloudAction` (auth/config/projects + set_project / Compute Engine instances list-start-stop-describe / Cloud Run deploy-list-describe / Cloud Storage ls-cp-rm / `custom` passthrough; AI tool `gcloud`) wrapping the official gcloud CLI (pinned versioned archive via pooch into `package_dir("gcloud")` — NOT npm; the Windows bundled-python zip keeps the legacy `google-cloud-sdk-` filename prefix, the `-cli-` spelling 404s, locked by test). CLI-opens-the-browser login variant (the pre-1.0 Cloudflare flow; gcloud picks a random loopback port — no fixed-port hazard) + the gh marker-token pattern; success gate = `gcloud auth list --filter=status:ACTIVE --format=json` non-empty (exit codes never trusted). **Config isolation divergence from gh**: every invocation pins `CLOUDSDK_CONFIG=<DATA_DIR>/gcloud/`, so terminal logins against the operator's global gcloud are deliberately NOT visible to the node. ADC note: node login mints gcloud USER creds only (CLI commands never read ADC); client-library code gets ADC via the `custom` op `auth application-default login` (lands isolated in the pinned dir). Cold install ~100 MB → login answers `pending: True` within the 22 s WS budget. Provider id `gcloud` is orthogonal to the Workspace `google` OAuth2 provider. Palette group `deployment`. || **[TikHub Service](./docs-internal/tikhub_service.md)** | TikHub social-scraping integration — `tikhubAction` (`call` / `list_endpoints` / `fetch_url` / `account`; AI tool `tikhub_action`; palette group `scraper`, visible in normal mode) over the **official `tikhub` SDK** (`tikhub>=2.1.2,<3`, auto-generated from TikHub's `openapi.json`; ~1,100 methods across TikTok / Douyin / Instagram / YouTube / Twitter / Xiaohongshu / Bilibili / Kuaishou / Weibo / Reddit / Threads / LinkedIn / Zhihu). **The node is the "flattened CLI"**: one `call` op addressed by the SDK's own `resource.method` id (`douyin_web.fetch_one_video`, also `resource/method` or the `/api/v1/...` path) with **reflective `getattr` dispatch** and `inspect.signature(...).bind` pre-flight so unknown kwargs fail before any paid request; **nothing is vendored** — `endpoint_index()` introspects the installed SDK at runtime (resources = `AsyncResource` instance attrs, params = keyword-only signature, route from the docstring's ``GET /api/v1/...`` literal), cached per process, and feeds both `list_endpoints` and the `platform`-dependent dynamic `endpoint` dropdown (`tikhubEndpoints` loader; `all` returns no options, the LLM path stays free text). `tikhub` is imported lazily inside `_sdk.py` only (plugin imports with `sys.modules["tikhub"] = None`). `TikHubCredential` = bearer `ApiKeyCredential` with a declarative httpx probe against `/api/v1/tikhub/user/get_user_info` (never the unauthenticated health route); runtime key via `TikHubCredential.resolve` so a missing key yields the structured `PermissionDeniedError` envelope. SDK `TikHubError` subclasses map to `NodeUserError` (401 key rejected -> Credentials; 403 scope-or-balance -> `account`; 429 + `retry_after`; 400/422 with TikHub `detail`; 404; 5xx upstream after the SDK's own retries) and HTTP-200-with-in-body-`code >= 400` is raised too. **Flat `$0.001`/request tracking** (`pricing.json: api.tikhub` + `operation_map.tikhub`, `track_tikhub_usage` -> `api_usage_metrics`, only after a 2xx, never for `list_endpoints`). SDK drift is guarded by two contract tests (every `PLATFORMS` value matches a live resource; every backticked id in the skill resolves). || **[Discord Service](./docs-internal/discord_service.md)** | Discord bot integration — `discordSend` / `discordAction` (AI tools) + `discordReceive` / `discordInteraction` triggers. **discord.py owns the gateway, REST is plugin-owned** (nodes must work with no gateway, `discordAction` needs arbitrary routes, and the invalid-request guard is process-wide across accounts). **Multi-account rides the existing `session_id` credential column** — `_accounts.py` is the only file that knows `account_id -> "discord:<app_id>"`, `"default"` is the row the modal already writes, and `credential_customer_id` is deliberately NOT used (it is per-execution-context tenancy, so two nodes in one workflow could never target different bots). **`AccountScopedNode` exists because `server_controlled_fields` is enforced only in `execute_as_tool`'s ToolNode branch** — a dual-purpose ActionNode takes an earlier `{**node_params, **tool_args}` merge with model args winning, so locked fields are stripped before it. Attachments are metadata on the trigger and downloaded by `discordAction` (deployed triggers never run their node body). Interaction tokens never leave the server — the trigger emits an opaque ref. The interactions endpoint is a plugin router, not a `WebhookSource`: Discord's validation probe requires **401** (the generic intake raises 400) and the 3-second ACK deadline precludes awaiting `emit`. Rate limiting is reactive; the invalid-request guard is **process-global** because Cloudflare bans the source IP, not the token. || **[Sarvam AI Service](./docs-internal/sarvam_service.md)** | Sarvam AI (Indic-first). **`nodes/sarvam/` no longer exists** — every capability it served is now a *provider* inside an abstracted node: speech in `nodes/speech/`, and translate / transliterate / detect-language in `nodes/translate/`. What remains Sarvam-specific is `sarvamChatModel` (an **OpenAI-compat provider**: one `_COMPAT_PROVIDERS` entry + a JSON block, no provider subclass) under `nodes/model/`. **One stored key spans two auth styles** — the chat route takes `Authorization: Bearer` (what the openai SDK sends) while every other endpoint takes only `api-subscription-key`, so `SarvamCredential` declares the native header and every surface shares it. Introduces the generic **`supports_model_listing: false`** flag: Sarvam ships no `/v1/models` route, and unhandled that 404 becomes a `NodeUserError` that `AIService.fetch_models` re-raises *before* its curated fallback, breaking key validation and the model dropdown — so `OpenAIProvider.fetch_models` serves the curated list and probes with a one-token completion instead (defaults `true`; every other provider is untouched, locked by test). Also added generic **`Connection.request(files=)`** multipart support. |@@ -2789,7 +2789,7 @@ This function:- **Telegram owner detection — three layers** (f746ddf): the bot owner is captured by THREE independent paths so the realistic setup flows all converge to a working state. (1) **Explicit field**: secondary `FieldDef` in the credentials modal lets the user paste their Telegram user ID directly (recommended; works without DM'ing the bot). (2) **Pre-poll peek** in `connect()` via `_capture_owner_from_pending_updates()` — calls `bot.get_updates(timeout=0)` BEFORE `start_polling(drop_pending_updates=True)` discards the queue, scans for any historical private DM, captures + persists atomically. (3) **Atomic write-through in `_on_message_received`** — persists FIRST, sets in-memory ONLY on success. Invariant: "in-memory has owner ⇒ DB has owner" so a process restart can re-capture cleanly. Failure logged at `ERROR` with `exc_info=True` (was `WARNING` previously, masking persist failures). The lazy fallback in `telegram_send.py` (read DB → `service.set_owner`) sits on top of all three.- **Supervisor Job Object loud-failure (cli/tree.py + cli/supervisor.py)** (8a64eb9): the Windows process-tree mechanism depends entirely on a Job Object with `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE` (no fallback — `start_new_session` is POSIX-only). `pywin32>=308` is a hard supervisor dependency on Windows; the declaration in the root `pyproject.toml` (where `opencompany-cli` lives — `cli/pyproject.toml` was removed as a stale duplicate) carries an inline comment so future maintainers don't drop it. `_JobObject.__init__` splits failures into explicit `ImportError` (with reinstall command) and `Exception` (with `repr`) branches — both write to `stderr` instead of swallowing. `_JobObject.add()` verifies enrollment via `win32job.IsProcessInJob(handle, self._handle)` after assignment; on mismatch it queries `IsProcessInJob(handle, None)` so the warning explicitly names the wrapper-job hypothesis (npm / bun / conhost wrappers occasionally place us in their own non-nesting Job). `supervisor._spawn_once` checks `add_to_job` return value and emits a yellow `WARN: pid=N not enrolled in Job Object` per child if False. Without these guards, a stale pywin32 install or a wrapping Job Object silently leaks orphan Python processes on every Ctrl-C and they accumulate to the point of holding SQLite locks that block subsequent backend startup.- **Credentials envelope-shape invariant** (dc94cde): the `useCredentialPanel` query stores `{values: CredentialFormValues, hadStored: boolean}` (an envelope, NOT a flat dict). The earlier `writeValues` called `setQueryData<CredentialFormValues>` with a spread `(prev) => ({...prev, [key]: value})`, which at runtime merged the typed character at the envelope level next to `values` and `hadStored` instead of inside `.values` — the input selector `panel.values[field.key]` re-rendered with the original (server) value on every keystroke and the input felt frozen. Fix: `writeValues` now preserves the envelope shape and updates only the inner `values` dict; `hadStored` is preserved verbatim (it reflects real server state, not local edits). When introducing other queries shaped as `{data, meta}` envelopes, follow the same pattern — never spread `prev` as if it were the inner payload.-- **`core.paths` is the SSOT for on-disk locations**: only generic helpers (`data_path` / `packages_dir` / `package_dir(name)` / `daemons_dir` / `workspaces_dir` / `workspace_dir(workflow_id)` / `example_workflows_dir`). Plugin-specific subpaths are composed inline at the plugin's call site — adding a new package never requires touching `core.paths`. Reference subtree under `opencompany_root()` (= `~/.opencompany/` per default `DATA_DIR`): `workspaces/<slug>/` (per-workflow scratch), `daemons/` (supervised event-source daemon cwds — `stripe listen` etc.; shared root by default, no per-namespace subdir), `claude/` (Claude Code's `CLAUDE_CONFIG_DIR` state — composed as `data_path("claude")` in `nodes/agent/claude_code_agent/_oauth.py`), `packages/` (OpenCompany-managed install root). `packages/` holds a **single shared, bun-managed packages tree** — one `package.json` + `bun.lock` + `node_modules/` covering every OpenCompany-managed npm-registry package (`@anthropic-ai/claude-code`, `edgymeow`, `cf`, `vercel`). Each plugin's `_install.py` calls `core.js_runtime.add_package(spec, trust=...)`, which runs `bun add --cwd <packages_dir> --no-progress [--trust] <spec>` and extends the shared tree idempotently (`ensure_shared_tree()` writes the minimal private manifest first); `bun_binary()` resolves bun from `OPENCOMPANY_BUN_BIN` or PATH, and `shared_tree_bin(name)` returns the shim at `node_modules/.bin/<name>` on POSIX or `<name>.exe` (plus a `<name>.bunx` file) on Windows. The shims run on the bun runtime — no Node or npm anywhere on this path (bun ignores a package's `engines.node`, and shims `node` for the lifecycle scripts it is allowed to run). bun blocks dependency lifecycle scripts unless trusted, so `trust=True` is passed only where a postinstall materialises something the plugin needs: claude-code (stages its native launcher), edgymeow (downloads the Go binary). The Browser runtime does not use this npm tree: its CLI installer uses `packages/browser-use/`; only explicit testing mode installs Chrome under `packages/chrome-for-testing/` (see [Browser](./docs-internal/browser.md)). Binaries that are not npm-registry packages (Stripe CLI, Temporal CLI) sit under sibling subdirs `packages/stripe/`, `packages/temporal/` via `package_dir(name)`. Also under `<DATA_DIR>/`: `whatsapp/` (WhatsApp session DB), `credentials.db` / `workflow.db` / `temporal.db`, and the model-registry caches `local_models.json` (models registered from the user's own LLM servers) / `litellm_models.json` (LiteLLM's model table, RFC-0003 D16). Pre-fix `packages_dir()` routed through `platformdirs.user_cache_path("OpenCompany")` (`~/.cache/OpenCompany/` etc.) and the Temporal CLI sat in its own `pooch.os_cache("opencompany-temporal")` namespace — operators reported both as "not local". The WhatsApp Go bridge (`edgymeow`) used to be a top-level pnpm dep at `<repo>/node_modules/edgymeow/`; now OpenCompany-managed via `nodes/whatsapp/_install.py` like the other CLIs. Daemon cwds used to live under `workspaces/_<namespace>/` and polluted per-workflow scratch with framework state. Out of scope: globally-installed binaries (Himalaya — system package manager). Shipped seed workflows are the lone exception — `example_workflows_dir()` is hardcoded to `<repo>/.opencompany/workflows/` (git-tracked seeds, NOT under `DATA_DIR`) so they survive `company clean` and stay at the same path across `DATA_DIR=~/.opencompany` vs `DATA_DIR=.opencompany` configs.+- **`core.paths` is the SSOT for on-disk locations**: only generic helpers (`data_path` / `packages_dir` / `package_dir(name)` / `daemons_dir` / `workspaces_dir` / `workspace_dir(workflow_id)` / `example_workflows_dir`). Plugin-specific subpaths are composed inline at the plugin's call site — adding a new package never requires touching `core.paths`. Reference subtree under `opencompany_root()` (= `~/.opencompany/` per default `DATA_DIR`): `workspaces/<slug>/` (per-workflow scratch), `daemons/` (supervised event-source daemon cwds — `stripe listen` etc.; shared root by default, no per-namespace subdir), `claude/` (Claude Code's `CLAUDE_CONFIG_DIR` state — composed as `data_path("claude")` in `nodes/agent/claude_code_agent/_oauth.py`), `packages/` (OpenCompany-managed install root). `packages/` holds a **single shared, bun-managed packages tree** — one `package.json` + `bun.lock` + `node_modules/` covering every OpenCompany-managed npm-registry package (`@anthropic-ai/claude-code`, `edgymeow`, `cf`, `vercel`). Each plugin's `_install.py` calls `core.js_runtime.add_package(spec, trust=...)`, which runs `bun add --cwd <packages_dir> --no-progress [--trust] <spec>` and extends the shared tree idempotently (`ensure_shared_tree()` writes the minimal private manifest first); `bun_binary()` resolves bun from `OPENCOMPANY_BUN_BIN` or PATH, and `shared_tree_bin(name)` returns the shim at `node_modules/.bin/<name>` on POSIX or `<name>.exe` (plus a `<name>.bunx` file) on Windows. `installed_version(name)` reads `node_modules/<name>/package.json`: an existing shim says nothing about its version and `company clean` keeps `packages/`, so a pinned plugin compares against it and re-runs `add_package` on a mismatch (Cloudflare does; the other installers check only that the shim exists, so their pin bumps reach fresh installs only). The shims run on the bun runtime — no Node or npm anywhere on this path (bun ignores a package's `engines.node`, and shims `node` for the lifecycle scripts it is allowed to run). bun blocks dependency lifecycle scripts unless trusted, so `trust=True` is passed only where a postinstall materialises something the plugin needs: claude-code (stages its native launcher), edgymeow (downloads the Go binary). The Browser runtime does not use this npm tree: its CLI installer uses `packages/browser-use/`; only explicit testing mode installs Chrome under `packages/chrome-for-testing/` (see [Browser](./docs-internal/browser.md)). Binaries that are not npm-registry packages (Stripe CLI, Temporal CLI) sit under sibling subdirs `packages/stripe/`, `packages/temporal/` via `package_dir(name)`. Also under `<DATA_DIR>/`: `whatsapp/` (WhatsApp session DB), `credentials.db` / `workflow.db` / `temporal.db`, and the model-registry caches `local_models.json` (models registered from the user's own LLM servers) / `litellm_models.json` (LiteLLM's model table, RFC-0003 D16). Pre-fix `packages_dir()` routed through `platformdirs.user_cache_path("OpenCompany")` (`~/.cache/OpenCompany/` etc.) and the Temporal CLI sat in its own `pooch.os_cache("opencompany-temporal")` namespace — operators reported both as "not local". The WhatsApp Go bridge (`edgymeow`) used to be a top-level pnpm dep at `<repo>/node_modules/edgymeow/`; now OpenCompany-managed via `nodes/whatsapp/_install.py` like the other CLIs. Daemon cwds used to live under `workspaces/_<namespace>/` and polluted per-workflow scratch with framework state. Out of scope: globally-installed binaries (Himalaya — system package manager). Shipped seed workflows are the lone exception — `example_workflows_dir()` is hardcoded to `<repo>/.opencompany/workflows/` (git-tracked seeds, NOT under `DATA_DIR`) so they survive `company clean` and stay at the same path across `DATA_DIR=~/.opencompany` vs `DATA_DIR=.opencompany` configs.- **`company clean` preserves `.opencompany/{workflows,deploy,packages}/`**: `cli/commands/clean.py` iterates the canonical `<repo>/.opencompany/` and pre-rebrand `<repo>/.machina/` roots and skips anything in `_OPENCOMPANY_KEEP = frozenset({"workflows", "deploy", "packages"})`. Wipes `claude/`, `workspaces/`, `*.db` as before. `workflows/` holds the shipped seed JSONs (git-tracked); `deploy/` holds Terraform state for LIVE cloud resources (only `company deploy destroy` removes it); `packages/` holds the OpenCompany-managed binaries (Temporal CLI ~114 MB, Stripe CLI, the shared bun packages tree) — re-fetchable but expensive, so clean+build cycles stay offline-safe cache hits. Test `cli/tests/test_clean.py::test_opencompany_keep_preserves_workflows_deploy_and_packages` locks the keep-list.- **No raw `print()` outside three sanctioned helpers**: `main._startup_log` (pre-logger boot markers), `core.container._clog` (DI-bootstrap markers), and `nodes.code.python_executor.captured_print` (the sandbox builtin handed to user code). Everything else goes through `logger = get_logger(__name__)`. The supervisor prefixes every aggregated line with `[HH:MM:SS.fff]` so no inner `TimeStamper` is needed; structlog console mode is deliberately timestamp-less. Test `server/tests/test_no_raw_prints.py` AST-walks the tree and flags any unsanctioned `print(...)` call.- **`configure_logging(settings)` must run BEFORE plugin self-registration imports**: in `main.py`, `Settings()` + `configure_logging(settings)` + `init_tracing()` + `get_logger(__name__)` happen ahead of `from core.container import container` and `from routers import …`. Otherwise plugin folders that register on import call `logger.debug(...)` while structlog is still on its default processor chain (which includes `TimeStamper` + no `filter_by_level`) — symptom is double timestamps + debug records leaking despite `LOG_LEVEL=INFO`.diff --git a/cli/terraform/aws/README.md b/cli/terraform/aws/README.mdindex ad86af08..65455baa 100644--- a/cli/terraform/aws/README.md+++ b/cli/terraform/aws/README.md@@ -14,7 +14,7 @@ Settings are the ones validated on a live t3.micro in September 2026:| Credit mode | `standard` | Caps compute at the hourly rate under continuous CPU load. || Root disk | 10 GiB gp3, deleted with the instance | A fresh install uses ~4.5 GiB. || Image | Ubuntu 24.04 LTS (Canonical) | Python 3.12 inside the server's `<3.13` pin. |-| bun | installed by `install.sh` (the official bun installer, into `~ubuntu/.bun`) when none is present; no Node, no npm | The published package runs on bun: the `company` shim, the JS executor sidecar and the plugin CLIs (including the Cloudflare `cf` CLI, whose `engines.node >= 22` bun ignores). systemd gets `$APP_HOME/.bun/bin` on PATH and `ExecStart=$APP_HOME/.bun/bin/company serve`. |+| bun | installed by `install.sh` (the official bun installer, into `~ubuntu/.bun`) when none is present; no Node, no npm | The published package runs on bun: the `company` shim, the JS executor sidecar and the plugin CLIs (including the Cloudflare `cf` CLI: bun ignores its `engines.node >= 22` and runs its API commands; only cf's project commands, which load a `cloudflare.config.ts`, need Node 22.18+). systemd gets `$APP_HOME/.bun/bin` on PATH and `ExecStart=$APP_HOME/.bun/bin/company serve`. || Install | `install.sh` as `ubuntu`, no sudo | Root installs leave the venvs unusable by the login user (errors.md #16). || Runtime | `company serve` under systemd as `ubuntu` on port 5678 | The server rejects ports below 1024; 80/443 stay free for a TLS front door. || Security group | 22, 80, 443 and the app port from `allow_cidr` | Same shape as the gcp module. |diff --git a/docs-internal/SCRIPTS.md b/docs-internal/SCRIPTS.mdindex dc679dd7..ff9b68a7 100644--- a/docs-internal/SCRIPTS.md+++ b/docs-internal/SCRIPTS.md@@ -182,7 +182,7 @@ code or doc should carry the numerals.| Dependency | Version | Install ||------------|---------|---------|-| bun | 1.4+ — the only JavaScript runtime and package manager anything shipped needs: it runs the `company` shim, the JS executor sidecar and the plugin CLIs (incl. the Cloudflare `cf` CLI, whose `engines.node >= 22` bun ignores) and installs the package (`bun add -g`) | official installer (https://bun.sh; `install.sh` / `install.ps1` run it); root `packageManager` pin read by `oven-sh/setup-bun` in CI; the desktop app bundles it |+| bun | 1.4+ — the only JavaScript runtime and package manager anything shipped needs: it runs the `company` shim, the JS executor sidecar and the plugin CLIs (incl. the Cloudflare `cf` CLI: bun ignores its `engines.node >= 22` and runs its API commands; only cf's project commands, which load a `cloudflare.config.ts`, need Node 22.18+) and installs the package (`bun add -g`) | official installer (https://bun.sh; `install.sh` / `install.ps1` run it); root `packageManager` pin read by `oven-sh/setup-bun` in CI; the desktop app bundles it || Python | 3.12+ (CLI); server venv accepts 3.11–3.12 | https://python.org/ || uv | latest | `curl -LsSf https://astral.sh/uv/install.sh \| sh` || Node.js | optional, dev/CI only — when present, bun runs vite / vitest / eslint on it via their node shebangs (CI installs 22 for that reason); `company build` reports it as optional | https://nodejs.org/ |diff --git a/docs-internal/cli_services_integration.md b/docs-internal/cli_services_integration.mdindex 97a2a9b0..8d0416db 100644--- a/docs-internal/cli_services_integration.md+++ b/docs-internal/cli_services_integration.md@@ -48,7 +48,10 @@ Follow the plugin-runtime pattern (references: `nodes/whatsapp/_runtime.py`,under `<DATA_DIR>/packages/<name>/` (pooch for release archives; theshared bun-managed packages tree via `core.js_runtime.add_package` fornpm-registry packages, whose bin shims then run on bun). Idempotent; callable one-shot from- `company build` when pre-caching is worth it.+ `company build` when pre-caching is worth it. Pin the version, and for+ an npm package compare `core.js_runtime.installed_version(name)` with+ the pin so a bump reaches machines that already have it+ (`nodes/cloudflare/_install.py`).2. **Supervise** — a `BaseProcessSupervisor` subclass in the plugin folder(`_runtime.py`) owning argv/cwd/env, with `ensure_started()`(probe-or-spawn) for on-demand starts. Register the singleton via@@ -69,5 +72,6 @@ Follow the plugin-runtime pattern (references: `nodes/whatsapp/_runtime.py`,| Adding plugin-daemon ports to `Config.all_ports` | the CLI would kill a backend-owned daemon during startup | The backend supervises them; the CLI carries no plugin knowledge || Spelling `node_modules/.bin/<cli>[.cmd]` by hand | Drifts per platform (bun writes `<name>.exe` + `<name>.bunx` on Windows, `<name>` elsewhere) | `core.js_runtime.shared_tree_bin(name)` after `add_package(spec)` || Running the CLI through `bun x` / `npx` per call | Slow, unpinned version, no shared tree | `add_package("<pkg>@<version>")` once into the shared packages tree, then call the shim directly |+| Treating an existing shim as the pinned version | A pin bump never reaches machines that already have the package (`company clean` keeps `packages/`) | Compare `core.js_runtime.installed_version(name)` with the pin and re-run `add_package` on a mismatch (`nodes/cloudflare/_install.py`) || Wrapping CLI in a JS script | Unnecessary indirection | Use CLI commands directly || Hardcoding port numbers in code or docs | drifts when ports change | Declare in `.env.template`; read via `core.env_defaults` |diff --git a/docs-internal/cloudflare_service.md b/docs-internal/cloudflare_service.mdindex 80433b03..5fe10c90 100644--- a/docs-internal/cloudflare_service.md+++ b/docs-internal/cloudflare_service.md@@ -85,8 +85,11 @@ tests, update this page and the skill.## Runtime — bun, delegation, and the working directorycf declares `engines.node >= 22`; bun 1.4 reports a Node version that-passes the bin's guard, and every API command works on it (verified with-no Node on PATH). Two documented limits follow from running on bun:+passes the bin's guard. With no Node on PATH, `--help`, `--dry-run` of+every wrapped command, `auth whoami`, `cli search` and `schema` all ran+on bun, and cf's own docs name only the commands that load a+`cloudflare.config.ts` as failing there. Two documented limits follow+from running on bun:- **`cloudflare.config.ts` cannot load under bun** ("Bun is notsupported" — commands that load it fail with *"cloudflare.config.ts@@ -261,7 +264,7 @@ Contract notes:always passes `--force` (choosing the operation is the confirmation),and `_run` turns that output into a `NodeUserError` for `custom`.- **Errors** are a box on stderr (`┌ Error │ ... └`; API errors add- `[<code>] <message>` and `<status> · HTTP <path>`) with exit 1.+ `[<code>] <message>` and `<status> <text> · HTTP <path>`) with exit 1.`_run` raises `NodeUserError("cf <command> failed: <stderr tail>")`plus a `hint` for known failures: no login / 401 (also`requires_user_action=True`, and a note when only a `cfk_` key isdiff --git a/docs-internal/errors.md b/docs-internal/errors.mdindex 25a52304..249e7fe4 100644--- a/docs-internal/errors.md+++ b/docs-internal/errors.md@@ -660,3 +660,32 @@ A real Temporal dev server confirmed the matching times for every frequency, and- A follow-up gave the sequential and parallel paths the same `errors` and `error`, and made every path report `total_nodes` and `completed_nodes`. `MachinaWorkflow` now returns its `total_nodes`.Locked by `server/tests/temporal/test_run_errors.py` and `server/tests/services/test_workflow_run_result.py`. The result contract is in [Temporal Architecture → The run result](./TEMPORAL_ARCHITECTURE.md#4-the-run-result).++## 32. Cloudflare: a DNS record delete reports success, but the record is still there++**Symptom**: `dns_record_delete` on the Cloudflare node (or a `custom` delete such as `kv namespaces delete <id>`) returns success, yet the record or resource still exists. The output's `stderr_tail` ends with:+```+? This permanently deletes the resource. Continue?+ (non-interactive; pass --force to confirm)+Aborted.+```++**Root cause**: the `cf` CLI asks before every destructive command. When no terminal is attached, as when the backend runs it, cf prints the question and `Aborted.`, changes nothing, and **exits 0**, so `run_cli_command` reported a successful run. The node never passed `--force`, on cf 0.2.0 or later.++**Fix** (`9a5cd688`): `dns_record_delete` always passes `--force`; choosing the operation is the confirmation. For any other command, `_run` in `nodes/cloudflare/cloudflare_action.py` turns that output into a `NodeUserError` asking for `--force`. Locked by `test_dns_record_delete_forces_and_uses_positional_id` and `test_aborted_confirmation_is_an_error` in `server/tests/test_cloudflare_plugin.py`. Scripts that run cf by hand need `--force` too.++## 33. Cloudflare: `No authentication token found` after the cf 1.0 upgrade, or `More than one account available`++**Symptom**: after updating past `9a5cd688`, the first Cloudflare operation is slow (cf is reinstalled), the Credentials modal shows Cloudflare as not connected, and operations fail with:+```+No authentication token found. Either:+1. Set the CLOUDFLARE_API_TOKEN environment variable+2. Run 'cf auth login' to authenticate via OAuth+```+With a login that can see several Cloudflare accounts, operations fail instead with `More than one account available but unable to select one in non-interactive mode`.++**Root cause**:+- The node moved from cf 0.2.0 to 1.0.0-beta.12. `ensure_cf_cli` reinstalls when the installed version differs from the pin (the first install downloads about 300 MB). cf 1.0 keeps its login in a new place (`<xdg-config>/cloudflare/config/default.json`; `%APPDATA%\xdg.config\cloudflare\...` on Windows) and does not pick up the login 0.2.0 stored, so the upgrade also clears the catalogue's "connected" marker.+- cf has no `--account-id` flag on most commands. It takes the account from `CLOUDFLARE_ACCOUNT_ID`, or uses the only one the login can see, and with no terminal to ask it stops when there are several.++**Fix**: log in again (Credentials → Cloudflare → Login: the modal shows a one-time code to approve on Cloudflare's page, from any browser), or paste an API token there. With several accounts, set the node's `account_id` to the account to use; the `whoami` operation lists them. See [Cloudflare Service](./cloudflare_service.md).diff --git a/docs-internal/node-logic-flows/cli_integrations/cloudflareAction.md b/docs-internal/node-logic-flows/cli_integrations/cloudflareAction.mdindex 5609006a..5fb9eab0 100644--- a/docs-internal/node-logic-flows/cli_integrations/cloudflareAction.md+++ b/docs-internal/node-logic-flows/cli_integrations/cloudflareAction.md@@ -206,8 +206,9 @@ flowchart TD(`<xdg-config>/cloudflare/config/default.json`) and is never read byOpenCompany; the modal badge is a synthetic `cli-managed` marker OAuthrow written by `_handlers.py`.-- **Services**: the `cf` CLI (declares `engines.node >= 22`; runs on bun for- every API command, `bun` on PATH or `OPENCOMPANY_BUN_BIN` for the+- **Services**: the `cf` CLI (declares `engines.node >= 22`; its API+ commands run on bun — only commands that load a `cloudflare.config.ts`+ need Node 22.18+; `bun` on PATH or `OPENCOMPANY_BUN_BIN` for theinstall); Cloudflare's OAuth device authorization for login (URL + codeshown in the modal; see `_handlers.py`).- **Python packages**: `httpx`, `pydantic`; `services.events.run_cli_command`.diff --git a/docs-internal/node_creation.md b/docs-internal/node_creation.mdindex f7467d47..e8492e18 100644--- a/docs-internal/node_creation.md+++ b/docs-internal/node_creation.md@@ -59,7 +59,8 @@ appears in the Component Palette under its first `group` entry.## Five-minute recipe — Wave 12 self-contained folder (signed webhook + CLI)For nodes that wrap a CLI tool **and** receive signed webhooks-(Stripe, future GitHub-CLI / Cloudflare-Wrangler integrations), use+(Stripe; CLI wrappers without webhooks — GitHub, Vercel, Cloudflare,+gcloud — need only the CLI-managed-auth variants further down), usethe [Wave 12 framework](./plugin_system.md#wave-12--generalized-event-framework-servicesevents).Stripe is the reference implementation([`server/nodes/stripe/`](../server/nodes/stripe/)). The shape:diff --git a/docs-internal/plugin_system.md b/docs-internal/plugin_system.mdindex 1778bef2..0c7194b4 100644--- a/docs-internal/plugin_system.md+++ b/docs-internal/plugin_system.md@@ -1205,8 +1205,9 @@ does above.### `DaemonEventSource` — supervised subprocess driver-For plugins that wrap a long-lived CLI tool or SDK loop (Stripe CLI,-future GitHub-CLI / Cloudflare-Wrangler / etc.). Delegates lifecycle+For plugins that wrap a long-lived CLI tool or SDK loop (the Stripe+CLI's `stripe listen`; one-shot CLI wrappers such as GitHub, Vercel,+Cloudflare and gcloud call `run_cli_command` instead). Delegates lifecycleto `ProcessService` (battle-tested PATHEXT-aware launching, kill_treecleanup, log capture, Terminal-tab broadcast). The base subscribes toProcessService's per-line callback hook (`line_handler`), so pluginsdiff --git a/server/services/events/cli.py b/server/services/events/cli.pyindex 9cca4e78..50ddd344 100644--- a/server/services/events/cli.py+++ b/server/services/events/cli.py@@ -4,7 +4,7 @@plugin's API key via the convention flag (``--api-key`` by default),runs the subprocess with a timeout, captures stdout/stderr, and parsesstdout as JSON when possible. Used by any plugin that wraps a CLI-tool (Stripe, future GitHub-CLI / Cloudflare-Wrangler / etc.).+tool (Stripe, GitHub, Vercel, Cloudflare, gcloud, ...)."""from __future__ import annotations