@elevasis/sdk 0.4.8 → 0.4.10

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/templates.js CHANGED
@@ -1,4 +1,4 @@
1
- // src/cli/commands/init.ts
1
+ // package.json
2
2
  function gitignoreTemplate() {
3
3
  return `node_modules/
4
4
  .env
@@ -59,6 +59,7 @@ proactivity -- to their assessed levels.
59
59
  | Credential model | \`reference/security/credentials.mdx\` | Setting up integrations or tool access |
60
60
  | Interaction guidance | \`reference/developer/interaction-guidance.mdx\` | Unsure how to adapt for a skill combination |
61
61
  | Error history | \`.claude/memory/errors/index.md\` | Debugging errors, checking past fixes |
62
+ | Command View model | \`reference/deployment/command-view.mdx\` | Deploying or building resources that invoke other resources |
62
63
  | SDK error reference | \`reference/troubleshooting/common-errors.mdx\` | Unknown error not in workspace memory |
63
64
  | Project resource map | \`docs/navigation.mdx\` | Understanding what's deployed |
64
65
  | Project priorities | \`docs/priorities.mdx\` | Deciding what to work on next |
@@ -70,12 +71,15 @@ All \`reference/\` paths resolve to \`node_modules/@elevasis/sdk/reference/\`.
70
71
  ## Rules
71
72
 
72
73
  - All resource definitions must be in \`src/\` and exported via \`src/index.ts\`
74
+ - Organize resources by business domain (e.g., src/operations/, src/acquisition/)
75
+ - Each domain exports \`workflows\` and \`agents\` arrays via an index.ts barrel
76
+ - src/shared/ is for cross-domain utilities; domain-specific shared code goes in <domain>/shared/
73
77
  - The default export must be an \`OrganizationResources\` object
74
78
  - Do not import from \`@repo/core\` -- use \`@elevasis/sdk\` types only
75
79
  - \`StepType\`, \`ExecutionError\`, \`ToolingError\` are runtime imports from \`'@elevasis/sdk'\`
76
80
  - \`platform\`, \`PlatformToolError\` are runtime imports from \`'@elevasis/sdk/worker'\`
77
81
  - \`.env\` is for CLI authentication only (\`ELEVASIS_API_KEY\`) -- never deployed, never in workers
78
- - Integration credentials are managed via the platform credential system (command center UI)
82
+ - Integration credentials are managed via the \`creds\` skill (auto-triggers when you mention credentials) or the Command Center UI
79
83
  - Documentation goes in \`docs/\` as \`.mdx\` files
80
84
  - \`dist/\` is generated by deploy -- never commit it
81
85
  - \`resourceId\` must be lowercase with hyphens, unique per organization
@@ -109,7 +113,8 @@ For detailed per-dimension adaptation rules, read
109
113
  | Command | Purpose |
110
114
  | --- | --- |
111
115
  | \`/meta\` | Project lifecycle: init, status, update, fix, deploy, health, develop |
112
- | \`/docs\` | Documentation lifecycle: create, checkpoint, cleanup, resume, verify |
116
+ | \`/docs\` | Documentation lifecycle: create, review, verify |
117
+ | \`/work\` | Task tracking: start, save, resume, done, list |
113
118
  | \`/database\` | Database operations: init, browse, query, schema, import |
114
119
  | \`/resource\` | Scaffold a new workflow or agent |
115
120
  | \`/templates\` | Discover and apply workflow templates |
@@ -118,6 +123,14 @@ For detailed per-dimension adaptation rules, read
118
123
  | \`/help\` | Command tree and navigation map |
119
124
  | \`/profile\` | View and update developer profile |
120
125
 
126
+ ## Skills
127
+
128
+ Skills auto-trigger based on conversation context. You do not need to invoke them manually.
129
+
130
+ | Skill | Triggers When |
131
+ | --- | --- |
132
+ | \`creds\` | You mention credentials, API keys, secrets, webhook secrets, or setting up integrations |
133
+
121
134
  ## Maintaining Memory
122
135
 
123
136
  ### What Memory Is
@@ -162,7 +175,7 @@ You are a documentation assistant for this Elevasis workspace.
162
175
  ## Context
163
176
 
164
177
  Read the project's CLAUDE.md and all files in docs/ to understand the project.
165
- Read src/index.ts and src/workflows/ to understand the resource definitions.
178
+ Read src/index.ts and the domain directories (src/operations/, src/example/, etc.) to understand the resource definitions.
166
179
 
167
180
  ## Operations
168
181
 
@@ -176,21 +189,6 @@ Populate with content based on the resource definitions in src/.
176
189
  **\`review\`:** Review all docs/ files for accuracy against the actual resource
177
190
  definitions. Flag mismatches between documented schemas and code.
178
191
 
179
- **\`checkpoint\`:** Save current work progress for session resume.
180
- Create or update \`docs/in-progress/<topic>.mdx\` with:
181
- - Current state and decisions made
182
- - Remaining work and blockers
183
- - Update \`docs/priorities.mdx\` with task status
184
-
185
- **\`cleanup\`:** Move completed documents from \`docs/in-progress/\` to their
186
- final location in \`docs/\`. Review each in-progress doc to determine if it's
187
- complete. Incomplete docs remain in \`docs/in-progress/\`.
188
- Also rebuild \`docs/navigation.mdx\` from the current project state.
189
-
190
- **\`resume\`:** Start-of-session command. Review in-progress docs, priorities,
191
- and recent deployment state. Present a summary: what's in progress, what's
192
- blocking, what's next. Offer to continue the highest-priority item.
193
-
194
192
  **\`verify [path]\`:** Cross-reference documentation with the codebase.
195
193
  Read the specified doc (or all docs if no path), compare claims against actual
196
194
  code (resource IDs, schema fields, platform tools used), and report
@@ -205,7 +203,7 @@ You are a resource scaffolding assistant for this Elevasis workspace.
205
203
  ## Context
206
204
 
207
205
  Read CLAUDE.md for navigation to SDK patterns (reference/resources/patterns.mdx).
208
- Read src/index.ts for the registry and src/workflows/ for existing resources.
206
+ Read src/index.ts for the registry and domain directories for existing resources.
209
207
 
210
208
  Before suggesting tools, read \`.claude/memory/profile/identity.md\` if it exists
211
209
  to check the user's known integrations and suggest relevant platform tools.
@@ -227,7 +225,7 @@ cannot specify schemas directly.
227
225
 
228
226
  ## Operations
229
227
 
230
- **\`workflow <name>\`:** Create a new workflow in \`src/workflows/<name>.ts\` with:
228
+ **\`workflow <name>\`:** Create a new workflow in the appropriate domain directory (e.g., \`src/<domain>/<name>.ts\`) with:
231
229
  - Zod input/output schemas with \`z.infer\` type aliases
232
230
  - Config object (resourceId, name, type, description, version, status)
233
231
  - Contract with schemas
@@ -244,10 +242,14 @@ cannot specify schemas directly.
244
242
  - Add to \`src/index.ts\` registry
245
243
 
246
244
  **\`tool-step <name>\`:** Create a step that calls a platform tool:
247
- - Import \`{ platform, PlatformToolError }\` from '@elevasis/sdk/worker'
248
- - Use \`await platform.call({ tool, method, params, credential })\`
245
+ - Prefer typed adapters: \`import { createAttioAdapter, scheduler, llm } from '@elevasis/sdk/worker'\`
246
+ - Integration tools: \`const attio = createAttioAdapter('cred'); await attio.listRecords({...})\`
247
+ - Platform singletons: \`await scheduler.createSchedule({...})\`, \`await llm.generate({...})\`
248
+ - Fallback for tools without adapters: \`await platform.call({ tool, method, params, credential })\`
249
+ - Import \`{ PlatformToolError }\` from '@elevasis/sdk/worker' for error handling
249
250
  - Wrap in try/catch for PlatformToolError
250
251
  - Note: 60s timeout per call, credential required for integration tools
252
+ - See reference/platform-tools/adapters.mdx for the full adapter API
251
253
  `;
252
254
  }
