@synap-core/workspace-templates 0.46.0 → 0.48.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.
Files changed (54) hide show
  1. package/README.md +4 -3
  2. package/automations/lead-converted-becomes-client.automation.json +89 -0
  3. package/automations/lead-converted-becomes-client.catalog.json +13 -0
  4. package/capabilities/apify.capability.json +8 -1
  5. package/capabilities/apollo.capability.json +8 -1
  6. package/capabilities/cal-com.capability.json +8 -1
  7. package/capabilities/exa.capability.json +8 -1
  8. package/capabilities/fal-ai.capability.json +8 -1
  9. package/capabilities/fal-media-lab.capability.json +8 -1
  10. package/capabilities/fireflies.capability.json +8 -1
  11. package/capabilities/mailgun.capability.json +8 -1
  12. package/capabilities/omniroute.capability.json +7 -1
  13. package/capabilities/posthog-analytics.capability.json +7 -1
  14. package/capabilities/postiz.capability.json +7 -1
  15. package/capabilities/replicate-rvm.capability.json +21 -5
  16. package/capabilities/stripe.capability.json +10 -1
  17. package/capabilities/unipile-linkedin.capability.json +39 -3
  18. package/capabilities/vercel.capability.json +8 -1
  19. package/dist/{define-BAPO0xZf.d.ts → define-Dto5_E47.d.ts} +15 -3
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +623 -96
  22. package/dist/index.js.map +1 -1
  23. package/dist/wire.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/src/agency-os.yaml +1 -1
  26. package/src/brand-library.yaml +6 -6
  27. package/src/builder.yaml +17 -12
  28. package/src/content-os.template.test.ts +38 -22
  29. package/src/content-os.video-takes.template.test.ts +4 -2
  30. package/src/content-os.yaml +33 -23
  31. package/src/crm-absorbs-outreach.template.test.ts +5 -1
  32. package/src/crm.yaml +53 -30
  33. package/src/decisions-wave.template.test.ts +99 -5
  34. package/src/finance.yaml +11 -6
  35. package/src/foundation.yaml +22 -10
  36. package/src/grants.yaml +4 -0
  37. package/src/intent.test.ts +4 -2
  38. package/src/lead-automations.test.ts +93 -0
  39. package/src/lead-becomes-client.template.test.ts +137 -0
  40. package/src/lifecycle-declarations.test.ts +20 -1
  41. package/src/lifecycle-presets.test.ts +39 -7
  42. package/src/marketing.yaml +3 -3
  43. package/src/operations.yaml +155 -24
  44. package/src/postiz-contract.test.ts +3 -2
  45. package/src/process-contract.validate.test.ts +4 -1
  46. package/src/publish-official-lib.test.ts +8 -7
  47. package/src/research-base.yaml +2 -2
  48. package/src/research-decision.yaml +1 -1
  49. package/src/ship-a-change.template.test.ts +11 -2
  50. package/src/templates.ts +223 -74
  51. package/src/types.ts +15 -3
  52. package/src/unipile-lookups-read-only.test.ts +1 -0
  53. package/src/validate-flow.ts +15 -1
  54. package/src/validate.ts +40 -4
package/README.md CHANGED
@@ -270,8 +270,9 @@ proposal; the review is the catalog commit.
270
270
  | Field | Where | Rule |
271
271
  |---|---|---|
272
272
  | `subjectProfile.profileSlug` | playbook | The kind or role the process works. |
273
- | (no status field) | playbook | The process FOLLOWS the kind's declared lifecycle: every `subjectStatus` and worker `status` is an option of it. `statusProperty`, `onEnd` and `humanOnlyStatuses` are retired (One model decision 4, `playbook-field-retired`): a person-only option is `humanOnly` on the lifecycle, a status no stage owns is derived by the pod, and a session that ends early moves nothing. |
274
- | `stages[].subjectStatus` | stage | Entering the stage moves the subject to this option, through the door. Must be an **existing option** of the lifecycle — never invent one. |
273
+ | (no status field) | playbook | The process FOLLOWS the kind's declared lifecycle: every `subjectStatus`, `onApproved` and worker `status` is an option of it. `statusProperty`, `onEnd` and `humanOnlyStatuses` are retired (One model decision 4, `playbook-field-retired`): a person-only option is `humanOnly` on the lifecycle, a status no stage owns is derived by the pod, and a session that ends early moves nothing. |
274
+ | `stages[].subjectStatus` | stage | The IN-PROGRESS status (In Draft, Review): entering the stage moves the subject to this option, through the door. Must be an **existing option** of the lifecycle — never invent one. |
275
+ | `stages[].onApproved` | stage | The RESULT status (Scripted, sent, won): reached when the stage's work is APPROVED — its `expectedOutputs` all delivered, else the next stage's gate passing (decision D2). The subject holding it means the run stands at the NEXT stage. With neither (a last stage, or an ungated next stage, and no required output) the engine never writes it, never on a session's end: it stays declared so the follow and `flow.of` know what the stage reaches, and the stage's goal must name the move (the value or its label) for whoever finishes it, through the status door (`stage-on-approved-no-signal`). An agent's move into a done or lost option comes back proposed for the person. |
275
276
  | `stages[].gate` | stage | `{kind: human}` at every commitment: send to a client, sign, pay, publish, won/lost, anything irreversible. `{kind: check}` only where the stage's own criteria can be verified. A gated stage writes its status only when the gate passes. A check gate judges the stage being LEFT, so never use it to guard an irreversible status. |
