@elevasis/sdk 1.40.0 → 1.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,7 +58,7 @@
58
58
  "tsup": "^8.0.0",
59
59
  "typescript": "5.9.2",
60
60
  "zod": "^4.1.0",
61
- "@repo/core": "0.56.0",
61
+ "@repo/core": "0.57.0",
62
62
  "@repo/eslint-config": "0.0.0",
63
63
  "@repo/typescript-config": "0.0.0"
64
64
  },
@@ -0,0 +1,73 @@
1
+ # Agent iteration output is now actually enforced, and long turns stop being lost
2
+
3
+ ## Why this note exists
4
+
5
+ Two changes land together. Both are platform-side and need no agent definition changes, but **both
6
+ require a redeploy** to take effect, and one of them silently did nothing until now.
7
+
8
+ **1. Structured output was not being enforced for your agents, and nothing said so.**
9
+
10
+ The platform asks the model for agent iterations through a forced tool call. `strict: true` is what
11
+ actually enforces the response shape — without it the schema is guidance, required fields are
12
+ best-effort, and the model is free to return an object missing one. Measured across long sessions,
13
+ about 20% of iteration calls came back with `reasoning` and no `nextActions`.
14
+
15
+ Strict mode compiles the schema into a sampling grammar, and that grammar accepts only a subset of
16
+ JSON Schema. The agent iteration schema asked for memory writes as a free-form map
17
+ (`additionalProperties: true` with nothing declared), which has no strict equivalent — so the
18
+ platform refused to send `strict` and fell back to the old unenforced behavior. Correct and safe,
19
+ but **completely silent**: there was no way to tell an enforced call from an unenforced one.
20
+
21
+ The schema now asks for memory writes as a list of `{ key, value }` pairs, which is inside the
22
+ grammar, so the call goes out enforced. The shape lives in your deployed bundle, which is why a
23
+ redeploy is required and why a platform deploy alone could not fix it.
24
+
25
+ **2. Long agent turns were occasionally lost outright.**
26
+
27
+ On long turns the model would begin a second tool invocation while still writing the first one's
28
+ `reasoning` string. The grammar traps that markup inside the string, and the turn ends with either
29
+ response markup embedded in `reasoning` or no user-facing message at all. Measured at roughly 10%
30
+ of calls on a long turn.
31
+
32
+ The iteration schema now emits `nextActions` before `reasoning`. Under grammar-constrained sampling
33
+ the model fills keys in declaration order, so the reply is already committed by the time the drift
34
+ can start. Measured over 70 calls per arm, this took the failure rate from 10% to 2.9%, and the one
35
+ remaining case still delivered its message. Answer quality was measured, not assumed: replies got
36
+ slightly longer and read the same or better.
37
+
38
+ ## Applies to
39
+
40
+ - **Every agent**, and especially every `sessionCapable: true` agent, since the failures scale with
41
+ accumulated context and show up on long conversations rather than in a smoke test.
42
+ - Agents on **Anthropic models**. OpenAI-model agents stay on the unenforced path for now; that is
43
+ a separate, deliberately deferred item.
44
+ - Anything that reads a stored `reasoning` field — see the caveat below.
45
+
46
+ ## Required actions
47
+
48
+ 1. **Take the `@elevasis/core` and `@elevasis/sdk` baseline bumps** this train propagates, then
49
+ reinstall in `operations/` so the new worker bundle is present.
50
+ 2. **Redeploy your operations bundle.** Both changes live in the schema your deployed bundle emits.
51
+ An existing deployment keeps sending the old unenforced schema until it is redeployed:
52
+ `pnpm -C operations exec elevasis-sdk deploy --prod` (or your project's deploy command).
53
+ 3. **If you parse or display stored `reasoning`, re-check it.** Nothing about the field's type or
54
+ presence changed, but it is now generated after the reply rather than before, so its content
55
+ reads more like a summary of the answer than a lead-up to it.
56
+
57
+ ## Verification
58
+
59
+ - Run a session long enough to accumulate real context — the failures do not reproduce on short
60
+ ones. Confirm no turn fails with `LLM output does not match responseSchema: missing required
61
+ field 'reasoning'; missing required field 'nextActions'`. That error on a redeployed agent means the
62
+ bundle is stale.
63
+ - Check the observability rows for an execution: a call that had to fall back to the unenforced path
64
+ now records `strictRefusalReasons` on its `ai_calls` entry. **Absence of that field is the healthy
65
+ state** — a redeployed agent should show none. If you see `["freeFormObject"]`, that agent is
66
+ still running a pre-update bundle.
67
+
68
+ ## Not handled by /git-sync
69
+
70
+ - **The redeploy.** `/git-sync` commits and pushes the propagated dependency baseline. It does not
71
+ redeploy your operations bundle, and neither change is live until you do (action 2 above).
72
+ - **Reading the new observability field.** Nothing is written retroactively; only executions that
73
+ run after the redeploy carry it.
@@ -63,4 +63,4 @@ See [@elevasis/ui](ui/index.mdx) for the provider model, feature modules, peer d
63
63
 
64
64
  ## Authoring Note
65
65
 
66
- These pages have a dual surface. At SDK build time, `packages/sdk/scripts/copy-reference-docs.mjs` copies every `apps/docs/content/docs/sdk/**.mdx` into `packages/sdk/reference/`, which ships inside the npm package (`files: ["reference/"]`). The `external/_template/CLAUDE.md` points tenant-project agents at `node_modules/@elevasis/sdk/reference/` as their primary reference bundle. Drift in these docs does not just affect the public site -- it actively misleads every agent building a tenant project.
66
+ These pages have a dual surface. At SDK build time, `packages/sdk/scripts/copy-reference-docs.mjs` copies every `apps/docs/content/docs/sdk/**.mdx` into `packages/sdk/reference/`, which ships inside the npm package (`files: ["reference/"]`). The `external/_template/CLAUDE.md` points tenant-project agents at `operations/node_modules/@elevasis/sdk/reference/` as their primary reference bundle. Drift in these docs does not just affect the public site -- it actively misleads every agent building a tenant project.
@@ -1,52 +1,52 @@
1
- # Entities
2
-
3
- Published base entity contracts for the Elevasis platform. Each entity ships as a TypeScript interface, a matching Zod schema, and an inferred `Input` type, generic over a `<TMeta>` extension slot.
4
-
5
- External projects extend these in `core/types/entities.ts` to attach project-specific metadata while keeping the canonical shape stable.
6
-
7
- ## Published Exports
8
-
9
- The published entry point exposes six entity contracts:
10
-
11
- - `BaseProject<TMeta>`, `BaseProjectSchema`, `BaseProjectInput`
12
- - `BaseMilestone<TMeta>`, `BaseMilestoneSchema`, `BaseMilestoneInput`
13
- - `BaseTask<TMeta>`, `BaseTaskSchema`, `BaseTaskInput`
14
- - `BaseDeal<TMeta>`, `BaseDealSchema`, `BaseDealInput`
15
- - `BaseCompany<TMeta>`, `BaseCompanySchema`, `BaseCompanyInput`
16
- - `BaseContact<TMeta>`, `BaseContactSchema`, `BaseContactInput`
17
-
18
- Import them from the published subpath:
19
-
20
- ```ts
21
- import { BaseDealSchema, type BaseDeal } from '@elevasis/core/entities'
22
- ```
23
-
24
- ## Extension Pattern
25
-
26
- Each base interface accepts a generic metadata type. Extend the schema with `.extend({ metadata: ... })` and infer the type with `BaseProject<z.infer<typeof MetaSchema>>`.
27
-
28
- ```ts
29
- import { z } from 'zod'
30
- import { BaseProjectSchema, type BaseProject } from '@elevasis/core/entities'
31
-
32
- const ProjectMetaSchema = z.object({
33
- budget: z.number().int().nonnegative(),
34
- clientPriority: z.enum(['low', 'medium', 'high'])
35
- })
36
-
37
- export const ProjectSchema = BaseProjectSchema.extend({ metadata: ProjectMetaSchema })
38
- export type Project = BaseProject<z.infer<typeof ProjectMetaSchema>>
39
- ```
40
-
41
- Use the base shape as-is when no extension is needed:
42
-
43
- ```ts
44
- export const DealSchema = BaseDealSchema
45
- export type Deal = BaseDeal
46
- ```
47
-
48
- ## Recipe
49
-
50
- The full pattern is documented in the SDK scaffold bundle: `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-a-base-entity.md`.
51
-
52
- The canonical template demo lives at `external/_template/core/types/entities.ts`.
1
+ # Entities
2
+
3
+ Published base entity contracts for the Elevasis platform. Each entity ships as a TypeScript interface, a matching Zod schema, and an inferred `Input` type, generic over a `<TMeta>` extension slot.
4
+
5
+ External projects extend these in `core/types/entities.ts` to attach project-specific metadata while keeping the canonical shape stable.
6
+
7
+ ## Published Exports
8
+
9
+ The published entry point exposes six entity contracts:
10
+
11
+ - `BaseProject<TMeta>`, `BaseProjectSchema`, `BaseProjectInput`
12
+ - `BaseMilestone<TMeta>`, `BaseMilestoneSchema`, `BaseMilestoneInput`
13
+ - `BaseTask<TMeta>`, `BaseTaskSchema`, `BaseTaskInput`
14
+ - `BaseDeal<TMeta>`, `BaseDealSchema`, `BaseDealInput`
15
+ - `BaseCompany<TMeta>`, `BaseCompanySchema`, `BaseCompanyInput`
16
+ - `BaseContact<TMeta>`, `BaseContactSchema`, `BaseContactInput`
17
+
18
+ Import them from the published subpath:
19
+
20
+ ```ts
21
+ import { BaseDealSchema, type BaseDeal } from '@elevasis/core/entities'
22
+ ```
23
+
24
+ ## Extension Pattern
25
+
26
+ Each base interface accepts a generic metadata type. Extend the schema with `.extend({ metadata: ... })` and infer the type with `BaseProject<z.infer<typeof MetaSchema>>`.
27
+
28
+ ```ts
29
+ import { z } from 'zod'
30
+ import { BaseProjectSchema, type BaseProject } from '@elevasis/core/entities'
31
+
32
+ const ProjectMetaSchema = z.object({
33
+ budget: z.number().int().nonnegative(),
34
+ clientPriority: z.enum(['low', 'medium', 'high'])
35
+ })
36
+
37
+ export const ProjectSchema = BaseProjectSchema.extend({ metadata: ProjectMetaSchema })
38
+ export type Project = BaseProject<z.infer<typeof ProjectMetaSchema>>
39
+ ```
40
+
41
+ Use the base shape as-is when no extension is needed:
42
+
43
+ ```ts
44
+ export const DealSchema = BaseDealSchema
45
+ export type Deal = BaseDeal
46
+ ```
47
+
48
+ ## Recipe
49
+
50
+ The full pattern is documented in the SDK scaffold bundle: `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-a-base-entity.md`.
51
+
52
+ The canonical template demo lives at `external/_template/core/types/entities.ts`.
@@ -12,7 +12,7 @@ paths:
12
12
  ## Safety Invariants
13
13
 
14
14
  - `ElevasisUIProvider` in `ui/src/main.tsx` auto-composes shared UI, auth, and API surface -- route files do not wire providers manually
15
- - `useApiClient()` from `@/lib/hooks/useApiClient` for authenticated API calls -- never raw `fetch` with auth headers
15
+ - `useApiClient()` from `@elevasis/ui/api` for authenticated API calls, passing `API_URL` from `@/lib/constants/api` -- never raw `fetch` with auth headers. There is no `ui/src/lib/hooks/` directory; see `ui.md` "API and Streaming"
16
16
  - `routeTree.gen.ts` is auto-generated on `pnpm dev` -- never edit manually
17
17
  - Auth protection: wrap page content with `ProtectedRoute` from `@elevasis/ui/auth`. Admin pages nest `AdminGuard` inside `ProtectedRoute`
18
18
  - Never fork `@elevasis/ui` components -- if a published component needs a tweak, that missing capability is a bug in `@elevasis/ui`
@@ -36,5 +36,5 @@ This project's own org-model and workflows live in `core/config/organization-mod
36
36
 
37
37
  ## References
38
38
 
39
- - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` — full SDK scaffold reference
39
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` — full SDK scaffold reference
40
40
  - Monorepo source rule: `.claude/rules/package-taxonomy.md` in the elevasis-monorepo (when working across both)
@@ -39,7 +39,7 @@ paths:
39
39
 
40
40
  ## Detailed Reference
41
41
 
42
- - `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- workflow anatomy, adapter patterns, trigger patterns
43
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md` -- end-to-end resource authoring guide
44
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- lead-gen UI, hooks, list/member state, artifacts, and workflow adapter extension guide
42
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- workflow anatomy, adapter patterns, trigger patterns
43
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md` -- end-to-end resource authoring guide
44
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- lead-gen UI, hooks, list/member state, artifacts, and workflow adapter extension guide
45
45
  - SDK reference docs: `operations/node_modules/@elevasis/sdk/reference/` (concepts, framework, platform-tools, runtime, CLI)
@@ -1,63 +1,63 @@
1
- ---
2
- title: Scaffold Maintenance
3
- description: How scaffold documentation is organized, generated, and bundled into the SDK -- content placement map, auto-generation pipeline, and instructions for adding new scaffold docs.
4
- ---
1
+ ---
2
+ title: Scaffold Maintenance
3
+ description: How scaffold documentation is organized, generated, and bundled into the SDK -- content placement map, auto-generation pipeline, and instructions for adding new scaffold docs.
4
+ ---
5
5
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
6
  <!-- Regenerate: pnpm scaffold:sync -->
7
7
 
8
-
9
- # Scaffold Maintenance
10
-
11
- `🟢 Stable` -- Use this when adding or modifying scaffold documentation.
12
-
13
- ---
14
-
15
- ## Content Placement Model
16
-
17
- Scaffold docs are co-located with their owning package and copied into the SDK reference at build time. This makes each package owner responsible for their docs and avoids a single monolithic directory.
18
-
19
- ### Placement Rules
20
-
21
- - If a doc explains a single abstraction boundary, **co-locate it** with the owning package.
22
- - If a doc explains relationships between multiple abstractions, **centralize it** in `packages/sdk/docs/scaffold/`.
23
- - If a doc can be derived from code or manifests, **generate it**.
24
- - Hand-authored docs should point to generated maps rather than restating them.
25
-
26
- ### Source-to-Destination Map
27
-
28
- | Content | Source | SDK Reference Destination |
29
- | --------------------------- | --------------------------------------------------------------- | --------------------------------------------- |
30
- | Organization Model | `packages/core/src/organization-model/organization-model.mdx` | `scaffold/core/organization-model.mdx` |
31
- | Organization Graph | `packages/core/src/organization-model/organization-graph.mdx` | `scaffold/core/organization-graph.mdx` |
8
+
9
+ # Scaffold Maintenance
10
+
11
+ `🟢 Stable` -- Use this when adding or modifying scaffold documentation.
12
+
13
+ ---
14
+
15
+ ## Content Placement Model
16
+
17
+ Scaffold docs are co-located with their owning package and copied into the SDK reference at build time. This makes each package owner responsible for their docs and avoids a single monolithic directory.
18
+
19
+ ### Placement Rules
20
+
21
+ - If a doc explains a single abstraction boundary, **co-locate it** with the owning package.
22
+ - If a doc explains relationships between multiple abstractions, **centralize it** in `packages/sdk/docs/scaffold/`.
23
+ - If a doc can be derived from code or manifests, **generate it**.
24
+ - Hand-authored docs should point to generated maps rather than restating them.
25
+
26
+ ### Source-to-Destination Map
27
+
28
+ | Content | Source | SDK Reference Destination |
29
+ | --------------------------- | --------------------------------------------------------------- | --------------------------------------------- |
30
+ | Organization Model | `packages/core/src/organization-model/organization-model.mdx` | `scaffold/core/organization-model.mdx` |
31
+ | Organization Graph | `packages/core/src/organization-model/organization-graph.mdx` | `scaffold/core/organization-graph.mdx` |
32
32
  | Glossary | `packages/core/src/reference/glossary.md` | `scaffold/reference/glossary.md` |
33
33
  | Contracts (auto-gen) | `packages/core/src/reference/_generated/contracts.md` | `scaffold/reference/contracts.md` |
34
34
  | System Interface Capabilities (auto-gen) | `packages/core/src/reference/_generated/system-interface-capabilities.md` | `scaffold/reference/system-interface-capabilities.md` |
35
35
  | UI Recipes | `packages/ui/src/scaffold/recipes.md` | `scaffold/ui/recipes.md` |
36
- | System Flags & Gating | `packages/ui/src/scaffold/feature-flags-and-gating.md` | `scaffold/ui/feature-flags-and-gating.md` |
37
- | Customization | `packages/ui/src/scaffold/customization.md` | `scaffold/ui/customization.md` |
38
- | System Shell | `packages/ui/src/scaffold/feature-shell.mdx` | `scaffold/ui/feature-shell.mdx` |
39
- | Composition & Extensibility | `packages/ui/src/scaffold/composition-extensibility.mdx` | `scaffold/ui/composition-extensibility.mdx` |
40
- | System Registry (auto-gen) | `packages/ui/src/scaffold/_generated/feature-registry.md` | `scaffold/reference/feature-registry.md` |
41
- | Scaffold Index | `packages/sdk/docs/scaffold/index.mdx` | `scaffold/index.mdx` |
42
- | Pathway Recipes | `packages/sdk/docs/scaffold/recipes/` | `scaffold/recipes/` |
43
- | Workflow Recipes | `packages/sdk/docs/scaffold/operations/workflow-recipes.md` | `scaffold/operations/workflow-recipes.md` |
44
- | Propagation Pipeline | `packages/sdk/docs/scaffold/operations/propagation-pipeline.md` | `scaffold/operations/propagation-pipeline.md` |
45
- | This doc | `packages/sdk/docs/scaffold/operations/scaffold-maintenance.md` | `scaffold/operations/scaffold-maintenance.md` |
46
-
47
- ---
48
-
49
- ## Auto-Generation Pipeline
50
-
51
- Two types of docs are auto-generated from source:
52
-
53
- ### Contracts (`contracts.md`)
54
-
55
- Generated by `scripts/monorepo/generate-scaffold-contracts.js` from TypeScript source types:
56
-
57
- - `packages/core/src/organization-model/types.ts` -- Organization Model, System Model
58
- - `packages/ui/src/features/registry/types.ts` -- System Registry
59
- - `packages/core/src/platform/registry/types.ts` -- Resource Registry, Deployment Spec
60
-
36
+ | System Flags & Gating | `packages/ui/src/scaffold/feature-flags-and-gating.md` | `scaffold/ui/feature-flags-and-gating.md` |
37
+ | Customization | `packages/ui/src/scaffold/customization.md` | `scaffold/ui/customization.md` |
38
+ | System Shell | `packages/ui/src/scaffold/feature-shell.mdx` | `scaffold/ui/feature-shell.mdx` |
39
+ | Composition & Extensibility | `packages/ui/src/scaffold/composition-extensibility.mdx` | `scaffold/ui/composition-extensibility.mdx` |
40
+ | System Registry (auto-gen) | `packages/ui/src/scaffold/_generated/feature-registry.md` | `scaffold/reference/feature-registry.md` |
41
+ | Scaffold Index | `packages/sdk/docs/scaffold/index.mdx` | `scaffold/index.mdx` |
42
+ | Pathway Recipes | `packages/sdk/docs/scaffold/recipes/` | `scaffold/recipes/` |
43
+ | Workflow Recipes | `packages/sdk/docs/scaffold/operations/workflow-recipes.md` | `scaffold/operations/workflow-recipes.md` |
44
+ | Propagation Pipeline | `packages/sdk/docs/scaffold/operations/propagation-pipeline.md` | `scaffold/operations/propagation-pipeline.md` |
45
+ | This doc | `packages/sdk/docs/scaffold/operations/scaffold-maintenance.md` | `scaffold/operations/scaffold-maintenance.md` |
46
+
47
+ ---
48
+
49
+ ## Auto-Generation Pipeline
50
+
51
+ Two types of docs are auto-generated from source:
52
+
53
+ ### Contracts (`contracts.md`)
54
+
55
+ Generated by `scripts/monorepo/generate-scaffold-contracts.js` from TypeScript source types:
56
+
57
+ - `packages/core/src/organization-model/types.ts` -- Organization Model, System Model
58
+ - `packages/ui/src/features/registry/types.ts` -- System Registry
59
+ - `packages/core/src/platform/registry/types.ts` -- Resource Registry, Deployment Spec
60
+
61
61
  Output: `packages/core/src/reference/_generated/contracts.md`
62
62
 
63
63
  ### System Interface Capabilities (`system-interface-capabilities.md`)
@@ -68,37 +68,37 @@ Generated by `scripts/monorepo/generate-scaffold-contracts.js` from:
68
68
  - `packages/core/src/business/acquisition/ontology-validation.ts` -- derived-readiness validation constants and checks
69
69
 
70
70
  Output: `packages/core/src/reference/_generated/system-interface-capabilities.md`
71
-
72
- ### System Registry (`feature-registry.md`)
73
-
74
- Generated by `scripts/monorepo/generate-scaffold-feature-registry.js` from system manifests:
75
-
76
- - `packages/ui/src/features/*/manifest.ts` -- individual system manifests
77
- - `packages/ui/src/features/registry/manifests.ts` -- `SYSTEM_MANIFESTS`
78
-
79
- Output: `packages/ui/src/scaffold/_generated/feature-registry.md`
80
-
81
- ### Reference Artifacts
82
-
83
- Generated by `scripts/monorepo/generate-reference-artifacts.js`:
84
-
85
- - `packages/sdk/reference/_reference-manifest.json` -- machine-readable catalog of all reference entries
86
- - `packages/sdk/reference/_navigation.md` -- navigation table
87
-
88
- ### Running Generators
89
-
90
- ```bash
91
- pnpm scaffold:generate # Run both generators
92
- pnpm scaffold:sync # Generate + validate (the full loop)
93
- pnpm sdk-ref:generate # Reference artifacts only
94
- ```
95
-
96
- Generated files should never be edited manually. If the output is wrong, fix the source types or the generator script.
97
-
98
- ---
99
-
100
- ## SDK Build Pipeline (Reference Copy)
101
-
71
+
72
+ ### System Registry (`feature-registry.md`)
73
+
74
+ Generated by `scripts/monorepo/generate-scaffold-feature-registry.js` from system manifests:
75
+
76
+ - `packages/ui/src/features/*/manifest.ts` -- individual system manifests
77
+ - `packages/ui/src/features/registry/manifests.ts` -- `SYSTEM_MANIFESTS`
78
+
79
+ Output: `packages/ui/src/scaffold/_generated/feature-registry.md`
80
+
81
+ ### Reference Artifacts
82
+
83
+ Generated by `scripts/monorepo/generate-reference-artifacts.js`:
84
+
85
+ - `packages/sdk/reference/_reference-manifest.json` -- machine-readable catalog of all reference entries
86
+ - `packages/sdk/reference/_navigation.md` -- navigation table
87
+
88
+ ### Running Generators
89
+
90
+ ```bash
91
+ pnpm scaffold:generate # Run both generators
92
+ pnpm scaffold:sync # Generate + validate (the full loop)
93
+ pnpm sdk-ref:generate # Reference artifacts only
94
+ ```
95
+
96
+ Generated files should never be edited manually. If the output is wrong, fix the source types or the generator script.
97
+
98
+ ---
99
+
100
+ ## SDK Build Pipeline (Reference Copy)
101
+
102
102
  `packages/sdk/scripts/copy-reference-docs.mjs` runs during `pnpm --filter @elevasis/sdk build` and has four phases:
103
103
 
104
104
  1. **Phase 1:** Copies SDK public docs from `apps/docs/content/docs/sdk/` with link rewriting and MDX escape stripping
@@ -106,31 +106,31 @@ Generated files should never be edited manually. If the output is wrong, fix the
106
106
  3. **Phase 3:** Copies scaffold docs from co-located package sources using the `SCAFFOLD_COPIES` map
107
107
  4. **Phase 4:** Copies `external/_template/.claude` into `packages/sdk/reference/claude-config` for tenant-facing agent configuration
108
108
 
109
- The output lands in `packages/sdk/reference/` which is included in the npm package's `files` array. External projects access it via `node_modules/@elevasis/sdk/reference/`.
110
-
111
- ---
112
-
113
- ## Adding New Scaffold Docs
114
-
115
- 1. **Create the source doc** in the appropriate package:
116
- - Core concepts: `packages/core/src/...`
117
- - UI patterns: `packages/ui/src/scaffold/...`
118
- - Cross-package or SDK-owned: `packages/sdk/docs/scaffold/...`
119
-
120
- 2. **Add to `SCAFFOLD_COPIES`** in `packages/sdk/scripts/copy-reference-docs.mjs`:
121
-
122
- ```javascript
123
- { source: 'packages/sdk/docs/scaffold/operations/my-doc.md', target: 'scaffold/operations/my-doc.md' }
124
- ```
125
-
126
- 3. **Update the scaffold index** in `packages/sdk/docs/scaffold/index.mdx` with a link and description.
127
-
128
- 4. **Rebuild the SDK** to verify: `pnpm --filter @elevasis/sdk build`
129
-
130
- 5. **Update the permanent architecture docs** if the new doc covers a concept already referenced in `apps/docs/content/docs/technical/architecture/scaffold-reference.mdx`.
131
-
132
- ---
133
-
134
- ## Freshness Validation
135
-
136
- At the monorepo level, `pnpm scaffold:sync` followed by `pnpm sync:verify` confirms that all artifacts are current and all downstream projects are consistent. The SDK no longer ships doc validation because external projects no longer carry a `docs/` tree.
109
+ The output lands in `packages/sdk/reference/` which is included in the npm package's `files` array. External projects access it via `operations/node_modules/@elevasis/sdk/reference/`.
110
+
111
+ ---
112
+
113
+ ## Adding New Scaffold Docs
114
+
115
+ 1. **Create the source doc** in the appropriate package:
116
+ - Core concepts: `packages/core/src/...`
117
+ - UI patterns: `packages/ui/src/scaffold/...`
118
+ - Cross-package or SDK-owned: `packages/sdk/docs/scaffold/...`
119
+
120
+ 2. **Add to `SCAFFOLD_COPIES`** in `packages/sdk/scripts/copy-reference-docs.mjs`:
121
+
122
+ ```javascript
123
+ { source: 'packages/sdk/docs/scaffold/operations/my-doc.md', target: 'scaffold/operations/my-doc.md' }
124
+ ```
125
+
126
+ 3. **Update the scaffold index** in `packages/sdk/docs/scaffold/index.mdx` with a link and description.
127
+
128
+ 4. **Rebuild the SDK** to verify: `pnpm --filter @elevasis/sdk build`
129
+
130
+ 5. **Update the permanent architecture docs** if the new doc covers a concept already referenced in `apps/docs/content/docs/technical/architecture/scaffold-reference.mdx`.
131
+
132
+ ---
133
+
134
+ ## Freshness Validation
135
+
136
+ At the monorepo level, `pnpm scaffold:sync` followed by `pnpm sync:verify` confirms that all artifacts are current and all downstream projects are consistent. The SDK no longer ships doc validation because external projects no longer carry a `docs/` tree.