253
255
  function claudeTutorialCommandTemplate() {
@@ -280,8 +282,9 @@ Each lesson follows this flow:
280
282
  ## Lessons
281
283
 
282
284
  **Lesson 1: Welcome & Orientation**
283
- Tour project files: src/index.ts (registry), src/workflows/echo.ts (starter
284
- workflow), elevasis.config.ts, .env, docs/. Explain the execution model.
285
+ Tour project files: src/index.ts (registry), src/example/echo.ts (starter
286
+ workflow), src/operations/platform-status.ts (platform API example),
287
+ elevasis.config.ts, .env, docs/. Explain the execution model.
285
288
  Verify: run \`elevasis resources\`. Observation focus: cloud deployment model.
286
289
 
287
290
  **Lesson 2: Your First Custom Workflow**
@@ -299,7 +302,10 @@ Observation focus: optional fields, types, suggesting own fields.
299
302
  **Lesson 4: Using Platform Tools**
300
303
  Explain platform tools (concepts page). Browse available tools via
301
304
  reference/platform-tools/index.mdx. Pick a tool based on user's goals.
302
- Build: add a platform.call() step. Explain credential setup.
305
+ Build: add a tool step using typed adapters (preferred) or platform.call().
306
+ Show adapter pattern: \`const attio = createAttioAdapter('cred')\`.
307
+ Show singleton pattern: \`import { scheduler, llm } from '@elevasis/sdk/worker'\`.
308
+ Explain credential setup. See reference/platform-tools/adapters.mdx for full API.
303
309
  Observation focus: credential model, async/await.
304
310
 
305
311
  **Lesson 5: Multi-Step Workflows**
@@ -360,11 +366,17 @@ Available Commands:
360
366
  /docs Documentation lifecycle
361
367
  /docs Show documentation status
362
368
  /docs create Create new documentation page
363
- /docs checkpoint Save progress for session resume
364
- /docs cleanup Move completed docs, rebuild navigation maps
365
- /docs resume Review in-progress work and priorities
369
+ /docs review Review docs for accuracy
366
370
  /docs verify Cross-reference docs with codebase for accuracy
367
371
 
372
+ /work Task tracking
373
+ /work Show current tasks
374
+ /work start Create new task
375
+ /work save Save progress for session resume
376
+ /work resume Resume in-progress work
377
+ /work done Complete and move task
378
+ /work list List all tasks with status
379
+
368
380
  /database Database operations
369
381
  /database init Connect Supabase project
370
382
  /database browse Query and display table contents
@@ -416,7 +428,7 @@ Read \`.claude/memory/profile/skills.md\` to adapt generated code to skill level
416
428
 
417
429
  **\`/templates apply <name>\`:** Generate a workflow from the template:
418
430
  1. Read the template definition from reference/templates/<name>.mdx
419
- 2. Generate a workflow file in src/workflows/<name>.ts
431
+ 2. Generate a workflow file in the appropriate domain directory
420
432
  3. Add the import to src/index.ts registry
421
433
  4. If the template uses platform tools, prompt for credential setup
422
434
  5. If the template uses the database, check that /database init has been run
@@ -491,14 +503,14 @@ You are an agent development assistant for this Elevasis workspace.
491
503
 
492
504
  Agent definitions are accepted by the SDK and appear in the registry.
493
505
  Autonomous agent execution (multi-turn tool use loops) is deferred.
494
- LLM calls are available via \`platform.call({ tool: 'llm' })\` as a workaround.
506
+ LLM calls are available via the \`llm\` typed adapter: \`import { llm } from '@elevasis/sdk/worker'\`, then \`await llm.generate({ messages: [...] })\`.
495
507
 
496
508
  ## Operations
497
509
 
498
510
  **\`/agent\` (no args):** Explain the current state:
499
511
  - Agent definitions are accepted by the SDK and appear in the registry
500
512
  - Autonomous agent execution (multi-turn tool use loops) is deferred
501
- - LLM calls are available via platform.call({ tool: 'llm' }) as a workaround
513
+ - LLM calls are available via the \`llm\` typed adapter (\`import { llm } from '@elevasis/sdk/worker'\`)
502
514
  - Show the AgentDefinition pattern for future use
503
515
 
504
516
  **\`/agent scaffold <name>\`:** Create an agent definition with:
@@ -655,6 +667,9 @@ Detect and repair drift without a version upgrade:
655
667
 
656
668
  ### \`/meta deploy\` -- Full Deploy Pipeline
657
669
 
670
+ 0. Read \`reference/deployment/command-view.mdx\` -- understand the Command View
671
+ model, relationship declarations, and what deploy-time validation checks.
672
+ This context is essential for diagnosing validation failures in steps 1-2.
658
673
  1. Run \`elevasis check\` (validation)
659
674
  2. Type check if \`tsconfig.json\` exists
660
675
  3. Verify docs reflect current resources
@@ -666,6 +681,8 @@ Detect and repair drift without a version upgrade:
666
681
  9. If git configured and remote exists: optionally push
667
682
 
668
683
  Each step reports its result. Pipeline stops on failure with suggested fix.
684
+ If validation fails with relationship errors, re-read \`reference/deployment/command-view.mdx\`
685
+ for the enforcement model and common fixes.
669
686
 
670
687
  ### \`/meta health\` -- Execution Debugging
671
688
 
@@ -743,5 +760,111 @@ export const echo: WorkflowDefinition = {
743
760
  }
744
761
  `;
745
762
  }
