@synap-core/workspace-templates 0.58.0 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,6 +26,7 @@ How installs, reconciles and tiers work is in the `synap-market` skill
26
26
  | `views/<slug>.view.json` | `view` | Manifest; `spec.views` in the canonical shape the CP stores (`{slug, displayName, type, config, scopeProfileSlugs}`) | Category `view`. Three today (`bookmark-views-pack`, `event-views-pack`, `task-views-pack`), moved from the old CP pack fragments on 2026-11-05. CI on every push to main |
27
27
  | `automations/<slug>.automation.json` | `automation` | bridge-setup `flowDefinition` form, plus a header `automations/<slug>.catalog.json` beside it | Only with its header, and only without apply-time placeholders. Headers decided by the founder on 2026-11-05: `bookmark-enrichment` public; `url-bookmark-capture`, `github-pr-events` and the five `ship-a-change-*` unlisted. `mail-feed` stays **staged**: it carries two placeholders bridge-setup fills |
28
28
  | `agents/<slug>.agent.yaml` | `agent` | Manifest. `spec` (`schema/agent.ts`) is what the pod reads as `definition.agent`: `harness` (the `agent_type` join key), `aliases`, `worker`, `tried`, `detect`, `wake` (data: `program` + `args` + `params`, never a shell line; required for a worker only), `practices.skills`, `mcp` (where its program reads MCP servers: `config` under ~/, `format` yaml/json, `key` dot path, `entry`; the CLI writes the pod's server there on `synap agents add`, the pod ignores it), `toolProfile` (`entry` / `builder`) + `toolGroups` (only with `entry`): the MCP tools an agent's first key lists, read by the pod (backend#900). One per program of the backend harness registry, plus `hermes`. CP category `agent`, official vendor only, left out of browse lists (the catalog installs every official agent on every pod, founder decision D8) | Yes, on every push to main, like every other kind (the first publish was the founder's, by hand, on 2026-11-07; `FIRST_PUBLISH_BY_HAND` is empty since) |
29
+ | `renderer-bundles/<slug>.yaml` | `renderer-bundle` | Manifest (`schema/renderer-bundle.ts`): the cells (each an entry module under `packages/web/src/renderer-bundle/cells/`, importing only the bundle's kit `space-packages/kit-bundle.ts`), and the host's fallbacks (`defaults`). `pnpm --filter @synap-core/workspace-templates build:renderer-bundle` builds `renderer-bundles/built/<slug>.definition.json` (the `RendererBundleDefinition`: its own React, kit and tokens, the cells' code, every sha256) and `<slug>.build.json` (inputs + the tRPC trace), both committed and held fresh by `scripts/build-renderer-bundle.test.ts`. Never in the npm package (`files`). Licence PolyForm Noncommercial 1.0.0 | Category `renderer-bundle`, private, never synced: the CP delivers it to any live pod a Synap plan covers (decision c91d26dc; founder, 20 Nov 2026). CI on every push to main, once the CP accepts the category |
29
30
  | `schema/` | | Zod manifest schema: `header.ts`, plus one body per kind (`workspace`, `capability`, `skill`, `automation`, `view`, `agent`, `playbook`) | |
30
31
  | `standards/*.standard.yaml` | | Quality standard per workspace (`pnpm eval`) | |
31
32
  | `scripts/catalog-lib.mjs` | | **The ONE lib**: `loadCatalog` → `validateCatalog` → `diffCatalog` → `publishCatalog` | |
@@ -44,10 +44,16 @@
44
44
  "name": "design.catalog",
45
45
  "kind": "builtin",
46
46
  "scope": "pod",
47
- "description": "What a design may be made of: the kit's components and their props, the canvas blocks (Section, Box, Stack, Row, Grid, Heading, Text, Motion) whose spacing, radius and colour options are token steps, the grid per width class and the frame presets. Read it before writing a design; every refusal names its hash.",
47
+ "description": "What a design may be made of: the kit's components and their props, the canvas blocks (Section, Box, Stack, Row, Grid, Heading, Text, Motion) whose spacing, radius and colour options are token steps, the grid per width class and the frame presets. With appId, the catalog of that app's designs: its own component kit when it has one (its design-kit), else Synap's. Read it before writing a design; every refusal names its hash.",
48
48
  "parameters": {
49
49
  "type": "object",
50
- "properties": {},
50
+ "properties": {
51
+ "appId": {
52
+ "type": "string",
53
+ "format": "uuid",
54
+ "description": "The app (devplane_app) a design is for. Its designs are drawn with the app's own component kit when it has one (its `design-kit`); omit it for Synap's own components."
55
+ }
56
+ },
51
57
  "additionalProperties": false
52
58
  },
53
59
  "metadata": {
@@ -78,7 +84,7 @@
78
84
  "items": {
79
85
  "type": "object"
80
86
  },
81
- "description": "The ops, applied in order, all or nothing: create_design {title, appId?, projectId?} (first only), add_frame {preset, name?, id?, pageOf?, x?, y?}, update_frame {frameId, name?, preset?, x?, y?, w?, h?}, remove_frame {frameId}, add_block {frameId, parentId?, slot?, index?, type, props?}, update_block {id, props?, unset?}, move_block {id, frameId?, parentId?, slot?, index?}, remove_block {id}, set_span {id, class, span}, set_hide {id, class, hide}, replace_page {frameId, page}, replace_board {board}."
87
+ "description": "The ops, applied in order, all or nothing: create_design {title, appId?, projectId?} (first only), add_frame {preset, name?, id?, pageOf?, x?, y?}, update_frame {frameId, name?, preset?, x?, y?, w?, h?}, remove_frame {frameId}, add_block {frameId, parentId?, slot?, index?, type, props?}, update_block {id, props?, unset?}, move_block {id, frameId?, parentId?, slot?, index?}, remove_block {id}, set_span {id, class, span}, set_start {id, class, start}, set_hide {id, class, hide}, replace_page {frameId, page}, replace_board {board}."
82
88
  },
83
89
  "acceptDrops": {
84
90
  "type": "boolean",
@@ -63,7 +63,7 @@
63
63
  "intent": "generate_media",
64
64
  "kind": "code",
65
65
  "scope": "pod",
66
- "description": "Generates images from a text prompt via fal.ai (proposal-gated) and proposes each result as a bookmark entity holding its image URL. Args: { prompt: string, model?: string (fal model id, default 'fal-ai/flux/schnell'; edit/reference models such as 'fal-ai/nano-banana/edit' need imageUrls), imageSize?: string (default 'square_hd' when no aspectRatio, e.g. 'square'|'portrait_4_3'|'landscape_16_9'), numImages?: string (default '1', max 4), imageUrls?: string[] (1-8 public http(s) reference or source image URLs, sent as image_urls), images?: pod file entity ids (reference images from the pod; the pod signs them at run time and they join imageUrls in image_urls, 8 at most in all), aspectRatio?: string (e.g. '16:9', '1:1', 'auto'; sent as aspect_ratio, used by nano-banana), seed?: string (whole number, for reproducible results) }. Only these args reach fal. Returns { imageUrl (first), imageUrls (all), imageCount, seed, bookmarks: [{ url, status, proposalId?, error? }], bookmarkFailures }; a failed bookmark write is reported there and never fails the run.",
66
+ "description": "Generates images from a text prompt via fal.ai (proposal-gated) and proposes each result as a bookmark entity holding its image URL. Args: { prompt: string, model?: string (fal model id, default 'fal-ai/flux/schnell'; edit/reference models such as 'fal-ai/nano-banana/edit' need imageUrls), imageSize?: string (default 'square_hd' when no aspectRatio, e.g. 'square'|'portrait_4_3'|'landscape_16_9'), numImages?: string (default '1', max 4), imageUrls?: string[] (1-8 public http(s) reference or source image URLs, sent as image_urls), images?: pod file entity ids (reference images from the pod; the pod signs them at run time and they join imageUrls in image_urls, 8 at most in all), aspectRatio?: string (e.g. '16:9', '1:1', 'auto'; sent as aspect_ratio, used by nano-banana), seed?: string (whole number, for reproducible results) }. Only these args reach fal. Per-model input rules (metadata.parameterRules: FLUX Kontext takes only the aspect ratios 21:9 to 9:21, and exactly one image unless /multi) are checked before the run is proposed. Returns { imageUrl (first), imageUrls (all), imageCount, seed, bookmarks: [{ url, status, proposalId?, error? }], bookmarkFailures }; a failed bookmark write is reported there and never fails the run.",
67
67
  "requires": [
68
68
  "fal_api"
69
69
  ],
@@ -79,7 +79,99 @@
79
79
  "aspectRatio": "string?",
80
80
  "seed": "string?"
81
81
  },
82
- "code": "// Generate an image via fal.ai's synchronous run endpoint (side-effecting write:\n// calls a billed external API). Executor wraps this body as\n// (async (args, context) => { <code> }); use args directly and `return`.\n// callProvider(tool, method, path, body?, opts?) resolves the fal_api tool by\n// NAME, injects the vaulted key as Authorization: Key <key>, and uses the\n// tool's config.baseUrl = https://fal.run. The model id becomes the path.\n//\n// MODEL INPUTS: only the DECLARED args reach fal, each validated and capped:\n// imageUrls -> image_urls (edit / reference models such as\n// fal-ai/nano-banana/edit), aspectRatio -> aspect_ratio, seed -> seed. Nothing\n// else is forwarded, so a caller cannot smuggle a key or an arbitrary field\n// into the billed request. A fal-style snake_case spelling of a declared arg\n// is REFUSED with the name to use, never silently dropped (a dropped\n// image_urls is what turned an edit call into a fal 422).\nconst prompt = String(args?.prompt ?? '').trim();\nif (!prompt) throw new Error('fal_generate_image: prompt is required');\nconst SNAKE = { image_urls: 'imageUrls', aspect_ratio: 'aspectRatio', image_size: 'imageSize', num_images: 'numImages' };\nfor (const k of Object.keys(SNAKE)) {\n if (args && args[k] !== undefined) throw new Error('fal_generate_image: pass ' + SNAKE[k] + ', not ' + k);\n}\nconst model = String(args?.model ?? 'fal-ai/flux/schnell').trim() || 'fal-ai/flux/schnell';\nif (!/^[a-z0-9][a-z0-9._-]*(\\/[a-z0-9][a-z0-9._-]*){1,4}$/i.test(model)) {\n throw new Error('fal_generate_image: model must be a fal model id such as fal-ai/flux/schnell');\n}\nconst numImagesRaw = Number(args?.numImages ?? 1);\nconst numImages = Number.isFinite(numImagesRaw) && numImagesRaw > 0 ? Math.min(Math.floor(numImagesRaw), 4) : 1;\n\nconst payload = { prompt, num_images: numImages };\nlet imageUrls = [];\nif (args?.imageUrls !== undefined) {\n if (!Array.isArray(args.imageUrls)) throw new Error('fal_generate_image: imageUrls must be an array of URLs');\n imageUrls = args.imageUrls.map((u) => String(u ?? '').trim()).filter((u) => u.length > 0);\n if (imageUrls.length === 0) throw new Error('fal_generate_image: imageUrls is empty');\n if (imageUrls.length > 8) throw new Error('fal_generate_image: imageUrls takes at most 8 URLs');\n for (const u of imageUrls) {\n // Public http(s) only, no userinfo (user:pass@) and no data:/file:/vault: refs.\n if (u.length > 2048 || !/^https?:\\/\\/[^\\s\\/?#@]+([\\/?#][^\\s]*)?$/i.test(u)) {\n throw new Error('fal_generate_image: imageUrls must be public http(s) URLs without credentials (got ' + u.slice(0, 80) + ')');\n }\n }\n}\n// `images` are POD FILES (declared \"file[]:url?\", backend #469): the caller passes\n// file entity ids and the pod swaps each for a fresh signed URL at run time (6 h\n// for this async verb). Those URLs are sent to fal and never stored or echoed.\nlet podImages = [];\nif (args?.images !== undefined && args?.images !== null) {\n if (!Array.isArray(args.images)) throw new Error('fal_generate_image: images must be a list of pod file ids');\n podImages = args.images.map((u) => String(u ?? '').trim()).filter((u) => u.length > 0);\n for (const u of podImages) {\n if (u.length > 4096 || !/^https:\\/\\/[^\\s\\/?#@]+([\\/?#][^\\s]*)?$/i.test(u)) {\n throw new Error('fal_generate_image: images did not arrive as signed pod file URLs; pass pod file entity ids');\n }\n }\n}\nconst references = imageUrls.concat(podImages);\nif (references.length > 8) throw new Error('fal_generate_image: imageUrls and images take at most 8 images together');\nif (references.length > 0) payload.image_urls = references;\nconst aspectRatio = args?.aspectRatio === undefined ? '' : String(args.aspectRatio).trim();\nif (aspectRatio) {\n if (!/^(auto|\\d{1,2}:\\d{1,2})$/.test(aspectRatio)) throw new Error('fal_generate_image: aspectRatio must be like 16:9, 1:1 or auto');\n payload.aspect_ratio = aspectRatio;\n}\n// image_size: sent when asked for, or as the default when no aspectRatio\n// is given (flux-family models size by image_size; nano-banana ignores it\n// and sizes by aspect_ratio).\nconst imageSize = args?.imageSize === undefined ? '' : String(args.imageSize).trim();\nif (imageSize || !aspectRatio) payload.image_size = imageSize || 'square_hd';\nif (args?.seed !== undefined && String(args.seed).trim() !== '') {\n const seed = Number(args.seed);\n if (!Number.isSafeInteger(seed) || seed < 0 || seed > 4294967295) throw new Error('fal_generate_image: seed must be a whole number from 0 to 4294967295');\n payload.seed = seed;\n}\n\nconst res = await callProvider('fal_api', 'POST', '/' + model, payload);\n// The capability-execution gate may return a PROPOSAL envelope ({ proposed,\n// proposalId }) instead of executing — that proposal IS the record; return early\n// WITHOUT also filing a bookmark (no double-proposal).\nif (res?.proposed === true) {\n return { success: false, proposed: true, proposalId: res?.proposalId ?? null, prompt, model };\n}\nconst ok = typeof res?.status === 'number' && res.status >= 200 && res.status < 300;\nconst body = res?.body ?? res;\nconst images = (Array.isArray(body?.images) ? body.images : []).filter((im) => typeof im?.url === 'string' && im.url);\nif (!ok || images.length === 0) {\n throw new Error('fal_generate_image: generation failed or returned no image (status ' + (res?.status ?? 'unknown') + ')');\n}\nconst urls = images.map((im) => im.url);\nconst outSeed = typeof body?.seed === 'number' ? body.seed : (payload.seed ?? null);\n\n// One bookmark per image: each variant is kept or rejected on its own.\n// TITLE = prompt + the image's own fal file id. A bookmark's identity is its\n// url, but the duplicate door's name leg compares titles: a title made of the\n// truncated prompt alone was the SAME for every variant and every re-run, so\n// each image after the first was filed as POSSIBLE_DUPLICATE, sat pending,\n// and ate the agent's pending-proposal budget until generation itself failed.\n// A failed bookmark write never fails the run: the images are generated and\n// billed, so their URLs are returned and the failure is reported beside them.\nconst shortPrompt = prompt.length > 60 ? prompt.slice(0, 57) + '...' : prompt;\nconst bookmarks = [];\nfor (let i = 0; i < images.length; i++) {\n const im = images[i];\n const file = String(im.url.split('?')[0].split('/').pop() || '').replace(/\\.[a-z0-9]+$/i, '');\n const tag = file ? file.slice(0, 32) : String(i + 1);\n try {\n const r = await propose.entity({\n profileSlug: 'bookmark',\n title: 'AI image: ' + shortPrompt + ' #' + tag,\n properties: { url: im.url, prompt, model, provenance: 'connector', provider: 'fal.ai', width: im.width ?? null, height: im.height ?? null, imageCount: images.length, imageIndex: i + 1, seed: outSeed, referenceUrls: imageUrls.length ? imageUrls : null, referencePodFiles: podImages.length || null },\n reasoning: 'Recorded the fal.ai-generated image so it is findable in the pod.'\n });\n bookmarks.push({ url: im.url, status: r?.status ?? 'unknown', proposalId: r?.proposalId ?? null, entityId: r?.proposedEntityId ?? null });\n } catch (err) {\n bookmarks.push({ url: im.url, status: 'failed', error: String(err?.message ?? err).slice(0, 300) });\n }\n}\nconst bookmarkFailures = bookmarks.filter((b) => b.status === 'failed').length;\nreturn { success: true, proposed: false, imageUrl: urls[0], imageUrls: urls, model, prompt, imageCount: urls.length, seed: outSeed, bookmarks, bookmarkFailures };"
82
+ "metadata": {
83
+ "parameterRules": [
84
+ {
85
+ "when": {
86
+ "model": [
87
+ "fal-ai/flux-pro/kontext",
88
+ "fal-ai/flux-pro/kontext/max"
89
+ ]
90
+ },
91
+ "allow": {
92
+ "aspectRatio": [
93
+ "21:9",
94
+ "16:9",
95
+ "4:3",
96
+ "3:2",
97
+ "1:1",
98
+ "2:3",
99
+ "3:4",
100
+ "9:16",
101
+ "9:21"
102
+ ]
103
+ },
104
+ "count": {
105
+ "fields": [
106
+ "images",
107
+ "imageUrls"
108
+ ],
109
+ "min": 1,
110
+ "max": 1
111
+ },
112
+ "why": "FLUX Kontext edits exactly one image (sent as image_url); for several images use the model's /multi variant, for none its /text-to-image variant."
113
+ },
114
+ {
115
+ "when": {
116
+ "model": [
117
+ "fal-ai/flux-pro/kontext/multi",
118
+ "fal-ai/flux-pro/kontext/max/multi"
119
+ ]
120
+ },
121
+ "allow": {
122
+ "aspectRatio": [
123
+ "21:9",
124
+ "16:9",
125
+ "4:3",
126
+ "3:2",
127
+ "1:1",
128
+ "2:3",
129
+ "3:4",
130
+ "9:16",
131
+ "9:21"
132
+ ]
133
+ },
134
+ "count": {
135
+ "fields": [
136
+ "images",
137
+ "imageUrls"
138
+ ],
139
+ "min": 1
140
+ },
141
+ "why": "FLUX Kontext multi edits from one or more images, so it needs at least one."
142
+ },
143
+ {
144
+ "when": {
145
+ "model": [
146
+ "fal-ai/flux-pro/kontext/text-to-image",
147
+ "fal-ai/flux-pro/kontext/max/text-to-image"
148
+ ]
149
+ },
150
+ "allow": {
151
+ "aspectRatio": [
152
+ "21:9",
153
+ "16:9",
154
+ "4:3",
155
+ "3:2",
156
+ "1:1",
157
+ "2:3",
158
+ "3:4",
159
+ "9:16",
160
+ "9:21"
161
+ ]
162
+ },
163
+ "count": {
164
+ "fields": [
165
+ "images",
166
+ "imageUrls"
167
+ ],
168
+ "max": 0
169
+ },
170
+ "why": "FLUX Kontext text-to-image takes no image; to edit one use the model without /text-to-image."
171
+ }
172
+ ]
173
+ },
174
+ "code": "// Generate an image via fal.ai's synchronous run endpoint (side-effecting write:\n// calls a billed external API). Executor wraps this body as\n// (async (args, context) => { <code> }); use args directly and `return`.\n// callProvider(tool, method, path, body?, opts?) resolves the fal_api tool by\n// NAME, injects the vaulted key as Authorization: Key <key>, and uses the\n// tool's config.baseUrl = https://fal.run. The model id becomes the path.\n//\n// MODEL INPUTS: only the DECLARED args reach fal, each validated and capped:\n// imageUrls -> image_urls (edit / reference models such as\n// fal-ai/nano-banana/edit), aspectRatio -> aspect_ratio, seed -> seed. Nothing\n// else is forwarded, so a caller cannot smuggle a key or an arbitrary field\n// into the billed request. A fal-style snake_case spelling of a declared arg\n// is REFUSED with the name to use, never silently dropped (a dropped\n// image_urls is what turned an edit call into a fal 422).\nconst prompt = String(args?.prompt ?? '').trim();\nif (!prompt) throw new Error('fal_generate_image: prompt is required');\nconst SNAKE = { image_urls: 'imageUrls', aspect_ratio: 'aspectRatio', image_size: 'imageSize', num_images: 'numImages' };\nfor (const k of Object.keys(SNAKE)) {\n if (args && args[k] !== undefined) throw new Error('fal_generate_image: pass ' + SNAKE[k] + ', not ' + k);\n}\nconst model = String(args?.model ?? 'fal-ai/flux/schnell').trim() || 'fal-ai/flux/schnell';\nif (!/^[a-z0-9][a-z0-9._-]*(\\/[a-z0-9][a-z0-9._-]*){1,4}$/i.test(model)) {\n throw new Error('fal_generate_image: model must be a fal model id such as fal-ai/flux/schnell');\n}\nconst numImagesRaw = Number(args?.numImages ?? 1);\nconst numImages = Number.isFinite(numImagesRaw) && numImagesRaw > 0 ? Math.min(Math.floor(numImagesRaw), 4) : 1;\n\nconst payload = { prompt, num_images: numImages };\nlet imageUrls = [];\nif (args?.imageUrls !== undefined) {\n if (!Array.isArray(args.imageUrls)) throw new Error('fal_generate_image: imageUrls must be an array of URLs');\n imageUrls = args.imageUrls.map((u) => String(u ?? '').trim()).filter((u) => u.length > 0);\n if (imageUrls.length === 0) throw new Error('fal_generate_image: imageUrls is empty');\n if (imageUrls.length > 8) throw new Error('fal_generate_image: imageUrls takes at most 8 URLs');\n for (const u of imageUrls) {\n // Public http(s) only, no userinfo (user:pass@) and no data:/file:/vault: refs.\n if (u.length > 2048 || !/^https?:\\/\\/[^\\s\\/?#@]+([\\/?#][^\\s]*)?$/i.test(u)) {\n throw new Error('fal_generate_image: imageUrls must be public http(s) URLs without credentials (got ' + u.slice(0, 80) + ')');\n }\n }\n}\n// `images` are POD FILES (declared \"file[]:url?\", backend #469): the caller passes\n// file entity ids and the pod swaps each for a fresh signed URL at run time (6 h\n// for this async verb). Those URLs are sent to fal and never stored or echoed.\nlet podImages = [];\nif (args?.images !== undefined && args?.images !== null) {\n if (!Array.isArray(args.images)) throw new Error('fal_generate_image: images must be a list of pod file ids');\n podImages = args.images.map((u) => String(u ?? '').trim()).filter((u) => u.length > 0);\n for (const u of podImages) {\n if (u.length > 4096 || !/^https:\\/\\/[^\\s\\/?#@]+([\\/?#][^\\s]*)?$/i.test(u)) {\n throw new Error('fal_generate_image: images did not arrive as signed pod file URLs; pass pod file entity ids');\n }\n }\n}\nconst references = imageUrls.concat(podImages);\nif (references.length > 8) throw new Error('fal_generate_image: imageUrls and images take at most 8 images together');\n// A SINGLE-image model takes ONE image as `image_url`, not a list (fal 422\n// \"body.image_url: Field required\", report 8a0b5606). The same models carry a\n// `metadata.parameterRules` count of exactly one, which the pod checks BEFORE\n// the person is asked to approve; this is only how the one image is sent.\nconst SINGLE_IMAGE_MODELS = ['fal-ai/flux-pro/kontext', 'fal-ai/flux-pro/kontext/max'];\nif (references.length > 0) {\n if (SINGLE_IMAGE_MODELS.includes(model)) {\n if (references.length !== 1) throw new Error('fal_generate_image: ' + model + ' edits exactly one image; for several use ' + model + '/multi');\n payload.image_url = references[0];\n } else {\n payload.image_urls = references;\n }\n}\nconst aspectRatio = args?.aspectRatio === undefined ? '' : String(args.aspectRatio).trim();\nif (aspectRatio) {\n if (!/^(auto|\\d{1,2}:\\d{1,2})$/.test(aspectRatio)) throw new Error('fal_generate_image: aspectRatio must be like 16:9, 1:1 or auto');\n payload.aspect_ratio = aspectRatio;\n}\n// image_size: sent when asked for, or as the default when no aspectRatio\n// is given (flux-family models size by image_size; nano-banana ignores it\n// and sizes by aspect_ratio).\nconst imageSize = args?.imageSize === undefined ? '' : String(args.imageSize).trim();\nif (imageSize || !aspectRatio) payload.image_size = imageSize || 'square_hd';\nif (args?.seed !== undefined && String(args.seed).trim() !== '') {\n const seed = Number(args.seed);\n if (!Number.isSafeInteger(seed) || seed < 0 || seed > 4294967295) throw new Error('fal_generate_image: seed must be a whole number from 0 to 4294967295');\n payload.seed = seed;\n}\n\nconst res = await callProvider('fal_api', 'POST', '/' + model, payload);\n// The capability-execution gate may return a PROPOSAL envelope ({ proposed,\n// proposalId }) instead of executing — that proposal IS the record; return early\n// WITHOUT also filing a bookmark (no double-proposal).\nif (res?.proposed === true) {\n return { success: false, proposed: true, proposalId: res?.proposalId ?? null, prompt, model };\n}\nconst ok = typeof res?.status === 'number' && res.status >= 200 && res.status < 300;\nconst body = res?.body ?? res;\nconst images = (Array.isArray(body?.images) ? body.images : []).filter((im) => typeof im?.url === 'string' && im.url);\nif (!ok || images.length === 0) {\n throw new Error('fal_generate_image: generation failed or returned no image (status ' + (res?.status ?? 'unknown') + ')');\n}\nconst urls = images.map((im) => im.url);\nconst outSeed = typeof body?.seed === 'number' ? body.seed : (payload.seed ?? null);\n\n// One bookmark per image: each variant is kept or rejected on its own.\n// TITLE = prompt + the image's own fal file id. A bookmark's identity is its\n// url, but the duplicate door's name leg compares titles: a title made of the\n// truncated prompt alone was the SAME for every variant and every re-run, so\n// each image after the first was filed as POSSIBLE_DUPLICATE, sat pending,\n// and ate the agent's pending-proposal budget until generation itself failed.\n// A failed bookmark write never fails the run: the images are generated and\n// billed, so their URLs are returned and the failure is reported beside them.\nconst shortPrompt = prompt.length > 60 ? prompt.slice(0, 57) + '...' : prompt;\nconst bookmarks = [];\nfor (let i = 0; i < images.length; i++) {\n const im = images[i];\n const file = String(im.url.split('?')[0].split('/').pop() || '').replace(/\\.[a-z0-9]+$/i, '');\n const tag = file ? file.slice(0, 32) : String(i + 1);\n try {\n const r = await propose.entity({\n profileSlug: 'bookmark',\n title: 'AI image: ' + shortPrompt + ' #' + tag,\n properties: { url: im.url, prompt, model, provenance: 'connector', provider: 'fal.ai', width: im.width ?? null, height: im.height ?? null, imageCount: images.length, imageIndex: i + 1, seed: outSeed, referenceUrls: imageUrls.length ? imageUrls : null, referencePodFiles: podImages.length || null },\n reasoning: 'Recorded the fal.ai-generated image so it is findable in the pod.'\n });\n bookmarks.push({ url: im.url, status: r?.status ?? 'unknown', proposalId: r?.proposalId ?? null, entityId: r?.proposedEntityId ?? null });\n } catch (err) {\n bookmarks.push({ url: im.url, status: 'failed', error: String(err?.message ?? err).slice(0, 300) });\n }\n}\nconst bookmarkFailures = bookmarks.filter((b) => b.status === 'failed').length;\nreturn { success: true, proposed: false, imageUrl: urls[0], imageUrls: urls, model, prompt, imageCount: urls.length, seed: outSeed, bookmarks, bookmarkFailures };"
83
175
  }
84
176
  ],
85
177
  "provides": [
@@ -0,0 +1,117 @@
1
+ {
2
+ "apiVersion": "synap/v1",
3
+ "kind": "capability",
4
+ "meta": {
5
+ "slug": "vast-ai-compute-worker",
6
+ "name": "Vast.ai Compute Worker",
7
+ "description": "Provision an interruptible or on-demand GPU lease on Vast.ai, serve a public open-weight coding model through vLLM, register it as a temporary upstream in the central LiteLLM gateway, and deterministically remove both the route and instance.",
8
+ "tags": ["capability", "ai", "agents", "compute", "vast"],
9
+ "isPublic": false,
10
+ "owner": "template-owner",
11
+ "syncByDefault": false
12
+ },
13
+ "spec": {
14
+ "key": "vast-ai-compute-worker",
15
+ "name": "Vast.ai Compute Worker",
16
+ "description": "A governed GPU-worker lease controller. It uses a scoped Vast API key and the LiteLLM gateway master key, both stored in the pod vault. It never sends either credential to the marketplace worker. The only secret exposed to the worker is a dedicated vLLM API key; it is also stored in LiteLLM as the upstream API key. Lifecycle: search -> start -> status/health -> register -> drain -> destroy. The runtime has no timer: status returns nextPollSeconds instead of sleeping. Use a Git branch and persist work frequently for interruptible offers.",
17
+ "params": [
18
+ {"name":"vastApiKey","label":"Vast.ai scoped API key","type":"password","required":true,"description":"A Vast.ai key restricted to searching offers and creating, reading, stopping and destroying this account's instances. Stored encrypted in the pod vault."},
19
+ {"name":"litellmMasterKey","label":"LiteLLM master key","type":"password","required":true,"description":"The master key for the central LiteLLM proxy. Stored encrypted in the pod vault; never sent to Vast or a worker."},
20
+ {"name":"workerApiKey","label":"vLLM worker API key","type":"password","required":true,"description":"A random dedicated secret used only between LiteLLM and an ephemeral vLLM worker. It is the only secret sent to a Vast instance."},
21
+ {"name":"litellmBaseUrl","label":"LiteLLM base URL","type":"text","required":false,"default":"https://litellm.antoinesrvt.synap.live","description":"Central LiteLLM gateway URL, without a trailing slash."},
22
+ {"name":"defaultModel","label":"Default open coding model","type":"text","required":false,"default":"Qwen/Qwen3-Coder-30B-A3B-Instruct","description":"Public Hugging Face model id launched by vLLM. Test and replace this after benchmark runs."}
23
+ ],
24
+ "vault": [
25
+ {"ref":"vastApiKeySecret","name":"{{name}} Vast API key","value":"{{vastApiKey}}","type":"api_key","service":"vast.ai","description":"Scoped Vast API key for the lease controller."},
26
+ {"ref":"litellmMasterKeySecret","name":"{{name}} LiteLLM master key","value":"{{litellmMasterKey}}","type":"api_key","service":"litellm","description":"Central LiteLLM administration key."},
27
+ {"ref":"workerApiKeySecret","name":"{{name}} vLLM worker API key","value":"{{workerApiKey}}","type":"api_key","service":"vllm","description":"Per-worker upstream key; never use a provider master key here."}
28
+ ],
29
+ "tools": [
30
+ {
31
+ "name":"vast_ai_api",
32
+ "kind":"api",
33
+ "executor":"is-agent",
34
+ "description":"Authenticated Vast.ai API at https://console.vast.ai/api/v0. The pod injects the vaulted scoped key as Authorization: Bearer; it is never included in worker launch environment.",
35
+ "credentialRef":"vastApiKeySecret",
36
+ "config":{"baseUrl":"https://console.vast.ai/api/v0","auth":{"in":"header","name":"Authorization","prefix":"Bearer "}}
37
+ },
38
+ {
39
+ "name":"litellm_admin",
40
+ "kind":"api",
41
+ "executor":"is-agent",
42
+ "description":"Authenticated central LiteLLM administration API. Use only to create/delete the temporary upstream model alias; the master key never leaves the pod.",
43
+ "credentialRef":"litellmMasterKeySecret",
44
+ "config":{"baseUrl":"{{litellmBaseUrl}}","auth":{"in":"header","name":"Authorization","prefix":"Bearer "}}
45
+ }
46
+ ],
47
+ "skills": [
48
+ {
49
+ "name":"vast_worker_search",
50
+ "intent":"search_external",
51
+ "kind":"code",
52
+ "scope":"pod",
53
+ "description":"Lists eligible Vast offers for a coding worker. Args: { minVramGb?: 48|64|80|96, maxHourlyUsd?: number, interruptible?: boolean, minReliability?: number }. Returns normalized candidates, cheapest first. Read-only.",
54
+ "requires":["vast_ai_api"],
55
+ "executionMode":"sync",
56
+ "timeoutSeconds":30,
57
+ "metadata":{"readOnly":true},
58
+ "parameters":{"minVramGb":"number?","maxHourlyUsd":"number?","interruptible":"boolean?","minReliability":"number?"},
59
+ "code":"const vram = Number(args?.minVramGb ?? 48); const cap = Number(args?.maxHourlyUsd ?? 1); const interruptible = args?.interruptible !== false; const reliability = Number(args?.minReliability ?? 0.95); if (![48,64,80,96].includes(vram)) throw new Error('minVramGb must be 48, 64, 80 or 96'); if (!(cap > 0 && cap <= 3)) throw new Error('maxHourlyUsd must be > 0 and <= 3'); const body={limit:100,type:interruptible?'interruptible':'on-demand',verified:{eq:true},rentable:{eq:true},rented:{eq:false},gpu_total_ram:{gte:vram*1024},dph_total:{lte:cap},reliability:{gte:reliability},direct_port_count:{gte:1}}; const r=await callProvider('vast_ai_api','POST','/bundles',body); const offers=Array.isArray(r?.body?.offers)?r.body.offers:Array.isArray(r?.body)?r.body:[]; return { interruptible, candidates: offers.map(o=>({offerId:o.id ?? o.ask_contract_id,gpu:o.gpu_name,vramGb:Math.round(Number(o.gpu_total_ram ?? o.gpu_ram ?? 0)/1024),hourlyUsd:o.dph_total,reliability:o.reliability,dlperf:o.dlperf,location:o.geolocation,directPorts:o.direct_port_count})).filter(o=>o.offerId && o.hourlyUsd<=cap).sort((a,b)=>a.hourlyUsd-b.hourlyUsd) };"
60
+ },
61
+ {
62
+ "name":"vast_worker_start",
63
+ "intent":"run_external_job",
64
+ "kind":"code",
65
+ "scope":"pod",
66
+ "description":"Rents one Vast offer and launches vLLM. Args: { offerId, model?, maxModelLen?: number, diskGb?: number, interruptible?: boolean, ttlMinutes?: number }. Returns a lease receipt and requires polling with vast_worker_status. This is billed and therefore write-governed.",
67
+ "requires":["vast_ai_api"],
68
+ "executionMode":"async",
69
+ "timeoutSeconds":60,
70
+ "metadata":{"verbType":"write"},
71
+ "parameters":{"offerId":"number","model":"string?","maxModelLen":"number?","diskGb":"number?","interruptible":"boolean?","ttlMinutes":"number?"},
72
+ "code":"const id=Number(args?.offerId); if (!Number.isInteger(id)||id<=0) throw new Error('offerId is required'); const model=String(args?.model || '{{defaultModel}}').trim(); if (!/^[A-Za-z0-9._/-]{3,200}$/.test(model)) throw new Error('model must be a Hugging Face model id'); const maxLen=Number(args?.maxModelLen ?? 65536); const disk=Number(args?.diskGb ?? 100); const ttl=Number(args?.ttlMinutes ?? 240); if (!Number.isInteger(maxLen)||maxLen<8192||maxLen>262144) throw new Error('maxModelLen must be 8192..262144'); if (!Number.isInteger(disk)||disk<60||disk>500) throw new Error('diskGb must be 60..500'); if (!Number.isInteger(ttl)||ttl<30||ttl>480) throw new Error('ttlMinutes must be 30..480'); const workerKey=await secrets.get('{{vault:workerApiKeySecret}}'); if (!workerKey) throw new Error('vLLM worker API key unavailable'); const start='vllm serve '+model+' --host 0.0.0.0 --port 8000 --api-key '+workerKey+' --max-model-len '+maxLen+' --enable-auto-tool-choice --tool-call-parser qwen3_coder'; const body={image:'vllm/vllm-openai:latest',disk,runtype:'ssh',ssh:true,direct:true,env:'-p 8000:8000',onstart_cmd:start}; const r=await callProvider('vast_ai_api','PUT','/asks/'+id,body); const b=r?.body ?? {}; const instanceId=Number(b.new_contract ?? b.instance_id); if (!(r?.status>=200&&r?.status<300)||!Number.isInteger(instanceId)) throw new Error('Vast did not create an instance: '+String(b.msg ?? b.error ?? r?.status)); return {leaseId:'vast-'+instanceId,instanceId,model,maxModelLen:maxLen,diskGb:disk,ttlMinutes:ttl,status:'booting',next:{verbId:'vast_worker_status',parameters:{instanceId,model,ttlMinutes:ttl},nextPollSeconds:20}};"
73
+ },
74
+ {
75
+ "name":"vast_worker_status",
76
+ "intent":"fetch_record",
77
+ "kind":"code",
78
+ "scope":"pod",
79
+ "description":"Reads instance state and returns the external vLLM OpenAI-compatible base URL only after Vast reports a running instance with mapped port 8000. Read-only; poll every 20 seconds while booting/model_loading.",
80
+ "requires":["vast_ai_api"],
81
+ "executionMode":"sync",
82
+ "timeoutSeconds":30,
83
+ "metadata":{"readOnly":true},
84
+ "parameters":{"instanceId":"number","model":"string?","ttlMinutes":"number?"},
85
+ "code":"const id=Number(args?.instanceId); if(!Number.isInteger(id)||id<=0) throw new Error('instanceId is required'); const r=await callProvider('vast_ai_api','GET','/instances/'+id); const x=r?.body ?? {}; if(!(r?.status>=200&&r?.status<300)) throw new Error('could not read Vast instance '+id); const state=String(x.actual_status ?? x.status ?? '').toLowerCase(); if(['exited','offline','unknown','destroyed'].includes(state)) return {instanceId:id,status:'failed',reason:state,next:{verbId:'vast_worker_destroy',parameters:{instanceId:id}}}; if(state!=='running') return {instanceId:id,status:'booting',providerState:state||'unknown',next:{verbId:'vast_worker_status',parameters:{instanceId:id,model:args?.model,ttlMinutes:args?.ttlMinutes},nextPollSeconds:20}}; const ip=String(x.public_ipaddr ?? x.public_ip ?? '').trim(); const ports=x.ports ?? {}; let port=null; if(Array.isArray(ports)){ const p=ports.find(v=>String(v?.[1] ?? v?.internal_port ?? v?.port ?? '')==='8000'); port=p && (p[0] ?? p.external_port ?? p.public_port); } else if(ports && typeof ports==='object'){port=ports['8000/tcp'] ?? ports['8000'] ?? ports[8000]; if(Array.isArray(port)) port=port[0]; if(port && typeof port==='object') port=port.HostPort ?? port.host_port ?? port.external_port;} if(!ip||!port) return {instanceId:id,status:'running_unreachable',providerState:state,reason:'Vast has not reported a public mapping for port 8000 yet',next:{verbId:'vast_worker_status',parameters:{instanceId:id,model:args?.model,ttlMinutes:args?.ttlMinutes},nextPollSeconds:20}}; return {instanceId:id,status:'ready_to_register',model:args?.model ?? '{{defaultModel}}',apiBase:'http://'+ip+':'+String(port)+'/v1',next:{verbId:'vast_worker_register_litellm',parameters:{instanceId:id,apiBase:'http://'+ip+':'+String(port)+'/v1',model:args?.model ?? '{{defaultModel}}'}}};"
86
+ },
87
+ {
88
+ "name":"vast_worker_register_litellm",
89
+ "intent":"run_external_job",
90
+ "kind":"code",
91
+ "scope":"pod",
92
+ "description":"Creates the temporary LiteLLM alias for a healthy worker. Args: { instanceId, apiBase, model?, alias? }. The alias routes OpenAI-compatible requests through the central gateway. This is a write.",
93
+ "requires":["litellm_admin"],
94
+ "executionMode":"sync",
95
+ "timeoutSeconds":30,
96
+ "metadata":{"verbType":"write"},
97
+ "parameters":{"instanceId":"number","apiBase":"string","model":"string?","alias":"string?"},
98
+ "code":"const id=Number(args?.instanceId); const apiBase=String(args?.apiBase||'').replace(/\\/+$/,''); const model=String(args?.model||'{{defaultModel}}').trim(); if(!Number.isInteger(id)||id<=0) throw new Error('instanceId is required'); if(!/^https?:\\/\\/[A-Za-z0-9.:-]+\\/v1$/.test(apiBase)) throw new Error('apiBase must be the worker HTTP(S) URL ending in /v1'); const workerKey=await secrets.get('{{vault:workerApiKeySecret}}'); if(!workerKey) throw new Error('vLLM worker API key unavailable'); const alias=String(args?.alias||('synap-vast-'+id)).trim(); if(!/^[A-Za-z0-9._-]{3,80}$/.test(alias)) throw new Error('alias contains unsupported characters'); const body={model_name:alias,litellm_params:{model:'openai/'+model,api_base:apiBase,api_key:workerKey},model_info:{id:'synap-vast-'+id,mode:'chat'}}; const r=await callProvider('litellm_admin','POST','/model/new',body); if(!(r?.status>=200&&r?.status<300)) throw new Error('LiteLLM registration failed: '+String(r?.body?.error?.message ?? r?.body?.detail ?? r?.status)); return {instanceId:id,status:'registered',alias,litellmModel:alias,apiBase,teardown:{verbId:'vast_worker_destroy',parameters:{instanceId:id,alias}}};"
99
+ },
100
+ {
101
+ "name":"vast_worker_destroy",
102
+ "intent":"run_external_job",
103
+ "kind":"code",
104
+ "scope":"pod",
105
+ "description":"Deletes the temporary LiteLLM model alias when supplied, then destroys the Vast instance. Args: { instanceId, alias? }. This is irreversible and stops billing.",
106
+ "requires":["vast_ai_api","litellm_admin"],
107
+ "executionMode":"async",
108
+ "timeoutSeconds":60,
109
+ "metadata":{"verbType":"write"},
110
+ "parameters":{"instanceId":"number","alias":"string?"},
111
+ "code":"const id=Number(args?.instanceId); if(!Number.isInteger(id)||id<=0) throw new Error('instanceId is required'); const alias=String(args?.alias||'').trim(); const cleanup=[]; if(alias){ const lr=await callProvider('litellm_admin','POST','/model/delete',{id:'synap-vast-'+id}); cleanup.push({litellmStatus:lr?.status ?? null}); } const vr=await callProvider('vast_ai_api','DELETE','/instances/'+id); const b=vr?.body ?? {}; if(!(vr?.status>=200&&vr?.status<300)&&vr?.status!==404) throw new Error('Vast destroy failed: '+String(b.msg ?? b.error ?? vr?.status)); return {instanceId:id,status:'destroyed',cleanup};"
112
+ }
113
+ ],
114
+ "provides":["search_external","run_external_job","fetch_record"]
115
+ },
116
+ "dependencies": []
117
+ }
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ var BUILT_SPACE_PACKAGES = {
28
28
  "inputs": {
29
29
  "packages/web/src/space-packages/builder/home.tsx": "7afed696a23b1a474eace193d85688233e2f652e5e4ca56926edc8e1a16e62ef",
30
30
  "packages/web/src/space-packages/frame-doors.ts": "662fbd70165f21a758b8677ac7a1169030f76996921e322159ccd67e19ee7520",
31
- "packages/web/src/space-packages/frame-lens.ts": "627d26ad593a327f4d3cb50ceb3f04529200f99bb97719d02edc346ff60c2073",
31
+ "packages/web/src/space-packages/frame-lens.ts": "a218e6854b5ccb1cf6d34b6b826a2ad3eba9c447d1b0fb1b27899a36d04f92a8",
32
32
  "packages/web/src/space-packages/SpaceWorkHome.tsx": "e44497878da09b9ac0e9356440196e5973329a5ddef462991d9deb7087444718"
33
33
  }
34
34
  }
@@ -3770,6 +3770,13 @@ var DATA = {
3770
3770
  "label": "Local Repository Path",
3771
3771
  "valueType": "string",
3772
3772
  "inputType": "text"
3773
+ },
3774
+ {
3775
+ "slug": "design-kit",
3776
+ "label": "Design kit",
3777
+ "valueType": "entity_id",
3778
+ "targetProfileSlug": "file",
3779
+ "description": "The app's own component kit for the Design app (the catalog.json its `pnpm design:kit --publish` stored, pinning the kit's code by sha256). Its designs are drawn and checked with that kit in the project's brand; empty = Synap's components."
3773
3780
  }
3774
3781
  ]
3775
3782
  },
@@ -11838,6 +11845,24 @@ var DATA = {
11838
11845
  "description": "Id of this piece's whiteboard (a pod view of type whiteboard).",
11839
11846
  "valueType": "string",
11840
11847
  "inputType": "text"
11848
+ },
11849
+ {
11850
+ "slug": "content-format",
11851
+ "label": "Format",
11852
+ "description": "What this piece is made as. Empty: a thinking piece. text-site = Text \xB7 your site, text-linkedin = Text \xB7 LinkedIn, text-newsletter = Text \xB7 newsletter, carousel-linkedin = Carousel \xB7 LinkedIn, carousel-instagram = Carousel \xB7 Instagram, carousel-both = Carousel \xB7 LinkedIn and Instagram, video-motion = Video \xB7 motion design, video-capture = Video \xB7 captured, carousel = Carousel, network not set (made before design I).",
11853
+ "valueType": "string",
11854
+ "inputType": "select",
11855
+ "enumValues": [
11856
+ "text-site",
11857
+ "text-linkedin",
11858
+ "text-newsletter",
11859
+ "carousel-linkedin",
11860
+ "carousel-instagram",
11861
+ "carousel-both",
11862
+ "video-motion",
11863
+ "video-capture",
11864
+ "carousel"
11865
+ ]
11841
11866
  }
11842
11867
  ]
