@elevasis/sdk 1.15.0 → 1.16.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 (66) hide show
  1. package/dist/cli.cjs +2325 -124
  2. package/dist/index.d.ts +882 -794
  3. package/dist/index.js +170 -46
  4. package/dist/node/index.d.ts +69 -0
  5. package/dist/node/index.js +273 -0
  6. package/dist/test-utils/index.d.ts +857 -711
  7. package/dist/test-utils/index.js +2 -0
  8. package/dist/types/worker/adapters/lead.d.ts +1 -1
  9. package/dist/types/worker/platform.d.ts +2 -9
  10. package/dist/worker/index.js +1 -0
  11. package/package.json +12 -3
  12. package/reference/_navigation.md +23 -1
  13. package/reference/_reference-manifest.json +98 -0
  14. package/reference/claude-config/rules/agent-start-here.md +13 -0
  15. package/reference/claude-config/rules/organization-model.md +40 -40
  16. package/reference/claude-config/rules/organization-os.md +16 -16
  17. package/reference/claude-config/rules/ui.md +2 -6
  18. package/reference/claude-config/rules/vibe.md +13 -13
  19. package/reference/claude-config/skills/knowledge/SKILL.md +253 -0
  20. package/reference/claude-config/skills/{configure → knowledge}/operations/codify-level-a.md +100 -100
  21. package/reference/claude-config/skills/{configure → knowledge}/operations/codify-level-b.md +158 -158
  22. package/reference/claude-config/skills/knowledge/operations/customers.md +109 -0
  23. package/reference/claude-config/skills/knowledge/operations/features.md +113 -0
  24. package/reference/claude-config/skills/knowledge/operations/goals.md +118 -0
  25. package/reference/claude-config/skills/knowledge/operations/identity.md +93 -0
  26. package/reference/claude-config/skills/knowledge/operations/labels.md +89 -0
  27. package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -0
  28. package/reference/claude-config/skills/knowledge/operations/roles.md +99 -0
  29. package/reference/claude-config/skills/knowledge/operations/techStack.md +102 -0
  30. package/reference/claude-config/skills/run-ui/SKILL.md +73 -0
  31. package/reference/claude-config/skills/setup/SKILL.md +270 -270
  32. package/reference/claude-config/skills/tutorial/SKILL.md +249 -0
  33. package/reference/claude-config/skills/tutorial/progress-template.md +74 -0
  34. package/reference/claude-config/skills/tutorial/technical.md +1309 -0
  35. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -0
  36. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -0
  37. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -0
  38. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -0
  39. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -0
  40. package/reference/deployment/index.mdx +5 -5
  41. package/reference/examples/organization-model.ts +40 -0
  42. package/reference/framework/index.mdx +1 -1
  43. package/reference/framework/tutorial-system.mdx +86 -173
  44. package/reference/packages/core/src/knowledge/README.md +32 -0
  45. package/reference/packages/ui/src/knowledge/README.md +31 -0
  46. package/reference/packages/ui/src/theme/presets/README.md +19 -0
  47. package/reference/scaffold/core/organization-model.mdx +1 -1
  48. package/reference/scaffold/recipes/add-a-feature.md +1 -1
  49. package/reference/scaffold/recipes/customize-crm-actions.md +3 -3
  50. package/reference/scaffold/recipes/customize-organization-model.md +3 -3
  51. package/reference/scaffold/recipes/extend-crm.md +12 -8
  52. package/reference/scaffold/recipes/extend-lead-gen.md +129 -20
  53. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +1 -1
  54. package/reference/scaffold/recipes/index.md +6 -0
  55. package/reference/scaffold/reference/contracts.md +829 -595
  56. package/reference/scaffold/reference/feature-registry.md +2 -1
  57. package/reference/scaffold/ui/composition-extensibility.mdx +17 -0
  58. package/reference/claude-config/skills/configure/SKILL.md +0 -98
  59. package/reference/claude-config/skills/configure/operations/customers.md +0 -150
  60. package/reference/claude-config/skills/configure/operations/features.md +0 -162
  61. package/reference/claude-config/skills/configure/operations/goals.md +0 -147
  62. package/reference/claude-config/skills/configure/operations/identity.md +0 -133
  63. package/reference/claude-config/skills/configure/operations/labels.md +0 -128
  64. package/reference/claude-config/skills/configure/operations/offerings.md +0 -159
  65. package/reference/claude-config/skills/configure/operations/roles.md +0 -153
  66. package/reference/claude-config/skills/configure/operations/techStack.md +0 -139
@@ -1,222 +1,135 @@
1
1
  ---