763
+ function platformStatusTemplate() {
764
+ return `import type { WorkflowDefinition } from '@elevasis/sdk'
765
+ import { StepType } from '@elevasis/sdk'
766
+ import { platform } from '@elevasis/sdk/worker'
767
+ import { llm } from '@elevasis/sdk/worker'
768
+ import { z } from 'zod'
769
+
770
+ const input = z.object({
771
+ timeRange: z.enum(['1h', '24h', '7d']).default('24h').describe('Time window for status data'),
772
+ })
773
+
774
+ const statusData = z.object({
775
+ raw: z.unknown().describe('Raw status overview from platform'),
776
+ })
777
+
778
+ const output = z.object({
779
+ raw: z.unknown().describe('Raw status overview from platform'),
780
+ summary: z.string().describe('Natural language status summary'),
781
+ })
782
+
783
+ type Input = z.infer<typeof input>
784
+
785
+ export const platformStatus: WorkflowDefinition = {
786
+ config: {
787
+ resourceId: 'platform-status',
788
+ name: 'Platform Status',
789
+ type: 'workflow',
790
+ description: 'Gathers cross-system platform status and compiles a natural language summary',
791
+ version: '1.0.0',
792
+ status: 'dev',
793
+ },
794
+ contract: { inputSchema: input, outputSchema: output },
795
+ steps: {
796
+ 'gather-status': {
797
+ id: 'gather-status',
798
+ name: 'Gather Status',
799
+ description: 'Queries platform status overview (executions, pending items, schedules, credentials)',
800
+ handler: async (rawInput) => {
801
+ const { timeRange } = rawInput as Input
802
+ const raw = await platform.call({
803
+ tool: 'status',
804
+ method: 'overview',
805
+ params: { timeRange },
806
+ })
807
+ return { raw }
808
+ },
809
+ inputSchema: input,
810
+ outputSchema: statusData,
811
+ next: { type: StepType.LINEAR, target: 'compile-report' },
812
+ },
813
+ 'compile-report': {
814
+ id: 'compile-report',
815
+ name: 'Compile Report',
816
+ description: 'Generates a natural language summary from raw status data',
817
+ handler: async (rawInput) => {
818
+ const { raw } = rawInput as z.infer<typeof statusData>
819
+ const result = await llm.generate({
820
+ provider: 'google',
821
+ model: 'gemini-3-flash-preview',
822
+ messages: [
823
+ {
824
+ role: 'user',
825
+ content: [
826
+ 'Summarize this platform status overview in 3-5 concise bullet points.',
827
+ 'Focus on: execution health, pending items needing attention, upcoming schedules, and credential coverage.',
828
+ 'Be specific with numbers. Flag any issues.',
829
+ '',
830
+ JSON.stringify(raw, null, 2),
831
+ ].join('\\n'),
832
+ },
833
+ ],
834
+ responseSchema: {
835
+ type: 'object',
836
+ properties: {
837
+ summary: { type: 'string', description: 'Natural language status summary with bullet points' },
838
+ },
839
+ required: ['summary'],
840
+ },
841
+ temperature: 0,
842
+ })
843
+ const summary = (result as any)?.summary ?? String(result)
844
+ return { raw, summary }
845
+ },
846
+ inputSchema: statusData,
847
+ outputSchema: output,
848
+ next: null,
849
+ },
850
+ },
851
+ entryPoint: 'gather-status',
852
+ }
853
+ `;
854
+ }
855
+ function operationsBarrelTemplate() {
856
+ return `import { platformStatus } from './platform-status.js'
857
+
858
+ export const workflows = [platformStatus]
859
+ export const agents = []
860
+ `;
861
+ }
862
+ function exampleBarrelTemplate() {
863
+ return `import { echo } from './echo.js'
864
+
865
+ export const workflows = [echo]
866
+ export const agents = []
867
+ `;
868
+ }
746
869
 
