@synap-core/cli 1.10.0 → 1.11.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 (120) hide show
  1. package/dist/commands/capability.js +79 -8
  2. package/dist/commands/capability.js.map +1 -1
  3. package/dist/commands/centrality.js +2 -1
  4. package/dist/commands/centrality.js.map +1 -1
  5. package/dist/commands/context.js +2 -1
  6. package/dist/commands/context.js.map +1 -1
  7. package/dist/commands/data-extra.js +7 -4
  8. package/dist/commands/data-extra.js.map +1 -1
  9. package/dist/commands/data.js +14 -4
  10. package/dist/commands/data.js.map +1 -1
  11. package/dist/commands/diagnose.js +44 -1
  12. package/dist/commands/diagnose.js.map +1 -1
  13. package/dist/commands/digest.js +2 -1
  14. package/dist/commands/digest.js.map +1 -1
  15. package/dist/commands/doc.d.ts +14 -0
  16. package/dist/commands/doc.js +61 -4
  17. package/dist/commands/doc.js.map +1 -1
  18. package/dist/commands/doctor.d.ts +21 -0
  19. package/dist/commands/doctor.js +189 -0
  20. package/dist/commands/doctor.js.map +1 -0
  21. package/dist/commands/events.js +3 -1
  22. package/dist/commands/events.js.map +1 -1
  23. package/dist/commands/graph.js +5 -3
  24. package/dist/commands/graph.js.map +1 -1
  25. package/dist/commands/import.js +40 -9
  26. package/dist/commands/import.js.map +1 -1
  27. package/dist/commands/knowledge.d.ts +6 -0
  28. package/dist/commands/knowledge.js +253 -30
  29. package/dist/commands/knowledge.js.map +1 -1
  30. package/dist/commands/launch.js +2 -2
  31. package/dist/commands/launch.js.map +1 -1
  32. package/dist/commands/lens.js +1 -1
  33. package/dist/commands/lens.js.map +1 -1
  34. package/dist/commands/market-authoring.d.ts +45 -0
  35. package/dist/commands/market-authoring.js +225 -0
  36. package/dist/commands/market-authoring.js.map +1 -0
  37. package/dist/commands/market.d.ts +22 -7
  38. package/dist/commands/market.js +335 -60
  39. package/dist/commands/market.js.map +1 -1
  40. package/dist/commands/mcp.d.ts +24 -2
  41. package/dist/commands/mcp.js +84 -3
  42. package/dist/commands/mcp.js.map +1 -1
  43. package/dist/commands/pod.js +1 -1
  44. package/dist/commands/pod.js.map +1 -1
  45. package/dist/commands/pods.d.ts +14 -0
  46. package/dist/commands/pods.js +156 -2
  47. package/dist/commands/pods.js.map +1 -1
  48. package/dist/commands/proposals-actions.js +3 -0
  49. package/dist/commands/proposals-actions.js.map +1 -1
  50. package/dist/commands/sessions.js +2 -1
  51. package/dist/commands/sessions.js.map +1 -1
  52. package/dist/commands/skills.js +3 -1
  53. package/dist/commands/skills.js.map +1 -1
  54. package/dist/commands/template.d.ts +42 -0
  55. package/dist/commands/template.js +191 -0
  56. package/dist/commands/template.js.map +1 -0
  57. package/dist/commands/upload.d.ts +30 -0
  58. package/dist/commands/upload.js +155 -0
  59. package/dist/commands/upload.js.map +1 -0
  60. package/dist/index.js +118 -0
  61. package/dist/index.js.map +1 -1
  62. package/dist/lib/capture-lane.js +5 -3
  63. package/dist/lib/capture-lane.js.map +1 -1
  64. package/dist/lib/capture-structure.d.ts +123 -0
  65. package/dist/lib/capture-structure.js +57 -0
  66. package/dist/lib/capture-structure.js.map +1 -0
  67. package/dist/lib/cp-packages.d.ts +56 -0
  68. package/dist/lib/cp-packages.js +171 -0
  69. package/dist/lib/cp-packages.js.map +1 -1
  70. package/dist/lib/hub-client.d.ts +14 -1
  71. package/dist/lib/hub-client.js +110 -19
  72. package/dist/lib/hub-client.js.map +1 -1
  73. package/dist/lib/id.d.ts +23 -0
  74. package/dist/lib/id.js +35 -0
  75. package/dist/lib/id.js.map +1 -0
  76. package/dist/lib/pod.d.ts +53 -3
  77. package/dist/lib/pod.js +81 -9
  78. package/dist/lib/pod.js.map +1 -1
  79. package/dist/lib/template-file.d.ts +74 -0
  80. package/dist/lib/template-file.js +140 -0
  81. package/dist/lib/template-file.js.map +1 -0
  82. package/node_modules/@synap/hub-rest-client/dist/index.cjs +1261 -0
  83. package/node_modules/@synap/hub-rest-client/dist/index.d.cts +1647 -0
  84. package/node_modules/@synap/hub-rest-client/dist/index.d.ts +1647 -0
  85. package/node_modules/@synap/hub-rest-client/dist/index.js +1231 -0
  86. package/node_modules/@synap/hub-rest-client/package.json +45 -0
  87. package/node_modules/@synap/hub-rest-client/src/client.ts +1631 -0
  88. package/node_modules/@synap/hub-rest-client/src/errors.ts +30 -0
  89. package/node_modules/@synap/hub-rest-client/src/index.ts +153 -0
  90. package/node_modules/@synap/hub-rest-client/src/setup.ts +133 -0
  91. package/node_modules/@synap/hub-rest-client/src/types.ts +1299 -0
  92. package/package.json +3 -2
  93. package/skills/agent-os/SKILL.md +6 -0
  94. package/skills/manifest.json +1 -1
  95. package/skills/onboard/SKILL.md +7 -0
  96. package/skills/synap/SKILL.md +110 -29
  97. package/skills/synap/capture.md +50 -152
  98. package/skills/synap/common-mistakes.md +1 -0
  99. package/skills/synap/content-os.md +83 -0
  100. package/skills/synap/digesting-a-channel.md +25 -0
  101. package/skills/synap/mental-model.md +7 -7
  102. package/skills/synap/multi-entity-capture.md +6 -4
  103. package/skills/synap/worked-examples.md +21 -0
  104. package/skills/synap/writes.md +75 -18
  105. package/skills/synap-app/SKILL.md +319 -0
  106. package/skills/synap-app/_order.txt +5 -0
  107. package/skills/synap-app/_skill.yaml +20 -0
  108. package/skills/synap-app/creating-the-base-app.md +64 -0
  109. package/skills/synap-app/governance.md +42 -0
  110. package/skills/synap-app/install-commands.md +55 -0
  111. package/skills/synap-app/overview.md +50 -0
  112. package/skills/synap-app/using-the-sdk.md +73 -0
  113. package/skills/synap-market/SKILL.md +335 -0
  114. package/skills/synap-market/_order.txt +5 -0
  115. package/skills/synap-market/_skill.yaml +24 -0
  116. package/skills/synap-market/author-and-publish.md +75 -0
  117. package/skills/synap-market/discover-and-fetch.md +59 -0
  118. package/skills/synap-market/governance-and-catalog.md +56 -0
  119. package/skills/synap-market/install.md +55 -0
  120. package/skills/synap-market/overview.md +51 -0
