@synap-core/cli 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/data.js +16 -9
- package/dist/commands/data.js.map +1 -1
- package/dist/commands/discover.d.ts +18 -0
- package/dist/commands/discover.js +71 -0
- package/dist/commands/discover.js.map +1 -0
- package/dist/commands/knowledge.js +9 -5
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/hub-client.d.ts +8 -0
- package/dist/lib/hub-client.js +14 -0
- package/dist/lib/hub-client.js.map +1 -1
- package/dist/lib/pod.d.ts +8 -0
- package/dist/lib/pod.js +9 -1
- package/dist/lib/pod.js.map +1 -1
- package/dist/lib/targets.js +31 -7
- package/dist/lib/targets.js.map +1 -1
- package/node_modules/@synap/hub-rest-client/dist/index.cjs +881 -0
- package/node_modules/@synap/hub-rest-client/dist/index.d.cts +907 -0
- package/node_modules/@synap/hub-rest-client/dist/index.d.ts +907 -0
- package/node_modules/@synap/hub-rest-client/dist/index.js +851 -0
- package/node_modules/@synap/hub-rest-client/package.json +45 -0
- package/node_modules/@synap/hub-rest-client/src/client.ts +1143 -0
- package/node_modules/@synap/hub-rest-client/src/errors.ts +30 -0
- package/node_modules/@synap/hub-rest-client/src/index.ts +111 -0
- package/node_modules/@synap/hub-rest-client/src/setup.ts +77 -0
- package/node_modules/@synap/hub-rest-client/src/types.ts +639 -0
- package/package.json +8 -2
- package/skills/synap/SKILL.md +105 -7
package/skills/synap/SKILL.md
CHANGED
|
@@ -48,6 +48,58 @@ Synap is a typed knowledge graph. Six layers you need:
|
|
|
48
48
|
| **Threads** | Channel conversations, optional entity context | Posting to the user's personal AI channel |
|
|
49
49
|
| **Proposals** | Writes queued for human approval | Governance for some mutations (not an error — see below) |
|
|
50
50
|
|
|
51
|
+
## Quick reference — 90% of tasks in 30 lines
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# CLI (preferred — auth automatic, --json = clean output)
|
|
55
|
+
synap orient --json # discover userId + workspaces
|
|
56
|
+
synap use <workspace-name-or-id> # set active workspace
|
|
57
|
+
synap create entity --profile=task --name="…" --props='{"status":"todo","priority":"high"}' --json
|
|
58
|
+
synap set entity <id> --props='{"status":"done"}' --json # merge-patch (only changed keys)
|
|
59
|
+
synap search "query" --json
|
|
60
|
+
synap remember "fact about the user" --json
|
|
61
|
+
synap recall "query" --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# REST (when no Bash access)
|
|
66
|
+
POST /api/hub/entities body: { userId, workspaceId?, profileSlug, title, properties }
|
|
67
|
+
PATCH /api/hub/entities/{id} body: { userId, properties } ← deep-merges, send only changed keys
|
|
68
|
+
POST /api/hub/documents body: { userId, workspaceId?, title, content, entityId? }
|
|
69
|
+
PATCH /api/hub/documents/{id} body: { userId, title?, content? } ← full content replacement
|
|
70
|
+
POST /api/hub/relations body: { userId, sourceEntityId, targetEntityId, type }
|
|
71
|
+
GET /api/hub/entities?q=…&profileSlug=task&workspaceId=…
|
|
72
|
+
GET /api/hub/entities/{id}/connections?userId=…
|
|
73
|
+
POST /api/hub/memory body: { userId, fact }
|
|
74
|
+
GET /api/hub/memory?userId=…&query=…
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Profile schemas are runtime-discovered — never hardcoded:**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
synap discover --json # CLI: full profile tree with property schemas + command map
|
|
81
|
+
synap discover --profiles --json # CLI: profiles only
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
GET /api/hub/discover?userId={userId}&workspaceId={workspaceId}
|
|
86
|
+
→ { profiles: [{ slug, displayName, scope, properties: [{ slug, type, options? }], createCommand }], commands: {...} }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Call this once at session start. The response includes every system profile and any custom workspace profiles the user has created, each with its full property schema. Use `createCommand` per profile as a copy-paste template. Do not rely on a static property list — it will drift.
|
|
90
|
+
|
|
91
|
+
**Load more detail on demand** (`GET /api/hub/skills/system?sections=<id>`):
|
|
92
|
+
|
|
93
|
+
| Section ID | When to load |
|
|
94
|
+
| ------------------------- | ------------------------------------------------------ |
|
|
95
|
+
| `synap:capture` | User pastes multi-entity text (email, transcript, bio) |
|
|
96
|
+
| `synap:governance` | Write was proposed or denied; need to explain policy |
|
|
97
|
+
| `synap:linking` | Custom relation types, auto-sync edge cases |
|
|
98
|
+
| `synap-ui:SKILL` | Building views, bento dashboards, workspaces |
|
|
99
|
+
| `synap-ui:view-types` | Specific view type config shapes |
|
|
100
|
+
| `synap-ui:widget-catalog` | Available widget kinds and their configSchema |
|
|
101
|
+
| `synap-schema:SKILL` | Creating custom profiles or property definitions |
|
|
102
|
+
|
|
51
103
|
## Synap-first operating mode
|
|
52
104
|
|
|
53
105
|
> **MCP clients** (Claude Desktop, Raycast, OpenClaw with MCP): use `synap_*` tool names — they wrap auth and governance automatically. **REST / HTTP clients**: use the endpoints below.
|
|
@@ -67,12 +119,14 @@ GET /api/hub/users/me
|
|
|
67
119
|
GET /api/hub/workspaces
|
|
68
120
|
→ [{ id, name, role }] ← workspaces[0].id if only one
|
|
69
121
|
|
|
70
|
-
GET /api/hub/
|
|
71
|
-
→ [{ slug, displayName,
|
|
122
|
+
GET /api/hub/discover?userId={userId}&workspaceId={workspaceId}
|
|
123
|
+
→ { profiles: [{ slug, displayName, scope, properties, createCommand }], commands: {...} }
|
|
124
|
+
← replaces /profiles — includes property schemas + custom workspace profiles
|
|
72
125
|
```
|
|
73
126
|
|
|
74
|
-
`
|
|
75
|
-
`
|
|
127
|
+
`scope: "pod"` = visible across all workspaces (note, task, project, person, company, bookmark, event, contact, article, website).
|
|
128
|
+
`scope: "workspace"` = scoped to one workspace (deal, file, capture, custom profiles).
|
|
129
|
+
Each profile includes its full property schema. Use `createCommand` as a template.
|
|
76
130
|
|
|
77
131
|
**2. Search before answering**
|
|
78
132
|
Before answering any question about the user's projects, tasks, contacts, decisions, or anything they might have captured — search Synap first. Do not answer from your training or context window when Synap may have the authoritative answer.
|
|
@@ -390,10 +444,12 @@ POST /api/hub/entities
|
|
|
390
444
|
|
|
391
445
|
```json
|
|
392
446
|
PATCH /api/hub/entities/{entityId}
|
|
393
|
-
{ "title": "…", "properties": { "status": "done" } }
|
|
447
|
+
{ "userId": "{userId}", "title": "…", "properties": { "status": "done" } }
|
|
394
448
|
```
|
|
395
449
|
|
|
396
|
-
|
|
450
|
+
**Properties are deep-merged — send only the keys you want to change.** An update with `{ "status": "done" }` leaves all other properties untouched. You never need to re-send the full properties object.
|
|
451
|
+
|
|
452
|
+
### Create a document (attach to an entity)
|
|
397
453
|
|
|
398
454
|
```json
|
|
399
455
|
POST /api/hub/documents
|
|
@@ -402,10 +458,52 @@ POST /api/hub/documents
|
|
|
402
458
|
"workspaceId": "{workspaceId}",
|
|
403
459
|
"title": "Meeting notes — 2026-04-20",
|
|
404
460
|
"content": "# Attendees\n- …\n\n# Decisions\n- …",
|
|
405
|
-
"
|
|
461
|
+
"type": "markdown", // "markdown" | "html" | "text" | "code"
|
|
462
|
+
"entityId": "ent_event_..." // attach to an entity for context
|
|
406
463
|
}
|
|
407
464
|
```
|
|
408
465
|
|
|
466
|
+
`type: "html"` stores self-contained HTML. The browser renders it via the `html-doc` cell in a sandboxed iframe. Use for AI-generated reports, rich visualisations, custom charts, or anything beyond markdown.
|
|
467
|
+
|
|
468
|
+
**Full HTML cell workflow** (AI → visible custom UI in any bento):
|
|
469
|
+
|
|
470
|
+
```json
|
|
471
|
+
// 1. Create the HTML document
|
|
472
|
+
POST /api/hub/documents
|
|
473
|
+
{ "userId": "{userId}", "workspaceId": "{workspaceId}",
|
|
474
|
+
"title": "Q2 Revenue Report", "type": "html",
|
|
475
|
+
"content": "<!DOCTYPE html><html>…</html>",
|
|
476
|
+
"entityId": "ent_project_..." }
|
|
477
|
+
// → { "document": { "id": "doc_abc" }, ... }
|
|
478
|
+
|
|
479
|
+
// 2. Place the html-doc cell in any bento view
|
|
480
|
+
POST /api/hub/views/{bentoViewId}/arrange
|
|
481
|
+
{ "userId": "{userId}", "workspaceId": "{workspaceId}",
|
|
482
|
+
"widgets": [
|
|
483
|
+
{ "id": "b1", "kind": "html-doc", "config": { "documentId": "doc_abc" },
|
|
484
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 } }
|
|
485
|
+
] }
|
|
486
|
+
|
|
487
|
+
// 3. Update the HTML (cell auto-refreshes)
|
|
488
|
+
PATCH /api/hub/documents/doc_abc
|
|
489
|
+
{ "userId": "{userId}", "content": "<!DOCTYPE html>…updated…</html>" }
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
The iframe uses `sandbox="allow-scripts"` — scripts run but have no same-origin access to the parent app. The HTML is fully isolated.
|
|
493
|
+
|
|
494
|
+
### Update a document (title and/or content)
|
|
495
|
+
|
|
496
|
+
```json
|
|
497
|
+
PATCH /api/hub/documents/{documentId}
|
|
498
|
+
{
|
|
499
|
+
"userId": "{userId}",
|
|
500
|
+
"title": "Updated title", // optional
|
|
501
|
+
"content": "# Full replacement\n…" // full string — not a diff
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Content is a **full replacement**, not a patch. Fetch the current content first if you want to append: `GET /api/hub/documents/{id}?userId={userId}` → `.content`, append, then PATCH.
|
|
506
|
+
|
|
409
507
|
The reverse lookup is `entities WHERE documentId = ?`. Always attach the document to a meaningful entity (the meeting event, the project, the person) — a floating document is another orphan.
|
|
410
508
|
|
|
411
509
|
### Store a fact (memory) — use sparingly
|