@elevasis/sdk 1.55.0 → 1.57.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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/dist/{chunk-72ZGICTR.js → chunk-3XEHBMWM.js} +1 -1
  4. package/dist/{chunk-R3J6BEPO.js → chunk-HDMMMDIR.js} +225 -67
  5. package/dist/cli.cjs +209 -109
  6. package/dist/index.d.ts +82 -20
  7. package/dist/index.js +1 -1
  8. package/dist/node/index.d.ts +1 -8
  9. package/dist/node/index.js +3 -14
  10. package/dist/test-utils/index.js +2 -2
  11. package/dist/worker/index.js +2 -2
  12. package/package.json +2 -2
  13. package/reference/_navigation.md +4 -4
  14. package/reference/_reference-manifest.json +3 -3
  15. package/reference/index.mdx +1 -1
  16. package/reference/packages/ui/src/knowledge/README.md +32 -32
  17. package/reference/rules/agent-start-here.md +1 -1
  18. package/reference/rules/error-handling.md +50 -1
  19. package/reference/rules/execution.md +63 -7
  20. package/reference/rules/organization-model.md +3 -2
  21. package/reference/scaffold/recipes/customize-crm-actions.md +231 -223
  22. package/reference/scaffold/recipes/customize-organization-model.md +3 -1
  23. package/reference/scaffold/recipes/extend-crm.md +4 -2
  24. package/reference/scaffold/recipes/extend-lead-gen.md +2 -2
  25. package/reference/scaffold/recipes/index.md +2 -2
  26. package/reference/scaffold/reference/contracts.md +49 -12
  27. package/reference/scaffold/reference/system-interface-capabilities.md +4 -4
  28. package/reference/sdk/cli-management.mdx +0 -4
  29. package/reference/sdk/cli.mdx +0 -4
  30. package/reference/sdk/concepts.mdx +0 -4
  31. package/reference/sdk/deployment/command-center.mdx +0 -4
  32. package/reference/sdk/framework/agent.mdx +0 -4
  33. package/reference/sdk/framework/index.mdx +0 -4
  34. package/reference/sdk/framework/project-structure.mdx +1 -7
  35. package/reference/sdk/getting-started.mdx +0 -4
  36. package/reference/sdk/index.mdx +4 -8
  37. package/reference/sdk/platform-tools/index.mdx +0 -4
  38. package/reference/sdk/resources/index.mdx +0 -4
  39. package/reference/sdk/resources/patterns.mdx +0 -4
  40. package/reference/sdk/runtime.mdx +0 -4
  41. package/reference/sdk/templates/data-enrichment.mdx +0 -4
  42. package/reference/sdk/templates/email-sender.mdx +0 -4
  43. package/reference/sdk/templates/index.mdx +0 -4
  44. package/reference/sdk/templates/lead-scorer.mdx +0 -4
  45. package/reference/sdk/templates/pdf-generator.mdx +0 -4
  46. package/reference/sdk/templates/recurring-job.mdx +0 -4
  47. package/reference/sdk/templates/text-classifier.mdx +0 -4
  48. package/reference/sdk/templates/web-scraper.mdx +0 -4
  49. package/reference/sdk/troubleshooting.mdx +0 -4
  50. package/reference/ui/exports.mdx +1 -1
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ProspectingBuildTemplateSchema as BuildTemplateSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, bindResourceDescriptor, compileBusinessOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineSingleStepWorkflow, defineTopology, defineTopologyRelationship, defineWorkflowConfig, deriveActions, diagnosticOutput, integrationInput, isBuiltInReadinessProfile, isZodType, lookupReadinessProfile, parseTopologyNodeRef, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, topologyRef, topologyRelationship, validateDeclaredSystemInterfaceReadiness, validateResourceGovernance } from './chunk-R3J6BEPO.js';
1
+ export { ActivityEventSchema, BuildPlanSnapshotStepSchema, ProspectingBuildTemplateSchema as BuildTemplateSchema, ContractRefResolutionError, CrmStageKeySchema, CrmStateKeySchema, EmailSchema, ExecutionError, ListBuilderStageKeySchema, ProcessingStageStatusSchema, RegistryValidationError, ResourceRegistry, StepType, ToolingError, bindResourceDescriptor, compileBusinessOntologyValidationIndex, compileCrmActionCatalog, compileCrmApiOntologyValidationIndex, concurrentPool, createLeadGenStageValidators, defineContract, defineResource, defineResourceOntology, defineResources, defineSingleStepWorkflow, defineTopology, defineTopologyRelationship, defineWorkflowConfig, deriveCompiledCrmActions, diagnosticOutput, integrationInput, isBuiltInReadinessProfile, isCompiledCrmActionAvailable, isZodType, lookupReadinessProfile, parseTopologyNodeRef, registerReadinessProfile, resolveContractRef, runDiagnostic, splitName, topologyRef, topologyRelationship, validateDeclaredSystemInterfaceReadiness, validateResourceGovernance } from './chunk-HDMMMDIR.js';
2
2
  export { projectDeploymentSpec, projectTopologyRelationships, toSdkResourceDescriptor, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors } from './chunk-QF2RNYYX.js';
