@synap-core/workspace-templates 0.33.0 → 0.35.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.
@@ -0,0 +1,195 @@
1
+ {
2
+ "apiVersion": "synap/v1",
3
+ "kind": "capability",
4
+ "meta": {
5
+ "slug": "media-matte",
6
+ "name": "Remove a video's background on your computer",
7
+ "description": "Cuts the person out of a recorded video on your own computer, to put a new background behind them. On a Mac with Apple Vision (free, built on the Mac); on Linux with Robust Video Matting (GPL-3.0, installed from its author). When no computer has it, Replicate can do it on your account, only if you say yes and with its price shown.",
8
+ "tags": [
9
+ "capability",
10
+ "media",
11
+ "video",
12
+ "computer"
13
+ ],
14
+ "isPublic": true
15
+ },
16
+ "spec": {
17
+ "key": "media-matte",
18
+ "name": "Remove a video's background on your computer",
19
+ "description": "A temporally stable person matte (white = the person) for a talking-head video, with no green screen. Mac: synap-matte, a small Swift tool on Apple Vision person segmentation through one sequence handler (no flicker), compiled on the Mac from the source the catalog ships with the facecam-edit skill (checked against its sha256; needs Apple's command line tools). Linux: Robust Video Matting at a pinned commit in its own uv environment with its v1.0.0 mobilenetv3 checkpoint; GPL-3.0, so installed from its author, never bundled. Pod fallback: replicate-rvm, offered per tool with its price, never used silently (decision 6). Composite with media-ffmpeg's background-replace recipe.",
20
+ "licence": "LicenseRef-Synap",
21
+ "placement": {
22
+ "runsOn": [
23
+ "computer"
24
+ ],
25
+ "prefer": [
26
+ "computer"
27
+ ],
28
+ "platforms": [
29
+ {
30
+ "os": "darwin",
31
+ "arch": [
32
+ "arm64",
33
+ "x64"
34
+ ]
35
+ },
36
+ {
37
+ "os": "linux",
38
+ "arch": [
39
+ "x64",
40
+ "arm64"
41
+ ]
42
+ }
43
+ ],
44
+ "labels": [
45
+ "gpu?"
46
+ ],
47
+ "requires": {
48
+ "capabilities": [
49
+ {
50
+ "slug": "media-ffmpeg"
51
+ }
52
+ ],
53
+ "runtimes": {
54
+ "uv": ">=0.5"
55
+ }
56
+ },
57
+ "fallback": {
58
+ "capability": "replicate-rvm",
59
+ "price": "Billed by Replicate to your own account for each video; the price is shown before you say yes."
60
+ }
61
+ },
62
+ "install": {
63
+ "darwin": {
64
+ "steps": [
65
+ {
66
+ "kind": "download",
67
+ "what": "file",
68
+ "url": "https://cdn.jsdelivr.net/npm/@synap-core/workspace-templates@0.33.0/skills/facecam-edit/synap-matte.swift",
69
+ "sha256": "86a3ddec67c6dba536ee2c5e8d3a874d1d1e9903d0114ccb311e7b6b5f083b4f",
70
+ "dest": "{tools}/synap-matte.swift"
71
+ },
72
+ {
73
+ "kind": "script",
74
+ "name": "build-synap-matte.sh",
75
+ "args": [
76
+ "{tools}/synap-matte.swift",
77
+ "{home}/.synap/bin"
78
+ ],
79
+ "source": "#!/bin/sh\n# build-synap-matte.sh SOURCE OUT_DIR: compile the Apple Vision matte tool on this Mac.\nset -eu\ncommand -v swiftc >/dev/null 2>&1 || { echo \"Apple's command line tools are needed: run xcode-select --install, then try again\" >&2; exit 3; }\nmkdir -p \"$2\"\nswiftc -O \"$1\" -o \"$2/synap-matte\"\n",
80
+ "sha256": "201f0f172f63ac5c0fa1d09cff6587facf4d134d13741ec3a03d4afcb750d9d0",
81
+ "elevation": "never"
82
+ }
83
+ ],
84
+ "bins": {
85
+ "synap-matte": "{home}/.synap/bin/synap-matte"
86
+ },
87
+ "bundled": true
88
+ },
89
+ "linux": {
90
+ "steps": [
91
+ {
92
+ "kind": "script",
93
+ "name": "rvm-install.sh",
94
+ "args": [
95
+ "{tools}"
96
+ ],
97
+ "source": "#!/bin/sh\n# rvm-install.sh TOOLS_DIR: Robust Video Matting (GPL-3.0) at a pinned commit, in its own Python environment.\nset -eu\nDIR=\"$1/rvm\"\nmkdir -p \"$DIR\"\ncurl -fsSL \"https://github.com/PeterL1n/RobustVideoMatting/archive/53d74c6826735f01f4406b5ca9075eee27bec094.tar.gz\" | tar xz -C \"$DIR\" --strip-components 1\nuv venv --python 3.11 \"$DIR/.venv\"\nuv pip install --python \"$DIR/.venv/bin/python\" torch torchvision av tqdm pims\n",
98
+ "sha256": "509071611eccc7e76b1f960d55f84c225d2d6a2753f99c4dd400507d8b3dcac4",
99
+ "elevation": "never"
100
+ },
101
+ {
102
+ "kind": "download",
103
+ "what": "model",
104
+ "url": "https://github.com/PeterL1n/RobustVideoMatting/releases/download/v1.0.0/rvm_mobilenetv3.pth",
105
+ "sha256": "3c7c1d92033f7c38d6577c481d13a195d7d80a159b960f4f3119ac7b534cf4f8",
106
+ "sizeMb": 15,
107
+ "dest": "{tools}/rvm"
108
+ }
109
+ ],
110
+ "bins": {
111
+ "rvm-python": "{tools}/rvm/.venv/bin/python"
112
+ },
113
+ "licence": "GPL-3.0-only"
114
+ },
115
+ "elevation": "never",
116
+ "diskFreeMb": 3000
117
+ },
118
+ "verify": {
119
+ "darwin": {
120
+ "command": [
121
+ "synap-matte",
122
+ "--version"
123
+ ],
124
+ "expect": {
125
+ "exitCode": 0,
126
+ "stdoutMatches": "^synap-matte (\\d+\\.\\d+\\.\\d+)"
127
+ },
128
+ "captureVersion": 1
129
+ },
130
+ "linux": {
131
+ "command": [
132
+ "rvm-python",
133
+ "-c",
134
+ "import torch, av; print(torch.__version__, torch.cuda.is_available())"
135
+ ],
136
+ "expect": {
137
+ "exitCode": 0,
138
+ "stdoutMatches": "^(\\d+\\.\\d+\\.\\d+)"
139
+ },
140
+ "captureVersion": 1,
141
+ "smoke": {
142
+ "command": [
143
+ "rvm-python",
144
+ "{tools}/rvm/inference.py",
145
+ "--help"
146
+ ],
147
+ "expect": {
148
+ "exitCode": 0
149
+ }
150
+ }
151
+ },
152
+ "timeoutSec": 120,
153
+ "reverifyEvery": "P7D"
154
+ },
155
+ "uninstall": {
156
+ "darwin": {
157
+ "steps": [
158
+ {
159
+ "kind": "script",
160
+ "name": "remove-synap-matte.sh",
161
+ "args": [
162
+ "{home}/.synap/bin/synap-matte"
163
+ ],
164
+ "source": "#!/bin/sh\n# remove-synap-matte.sh BIN: remove the built matte tool.\nset -eu\nrm -f \"$1\"\n",
165
+ "sha256": "8c0e4dec6b75840c5c261c8964f17622483826e3ccc8a2729ff3ac5e58402ecb",
166
+ "elevation": "never"
167
+ }
168
+ ]
169
+ },
170
+ "keepUserData": true
171
+ },
172
+ "permissions": {
173
+ "filesystem": [
174
+ {
175
+ "path": "{workdir}",
176
+ "access": "rw"
177
+ }
178
+ ],
179
+ "network": [],
180
+ "devices": [
181
+ "gpu"
182
+ ]
183
+ },
184
+ "skills": [
185
+ {
186
+ "name": "matte-on-computer",
187
+ "kind": "instruction",
188
+ "scope": "pod",
189
+ "description": "How to make a person matte of a video on the computer that has this tool (Apple Vision on a Mac, Robust Video Matting on Linux), then composite it with media-ffmpeg; Replicate only on a yes.",
190
+ "code": "# Cut the person out of a video on this computer\n\nThe result is a matte video (white = the person) to composite a new background with the media-ffmpeg recipe `background-replace`. The facecam-edit skill walks the whole edit; this is the matte step.\n\n1. Check the tool is here: `synap tools verify media-matte`. Not installed: ask the person first (on Linux it installs Robust Video Matting, GPL-3.0, about 2 GB with PyTorch).\n2. Make the matte:\n\n**Mac: synap-matte (Apple Vision, built on this Mac, free, nothing leaves it)**\n```\nsynap-matte take.mp4 matte.mov accurate\n```\nThe matte has the take's size, frame times and rotation. Use the take itself as the foreground.\n\n**Linux (best with an NVIDIA GPU): Robust Video Matting** (`{tools}` is the folder `synap tools install` put it in; `synap tools verify media-matte` prints it)\n```\nrvm-python {tools}/rvm/inference.py --variant mobilenetv3 --checkpoint {tools}/rvm/rvm_mobilenetv3.pth --device cuda \\\n --input-source take.mp4 --downsample-ratio 0.25 --output-type video \\\n --output-alpha pha.mp4 --output-foreground fgr.mp4 --output-video-mbps 20 --seq-chunk 12\n```\n`--device cpu` without a GPU (slow: offline batches only). Downsample 0.25 for 1080p, 0.125 for 4K. Use `fgr.mp4` as the foreground: its colours are cleaned of the old room.\n\n3. Composite with `background-replace` (fg, matte, background, the take for its sound). Show a 5-second side-by-side preview before the full render.\n\n**No computer has the tool?** The pod capability `replicate-rvm` runs the same model on Replicate, billed to the person's own Replicate account. Offer it with its price, and only use it after a yes, per tool; never silently.\n\n**Gotchas**\n- A per-frame image model (rembg, u2net at 320 px) flickers and turns hair to mush: never use it for video.\n- RVM is GPL-3.0: it is installed from its author's repository on the person's computer, never bundled or shipped by Synap.\n"
191
+ }
192
+ ],
193
+ "provides": []
194
+ }
195
+ }
@@ -0,0 +1,282 @@
1
+ {
2
+ "apiVersion": "synap/v1",
3
+ "kind": "capability",
4
+ "meta": {
5
+ "slug": "media-transcribe",
6
+ "name": "Transcribe on your computer",
7
+ "description": "Turns a video or audio file into a transcript, subtitles and word timings, on your own computer. No audio leaves it and no AI tokens are spent.",
8
+ "tags": [
9
+ "capability",
10
+ "media",
11
+ "audio",
12
+ "computer"
13
+ ],
14
+ "isPublic": true
15
+ },
16
+ "spec": {
17
+ "key": "media-transcribe",
18
+ "name": "Transcribe on your computer",
19
+ "description": "Local speech-to-text with word timestamps: SRT, VTT, text and a words JSON (segments[].words[] with start and end). Mac (Apple Silicon): mlx-whisper on the Metal GPU, installed with uv. Linux and Windows: faster-whisper through its CLI whisper-ctranslate2 (int8 on a CPU, float16 on an NVIDIA GPU), installed with uv. The model, whisper large-v3-turbo, is an explicit 1.6 GB download with a disk check. whisper.cpp is the no-Python alternative, described in the skill. Needs media-ffmpeg to turn a video into 16 kHz mono audio first.",
20
+ "licence": "MIT",
21
+ "placement": {
22
+ "runsOn": [
23
+ "computer"
24
+ ],
25
+ "prefer": [
26
+ "computer"
27
+ ],
28
+ "platforms": [
29
+ {
30
+ "os": "darwin",
31
+ "arch": [
32
+ "arm64"
33
+ ]
34
+ },
35
+ {
36
+ "os": "linux",
37
+ "arch": [
38
+ "x64",
39
+ "arm64"
40
+ ]
41
+ },
42
+ {
43
+ "os": "win32",
44
+ "arch": [
45
+ "x64"
46
+ ]
47
+ }
48
+ ],
49
+ "labels": [
50
+ "gpu?"
51
+ ],
52
+ "requires": {
53
+ "capabilities": [
54
+ {
55
+ "slug": "media-ffmpeg"
56
+ }
57
+ ],
58
+ "runtimes": {
59
+ "uv": ">=0.5",
60
+ "python": ">=3.10"
61
+ }
62
+ }
63
+ },
64
+ "install": {
65
+ "darwin": {
66
+ "steps": [
67
+ {
68
+ "kind": "uv",
69
+ "action": "tool-install",
70
+ "package": "mlx-whisper"
71
+ },
72
+ {
73
+ "kind": "download",
74
+ "what": "model",
75
+ "id": "mlx-community/whisper-large-v3-turbo",
76
+ "dest": "{models}",
77
+ "sizeMb": 1600,
78
+ "resumable": true
79
+ }
80
+ ],
81
+ "bins": {
82
+ "mlx_whisper": "{home}/.local/bin/mlx_whisper"
83
+ }
84
+ },
85
+ "linux": {
86
+ "steps": [
87
+ {
88
+ "kind": "uv",
89
+ "action": "tool-install",
90
+ "package": "whisper-ctranslate2"
91
+ },
92
+ {
93
+ "kind": "download",
94
+ "what": "model",
95
+ "id": "mobiuslabsgmbh/faster-whisper-large-v3-turbo",
96
+ "dest": "{models}",
97
+ "sizeMb": 1600,
98
+ "resumable": true
99
+ }
100
+ ],
101
+ "bins": {
102
+ "whisper-ctranslate2": "{home}/.local/bin/whisper-ctranslate2"
103
+ }
104
+ },
105
+ "win32": {
106
+ "steps": [
107
+ {
108
+ "kind": "uv",
109
+ "action": "tool-install",
110
+ "package": "whisper-ctranslate2"
111
+ },
112
+ {
113
+ "kind": "download",
114
+ "what": "model",
115
+ "id": "mobiuslabsgmbh/faster-whisper-large-v3-turbo",
116
+ "dest": "{models}",
117
+ "sizeMb": 1600,
118
+ "resumable": true
119
+ }
120
+ ],
121
+ "bins": {
122
+ "whisper-ctranslate2": "{home}/.local/bin/whisper-ctranslate2.exe"
123
+ }
124
+ },
125
+ "elevation": "never",
126
+ "diskFreeMb": 4000
127
+ },
128
+ "verify": {
129
+ "darwin": {
130
+ "command": [
131
+ "mlx_whisper",
132
+ "--help"
133
+ ],
134
+ "expect": {
135
+ "exitCode": 0,
136
+ "stdoutMatches": "usage: mlx_whisper"
137
+ },
138
+ "smoke": {
139
+ "command": [
140
+ "mlx_whisper",
141
+ "{fixture}",
142
+ "--model",
143
+ "mlx-community/whisper-large-v3-turbo",
144
+ "-f",
145
+ "txt",
146
+ "-o",
147
+ "{workdir}"
148
+ ],
149
+ "expect": {
150
+ "exitCode": 0,
151
+ "stdoutContains": "ask not what your country"
152
+ },
153
+ "fixture": "jfk.wav"
154
+ }
155
+ },
156
+ "linux": {
157
+ "command": [
158
+ "whisper-ctranslate2",
159
+ "--version"
160
+ ],
161
+ "expect": {
162
+ "exitCode": 0,
163
+ "stdoutMatches": "(\\d+\\.\\d+\\.\\d+)"
164
+ },
165
+ "captureVersion": 1,
166
+ "smoke": {
167
+ "command": [
168
+ "whisper-ctranslate2",
169
+ "{fixture}",
170
+ "--model",
171
+ "large-v3-turbo",
172
+ "--device",
173
+ "cpu",
174
+ "--compute_type",
175
+ "int8",
176
+ "--output_format",
177
+ "txt",
178
+ "--output_dir",
179
+ "{workdir}"
180
+ ],
181
+ "expect": {
182
+ "exitCode": 0,
183
+ "stdoutContains": "ask not what your country"
184
+ },
185
+ "fixture": "jfk.wav"
186
+ }
187
+ },
188
+ "win32": {
189
+ "command": [
190
+ "whisper-ctranslate2",
191
+ "--version"
192
+ ],
193
+ "expect": {
194
+ "exitCode": 0,
195
+ "stdoutMatches": "(\\d+\\.\\d+\\.\\d+)"
196
+ },
197
+ "captureVersion": 1,
198
+ "smoke": {
199
+ "command": [
200
+ "whisper-ctranslate2",
201
+ "{fixture}",
202
+ "--model",
203
+ "large-v3-turbo",
204
+ "--device",
205
+ "cpu",
206
+ "--compute_type",
207
+ "int8",
208
+ "--output_format",
209
+ "txt",
210
+ "--output_dir",
211
+ "{workdir}"
212
+ ],
213
+ "expect": {
214
+ "exitCode": 0,
215
+ "stdoutContains": "ask not what your country"
216
+ },
217
+ "fixture": "jfk.wav"
218
+ }
219
+ },
220
+ "timeoutSec": 300,
221
+ "reverifyEvery": "P7D"
222
+ },
223
+ "uninstall": {
224
+ "darwin": {
225
+ "steps": [
226
+ {
227
+ "kind": "uv",
228
+ "action": "tool-uninstall",
229
+ "package": "mlx-whisper"
230
+ }
231
+ ]
232
+ },
233
+ "linux": {
234
+ "steps": [
235
+ {
236
+ "kind": "uv",
237
+ "action": "tool-uninstall",
238
+ "package": "whisper-ctranslate2"
239
+ }
240
+ ]
241
+ },
242
+ "win32": {
243
+ "steps": [
244
+ {
245
+ "kind": "uv",
246
+ "action": "tool-uninstall",
247
+ "package": "whisper-ctranslate2"
248
+ }
249
+ ]
250
+ },
251
+ "keepUserData": true
252
+ },
253
+ "permissions": {
254
+ "filesystem": [
255
+ {
256
+ "path": "{workdir}",
257
+ "access": "rw"
258
+ },
259
+ {
260
+ "path": "{models}",
261
+ "access": "rw"
262
+ }
263
+ ],
264
+ "network": [
265
+ "huggingface.co"
266
+ ],
267
+ "devices": [
268
+ "gpu"
269
+ ]
270
+ },
271
+ "skills": [
272
+ {
273
+ "name": "transcribe-on-computer",
274
+ "kind": "instruction",
275
+ "scope": "pod",
276
+ "description": "How to transcribe a video or audio file on the computer that has this tool: extract 16 kHz audio, run mlx-whisper (Mac) or faster-whisper (Linux, Windows) with word timings, keep SRT, VTT and the words JSON.",
277
+ "code": "# Transcribe a video or audio file on this computer\n\nThe result is a timed transcript: subtitles (SRT and VTT) and a JSON file with every word's start and end (`segments[].words[]`: word, start, end, probability). The words JSON is what the `captions-burn-in` and silence recipes of media-ffmpeg read. Nothing leaves the computer and no AI tokens are spent.\n\n1. Check the tool is here: `synap tools verify media-transcribe`. Not installed: ask the person before installing (the model is a 1.6 GB download).\n2. Turn the input into 16 kHz mono WAV with the media-ffmpeg recipe `audio-extract` (a video goes in, `audio.wav` comes out).\n3. Run the tool for this computer, with word timings ON and the model named (never the tiny default):\n\n**Mac (Apple Silicon): mlx-whisper**\n```\nmlx_whisper audio.wav --model mlx-community/whisper-large-v3-turbo -f all -o OUT_DIR --word-timestamps True --condition-on-previous-text False\n```\nAdd `--language en` (or fr...) when you know it. For subtitle lines, `--max-words-per-line 4` (it needs word timestamps).\n\n**Linux and Windows: faster-whisper (whisper-ctranslate2)**\n```\nwhisper-ctranslate2 audio.wav --model large-v3-turbo --output_format all --output_dir OUT_DIR --word_timestamps True --vad_filter True\n```\nOn a computer without an NVIDIA GPU add `--device cpu --compute_type int8`.\n\n4. Keep the four files beside the source: `.srt`, `.vtt`, `.txt`, `.json`.\n\n**No Python on the computer?** whisper.cpp is a single program (MIT): `brew install whisper-cpp` on a Mac, or built from github.com/ggml-org/whisper.cpp; then `whisper-cli -m ggml-large-v3-turbo.bin -f audio.wav -osrt -ovtt -ojf -of OUT`. Its full JSON has token timings, not the `segments[].words[]` shape, so the caption recipe cannot read it as is.\n\n**Gotchas**\n- Long silences can make whisper repeat itself: `--condition-on-previous-text False` (mlx) and `--vad_filter True` (faster-whisper) stop it.\n- After a silence cut, transcribe the CUT file again so word timings match.\n- A GPU on Linux needs CUDA 12 and cuDNN 9 for faster-whisper.\n"
278
+ }
279
+ ],
280
+ "provides": []
281
+ }
282
+ }
@@ -321,6 +321,19 @@
321
321
  "company": "string",