276
277
  | `stages[].onFail` | stage | `{toStage: <key>}` — where a rejected gate sends the run (rework loop). |
277
278
  | `stages[].criteria` | stage | 2–5 binary statements; `check.kind` evidence (cheapest) · capability · judge · human. |
@@ -318,7 +319,7 @@ meta:
318
319
  - **Each produced profile declares a lifecycle** — a home counts things by lifecycle category, so a kind without
319
320
  one cannot be counted (`intent-no-lifecycle`, naming it). Declare the lifecycle first (see "Writing a process").
320
321
  - **Each produced profile is the template's own or one it depends on** (`require`/`compose` closure), e.g. CRM
321
- produces the `lead` and `client` roles whose lifecycles `foundation` declares (`intent-profile-unknown`).
322
+ produces the `lead` role and Operations the `client` role, whose lifecycles `foundation` declares (`intent-profile-unknown`).
322
323
  - **Only a template that owns a space declares it.** An overlay (`compose`) layers onto its base's space and a
323
324
  pack (`suite`) owns none, so neither carries an intent (`intent-no-workspace`); `base` carries none either
324
325
  (it is seeded into every space).
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "A lead signs: it becomes a client",
3
+ "description": "When a lead moves to converted (the client signed; a person's move, so an agent's move is a proposal the person approves first), the lead is stamped with the date it converted and the same person or company gets the client role, handed off to Operations. Operations' \"Onboard a client\" starts when the client role is attached. The converted lead role stays as the history of the sale. Attaching the client role again is a no-op, so the CRM app's own handoff and this rule never add a second client role.",
4
+ "triggerType": "event",
5
+ "status": "active",
6
+ "triggerConfig": {
7
+ "eventPattern": "entity.transition.completed",
8
+ "filters": { "lifecycleProfile": "lead", "to": "converted" }
9
+ },
10
+ "flowDefinition": {
11
+ "nodes": [
12
+ {
13
+ "id": "t",
14
+ "type": "trigger",
15
+ "position": { "x": 0, "y": 0 },
16
+ "data": {
17
+ "label": "A lead moved to converted",
18
+ "triggerType": "event",
19
+ "config": {
20
+ "eventPattern": "entity.transition.completed",
21
+ "filters": { "lifecycleProfile": "lead", "to": "converted" }
22
+ }
23
+ }
24
+ },
25
+ {
26
+ "id": "has-entity",
27
+ "type": "guard",
28
+ "position": { "x": 0, "y": 120 },
29
+ "data": {
30
+ "label": "The move names the person or company that signed",
31
+ "checks": [
32
+ {
33
+ "path": "trigger.payload.data.entityId",
34
+ "minLength": 36,
35
+ "message": "The lead's move names no person or company: there is no one to make a client."
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "id": "now",
42
+ "type": "compute",
43
+ "position": { "x": 0, "y": 240 },
44
+ "data": {
45
+ "label": "When the lead signed",
46
+ "operation": "now"
47
+ }
48
+ },
49
+ {
50
+ "id": "stamp-lead",
51
+ "type": "output",
52
+ "position": { "x": 0, "y": 360 },
53
+ "data": {
54
+ "label": "Stamp the lead with the date it converted",
55
+ "outputType": "facet_update",
56
+ "config": {
57
+ "entityId": "{{trigger.payload.data.entityId}}",
58
+ "facetSlug": "lead",
59
+ "properties": { "convertedAt": "{{steps.now.output.result}}" }
60
+ }
61
+ }
62
+ },
63
+ {
64
+ "id": "become-client",
65
+ "type": "output",
66
+ "position": { "x": 0, "y": 480 },
67
+ "data": {
68
+ "label": "Attach the client role, handed off to Operations",
69
+ "outputType": "facet_attach",
70
+ "config": {
71
+ "entityId": "{{trigger.payload.data.entityId}}",
72
+ "facetSlug": "client",
73
+ "properties": {
74
+ "becameClientAt": "{{steps.now.output.result}}",
75
+ "handoffStatus": "handed_off",
76
+ "handoffDestination": "Operations"
77
+ }
78
+ }
79
+ }
80
+ }
81
+ ],
82
+ "edges": [
83
+ { "id": "e1", "source": "t", "target": "has-entity" },
84
+ { "id": "e2", "source": "has-entity", "target": "now" },
85
+ { "id": "e3", "source": "now", "target": "stamp-lead" },
86
+ { "id": "e4", "source": "stamp-lead", "target": "become-client" }
87
+ ]
88
+ }
89
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "apiVersion": "synap/v1",
3
+ "kind": "automation",
4
+ "meta": {
5
+ "slug": "lead-converted-becomes-client",
6
+ "name": "A lead signs: it becomes a client",
7
+ "description": "When a person moves a lead to converted (signed), the lead is stamped with the date and the same person or company gets the client role, handed off to Operations, where \"Onboard a client\" starts. Needs the lead and client roles (foundation); attaching the role twice is a no-op.",
8
+ "tags": ["automation", "crm", "lead", "client", "operations"],
9
+ "isPublic": false,
10
+ "owner": "template-owner"
11
+ },
12
+ "dependencies": []
13
+ }
@@ -21,7 +21,14 @@
21
21
  "label": "Apify API token",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "The Apify API token (Console -> Settings -> Integrations -> Personal API tokens). Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "The Apify personal API token. Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://console.apify.com/settings/integrations",
27
+ "steps": [
28
+ "Open the Apify Console, then Settings, then Integrations",
29
+ "Under Personal API tokens, copy a token or create one"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -21,7 +21,14 @@
21
21
  "label": "Apollo API key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "The Apollo.io API key (Settings -> Integrations -> API). Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "The Apollo.io API key. Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://app.apollo.io/#/settings/integrations/api",
27
+ "steps": [
28
+ "In Apollo.io, open Settings, then Integrations, then API",
29
+ "Create an API key and copy it"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -21,7 +21,14 @@
21
21
  "label": "Cal.com API key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "The Cal.com API key (Settings -> Developer -> API Keys, a `cal_live_...` token). Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "The Cal.com API key (a `cal_live_...` token). Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://app.cal.com/settings/developer/api-keys",
27
+ "steps": [
28
+ "In Cal.com, open Settings, then Developer, then API Keys",
29
+ "Create a key and copy it (it starts with cal_live_)"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -21,7 +21,14 @@
21
21
  "label": "Exa API key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "The Exa API key (dashboard.exa.ai -> API Keys). Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "The Exa API key. Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://dashboard.exa.ai/api-keys",
27
+ "steps": [
28
+ "Open the Exa dashboard, then API Keys",
29
+ "Create a key and copy it"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -21,7 +21,14 @@
21
21
  "label": "fal.ai API key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "The fal.ai API key (https://fal.ai/dashboard/keys). Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "The fal.ai API key. Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://fal.ai/dashboard/keys",
27
+ "steps": [
28
+ "Open the fal.ai dashboard, then Keys",
29
+ "Add a key and copy it"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -21,7 +21,14 @@
21
21
  "label": "fal.ai API key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "A fal.ai API key from https://fal.ai/dashboard/keys. It is encrypted in this pod's vault and is never included in generated media records."
24
+ "description": "A fal.ai API key. It is encrypted in this pod's vault and is never included in generated media records.",
25
+ "obtain": {
26
+ "url": "https://fal.ai/dashboard/keys",
27
+ "steps": [
28
+ "Open the fal.ai dashboard, then Keys",
29
+ "Add a key and copy it"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -21,7 +21,14 @@
21
21
  "label": "Fireflies API key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "The Fireflies.ai API key (dashboard -> Settings -> Developer Settings -> API Key). Used as the Bearer token. Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "The Fireflies.ai API key. Used as the Bearer token. Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://app.fireflies.ai/settings",
27
+ "steps": [
28
+ "In Fireflies.ai, open Settings, then Developer Settings",
29
+ "Copy the API Key"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -21,7 +21,14 @@
21
21
  "label": "Mailgun HTTP webhook signing key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "The Mailgun account's HTTP webhook signing key (Sending -> Webhooks -> HTTP webhook signing key). Used to verify inbound webhook signatures; NOT an API key. Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "The Mailgun account's HTTP webhook signing key. Used to verify inbound webhook signatures; NOT an API key. Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://app.mailgun.com/",
27
+ "steps": [
28
+ "In Mailgun, open Sending, then Webhooks",
29
+ "Copy the HTTP webhook signing key"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -28,7 +28,13 @@
28
28
  "label": "Inference API key",
29
29
  "type": "text",
30
30
  "required": true,
31
- "description": "An inference key (sk-…) from OmniRoute's dashboard → API Keys. Stored server-encrypted as a pod-wide shared key; used only as the MCP transport's Authorization header, never shown to agents. A plain inference key gets 403 on OmniRoute's management routes, so do not expect the write tools below to work unless the key carries manage/admin scope."
31
+ "description": "An OmniRoute inference key (sk-…). Stored server-encrypted as a pod-wide shared key; used only as the MCP transport's Authorization header, never shown to agents. A plain inference key gets 403 on OmniRoute's management routes, so do not expect the write tools below to work unless the key carries manage/admin scope.",
32
+ "obtain": {
33
+ "steps": [
34
+ "Open your OmniRoute dashboard, then API Keys",
35
+ "Create an inference key and copy it (it starts with sk-)"
36
+ ]
37
+ }
32
38
  }
33
39
  ],
34
40
  "vault": [
@@ -21,7 +21,13 @@
21
21
  "label": "PostHog Personal API Key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "A PostHog PERSONAL API KEY (PostHog → Settings → Personal API keys) with query:read, insight:read, event:read and person:read. Stored server-encrypted in the vault; never persisted in this template. The `phc_…` project token used by the client apps is INGEST-ONLY and is rejected by every read."
24
+ "description": "A PostHog PERSONAL API KEY with query:read, insight:read, event:read and person:read. Stored server-encrypted in the vault; never persisted in this template. The `phc_…` project token used by the client apps is INGEST-ONLY and is rejected by every read.",
25
+ "obtain": {
26
+ "steps": [
27
+ "In PostHog, open Settings, then Personal API keys",
28
+ "Create a key with query:read, insight:read, event:read and person:read, then copy it"
29
+ ]
30
+ }
25
31
  },
26
32
  {
27
33
  "name": "analyticsHost",
@@ -22,7 +22,13 @@
22
22
  "label": "Postiz API key",
23
23
  "type": "text",
24
24
  "required": true,
25
- "description": "API key from the user's Postiz (Settings → API Keys). Sent as the Authorization header value. Stored server-encrypted in the vault; never persisted in the template."
25
+ "description": "The API key of the user's Postiz. Sent as the Authorization header value. Stored server-encrypted in the vault; never persisted in the template.",
26
+ "obtain": {
27
+ "steps": [
28
+ "In Postiz, open Settings, then API Keys",
29
+ "Copy the API key"
30
+ ]
31
+ }
26
32
  },
27
33
  {
28
34
  "name": "postizBaseUrl",
@@ -5,7 +5,9 @@
5
5
  "slug": "replicate-rvm",
6
6
  "name": "Replicate — Video Background Removal",
7
7
  "description": "Cut the person out of a recorded video with Robust Video Matting on Replicate: returns the matte and the person's own colours as videos, for putting a new background behind them. Each run bills your Replicate account. Replicate deletes the results after about an hour, so download them. Needs a Replicate API token.",
8
- "tags": ["capability"],
8
+ "tags": [
9
+ "capability"
10
+ ],
9
11
  "isPublic": true,
10
12
  "syncByDefault": true
11
13
  },
@@ -19,7 +21,14 @@
19
21
  "label": "Replicate API token",
20
22
  "type": "text",
21
23
  "required": true,
22
- "description": "The Replicate API token (https://replicate.com/account/api-tokens). Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "The Replicate API token. Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://replicate.com/account/api-tokens",
27
+ "steps": [
28
+ "Open your Replicate account, then API tokens",
29
+ "Create a token and copy it"
30
+ ]
31
+ }
23
32
  }
24
33
  ],
25
34
  "vault": [
@@ -55,7 +64,9 @@
55
64
  "kind": "code",
56
65
  "scope": "pod",
57
66
  "description": "Cuts the person out of a video with Robust Video Matting on Replicate (bills the Replicate account). Args: { video?: string (https URL of the video, no credentials) OR videoFile?: a pod file entity id (the pod signs it at run time; pass exactly one), outputs?: string[] (any of 'alpha', 'foreground', 'green-screen'; default ['alpha', 'foreground']) }. Only these args reach Replicate. Returns { status: 'succeeded' | 'processing', alphaUrl?, foregroundUrl?, greenScreenUrl?, predictions: [{ output, id, status, url, error }], predictionIds, next }. status 'processing' means a prediction was still running after about a minute: run next (replicate_rvm_result with the same predictionIds) every 30-60 s; never run this verb again for the same video. A failed prediction fails the run with its error. Replicate deletes the videos about an hour after they finish: download them at once.",
58
- "requires": ["replicate_api"],
67
+ "requires": [
68
+ "replicate_api"
69
+ ],
59
70
  "executionMode": "async",
60
71
  "timeoutSeconds": 150,
61
72
  "metadata": {
@@ -79,7 +90,9 @@
79
90
  "kind": "code",
80
91
  "scope": "pod",
81
92
  "description": "Reads Robust Video Matting predictions that replicate_rvm_matte started (read-only: nothing is started or billed). Args: { predictionIds: string[] (1-3 ids from replicate_rvm_matte) }. Returns the same shape: { status: 'succeeded' | 'processing', alphaUrl?, foregroundUrl?, greenScreenUrl?, predictions, predictionIds, next }. A failed prediction fails the run with its error; an id that is not an RVM prediction is refused.",
82
- "requires": ["replicate_api"],
93
+ "requires": [
94
+ "replicate_api"
95
+ ],
83
96
  "executionMode": "sync",
84
97
  "timeoutSeconds": 30,
85
98
  "metadata": {
@@ -91,7 +104,10 @@
91
104
  "code": "// Read Robust Video Matting predictions started by replicate_rvm_matte (a\n// read: GET only, nothing is billed or started). Executor wraps this body as\n// (async (args, context) => { <code> }). callProvider resolves the\n// replicate_api tool by NAME and injects the vaulted token.\n//\n// Run it while replicate_rvm_matte's result says status 'processing', with the\n// predictionIds it returned (its `next`), every 30-60 s. Only predictions of\n// the pinned RVM version are read: another id on the same token is refused.\nconst VERSION = '73d2128a371922d5d1abf0712a1d974be0e4e2358cc1218e4e34714767232bac';\nconst OUTPUTS = { 'alpha-mask': 'alpha', 'foreground-mask': 'foreground', 'green-screen': 'green-screen' };\nconst URL_KEYS = { alpha: 'alphaUrl', foreground: 'foregroundUrl', 'green-screen': 'greenScreenUrl' };\nif (args && args.prediction_ids !== undefined) throw new Error('replicate_rvm_result: pass predictionIds, not prediction_ids');\nif (!Array.isArray(args?.predictionIds) || args.predictionIds.length === 0) {\n throw new Error('replicate_rvm_result: predictionIds is required (the ids replicate_rvm_matte returned)');\n}\nconst ids = [];\nfor (const raw of args.predictionIds) {\n const id = String(raw ?? '').trim();\n if (!/^[a-z0-9]{8,64}$/.test(id)) throw new Error('replicate_rvm_result: ' + id.slice(0, 40) + ' is not a Replicate prediction id');\n if (!ids.includes(id)) ids.push(id);\n}\nif (ids.length > 3) throw new Error('replicate_rvm_result: predictionIds takes at most 3 ids');\n\nconst FAILED = ['failed', 'canceled', 'aborted'];\nconst predictions = [];\nfor (const id of ids) {\n const res = await callProvider('replicate_api', 'GET', '/predictions/' + id);\n const p = res?.body ?? {};\n if (!(typeof res?.status === 'number' && res.status >= 200 && res.status < 300) || p.id !== id) {\n throw new Error('replicate_rvm_result: could not read prediction ' + id + ' (status ' + (res?.status ?? 'unknown') + ')');\n }\n if (p.version !== VERSION) throw new Error('replicate_rvm_result: prediction ' + id + ' is not a Robust Video Matting prediction');\n const output = OUTPUTS[p?.input?.output_type ?? 'green-screen'] ?? null;\n const status = String(p.status ?? '');\n const out = Array.isArray(p.output) ? p.output[0] : p.output;\n if (status === 'succeeded' && typeof out === 'string' && /^https:\\/\\//i.test(out)) predictions.push({ output, id, status: 'succeeded', url: out, error: null });\n else if (status === 'succeeded') predictions.push({ output, id, status: 'failed', url: null, error: 'the prediction succeeded with no video URL' });\n else if (FAILED.includes(status)) predictions.push({ output, id, status: 'failed', url: null, error: String(p.error ?? status).slice(0, 300) });\n else predictions.push({ output, id, status: 'processing', url: null, error: null });\n}\n\nconst failed = predictions.filter((p) => p.status === 'failed');\nif (failed.length) {\n throw new Error('replicate_rvm_result: ' + failed.map((p) => p.output + ' prediction ' + p.id + ' failed: ' + p.error).join('; '));\n}\nconst status = predictions.some((p) => p.status === 'processing') ? 'processing' : 'succeeded';\nconst urls = {};\nfor (const p of predictions) if (p.url && p.output) urls[URL_KEYS[p.output]] = p.url;\nreturn {\n success: true,\n status,\n ...urls,\n predictions,\n predictionIds: ids,\n next: status === 'processing' ? { verbId: 'replicate_rvm_result', parameters: { predictionIds: ids } } : null,\n note: 'Replicate deletes prediction outputs about an hour after they finish: download the videos now.',\n};"
92
105
  }
93
106
  ],
94
- "provides": ["edit_video", "fetch_record"]
107
+ "provides": [
108
+ "edit_video",
109
+ "fetch_record"
110
+ ]
95
111
  },
96
112
  "dependencies": []
97
113
  }
@@ -21,7 +21,16 @@
21
21
  "label": "Stripe restricted API key",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "A Stripe RESTRICTED API key (Developers -> API keys -> Create restricted key; starts with rk_live_ or rk_test_), never a full sk_live secret key. Grant Read on what the pod may see, and Write only on what it may change (Customers, Products, Prices, Payment Links, Checkout Sessions, Invoices, Subscriptions, Refunds, Payouts, Balance, Tax Settings, Tax Registrations). A read-only key keeps every write verb failing at Stripe. Stored server-encrypted in the vault; never persisted in the template."
24
+ "description": "A Stripe RESTRICTED API key (starts with rk_live_ or rk_test_), never a full sk_live secret key. Grant Read on what the pod may see, and Write only on what it may change (Customers, Products, Prices, Payment Links, Checkout Sessions, Invoices, Subscriptions, Refunds, Payouts, Balance, Tax Settings, Tax Registrations). A read-only key keeps every write verb failing at Stripe. Stored server-encrypted in the vault; never persisted in the template.",
25
+ "obtain": {
26
+ "url": "https://dashboard.stripe.com/apikeys",
27
+ "steps": [
28
+ "In the Stripe Dashboard, open Developers, then API keys",
29
+ "Choose Create restricted key",
30
+ "Grant Read on what the pod may see, Write only on what it may change",
31
+ "Create the key and copy it (it starts with rk_)"
32
+ ]
33
+ }
25
34
  }
26
35
  ],
27
36
  "vault": [
@@ -341,7 +341,7 @@
341
341
  "intent": "enrich_entity",
342
342
  "kind": "code",
343
343
  "scope": "pod",
344
- "description": "Fetches one full LinkedIn profile by user id or public identifier, sections expanded. Pure read -> runs instantly. The enrichment primitive. Args: { identifier: string, accountId: string (from unipile_list_accounts) }.",
344
+ "description": "Fetches one LinkedIn profile by user id or public identifier. Pure read -> runs instantly. The enrichment primitive. By default each section comes as a short preview (the first entries, as LinkedIn shows them), which keeps the reply small; name the sections you need in `sections` to get them in full. Args: { identifier: string, accountId: string (from unipile_list_accounts), sections?: string }. `sections` is comma-separated Unipile v2 section names: linkedin_experience, linkedin_education, linkedin_languages, linkedin_skills, linkedin_certifications, linkedin_volunteer_experience, linkedin_projects, linkedin_recommendations, linkedin_recruiting_activity, linkedin_interests (each also with a _preview suffix), or linkedin_* for every section in full (large: tens of thousands of characters).",
345
345
  "requires": [
346
346
  "unipile_linkedin"
347
347
  ],
@@ -352,9 +352,10 @@
352
352
  },
353
353
  "parameters": {
354
354
  "identifier": "string",
355
- "accountId": "string"
355
+ "accountId": "string",
356
+ "sections": "string?"
356
357
  },
357
- "code": "// Fetch a single LinkedIn profile. Pure read (GET, no propose.entity) -> the\n// catalog classifies it `read` -> governance `auto`, so enrichment runs inline.\n// v2: account_id is a path segment; sections use with_sections (was\n// linkedin_sections) with a linkedin_ prefix; variant selects the product API.\nconst accountId = String(args?.accountId ?? '').trim();\nconst identifier = String(args?.identifier ?? '').trim();\nif (!accountId) throw new Error('linkedin_get_profile: accountId is required — call unipile_list_accounts first to find yours.');\nif (!identifier) throw new Error('linkedin_get_profile: identifier (a LinkedIn provider_id or public identifier) is required');\n\nconst qs = new URLSearchParams({ variant: 'linkedin_classic' });\nqs.append('with_sections', 'linkedin_*');\nconst res = await callProvider('unipile_linkedin', 'GET', `/${encodeURIComponent(accountId)}/users/${encodeURIComponent(identifier)}?${qs.toString()}`);\n// Return the RAW v2 UserProfile. Note v2 renames: headline->description,\n// summary->bio, provider_id->id, and LinkedIn extras live under specifics.linkedin.\nreturn res?.body ?? res;\n"
358
+ "code": "// Fetch a single LinkedIn profile. Pure read (GET, no propose.entity) -> the\n// catalog classifies it `read` -> governance `auto`, so enrichment runs inline.\n// v2: account_id is a path segment; sections use with_sections (was\n// linkedin_sections) with a linkedin_ prefix, repeated once per section; variant selects the product API.\nconst accountId = String(args?.accountId ?? '').trim();\nconst identifier = String(args?.identifier ?? '').trim();\nif (!accountId) throw new Error('linkedin_get_profile: accountId is required — call unipile_list_accounts first to find yours.');\nif (!identifier) throw new Error('linkedin_get_profile: identifier (a LinkedIn provider_id or public identifier) is required');\n\n// Sections: a compact default (every section as a preview, the first entries).\n// `sections` names the ones to read, comma-separated; `linkedin_*` asks for all\n// of them in full (~58k chars). Names are Unipile v2's with_sections enum.\nconst NAMES = ['experience', 'education', 'languages', 'skills', 'certifications', 'volunteer_experience', 'projects', 'recommendations', 'recruiting_activity', 'interests'];\nconst VALID = new Set(['linkedin_*', 'linkedin_*_preview', ...NAMES.flatMap((n) => [`linkedin_${n}`, `linkedin_${n}_preview`])]);\nconst wanted = String(args?.sections ?? '').split(',').map((s) => s.trim()).filter(Boolean);\nconst bad = wanted.filter((s) => !VALID.has(s));\nif (bad.length) throw new Error(`linkedin_get_profile: unknown sections ${bad.join(', ')} — valid: linkedin_*, linkedin_*_preview, and linkedin_<${NAMES.join('|')}> with an optional _preview suffix.`);\nconst qs = new URLSearchParams({ variant: 'linkedin_classic' });\nfor (const s of wanted.length ? wanted : ['linkedin_*_preview']) qs.append('with_sections', s);\nconst res = await callProvider('unipile_linkedin', 'GET', `/${encodeURIComponent(accountId)}/users/${encodeURIComponent(identifier)}?${qs.toString()}`);\n// Return the RAW v2 UserProfile. Note v2 renames: headline->description,\n// summary->bio, provider_id->id, and LinkedIn extras live under specifics.linkedin.\nreturn res?.body ?? res;\n"
358
359
  },
359
360
  {
360
361
  "name": "linkedin_send_first_message",
@@ -444,6 +445,41 @@
444
445
  }
445
446
  }
446
447
  },
448
+ {
449
+ "name": "linkedin_list_posts",
450
+ "intent": "list_records",
451
+ "kind": "declarative",
452
+ "scope": "pod",
453
+ "description": "Lists the posts a LinkedIn user or company published or shared, newest first, cursor-paginated. Pass identifier \"me\" for the connected account's own posts, or a LinkedIn user id / public identifier for someone else's. Read-only. Args: { accountId: string (from unipile_list_accounts), identifier: string, cursor?: string }. v2: GET /{account_id}/users/{user_id}/posts (pagination is by cursor only).",
454
+ "requires": [
455
+ "unipile_linkedin"
456
+ ],
457
+ "executionMode": "sync",
458
+ "timeoutSeconds": 30,
459
+ "metadata": {
460
+ "readOnly": true
461
+ },
462
+ "parameters": {
463
+ "accountId": "string",
464
+ "identifier": "string",
465
+ "cursor": "string?"
466
+ },
467
+ "providerSpec": {
468
+ "tool": "unipile_linkedin",
469
+ "method": "GET",
470
+ "pathTemplate": "/{{accountId}}/users/{{identifier}}/posts",
471
+ "responseShape": {
472
+ "collectionPath": "data",
473
+ "collectionAs": "posts",
474
+ "scalar": {
475
+ "cursor": "payload.next_cursor"
476
+ }
477
+ },
478
+ "query": {
479
+ "cursor": "{{cursor}}"
480
+ }
481
+ }
482
+ },
447
483
  {
448
484
  "name": "linkedin_list_company_pages",
449
485
  "intent": "list_records",
@@ -21,7 +21,14 @@
21
21
  "label": "Vercel Personal Access Token",
22
22
  "type": "text",
23
23
  "required": true,
24
- "description": "A Vercel Personal Access Token created at https://vercel.com/account/tokens (Account Settings → Tokens). It is stored in the vault as an API key and sent as `Authorization: Bearer <token>`. Scope it to the Team that owns the projects you want reachable."
24
+ "description": "A Vercel Personal Access Token. It is stored in the vault as an API key and sent as `Authorization: Bearer <token>`. Scope it to the Team that owns the projects you want reachable.",
25
+ "obtain": {
26
+ "url": "https://vercel.com/account/tokens",
27
+ "steps": [
28
+ "In Vercel, open Account Settings, then Tokens",
29
+ "Create a token scoped to the Team that owns your projects, then copy it"
30
+ ]
31
+ }
25
32
  }
26
33
  ],