@@ -44,15 +44,8 @@ interface KnowledgeNodeInput {
44
44
  summary: string;
45
45
  body: string;
46
46
  }
47
- interface KnowledgeSearchEntry {
48
- id: string;
49
- title: string;
50
- summary: string;
51
- bodyText: string;
52
- }
53
47
  interface CodegenResult {
54
48
  bodiesTsx: string;
55
- searchIndex: KnowledgeSearchEntry[];
56
49
  }
57
50
  /**
58
51
  * Compiles knowledge nodes into generated file contents.
@@ -71,4 +64,4 @@ interface ResolvedKnowledgeLayout {
71
64
  declare function runKnowledgeCodegen(layout: ResolvedKnowledgeLayout): Promise<void>;
72
65
 
73
66
  export { generateKnowledgeBodies, generateKnowledgeNodes, generateKnowledgeNodesTs, readKnowledgeNodeMdx, runKnowledgeCodegen };
74
- export type { CodegenResult, GenerateKnowledgeNodesOptions, GenerateKnowledgeNodesResult, KnowledgeCodegenNode, KnowledgeKind, KnowledgeNodeInput, KnowledgeSearchEntry, ResolvedKnowledgeLayout };
67
+ export type { CodegenResult, GenerateKnowledgeNodesOptions, GenerateKnowledgeNodesResult, KnowledgeCodegenNode, KnowledgeKind, KnowledgeNodeInput, ResolvedKnowledgeLayout };
@@ -393,9 +393,6 @@ To add a component:
393
393
  );
394
394
  }
395
395
  }
396
- function stripToPlainText(body) {
397
- return body.replace(/^(import|export)\s+.+$/gm, "").replace(/<[A-Z][^>]*>/g, "").replace(/<\/[A-Z][^>]*>/g, "").replace(/^#{1,6}\s+/gm, "").replace(/[*_`~]/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\n{3,}/g, "\n\n").trim();
398
- }
399
396
  var BODIES_HEADER = [
400
397
  "// @generated by generate-knowledge-bodies -- DO NOT EDIT",
401
398
  "// Regenerate: pnpm scaffold:sync",
@@ -457,11 +454,10 @@ async function generateKnowledgeBodies(nodes) {
457
454
  "> = {}",
458
455
  ""
459
456
  ].join("\n");
460
- return { bodiesTsx: bodiesTsx2, searchIndex: [] };
457
+ return { bodiesTsx: bodiesTsx2 };
461
458
  }
462
459
  const nodeComments = [];
463
460
  const mapEntries = [];
464
- const searchIndex = [];
465
461
  for (const node of nodes) {
466
462
  if (/^(import|export)\s+/m.test(node.body)) {
467
463
  throw new Error(
@@ -475,15 +471,13 @@ async function generateKnowledgeBodies(nodes) {
475
471
  });
476
472
  const fnBodyCode = String(compiled);
477
473
  validateComponents(node.id, fnBodyCode);
478
- const bodyText = stripToPlainText(node.body);
479
- searchIndex.push({ id: node.id, title: node.title, summary: node.summary, bodyText });
480
474
  nodeComments.push(`// Node: ${node.id} (${node.kind})`);
481
475
  mapEntries.push(` '${node.id}': makeKnowledgeComponent(${JSON.stringify(fnBodyCode)})`);
482
476
  }
483
477
  const mapBlock = `export const KNOWLEDGE_BODIES: Record<string, ComponentType<KnowledgeBodyProps>> = {
484
478
  ` + mapEntries.join(",\n") + "\n}\n";
485
479
  const bodiesTsx = BODIES_HEADER + FACTORY_BLOCK + MAP_HEADER + (nodeComments.length > 0 ? nodeComments.join("\n") + "\n\n" : "") + mapBlock;
486
- return { bodiesTsx, searchIndex };
480
+ return { bodiesTsx };
487
481
  }
488
482
  async function runKnowledgeCodegen(layout) {
489
483
  let nodes;
@@ -504,14 +498,9 @@ async function runKnowledgeCodegen(layout) {
504
498
  });
505
499
  nodes = result.nodes;
506
500
  }
507
- const { bodiesTsx, searchIndex } = await generateKnowledgeBodies(nodes);
501
+ const { bodiesTsx } = await generateKnowledgeBodies(nodes);
508
502
  mkdirSync(layout.generatedDir, { recursive: true });
509
503
  writeFileSync(resolve(layout.generatedDir, "knowledge-bodies.tsx"), bodiesTsx, "utf8");
510
- writeFileSync(
511
- resolve(layout.generatedDir, "knowledge-search-index.json"),
512
- JSON.stringify(searchIndex, null, 2) + "\n",
513
- "utf8"
514
- );
515
504
  }
516
505
 
517
506
  export { generateKnowledgeBodies, generateKnowledgeNodes, generateKnowledgeNodesTs, readKnowledgeNodeMdx, runKnowledgeCodegen };
@@ -1,5 +1,5 @@
1
- import { executeWorkflow } from '../chunk-72ZGICTR.js';
2
- import { validateDeploymentSpec, validateRelationships } from '../chunk-R3J6BEPO.js';
1
+ import { executeWorkflow } from '../chunk-3XEHBMWM.js';
2
+ import { validateDeploymentSpec, validateRelationships } from '../chunk-HDMMMDIR.js';
3
3
  import '../chunk-QF2RNYYX.js';
4
4
  import { vi } from 'vitest';
5
5
 
@@ -1,3 +1,3 @@
1
- export { ListBuilderResultSchema, ListBuilderResultsSchema, PlatformToolError, acqDb, approval, artifacts, classifyPlatformToolError, content, createAdapter, createAnymailfinderAdapter, createApifyAdapter, createAttioAdapter, createCaptionGenerationWorkflow, createCaptureInstagramMetricsWorkflow, createClickUpAdapter, createDropboxAdapter, createGmailAdapter, createGoogleSheetsAdapter, createImageAnalysisWorkflow, createInstagramAdapter, createInstantlyAdapter, createMillionVerifierAdapter, createPublishInstagramWorkflow, createResendAdapter, createSignatureApiAdapter, createStripeAdapter, createTombaAdapter, crm, email, executeWorkflow, execution, generateHmacToken, list, listBuilderWorkflow, llm, notifications, pdf, platform, projects, scheduler, startWorker, storage, toContentMetrics } from '../chunk-72ZGICTR.js';
2
- import '../chunk-R3J6BEPO.js';
1
+ export { ListBuilderResultSchema, ListBuilderResultsSchema, PlatformToolError, acqDb, approval, artifacts, classifyPlatformToolError, content, createAdapter, createAnymailfinderAdapter, createApifyAdapter, createAttioAdapter, createCaptionGenerationWorkflow, createCaptureInstagramMetricsWorkflow, createClickUpAdapter, createDropboxAdapter, createGmailAdapter, createGoogleSheetsAdapter, createImageAnalysisWorkflow, createInstagramAdapter, createInstantlyAdapter, createMillionVerifierAdapter, createPublishInstagramWorkflow, createResendAdapter, createSignatureApiAdapter, createStripeAdapter, createTombaAdapter, crm, email, executeWorkflow, execution, generateHmacToken, list, listBuilderWorkflow, llm, notifications, pdf, platform, projects, scheduler, startWorker, storage, toContentMetrics } from '../chunk-3XEHBMWM.js';
2
+ import '../chunk-HDMMMDIR.js';
3
3
  import '../chunk-QF2RNYYX.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "1.55.0",
3
+ "version": "1.57.0",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -63,8 +63,8 @@
63
63
  "typescript": "5.9.2",
64
64
  "vitest": "^3.2.4",
65
65
  "zod": "^4.1.0",
66
- "@repo/core": "0.71.0",
67
66
  "@repo/eslint-config": "0.0.0",
67
+ "@repo/core": "0.73.0",
68
68
  "@repo/typescript-config": "0.0.0"
69
69
  },
70
70
  "license": "MIT",
@@ -162,7 +162,7 @@ Package entries indexed: 63.
162
162
  | Theme | `packages/ui/src/theme/README.md` | Published theme entry for downstream applications. | (not specified) |
163
163
  | Graph | `packages/ui/src/graph/README.md` | Published graph helper and visualization entry. | (not specified) |
164
164
  | Theme Presets | `packages/ui/src/theme/presets/README.md` | Published THEME_PRESETS tuple, ThemePresetName union, and ThemePresetEnum Zod enum, defined locally and kept manually aligned with the canonical list in packages/core/src/auth/multi-tenancy/theme-presets.ts. | (not specified) |
165
- | Knowledge | `packages/ui/src/knowledge/README.md` | Published knowledge browser primitives: Browser, Tree, NodeList, NodeView, SearchBar, MDX provider, and the generated KNOWLEDGE_BODIES map. | (not specified) |
165
+ | Knowledge | `packages/ui/src/knowledge/README.md` | Published knowledge browser primitives: Browser, Tree, NodeList, NodeView, SearchBar, MDX provider, and the KnowledgeBodiesMap type. Machinery only -- each consumer supplies its own compiled corpus via the required knowledgeBodies prop. | (not specified) |
166
166
 
167
167
  ---
168
168
 
@@ -194,7 +194,7 @@ Universal scaffold documentation for all SDK projects. Source locations are co-l
194
194
  | Build and Extend CRM | `scaffold/recipes/extend-crm.md` | Map the CRM platform primitives available to SDK projects: shared UI pages, sidebar composition, data hooks, action definitions, workflow adapters, System Interfaces, and org-model extension boundaries. |
195
195
  | Build and Extend Lead Gen | `scaffold/recipes/extend-lead-gen.md` | Map the lead-gen platform primitives available to SDK projects: shared UI pages, provider-injected Organization Model config, data hooks, list/member state, artifacts, workflow adapters, System Interfaces, and tenant-owned extension boundaries. |
196
196
  | Build and Extend Content | `scaffold/recipes/extend-content.md` | Map the content platform primitives available to SDK projects: pipeline and step catalogs, shared review/pipeline/distribution pages, data hooks, the content workflow adapter, and org-model extension boundaries. |
197
- | Customize CRM Actions | `scaffold/recipes/customize-crm-actions.md` | Add, hide, or replace CRM deal action buttons in a template-derived project, and override default platform action workflows with project-owned implementations. |
197
+ | Customize CRM Actions | `scaffold/recipes/customize-crm-actions.md` | Add, hide, reorder, or re-implement CRM deal action buttons by authoring them in your project's Organization Model and deploying the workflows they dispatch to. |
198
198
  | Customize Knowledge Browser | `scaffold/recipes/customize-knowledge-browser.md` | Author knowledge nodes and customize the Knowledge Browser in a template-derived project -- from zero-config authoring through sidebar composition, custom dispatchers, and direct query access. |
199
199
  | Query the Knowledge Graph | `scaffold/recipes/query-the-knowledge-graph.md` | Use the `knowledge:*` CLI subcommands on `elevasis-sdk` (external projects) and `elevasis` (monorepo) to browse, inspect, and traverse the OrganizationModel knowledge graph via six mount axes. |
200
200
  | Workflow Recipes | `scaffold/operations/workflow-recipes.md` | Anatomy of a workflow, adapter usage, and trigger patterns -- runnable email-notification example replaces the trivial echo workflow. Resolves eval score 2/5 on workflow authoring. |
@@ -226,9 +226,9 @@ Agent rules indexed: 19.
226
226
  | Platform | `rules/platform.md` | Platform conventions -- SDK workflows, agents, deployment, resource registry | Authoring a workflow or agent definition, or registering a resource in the registry. |
227
227
  | Deployment | `rules/deployment.md` | Deployment workflow -- check-first, dev vs prod, version bumping, common errors | Before any deploy -- a plain `run deploy` targets production by default. |
228
228
  | Content | `rules/content.md` | Building the content System behind the shipped pipeline, item, and distribution routes -- which recipe to read, and the catalog vocabulary that is model-owned rather than coded | Editing anything under `ui/src/routes/content/` -- items, pipelines, distributions, or a review gate. |
229
- | Execution Model | `rules/execution.md` | Execution model -- timeouts, memory, concurrency, org isolation, runtime constraints | Hitting a timeout, memory ceiling, concurrency limit, or org-isolation question at runtime. |
229
+ | Execution Model | `rules/execution.md` | Execution model -- per-step and agent timeouts, spend ceilings, memory, concurrency, org isolation | Hitting a timeout, memory ceiling, concurrency limit, or org-isolation question at runtime. |
230
230
  | Agent Runtime | `rules/agent-runtime.md` | Agent runtime behavior -- iteration response shape, session memory and replay, prose normalization, and why a redeploy is what makes a platform fix live | Debugging an agent turn -- a missing reply, a corrupted one, a session that forgot, or an unenforced schema. |
231
- | Error Handling | `rules/error-handling.md` | Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry | Writing or debugging a step handler that throws, catches, or retries. |
231
+ | Error Handling | `rules/error-handling.md` | Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry, /api/external error envelope | Writing or debugging a step handler that throws, catches, or retries. |
232
232
  | Observability | `rules/observability.md` | Observability -- context.logger API, execution inspection, step-level context | Adding logging to a step handler, or inspecting a past execution. |
233
233
 
234
234
  ### Orientation
@@ -875,7 +875,7 @@
875
875
  "subpath": "./knowledge",
876
876
  "kind": "subpath",
877
877
  "title": "Knowledge",
878
- "description": "Published knowledge browser primitives: Browser, Tree, NodeList, NodeView, SearchBar, MDX provider, and the generated KNOWLEDGE_BODIES map.",
878
+ "description": "Published knowledge browser primitives: Browser, Tree, NodeList, NodeView, SearchBar, MDX provider, and the KnowledgeBodiesMap type. Machinery only -- each consumer supplies its own compiled corpus via the required knowledgeBodies prop.",
879
879
  "group": "Visual",
880
880
  "order": 3,
881
881
  "sourcePath": "packages/ui/src/knowledge/index.ts",
@@ -948,7 +948,7 @@
948
948
  {
949
949
  "packageName": "@elevasis/sdk",
950
950
  "title": "Execution Model",
951
- "description": "Execution model -- timeouts, memory, concurrency, org isolation, runtime constraints",
951
+ "description": "Execution model -- per-step and agent timeouts, spend ceilings, memory, concurrency, org isolation",
952
952
  "group": "Operations",
953
953
  "order": 4,
954
954
  "loadWhen": "Hitting a timeout, memory ceiling, concurrency limit, or org-isolation question at runtime.",
@@ -968,7 +968,7 @@
968
968
  {
969
969
  "packageName": "@elevasis/sdk",
970
970
  "title": "Error Handling",
971
- "description": "Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry",
971
+ "description": "Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry, /api/external error envelope",
972
972
  "group": "Operations",
973
973
  "order": 6,
974
974
  "loadWhen": "Writing or debugging a step handler that throws, catches, or retries.",
@@ -33,7 +33,7 @@ You do not need all three packages. A pure automation project needs only `@eleva
33
33
 
34
34
  ### @elevasis/sdk (v1.48.0)
35
35
 
36
- The primary developer package. Provides the TypeScript API for defining workflows and agents, the `elevasis-sdk` CLI for validation and deployment, and typed worker adapters for 27 platform and integration tools.
36
+ The primary developer package. Provides the TypeScript API for defining workflows and agents, the `elevasis-sdk` CLI for validation and deployment, and typed worker adapters for 28 platform and integration tools.
37
37
 
38
38
  **Install:** `pnpm add @elevasis/sdk`
39
39
 
@@ -1,33 +1,33 @@
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`. |
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 built in-memory from the live `knowledgeNodes` prop. |
14
14
  | `KnowledgeNodeDetailRouteView` | Shared `/knowledge/$nodeId` content route view; apps keep TanStack route adapters and navigation wiring local. |
15
- | `KnowledgeRouteIds` helpers | Decode route ids, resolve Knowledge route targets, and derive route labels for app-local breadcrumbs. |
16
- | `KnowledgeSidebarMiddle` | Deprecated legacy sidebar middle section; active sidebar lives under `features/knowledge/sidebar`. |
17
- | `KNOWLEDGE_ITEMS` | Deprecated default sidebar nav items retained for compatibility. |
18
- | `KnowledgeMDXProvider`, `useKnowledgeAllowlist`, `KNOWLEDGE_ALLOWLIST` | MDX runtime allowlist (`Card`, `Cards`, `Step`, `Steps`, `Callout`, `Tab`, `Tabs`). |
19
- | `KNOWLEDGE_BODIES` | Build-time-compiled MDX components keyed by node id. |
20
-
21
- ## Customization tiers
22
-
23
- 1. **Default** — mount `knowledgeManifest` from `@elevasis/ui/features/knowledge`.
24
- 2. **Extend** — pass `extraComponents` to `KnowledgeMDXProvider` or compose around the feature sidebar primitives.
25
- 3. **Replace** — call `@elevasis/core/knowledge` queries directly from project-owned routes.
26
-
27
- ## Codegen
28
-
29
- `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`.
30
-
31
- The Vite plugin at `@elevasis/ui/vite-plugin-knowledge` re-runs codegen on `buildStart` and watches the OM source dir for HMR.
32
-
33
- Phase 1 is read-only. Phase 2 will move bodies into Supabase and ship via `mdx-bundler`.
15
+ | `KnowledgeRouteIds` helpers | Decode route ids, resolve Knowledge route targets, and derive route labels for app-local breadcrumbs. |
16
+ | `KnowledgeSidebarMiddle` | Deprecated legacy sidebar middle section; active sidebar lives under `features/knowledge/sidebar`. |
17
+ | `KNOWLEDGE_ITEMS` | Deprecated default sidebar nav items retained for compatibility. |
18
+ | `KnowledgeMDXProvider`, `useKnowledgeAllowlist`, `KNOWLEDGE_ALLOWLIST` | MDX runtime allowlist (`Card`, `Cards`, `Step`, `Steps`, `Callout`, `Tab`, `Tabs`). |
19
+ | `KnowledgeBodiesMap` | Type for the compiled MDX-component-by-node-id map. `@elevasis/ui` ships this type only, not a corpus. |
20
+
21
+ ## Customization tiers
22
+
23
+ 1. **Default** — mount `knowledgeManifest` from `@elevasis/ui/features/knowledge`.
24
+ 2. **Extend** — pass `extraComponents` to `KnowledgeMDXProvider` or compose around the feature sidebar primitives.
25
+ 3. **Replace** — call `@elevasis/core/knowledge` queries directly from project-owned routes.
26
+
27
+ ## Codegen
28
+
29
+ This package ships the machinery only, not a compiled corpus. Each consumer generates its own `knowledge-bodies.tsx` (matching `KnowledgeBodiesMap`) beside its own Organization Model and hands it to `ElevasisSystemsProvider` as the required `knowledgeBodies` prop. In the monorepo that lives at `packages/elevasis/core/config/knowledge/_generated/`, sourced from `canonicalOrganizationModel.knowledge.nodes`; in an external project it lives at `<project-root>/core/config/knowledge/_generated/`. Regenerate with `pnpm scaffold:sync` (or `pnpm knowledge:generate` for only the knowledge step).
30
+
31
+ The Vite plugin at `@elevasis/ui/vite-plugin-knowledge` re-runs codegen on `buildStart` and watches the OM source dir for HMR.
32
+
33
+ Phase 1 is read-only. Phase 2 will move bodies into Supabase and ship via `mdx-bundler`.
@@ -103,7 +103,7 @@ Load first:
103
103
  - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
104
104
  - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md`
105
105
  - Typed feature and surface ID constants exported from `@elevasis/core/organization-model` (`SALES_FEATURE_ID`, `PROSPECTING_LISTS_SURFACE_ID`, and the rest). Always use these constants instead of magic strings when overriding feature/surface IDs; the full list is enumerated in `.claude/rules/organization-os.md`.
106
- - The `extend-crm.md`, `extend-lead-gen.md`, and `customize-crm-actions.md` recipes listed under Class 1 -- CRM and lead gen are Organization OS + UI + hooks + workflow-adapter surfaces, and CRM action buttons are not `sales.actions` org-model config in v1 (use the recipe's provider/custom-button path).
106
+ - The `extend-crm.md`, `extend-lead-gen.md`, and `customize-crm-actions.md` recipes listed under Class 1 -- CRM and lead gen are Organization OS + UI + hooks + workflow-adapter surfaces, and CRM deal action buttons come from your own `sales.crm` ontology `actionTypes` records rather than any `sales.actions` field (the recipe shows the record shape and the provider wiring).
107
107
 
108
108
  Then inspect:
109
109
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry
2
+ description: Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry, /api/external error envelope
3
3
  paths:
4
4
  - operations/**
5
5
  ---
@@ -41,6 +41,17 @@ try {
41
41
  }
42
42
  ```
43
43
 
44
+ ## What Your Handler May Throw
45
+
46
+ `ExecutionError` is the class to throw from workflow and agent code. It carries a `context` record
47
+ and an `isRetryable()` the engine reads, which is why it is preferable to a bare `Error` -- a plain
48
+ throw arrives at the platform with no classification and no structured context.
49
+
50
+ Handler code runs in a worker thread, not in an API request. A throw there becomes an **execution
51
+ failure** recorded against the execution -- it never becomes an HTTP response body, so there is no
52
+ status code to pick and no envelope to shape. The envelope below is what you _receive_ when you call
53
+ the platform's own API, not what your handler produces.
54
+
44
55
  ## No Auto-Retry
45
56
 
46
57
  The platform does NOT automatically retry failed steps. Your handler is responsible for retry logic. Check `PlatformToolError.retryable` to decide whether retrying is safe.
@@ -60,6 +71,44 @@ The platform does NOT automatically retry failed steps. Your handler is responsi
60
71
  | `credentials_invalid` | No | Credential not found or expired |
61
72
  | `validation_error` | No | Invalid parameters passed to tool |
62
73
 
74
+ ## Error Bodies From `/api/external/*`
75
+
76
+ Every `/api/external/*` route returns the same error envelope. Tenants are the only consumers of
77
+ these routes, so this is the shape your API-key client parses:
78
+
79
+ ```json
80
+ {
81
+ "error": "human-readable message",
82
+ "code": "VALIDATION_ERROR",
83
+ "requestId": "correlates with server logs",
84
+ "fields": { "newResourceId": ["must differ from oldResourceId"] }
85
+ }
86
+ ```
87
+
88
+ `error` and `code` are always present. `requestId` is present on every error response -- quote it
89
+ when reporting a problem. `fields` appears only when the request body itself failed schema
90
+ validation. `retryAfter` (seconds) accompanies `RATE_LIMIT_EXCEEDED`, and `details` carries a
91
+ structured payload on some conflicts.
92
+
93
+ **`POST /api/external/resources/rename` changed shape -- read `code`, not just `error`.** It used to
94
+ build `{ error, code }` by hand, and then briefly returned `code: "VALIDATION_ERROR"` with a 400 for
95
+ _every_ failure, including ones that were not your fault. It now states the real cause:
96
+
97
+ | Failure | Status | `code` |
98
+ | --------------------------------------------- | ------ | ---------------------------------- |
99
+ | Body fails schema validation | 400 | `VALIDATION_ERROR` (with `fields`) |
100
+ | `newResourceId` already has execution history | 409 | `CONFLICT` |
101
+ | A database query or update failed | 500 | `INTERNAL_SERVER_ERROR` |
102
+
103
+ A client that branched on "400 means my input was wrong" now needs to distinguish 409 (rename to a
104
+ different id) from 500 (retry or report). A client reading only `error` as its diagnostic silently
105
+ loses that distinction -- the message text is not a stable contract, and `code` is.
106
+
107
+ **On any 5xx, `error` is generic by design.** The platform suppresses server-fault messages, so a 500
108
+ reads `"Internal server error"` rather than what actually broke -- that sentence was written for
109
+ whoever fixes the server, and it stays in the server's logs. `requestId` is what joins your failure
110
+ to that log line, so quote it when you report a 5xx rather than the message.
111
+
63
112
  ## CLI Transport Failures
64
113
 
65
114
  These are errors in the CLI you type commands into, not in your handler code. They are worth knowing because the natural reaction to one of them is the wrong reaction.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Execution model -- timeouts, memory, concurrency, org isolation, runtime constraints
2
+ description: Execution model -- per-step and agent timeouts, spend ceilings, memory, concurrency, org isolation
3
3
  paths:
4
4
  - operations/**
5
5
  ---
@@ -15,15 +15,71 @@ Each execution runs in an isolated Node.js worker thread spawned from the deploy
15
15
 
16
16
  ## Constraints
17
17
 
18
- | Constraint | Workflows | Agents |
19
- | ---------- | ------------------------------- | ----------------------------------------------------- |
20
- | Timeout | 300s (5 min) | 600s (10 min, configurable via `constraints.timeout`) |
21
- | Memory | 256MB hard limit | 256MB hard limit |
22
- | Disk | None (no persistent filesystem) | None |
18
+ | Constraint | Workflows | Agents |
19
+ | ---------- | ------------------------------- | ---------------------------------------------- |
20
+ | Timeout | 2h execution ceiling | 2h ceiling, lower it via `constraints.timeout` |
21
+ | Memory | 256MB hard limit | 256MB hard limit |
22
+ | Disk | None (no persistent filesystem) | None |
23
23
 
24
24
  - Platform enforces timeouts -- no handler code needed, worker terminates automatically.
25
25
  - Memory overflow crashes the worker. Other tenants are unaffected.
26
- - For long-running tasks, break work into multiple steps or use agents with extended timeout.
26
+ - The ceiling is a safety net against a runaway loop, not a duration budget. Bound the work you
27
+ actually want bounded with a per-step `timeout` (below) or `constraints.timeout`, rather than
28
+ relying on the ceiling to stop it.
29
+
30
+ ## Per-Step Timeouts
31
+
32
+ A workflow step may declare its own millisecond ceiling:
33
+
34
+ | Field | Applies to | Omitted |
35
+ | ---------------------- | ------------- | ----------------------------------------------------- |
36
+ | `WorkflowStep.timeout` | one step | the step is bounded only by the 2h execution ceiling |
37
+ | `constraints.timeout` | a whole agent | the agent is bounded only by the 2h execution ceiling |
38
+
39
+ `WorkflowConfig` has no `constraints` field on purpose. A per-workflow override would only restate
40
+ the execution ceiling; "this HTTP call should never take more than 5 seconds" is a property of the
41
+ step and has nowhere else to live.
42
+
43
+ **The two timeout failures are not the same failure, and the difference is whether a retry can
44
+ work.** A step that breaches its own `timeout` while the workflow still has budget left fails
45
+ **retryably** -- a slow third-party call is exactly what a retry exists for. A workflow that reaches
46
+ the 2h execution ceiling fails **non-retryably**: there is no budget left to retry inside. Neither
47
+ error class is exported from `@elevasis/sdk`, so branch on your own step's outcome rather than on
48
+ `instanceof`; the retryability distinction is what determines whether re-running is worth anything.
49
+
50
+ Declare a `timeout` on any step that calls something you do not control. Without one, a hung
51
+ integration call holds the whole workflow open for two hours.
52
+
53
+ ## Agent Spend Guards
54
+
55
+ `maxIterations` and `timeout` bound how MANY model calls an agent makes and how LONG it runs.
56
+ Neither bounds how much those calls cost. An agent on a large context or an expensive model can
57
+ spend without limit inside a budget it is technically respecting. Three `AgentConstraints` fields
58
+ close that:
59
+
60
+ | Constraint | Bounds | Default |
61
+ | ------------------------ | ------------------------------------------------ | ------------------- |
62
+ | `maxCostUsd` | total USD across every AI call in the turn | unset -- no ceiling |
63
+ | `maxTotalTokens` | total input + output tokens across every AI call | unset -- no ceiling |
64
+ | `maxIdenticalIterations` | consecutive byte-identical plans before stopping | 3 |
65
+
66
+ Set at least one of the first two on any agent you are not watching. Unset is genuinely unbounded,
67
+ not "bounded by something sensible".
68
+
69
+ **Reaching a spend ceiling fails the execution.** The stop reason is `spend_exhausted`, and the
70
+ worker reports `status: 'failed'` with `AgentSpendExhaustedError` -- deliberately, because an agent
71
+ that stopped at its ceiling did not finish its work, and reporting that as success is what makes the
72
+ failure mode invisible. Whatever the agent synthesized still travels on the failed result, so a
73
+ partial answer is not lost.
74
+
75
+ `spend_exhausted` is kept distinct from `budget_exhausted` (the `maxIterations` stop) because the
76
+ right response differs: an agent out of iterations may just need a larger `maxIterations`, while one
77
+ out of spend is the ceiling doing its job. Read the stop reason before raising either limit.
78
+
79
+ Ceilings are enforced only where the platform injects a usage collector, which is every
80
+ coordinator-run execution. Note that a **synchronous nested execution shares its parent's
81
+ collector**, so a parent's ceiling covers the agent and everything it invokes synchronously -- and
82
+ can therefore be reached by a child's spend.
27
83
 
28
84
  ## Concurrency
29
85
 
@@ -59,7 +59,7 @@ Bare `/om` runs the layered flow (identity → customers → offerings → roles
59
59
 
60
60
  Do not author Resource `actionKey` in the target contract. Runtime/UI routing that needs a single selectable action should read `resource.ontology.primaryAction`.
61
61
 
62
- Do not add `sales.actions` to the org model -- the v1 server-side override surface is intentionally deferred. Customize deal actions through `scaffold/recipes/customize-crm-actions.md` instead.
62
+ There is no `sales.actions` field -- do not add one. CRM deal actions are `actionTypes` records in the `sales.crm` System's `ontology` scope, each carrying `label`, `order`, `resourceId`, and `availableFrom`, with the ontology local id as the dispatch key. `compileCrmActionCatalog` turns them into the deal panel's buttons. See `scaffold/recipes/customize-crm-actions.md`.
63
63
 
64
64
  ## `System.apiInterface`
65
65
 
@@ -77,10 +77,11 @@ Do not confuse ontology `interface` records with `system.apiInterface`. Ontology
77
77
 
78
78
  ### Readiness contract authoring
79
79
 
80
- Three rules govern what you may write inside an `apiInterface`, all enforced at deploy preflight:
80
+ Four rules govern what you may write inside an `apiInterface`, all enforced at deploy preflight:
81
81
 
82
82
  - **`readinessProfile` must be declared explicitly. There is no positional fallback.** An omitted value resolves to `undefined` and produces a `missing-readiness-profile` diagnostic -- it does **not** fall back to `${systemPath}.${interfaceKey}`. That fallback was removed because it coupled profile identity to tree position: a System sitting at a path that happened to match a built-in profile id (say `sales.crm`) silently inherited that built-in's requirements without ever declaring one.
83
83
  - **A `readinessContract` must list at least one entry in `requiredCatalogs`.** An empty or omitted list no longer parses, so a contract that asserts nothing fails at deploy rather than passing silently.
84
+ - **Never declare a `readinessContract` beside a built-in profile** (`sales.lead-gen.api`, `sales.crm.api`, `sales.lead-gen.crm-handoff`). A platform validator already covers those, so a contract there would be ignored at runtime; deploy preflight and `om:doctor` reject it as `readiness-contract-on-built-in-profile`. Only contract-validated profiles such as `content.api` take one.
84
85
  - **`resourceIds` must scope real resources.** An empty array used to skip readiness validation entirely, which made deploy and runtime disagree -- deploy passed and the API then returned 503. If a stub marker exists, either scope it or remove the marker; absence is the designed opt-out.
85
86
 
86
87
  `profileForInterface` is removed. It had degraded to an identity function returning its third argument; read `apiInterface?.readinessProfile` directly.