322
322
  "accountId": "string"
323
323
  },
324
+ "inputMap": {
325
+ "params": {
326
+ "fullName": "$.name",
327
+ "company": "$.company",
328
+ "accountId": "$account.id"
329
+ },
330
+ "accounts": {
331
+ "verb": "unipile_list_accounts",
332
+ "id": "id",
333
+ "label": "name",
334
+ "provider": "provider"
335
+ }
336
+ },
324
337
  "code": "// Find ONE person's LinkedIn profile by their full name and company: a STRICT\n// match or none (CRM wave 2, S4b). A pure read: it writes nothing, so it runs at\n// once. Writing the match onto the person (linkedinUrl, linkedinProviderId) is\n// the caller's write, proposed for a person to approve (founder decision 7).\n// STRICT: the result's name equals the full name (case- and accent-insensitive,\n// spaces collapsed), the company is in its headline as whole words (a v2\n// PeopleSearchResult has no company field), and exactly one result is both.\n// None, several, or a third page left unread (so one more could exist): no\n// match, with up to 3 candidates (the closest first) for a person to choose.\n// v2: POST /{account_id}/linkedin/search/people, paged by `cursor` (the reply's\n// next_cursor); the company also narrows the search (advanced_keywords).\nconst accountId = String(args?.accountId ?? '').trim();\nconst fullName = String(args?.fullName ?? '').trim();\nconst company = String(args?.company ?? '').trim();\nif (!accountId) throw new Error('linkedin_find_profile: accountId is required — call unipile_list_accounts first to find yours.');\nif (!fullName) throw new Error('linkedin_find_profile: fullName (the person\\'s first and last name) is required');\nif (!company) throw new Error('linkedin_find_profile: company is required: without it a name alone is never a strict match');\n\nconst fold = (s) => String(s ?? '').normalize('NFD').replace(/\\p{M}+/gu, '').toLowerCase();\nconst nameKey = (s) => fold(s).replace(/\\s+/g, ' ').trim();\nconst words = (s) => fold(s).split(/[^\\p{L}\\p{N}]+/u).filter(Boolean);\nconst hasWords = (text, part) => {\n if (!part.length) return false;\n for (let i = 0; i + part.length <= text.length; i++) {\n if (part.every((w, j) => text[i + j] === w)) return true;\n }\n return false;\n};\nconst wanted = nameKey(fullName);\nconst companyWords = words(company);\nconst nameMatches = (p) => nameKey(p?.display_name) === wanted;\nconst companyInHeadline = (p) => hasWords(words(p?.headline), companyWords);\n\nconst MAX_PAGES = 2;\nconst account = encodeURIComponent(accountId);\nconst body = { keywords: fullName, advanced_keywords: { company } };\nconst byId = new Map();\nlet cursor = null;\nlet pages = 0;\ndo {\n const qs = cursor ? `?${new URLSearchParams({ cursor }).toString()}` : '';\n const res = await callProvider('unipile_linkedin', 'POST', `/${account}/linkedin/search/people${qs}`, body);\n if (res?.proposed === true) {\n return { matched: false, reason: 'proposed', proposed: true, proposalId: res?.proposalId ?? null, candidates: [] };\n }\n if (res?.status && (res.status < 200 || res.status >= 300)) throw new Error(`linkedin_find_profile: the LinkedIn search failed (status ${res.status}).`);\n const payload = res?.body ?? res;\n const items = Array.isArray(payload?.data) ? payload.data : [];\n for (const p of items) {\n const key = String(p?.id ?? p?.public_identifier ?? `row-${byId.size}`);\n if (!byId.has(key)) byId.set(key, p);\n }\n pages += 1;\n const next = typeof payload?.next_cursor === 'string' && payload.next_cursor ? payload.next_cursor : null;\n cursor = next && next !== cursor ? next : null;\n} while (cursor && pages < MAX_PAGES);\nconst moreUnread = Boolean(cursor);\n\nconst view = (p) => {\n const publicIdentifier = p?.public_identifier ?? null;\n return {\n name: String(p?.display_name ?? '').trim() || null,\n headline: p?.headline ?? null,\n location: p?.location ?? null,\n providerId: p?.id ?? null,\n publicIdentifier,\n profileUrl: p?.profile_url ?? (publicIdentifier ? `https://www.linkedin.com/in/${publicIdentifier}` : null),\n networkDistance: p?.network_distance ?? null,\n nameMatches: nameMatches(p),\n companyInHeadline: companyInHeadline(p),\n };\n};\nconst rows = [...byId.values()].map(view);\nconst strict = rows.filter((r) => r.nameMatches && r.companyInHeadline);\nconst searched = { fullName, company, results: rows.length, pages, moreUnread };\n\nif (strict.length === 1 && !moreUnread) {\n const profile = strict[0];\n return {\n matched: true,\n profile,\n properties: { linkedinUrl: profile.profileUrl, linkedinProviderId: profile.providerId },\n candidates: [],\n searched,\n };\n}\nconst rank = (r) => (r.nameMatches ? 2 : 0) + (r.companyInHeadline ? 1 : 0);\nconst candidates = rows\n .map((r, i) => ({ r, i }))\n .sort((a, b) => rank(b.r) - rank(a.r) || a.i - b.i)\n .slice(0, 3)\n .map(({ r }) => r);\nconst reason = strict.length > 1 ? 'several' : strict.length === 1 ? 'more_results' : 'none';\nreturn { matched: false, reason, candidates, searched };\n"