@@ -0,0 +1,59 @@
1
+ # Discover & fetch
2
+
3
+ Three doors reach the same catalog. Pick the one that matches where you're
4
+ running.
5
+
6
+ ## CLI — `synap market`
7
+
8
+ ```bash
9
+ synap market # browse/list (the default action)
10
+ synap market --search "crm" # filter by name/description/slug
11
+ synap market --type capability # filter by type: workspace|capability|skill|workflow|view|cell
12
+ synap market --search "crm" --type workspace --json
13
+ ```
14
+
15
+ `market` with no subcommand lists; `--list` is accepted explicitly too. It
16
+ merges: your OWN packages (public + private, via `GET /api/packages/mine`)
17
+ with the PUBLIC catalog (`GET /api/packages`) — logged out, you only see the
18
+ public/bundled set.
19
+
20
+ Companion commands:
21
+
22
+ ```bash
23
+ synap market installed # what's already installed on THIS pod (pure read)
24
+ synap market installed --tree # composition graph: package → templates → workspaces
25
+ synap market update # check installed packages for drift against the catalog
26
+ ```
27
+
28
+ ## Pod verb — `market.search` (MCP / agent / automation)
29
+
30
+ The pod-native verb, run via MCP `run_capability` or
31
+ `POST /api/hub/capabilities/execute` with `{ verbId: "market.search", parameters }`:
32
+
33
+ ```json
34
+ { "query": "crm", "kind": "template", "limit": 20 }
35
+ ```
36
+
37
+ - `kind` ∈ `capability | automation | template | cell` (omit to search all).
38
+ - Reads the pod-local `cp_catalog_cache` — fast, no live CP round-trip.
39
+ - Returns `{ entries: [{ slug, kind, name, description, version, tier, installed }], count }`.
40
+ - `installed` is `true`/`false` for capability/cell (cheap natural-key check);
41
+ `undefined` for automation/template — that's an HONEST unknown, not a bug,
42
+ never read it as "not installed."
43
+ - Empty result → say so plainly ("nothing matched") — never fabricate a
44
+ package that doesn't exist. Offer to capture the gap as a note for later.
45
+
46
+ This is the verb an agent should reach for first — it's read-only (auto-runs,
47
+ no approval needed) and mirrors exactly what `synap market --search` shows a
48
+ human.
49
+
50
+ ## Fetching one package's full definition
51
+
52
+ - **CLI (authoring path):** `synap market publish --from-workspace <id>` reads
53
+ a LIVE workspace via the pod's own `to-template` serializer — see
54
+ `author-and-publish.md`.
55
+ - **CP directly:** `GET /api/packages/:slug` returns the full row **with**
56
+ `definition` — the install payload. Auth is required to see a private
57
+ package (author-only). No auth → public only, and a private slug 404s.
58
+ - **From an install:** you don't normally need the definition yourself —
59
+ `market.install` (see `install.md`) resolves and applies it for you.
@@ -0,0 +1,56 @@
1
+ # Governance & the one-catalog principle
2
+
3
+ ## Writes are governed — "proposed" is success
4
+
5
+ Every mutating marketplace action an AGENT takes (`market.install` above all)
6
+ can come back `{ status: "proposed", proposalId, reviewUrl }` instead of
7
+ `{ status: "installed" }`. That is the write queued for the pod owner's
8
+ review — like opening a PR, not a failure and not an error to retry. Always:
9
+
10
+ - Surface `reviewUrl` to the user.
11
+ - Don't retry the same install hoping for "installed" — it won't change the
12
+ outcome and may create a duplicate proposal.
13
+ - Remember an unreviewed proposal isn't live yet: `market.search`'s
14
+ `installed` flag and any downstream read won't reflect it until approved.
15
+
16
+ An OPERATOR-driven install (the pod owner themself, via CLI with their own
17
+ credentials, no agent identity) executes directly — no proposal. The
18
+ distinction is WHO is acting, not which door they used.
19
+
20
+ ## One catalog — never fork it
21
+
22
+ - The catalog is `synapPackages` in the Control Plane, reached through
23
+ `GET/POST/PATCH /api/packages*`. `cp_catalog_cache` on the pod is a
24
+ **read-through cache** of it (populated by sync), not a second source of
25
+ truth — never write to it directly, and never treat a cache miss as "the
26
+ package doesn't exist" without falling back to a live CP fetch (which
27
+ `market.install` already does for automation/template kinds).
28
+ - Discovery happens on the CP (`market.search`, `synap market`); apply
29
+ happens on the pod (`market.install`, workspace creation). Don't invent a
30
+ parallel "known templates" list anywhere else in a workflow you're
31
+ building — always search the real catalog.
32
+ - Publishing to anywhere other than `POST /api/packages` (e.g. hand-writing a
33
+ file and calling it "published," or registering a template only in a local
34
+ config) is NOT publishing — it produces something invisible to
35
+ `market.search` and every other consumer.
36
+
37
+ ## Visibility model
38
+
39
+ - **Public** (`isPublic: true`) — visible to everyone via `GET /api/packages`.
40
+ - **Private** (`isPublic: false`, the default) — visible only to its
41
+ `authorId` (and, for non-workspace categories, active members of an
42
+ `podId`-owned team). A private **workspace template** is stricter:
43
+ owner-only, full stop, even for pod teammates.
44
+ - A private package a caller can't see **404s, never 403s** — this is
45
+ deliberate (don't leak existence). If you get a 404 fetching a package by
46
+ slug, don't assume it never existed — it may just be private to someone
47
+ else.
48
+
49
+ ## Tier gating
50
+
51
+ A public package can declare `requiredTier`. `GET /api/packages/available`
52
+ tells an authed caller which tiered slugs their subscription actually
53
+ unlocks; a slug missing from that list but present in the browse catalog is
54
+ locked for them — `market.install` pre-checks this and fails before touching
55
+ governance, so surface the tier requirement rather than treating it as a
56
+ generic install error.
@@ -0,0 +1,55 @@
1
+ # Install
2
+
3
+ ## CLI — `synap market install <slug>`
4
+
5
+ ```bash
6
+ synap market install crm # install as a new workspace
7
+ synap market install crm --dry-run # preview: would-create / reuse / conflicts, writes nothing
8
+ synap market install crm --onto <workspaceId> # reconcile ONTO an existing workspace (additive)
9
+ synap market install crm --project <id> # tag seeded entities to a project (install stays pod-wide)
10
+ ```
11
+
12
+ Installs are **workspace-first**: a `workspace`/`template` package spins up
13
+ (or reconciles onto) a workspace directly. Other package types (capability,
14
+ automation, cell) route you to the right surface (`synap capability add`,
15
+ etc.) rather than being force-fit into a workspace install.
16
+
17
+ ## Pod verb — `market.install` (MCP / agent / automation)
18
+
19
+ ```json
20
+ { "slug": "crm", "kind": "template", "version": "optional", "params": {} }
21
+ ```
22
+
23
+ `kind` ∈ `capability | automation | template | cell` — required, unlike
24
+ `market.search`.
25
+
26
+ **This verb ALWAYS mutates**, so it goes through the full permission gate —
27
+ never treat a non-"installed" response as failure:
28
+
29
+ - **Operator call** (no agent identity — e.g. you're driving the CLI as the
30
+ pod owner): executes directly → `{ status: "installed", result }`.
31
+ - **Agent call** (any MCP/automation/agent-key caller): ALWAYS proposes,
32
+ regardless of any standing grant on `market.install` itself — a grant on
33
+ the verb governs _invoking_ it, not the provisioning it performs. Response:
34
+ `{ status: "proposed", proposalId, reviewUrl }`.
35
+
36
+ **`"proposed"` is success, not an error.** Surface `reviewUrl` to the user so
37
+ they can approve it — don't retry, don't report it as a failure. See
38
+ `governance-and-catalog.md`.
39
+
40
+ ## Idempotency by kind
41
+
42
+ - **capability** — natural key is `(name, workspaceId)`; installing twice
43
+ converges, doesn't duplicate.
44
+ - **template/workspace** — keyed by `packageSlug`/`proposalId` (both set to
45
+ the catalog slug); re-installing the same template for the same user
46
+ converges to the existing workspace rather than creating a second one.
47
+ - **automation** — pre-checked by `(name, workspace)` before creating.
48
+ - **cell** — keyed by `(typeKey, workspaceId)`.
49
+
50
+ ## Locked / tier-gated packages
51
+
52
+ A package can declare a `requiredTier`. Installing one your account's plan
53
+ doesn't cover fails a pre-check (`assertPackageTierAccess`) BEFORE any
54
+ proposal or provisioning — tell the user which tier is required rather than
55
+ retrying.
@@ -0,0 +1,51 @@
1
+ # Marketplace & templates on Synap
2
+
3
+ The marketplace is Synap's **package layer**: workspace templates, capabilities,
4
+ automations, and cells — anything that can be installed into a pod rather than
5
+ hand-built. It lives in the Control Plane (CP) catalog and is discoverable and
6
+ installable from any door: the `synap` CLI, MCP (`run_capability`), or the Hub
7
+ REST API (`/api/hub/capabilities/execute`).
8
+
9
+ ## The two reflexes
10
+
11
+ 1. **DISCOVER before you invent.** Before scaffolding a new template or
12
+ capability, search the catalog — `synap market --search "<query>"` or the
13
+ `market.search` verb. Someone may have already published what you need.
14
+ Reinventing a workspace that already exists as a template is wasted work
15
+ AND fragments the catalog.
16
+ 2. **One catalog, never a second one.** Every package — public or private —
17
+ lives in the CP's `synapPackages` table, reached through
18
+ `GET/POST /api/packages`. There is no side channel: don't write a
19
+ template to a random file and call it "published," and don't stand up a
20
+ local list of "known templates" — search the real catalog every time.
21
+
22
+ ## The four things this skill teaches
23
+
24
+ | Task | Doc |
25
+ | --------------------------------------------------------- | --------------------------- |
26
+ | Search/browse/fetch a package (any kind) | `discover-and-fetch.md` |
27
+ | Install a package into a pod | `install.md` |
28
+ | Author a new template and publish it (the ONE write door) | `author-and-publish.md` |
29
+ | Governance rules + the one-catalog principle | `governance-and-catalog.md` |
30
+
31
+ ## Package kinds
32
+
33
+ - **workspace / template** — a full workspace definition (profiles, views,
34
+ entity links) you can spin up as a new workspace, or reconcile onto an
35
+ existing one.
36
+ - **capability** — a tool + skill bundle (an integration or verb pack).
37
+ - **automation** — a trigger + action definition.
38
+ - **cell** — a custom UI renderer.
39
+
40
+ The CLI's browse filter (`market --type`) uses
41
+ `workspace|capability|skill|workflow|view|cell`; the pod-native install verb
42
+ (`market.install`) and its catalog use the narrower
43
+ `capability|automation|template|cell` (workspace ≡ template there). Match
44
+ whichever surface you're calling.
45
+
46
+ ## Visibility
47
+
48
+ Every package is **public** or **private** (owner-only). Default on publish is
49
+ **private** — you opt in to sharing with `--public`. A private package 404s
50
+ (not 403) to anyone who isn't its author or an active member of its owning pod
51
+ — see `governance-and-catalog.md`.