747
- export { claudeAgentCommandTemplate, claudeDatabaseCommandTemplate, claudeDocsCommandTemplate, claudeHelpCommandTemplate, claudeMdTemplate, claudeMetaCommandTemplate, claudeProfileCommandTemplate, claudeResourceCommandTemplate, claudeSettingsTemplate, claudeTemplatesCommandTemplate, claudeTutorialCommandTemplate, gitignoreTemplate, starterWorkflowTemplate };
870
+ export { claudeAgentCommandTemplate, claudeDatabaseCommandTemplate, claudeDocsCommandTemplate, claudeHelpCommandTemplate, claudeMdTemplate, claudeMetaCommandTemplate, claudeProfileCommandTemplate, claudeResourceCommandTemplate, claudeSettingsTemplate, claudeTemplatesCommandTemplate, claudeTutorialCommandTemplate, exampleBarrelTemplate, gitignoreTemplate, operationsBarrelTemplate, platformStatusTemplate, starterWorkflowTemplate };
@@ -1 +1 @@
1
- export { claudeMdTemplate, claudeMetaCommandTemplate, claudeProfileCommandTemplate, claudeDocsCommandTemplate, claudeResourceCommandTemplate, claudeTutorialCommandTemplate, claudeHelpCommandTemplate, claudeTemplatesCommandTemplate, claudeDatabaseCommandTemplate, claudeAgentCommandTemplate, gitignoreTemplate, claudeSettingsTemplate, starterWorkflowTemplate, } from './cli/commands/init.js';
1
+ export { claudeMdTemplate, claudeMetaCommandTemplate, claudeProfileCommandTemplate, claudeDocsCommandTemplate, claudeResourceCommandTemplate, claudeTutorialCommandTemplate, claudeHelpCommandTemplate, claudeTemplatesCommandTemplate, claudeDatabaseCommandTemplate, claudeAgentCommandTemplate, gitignoreTemplate, claudeSettingsTemplate, starterWorkflowTemplate, platformStatusTemplate, operationsBarrelTemplate, exampleBarrelTemplate, } from './cli/commands/init.js';
@@ -8,8 +8,13 @@
8
8
  * Parent -> Worker: { type: 'manifest' }
