a937b89a47
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Environments are configured through a JSON-schema-driven form (`JsonSchemaForm`), and each sandbox provider (here, Daytona) supplies a manifest describing its fields > - In the Daytona environment config form, the "memory" field rendered as a free-text input; on save the value round-tripped to `0`, producing a server-side "number must be greater than zero" error even when the user typed a valid number like `2` > - Rather than patch the free-text input, memory is now a true dropdown of the sandbox sizes Daytona actually supports, so an invalid value can no longer be typed or coerced > - The dropdown leads with a blank "None" row that is selected by default (meaning "not configured — use Daytona's defaults"); `0` is never offered because it is not a valid configuration > - The benefit is that operators pick a valid memory size from a constrained list, it saves correctly as an integer, and leaving it unset cleanly omits the field instead of submitting `0` ## Linked Issues or Issue Description No public GitHub issue exists; describing the bug inline per the bug report template. ### What happened? In the Daytona environment configuration form, the memory field is a free-text input labelled "gigabytes of RAM". Entering a value such as `2` and saving coerced the value to `0`, and the server rejected the save with "the number must be greater than zero". There was no way to enter a valid memory size through the form. ### Expected behavior Selecting a valid memory size (e.g. `2`) keeps that value and saves cleanly as an integer. Leaving memory unset is valid and submits no value (Daytona defaults apply). `0` is never selectable. ### Steps to reproduce 1. Open the environment configuration form for a Daytona sandbox provider. 2. In the memory field, type `2`. 3. Click Save. 4. Observe the value becomes `0` and the form errors with "the number must be greater than zero". ## What Changed - Daytona manifest: `memory` is now an `enum` of the supported sandbox sizes `[1, 2, 4, 8]` (GiB). It stays optional, so "not configured" remains valid. `0` is not in the list. - `JsonSchemaForm` `EnumField`: optional enums now render a leading blank **None** row that is selected by default when no value is set, letting the user express "not configured" and clear a previous selection (Radix `Select` forbids an empty-string item value, so the unset state maps to a sentinel that translates back to `undefined`). - `JsonSchemaForm` `EnumField`: when every enum option is numeric, the selected value is coerced back to a number on change so the payload keeps the schema's integer type (a stringified `"2"` would otherwise fail server-side integer validation — this is what fixes the original bug for the dropdown path). - Tests: added `EnumField` coverage in `JsonSchemaForm.test.tsx` (blank row present, no `0`, blank selected by default, numeric coercion, blank → unset) and Daytona manifest coverage in the plugin test (memory enum is `[1,2,4,8]`, excludes `0`, stays optional). ## Verification - `cd ui && npx vitest run src/components/JsonSchemaForm.test.tsx src/pages/CompanyEnvironments.test.tsx` → 16/16 passing (14 + 2). - `vitest run` in `packages/plugins/sandbox-providers/daytona` → 19/19 passing (incl. 3 new manifest tests). - `cd ui && npx tsc --noEmit` → clean. - Behavior: the memory field now renders as a dropdown showing **None / 1 / 2 / 4 / 8**, with **None** selected by default. Picking `2` stores the integer `2`; picking **None** clears the field so it is omitted from the payload (no `0`, no "must be greater than zero" error). ## Risks - Low risk. The blank-row + numeric-coercion changes live in `EnumField`. The blank row is only added for **optional** enums (required enums are unaffected); numeric coercion only triggers when every option is numeric, so existing string enums (`egressMode`, `backend`, `sessionStrategy`) are unchanged. The manifest change is scoped to the Daytona provider. ## Model Used Claude (Anthropic), Opus-class model, used via the Paperclip agent workflow (author + reviewer agents) with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above (none found) - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links - [x] My branch name describes the change and contains no internal Paperclip ticket id - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge
110 lines
3.8 KiB
TypeScript
110 lines
3.8 KiB
TypeScript
import type { PaperclipPluginManifestV1 } from "@paperclipai/plugin-sdk";
|
|
|
|
const PLUGIN_ID = "paperclip.daytona-sandbox-provider";
|
|
const PLUGIN_VERSION = "0.1.0";
|
|
|
|
const manifest: PaperclipPluginManifestV1 = {
|
|
id: PLUGIN_ID,
|
|
apiVersion: 1,
|
|
version: PLUGIN_VERSION,
|
|
displayName: "Daytona Sandbox Provider",
|
|
description:
|
|
"First-party sandbox provider plugin that provisions Daytona sandboxes as Paperclip execution environments.",
|
|
author: "Paperclip",
|
|
categories: ["automation"],
|
|
capabilities: ["environment.drivers.register"],
|
|
entrypoints: {
|
|
worker: "./dist/worker.js",
|
|
},
|
|
environmentDrivers: [
|
|
{
|
|
driverKey: "daytona",
|
|
kind: "sandbox_provider",
|
|
displayName: "Daytona Sandbox",
|
|
description:
|
|
"Provisions Daytona sandboxes with configurable image or snapshot selection, startup timeouts, and lease reuse.",
|
|
configSchema: {
|
|
type: "object",
|
|
properties: {
|
|
apiKey: {
|
|
type: "string",
|
|
format: "secret-ref",
|
|
description:
|
|
"Environment-specific Daytona API key. Paste a key or an existing Paperclip secret reference; saved environments store pasted values as company secrets. Falls back to DAYTONA_API_KEY if omitted.",
|
|
},
|
|
apiUrl: {
|
|
type: "string",
|
|
description:
|
|
"Optional Daytona API base URL. If omitted, the Daytona SDK uses its configured default endpoint.",
|
|
},
|
|
target: {
|
|
type: "string",
|
|
description: "Optional Daytona target/region identifier.",
|
|
},
|
|
snapshot: {
|
|
type: "string",
|
|
description: "Optional Daytona snapshot name to start from.",
|
|
},
|
|
image: {
|
|
type: "string",
|
|
description:
|
|
"Optional base image or Daytona Image reference. If set, the sandbox is created from this image instead of a snapshot.",
|
|
},
|
|
language: {
|
|
type: "string",
|
|
description:
|
|
"Optional Daytona language hint for direct code execution. If omitted, Daytona uses its default runtime.",
|
|
},
|
|
cpu: {
|
|
type: "integer",
|
|
description: "Optional CPU allocation in cores.",
|
|
minimum: 1,
|
|
},
|
|
memory: {
|
|
type: "integer",
|
|
description:
|
|
"Optional memory allocation in GiB. Leave unset to use Daytona defaults; supported sandbox sizes are 1, 2, 4, and 8 GiB.",
|
|
enum: [1, 2, 4, 8],
|
|
},
|
|
disk: {
|
|
type: "integer",
|
|
description: "Optional disk allocation in GiB.",
|
|
minimum: 1,
|
|
},
|
|
gpu: {
|
|
type: "integer",
|
|
description: "Optional GPU allocation in units.",
|
|
minimum: 1,
|
|
},
|
|
timeoutMs: {
|
|
type: "number",
|
|
description: "Timeout for Daytona create/start/stop/execute operations in milliseconds.",
|
|
default: 300000,
|
|
},
|
|
autoStopInterval: {
|
|
type: "number",
|
|
description: "Optional Daytona auto-stop interval in minutes. `0` disables auto-stop.",
|
|
},
|
|
autoArchiveInterval: {
|
|
type: "number",
|
|
description: "Optional Daytona auto-archive interval in minutes. `0` uses Daytona's max interval.",
|
|
},
|
|
autoDeleteInterval: {
|
|
type: "number",
|
|
description:
|
|
"Optional Daytona auto-delete interval in minutes. `-1` disables auto-delete and `0` deletes immediately after stop.",
|
|
},
|
|
reuseLease: {
|
|
type: "boolean",
|
|
description:
|
|
"Whether to stop and later resume the sandbox across runs instead of deleting it on release.",
|
|
default: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
export default manifest;
|