325
338
  },
326
339
  {
package/dist/wire.d.ts CHANGED
@@ -87,6 +87,18 @@ interface CapabilityElement {
87
87
  mcpServers?: unknown;
88
88
  metadata?: Record<string, unknown>;
89
89
  _generated?: unknown;
90
+ /** Where it runs and how a computer installs, checks and removes its tool (`schema/computer.ts`). */
91
+ placement?: Record<string, unknown>;
92
+ install?: Record<string, unknown>;
93
+ verify?: Record<string, unknown>;
94
+ uninstall?: Record<string, unknown>;
95
+ permissions?: Record<string, unknown>;
96
+ /** SPDX expression; set on every capability that runs on a computer. */
97
+ licence?: string;
98
+ /** The containers a `service` capability runs on a computer (`schema/computer.ts`). */
99
+ services?: Array<Record<string, unknown>>;
100
+ /** Stored recipes the computer runs (`schema/recipe.ts`). */
101
+ recipes?: Array<Record<string, unknown>>;
90
102
  }
91
103
  /** capability: `{ profiles: [], description, capability }`. */
92
104
  interface CapabilityWire extends WireEnvelope {
package/dist/wire.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/wire-core.ts","../src/wire.ts"],"sourcesContent":["/**\n * The per-kind wire envelopes and the ONE unwrap — import-free on purpose.\n *\n * Re-exported (with the workspace types) by `./wire`, the public subpath\n * `@synap-core/workspace-templates/wire`. It has no imports so a consumer that\n * still resolves an older npm copy of this package (the CLI, the CP, the pod)\n * can carry it as a BYTE-IDENTICAL mirror pinned by a tripwire until it can\n * import the subpath. Edit it here; the mirror copies it.\n *\n * What `GET {CP}/api/packages/:slug` serves as `package.definition`, per kind:\n * the outputs of this package's producers (`scripts/catalog-lib.mjs`\n * `toPublishBody`; `toOfficialPublishBody` for workspaces) plus what the CP\n * adds on store/serve (`_meta.slug` via `withTemplateSlug`,\n * `capability.contentHash`).\n *\n * WHY: a skill package is served as `{ _meta, skill: {…} }`. Read flat, every\n * field is `undefined`: install refused a \"bodiless\" skill and the update door\n * reported \"no drift\" forever (founder pod 2026-10-13, creative-director). Each\n * consumer had its own cast; this is the one place the envelope is known.\n *\n * Element fields are pinned to the catalog schema (`SKILL_FIELDS`,\n * `CapabilitySpec`) and `AutomationElement` to `PackageAutomationWire` by\n * `schema/wire.parity.test.ts` (compile time).\n */\n\n// ─── Kinds ──────────────────────────────────────────────────────────────────\n\n/** The kinds whose served definition this module describes. */\nexport const WIRE_KINDS = [\"workspace\", \"capability\", \"skill\", \"automation\", \"view\"] as const;\nexport type WireKind = (typeof WIRE_KINDS)[number];\n\n/**\n * Other names the same kinds go by: the pod's `market.install` says\n * `template`, the CP category for an automation is `workflow`, and a pack is\n * a workspace-shaped definition.\n */\nexport const WIRE_KIND_ALIASES = {\n template: \"workspace\",\n pack: \"workspace\",\n workflow: \"automation\",\n} as const satisfies Record<string, WireKind>;\nexport type WireKindName = WireKind | keyof typeof WIRE_KIND_ALIASES;\n\n/** `template` → `workspace`, `workflow` → `automation`; `null` for a kind with no wire contract here (e.g. `cell`). */\nexport function toWireKind(kind: string): WireKind | null {\n if ((WIRE_KINDS as readonly string[]).includes(kind)) return kind as WireKind;\n return (WIRE_KIND_ALIASES as Record<string, WireKind>)[kind] ?? null;\n}\n\n// ─── Envelope pieces every kind shares ──────────────────────────────────────\n\n/**\n * `definition._meta` as served: the CP stamps `slug` on every row (the pod\n * keys \"which space is this template's?\" on it); the CLI adds the `version`\n * label it installs.\n */\nexport interface WireMeta {\n slug?: string;\n version?: string;\n [key: string]: unknown;\n}\n\n/** `meta.icon` / `color` / `domain`, mirrored onto the definition by every publish builder. */\nexport interface WireIdentity {\n icon?: string;\n color?: string;\n domain?: string;\n}\n\n/** A composition dependency. */\nexport interface WireDependency {\n slug: string;\n kind?: \"workspace\" | \"capability\" | \"skill\" | \"workflow\" | \"view\" | \"cell\" | \"automation\";\n relation?: \"compose\" | \"require\";\n reason?: string;\n}\n\nexport interface WireEnvelope extends WireIdentity {\n _meta?: WireMeta;\n dependencies?: WireDependency[];\n}\n\n// ─── Elements and envelopes, per kind ───────────────────────────────────────\n\n/** The capability itself (`CapabilityDefinition`). */\nexport interface CapabilityElement {\n key: string;\n name: string;\n description?: string;\n params?: Array<Record<string, unknown>>;\n vault?: Array<Record<string, unknown>>;\n tools?: Array<Record<string, unknown>>;\n skills?: Array<Record<string, unknown>>;\n provides?: string[];\n playbooks?: Array<Record<string, unknown>>;\n /** Stamped by the CP on publish; the pod's drift marker. */\n contentHash?: string;\n automations?: Array<Record<string, unknown>>;\n mcpServers?: unknown;\n metadata?: Record<string, unknown>;\n _generated?: unknown;\n}\n\n/** capability: `{ profiles: [], description, capability }`. */\nexport interface CapabilityWire extends WireEnvelope {\n profiles: unknown[];\n description?: string;\n capability: CapabilityElement;\n}\n\n/** ONE standalone skill. Not a workspace's `skills[]` link list. */\nexport interface SkillElement {\n /** The pod-side `load_skill` ref — its own identity, not the package slug. */\n slug?: string;\n name?: string;\n displayName?: string;\n description?: string;\n kind?: \"instruction\" | \"code\" | \"declarative\" | \"builtin\";\n scope?: \"pod\" | \"user\" | \"workspace\";\n agentTypes?: string[];\n body?: string;\n code?: string;\n providerSpec?: Record<string, unknown>;\n parameters?: Record<string, unknown>;\n category?: string;\n executionMode?: \"sync\" | \"async\";\n timeoutSeconds?: number;\n intent?: string;\n [key: string]: unknown;\n}\n\n/** skill: `{ skill, icon?, color?, domain?, dependencies? }`. */\nexport interface SkillWire extends WireEnvelope {\n skill: SkillElement;\n}\n\n/** One graph automation (= `PackageAutomationWire`): `flowDefinition`, not the authored `flow`. */\nexport interface AutomationElement {\n key?: string;\n name: string;\n description?: string;\n triggerType: \"event\" | \"cron\" | \"webhook\" | \"manual\";\n triggerConfig?: Record<string, unknown>;\n flowDefinition?: { nodes: unknown[]; edges: unknown[]; precondition?: string };\n status?: \"draft\" | \"active\" | \"paused\";\n}\n\n/** automation (CP category `workflow`): `{ profiles: [], automations: [one] }`. */\nexport interface AutomationWire extends WireEnvelope {\n profiles: unknown[];\n automations: AutomationElement[];\n}\n\n/** One view, as the pod's view install and update doors read it. */\nexport interface ViewElement {\n slug?: string;\n name?: string;\n displayName?: string;\n description?: string;\n type?: string;\n config?: Record<string, unknown>;\n query?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n scopeProfileSlugs?: string[];\n scopeProfileIds?: string[];\n [key: string]: unknown;\n}\n\n/** view: `{ views: [...] }`, or a legacy single view with its fields on top (has its own `type`). No catalog producer today. */\nexport type ViewWire = (WireEnvelope & { views: ViewElement[] }) | ViewElement;\n\n/**\n * What {@link unwrapPackage} returns per kind. `workspace` is the definition\n * itself; `./wire` narrows it to `WorkspaceWire`.\n */\nexport interface PackageElementByKind<W = Record<string, unknown>> {\n workspace: W;\n capability: CapabilityElement;\n skill: SkillElement;\n automation: AutomationElement[];\n view: ViewElement[];\n}\n\nexport type ElementOf<K extends WireKindName, W = Record<string, unknown>> = PackageElementByKind<W>[K extends WireKind\n ? K\n : K extends keyof typeof WIRE_KIND_ALIASES\n ? (typeof WIRE_KIND_ALIASES)[K]\n : never];\n\n// ─── The ONE unwrap ─────────────────────────────────────────────────────────\n\nconst isRecord = (v: unknown): v is Record<string, unknown> =>\n typeof v === \"object\" && v !== null && !Array.isArray(v);\n\n/**\n * The installable element(s) inside a served definition:\n *\n * skill → the `skill` object (a legacy flat definition is the skill itself)\n * capability → the `capability` object (a flat `CapabilityDefinition` — the\n * pod cache / CP by-key shape — passes through)\n * automation → `automations[]` (`[]` when the definition declares none)\n * view → `views[]`, or a legacy flat view (top-level `type`) as `[def]`, else `[]`\n * workspace → the definition itself\n *\n * An empty array means the definition declares none; the install doors refuse\n * that themselves. A definition that is not an object is a failed read, never\n * an empty one: it throws.\n */\nexport function unwrapPackage<K extends WireKindName>(kind: K, definition: unknown): ElementOf<K>;\nexport function unwrapPackage(kind: string, definition: unknown): unknown {\n const wireKind = toWireKind(kind);\n if (!wireKind) throw new Error(`unwrapPackage: \"${kind}\" has no wire contract`);\n if (!isRecord(definition)) {\n throw new TypeError(\n `unwrapPackage(${kind}): the definition is not an object (${definition === null ? \"null\" : Array.isArray(definition) ? \"array\" : typeof definition})`,\n );\n }\n switch (wireKind) {\n case \"skill\":\n return isRecord(definition.skill) ? definition.skill : definition;\n case \"capability\":\n return isRecord(definition.capability) ? definition.capability : definition;\n case \"automation\":\n return Array.isArray(definition.automations) ? definition.automations : [];\n case \"view\":\n if (Array.isArray(definition.views) && definition.views.length > 0) return definition.views;\n return definition.type ? [definition] : [];\n case \"workspace\":\n return definition;\n }\n}\n","/**\n * @synap-core/workspace-templates/wire — ONE wire contract per package kind.\n *\n * The per-kind envelopes and `unwrapPackage` live in `./wire-core` (import-free,\n * so it can be mirrored byte-for-byte by consumers still pinned to an older npm\n * copy). This adds what needs the rest of the package: the workspace envelope,\n * derived from `PackageDefinitionOutput` instead of re-declared, and the one\n * workspace wire → create-input translation.\n */\n\nimport type { PackageDefinitionOutput, WorkspaceDefinitionInput } from \"./define\";\nimport { unwrapPackage as unwrapCore, type ElementOf, type WireIdentity, type WireKindName, type WireMeta } from \"./wire-core\";\n\nexport {\n WIRE_KINDS,\n WIRE_KIND_ALIASES,\n toWireKind,\n type WireKind,\n type WireKindName,\n type WireMeta,\n type WireIdentity,\n type WireDependency,\n type WireEnvelope,\n type CapabilityElement,\n type CapabilityWire,\n type SkillElement,\n type SkillWire,\n type AutomationElement,\n type AutomationWire,\n type ViewElement,\n type ViewWire,\n type PackageElementByKind,\n} from \"./wire-core\";\nimport type { AutomationWire, CapabilityWire, SkillWire, ViewWire, WireKind } from \"./wire-core\";\n\n/**\n * workspace / pack: `toPackageDefinition()` output — re-used, not re-declared.\n * As served it is `toOfficialPublishBody().definition` (identity mirrored on\n * top, `sourcePackage`) with `_meta` cut down to what the CP stamps; a bundled\n * `PackageDefinitionOutput` is assignable to it as is.\n */\nexport type WorkspaceWire = Omit<PackageDefinitionOutput, \"_meta\"> &\n WireIdentity & {\n _meta?: Partial<PackageDefinitionOutput[\"_meta\"]> & WireMeta;\n /** Which build of this package generated the row (official rows only). */\n sourcePackage?: { name: string; version: string };\n };\n\n/** The served definition, keyed by kind. */\nexport interface PackageWireByKind {\n workspace: WorkspaceWire;\n capability: CapabilityWire;\n skill: SkillWire;\n automation: AutomationWire;\n view: ViewWire;\n}\nexport type PackageWire = PackageWireByKind[WireKind];\n\n/** `./wire-core`'s `unwrapPackage`, with the workspace element typed as {@link WorkspaceWire}. */\nexport function unwrapPackage<K extends WireKindName>(kind: K, definition: unknown): ElementOf<K, WorkspaceWire> {\n return unwrapCore(kind, definition) as ElementOf<K, WorkspaceWire>;\n}\n\n/**\n * The served workspace definition → the input the pod's create/reconcile door\n * takes (`WorkspaceDefinitionInput`). The two renames live here and only here:\n * `suggestedEntities` → `seedEntities` and `automations` (graph flows) →\n * `flowAutomations`.\n *\n * A 1:1 copy of the pod's `toWorkspaceDefinitionInput`\n * (synap-backend `services/capabilities/resolve-workspace-template.ts`), so the\n * pod can import this instead. Like it, it does NOT carry `taskIntents`,\n * `capabilities`, `playbooks`, `actionPlacements`, `rules` or `skills`: the\n * post-workspace layer reads the last five off the package definition itself;\n * `taskIntents` is a gap on that path today. `wire.test.ts` pins every\n * difference from `toWorkspaceDefinition`.\n */\nexport function toWorkspaceInput(pkg: WorkspaceWire): WorkspaceDefinitionInput {\n return {\n workspaceName: pkg.workspaceName,\n description: pkg.description,\n proposalId: pkg._meta?.slug,\n profiles: pkg.profiles,\n views: pkg.views ?? [],\n entityLinks: pkg.entityLinks ?? [],\n seedEntities: pkg.suggestedEntities ?? [],\n suggestedRelations: pkg.suggestedRelations,\n displayTemplates: pkg.displayTemplates,\n layoutConfig: pkg.layoutConfig,\n bentoViewName: pkg.bentoViewName,\n bentoLayout: pkg.bentoLayout,\n bentoViewBlocks: pkg.bentoViewBlocks,\n profileEntityBentoTemplates: pkg.profileEntityBentoTemplates,\n workspaceSubtype: pkg.workspaceSubtype,\n workspaceType: pkg.workspaceType,\n workspaceVisibility: pkg.workspaceVisibility,\n workspaceCapabilities: pkg.workspaceCapabilities,\n intent: pkg.intent,\n sourceRoles: pkg.sourceRoles,\n defaultSources: pkg.defaultSources,\n onboarding: pkg.onboarding,\n dependencies: pkg.dependencies,\n flowAutomations: pkg.automations ?? [],\n commands: pkg.commands ?? [],\n relationDefs: pkg.relationDefs ?? [],\n };\n}\n"],"mappings":";AA4BO,IAAM,aAAa,CAAC,aAAa,cAAc,SAAS,cAAc,MAAM;AAQ5E,IAAM,oBAAoB;AAAA,EAC/B,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AACZ;AAIO,SAAS,WAAW,MAA+B;AACxD,MAAK,WAAiC,SAAS,IAAI,EAAG,QAAO;AAC7D,SAAQ,kBAA+C,IAAI,KAAK;AAClE;AAgJA,IAAM,WAAW,CAAC,MAChB,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAiBlD,SAAS,cAAc,MAAc,YAA8B;AACxE,QAAM,WAAW,WAAW,IAAI;AAChC,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,mBAAmB,IAAI,wBAAwB;AAC9E,MAAI,CAAC,SAAS,UAAU,GAAG;AACzB,UAAM,IAAI;AAAA,MACR,iBAAiB,IAAI,uCAAuC,eAAe,OAAO,SAAS,MAAM,QAAQ,UAAU,IAAI,UAAU,OAAO,UAAU;AAAA,IACpJ;AAAA,EACF;AACA,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO,SAAS,WAAW,KAAK,IAAI,WAAW,QAAQ;AAAA,IACzD,KAAK;AACH,aAAO,SAAS,WAAW,UAAU,IAAI,WAAW,aAAa;AAAA,IACnE,KAAK;AACH,aAAO,MAAM,QAAQ,WAAW,WAAW,IAAI,WAAW,cAAc,CAAC;AAAA,IAC3E,KAAK;AACH,UAAI,MAAM,QAAQ,WAAW,KAAK,KAAK,WAAW,MAAM,SAAS,EAAG,QAAO,WAAW;AACtF,aAAO,WAAW,OAAO,CAAC,UAAU,IAAI,CAAC;AAAA,IAC3C,KAAK;AACH,aAAO;AAAA,EACX;AACF;;;AC3KO,SAASA,eAAsC,MAAS,YAAkD;AAC/G,SAAO,cAAW,MAAM,UAAU;AACpC;AAgBO,SAAS,iBAAiB,KAA8C;AAC7E,SAAO;AAAA,IACL,eAAe,IAAI;AAAA,IACnB,aAAa,IAAI;AAAA,IACjB,YAAY,IAAI,OAAO;AAAA,IACvB,UAAU,IAAI;AAAA,IACd,OAAO,IAAI,SAAS,CAAC;AAAA,IACrB,aAAa,IAAI,eAAe,CAAC;AAAA,IACjC,cAAc,IAAI,qBAAqB,CAAC;AAAA,IACxC,oBAAoB,IAAI;AAAA,IACxB,kBAAkB,IAAI;AAAA,IACtB,cAAc,IAAI;AAAA,IAClB,eAAe,IAAI;AAAA,IACnB,aAAa,IAAI;AAAA,IACjB,iBAAiB,IAAI;AAAA,IACrB,6BAA6B,IAAI;AAAA,IACjC,kBAAkB,IAAI;AAAA,IACtB,eAAe,IAAI;AAAA,IACnB,qBAAqB,IAAI;AAAA,IACzB,uBAAuB,IAAI;AAAA,IAC3B,QAAQ,IAAI;AAAA,IACZ,aAAa,IAAI;AAAA,IACjB,gBAAgB,IAAI;AAAA,IACpB,YAAY,IAAI;AAAA,IAChB,cAAc,IAAI;AAAA,IAClB,iBAAiB,IAAI,eAAe,CAAC;AAAA,IACrC,UAAU,IAAI,YAAY,CAAC;AAAA,IAC3B,cAAc,IAAI,gBAAgB,CAAC;AAAA,EACrC;AACF;","names":["unwrapPackage"]}
1
+ {"version":3,"sources":["../src/wire-core.ts","../src/wire.ts"],"sourcesContent":["/**\n * The per-kind wire envelopes and the ONE unwrap — import-free on purpose.\n *\n * Re-exported (with the workspace types) by `./wire`, the public subpath\n * `@synap-core/workspace-templates/wire`. It has no imports so a consumer that\n * still resolves an older npm copy of this package (the CLI, the CP, the pod)\n * can carry it as a BYTE-IDENTICAL mirror pinned by a tripwire until it can\n * import the subpath. Edit it here; the mirror copies it.\n *\n * What `GET {CP}/api/packages/:slug` serves as `package.definition`, per kind:\n * the outputs of this package's producers (`scripts/catalog-lib.mjs`\n * `toPublishBody`; `toOfficialPublishBody` for workspaces) plus what the CP\n * adds on store/serve (`_meta.slug` via `withTemplateSlug`,\n * `capability.contentHash`).\n *\n * WHY: a skill package is served as `{ _meta, skill: {…} }`. Read flat, every\n * field is `undefined`: install refused a \"bodiless\" skill and the update door\n * reported \"no drift\" forever (founder pod 2026-10-13, creative-director). Each\n * consumer had its own cast; this is the one place the envelope is known.\n *\n * Element fields are pinned to the catalog schema (`SKILL_FIELDS`,\n * `CapabilitySpec`) and `AutomationElement` to `PackageAutomationWire` by\n * `schema/wire.parity.test.ts` (compile time).\n */\n\n// ─── Kinds ──────────────────────────────────────────────────────────────────\n\n/** The kinds whose served definition this module describes. */\nexport const WIRE_KINDS = [\"workspace\", \"capability\", \"skill\", \"automation\", \"view\"] as const;\nexport type WireKind = (typeof WIRE_KINDS)[number];\n\n/**\n * Other names the same kinds go by: the pod's `market.install` says\n * `template`, the CP category for an automation is `workflow`, and a pack is\n * a workspace-shaped definition.\n */\nexport const WIRE_KIND_ALIASES = {\n template: \"workspace\",\n pack: \"workspace\",\n workflow: \"automation\",\n} as const satisfies Record<string, WireKind>;\nexport type WireKindName = WireKind | keyof typeof WIRE_KIND_ALIASES;\n\n/** `template` → `workspace`, `workflow` → `automation`; `null` for a kind with no wire contract here (e.g. `cell`). */\nexport function toWireKind(kind: string): WireKind | null {\n if ((WIRE_KINDS as readonly string[]).includes(kind)) return kind as WireKind;\n return (WIRE_KIND_ALIASES as Record<string, WireKind>)[kind] ?? null;\n}\n\n// ─── Envelope pieces every kind shares ──────────────────────────────────────\n\n/**\n * `definition._meta` as served: the CP stamps `slug` on every row (the pod\n * keys \"which space is this template's?\" on it); the CLI adds the `version`\n * label it installs.\n */\nexport interface WireMeta {\n slug?: string;\n version?: string;\n [key: string]: unknown;\n}\n\n/** `meta.icon` / `color` / `domain`, mirrored onto the definition by every publish builder. */\nexport interface WireIdentity {\n icon?: string;\n color?: string;\n domain?: string;\n}\n\n/** A composition dependency. */\nexport interface WireDependency {\n slug: string;\n kind?: \"workspace\" | \"capability\" | \"skill\" | \"workflow\" | \"view\" | \"cell\" | \"automation\";\n relation?: \"compose\" | \"require\";\n reason?: string;\n}\n\nexport interface WireEnvelope extends WireIdentity {\n _meta?: WireMeta;\n dependencies?: WireDependency[];\n}\n\n// ─── Elements and envelopes, per kind ───────────────────────────────────────\n\n/** The capability itself (`CapabilityDefinition`). */\nexport interface CapabilityElement {\n key: string;\n name: string;\n description?: string;\n params?: Array<Record<string, unknown>>;\n vault?: Array<Record<string, unknown>>;\n tools?: Array<Record<string, unknown>>;\n skills?: Array<Record<string, unknown>>;\n provides?: string[];\n playbooks?: Array<Record<string, unknown>>;\n /** Stamped by the CP on publish; the pod's drift marker. */\n contentHash?: string;\n automations?: Array<Record<string, unknown>>;\n mcpServers?: unknown;\n metadata?: Record<string, unknown>;\n _generated?: unknown;\n /** Where it runs and how a computer installs, checks and removes its tool (`schema/computer.ts`). */\n placement?: Record<string, unknown>;\n install?: Record<string, unknown>;\n verify?: Record<string, unknown>;\n uninstall?: Record<string, unknown>;\n permissions?: Record<string, unknown>;\n /** SPDX expression; set on every capability that runs on a computer. */\n licence?: string;\n /** The containers a `service` capability runs on a computer (`schema/computer.ts`). */\n services?: Array<Record<string, unknown>>;\n /** Stored recipes the computer runs (`schema/recipe.ts`). */\n recipes?: Array<Record<string, unknown>>;\n}\n\n/** capability: `{ profiles: [], description, capability }`. */\nexport interface CapabilityWire extends WireEnvelope {\n profiles: unknown[];\n description?: string;\n capability: CapabilityElement;\n}\n\n/** ONE standalone skill. Not a workspace's `skills[]` link list. */\nexport interface SkillElement {\n /** The pod-side `load_skill` ref — its own identity, not the package slug. */\n slug?: string;\n name?: string;\n displayName?: string;\n description?: string;\n kind?: \"instruction\" | \"code\" | \"declarative\" | \"builtin\";\n scope?: \"pod\" | \"user\" | \"workspace\";\n agentTypes?: string[];\n body?: string;\n code?: string;\n providerSpec?: Record<string, unknown>;\n parameters?: Record<string, unknown>;\n category?: string;\n executionMode?: \"sync\" | \"async\";\n timeoutSeconds?: number;\n intent?: string;\n [key: string]: unknown;\n}\n\n/** skill: `{ skill, icon?, color?, domain?, dependencies? }`. */\nexport interface SkillWire extends WireEnvelope {\n skill: SkillElement;\n}\n\n/** One graph automation (= `PackageAutomationWire`): `flowDefinition`, not the authored `flow`. */\nexport interface AutomationElement {\n key?: string;\n name: string;\n description?: string;\n triggerType: \"event\" | \"cron\" | \"webhook\" | \"manual\";\n triggerConfig?: Record<string, unknown>;\n flowDefinition?: { nodes: unknown[]; edges: unknown[]; precondition?: string };\n status?: \"draft\" | \"active\" | \"paused\";\n}\n\n/** automation (CP category `workflow`): `{ profiles: [], automations: [one] }`. */\nexport interface AutomationWire extends WireEnvelope {\n profiles: unknown[];\n automations: AutomationElement[];\n}\n\n/** One view, as the pod's view install and update doors read it. */\nexport interface ViewElement {\n slug?: string;\n name?: string;\n displayName?: string;\n description?: string;\n type?: string;\n config?: Record<string, unknown>;\n query?: Record<string, unknown>;\n metadata?: Record<string, unknown>;\n scopeProfileSlugs?: string[];\n scopeProfileIds?: string[];\n [key: string]: unknown;\n}\n\n/** view: `{ views: [...] }`, or a legacy single view with its fields on top (has its own `type`). No catalog producer today. */\nexport type ViewWire = (WireEnvelope & { views: ViewElement[] }) | ViewElement;\n\n/**\n * What {@link unwrapPackage} returns per kind. `workspace` is the definition\n * itself; `./wire` narrows it to `WorkspaceWire`.\n */\nexport interface PackageElementByKind<W = Record<string, unknown>> {\n workspace: W;\n capability: CapabilityElement;\n skill: SkillElement;\n automation: AutomationElement[];\n view: ViewElement[];\n}\n\nexport type ElementOf<K extends WireKindName, W = Record<string, unknown>> = PackageElementByKind<W>[K extends WireKind\n ? K\n : K extends keyof typeof WIRE_KIND_ALIASES\n ? (typeof WIRE_KIND_ALIASES)[K]\n : never];\n\n// ─── The ONE unwrap ─────────────────────────────────────────────────────────\n\nconst isRecord = (v: unknown): v is Record<string, unknown> =>\n typeof v === \"object\" && v !== null && !Array.isArray(v);\n\n/**\n * The installable element(s) inside a served definition:\n *\n * skill → the `skill` object (a legacy flat definition is the skill itself)\n * capability → the `capability` object (a flat `CapabilityDefinition` — the\n * pod cache / CP by-key shape — passes through)\n * automation → `automations[]` (`[]` when the definition declares none)\n * view → `views[]`, or a legacy flat view (top-level `type`) as `[def]`, else `[]`\n * workspace → the definition itself\n *\n * An empty array means the definition declares none; the install doors refuse\n * that themselves. A definition that is not an object is a failed read, never\n * an empty one: it throws.\n */\nexport function unwrapPackage<K extends WireKindName>(kind: K, definition: unknown): ElementOf<K>;\nexport function unwrapPackage(kind: string, definition: unknown): unknown {\n const wireKind = toWireKind(kind);\n if (!wireKind) throw new Error(`unwrapPackage: \"${kind}\" has no wire contract`);\n if (!isRecord(definition)) {\n throw new TypeError(\n `unwrapPackage(${kind}): the definition is not an object (${definition === null ? \"null\" : Array.isArray(definition) ? \"array\" : typeof definition})`,\n );\n }\n switch (wireKind) {\n case \"skill\":\n return isRecord(definition.skill) ? definition.skill : definition;\n case \"capability\":\n return isRecord(definition.capability) ? definition.capability : definition;\n case \"automation\":\n return Array.isArray(definition.automations) ? definition.automations : [];\n case \"view\":\n if (Array.isArray(definition.views) && definition.views.length > 0) return definition.views;\n return definition.type ? [definition] : [];\n case \"workspace\":\n return definition;\n }\n}\n","/**\n * @synap-core/workspace-templates/wire — ONE wire contract per package kind.\n *\n * The per-kind envelopes and `unwrapPackage` live in `./wire-core` (import-free,\n * so it can be mirrored byte-for-byte by consumers still pinned to an older npm\n * copy). This adds what needs the rest of the package: the workspace envelope,\n * derived from `PackageDefinitionOutput` instead of re-declared, and the one\n * workspace wire → create-input translation.\n */\n\nimport type { PackageDefinitionOutput, WorkspaceDefinitionInput } from \"./define\";\nimport { unwrapPackage as unwrapCore, type ElementOf, type WireIdentity, type WireKindName, type WireMeta } from \"./wire-core\";\n\nexport {\n WIRE_KINDS,\n WIRE_KIND_ALIASES,\n toWireKind,\n type WireKind,\n type WireKindName,\n type WireMeta,\n type WireIdentity,\n type WireDependency,\n type WireEnvelope,\n type CapabilityElement,\n type CapabilityWire,\n type SkillElement,\n type SkillWire,\n type AutomationElement,\n type AutomationWire,\n type ViewElement,\n type ViewWire,\n type PackageElementByKind,\n} from \"./wire-core\";\nimport type { AutomationWire, CapabilityWire, SkillWire, ViewWire, WireKind } from \"./wire-core\";\n\n/**\n * workspace / pack: `toPackageDefinition()` output — re-used, not re-declared.\n * As served it is `toOfficialPublishBody().definition` (identity mirrored on\n * top, `sourcePackage`) with `_meta` cut down to what the CP stamps; a bundled\n * `PackageDefinitionOutput` is assignable to it as is.\n */\nexport type WorkspaceWire = Omit<PackageDefinitionOutput, \"_meta\"> &\n WireIdentity & {\n _meta?: Partial<PackageDefinitionOutput[\"_meta\"]> & WireMeta;\n /** Which build of this package generated the row (official rows only). */\n sourcePackage?: { name: string; version: string };\n };\n\n/** The served definition, keyed by kind. */\nexport interface PackageWireByKind {\n workspace: WorkspaceWire;\n capability: CapabilityWire;\n skill: SkillWire;\n automation: AutomationWire;\n view: ViewWire;\n}\nexport type PackageWire = PackageWireByKind[WireKind];\n\n/** `./wire-core`'s `unwrapPackage`, with the workspace element typed as {@link WorkspaceWire}. */\nexport function unwrapPackage<K extends WireKindName>(kind: K, definition: unknown): ElementOf<K, WorkspaceWire> {\n return unwrapCore(kind, definition) as ElementOf<K, WorkspaceWire>;\n}\n\n/**\n * The served workspace definition → the input the pod's create/reconcile door\n * takes (`WorkspaceDefinitionInput`). The two renames live here and only here:\n * `suggestedEntities` → `seedEntities` and `automations` (graph flows) →\n * `flowAutomations`.\n *\n * A 1:1 copy of the pod's `toWorkspaceDefinitionInput`\n * (synap-backend `services/capabilities/resolve-workspace-template.ts`), so the\n * pod can import this instead. Like it, it does NOT carry `taskIntents`,\n * `capabilities`, `playbooks`, `actionPlacements`, `rules` or `skills`: the\n * post-workspace layer reads the last five off the package definition itself;\n * `taskIntents` is a gap on that path today. `wire.test.ts` pins every\n * difference from `toWorkspaceDefinition`.\n */\nexport function toWorkspaceInput(pkg: WorkspaceWire): WorkspaceDefinitionInput {\n return {\n workspaceName: pkg.workspaceName,\n description: pkg.description,\n proposalId: pkg._meta?.slug,\n profiles: pkg.profiles,\n views: pkg.views ?? [],\n entityLinks: pkg.entityLinks ?? [],\n seedEntities: pkg.suggestedEntities ?? [],\n suggestedRelations: pkg.suggestedRelations,\n displayTemplates: pkg.displayTemplates,\n layoutConfig: pkg.layoutConfig,\n bentoViewName: pkg.bentoViewName,\n bentoLayout: pkg.bentoLayout,\n bentoViewBlocks: pkg.bentoViewBlocks,\n profileEntityBentoTemplates: pkg.profileEntityBentoTemplates,\n workspaceSubtype: pkg.workspaceSubtype,\n workspaceType: pkg.workspaceType,\n workspaceVisibility: pkg.workspaceVisibility,\n workspaceCapabilities: pkg.workspaceCapabilities,\n intent: pkg.intent,\n sourceRoles: pkg.sourceRoles,\n defaultSources: pkg.defaultSources,\n onboarding: pkg.onboarding,\n dependencies: pkg.dependencies,\n flowAutomations: pkg.automations ?? [],\n commands: pkg.commands ?? [],\n relationDefs: pkg.relationDefs ?? [],\n };\n}\n"],"mappings":";AA4BO,IAAM,aAAa,CAAC,aAAa,cAAc,SAAS,cAAc,MAAM;AAQ5E,IAAM,oBAAoB;AAAA,EAC/B,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AACZ;AAIO,SAAS,WAAW,MAA+B;AACxD,MAAK,WAAiC,SAAS,IAAI,EAAG,QAAO;AAC7D,SAAQ,kBAA+C,IAAI,KAAK;AAClE;AA4JA,IAAM,WAAW,CAAC,MAChB,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAiBlD,SAAS,cAAc,MAAc,YAA8B;AACxE,QAAM,WAAW,WAAW,IAAI;AAChC,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,mBAAmB,IAAI,wBAAwB;AAC9E,MAAI,CAAC,SAAS,UAAU,GAAG;AACzB,UAAM,IAAI;AAAA,MACR,iBAAiB,IAAI,uCAAuC,eAAe,OAAO,SAAS,MAAM,QAAQ,UAAU,IAAI,UAAU,OAAO,UAAU;AAAA,IACpJ;AAAA,EACF;AACA,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO,SAAS,WAAW,KAAK,IAAI,WAAW,QAAQ;AAAA,IACzD,KAAK;AACH,aAAO,SAAS,WAAW,UAAU,IAAI,WAAW,aAAa;AAAA,IACnE,KAAK;AACH,aAAO,MAAM,QAAQ,WAAW,WAAW,IAAI,WAAW,cAAc,CAAC;AAAA,IAC3E,KAAK;AACH,UAAI,MAAM,QAAQ,WAAW,KAAK,KAAK,WAAW,MAAM,SAAS,EAAG,QAAO,WAAW;AACtF,aAAO,WAAW,OAAO,CAAC,UAAU,IAAI,CAAC;AAAA,IAC3C,KAAK;AACH,aAAO;AAAA,EACX;AACF;;;ACvLO,SAASA,eAAsC,MAAS,YAAkD;AAC/G,SAAO,cAAW,MAAM,UAAU;AACpC;AAgBO,SAAS,iBAAiB,KAA8C;AAC7E,SAAO;AAAA,IACL,eAAe,IAAI;AAAA,IACnB,aAAa,IAAI;AAAA,IACjB,YAAY,IAAI,OAAO;AAAA,IACvB,UAAU,IAAI;AAAA,IACd,OAAO,IAAI,SAAS,CAAC;AAAA,IACrB,aAAa,IAAI,eAAe,CAAC;AAAA,IACjC,cAAc,IAAI,qBAAqB,CAAC;AAAA,IACxC,oBAAoB,IAAI;AAAA,IACxB,kBAAkB,IAAI;AAAA,IACtB,cAAc,IAAI;AAAA,IAClB,eAAe,IAAI;AAAA,IACnB,aAAa,IAAI;AAAA,IACjB,iBAAiB,IAAI;AAAA,IACrB,6BAA6B,IAAI;AAAA,IACjC,kBAAkB,IAAI;AAAA,IACtB,eAAe,IAAI;AAAA,IACnB,qBAAqB,IAAI;AAAA,IACzB,uBAAuB,IAAI;AAAA,IAC3B,QAAQ,IAAI;AAAA,IACZ,aAAa,IAAI;AAAA,IACjB,gBAAgB,IAAI;AAAA,IACpB,YAAY,IAAI;AAAA,IAChB,cAAc,IAAI;AAAA,IAClB,iBAAiB,IAAI,eAAe,CAAC;AAAA,IACrC,UAAU,IAAI,YAAY,CAAC;AAAA,IAC3B,cAAc,IAAI,gBAAgB,CAAC;AAAA,EACrC;AACF;","names":["unwrapPackage"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synap-core/workspace-templates",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "type": "module",
5
5
  "description": "Canonical workspace definitions — YAML source + typed exports for browser, backend, CLI, and marketplace",
6
6
  "repository": {
package/src/crm.yaml CHANGED
@@ -1503,9 +1503,11 @@ playbooks:
1503
1503
  # ── Find their LinkedIn — one lead's LinkedIn profile ───────────────────
1504
1504
  # CRM Messages contract (decision b603d75e, build map ca310f27): the first of
1505
1505
  # the steps a LinkedIn lead walks (Find their LinkedIn, Ask to connect,
1506
- # Waiting, Send). linkedin_find_profile is a read with no inputMap, so the
1507
- # actions door cannot run it for the CRM app: the app starts this process
1508
- # for one lead (`params.lead`, as "Draft a first message"). On a strict match
1506
+ # Waiting, Send). The CRM app runs linkedin_find_profile itself through the
1507
+ # actions door (enrich_entity, input { name, company }; founder 7 Nov 2026:
1508
+ # "no need for ai" for a tool with a parameter), and offers this process
1509
+ # only as "Ask Synap AI to search" when the lookup finds nothing, for one
1510
+ # lead (`params.lead`, as "Draft a first message"). On a strict match
1509
1511
  # it PROPOSES linkedinUrl and linkedinProviderId on the person; on none or
1510
1512
  # several it hands the person up to 3 candidates. The reach fields stay the
1511
1513
  # pod's (backend#786). A lifecycle READER of leadStage: no stage moves.
@@ -79,6 +79,22 @@ describe("linkedin_find_profile — a strict match or none", () => {
79
79
  expect(verb.code).not.toMatch(/propose\.entity|callProvider\([^)]*'(PATCH|PUT|DELETE)'/);
80
80
  });
81
81
 
82
+ // A pod app runs the lookup itself (CRM "Find their LinkedIn", founder 7 Nov 2026: "no need for ai"):
83
+ // the enrich_entity input (backend migration 0409: { name, company? }) feeds every parameter of the
84
+ // verb, one action per Unipile account. Without a map the actions door offers the verb to no app.
85
+ it("serves enrich_entity for a pod app: { name, company } and the account feed every parameter", () => {
86
+ expect(verb.inputMap).toEqual({
87
+ params: { fullName: "$.name", company: "$.company", accountId: "$account.id" },
88
+ accounts: { verb: "unipile_list_accounts", id: "id", label: "name", provider: "provider" },
89
+ });
90
+ expect(Object.keys(verb.inputMap.params).sort()).toEqual(Object.keys(verb.parameters).sort());
91
+ // Only the fields the intent's input has (0409), never a `$to` address: the app names no recipient.
92
+ const read = Object.values(verb.inputMap.params as Record<string, string>).filter((s) => !s.startsWith("$account."));
93
+ expect(read.sort()).toEqual(["$.company", "$.name"]);
94
+ // The account source is the capability's own declared read.
95
+ expect(skill("unipile_list_accounts").metadata?.readOnly).toBe(true);
96
+ });
97
+
82
98
  it("one result with the same name (case and accents aside) and the company in its headline: the match", async () => {
83
99
  const other = row("u-2", "Ada Byron", "Engineer at Analytical Engines");
84
100
  const { result, calls, proposals } = await run("linkedin_find_profile", ARGS, [{ data: [other, ADA], next_cursor: null }]);