2
2
  title: Tutorial System
3
- description: Reference for the SDK tutorial system -- 21-item menu across 4 sections, skill-level adaptation rules, progress tracking format, and per-lesson module contents
3
+ description: The /tutorial skill in the external project scaffold -- two-track onboarding (vibe-coder and technical), gate question, track persistence, and escape hatch
4
4
  ---
5
5
 
6
- The tutorial system is available via the `/tutorial` slash command in Claude Code. It is included in the external template project scaffold.
6
+ The `/tutorial` skill is included in every scaffolded external project. Run it from Claude Code inside a project to start interactive onboarding. It forks into two tracks on first invocation and adapts agent tone project-wide based on your choice.
7
7
 
8
8
  ---
9
9
 
10
- ## Menu System
10
+ ## Getting Started
11
11
 
12
- `/tutorial` always shows the full 21-item menu table on invocation. All items are visible at once with progress indicators. No track gating -- any item is available at any time.
12
+ Open a scaffolded external project in Claude Code and run:
13
13
 
14
14
  ```
15
- Elevasis Tutorial
16
- ==================
17
-
18
- INTRODUCTION 0/4
19
- 1 Welcome & Orientation [ ]
20
- 2 How This Workspace Works [ ]
21
- 3 The /meta Command [ ]
22
- 4 /work and /docs [ ]
23
-
24
- CORE CONCEPTS 0/6
25
- 5 Your First Custom Workflow [ ]
26
- 6 Understanding Data (Schemas) [ ]
27
- 7 Using Platform Tools [ ]
28
- 8 Multi-Step Workflows [ ]
29
- 9 Decision Points [ ]
30
- 10 Going to Production [ ]
31
-
32
- ADVANCED MODULES 0/9
33
- 11 Human-in-the-Loop [ ]
34
- 12 Task Scheduling [ ]
35
- 13 Notification System [ ]
36
- 14 Real-World Integrations [ ]
37
- 15 Error Handling Mastery [ ]
38
- 16 Advanced Workflows [ ]
39
- 17 Resource Composition [ ]
40
- 18 LLM Integration [ ]
41
- 19 AI Agents [ ]
42
-
43
- ADVANCED WORKSPACE 0/2
44
- 20 Rules, Memory, and Customization [ ]
45
- 21 Template Lifecycle [ ]
46
-
47
- Pick a number to start.
15
+ /tutorial
48
16
  ```
49
17
 
50
- **Progress indicators:** `[ ]` not started, `[>]` in progress, `[x] YYYY-MM-DD` complete.
51
-
52
- User picks a number to start or resume any item. `"status"` shows the same table.
18
+ On first invocation in a fresh project, the skill asks one gate question:
53
19
 
54
- ---
20
+ > "Are you here to **build automations by describing what you want** (and I handle the technical side), or are you a **developer** who'll edit code directly?"
55
21
 
56
- ## 4 Sections
22
+ Your answer selects a track. The choice is saved to `.claude/memory/profile.md` and shapes agent vocabulary, tool-call visibility, and verbosity for every conversation in the project -- not just `/tutorial` sessions.
57
23
 
58
- - **INTRODUCTION (1-4):** Welcome + workspace orientation (workspace framework, /meta, /work and /docs) -- taught before building
59
- - **CORE CONCEPTS (5-10):** Orchestration lessons (workflows, schemas, tools, multi-step, conditions, production)
60
- - **ADVANCED MODULES (11-19):** Hands-on feature modules (hitl, schedules, notifications, integrations, error-handling, workflows, composition, llm, agents)
61
- - **ADVANCED WORKSPACE (20-21):** Power-user customization (rules/memory, template lifecycle)
24
+ Subsequent `/tutorial` invocations skip the gate question and resume your progress.
62
25
 
63
26
  ---
64
27
 
65
- ## Skill-Level Adaptation
66
-
67
- Assessed during `/meta init`. Two independent dimensions.
68
-
69
- ### automation dimension
28
+ ## Tracks at a Glance
70
29
 