11843
11868
  },
@@ -35204,8 +35229,8 @@ var vocabularyFr = {
35204
35229
  "action.top_up.past": "Recharg\xE9",
35205
35230
  "action.upgrade.imperative": "Mettre \xE0 niveau",
35206
35231
  "action.upgrade.past": "Mis \xE0 niveau",
35207
- "action.ask_admin.imperative": "Demander \xE0 l\u2019admin",
35208
- "action.ask_admin.past": "Demand\xE9 \xE0 l\u2019admin",
35232
+ "action.ask_admin.imperative": "Demander \xE0 un admin",
35233
+ "action.ask_admin.past": "Demand\xE9 \xE0 un admin",
35209
35234
  "action.fix_payment.imperative": "Corriger le paiement",
35210
35235
  "action.fix_payment.past": "Paiement corrig\xE9",
35211
35236
  "action.reopen.imperative": "Rouvrir",
@@ -35465,7 +35490,8 @@ var vocabularyFr = {
35465
35490
  "status.credits_low": "Cr\xE9dits faibles",
35466
35491
  "status.credits_empty": "Plus de cr\xE9dits",
35467
35492
  "status.not_entitled": "Pas de forfait IA",
35468
- "status.suspended": "Suspendu",
35493
+ "status.account_inactive": "IA d\xE9sactiv\xE9e",
35494
+ "status.suspended": "Paiement requis",
35469
35495
  "status.budget_paused": "En pause",
35470
35496
  "status.provider_issue": "Probl\xE8me d\u2019IA",
35471
35497
  "status.service_down": "IA hors ligne",
@@ -36424,7 +36450,7 @@ var ACTION_VERB_ROWS = {
36424
36450
  // they cannot pay; `upgrade` also covers renewing a plan that has no AI.
36425
36451
  top_up: { imperative: "Top up", past: "Topped up" },
36426
36452
  upgrade: { imperative: "Upgrade", past: "Upgraded" },
36427
- ask_admin: { imperative: "Ask admin", past: "Asked admin" },
36453
+ ask_admin: { imperative: "Ask an admin", past: "Asked an admin" },
36428
36454
  fix_payment: { imperative: "Fix payment", past: "Fixed payment" },
36429
36455
  // Put a REJECTED proposal back in the queue — the inverse of reject. Without
36430
36456
  // a row `resolveActionLabel("reopen", …)` fell through to `humanizeToken`,
@@ -37028,10 +37054,14 @@ var STATUS_LABEL_ROWS = {
37028
37054
  public: "Public",
37029
37055
  // AI AVAILABILITY (`AiAvailabilityKind`, `@synap-core/types/ai-availability`)
37030
37056
  // — the short state chip. Headlines and CTAs live in that module's copy deck.
37057
+ // `suspended` says what the payer does, as the deck's title does: humanized,
37058
+ // "Suspended" named no cause. `account_inactive` is the `not_entitled` chip
37059
+ // when AI was switched off rather than left out of the plan.
37031
37060
  credits_low: "Low credits",
37032
37061
  credits_empty: "Out of credits",
37033
37062
  not_entitled: "No AI plan",
37034
- suspended: "Suspended",
37063
+ account_inactive: "AI turned off",
37064
+ suspended: "Payment needed",
37035
37065
  budget_paused: "Paused",
37036
37066
  provider_issue: "AI issue",
37037
37067
  service_down: "AI offline",