27
34
  "vault": [
@@ -592,11 +592,23 @@ interface TemplatePlaybookStage {
592
592
  proposalType?: "playbook.stage_gate";
593
593
  };
594
594
  /**
595
- * The value of the subject kind's lifecycle property this stage
596
- * corresponds to. Advancing INTO the stage writes it to the subject
597
- * (governed); the subject ENTERING it advances an open run to the stage.
595
+ * The IN-PROGRESS value of the subject kind's lifecycle property while this
596
+ * stage is worked (In Draft, Review). Entering the stage writes it to the
597
+ * subject (governed; a gated stage at its gate's pass); the subject
598
+ * ENTERING it advances an open run to the stage.
598
599
  */
599
600
  subjectStatus?: string;
601
+ /**
602
+ * The RESULT value this stage's APPROVED work reaches (Scripted, sent, won;
603
+ * decision D2): written when the stage's `expectedOutputs` are all
604
+ * delivered, else when the next stage's gate passes. With neither (a last
605
+ * stage, an ungated next stage, no required output) the pod never writes
606
+ * it, never on a session's end: it stays declared for the follow and
607
+ * `flow.of`, and the stage's goal names the move for whoever finishes it
608
+ * (validate.ts `stage-on-approved-no-signal`). The subject ENTERING it
609
+ * advances an open run to the NEXT stage. Pod `PlaybookStage.onApproved`.
610
+ */
611
+ onApproved?: string;
600
612
  /** Where a rejected human gate / failed check sends the run back (a stage key or name). */
601
613
  onFail?: {
602
614
  toStage: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { W as WorkspaceYaml, T as TemplateDependency, a as TemplateLifecycleOption, b as TemplateLifecycleOptionWaits } from './define-BAPO0xZf.js';
2
- export { B as BentoViewBlockWire, c as BentoWidgetBlockWire, d as BuiltSpacePackage, e as BuiltSpacePackageCell, I as INTENT_LABEL_MAX, P as PACKAGE_DEPENDENCY_KINDS, f as PackageAutomationWire, g as PackageDefinitionOutput, h as PackageDependencyKind, S as START_EXAMPLE_RANGE, i as START_STARTERS_RANGE, j as START_VIEWS_MAX, k as SpacePackageCellWire, l as SplitBentoBlocks, m as TemplateActionPlacement, n as TemplateAppKind, o as TemplateAppRef, p as TemplateAutomation, q as TemplateBentoBlock, r as TemplateDefaultSource, s as TemplateDisplayTemplate, t as TemplateEntityLink, u as TemplateExtendsRef, v as TemplateIntegration, w as TemplateIntent, x as TemplateLayoutConfig, y as TemplateMeta, z as TemplateOnboarding, A as TemplateOnboardingCollectTarget, C as TemplatePlaybook, D as TemplatePlaybookParam, E as TemplatePrimarySurface, F as TemplateProfile, G as TemplateProfileEntityBentoTemplates, H as TemplateProperty, J as TemplateSeedEntity, K as TemplateSidebarItem, L as TemplateSidebarSurface, M as TemplateSourceRole, N as TemplateSpacePackage, O as TemplateSpacePackageCell, Q as TemplateStart, R as TemplateSuggestedRelation, U as TemplateView, V as ToDefinitionResult, X as WorkspaceDefinitionInput, Y as WorkspaceJsonValue, Z as WorkspacePrimarySurface, _ as WorkspacePrimarySurfaceViewReference, $ as normalizeTemplateLayout, a0 as spacePackageCells, a1 as splitBentoBlocks, a2 as toAutomationWire, a3 as toPackageDefinition, a4 as toWorkspaceDefinition } from './define-BAPO0xZf.js';
1
+ import { W as WorkspaceYaml, T as TemplateDependency, a as TemplateLifecycleOption, b as TemplateLifecycleOptionWaits } from './define-Dto5_E47.js';
2
+ export { B as BentoViewBlockWire, c as BentoWidgetBlockWire, d as BuiltSpacePackage, e as BuiltSpacePackageCell, I as INTENT_LABEL_MAX, P as PACKAGE_DEPENDENCY_KINDS, f as PackageAutomationWire, g as PackageDefinitionOutput, h as PackageDependencyKind, S as START_EXAMPLE_RANGE, i as START_STARTERS_RANGE, j as START_VIEWS_MAX, k as SpacePackageCellWire, l as SplitBentoBlocks, m as TemplateActionPlacement, n as TemplateAppKind, o as TemplateAppRef, p as TemplateAutomation, q as TemplateBentoBlock, r as TemplateDefaultSource, s as TemplateDisplayTemplate, t as TemplateEntityLink, u as TemplateExtendsRef, v as TemplateIntegration, w as TemplateIntent, x as TemplateLayoutConfig, y as TemplateMeta, z as TemplateOnboarding, A as TemplateOnboardingCollectTarget, C as TemplatePlaybook, D as TemplatePlaybookParam, E as TemplatePrimarySurface, F as TemplateProfile, G as TemplateProfileEntityBentoTemplates, H as TemplateProperty, J as TemplateSeedEntity, K as TemplateSidebarItem, L as TemplateSidebarSurface, M as TemplateSourceRole, N as TemplateSpacePackage, O as TemplateSpacePackageCell, Q as TemplateStart, R as TemplateSuggestedRelation, U as TemplateView, V as ToDefinitionResult, X as WorkspaceDefinitionInput, Y as WorkspaceJsonValue, Z as WorkspacePrimarySurface, _ as WorkspacePrimarySurfaceViewReference, $ as normalizeTemplateLayout, a0 as spacePackageCells, a1 as splitBentoBlocks, a2 as toAutomationWire, a3 as toPackageDefinition, a4 as toWorkspaceDefinition } from './define-Dto5_E47.js';
3
3
  import '@synap-core/types/presentation';
4
4
  import '@synap-core/types/space-brief';
5
5
  import '@synap-core/types/capability-intents';