71
- | Level | Context Loading | Delivery | Verification |
72
- | ---------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------- |
73
- | `none` | Glossary, Workflow overview, Platform Tools Overview only. Skip Zod, Execution Model, Design Decisions. | Agent writes all code. No code shown to user. Analogies throughout. | CLI primary. Agent runs `elevasis-sdk exec` and narrates results. |
74
- | `low-code` | All concept sections. Zapier/Make mapping. `adapters-integration.mdx` / `adapters-platform.mdx` on-demand. | Map to Zapier/Make equivalents. Show code with explanations. | CLI primary. |
75
- | `custom` | All docs listed per-lesson and per-module. | Full technical content, code-first. | CLI primary. |
76
-
77
- ### platformNavigation dimension
78
-
79
- | Level | Behavior |
80
- | ------------- | ---------------------------------------------------------------------------------------------------------------------- |
81
- | `none` | Walk through pages step by step with exact navigation paths. Explain each page before asking user to interact with it. |
82
- | `oriented` | Reference pages by name; briefly remind purpose on first mention. |
83
- | `comfortable` | Reference by name only; focus on advanced filtering and schedule types. |
84
-
85
- **General rules (all levels):** Fast users: acknowledge, offer to skip ahead. Level change observed: note in `skills.md` Growth Log. After lesson/module: update progress file.
86
-
87
- ---
30
+ ### Vibe-Coder Track (8 lessons)
88
31
 
89
- ## Progress Logic
32
+ For users who want to describe what they want and have the agent handle the implementation. The agent never uses technical vocabulary -- no TypeScript, no pnpm, no CLI commands shown, no schemas explained. Everything is narrated in plain language.
90
33
 
91
34
  ```
92
- 1. Read .claude/memory/tutorial-progress.md
93
- 2. Show the full menu table with progress indicators filled in
94
- 3. User picks a number -> start or resume that item directly
95
- 4. After completion: mark done in progress file, show updated menu table
96
- 5. All 21 items complete -> congratulate, suggest docs/ or /work
35
+ Your Tutorial
36
+ ==============
37
+ 1 Welcome -- what this place does for you [ ]
38
+ 2 How to talk to me [ ]
39
+ 3 Your business profile [ ]
40
+ 4 Your first automation [ ]
41
+ 5 Your dashboard -- where everything lives [ ]
42
+ 6 Your approval queue -- signing off on things [ ]
43
+ 7 Changing things later [ ]
44
+ 8 When things go wrong [ ]
45
+
46
+ Pick a number to start.
97
47
  ```
98
48
 
99
- ---
49
+ **What each lesson covers:**
100
50
 
101
- ## Introduction: Items 1-4
51
+ - **1. Welcome** -- Plain analogy for the platform. Shows a real automation already running before any building.
52
+ - **2. How to talk to me** -- Conversation patterns for making requests, asking questions, and describing changes. No technical vocabulary introduced.
53
+ - **3. Your business profile** -- Conversational walk through org identity. Agent handles all edits silently; user answers questions.
54
+ - **4. Your first automation** -- User describes what they want. Agent builds, runs, and narrates. User never sees code.
55
+ - **5. Your dashboard** -- Tour of Command Center. Where automations live and how to read the visual map.
56
+ - **6. Your approval queue** -- Show a pending approval, approve it, see the automation continue.
57
+ - **7. Changing things later** -- Plain-language change requests. Agent handles implementation.
58
+ - **8. When things go wrong** -- "Tell me what looks wrong. I'll figure it out and tell you what I did." No error traces shown.
102
59
 
103
- Items 1-4 orient the user to the platform and workspace before any building.
60
+ **Vocabulary rules in this track:** The agent never says workflow, schema, deploy, credential, TypeScript, or pnpm. "Automation" replaces all SDK resource terms. "Make it live" replaces "deploy." "Account connection" replaces "credential." "Your approval queue" replaces HITL.
104
61
 
105
- **Item 1 -- Welcome & Orientation:** Platform tour, deploy echo workflow, Command Center orientation.
62
+ ### Technical Track (19 lessons, 5 sections)
106
63
 
107
- **Item 2 -- How This Workspace Works:** CLAUDE.md as instruction sheet, four commands, creds skill, memory system overview.
64
+ For developers who will read and edit code directly. Lessons are code-first. All SDK concepts, CLI commands, and file structures are covered.
108
65
 
109
- **Item 3 -- The /meta Command:** Project dashboard, /meta fix, /meta deploy, /meta health.
66
+ ```
67
+ SECTION A -- The workspace (3 items)
68
+ 1 What is this workspace [ ]
69
+ 2 The skill layer -- slash commands you'll use [ ]
70
+ 3 The vibe layer -- ambient intent classification [ ]
71
+
72
+ SECTION B -- Build your first thing (5 items)
73
+ 4 Echo workflow tour [ ]
74
+ 5 Custom workflow with schemas [ ]
75
+ 6 Platform tools and credentials [ ]
76
+ 7 Multi-step and conditionals [ ]
77
+ 8 Going to production [ ]
78
+
79
+ SECTION C -- The Organization Model (3 items)
80
+ 9 /knowledge ceremony -- identity, customers, [ ]
81
+ offerings via the layered flow
82
+ 10 Features and labels [ ]
83
+ 11 Entity extensions -- BaseProject, BaseDeal [ ]
84
+
85
+ SECTION D -- Modules (load on demand) (~6 items)
86
+ 12 HITL [ ]
87
+ 13 Schedules [ ]
88
+ 14 Notifications + integrations [ ]
89
+ 15 Error handling [ ]
90
+ 16 LLM and agents [ ]
91
+ 17 Composition (execution.trigger) [ ]
92
+
93
+ SECTION E -- Power user (2 items)
94
+ 18 Rules, memory, scaffold registry [ ]
95
+ 19 Template lifecycle and /git-sync [ ]
96
+ ```
110
97
 
