An open-source, faster Devin alternative
TypeScript
remove projects references
Brian Reardon7d4bd5362c6d
diff --git a/cmd/oc/internal/commands/sandbox.go b/cmd/oc/internal/commands/sandbox.goindex 67586546..1e435001 100644--- a/cmd/oc/internal/commands/sandbox.go+++ b/cmd/oc/internal/commands/sandbox.go@@ -26,7 +26,7 @@ var sandboxCreateCmd = &cobra.Command{memory, _ := cmd.Flags().GetInt("memory")envSlice, _ := cmd.Flags().GetStringSlice("env")metaSlice, _ := cmd.Flags().GetStringSlice("metadata")- project, _ := cmd.Flags().GetString("project")+ secretStore, _ := cmd.Flags().GetString("secret-store")config := types.SandboxConfig{Timeout: timeout,@@ -36,7 +36,7 @@ var sandboxCreateCmd = &cobra.Command{Metadata: parseKVSlice(metaSlice),}- // Build request body — include project if set+ // Build request body — include secret store if setbody := map[string]interface{}{"timeout": config.Timeout,}@@ -52,8 +52,8 @@ var sandboxCreateCmd = &cobra.Command{if config.Metadata != nil {body["metadata"] = config.Metadata}- if project != "" {- body["project"] = project+ if secretStore != "" {+ body["secretStore"] = secretStore}var sandbox types.Sandbox@@ -229,7 +229,7 @@ func init() {cmd.Flags().Int("memory", 0, "Memory in MB")cmd.Flags().StringSlice("env", nil, "Environment variables (KEY=VALUE)")cmd.Flags().StringSlice("metadata", nil, "Metadata (KEY=VALUE)")- cmd.Flags().String("project", "", "Project name (inherits config + secrets)")+ cmd.Flags().String("secret-store", "", "Secret store name (injects encrypted secrets)")}// sandbox wake flagsdiff --git a/docs/cli/projects.mdx b/docs/cli/projects.mdxindex c90e7caa..05c20806 100644--- a/docs/cli/projects.mdx+++ b/docs/cli/projects.mdx@@ -1,137 +1,130 @@----title: "Projects & Secrets"-description: "Manage projects and encrypted secrets from the CLI"+title: "Secret Stores & Secrets"+description: "Manage secret stores and encrypted secrets from the CLI"----Projects group sandboxes with shared config defaults and encrypted secrets. Use `oc project` to manage projects and `oc secret` to manage their secrets.+Secret stores hold encrypted secrets that are injected into sandboxes as sealed tokens. Use `oc secret-store` to manage stores and `oc secret` to manage their secrets.-## Projects+## Secret Stores-### Create a Project+### Create a Secret Store```bash-oc project create --name my-agent --cpu 2 --memory 1024 --timeout 600+oc secret-store create --name my-agent-secrets --egress-allowlist api.anthropic.com```-#### `oc project create`+#### `oc secret-store create`| Flag | Type | Default | Description || --- | --- | --- | --- |-| `--name` | string | *required* | Project name (unique per org) |-| `--template` | string | — | Default template for sandboxes |-| `--cpu` | int | — | Default vCPU count |-| `--memory` | int | — | Default memory in MB |-| `--timeout` | int | — | Default timeout in seconds |+| `--name` | string | *required* | Store name (unique per org) |+| `--egress-allowlist` | string[] | — | Allowed egress hosts (comma-separated) |-### List Projects+### List Secret Stores```bash-oc project list+oc secret-store list```Output:```-ID NAME TEMPLATE CPU MEMORY TIMEOUT-9961c10e-c83c-4e6b-ad61-b91144323a3d my-agent default 2 1024 600+ID NAME EGRESS ALLOWLIST+9961c10e-c83c-4e6b-ad61-b91144323a3d my-agent-secrets api.anthropic.com```-### Get Project Details+### Get Secret Store Details```bash-oc project get <project-id>+oc secret-store get <store-id>```-### Update a Project+### Update a Secret StorePartial updates — only the flags you pass are changed.```bash-oc project update <project-id> --memory 2048-# Name, template, CPU, timeout are preserved+oc secret-store update <store-id> --name new-name --egress-allowlist api.anthropic.com,*.openai.com```-#### `oc project update`+#### `oc secret-store update`| Flag | Type | Description || --- | --- | --- |-| `--name` | string | New project name |-| `--template` | string | New default template |-| `--cpu` | int | New default vCPU count |-| `--memory` | int | New default memory in MB |-| `--timeout` | int | New default timeout in seconds |+| `--name` | string | New store name |+| `--egress-allowlist` | string[] | New allowed egress hosts |-### Delete a Project+### Delete a Secret Store```bash-oc project delete <project-id>+oc secret-store delete <store-id>```-Deletes the project and all its secrets. Running sandboxes are not affected.+Deletes the store and all its secrets. Running sandboxes are not affected.## Secrets-Secrets are encrypted at rest and injected as sealed tokens when a sandbox is created with the project. The real values are never visible inside the sandbox — they are only substituted by the MITM proxy on outbound HTTPS requests.+Secrets are encrypted at rest and injected as sealed tokens when a sandbox is created with a secret store. The real values are never visible inside the sandbox — they are only substituted by the MITM proxy on outbound HTTPS requests.### Set a Secret```bash-oc secret set <project-id> ANTHROPIC_API_KEY sk-ant-...+oc secret set <store-id> ANTHROPIC_API_KEY sk-ant-...```Or pipe from stdin (useful for multiline values or scripts):```bash-cat ~/.anthropic_key | oc secret set <project-id> ANTHROPIC_API_KEY --from-stdin+cat ~/.anthropic_key | oc secret set <store-id> ANTHROPIC_API_KEY --from-stdin``````bash-echo "sk-ant-..." | oc secret set <project-id> ANTHROPIC_API_KEY --from-stdin+echo "sk-ant-..." | oc secret set <store-id> ANTHROPIC_API_KEY --from-stdin```#### `oc secret set`| Argument | Description || --- | --- |-| `<project-id>` | UUID of the project |+| `<store-id>` | UUID of the secret store || `<name>` | Secret name (becomes the env var name in sandboxes) || `<value>` | Secret value (omit if using `--from-stdin`) || Flag | Description || --- | --- || `--from-stdin` | Read the secret value from stdin |+| `--allowed-hosts` | Restrict this secret to specific hosts only |### List Secrets```bash-oc secret list <project-id>+oc secret list <store-id>```Output:```-ANTHROPIC_API_KEY+NAME ALLOWED HOSTS+ANTHROPIC_API_KEY api.anthropic.comDATABASE_URL```-Returns names only. Values are never exposed.+Returns names and host restrictions only. Values are never exposed.### Delete a Secret```bash-oc secret delete <project-id> ANTHROPIC_API_KEY+oc secret delete <store-id> ANTHROPIC_API_KEY```-## Creating Sandboxes with Projects+## Creating Sandboxes with Secret Stores-Use the `--project` flag on `oc create` to inherit a project's config and secrets:+Use the `--secret-store` flag on `oc create` to inject a store's secrets:```bash-oc create --project my-agent --timeout 600+oc create --secret-store my-agent-secrets --timeout 600```-The sandbox inherits the project's template, CPU, memory, and timeout as defaults. Any flags you pass explicitly override the project defaults.-Secrets are injected as sealed tokens:```bash@@ -144,18 +137,18 @@ The proxy replaces sealed tokens with real values on outbound HTTPS requests, so## Example Workflow```bash-# Create a project-oc project create --name my-agent --cpu 2 --memory 1024 --timeout 600+# Create a secret store+oc secret-store create --name my-agent-secrets --egress-allowlist api.anthropic.com# Add secrets-oc secret set <project-id> ANTHROPIC_API_KEY sk-ant-...-oc secret set <project-id> DATABASE_URL postgres://user:pass@host/db+oc secret set <store-id> ANTHROPIC_API_KEY sk-ant-...+oc secret set <store-id> DATABASE_URL postgres://user:pass@host/db# Verify secrets are stored-oc secret list <project-id>+oc secret list <store-id>-# Create a sandbox — inherits config + secrets-oc create --project my-agent+# Create a sandbox — inherits secrets+oc create --secret-store my-agent-secrets# Secrets are sealed inside the sandboxoc exec <sandbox-id> -- env | grep -E 'API_KEY|DATABASE'@@ -171,5 +164,5 @@ oc exec <sandbox-id> -- curl -s https://api.anthropic.com/v1/messages \# Clean upoc sandbox delete <sandbox-id>-oc project delete <project-id>+oc secret-store delete <store-id>```diff --git a/docs/sdks/python/projects.mdx b/docs/sdks/python/projects.mdxindex 85ff2c13..085a4336 100644--- a/docs/sdks/python/projects.mdx+++ b/docs/sdks/python/projects.mdx@@ -1,113 +1,85 @@----title: "Projects & Secrets"-description: "Manage projects and encrypted secrets that are securely injected into sandboxes"+title: "Secret Stores & Secrets"+description: "Manage secret stores and encrypted secrets that are securely injected into sandboxes"----Projects group sandboxes together with shared configuration defaults and encrypted secrets. When you create a sandbox with a project, it inherits the project's template, resource limits, and timeout — and secrets are sealed inside the sandbox so they never exist as plaintext in VM memory.+Secret stores hold encrypted secrets that are injected into sandboxes as sealed tokens. When you create a sandbox with a secret store, secrets are sealed inside the sandbox so they never exist as plaintext in VM memory.## How Secrets Work-When a sandbox is created with a project:+When a sandbox is created with a secret store:-1. The server decrypts the project's secrets+1. The server decrypts the store's secrets2. Secrets are sent to the worker and **sealed** into opaque tokens (`osb_sealed_...`)3. Inside the sandbox, env vars contain sealed tokens — never real values4. When the sandbox makes an outbound HTTPS request, the MITM proxy intercepts it and replaces sealed tokens with real values in headers and request body5. The real secret only exists in the proxy's memory on the host, never inside the VM-## Creating a Project+## Creating a Secret Store```python-from opencomputer import Project--project = await Project.create(- name='my-agent',- template='default',- cpu_count=2,- memory_mb=1024,- timeout_sec=600,+from opencomputer import SecretStore++store = await SecretStore.create(+ name='my-agent-secrets',+ egress_allowlist=['api.anthropic.com'],)```-### `Project.create(**kwargs)`+### `SecretStore.create(**kwargs)`<ParamField body="name" type="str" required>- Project name (unique per organization).-</ParamField>-<ParamField body="template" type="str" default="">- Default template for sandboxes in this project.-</ParamField>-<ParamField body="cpu_count" type="int" default="0">- Default vCPU count.-</ParamField>-<ParamField body="memory_mb" type="int" default="0">- Default memory in MB.-</ParamField>-<ParamField body="timeout_sec" type="int" default="0">- Default sandbox timeout in seconds.+ Store name (unique per organization).</ParamField><ParamField body="egress_allowlist" type="list[str] | None" default="None">Allowed egress hosts (e.g. `["api.anthropic.com"]`).</ParamField>-**Returns:** `dict` — Project info with `id`, `name`, `template`, etc.+**Returns:** `dict` — Secret store info with `id`, `name`, `egressAllowlist`, etc.-## Listing Projects+## Listing Secret Stores```python-projects = await Project.list()+stores = await SecretStore.list()```-### `Project.list(**kwargs)`+### `SecretStore.list(**kwargs)`**Returns:** `list[dict]`-## Getting a Project+## Getting a Secret Store```python-project = await Project.get('project-uuid')+store = await SecretStore.get('store-uuid')```-### `Project.get(project_id, **kwargs)`+### `SecretStore.get(store_id, **kwargs)`-<ParamField body="project_id" type="str" required>- UUID of the project.+<ParamField body="store_id" type="str" required>+ UUID of the secret store.</ParamField>**Returns:** `dict`-## Updating a Project+## Updating a Secret StorePartial updates — only the fields you pass are changed.```python-updated = await Project.update(- 'project-uuid',- memory_mb=2048,- timeout_sec=900,+updated = await SecretStore.update(+ 'store-uuid',+ name='new-name',+ egress_allowlist=['api.anthropic.com', '*.openai.com'],)-# Name, template, cpu_count are preserved```-### `Project.update(project_id, **kwargs)`+### `SecretStore.update(store_id, **kwargs)`-<ParamField body="project_id" type="str" required>- UUID of the project to update.+<ParamField body="store_id" type="str" required>+ UUID of the store to update.</ParamField><ParamField body="name" type="str" default="">- New project name (empty = no change).-</ParamField>-<ParamField body="template" type="str" default="">- New default template (empty = no change).-</ParamField>-<ParamField body="cpu_count" type="int" default="0">- New default vCPU count (0 = no change).-</ParamField>-<ParamField body="memory_mb" type="int" default="0">- New default memory in MB (0 = no change).-</ParamField>-<ParamField body="timeout_sec" type="int" default="0">- New default timeout in seconds (0 = no change).+ New store name (empty = no change).</ParamField><ParamField body="egress_allowlist" type="list[str] | None" default="None">New allowed egress hosts (None = no change).@@ -115,30 +87,41 @@ updated = await Project.update(**Returns:** `dict`-## Deleting a Project+## Deleting a Secret Store```python-await Project.delete('project-uuid')+await SecretStore.delete('store-uuid')```-Deletes the project and all its secrets. Running sandboxes are not affected.+Deletes the store and all its secrets. Running sandboxes are not affected.-### `Project.delete(project_id, **kwargs)`+### `SecretStore.delete(store_id, **kwargs)`**Returns:** `None`## Setting a Secret```python-await Project.set_secret('project-uuid', 'ANTHROPIC_API_KEY', 'sk-ant-...')+await SecretStore.set_secret('store-uuid', 'ANTHROPIC_API_KEY', 'sk-ant-...')```Secrets are encrypted at rest. The value is never returned by the API.-### `Project.set_secret(project_id, name, value, **kwargs)`+Optionally restrict which hosts can receive this secret:++```python+await SecretStore.set_secret(+ 'store-uuid',+ 'ANTHROPIC_API_KEY',+ 'sk-ant-...',+ allowed_hosts=['api.anthropic.com'],+)+```++### `SecretStore.set_secret(store_id, name, value, **kwargs)`-<ParamField body="project_id" type="str" required>- UUID of the project.+<ParamField body="store_id" type="str" required>+ UUID of the secret store.</ParamField><ParamField body="name" type="str" required>Secret name (used as the env var name in sandboxes).@@ -146,41 +129,44 @@ Secrets are encrypted at rest. The value is never returned by the API.<ParamField body="value" type="str" required>Secret value (encrypted at rest, never returned by API).</ParamField>+<ParamField body="allowed_hosts" type="list[str] | None" default="None">+ Restrict this secret to specific hosts only.+</ParamField>**Returns:** `None`## Listing Secrets```python-names = await Project.list_secrets('project-uuid')-# ['ANTHROPIC_API_KEY', 'DATABASE_URL']+entries = await SecretStore.list_secrets('store-uuid')+# [{'name': 'ANTHROPIC_API_KEY', 'allowedHosts': ['api.anthropic.com'], ...}, ...]```-Returns secret names only. Values are never exposed.+Returns secret metadata only. Values are never exposed.-### `Project.list_secrets(project_id, **kwargs)`+### `SecretStore.list_secrets(store_id, **kwargs)`-**Returns:** `list[str]`+**Returns:** `list[dict]`## Deleting a Secret```python-await Project.delete_secret('project-uuid', 'DATABASE_URL')+await SecretStore.delete_secret('store-uuid', 'DATABASE_URL')```-### `Project.delete_secret(project_id, name, **kwargs)`+### `SecretStore.delete_secret(store_id, name, **kwargs)`**Returns:** `None`-## Creating a Sandbox with a Project+## Creating a Sandbox with a Secret Store-Pass the `project` parameter to `Sandbox.create()` to inherit the project's config and secrets:+Pass the `secret_store` parameter to `Sandbox.create()` to inject the store's secrets:```pythonfrom opencomputer import Sandboxsandbox = await Sandbox.create(- project='my-agent',+ secret_store='my-agent-secrets',timeout=600,)@@ -195,4 +181,4 @@ api_result = await sandbox.commands.run(# The proxy replaces the sealed token with the real key before it hits Anthropic```-Request-level options (`timeout`, `envs`, `cpu_count`, etc.) override project defaults.+Request-level options (`timeout`, `envs`, `cpu_count`, etc.) work as normal alongside `secret_store`.diff --git a/docs/sdks/typescript/projects.mdx b/docs/sdks/typescript/projects.mdxindex c82420d9..a0752995 100644--- a/docs/sdks/typescript/projects.mdx+++ b/docs/sdks/typescript/projects.mdx@@ -1,52 +1,37 @@----title: "Projects & Secrets"-description: "Manage projects and encrypted secrets that are securely injected into sandboxes"+title: "Secret Stores & Secrets"+description: "Manage secret stores and encrypted secrets that are securely injected into sandboxes"----Projects group sandboxes together with shared configuration defaults and encrypted secrets. When you create a sandbox with a project, it inherits the project's template, resource limits, and timeout — and secrets are sealed inside the sandbox so they never exist as plaintext in VM memory.+Secret stores hold encrypted secrets that are injected into sandboxes as sealed tokens. When you create a sandbox with a secret store, secrets are sealed inside the sandbox so they never exist as plaintext in VM memory.## How Secrets Work-When a sandbox is created with a project:+When a sandbox is created with a secret store:-1. The server decrypts the project's secrets+1. The server decrypts the store's secrets2. Secrets are sent to the worker and **sealed** into opaque tokens (`osb_sealed_...`)3. Inside the sandbox, env vars contain sealed tokens — never real values4. When the sandbox makes an outbound HTTPS request, the MITM proxy intercepts it and replaces sealed tokens with real values in headers and request body5. The real secret only exists in the proxy's memory on the host, never inside the VM-## Creating a Project+## Creating a Secret Store```typescript-import { Project } from '@opencomputer/sdk';--const project = await Project.create({- name: 'my-agent',- template: 'default',- cpuCount: 2,- memoryMB: 1024,- timeoutSec: 600,+import { SecretStore } from '@opencomputer/sdk';++const store = await SecretStore.create({+ name: 'my-agent-secrets',+ egressAllowlist: ['api.anthropic.com'],});```-### `Project.create(opts)`+### `SecretStore.create(opts)`-<ParamField body="opts" type="CreateProjectOpts" required>+<ParamField body="opts" type="CreateSecretStoreOpts" required><Expandable title="properties"><ParamField body="name" type="string" required>- Project name (unique per organization).- </ParamField>- <ParamField body="template" type="string" optional>- Default template for sandboxes in this project.- </ParamField>- <ParamField body="cpuCount" type="number" optional>- Default vCPU count.- </ParamField>- <ParamField body="memoryMB" type="number" optional>- Default memory in MB.- </ParamField>- <ParamField body="timeoutSec" type="number" optional>- Default sandbox timeout in seconds.+ Store name (unique per organization).</ParamField><ParamField body="egressAllowlist" type="string[]" optional>Allowed egress hosts (e.g. `["api.anthropic.com"]`).@@ -54,65 +39,52 @@ const project = await Project.create({</Expandable></ParamField>-**Returns:** `Promise<ProjectInfo>`+**Returns:** `Promise<SecretStoreInfo>`-## Listing Projects+## Listing Secret Stores```typescript-const projects = await Project.list();+const stores = await SecretStore.list();```-### `Project.list(opts?)`+### `SecretStore.list(opts?)`-**Returns:** `Promise<ProjectInfo[]>`+**Returns:** `Promise<SecretStoreInfo[]>`-## Getting a Project+## Getting a Secret Store```typescript-const project = await Project.get('project-uuid');+const store = await SecretStore.get('store-uuid');```-### `Project.get(projectId, opts?)`+### `SecretStore.get(storeId, opts?)`-<ParamField body="projectId" type="string" required>- UUID of the project.+<ParamField body="storeId" type="string" required>+ UUID of the secret store.</ParamField>-**Returns:** `Promise<ProjectInfo>`+**Returns:** `Promise<SecretStoreInfo>`-## Updating a Project+## Updating a Secret StorePartial updates — only the fields you pass are changed.```typescript-const updated = await Project.update('project-uuid', {- memoryMB: 2048,- timeoutSec: 900,+const updated = await SecretStore.update('store-uuid', {+ name: 'new-name',+ egressAllowlist: ['api.anthropic.com', '*.openai.com'],});-// Name, template, cpuCount are preserved```-### `Project.update(projectId, opts)`+### `SecretStore.update(storeId, opts)`-<ParamField body="projectId" type="string" required>- UUID of the project to update.+<ParamField body="storeId" type="string" required>+ UUID of the store to update.</ParamField>-<ParamField body="opts" type="UpdateProjectOpts" required>+<ParamField body="opts" type="UpdateSecretStoreOpts" required><Expandable title="properties"><ParamField body="name" type="string" optional>- New project name.- </ParamField>- <ParamField body="template" type="string" optional>- New default template.- </ParamField>- <ParamField body="cpuCount" type="number" optional>- New default vCPU count.- </ParamField>- <ParamField body="memoryMB" type="number" optional>- New default memory in MB.- </ParamField>- <ParamField body="timeoutSec" type="number" optional>- New default timeout in seconds.+ New store name.</ParamField><ParamField body="egressAllowlist" type="string[]" optional>New allowed egress hosts.@@ -120,32 +92,32 @@ const updated = await Project.update('project-uuid', {</Expandable></ParamField>-**Returns:** `Promise<ProjectInfo>`+**Returns:** `Promise<SecretStoreInfo>`-## Deleting a Project+## Deleting a Secret Store```typescript-await Project.delete('project-uuid');+await SecretStore.delete('store-uuid');```-Deletes the project and all its secrets. Running sandboxes are not affected.+Deletes the store and all its secrets. Running sandboxes are not affected.-### `Project.delete(projectId, opts?)`+### `SecretStore.delete(storeId, opts?)`**Returns:** `Promise<void>`## Setting a Secret```typescript-await Project.setSecret('project-uuid', 'ANTHROPIC_API_KEY', 'sk-ant-...');+await SecretStore.setSecret('store-uuid', 'ANTHROPIC_API_KEY', 'sk-ant-...');```Secrets are encrypted at rest. The value is never returned by the API.-### `Project.setSecret(projectId, name, value, opts?)`+### `SecretStore.setSecret(storeId, name, value, opts?)`-<ParamField body="projectId" type="string" required>- UUID of the project.+<ParamField body="storeId" type="string" required>+ UUID of the secret store.</ParamField><ParamField body="name" type="string" required>Secret name (used as the env var name in sandboxes).@@ -154,40 +126,48 @@ Secrets are encrypted at rest. The value is never returned by the API.Secret value (encrypted at rest, never returned by API).</ParamField>+Optionally restrict which hosts can receive this secret:++```typescript+await SecretStore.setSecret('store-uuid', 'ANTHROPIC_API_KEY', 'sk-ant-...', {+ allowedHosts: ['api.anthropic.com'],+});+```+**Returns:** `Promise<void>`## Listing Secrets```typescript-const names = await Project.listSecrets('project-uuid');-// ['ANTHROPIC_API_KEY', 'DATABASE_URL']+const entries = await SecretStore.listSecrets('store-uuid');+// [{ name: 'ANTHROPIC_API_KEY', allowedHosts: ['api.anthropic.com'], ... }, ...]```-Returns secret names only. Values are never exposed.+Returns secret metadata only. Values are never exposed.-### `Project.listSecrets(projectId, opts?)`+### `SecretStore.listSecrets(storeId, opts?)`-**Returns:** `Promise<string[]>`+**Returns:** `Promise<SecretEntryInfo[]>`## Deleting a Secret```typescript-await Project.deleteSecret('project-uuid', 'DATABASE_URL');+await SecretStore.deleteSecret('store-uuid', 'DATABASE_URL');```-### `Project.deleteSecret(projectId, name, opts?)`+### `SecretStore.deleteSecret(storeId, name, opts?)`**Returns:** `Promise<void>`-## Creating a Sandbox with a Project+## Creating a Sandbox with a Secret Store-Pass the `project` option to `Sandbox.create()` to inherit the project's config and secrets:+Pass the `secretStore` option to `Sandbox.create()` to inject the store's secrets:```typescriptimport { Sandbox } from '@opencomputer/sdk';const sandbox = await Sandbox.create({- project: 'my-agent',+ secretStore: 'my-agent-secrets',timeout: 600,});@@ -202,19 +182,26 @@ const apiResult = await sandbox.commands.run(// The proxy replaces the sealed token with the real key before it hits Anthropic```-Request-level options (`timeout`, `envs`, `cpuCount`, etc.) override project defaults.+Request-level options (`timeout`, `envs`, `cpuCount`, etc.) work as normal alongside `secretStore`.-## ProjectInfo Type+## SecretStoreInfo Type| Property | Type | Description || --- | --- | --- |-| `id` | `string` | Project UUID |+| `id` | `string` | Store UUID || `orgId` | `string` | Organization UUID |-| `name` | `string` | Project name |-| `template` | `string` | Default template |-| `cpuCount` | `number` | Default vCPU count |-| `memoryMB` | `number` | Default memory in MB |-| `timeoutSec` | `number` | Default timeout in seconds |+| `name` | `string` | Store name || `egressAllowlist` | `string[]` | Allowed egress hosts || `createdAt` | `string` | ISO 8601 timestamp || `updatedAt` | `string` | ISO 8601 timestamp |++## SecretEntryInfo Type++| Property | Type | Description |+| --- | --- | --- |+| `id` | `string` | Entry UUID |+| `storeId` | `string` | Parent store UUID |+| `name` | `string` | Secret name (env var name) |+| `allowedHosts` | `string[]` | Host restrictions for this secret |+| `createdAt` | `string` | ISO 8601 timestamp |+| `updatedAt` | `string` | ISO 8601 timestamp |diff --git a/scripts/test-proxy-secrets.sh b/scripts/test-proxy-secrets.shindex 96fc1ea7..f78c2fd7 100755--- a/scripts/test-proxy-secrets.sh+++ b/scripts/test-proxy-secrets.sh@@ -35,8 +35,8 @@ fail() { echo -e "${RED}✗ $1${RESET}"; }info() { echo -e "${DIM} $1${RESET}"; }header() { echo -e "\n${BOLD}━━━ $1 ━━━${RESET}\n"; }-PROJ_NAME="proxy-test-$(date +%s)"-PROJ_ID=""+STORE_NAME="proxy-test-$(date +%s)"+STORE_ID=""SB_ID=""TOKEN=""WORKER="https://dev.opensandbox.ai"@@ -45,8 +45,8 @@ cleanup() {if [ -n "$SB_ID" ]; thencurl -s -X DELETE "$API/api/sandboxes/$SB_ID" -H "X-API-Key: $KEY" > /dev/null 2>&1 || truefi- if [ -n "$PROJ_ID" ]; then- curl -s -X DELETE "$API/api/projects/$PROJ_ID" -H "X-API-Key: $KEY" > /dev/null 2>&1 || true+ if [ -n "$STORE_ID" ]; then+ curl -s -X DELETE "$API/api/secret-stores/$STORE_ID" -H "X-API-Key: $KEY" > /dev/null 2>&1 || truefi}trap cleanup EXIT@@ -57,38 +57,38 @@ echo "║ Sealed Secrets + Proxy Replacement Test ║"echo "╚══════════════════════════════════════════════════╝"echo -e "${RESET}"-# ── 1. Create project ──-header "1. Create project"+# ── 1. Create secret store ──+header "1. Create secret store"-PROJ_RESP=$(curl -s -X POST "$API/api/projects" \+STORE_RESP=$(curl -s -X POST "$API/api/secret-stores" \-H "X-API-Key: $KEY" -H "Content-Type: application/json" \- -d "{\"name\":\"$PROJ_NAME\",\"timeoutSec\":300}")+ -d "{\"name\":\"$STORE_NAME\"}")-PROJ_ID=$(echo "$PROJ_RESP" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])" 2>/dev/null || true)+STORE_ID=$(echo "$STORE_RESP" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])" 2>/dev/null || true)-if [ -n "$PROJ_ID" ]; then- pass "Project created: $PROJ_ID"+if [ -n "$STORE_ID" ]; then+ pass "Secret store created: $STORE_ID"else- fail "Project creation failed: $PROJ_RESP"+ fail "Secret store creation failed: $STORE_RESP"exit 1fi# ── 2. Set Anthropic key as secret ──header "2. Set ANTHROPIC_API_KEY secret"-SECRET_RESP=$(curl -s -X PUT "$API/api/projects/$PROJ_ID/secrets/ANTHROPIC_API_KEY" \+SECRET_RESP=$(curl -s -X PUT "$API/api/secret-stores/$STORE_ID/secrets/ANTHROPIC_API_KEY" \-H "X-API-Key: $KEY" -H "Content-Type: application/json" \-d "{\"value\":\"$ANTHROPIC_KEY\"}")pass "Secret set (encrypted at rest)"info "Key prefix: ${ANTHROPIC_KEY:0:12}..."-# ── 3. Create sandbox with project ──-header "3. Create sandbox with project"+# ── 3. Create sandbox with secret store ──+header "3. Create sandbox with secret store"SB_RESP=$(curl -s -X POST "$API/api/sandboxes" \-H "X-API-Key: $KEY" -H "Content-Type: application/json" \- -d "{\"project\":\"$PROJ_NAME\",\"timeout\":300}")+ -d "{\"secretStore\":\"$STORE_NAME\",\"timeout\":300}")SB_ID=$(echo "$SB_RESP" | python3 -c "import sys,json; print(json.load(sys.stdin)['sandboxID'])" 2>/dev/null || true)TOKEN=$(echo "$SB_RESP" | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])" 2>/dev/null || true)diff --git a/sdks/python/examples/test_projects.py b/sdks/python/examples/test_projects.pyindex f2d33bdb..04bc2bf2 100644--- a/sdks/python/examples/test_projects.py+++ b/sdks/python/examples/test_projects.py@@ -1,18 +1,18 @@#!/usr/bin/env python3"""-Projects & Secrets Test+Secret Stores & Secrets TestTests:- 1. Create a project- 2. List projects- 3. Get project by ID- 4. Update project- 5. Set secrets on a project+ 1. Create a secret store+ 2. List secret stores+ 3. Get secret store by ID+ 4. Update secret store+ 5. Set secrets on a store6. List secrets (names only, values never returned)- 7. Create sandbox with project (inherits config + secrets)- 8. Verify secrets are injected as env vars+ 7. Create sandbox with secret store (inherits secrets)+ 8. Verify secrets are injected as sealed env vars9. Delete secret- 10. Delete project+ 10. Delete secret storeUsage:python examples/test_projects.py@@ -22,7 +22,7 @@ import asyncioimport sysimport time-from opencomputer import Sandbox, Project+from opencomputer import Sandbox, SecretStoreGREEN = "\033[32m"RED = "\033[31m"@@ -35,11 +35,11 @@ failed = 0def green(msg: str) -> None:- print(f"{GREEN}✓ {msg}{RESET}")+ print(f"{GREEN}\u2713 {msg}{RESET}")def red(msg: str) -> None:- print(f"{RED}✗ {msg}{RESET}")+ print(f"{RED}\u2717 {msg}{RESET}")def bold(msg: str) -> None:@@ -63,105 +63,100 @@ def check(desc: str, condition: bool, detail: str = "") -> None:async def main() -> None:global passed, failed- bold("\n╔══════════════════════════════════════════════════╗")- bold("║ Projects & Secrets Test ║")- bold("╚══════════════════════════════════════════════════╝\n")+ bold("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")+ bold("\u2551 Secret Stores & Secrets Test \u2551")+ bold("\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d\n")- project_id = None+ store_id = Nonesandbox = None- project_name = f"test-project-{int(time.time())}"+ store_name = f"test-store-{int(time.time())}"try:- # ── Test 1: Create project ──- bold("━━━ Test 1: Create project ━━━\n")-- project = await Project.create(- name=project_name,- template="base",- cpu_count=1,- memory_mb=512,- timeout_sec=120,+ # -- Test 1: Create secret store --+ bold("--- Test 1: Create secret store ---\n")++ store = await SecretStore.create(+ name=store_name,+ egress_allowlist=["api.anthropic.com"],)- project_id = project["id"]- check("Project created", bool(project["id"]))- check("Name matches", project["name"] == project_name)- check("Template set", project["template"] == "base")- check("CPU set", project["cpuCount"] == 1)- check("Memory set", project["memoryMB"] == 512)- check("Timeout set", project["timeoutSec"] == 120)- dim(f"Project ID: {project_id}")+ store_id = store["id"]+ check("Store created", bool(store["id"]))+ check("Name matches", store["name"] == store_name)+ check("Egress allowlist set", len(store.get("egressAllowlist", [])) == 1)+ dim(f"Store ID: {store_id}")print()- # ── Test 2: List projects ──- bold("━━━ Test 2: List projects ━━━\n")+ # -- Test 2: List secret stores --+ bold("--- Test 2: List secret stores ---\n")- projects = await Project.list()- check("List returns list", isinstance(projects, list))- found = any(p["id"] == project_id for p in projects)- check("Created project in list", found)- dim(f"Total projects: {len(projects)}")+ stores = await SecretStore.list()+ check("List returns list", isinstance(stores, list))+ found = any(s["id"] == store_id for s in stores)+ check("Created store in list", found)+ dim(f"Total stores: {len(stores)}")print()- # ── Test 3: Get project ──- bold("━━━ Test 3: Get project by ID ━━━\n")+ # -- Test 3: Get secret store --+ bold("--- Test 3: Get secret store by ID ---\n")- fetched = await Project.get(project_id)- check("Get returns correct project", fetched["id"] == project_id)- check("Get has correct name", fetched["name"] == project_name)+ fetched = await SecretStore.get(store_id)+ check("Get returns correct store", fetched["id"] == store_id)+ check("Get has correct name", fetched["name"] == store_name)print()- # ── Test 4: Update project ──- bold("━━━ Test 4: Update project ━━━\n")+ # -- Test 4: Update secret store --+ bold("--- Test 4: Update secret store ---\n")- updated = await Project.update(- project_id,- memory_mb=1024,- timeout_sec=300,+ updated_name = f"{store_name}-updated"+ updated = await SecretStore.update(+ store_id,+ name=updated_name,+ egress_allowlist=["api.anthropic.com", "*.openai.com"],)- check("Memory updated to 1024", updated["memoryMB"] == 1024)- check("Timeout updated to 300", updated["timeoutSec"] == 300)- check("Name unchanged", updated["name"] == project_name)+ check("Name updated", updated["name"] == updated_name)+ check("Egress allowlist updated", len(updated.get("egressAllowlist", [])) == 2)print()- # ── Test 5: Set secrets ──- bold("━━━ Test 5: Set project secrets ━━━\n")+ # -- Test 5: Set secrets --+ bold("--- Test 5: Set secrets ---\n")- await Project.set_secret(project_id, "TEST_API_KEY", "sk-test-12345")+ await SecretStore.set_secret(store_id, "TEST_API_KEY", "sk-test-12345")green("Set TEST_API_KEY")- await Project.set_secret(project_id, "DATABASE_URL", "postgres://localhost/test")+ await SecretStore.set_secret(store_id, "DATABASE_URL", "postgres://localhost/test")green("Set DATABASE_URL")- await Project.set_secret(project_id, "TEMP_SECRET", "will-be-deleted")+ await SecretStore.set_secret(store_id, "TEMP_SECRET", "will-be-deleted")green("Set TEMP_SECRET")print()- # ── Test 6: List secrets ──- bold("━━━ Test 6: List secret names ━━━\n")-- secret_names = await Project.list_secrets(project_id)- check("Returns list", isinstance(secret_names, list))- check("Has TEST_API_KEY", "TEST_API_KEY" in secret_names)- check("Has DATABASE_URL", "DATABASE_URL" in secret_names)- check("Has TEMP_SECRET", "TEMP_SECRET" in secret_names)- check("3 secrets total", len(secret_names) == 3, f"got {len(secret_names)}")- dim(f"Secret names: {', '.join(secret_names)}")+ # -- Test 6: List secrets --+ bold("--- Test 6: List secret entries ---\n")++ entries = await SecretStore.list_secrets(store_id)+ check("Returns list", isinstance(entries, list))+ names = [e["name"] for e in entries]+ check("Has TEST_API_KEY", "TEST_API_KEY" in names)+ check("Has DATABASE_URL", "DATABASE_URL" in names)+ check("Has TEMP_SECRET", "TEMP_SECRET" in names)+ check("3 secrets total", len(entries) == 3, f"got {len(entries)}")+ dim(f"Secret names: {', '.join(names)}")print()- # ── Test 7: Create sandbox with project ──- bold("━━━ Test 7: Create sandbox with project ━━━\n")+ # -- Test 7: Create sandbox with secret store --+ bold("--- Test 7: Create sandbox with secret store ---\n")sandbox = await Sandbox.create(- project=project_name,+ secret_store=updated_name,timeout=120,)check("Sandbox created", bool(sandbox.sandbox_id))dim(f"Sandbox ID: {sandbox.sandbox_id}")print()- # ── Test 8: Verify secrets are sealed in sandbox ──- bold("━━━ Test 8: Verify secrets sealed in sandbox ━━━\n")+ # -- Test 8: Verify secrets are sealed in sandbox --+ bold("--- Test 8: Verify secrets sealed in sandbox ---\n")# Secrets should be sealed tokens (osb_sealed_*) inside the VM.# The MITM proxy replaces sealed tokens with real values on outbound HTTPS requests,@@ -182,37 +177,38 @@ async def main() -> None:f'got "{temp_val}"')print()- # ── Test 9: Delete secret ──- bold("━━━ Test 9: Delete secret ━━━\n")+ # -- Test 9: Delete secret --+ bold("--- Test 9: Delete secret ---\n")- await Project.delete_secret(project_id, "TEMP_SECRET")+ await SecretStore.delete_secret(store_id, "TEMP_SECRET")green("Deleted TEMP_SECRET")- after_delete = await Project.list_secrets(project_id)- check("TEMP_SECRET removed", "TEMP_SECRET" not in after_delete)+ after_delete = await SecretStore.list_secrets(store_id)+ after_names = [e["name"] for e in after_delete]+ check("TEMP_SECRET removed", "TEMP_SECRET" not in after_names)check("2 secrets remaining", len(after_delete) == 2, f"got {len(after_delete)}")print()- # ── Test 10: Delete project ──- bold("━━━ Test 10: Delete project ━━━\n")+ # -- Test 10: Delete secret store --+ bold("--- Test 10: Delete secret store ---\n")# Kill sandbox firstawait sandbox.kill()green("Sandbox killed")sandbox = None- await Project.delete(project_id)- green("Project deleted")+ await SecretStore.delete(store_id)+ green("Secret store deleted")# Verify it's gonetry:- await Project.get(project_id)- red("Project should not exist after delete")+ await SecretStore.get(store_id)+ red("Store should not exist after delete")failed += 1except Exception:- green("Project not found after delete (expected)")+ green("Store not found after delete (expected)")passed += 1- project_id = None+ store_id = Noneprint()except Exception as e:@@ -227,9 +223,9 @@ async def main() -> None:await sandbox.kill()except Exception:pass- if project_id:+ if store_id:try:- await Project.delete(project_id)+ await SecretStore.delete(store_id)except Exception:passdiff --git a/sdks/python/opencomputer/__init__.py b/sdks/python/opencomputer/__init__.pyindex 796af156..3b9ddb6d 100644--- a/sdks/python/opencomputer/__init__.py+++ b/sdks/python/opencomputer/__init__.py@@ -6,7 +6,7 @@ from opencomputer.filesystem import Filesystemfrom opencomputer.exec import Exec, ProcessResult, ExecSessionInfofrom opencomputer.pty import Pty, PtySessionfrom opencomputer.template import Template-from opencomputer.project import Project+from opencomputer.project import SecretStore__all__ = ["Sandbox",@@ -21,7 +21,7 @@ __all__ = ["Pty","PtySession","Template",- "Project",+ "SecretStore",]__version__ = "0.5.0"diff --git a/sdks/python/opencomputer/project.py b/sdks/python/opencomputer/project.pyindex 8ce1dfea..29703682 100644--- a/sdks/python/opencomputer/project.py+++ b/sdks/python/opencomputer/project.py@@ -1,4 +1,4 @@-"""Project management — CRUD for projects and encrypted secrets."""+"""Secret store management — CRUD for secret stores and encrypted secrets."""from __future__ import annotations@@ -25,49 +25,33 @@ def _get_client(return httpx.AsyncClient(base_url=api_base, headers=headers, timeout=30.0)-class Project:- """Static methods for managing projects and their secrets."""+class SecretStore:+ """Static methods for managing secret stores and their secrets."""@staticmethodasync def create(name: str,- template: str = "",- cpu_count: int = 0,- memory_mb: int = 0,- timeout_sec: int = 0,egress_allowlist: list[str] | None = None,api_key: str | None = None,api_url: str | None = None,) -> dict:- """Create a new project.+ """Create a new secret store.Args:- name: Project name (unique per org).- template: Default template for sandboxes in this project.- cpu_count: Default vCPU count.- memory_mb: Default memory in MB.- timeout_sec: Default sandbox timeout in seconds.+ name: Store name (unique per org).egress_allowlist: Allowed egress hosts (e.g. ["api.anthropic.com"]).api_key: API key (or OPENCOMPUTER_API_KEY env var).api_url: API URL (or OPENCOMPUTER_API_URL env var).Returns:- Project info dict with id, name, template, etc.+ Secret store info dict with id, name, egressAllowlist, etc."""body: dict[str, Any] = {"name": name}- if template:- body["template"] = template- if cpu_count:- body["cpuCount"] = cpu_count- if memory_mb:- body["memoryMB"] = memory_mb- if timeout_sec:- body["timeoutSec"] = timeout_secif egress_allowlist:body["egressAllowlist"] = egress_allowlistasync with _get_client(api_key, api_url) as client:- resp = await client.post("/projects", json=body)+ resp = await client.post("/secret-stores", json=body)resp.raise_for_status()return resp.json()@@ -76,133 +60,123 @@ class Project:api_key: str | None = None,api_url: str | None = None,) -> list[dict]:- """List all projects for the authenticated org."""+ """List all secret stores for the authenticated org."""async with _get_client(api_key, api_url) as client:- resp = await client.get("/projects")+ resp = await client.get("/secret-stores")resp.raise_for_status()return resp.json()@staticmethodasync def get(- project_id: str,+ store_id: str,api_key: str | None = None,api_url: str | None = None,) -> dict:- """Get project details by ID."""+ """Get secret store details by ID."""async with _get_client(api_key, api_url) as client:- resp = await client.get(f"/projects/{project_id}")+ resp = await client.get(f"/secret-stores/{store_id}")resp.raise_for_status()return resp.json()@staticmethodasync def update(- project_id: str,+ store_id: str,name: str = "",- template: str = "",- cpu_count: int = 0,- memory_mb: int = 0,- timeout_sec: int = 0,egress_allowlist: list[str] | None = None,api_key: str | None = None,api_url: str | None = None,) -> dict:- """Update a project's configuration.+ """Update a secret store's configuration.Args:- project_id: UUID of the project to update.- name: New project name (empty = no change).- template: New default template (empty = no change).- cpu_count: New default vCPU count (0 = no change).- memory_mb: New default memory in MB (0 = no change).- timeout_sec: New default timeout in seconds (0 = no change).+ store_id: UUID of the store to update.+ name: New store name (empty = no change).egress_allowlist: New allowed egress hosts (None = no change).api_key: API key (or OPENCOMPUTER_API_KEY env var).api_url: API URL (or OPENCOMPUTER_API_URL env var).Returns:- Updated project info dict.+ Updated secret store info dict."""body: dict[str, Any] = {}if name:body["name"] = name- if template:- body["template"] = template- if cpu_count:- body["cpuCount"] = cpu_count- if memory_mb:- body["memoryMB"] = memory_mb- if timeout_sec:- body["timeoutSec"] = timeout_secif egress_allowlist is not None:body["egressAllowlist"] = egress_allowlistasync with _get_client(api_key, api_url) as client:- resp = await client.put(f"/projects/{project_id}", json=body)+ resp = await client.put(f"/secret-stores/{store_id}", json=body)resp.raise_for_status()return resp.json()@staticmethodasync def delete(- project_id: str,+ store_id: str,api_key: str | None = None,api_url: str | None = None,) -> None:- """Delete a project and all its secrets."""+ """Delete a secret store and all its secrets."""async with _get_client(api_key, api_url) as client:- resp = await client.delete(f"/projects/{project_id}")+ resp = await client.delete(f"/secret-stores/{store_id}")resp.raise_for_status()- # ── Secrets ──────────────────────────────────────────────────────────────+ # ── Secret Entries ──────────────────────────────────────────────────────@staticmethodasync def set_secret(- project_id: str,+ store_id: str,name: str,value: str,+ allowed_hosts: list[str] | None = None,api_key: str | None = None,api_url: str | None = None,) -> None:- """Set (create or update) an encrypted secret on a project.+ """Set (create or update) an encrypted secret in a store.Args:- project_id: UUID of the project.+ store_id: UUID of the secret store.name: Secret name (used as env var name in sandboxes).value: Secret value (encrypted at rest, never returned by API).+ allowed_hosts: Restrict this secret to specific hosts only.api_key: API key (or OPENCOMPUTER_API_KEY env var).api_url: API URL (or OPENCOMPUTER_API_URL env var)."""+ body: dict[str, Any] = {"value": value}+ if allowed_hosts:+ body["allowedHosts"] = allowed_hosts+async with _get_client(api_key, api_url) as client:resp = await client.put(- f"/projects/{project_id}/secrets/{name}",- json={"value": value},+ f"/secret-stores/{store_id}/secrets/{name}",+ json=body,)resp.raise_for_status()@staticmethodasync def delete_secret(- project_id: str,+ store_id: str,name: str,api_key: str | None = None,api_url: str | None = None,) -> None:- """Delete a secret from a project."""+ """Delete a secret from a store."""async with _get_client(api_key, api_url) as client:- resp = await client.delete(f"/projects/{project_id}/secrets/{name}")+ resp = await client.delete(f"/secret-stores/{store_id}/secrets/{name}")if resp.status_code != 404:resp.raise_for_status()@staticmethodasync def list_secrets(- project_id: str,+ store_id: str,api_key: str | None = None,api_url: str | None = None,- ) -> list[str]:- """List secret names for a project (values are never returned).+ ) -> list[dict]:+ """List secret entries in a store (names and allowed hosts, no values).Returns:- List of secret names (e.g. ["ANTHROPIC_API_KEY", "DATABASE_URL"]).+ List of secret entry dicts with name, allowedHosts, etc."""async with _get_client(api_key, api_url) as client:- resp = await client.get(f"/projects/{project_id}/secrets")+ resp = await client.get(f"/secret-stores/{store_id}/secrets")resp.raise_for_status()return resp.json()diff --git a/sdks/python/opencomputer/sandbox.py b/sdks/python/opencomputer/sandbox.pyindex df8ffc32..5c09b36d 100644--- a/sdks/python/opencomputer/sandbox.py+++ b/sdks/python/opencomputer/sandbox.py@@ -37,7 +37,7 @@ class Sandbox:api_url: str | None = None,envs: dict[str, str] | None = None,metadata: dict[str, str] | None = None,- project: str | None = None,+ secret_store: str | None = None,) -> Sandbox:"""Create a new sandbox instance.@@ -46,10 +46,10 @@ class Sandbox:timeout: Sandbox timeout in seconds (default 300).api_key: API key (or OPENCOMPUTER_API_KEY env var).api_url: API URL (or OPENCOMPUTER_API_URL env var).- envs: Environment variables to inject. Overrides project secrets.+ envs: Environment variables to inject. Overrides store secrets.metadata: Custom metadata key-value pairs.- project: Project name — inherits template, cpu, memory, timeout,- and secrets from the project.+ secret_store: Secret store name — resolves encrypted secrets+ and egress allowlist."""url = api_url or os.environ.get("OPENCOMPUTER_API_URL", "https://app.opencomputer.dev")url = url.rstrip("/")@@ -72,8 +72,8 @@ class Sandbox:body["envs"] = envsif metadata:body["metadata"] = metadata- if project:- body["project"] = project+ if secret_store:+ body["secretStore"] = secret_storeresp = await client.post("/sandboxes", json=body)resp.raise_for_status()diff --git a/sdks/typescript/examples/test-projects.ts b/sdks/typescript/examples/test-projects.tsindex 6406bf0b..cb09079e 100644--- a/sdks/typescript/examples/test-projects.ts+++ b/sdks/typescript/examples/test-projects.ts@@ -1,26 +1,26 @@/**- * Projects & Secrets Test+ * Secret Stores & Secrets Test** Tests:- * 1. Create a project- * 2. List projects- * 3. Get project by ID- * 4. Update project- * 5. Set secrets on a project+ * 1. Create a secret store+ * 2. List secret stores+ * 3. Get secret store by ID+ * 4. Update secret store+ * 5. Set secrets on a store* 6. List secrets (names only, values never returned)- * 7. Create sandbox with project (inherits config + secrets)- * 8. Verify secrets are injected as env vars+ * 7. Create sandbox with secret store (inherits secrets)+ * 8. Verify secrets are injected as sealed env vars* 9. Delete secret- * 10. Delete project+ * 10. Delete secret store** Usage:* npx tsx examples/test-projects.ts*/-import { Sandbox, Project } from "../src/index";+import { Sandbox, SecretStore } from "../src/index";-function green(msg: string) { console.log(`\x1b[32m✓ ${msg}\x1b[0m`); }-function red(msg: string) { console.log(`\x1b[31m✗ ${msg}\x1b[0m`); }+function green(msg: string) { console.log(`\x1b[32m\u2713 ${msg}\x1b[0m`); }+function red(msg: string) { console.log(`\x1b[31m\u2717 ${msg}\x1b[0m`); }function bold(msg: string) { console.log(`\x1b[1m${msg}\x1b[0m`); }function dim(msg: string) { console.log(`\x1b[2m ${msg}\x1b[0m`); }@@ -38,104 +38,99 @@ function check(desc: string, condition: boolean, detail?: string) {}async function main() {- bold("\n╔══════════════════════════════════════════════════╗");- bold("║ Projects & Secrets Test ║");- bold("╚══════════════════════════════════════════════════╝\n");+ bold("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");+ bold("\u2551 Secret Stores & Secrets Test \u2551");+ bold("\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d\n");- let projectId: string | null = null;+ let storeId: string | null = null;let sandbox: Sandbox | null = null;- const projectName = `test-project-${Date.now()}`;+ const storeName = `test-store-${Date.now()}`;try {- // ── Test 1: Create project ────────────────────────────────────- bold("━━━ Test 1: Create project ━━━\n");-- const project = await Project.create({- name: projectName,- template: "base",- cpuCount: 1,- memoryMB: 512,- timeoutSec: 120,+ // -- Test 1: Create secret store --+ bold("--- Test 1: Create secret store ---\n");++ const store = await SecretStore.create({+ name: storeName,+ egressAllowlist: ["api.anthropic.com"],});- projectId = project.id;- check("Project created", !!project.id);- check("Name matches", project.name === projectName);- check("Template set", project.template === "base");- check("CPU set", project.cpuCount === 1);- check("Memory set", project.memoryMB === 512);- check("Timeout set", project.timeoutSec === 120);- dim(`Project ID: ${project.id}`);+ storeId = store.id;+ check("Store created", !!store.id);+ check("Name matches", store.name === storeName);+ check("Egress allowlist set", store.egressAllowlist?.length === 1);+ dim(`Store ID: ${store.id}`);console.log();- // ── Test 2: List projects ─────────────────────────────────────- bold("━━━ Test 2: List projects ━━━\n");+ // -- Test 2: List secret stores --+ bold("--- Test 2: List secret stores ---\n");- const projects = await Project.list();- check("List returns array", Array.isArray(projects));- const found = projects.find((p) => p.id === projectId);- check("Created project in list", !!found);- dim(`Total projects: ${projects.length}`);+ const stores = await SecretStore.list();+ check("List returns array", Array.isArray(stores));+ const found = stores.find((s) => s.id === storeId);+ check("Created store in list", !!found);+ dim(`Total stores: ${stores.length}`);console.log();- // ── Test 3: Get project ───────────────────────────────────────- bold("━━━ Test 3: Get project by ID ━━━\n");+ // -- Test 3: Get secret store --+ bold("--- Test 3: Get secret store by ID ---\n");- const fetched = await Project.get(projectId!);- check("Get returns correct project", fetched.id === projectId);- check("Get has correct name", fetched.name === projectName);+ const fetched = await SecretStore.get(storeId!);+ check("Get returns correct store", fetched.id === storeId);+ check("Get has correct name", fetched.name === storeName);console.log();- // ── Test 4: Update project ────────────────────────────────────- bold("━━━ Test 4: Update project ━━━\n");+ // -- Test 4: Update secret store --+ bold("--- Test 4: Update secret store ---\n");- const updated = await Project.update(projectId!, {- memoryMB: 1024,- timeoutSec: 300,+ const updatedName = `${storeName}-updated`;+ const updated = await SecretStore.update(storeId!, {+ name: updatedName,+ egressAllowlist: ["api.anthropic.com", "*.openai.com"],});- check("Memory updated to 1024", updated.memoryMB === 1024);- check("Timeout updated to 300", updated.timeoutSec === 300);- check("Name unchanged", updated.name === projectName);+ check("Name updated", updated.name === updatedName);+ check("Egress allowlist updated", updated.egressAllowlist?.length === 2);console.log();- // ── Test 5: Set secrets ───────────────────────────────────────- bold("━━━ Test 5: Set project secrets ━━━\n");+ // -- Test 5: Set secrets --+ bold("--- Test 5: Set secrets ---\n");- await Project.setSecret(projectId!, "TEST_API_KEY", "sk-test-12345");+ await SecretStore.setSecret(storeId!, "TEST_API_KEY", "sk-test-12345");green("Set TEST_API_KEY");- await Project.setSecret(projectId!, "DATABASE_URL", "postgres://localhost/test");+ await SecretStore.setSecret(storeId!, "DATABASE_URL", "postgres://localhost/test");green("Set DATABASE_URL");- await Project.setSecret(projectId!, "TEMP_SECRET", "will-be-deleted");+ await SecretStore.setSecret(storeId!, "TEMP_SECRET", "will-be-deleted");green("Set TEMP_SECRET");console.log();- // ── Test 6: List secrets ──────────────────────────────────────- bold("━━━ Test 6: List secret names ━━━\n");-- const secretNames = await Project.listSecrets(projectId!);- check("Returns array", Array.isArray(secretNames));- check("Has TEST_API_KEY", secretNames.includes("TEST_API_KEY"));- check("Has DATABASE_URL", secretNames.includes("DATABASE_URL"));- check("Has TEMP_SECRET", secretNames.includes("TEMP_SECRET"));- check("3 secrets total", secretNames.length === 3, `got ${secretNames.length}`);- dim(`Secret names: ${secretNames.join(", ")}`);+ // -- Test 6: List secrets --+ bold("--- Test 6: List secret entries ---\n");++ const entries = await SecretStore.listSecrets(storeId!);+ check("Returns array", Array.isArray(entries));+ const names = entries.map((e) => e.name);+ check("Has TEST_API_KEY", names.includes("TEST_API_KEY"));+ check("Has DATABASE_URL", names.includes("DATABASE_URL"));+ check("Has TEMP_SECRET", names.includes("TEMP_SECRET"));+ check("3 secrets total", entries.length === 3, `got ${entries.length}`);+ dim(`Secret names: ${names.join(", ")}`);console.log();- // ── Test 7: Create sandbox with project ───────────────────────- bold("━━━ Test 7: Create sandbox with project ━━━\n");+ // -- Test 7: Create sandbox with secret store --+ bold("--- Test 7: Create sandbox with secret store ---\n");sandbox = await Sandbox.create({- project: projectName,+ secretStore: updatedName,timeout: 120,});check("Sandbox created", !!sandbox.sandboxId);dim(`Sandbox ID: ${sandbox.sandboxId}`);console.log();- // ── Test 8: Verify secrets are sealed in sandbox ──────────────- bold("━━━ Test 8: Verify secrets sealed in sandbox ━━━\n");+ // -- Test 8: Verify secrets are sealed in sandbox --+ bold("--- Test 8: Verify secrets sealed in sandbox ---\n");// Secrets should be sealed tokens (osb_sealed_*) inside the VM.// The MITM proxy replaces sealed tokens with real values on outbound HTTPS requests,@@ -156,38 +151,39 @@ async function main() {`got "${tempVal}"`);console.log();- // ── Test 9: Delete secret ─────────────────────────────────────- bold("━━━ Test 9: Delete secret ━━━\n");+ // -- Test 9: Delete secret --+ bold("--- Test 9: Delete secret ---\n");- await Project.deleteSecret(projectId!, "TEMP_SECRET");+ await SecretStore.deleteSecret(storeId!, "TEMP_SECRET");green("Deleted TEMP_SECRET");- const afterDelete = await Project.listSecrets(projectId!);- check("TEMP_SECRET removed", !afterDelete.includes("TEMP_SECRET"));+ const afterDelete = await SecretStore.listSecrets(storeId!);+ const afterNames = afterDelete.map((e) => e.name);+ check("TEMP_SECRET removed", !afterNames.includes("TEMP_SECRET"));check("2 secrets remaining", afterDelete.length === 2, `got ${afterDelete.length}`);console.log();- // ── Test 10: Delete project ───────────────────────────────────- bold("━━━ Test 10: Delete project ━━━\n");+ // -- Test 10: Delete secret store --+ bold("--- Test 10: Delete secret store ---\n");// Kill sandbox firstawait sandbox.kill();green("Sandbox killed");sandbox = null;- await Project.delete(projectId!);- green("Project deleted");+ await SecretStore.delete(storeId!);+ green("Secret store deleted");// Verify it's gonetry {- await Project.get(projectId!);- red("Project should not exist after delete");+ await SecretStore.get(storeId!);+ red("Store should not exist after delete");failed++;} catch {- green("Project not found after delete (expected)");+ green("Store not found after delete (expected)");passed++;}- projectId = null;+ storeId = null;console.log();} catch (err: any) {@@ -199,8 +195,8 @@ async function main() {if (sandbox) {try { await sandbox.kill(); } catch {}}- if (projectId) {- try { await Project.delete(projectId); } catch {}+ if (storeId) {+ try { await SecretStore.delete(storeId); } catch {}}}diff --git a/sdks/typescript/src/index.ts b/sdks/typescript/src/index.tsindex 75041684..a495380b 100644--- a/sdks/typescript/src/index.ts+++ b/sdks/typescript/src/index.ts@@ -4,4 +4,4 @@ export { Filesystem, type EntryInfo } from "./filesystem.js";export { Exec, type ProcessResult, type RunOpts, type ExecSession, type ExecSessionInfo, type ExecStartOpts, type ExecAttachOpts } from "./exec.js";export { Pty, type PtySession, type PtyOpts } from "./pty.js";export { Templates, type TemplateInfo } from "./template.js";-export { Project, type ProjectInfo, type ProjectOpts, type CreateProjectOpts, type UpdateProjectOpts } from "./project.js";+export { SecretStore, type SecretStoreInfo, type SecretEntryInfo, type SecretStoreOpts, type CreateSecretStoreOpts, type UpdateSecretStoreOpts } from "./project.js";diff --git a/sdks/typescript/src/project.ts b/sdks/typescript/src/project.tsindex f9e4d09e..3392d2b3 100644--- a/sdks/typescript/src/project.ts+++ b/sdks/typescript/src/project.ts@@ -3,43 +3,40 @@ function resolveApiUrl(url: string): string {return base.endsWith("/api") ? base : `${base}/api`;}-export interface ProjectInfo {+export interface SecretStoreInfo {id: string;orgId: string;name: string;- template: string;- cpuCount: number;- memoryMB: number;- timeoutSec: number;egressAllowlist: string[];createdAt: string;updatedAt: string;}-export interface ProjectOpts {+export interface SecretEntryInfo {+ id: string;+ storeId: string;+ name: string;+ allowedHosts: string[];+ createdAt: string;+ updatedAt: string;+}++export interface SecretStoreOpts {apiKey?: string;apiUrl?: string;}-export interface CreateProjectOpts extends ProjectOpts {+export interface CreateSecretStoreOpts extends SecretStoreOpts {name: string;- template?: string;- cpuCount?: number;- memoryMB?: number;- timeoutSec?: number;egressAllowlist?: string[];}-export interface UpdateProjectOpts extends ProjectOpts {+export interface UpdateSecretStoreOpts extends SecretStoreOpts {name?: string;- template?: string;- cpuCount?: number;- memoryMB?: number;- timeoutSec?: number;egressAllowlist?: string[];}-function getConfig(opts: ProjectOpts) {+function getConfig(opts: SecretStoreOpts) {const apiUrl = resolveApiUrl(opts.apiUrl ?? process.env.OPENCOMPUTER_API_URL ?? "https://app.opencomputer.dev");const apiKey = opts.apiKey ?? process.env.OPENCOMPUTER_API_KEY ?? "";const headers: Record<string, string> = { "Content-Type": "application/json" };@@ -47,20 +44,16 @@ function getConfig(opts: ProjectOpts) {return { apiUrl, headers };}-export class Project {+export class SecretStore {private constructor() {}- static async create(opts: CreateProjectOpts): Promise<ProjectInfo> {+ static async create(opts: CreateSecretStoreOpts): Promise<SecretStoreInfo> {const { apiUrl, headers } = getConfig(opts);const body: Record<string, unknown> = { name: opts.name };- if (opts.template) body.template = opts.template;- if (opts.cpuCount != null) body.cpuCount = opts.cpuCount;- if (opts.memoryMB != null) body.memoryMB = opts.memoryMB;- if (opts.timeoutSec != null) body.timeoutSec = opts.timeoutSec;if (opts.egressAllowlist) body.egressAllowlist = opts.egressAllowlist;- const resp = await fetch(`${apiUrl}/projects`, {+ const resp = await fetch(`${apiUrl}/secret-stores`, {method: "POST",headers,body: JSON.stringify(body),@@ -68,48 +61,44 @@ export class Project {if (!resp.ok) {const text = await resp.text();- throw new Error(`Failed to create project: ${resp.status} ${text}`);+ throw new Error(`Failed to create secret store: ${resp.status} ${text}`);}return resp.json();}- static async list(opts: ProjectOpts = {}): Promise<ProjectInfo[]> {+ static async list(opts: SecretStoreOpts = {}): Promise<SecretStoreInfo[]> {const { apiUrl, headers } = getConfig(opts);- const resp = await fetch(`${apiUrl}/projects`, { headers });+ const resp = await fetch(`${apiUrl}/secret-stores`, { headers });if (!resp.ok) {- throw new Error(`Failed to list projects: ${resp.status}`);+ throw new Error(`Failed to list secret stores: ${resp.status}`);}return resp.json();}- static async get(projectId: string, opts: ProjectOpts = {}): Promise<ProjectInfo> {+ static async get(storeId: string, opts: SecretStoreOpts = {}): Promise<SecretStoreInfo> {const { apiUrl, headers } = getConfig(opts);- const resp = await fetch(`${apiUrl}/projects/${projectId}`, { headers });+ const resp = await fetch(`${apiUrl}/secret-stores/${storeId}`, { headers });if (!resp.ok) {- throw new Error(`Failed to get project: ${resp.status}`);+ throw new Error(`Failed to get secret store: ${resp.status}`);}return resp.json();}- static async update(projectId: string, opts: UpdateProjectOpts): Promise<ProjectInfo> {+ static async update(storeId: string, opts: UpdateSecretStoreOpts): Promise<SecretStoreInfo> {const { apiUrl, headers } = getConfig(opts);const body: Record<string, unknown> = {};if (opts.name) body.name = opts.name;- if (opts.template) body.template = opts.template;- if (opts.cpuCount != null) body.cpuCount = opts.cpuCount;- if (opts.memoryMB != null) body.memoryMB = opts.memoryMB;- if (opts.timeoutSec != null) body.timeoutSec = opts.timeoutSec;if (opts.egressAllowlist) body.egressAllowlist = opts.egressAllowlist;- const resp = await fetch(`${apiUrl}/projects/${projectId}`, {+ const resp = await fetch(`${apiUrl}/secret-stores/${storeId}`, {method: "PUT",headers,body: JSON.stringify(body),@@ -117,34 +106,37 @@ export class Project {if (!resp.ok) {const text = await resp.text();- throw new Error(`Failed to update project: ${resp.status} ${text}`);+ throw new Error(`Failed to update secret store: ${resp.status} ${text}`);}return resp.json();}- static async delete(projectId: string, opts: ProjectOpts = {}): Promise<void> {+ static async delete(storeId: string, opts: SecretStoreOpts = {}): Promise<void> {const { apiUrl, headers } = getConfig(opts);- const resp = await fetch(`${apiUrl}/projects/${projectId}`, {+ const resp = await fetch(`${apiUrl}/secret-stores/${storeId}`, {method: "DELETE",headers,});if (!resp.ok) {- throw new Error(`Failed to delete project: ${resp.status}`);+ throw new Error(`Failed to delete secret store: ${resp.status}`);}}- // ── Secrets ──────────────────────────────────────────────────────────────+ // ── Secret Entries ──────────────────────────────────────────────────────- static async setSecret(projectId: string, name: string, value: string, opts: ProjectOpts = {}): Promise<void> {+ static async setSecret(storeId: string, name: string, value: string, opts: SecretStoreOpts & { allowedHosts?: string[] } = {}): Promise<void> {const { apiUrl, headers } = getConfig(opts);- const resp = await fetch(`${apiUrl}/projects/${projectId}/secrets/${name}`, {+ const body: Record<string, unknown> = { value };+ if (opts.allowedHosts) body.allowedHosts = opts.allowedHosts;++ const resp = await fetch(`${apiUrl}/secret-stores/${storeId}/secrets/${name}`, {method: "PUT",headers,- body: JSON.stringify({ value }),+ body: JSON.stringify(body),});if (!resp.ok) {@@ -153,10 +145,10 @@ export class Project {}}- static async deleteSecret(projectId: string, name: string, opts: ProjectOpts = {}): Promise<void> {+ static async deleteSecret(storeId: string, name: string, opts: SecretStoreOpts = {}): Promise<void> {const { apiUrl, headers } = getConfig(opts);- const resp = await fetch(`${apiUrl}/projects/${projectId}/secrets/${name}`, {+ const resp = await fetch(`${apiUrl}/secret-stores/${storeId}/secrets/${name}`, {method: "DELETE",headers,});@@ -166,10 +158,10 @@ export class Project {}}- static async listSecrets(projectId: string, opts: ProjectOpts = {}): Promise<string[]> {+ static async listSecrets(storeId: string, opts: SecretStoreOpts = {}): Promise<SecretEntryInfo[]> {const { apiUrl, headers } = getConfig(opts);- const resp = await fetch(`${apiUrl}/projects/${projectId}/secrets`, { headers });+ const resp = await fetch(`${apiUrl}/secret-stores/${storeId}/secrets`, { headers });if (!resp.ok) {throw new Error(`Failed to list secrets: ${resp.status}`);diff --git a/sdks/typescript/src/sandbox.ts b/sdks/typescript/src/sandbox.tsindex 2f99d868..6c1914a2 100644--- a/sdks/typescript/src/sandbox.ts+++ b/sdks/typescript/src/sandbox.ts@@ -17,8 +17,8 @@ export interface SandboxOpts {metadata?: Record<string, string>;cpuCount?: number;memoryMB?: number;- /** Project name — inherits template, cpu, memory, timeout, and secrets from the project. */- project?: string;+ /** Secret store name — resolves encrypted secrets and egress allowlist. */+ secretStore?: string;}interface SandboxData {@@ -120,7 +120,7 @@ export class Sandbox {if (opts.metadata) body.metadata = opts.metadata;if (opts.cpuCount != null) body.cpuCount = opts.cpuCount;if (opts.memoryMB != null) body.memoryMB = opts.memoryMB;- if (opts.project) body.project = opts.project;+ if (opts.secretStore) body.secretStore = opts.secretStore;const resp = await fetch(`${apiUrl}/sandboxes`, {method: "POST",