9
9
  * Worker -> Parent: { type: 'manifest', workflows: [...], agents: [...] }
10
10
  *
11
- * Parent -> Worker: { type: 'execute', resourceId, executionId, input, organizationId?, organizationName? }
12
- * Worker -> Parent: { type: 'result', status, output?, error?, logs }
11
+ * Parent -> Worker: { type: 'execute', resourceId, executionId, input, organizationId?, organizationName?,
12
+ * sessionId?, sessionTurnNumber?, parentExecutionId?, executionDepth }
13
+ * Worker -> Parent: { type: 'result', status, output?, error?, logs, metrics: { durationMs } }
14
+ *
15
+ * Parent -> Worker: { type: 'abort' } (graceful abort before terminate)
16
+ *
17
+ * Worker -> Parent: { type: 'log', entry: { level, message, timestamp, executionId } }
13
18
  *
14
19
  * Worker -> Parent: { type: 'tool-call', id, tool, method, params, credential? }
15
20
  * Parent -> Worker: { type: 'tool-result', id, result?, error?, code? }
@@ -22,4 +27,5 @@
22
27
  import type { OrganizationResources } from '../index.js';
23
28
  export { platform, PlatformToolError } from './platform.js';
24
29
  export type { PlatformCredential } from './platform.js';
30
+ export * from './adapters/index.js';
25
31
  export declare function startWorker(org: OrganizationResources): void;