111
- **Item 4 -- /work and /docs:** Cross-session task tracking, documentation lifecycle, /work vs /docs boundary.
98
+ Section D modules are available any time -- no section order prerequisite. Sections A-C are designed to be completed in order on a first pass, though any item can be picked directly.
112
99
 
113
100
  ---
114
101
 
115
- ## Core Path: Lessons 5-10
116
-
117
- Each lesson: (1) announce title and goal, (2) explain concept per skill level, (3) build or modify something, (4) verify it works, (5) record observations, ask "ready for next?"
118
-
119
- **Lesson 5 -- Your First Custom Workflow**
120
-
121
- - `automation: none` -- "A recipe." Agent writes all code. Agent runs `elevasis-sdk exec` and narrates result.
122
- - `automation: low-code or custom` -- Modify echo workflow. Walk through `config`, `contract`, `steps`, `entryPoint`. Deploy with `elevasis-sdk check` then `elevasis-sdk deploy`.
123
-
124
- **Lesson 6 -- Understanding Data (Schemas)**
125
-
126
- - `automation: none` -- "What information does your automation need?" No Zod, no code shown. Agent reads identity.md goals and writes the schema.
127
- - `automation: low-code` -- "Field mapping like Zapier, but with validation." Show Zod types briefly.
128
- - `automation: custom` -- Full Zod explanation. `z.infer`. Show how schema fields define CLI input structure.
129
-
130
- **Lesson 7 -- Using Platform Tools**
102
+ ## Track Persistence
131
103
 
132
- - `automation: none` -- Agent makes all code edits. Credential creation guided via Command Center UI.
133
- - `automation: low-code or custom` -- Explain adapter pattern: `createAttioAdapter('cred')`. Show singleton pattern: `import { scheduler, llm } from '@elevasis/sdk/worker'`.
104
+ The track choice is saved to `.claude/memory/profile.md` on selection. The agent reads this file at session start alongside `agent-start-here.md`. This means:
134
105
 
135
- **Lesson 8 -- Multi-Step Workflows**
136
-
137
- - `automation: none` -- "Step 1 passes its result to Step 2, like a relay race." Command View is PRIMARY teaching tool.
138
- - `automation: low-code or custom` -- Chain steps with `StepType.LINEAR`. Show relationship edges in Command View.
139
-
140
- **Lesson 9 -- Decision Points**
141
-
142
- - `automation: none` -- "If the customer is VIP, do this -- otherwise, do that." Agent runs both paths. Open Execution Logs.
143
- - `automation: low-code or custom` -- Conditional routing with `StepType.CONDITIONAL`. Show step trace in Execution Logs.
144
-
145
- **Lesson 10 -- Going to Production**
146
-
147
- - `automation: none` -- "Draft vs live." Create Recurring schedule in Task Scheduler.
148
- - `automation: low-code or custom` -- Change `status: dev` -> `prod`. Cover `try/catch`, `ExecutionError`, `PlatformToolError`. CLI monitoring: `elevasis-sdk executions`.
106
+ - Agent vocabulary and tone adjust for every conversation in the project, not just `/tutorial`
107
+ - The vibe-coder track suppresses all technical surface globally until switched
108
+ - Progress is tracked separately in `.claude/memory/tutorial-progress.md`
149
109
 
150
110
  ---
151
111
 
152
- ## Module System: Items 11-19
153
-
154
- Modules are available any time -- no core path prerequisite. After completing a module the full menu table is shown again.
112
+ ## Switching Tracks
155
113
 
