@synap-core/workspace-templates 0.67.0 → 0.68.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 +135 -68
- package/capabilities/design.capability.json +126 -643
- package/capabilities/storybook.capability.json +84 -0
- package/capabilities/vast-ai-compute-worker.capability.json +178 -76
- package/dist/index.js +1386 -82
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/designing-with-real-components/SKILL.md +7 -1
- package/src/agency-os.yaml +22 -4
- package/src/builder.yaml +1480 -773
- package/src/campaign-channel-platforms.template.test.ts +13 -2
- package/src/catalog-safety.test.ts +14 -3
- package/src/content-os.campaigns.template.test.ts +63 -20
- package/src/content-os.piece-model.template.test.ts +185 -41
- package/src/content-os.template.test.ts +174 -58
- package/src/content-os.yaml +170 -28
- package/src/crm.yaml +289 -46
- package/src/decisions-wave.template.test.ts +171 -47
- package/src/ecosystem.yaml +7 -1
- package/src/finance.yaml +27 -5
- package/src/lifecycle-declarations.test.ts +8 -0
- package/src/marketing.yaml +6 -3
- package/src/process-contract.validate.test.ts +217 -71
- package/src/templates.ts +2332 -1299
- package/src/types.ts +35 -6
- package/src/ui-inventory.template.test.ts +256 -0
- package/src/validate.ts +541 -130
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": "synap/v1",
|
|
3
|
+
"kind": "capability",
|
|
4
|
+
"meta": {
|
|
5
|
+
"slug": "storybook",
|
|
6
|
+
"name": "Storybook",
|
|
7
|
+
"description": "The Storybook door: mirror an app's Storybook (its components, pages and user flows) into the pod as ui-component, ui-page and user-flow records, and list the components that changed since their last review. The verbs run on the pod; the sync writes through the pod's connection sync (its first run is one import proposal).",
|
|
8
|
+
"tags": [
|
|
9
|
+
"capability",
|
|
10
|
+
"design",
|
|
11
|
+
"storybook",
|
|
12
|
+
"ui"
|
|
13
|
+
],
|
|
14
|
+
"isPublic": true,
|
|
15
|
+
"syncByDefault": true
|
|
16
|
+
},
|
|
17
|
+
"dependencies": [],
|
|
18
|
+
"spec": {
|
|
19
|
+
"key": "storybook",
|
|
20
|
+
"name": "Storybook",
|
|
21
|
+
"description": "Two verbs over an app's Storybook: storybook.sync (mirror it into ui-component, ui-page and user-flow records; code facts belong to the sync) and storybook.changed (the components whose source changed since their last review, most used first).",
|
|
22
|
+
"skills": [
|
|
23
|
+
{
|
|
24
|
+
"name": "storybook.sync",
|
|
25
|
+
"kind": "builtin",
|
|
26
|
+
"scope": "pod",
|
|
27
|
+
"description": "Mirror an app's Storybook into the pod: one ui-component per component, one ui-page per page story, one user-flow per flow, with their composition, variants and the pages a flow goes through. It reads a synap.storybook-bundle/v1 file a computer uploaded, or a public Storybook over https. Upsert by external id (provider storybook); a record the source no longer emits moves to gone, never deleted. The first run for a source is one import proposal; later runs apply.",
|
|
28
|
+
"parameters": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"properties": {
|
|
31
|
+
"bundleFileId": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"format": "uuid",
|
|
34
|
+
"description": "A pod file holding a synap.storybook-bundle/v1 JSON (the devbox uploads it after each main push). Give this or url."
|
|
35
|
+
},
|
|
36
|
+
"url": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"format": "uri",
|
|
39
|
+
"description": "A public Storybook's https base URL, instead of bundleFileId: the pod reads its index.json and, when served, manifests/components.json (props) through its guarded fetch, on a host the pod allows."
|
|
40
|
+
},
|
|
41
|
+
"appId": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"format": "uuid",
|
|
44
|
+
"description": "The app (devplane_app) these components, pages and flows belong to."
|
|
45
|
+
},
|
|
46
|
+
"brandIdentityId": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"format": "uuid",
|
|
49
|
+
"description": "The brand identity (brand-identity) the Storybook expresses."
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"additionalProperties": false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "storybook.changed",
|
|
57
|
+
"kind": "builtin",
|
|
58
|
+
"scope": "pod",
|
|
59
|
+
"description": "List the ui-components whose source-hash differs from their reviewed-hash (changed since their last review), most used first.",
|
|
60
|
+
"parameters": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"properties": {
|
|
63
|
+
"limit": {
|
|
64
|
+
"type": "integer",
|
|
65
|
+
"minimum": 1,
|
|
66
|
+
"maximum": 200,
|
|
67
|
+
"description": "At most this many components (default 20)."
|
|
68
|
+
},
|
|
69
|
+
"appId": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"format": "uuid",
|
|
72
|
+
"description": "Only this app's components."
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"additionalProperties": false
|
|
76
|
+
},
|
|
77
|
+
"metadata": {
|
|
78
|
+
"readOnly": true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"provides": []
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -15,103 +15,205 @@
|
|
|
15
15
|
"name": "Vast.ai Compute Worker",
|
|
16
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
17
|
"params": [
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
{
|
|
19
|
+
"name": "vastApiKey",
|
|
20
|
+
"label": "Vast.ai scoped API key",
|
|
21
|
+
"type": "password",
|
|
22
|
+
"required": true,
|
|
23
|
+
"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."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "litellmMasterKey",
|
|
27
|
+
"label": "LiteLLM master key",
|
|
28
|
+
"type": "password",
|
|
29
|
+
"required": true,
|
|
30
|
+
"description": "The master key for the central LiteLLM proxy. Stored encrypted in the pod vault; never sent to Vast or a worker."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "workerApiKey",
|
|
34
|
+
"label": "vLLM worker API key",
|
|
35
|
+
"type": "password",
|
|
36
|
+
"required": true,
|
|
37
|
+
"description": "A random dedicated secret used only between LiteLLM and an ephemeral vLLM worker. It is the only secret sent to a Vast instance."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "litellmBaseUrl",
|
|
41
|
+
"label": "LiteLLM base URL",
|
|
42
|
+
"type": "text",
|
|
43
|
+
"required": false,
|
|
44
|
+
"default": "https://litellm.antoinesrvt.synap.live",
|
|
45
|
+
"description": "Central LiteLLM gateway URL, without a trailing slash."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "defaultModel",
|
|
49
|
+
"label": "Default open coding model",
|
|
50
|
+
"type": "text",
|
|
51
|
+
"required": false,
|
|
52
|
+
"default": "Qwen/Qwen3-Coder-30B-A3B-Instruct",
|
|
53
|
+
"description": "Public Hugging Face model id launched by vLLM. Test and replace this after benchmark runs."
|
|
54
|
+
}
|
|
23
55
|
],
|
|
24
56
|
"vault": [
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
57
|
+
{
|
|
58
|
+
"ref": "vastApiKeySecret",
|
|
59
|
+
"name": "{{name}} Vast API key",
|
|
60
|
+
"value": "{{vastApiKey}}",
|
|
61
|
+
"type": "api_key",
|
|
62
|
+
"service": "vast.ai",
|
|
63
|
+
"description": "Scoped Vast API key for the lease controller."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"ref": "litellmMasterKeySecret",
|
|
67
|
+
"name": "{{name}} LiteLLM master key",
|
|
68
|
+
"value": "{{litellmMasterKey}}",
|
|
69
|
+
"type": "api_key",
|
|
70
|
+
"service": "litellm",
|
|
71
|
+
"description": "Central LiteLLM administration key."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"ref": "workerApiKeySecret",
|
|
75
|
+
"name": "{{name}} vLLM worker API key",
|
|
76
|
+
"value": "{{workerApiKey}}",
|
|
77
|
+
"type": "api_key",
|
|
78
|
+
"service": "vllm",
|
|
79
|
+
"description": "Per-worker upstream key; never use a provider master key here."
|
|
80
|
+
}
|
|
28
81
|
],
|
|
29
82
|
"tools": [
|
|
30
83
|
{
|
|
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":{
|
|
84
|
+
"name": "vast_ai_api",
|
|
85
|
+
"kind": "api",
|
|
86
|
+
"executor": "is-agent",
|
|
87
|
+
"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.",
|
|
88
|
+
"credentialRef": "vastApiKeySecret",
|
|
89
|
+
"config": {
|
|
90
|
+
"baseUrl": "https://console.vast.ai/api/v0",
|
|
91
|
+
"auth": {
|
|
92
|
+
"in": "header",
|
|
93
|
+
"name": "Authorization",
|
|
94
|
+
"prefix": "Bearer "
|
|
95
|
+
}
|
|
96
|
+
}
|
|
37
97
|
},
|
|
38
98
|
{
|
|
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":{
|
|
99
|
+
"name": "litellm_admin",
|
|
100
|
+
"kind": "api",
|
|
101
|
+
"executor": "is-agent",
|
|
102
|
+
"description": "Authenticated central LiteLLM administration API. Use only to create/delete the temporary upstream model alias; the master key never leaves the pod.",
|
|
103
|
+
"credentialRef": "litellmMasterKeySecret",
|
|
104
|
+
"config": {
|
|
105
|
+
"baseUrl": "{{litellmBaseUrl}}",
|
|
106
|
+
"auth": {
|
|
107
|
+
"in": "header",
|
|
108
|
+
"name": "Authorization",
|
|
109
|
+
"prefix": "Bearer "
|
|
110
|
+
}
|
|
111
|
+
}
|
|
45
112
|
}
|
|
46
113
|
],
|
|
47
114
|
"skills": [
|
|
48
115
|
{
|
|
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":{
|
|
58
|
-
|
|
59
|
-
|
|
116
|
+
"name": "vast_worker_search",
|
|
117
|
+
"intent": "search_external",
|
|
118
|
+
"kind": "code",
|
|
119
|
+
"scope": "pod",
|
|
120
|
+
"description": "Lists eligible Vast offers for a coding worker. Args: { minVramGb?: 48|64|80|96, maxHourlyUsd?: number, interruptible?: boolean, minReliability?: number }. Interruptible offers are priced at min_bid (hourlyUsd), on-demand at dph_total. Returns normalized candidates, cheapest first. Read-only.",
|
|
121
|
+
"requires": ["vast_ai_api"],
|
|
122
|
+
"executionMode": "sync",
|
|
123
|
+
"timeoutSeconds": 30,
|
|
124
|
+
"metadata": {
|
|
125
|
+
"readOnly": true
|
|
126
|
+
},
|
|
127
|
+
"parameters": {
|
|
128
|
+
"minVramGb": "number?",
|
|
129
|
+
"maxHourlyUsd": "number?",
|
|
130
|
+
"interruptible": "boolean?",
|
|
131
|
+
"minReliability": "number?"
|
|
132
|
+
},
|
|
133
|
+
"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?'bid':'ondemand',verified:{eq:true},rentable:{eq:true},rented:{eq:false},gpu_total_ram:{gte:vram*1024},reliability:{gte:reliability},direct_port_count:{gte:1}}; if(!interruptible) body.dph_total={lte:cap}; 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=>{const price=interruptible?Number(o.min_bid ?? o.dph_total):Number(o.dph_total); return {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:price,onDemandUsd:o.dph_total,minBidUsd:o.min_bid,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
134
|
},
|
|
61
135
|
{
|
|
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":{
|
|
71
|
-
|
|
72
|
-
|
|
136
|
+
"name": "vast_worker_start",
|
|
137
|
+
"intent": "run_external_job",
|
|
138
|
+
"kind": "code",
|
|
139
|
+
"scope": "pod",
|
|
140
|
+
"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. Pass bidPriceUsd (minBidUsd from search) for interruptible rentals.",
|
|
141
|
+
"requires": ["vast_ai_api"],
|
|
142
|
+
"executionMode": "async",
|
|
143
|
+
"timeoutSeconds": 60,
|
|
144
|
+
"metadata": {
|
|
145
|
+
"verbType": "write"
|
|
146
|
+
},
|
|
147
|
+
"parameters": {
|
|
148
|
+
"offerId": "number",
|
|
149
|
+
"model": "string?",
|
|
150
|
+
"maxModelLen": "number?",
|
|
151
|
+
"diskGb": "number?",
|
|
152
|
+
"interruptible": "boolean?",
|
|
153
|
+
"ttlMinutes": "number?",
|
|
154
|
+
"bidPriceUsd": "number?"
|
|
155
|
+
},
|
|
156
|
+
"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 interruptible=args?.interruptible!==false; const bid=Number(args?.bidPriceUsd); if(interruptible&&!(bid>0)) throw new Error('bidPriceUsd is required for an interruptible rental (use minBidUsd from search)'); const body={image:'vllm/vllm-openai:latest',disk,runtype:'ssh',ssh:true,direct:true,env:'-p 8000:8000',onstart_cmd:start}; if(interruptible) body.price=bid; 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,interruptible,bidPriceUsd:interruptible?bid:null,status:'booting',next:{verbId:'vast_worker_status',parameters:{instanceId,model,ttlMinutes:ttl},nextPollSeconds:20}};"
|
|
73
157
|
},
|
|
74
158
|
{
|
|
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":{
|
|
84
|
-
|
|
85
|
-
|
|
159
|
+
"name": "vast_worker_status",
|
|
160
|
+
"intent": "fetch_record",
|
|
161
|
+
"kind": "code",
|
|
162
|
+
"scope": "pod",
|
|
163
|
+
"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.",
|
|
164
|
+
"requires": ["vast_ai_api"],
|
|
165
|
+
"executionMode": "sync",
|
|
166
|
+
"timeoutSeconds": 30,
|
|
167
|
+
"metadata": {
|
|
168
|
+
"readOnly": true
|
|
169
|
+
},
|
|
170
|
+
"parameters": {
|
|
171
|
+
"instanceId": "number",
|
|
172
|
+
"model": "string?",
|
|
173
|
+
"ttlMinutes": "number?"
|
|
174
|
+
},
|
|
175
|
+
"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
176
|
},
|
|
87
177
|
{
|
|
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":{
|
|
97
|
-
|
|
98
|
-
|
|
178
|
+
"name": "vast_worker_register_litellm",
|
|
179
|
+
"intent": "run_external_job",
|
|
180
|
+
"kind": "code",
|
|
181
|
+
"scope": "pod",
|
|
182
|
+
"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.",
|
|
183
|
+
"requires": ["litellm_admin"],
|
|
184
|
+
"executionMode": "sync",
|
|
185
|
+
"timeoutSeconds": 30,
|
|
186
|
+
"metadata": {
|
|
187
|
+
"verbType": "write"
|
|
188
|
+
},
|
|
189
|
+
"parameters": {
|
|
190
|
+
"instanceId": "number",
|
|
191
|
+
"apiBase": "string",
|
|
192
|
+
"model": "string?",
|
|
193
|
+
"alias": "string?"
|
|
194
|
+
},
|
|
195
|
+
"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
196
|
},
|
|
100
197
|
{
|
|
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":{
|
|
110
|
-
|
|
111
|
-
|
|
198
|
+
"name": "vast_worker_destroy",
|
|
199
|
+
"intent": "run_external_job",
|
|
200
|
+
"kind": "code",
|
|
201
|
+
"scope": "pod",
|
|
202
|
+
"description": "Deletes the temporary LiteLLM model alias when supplied, then destroys the Vast instance. Args: { instanceId, alias? }. This is irreversible and stops billing.",
|
|
203
|
+
"requires": ["vast_ai_api", "litellm_admin"],
|
|
204
|
+
"executionMode": "async",
|
|
205
|
+
"timeoutSeconds": 60,
|
|
206
|
+
"metadata": {
|
|
207
|
+
"verbType": "write"
|
|
208
|
+
},
|
|
209
|
+
"parameters": {
|
|
210
|
+
"instanceId": "number",
|
|
211
|
+
"alias": "string?"
|
|
212
|
+
},
|
|
213
|
+
"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
214
|
}
|
|
113
215
|
],
|
|
114
|
-
"provides":["search_external","run_external_job","fetch_record"]
|
|
216
|
+
"provides": ["search_external", "run_external_job", "fetch_record"]
|
|
115
217
|
},
|
|
116
218
|
"dependencies": []
|
|
117
219
|
}
|