156
- | # | Module | Reference Docs | Build | Key Concepts |
157
- | --- | ---------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
158
- | 11 | `hitl` | `command-center.mdx` (Command Queue) | Approval gate with `approval.create()`. Full lifecycle: trigger -> Command Queue -> approve/reject -> resume. | `approval` adapter, pending state, Command Queue UI |
159
- | 12 | `schedules` | `command-center.mdx` (Task Scheduler) | All three schedule types: Recurring, Relative, Absolute. `scheduler` adapter for in-workflow. | Cron syntax, schedule types, Task Scheduler UI |
160
- | 13 | `notifications` | `adapters-platform.mdx` (notifications, email) | Notification + email steps. Alerts on completion. | `notifications` singleton, `email` singleton |
161
- | 14 | `integrations` | `platform-tools/index.mdx` (Credential Security), `adapters-integration.mdx` | Real adapter from `identity.md`. Full end-to-end with OAuth or API key credential. | Adapter pattern, credential scoping, external call error handling |
162
- | 15 | `error-handling` | `patterns.mdx` (error handling), `troubleshooting.mdx` | Workflow demonstrating all three error types. `try/catch`, `context.logger`, recovery. | `ExecutionError`, `PlatformToolError`, `ToolingError` |
163
- | 16 | `workflows` | `patterns.mdx` (store, logging, organization) | Refactor with `context.store`, `context.logger`, domain directories. Advanced schema patterns. | `context.store`, `context.logger`, schema depth |
164
- | 17 | `composition` | `command-center.mdx` (Command View), `patterns.mdx` | Two workflows: first triggers second with `execution.trigger()`. Declare relationship. | `execution.trigger`, relationship declarations, Command View edges |
165
- | 18 | `llm` | `adapters-platform.mdx` (llm singleton) | `llm.generate()` with structured output. Model selection and temperature. | `llm` singleton, structured output, temperature |
166
- | 19 | `agents` | `framework/agent.mdx` | Agent definition with tools. LLM tool calling. Agent vs workflow comparison. | Agent definition, tool registration, execution trace |
114
+ Run `/tutorial switch` at any time to flip tracks and restart the menu. Progress from the previous track is preserved in the progress file for reference but the active lesson resets.
167
115
 
168
116
  ---
169
117
 
170
- ## Advanced Workspace: Items 20-21
118
+ ## Progress Indicators
171
119
 
172
- **Item 20 -- Rules, Memory, and Customization**
120
+ The menu uses three states:
173
121
 
174
- - `none` -- "Sticky notes the agent reads automatically." Show `.claude/rules/workspace-patterns.md` without technical detail.
175
- - `low-code` -- Show `.claude/rules/` directory. Explain MANAGED (`sdk-patterns.md`) vs INIT_ONLY (`workspace-patterns.md`). Explain error promotion: 3+ recurrences -> add a rule.
176
- - `custom` -- Read both rules files. Walk through memory layout: `index.md`, `profile/`, `errors/`, `tutorial-progress.md`. Walk through adding a new rule.
122
+ - `[ ]` -- not started
123
+ - `[>]` -- in progress
124
+ - `[x] YYYY-MM-DD` -- complete
177
125
 
178
- **Item 21 -- Template Lifecycle**
179
-
180
- - `none` -- "SDK releases automatically update your workspace." Explain `/meta fix` as the update command.
181
- - `low-code` -- Explain MANAGED vs INIT_ONLY file types. Show how `/meta fix` handles conflicts.
182
- - `custom` -- Full template lifecycle: the external template handles initial project creation. `/meta fix` performs drift repair and SDK upgrade. Conflict resolution merges current files against the template, preserving customizations in INIT_ONLY files.
126
+ Run `/tutorial` with no argument at any time to see the current menu with progress filled in. Run `/tutorial status` for the same view.
183
127
 
184
128
  ---
185
129
 
186
- ## Progress File Format
187
-
188
- Stored at `.claude/memory/tutorial-progress.md`.
189
-
190
- ```markdown
191
- # Tutorial Progress
192
-
193
- Current: <free-form, e.g. "4: /work and /docs" or "M:integrations">
194
- Started: YYYY-MM-DD
195
- Last Session: YYYY-MM-DD
196
-
197
- ## Completed Lessons
198
-
199
- | Item | Title | Completed | Duration |
200
- | --- | --- | --- | --- |
201
- | 1 | Welcome & Orientation | 2026-03-01 | 25 min |
202
-
203
- ## Completed Modules
204
-
205
- | Module | Title | Completed | Duration |
206
- | --- | --- | --- | --- |
207
- | hitl | Human-in-the-Loop | 2026-03-03 | 40 min |
208
-
209
- ## Capability Observations
210
-
211
- | Source | Observation |
212
- | --- | --- |
213
- | 1 | Navigated Command View without guidance |
214
-
215
- ## Assessment Notes
216
-
217
- - Strong automation background, slow on TypeScript syntax
218
- ```
219
-
220
- ---
130
+ ## Related Docs
221
131
 
222
- **Last Updated:** 2026-03-05
132
+ - [SDK Concepts](../concepts.mdx) -- full technical reference for workflows, schemas, adapters, and the org model
133
+ - [Getting Started](../getting-started.mdx) -- scaffold setup and first deploy
134
+ - [CLI Reference](../cli.mdx) -- `elevasis-sdk` commands referenced in the technical track
135
+ - [Framework Overview](index.mdx) -- skill layer, memory system, and interaction guidance
@@ -0,0 +1,32 @@
1
+ # @elevasis/core/knowledge
2
+
3
+ Pure query layer over the organization graph. Browser-safe (no Node APIs); shared by the SDK CLI, platform CLI, and the `@elevasis/ui/knowledge` browser.
4
+
5
+ ## Surface
6
+
7
+ | Export | Purpose |
8
+ | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
9
+ | `byFeature(graph, featureId, knowledgeNodes)` | Knowledge nodes that govern the given feature. |
10
+ | `byKind(graph, kind, knowledgeNodes)` | Filter knowledge nodes by `OrgKnowledgeKind`. |
11
+ | `byOwner(graph, ownerId, knowledgeNodes)` | Knowledge nodes whose `ownerIds` includes the given owner. |
12
+ | `governs(graph, nodeId)` | Outgoing `governs` targets (governed-feature ids) from a knowledge node. |
13
+ | `governedBy(graph, nodeId)` | Incoming `governs` sources (governing knowledge-node ids) into a feature. |
14
+ | `parsePath(pathString)` | Parse `/by-feature/$id`, `/by-kind/$kind`, `/by-owner/$id`, `/graph/$id/{governs,governed-by}`, or `/$id`. Throws on invalid input. |
15
+ | `formatText`, `formatJson`, `formatIdsOnly` | Output formatters used by the `knowledge:*` CLI subcommands. |
16
+
17
+ ## Path syntax
18
+
19
+ ```
20
+ /by-feature/<featureId>
21
+ /by-kind/<playbook|strategy|reference>
22
+ /by-owner/<ownerId>
23
+ /graph/<nodeId>/governs
24
+ /graph/<nodeId>/governed-by
25
+ /<nodeId>
26
+ ```
27
+
28
+ ## JSON envelope
29
+
30
+ `formatJson` returns `{ path, mount, args, results }` — the same wrapped envelope used by `pnpm exec elevasis knowledge:ls --json` and `pnpm exec elevasis-sdk knowledge:ls --json`.
31
+
32
+ `governs` and `governedBy` accept either bare or graph-namespaced ids (`knowledge.foo` or `knowledge:knowledge.foo`).
@@ -0,0 +1,31 @@
1
+ # @elevasis/ui/knowledge
2
+
3
+ Read-only browser primitives for the Organization Model knowledge graph.
4
+
5
+ ## Surface
6
+
7
+ | Export | Purpose |
8
+ | ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
9
+ | `KnowledgeBrowser` | Selected-node detail pane. Tree/search now live in the feature sidebar. |
10
+ | `KnowledgeTree` | By-feature primary tree with hierarchical features and multi-governance duplication. |
11
+ | `KnowledgeNodeList` | Legacy flat list of node summary cards; exported for compatibility. |
12
+ | `KnowledgeNodeView` | Single knowledge-node detail view using `NodeDescribeShell` and relationship groups. |
13
+ | `KnowledgeSearchBar` | Client-side search over `_generated/knowledge-search-index.json`. |
14
+ | `KnowledgeSidebarMiddle` | Deprecated legacy sidebar middle section; active sidebar lives under `features/knowledge/sidebar`. |
15
+ | `KNOWLEDGE_ITEMS` | Deprecated default sidebar nav items retained for compatibility. |
16
+ | `KnowledgeMDXProvider`, `useKnowledgeAllowlist`, `KNOWLEDGE_ALLOWLIST` | MDX runtime allowlist (`Card`, `Cards`, `Step`, `Steps`, `Callout`, `Tab`, `Tabs`). |
17
+ | `KNOWLEDGE_BODIES` | Build-time-compiled MDX components keyed by node id. |
18
+
19
+ ## Customization tiers
20
+
21
+ 1. **Default** — mount `knowledgeManifest` from `@elevasis/ui/features/knowledge`.
22
+ 2. **Extend** — pass `extraComponents` to `KnowledgeMDXProvider` or compose around the feature sidebar primitives.
23
+ 3. **Replace** — call `@elevasis/core/knowledge` queries directly from project-owned routes.
24
+
25
+ ## Codegen
26
+
27
+ `KNOWLEDGE_BODIES` and the search index are regenerated by `pnpm scaffold:sync` (or `pnpm knowledge:generate` to run only the knowledge step). Source: `canonicalOrganizationModel.knowledge.nodes` from `@repo/elevasis-core`.
28
+
29
+ The Vite plugin at `@elevasis/ui/vite-plugin-knowledge` re-runs codegen on `buildStart` and watches the OM source dir for HMR.
30
+
31
+ Phase 1 is read-only. Phase 2 will move bodies into Supabase and ship via `mdx-bundler`.
@@ -0,0 +1,19 @@
1
+ # Theme Presets
2
+
3
+ Re-exports the canonical theme-preset SSOT from `@repo/core`. This subpath exists so that consumers can import preset metadata without pulling in the full theme runtime surface.
4
+
5
+ ## Exports
6
+
7
+ - `THEME_PRESETS` — `as const` tuple of preset names; the single source of truth.
8
+ - `ThemePresetName` — union type derived from `THEME_PRESETS`.
9
+ - `ThemePresetEnum` — Zod enum derived from `THEME_PRESETS`.
10
+
11
+ ## Use When
12
+
13
+ - You need a Zod-validated preset name (form schemas, API request/response validation).
14
+ - You need the union type for component props or Zustand state.
15
+ - You're adding a new preset and want to ensure it propagates everywhere via the canonical tuple.
16
+
17
+ ## Source Of Truth
18
+
19
+ `packages/core/src/auth/multi-tenancy/theme-presets.ts`. This subpath is a thin re-export. The `ui → core` dependency stays one-directional; the runtime preset catalog (`presets`, `getPreset`) lives at `@repo/ui/theme` and consumes the names declared in core.
@@ -72,7 +72,7 @@ Authored fields:
72
72
  Containers omit `path`; leaves provide `path`. `uiPosition`, `requiresAdmin`, and `devOnly` inherit from ancestors.
73
73
  Development-only features remain defined and enabled with `devOnly: true`; shell consumers hide those entries and route paths outside development mode while preserving the semantic contract.
74
74
 
75
- Navigation surfaces may also carry `devOnly` for compatibility with the legacy/domain navigation model. `operations.command-view` is intentionally development-only while its graph visualization modes continue to mature.
75
+ Navigation surfaces may also carry `devOnly` for compatibility with the legacy/domain navigation model. `knowledge.command-view` is intentionally development-only while its graph visualization modes continue to mature.
76
76
 
77
77
  ## Graph IDs and Resource Links
78
78
 
@@ -22,7 +22,7 @@ const organizationOverride = defineOrganizationModel({
22
22
  label: 'Analytics',
23
23
  enabled: true,
24
24
  path: '/analytics',
25
- icon: 'chart',
25
+ icon: 'custom.analytics',
26
26
  uiPosition: 'sidebar-primary'
27
27
  }
28
28
  ]
@@ -78,7 +78,7 @@ These wrap existing `LeadService` logic -- they are extraction, not new business
78
78
 
79
79
  Deploy a workflow with the same `workflowId` as the default action you want to replace. The resource registry resolves your project-owned workflow first.
80
80
 
81
- The canonical transition workflow (see `external/elevasis/operations/src/sales/crm/actions/move-to-proposal.ts` for the deployed reference):
81
+ The canonical transition workflow (see `packages/elevasis-operations/src/sales/crm/actions/move-to-proposal.ts` for the deployed reference):
82
82
 
83
83
  ```ts
84
84
  // operations/src/sales/crm/actions/move-to-proposal.ts
@@ -203,7 +203,7 @@ This controls the shared `DealDetailPage` and `DealDrawer` action row.
203
203
 
204
204
  For a brand-new action key that calls a project-owned workflow, define the workflow first.
205
205
 
206
- If the action sends email, writes to another channel, or otherwise touches a customer, use `acqDb.recordDealActivity` inside the workflow handler to append an audit entry to the deal's `activity_log`. For an advanced Instantly-thread-aware variant that prefers in-thread replies and falls back to fresh outbound, see the canonical CRM action examples in `external/elevasis/operations/src/sales/crm/actions/`.
206
+ If the action sends email, writes to another channel, or otherwise touches a customer, use `acqDb.recordDealActivity` inside the workflow handler to append an audit entry to the deal's `activity_log`. For an advanced Instantly-thread-aware variant that prefers in-thread replies and falls back to fresh outbound, see the canonical CRM action examples in `packages/elevasis-operations/src/sales/crm/actions/`.
207
207
 
208
208
  ### Define the Workflow Contract
209
209
 
@@ -408,7 +408,7 @@ const validStates = getValidStatesForStage(CRM_PIPELINE_DEFINITION, 'interested'
408
408
 
409
409
  Workflows that write `state_key` should import from this definition rather than hardcoding string literals. This keeps the vocabulary in one place and lets the API validate against the allowed set for a deal's current stage.
410
410
 
411
- **Current gap:** `@elevasis/core` v0.13.0 does not yet expose the `organization-model` subpath. Until a new release ships that export, hardcoded strings in `external/elevasis/operations/...` are tracked as follow-up. Document usages with a `// TODO: replace with CRM_PIPELINE_DEFINITION import once @elevasis/core exposes organization-model` comment so they are easy to find.
411
+ **Current gap:** `@elevasis/core` v0.13.0 does not yet expose the `organization-model` subpath. Until a new release ships that export, hardcoded strings in `packages/elevasis-operations/...` are tracked as follow-up. Document usages with a `// TODO: replace with CRM_PIPELINE_DEFINITION import once @elevasis/core exposes organization-model` comment so they are easy to find.
412
412
 
413
413
  ## Activity Log Conventions
414
414
 
@@ -36,14 +36,14 @@ const override = defineOrganizationModel({
36
36
  label: 'Dashboard',
37
37
  enabled: true,
38
38
  path: '/',
39
- icon: 'dashboard',
39
+ icon: 'feature.dashboard',
40
40
  uiPosition: 'sidebar-primary'
41
41
  },
42
42
  {
43
43
  id: 'sales',
44
44
  label: 'Sales',
45
45
  enabled: true,
46
- icon: 'briefcase',
46
+ icon: 'feature.sales',
47
47
  uiPosition: 'sidebar-primary'
48
48
  },
49
49
  {
@@ -71,7 +71,7 @@ Feature field reference:
71
71
  - `description` -- optional settings/help text.
72
72
  - `enabled` -- organization default.
73
73
  - `path` -- route path for leaf nodes. Containers omit it.
74
- - `icon` and `color` -- optional display metadata.
74
+ - `icon` and `color` -- optional display metadata. Use semantic icon tokens such as `feature.dashboard`, `feature.sales`, or project-owned `custom.*` tokens; UI icon libraries are implementation details.
75
75
  - `uiPosition` -- `sidebar-primary` or `sidebar-bottom`; descendants inherit it.
76
76
  - `requiresAdmin` -- hides the node for non-admin members; descendants inherit it.
77
77
  - `devOnly` -- hides the node outside development contexts; descendants inherit it.
@@ -58,7 +58,9 @@ Read the generated contracts before changing typed boundaries:
58
58
 
59
59
  `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
60
60
 
61
- Look for the **CRM Platform Primitives** section. It includes deal stages, deal rows, task shapes, API schemas, action definitions, and the focused CRM workflow adapter map. The broader acquisition/list adapter maps live under **Lead Gen Platform Primitives**.
61
+ Look for the **CRM Platform Primitives** section. It includes deal stages, deal rows, task shapes, API schemas, action definitions, and the focused CRM workflow adapter map. The broader acquisition/list adapter maps live under **Lead Gen Platform Primitives**.
62
+
63
+ Deal list and detail responses include a server-derived `priority` object. Use `deal.priority.bucketKey`, `rank`, `label`, `reason`, `latestActivityAt`, and `nextActionAt` when composing custom deal workspaces or workflow-side follow-up logic instead of re-deriving priority from `updated_at`.
62
64
 
63
65
  ## 1. Extend CRM Navigation or Sidebar
64
66
 
@@ -192,13 +194,15 @@ export const followUpStaleDealsWorkflow: WorkflowDefinition = {
192
194
  outputSchema,
193
195
  next: null,
194
196
  handler: async (input) => {
195
- const deals = await crm.listDeals({ stage: input.stage })
196
-
197
- for (const deal of deals) {
198
- await crm.createDealTask({
199
- dealId: deal.id,
200
- title: 'Follow up',
201
- kind: 'email'
197
+ const deals = await crm.listDeals({ stage: input.stage })
198
+
199
+ for (const deal of deals) {
200
+ if (!['follow_up_due', 'stale'].includes(deal.priority.bucketKey)) continue
201
+
202
+ await crm.createDealTask({
203
+ dealId: deal.id,
204
+ title: 'Follow up',
205
+ kind: 'email'
202
206
  })
203
207
  await crm.recordActivity({
204
208
  dealId: deal.id,