@elevasis/sdk 1.44.3 → 1.45.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 (246) hide show
  1. package/dist/cli.cjs +991 -650
  2. package/dist/index.d.ts +1045 -509
  3. package/dist/index.js +738 -688
  4. package/dist/node/index.d.ts +105 -97
  5. package/dist/test-utils/index.d.ts +42 -28
  6. package/dist/test-utils/index.js +514 -783
  7. package/dist/worker/index.d.ts +12112 -0
  8. package/dist/worker/index.js +121 -182
  9. package/package.json +6 -9
  10. package/reference/_navigation.md +151 -21
  11. package/reference/_reference-manifest.json +186 -4
  12. package/reference/claude-config.md +8 -0
  13. package/reference/core/index.mdx +3 -3
  14. package/reference/examples/organization-model.ts +117 -111
  15. package/reference/index.mdx +4 -4
  16. package/reference/rules/active-change-index.md +40 -54
  17. package/reference/rules/agent-runtime.md +81 -0
  18. package/reference/rules/agent-start-here.md +71 -163
  19. package/reference/rules/deployment.md +33 -10
  20. package/reference/rules/error-handling.md +26 -0
  21. package/reference/rules/execution.md +13 -0
  22. package/reference/rules/frontend.md +10 -3
  23. package/reference/rules/observability.md +9 -1
  24. package/reference/rules/operations.md +26 -17
  25. package/reference/rules/organization-model.md +74 -88
  26. package/reference/rules/organization-os.md +71 -88
  27. package/reference/rules/package-taxonomy.md +11 -2
  28. package/reference/rules/platform.md +13 -7
  29. package/reference/rules/shared-types.md +15 -0
  30. package/reference/rules/task-tracking.md +30 -5
  31. package/reference/rules/ui.md +145 -3
  32. package/reference/rules/vibe-intents.md +271 -0
  33. package/reference/rules/vibe.md +17 -243
  34. package/reference/scaffold/core/organization-graph.mdx +111 -97
  35. package/reference/scaffold/core/organization-model.mdx +234 -214
  36. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  37. package/reference/scaffold/operations/scaffold-maintenance.md +19 -18
  38. package/reference/scaffold/operations/workflow-recipes.md +71 -19
  39. package/reference/scaffold/recipes/add-a-feature.md +156 -146
  40. package/reference/scaffold/recipes/add-a-resource.md +123 -117
  41. package/reference/scaffold/recipes/customize-crm-actions.md +25 -10
  42. package/reference/scaffold/recipes/customize-knowledge-browser.md +52 -117
  43. package/reference/scaffold/recipes/customize-organization-model.md +161 -149
  44. package/reference/scaffold/recipes/extend-a-base-entity.md +156 -140
  45. package/reference/scaffold/recipes/extend-crm.md +16 -11
  46. package/reference/scaffold/recipes/extend-lead-gen.md +25 -7
  47. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +160 -118
  48. package/reference/scaffold/recipes/index.md +2 -2
  49. package/reference/scaffold/recipes/query-the-knowledge-graph.md +23 -23
  50. package/reference/scaffold/reference/contracts.md +12 -1
  51. package/reference/scaffold/reference/glossary.md +3 -3
  52. package/reference/scaffold/reference/system-interface-capabilities.md +5 -4
  53. package/reference/scaffold/ui/composition-extensibility.mdx +271 -232
  54. package/reference/scaffold/ui/feature-flags-and-gating.md +14 -6
  55. package/reference/scaffold/ui/feature-shell.mdx +279 -62
  56. package/reference/scaffold/ui/recipes.md +229 -197
  57. package/reference/sdk/cli-management.mdx +77 -29
  58. package/reference/sdk/concepts.mdx +2 -0
  59. package/reference/sdk/define-builders.mdx +76 -0
  60. package/reference/sdk/deployment/command-center.mdx +6 -2
  61. package/reference/sdk/deployment/execution-reference.mdx +64 -186
  62. package/reference/sdk/deployment/index.mdx +2 -0
  63. package/reference/sdk/exports.mdx +4 -4
  64. package/reference/sdk/framework/agent.mdx +49 -119
  65. package/reference/sdk/framework/index.mdx +46 -65
  66. package/reference/sdk/framework/project-structure.mdx +150 -205
  67. package/reference/sdk/framework/tutorial-system.mdx +2 -2
  68. package/reference/sdk/human-in-the-loop.mdx +152 -0
  69. package/reference/sdk/index.mdx +6 -7
  70. package/reference/sdk/platform-tools/index.mdx +12 -0
  71. package/reference/sdk/platform-tools/type-safety.mdx +4 -0
  72. package/reference/sdk/project-deployment-spec.mdx +131 -0
  73. package/reference/sdk/resources/index.mdx +21 -7
  74. package/reference/sdk/resources/patterns.mdx +54 -24
  75. package/reference/sdk/resources/types.mdx +7 -4
  76. package/reference/sdk/templates/data-enrichment.mdx +7 -3
  77. package/reference/sdk/templates/email-sender.mdx +139 -135
  78. package/reference/sdk/templates/lead-scorer.mdx +5 -1
  79. package/reference/sdk/templates/pdf-generator.mdx +155 -151
  80. package/reference/sdk/templates/recurring-job.mdx +195 -189
  81. package/reference/sdk/templates/text-classifier.mdx +4 -0
  82. package/reference/sdk/templates/web-scraper.mdx +139 -135
  83. package/reference/spine/spine-primer.md +135 -96
  84. package/reference/ui/index.mdx +14 -7
  85. package/dist/types/worker/adapters/anymailfinder.d.ts +0 -14
  86. package/dist/types/worker/adapters/apify.d.ts +0 -14
  87. package/dist/types/worker/adapters/approval.d.ts +0 -23
  88. package/dist/types/worker/adapters/attio.d.ts +0 -22
  89. package/dist/types/worker/adapters/clickup.d.ts +0 -22
  90. package/dist/types/worker/adapters/create-adapter.d.ts +0 -41
  91. package/dist/types/worker/adapters/crm.d.ts +0 -20
  92. package/dist/types/worker/adapters/dropbox.d.ts +0 -14
  93. package/dist/types/worker/adapters/email.d.ts +0 -25
  94. package/dist/types/worker/adapters/execution.d.ts +0 -22
  95. package/dist/types/worker/adapters/gmail.d.ts +0 -14
  96. package/dist/types/worker/adapters/google-sheets.d.ts +0 -14
  97. package/dist/types/worker/adapters/index.d.ts +0 -33
  98. package/dist/types/worker/adapters/instantly.d.ts +0 -14
  99. package/dist/types/worker/adapters/lead.d.ts +0 -28
  100. package/dist/types/worker/adapters/list.d.ts +0 -9
  101. package/dist/types/worker/adapters/llm.d.ts +0 -45
  102. package/dist/types/worker/adapters/millionverifier.d.ts +0 -14
  103. package/dist/types/worker/adapters/notification.d.ts +0 -28
  104. package/dist/types/worker/adapters/pdf.d.ts +0 -22
  105. package/dist/types/worker/adapters/projects.d.ts +0 -20
  106. package/dist/types/worker/adapters/resend.d.ts +0 -14
  107. package/dist/types/worker/adapters/scheduler.d.ts +0 -25
  108. package/dist/types/worker/adapters/signature-api.d.ts +0 -14
  109. package/dist/types/worker/adapters/storage.d.ts +0 -33
  110. package/dist/types/worker/adapters/stripe.d.ts +0 -14
  111. package/dist/types/worker/adapters/tomba.d.ts +0 -14
  112. package/dist/types/worker/index.d.ts +0 -60
  113. package/dist/types/worker/platform.d.ts +0 -90
  114. package/dist/types/worker/utils.d.ts +0 -9
  115. package/reference/claude-config/Overview.md +0 -230
  116. package/reference/claude-config/hooks/post-edit-validate.mjs +0 -98
  117. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +0 -187
  118. package/reference/claude-config/hooks/tool-failure-recovery.mjs +0 -73
  119. package/reference/claude-config/registries/graph-skills.json +0 -4
  120. package/reference/claude-config/registries/knowledge-flags.json +0 -154
  121. package/reference/claude-config/registries/skill-coverage.json +0 -20
  122. package/reference/claude-config/rules/active-change-index.md +0 -22
  123. package/reference/claude-config/rules/agent-start-here.md +0 -22
  124. package/reference/claude-config/rules/deployment.md +0 -22
  125. package/reference/claude-config/rules/error-handling.md +0 -22
  126. package/reference/claude-config/rules/execution.md +0 -22
  127. package/reference/claude-config/rules/frontend.md +0 -22
  128. package/reference/claude-config/rules/observability.md +0 -22
  129. package/reference/claude-config/rules/operations.md +0 -22
  130. package/reference/claude-config/rules/organization-model.md +0 -22
  131. package/reference/claude-config/rules/organization-os.md +0 -22
  132. package/reference/claude-config/rules/package-taxonomy.md +0 -22
  133. package/reference/claude-config/rules/platform.md +0 -22
  134. package/reference/claude-config/rules/shared-types.md +0 -22
  135. package/reference/claude-config/rules/task-tracking.md +0 -22
  136. package/reference/claude-config/rules/topbar-actions.md +0 -70
  137. package/reference/claude-config/rules/ui.md +0 -22
  138. package/reference/claude-config/rules/vibe.md +0 -22
  139. package/reference/claude-config/scripts/statusline-command.js +0 -18
  140. package/reference/claude-config/settings.json +0 -30
  141. package/reference/claude-config/skills/client/SKILL.md +0 -201
  142. package/reference/claude-config/skills/deploy/SKILL.md +0 -159
  143. package/reference/claude-config/skills/dsp/SKILL.md +0 -66
  144. package/reference/claude-config/skills/elevasis/SKILL.md +0 -251
  145. package/reference/claude-config/skills/explore/SKILL.md +0 -78
  146. package/reference/claude-config/skills/git-sync/SKILL.md +0 -166
  147. package/reference/claude-config/skills/om/SKILL.md +0 -475
  148. package/reference/claude-config/skills/om/operations/build.md +0 -237
  149. package/reference/claude-config/skills/om/operations/codify-level-a.md +0 -109
  150. package/reference/claude-config/skills/om/operations/codify-level-b.md +0 -159
  151. package/reference/claude-config/skills/om/operations/customers.md +0 -114
  152. package/reference/claude-config/skills/om/operations/features.md +0 -88
  153. package/reference/claude-config/skills/om/operations/goals.md +0 -123
  154. package/reference/claude-config/skills/om/operations/identity.md +0 -97
  155. package/reference/claude-config/skills/om/operations/labels.md +0 -110
  156. package/reference/claude-config/skills/om/operations/offerings.md +0 -114
  157. package/reference/claude-config/skills/om/operations/roles.md +0 -104
  158. package/reference/claude-config/skills/om/operations/scaffold.md +0 -163
  159. package/reference/claude-config/skills/om/operations/techStack.md +0 -38
  160. package/reference/claude-config/skills/project/SKILL.md +0 -1114
  161. package/reference/claude-config/skills/run-ui/SKILL.md +0 -73
  162. package/reference/claude-config/skills/save/SKILL.md +0 -183
  163. package/reference/claude-config/skills/setup/SKILL.md +0 -290
  164. package/reference/claude-config/skills/status/SKILL.md +0 -59
  165. package/reference/claude-config/skills/submit-request/SKILL.md +0 -180
  166. package/reference/claude-config/skills/sync/SKILL.md +0 -47
  167. package/reference/claude-config/skills/tutorial/SKILL.md +0 -259
  168. package/reference/claude-config/skills/tutorial/progress-template.md +0 -74
  169. package/reference/claude-config/skills/tutorial/technical.md +0 -1303
  170. package/reference/claude-config/skills/tutorial/vibe-coder.md +0 -890
  171. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +0 -27
  172. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +0 -30
  173. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +0 -73
  174. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +0 -86
  175. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +0 -55
  176. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +0 -97
  177. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +0 -112
  178. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +0 -93
  179. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +0 -58
  180. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +0 -56
  181. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +0 -71
  182. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +0 -83
  183. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +0 -59
  184. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +0 -42
  185. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +0 -60
  186. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +0 -37
  187. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +0 -34
  188. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +0 -38
  189. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +0 -32
  190. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +0 -33
  191. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +0 -69
  192. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +0 -30
  193. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +0 -45
  194. package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +0 -52
  195. package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +0 -33
  196. package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +0 -32
  197. package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +0 -43
  198. package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +0 -40
  199. package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +0 -61
  200. package/reference/claude-config/sync-notes/2026-05-23-branding-names-to-identity.md +0 -49
  201. package/reference/claude-config/sync-notes/2026-05-23-lead-gen-manage-access.md +0 -31
  202. package/reference/claude-config/sync-notes/2026-05-23-om-deployment-drift-detection.md +0 -42
  203. package/reference/claude-config/sync-notes/2026-05-23-om-full-model-deploy-contract.md +0 -33
  204. package/reference/claude-config/sync-notes/2026-05-23-ui-sdk-package-fixes.md +0 -37
  205. package/reference/claude-config/sync-notes/2026-05-24-platform-invite-router-core-baseline.md +0 -28
  206. package/reference/claude-config/sync-notes/2026-05-24-system-interface-readiness.md +0 -43
  207. package/reference/claude-config/sync-notes/2026-05-25-invitation-login-loader.md +0 -26
  208. package/reference/claude-config/sync-notes/2026-05-25-om-topbar-requests.md +0 -33
  209. package/reference/claude-config/sync-notes/2026-05-25-system-interface-profile-registry-and-substrate.md +0 -35
  210. package/reference/claude-config/sync-notes/2026-05-25-tenant-om-scaffold-cli.md +0 -49
  211. package/reference/claude-config/sync-notes/2026-05-25-vibe-operate-intent.md +0 -47
  212. package/reference/claude-config/sync-notes/2026-05-28-om-snapshot-sdk-workflow-config.md +0 -33
  213. package/reference/claude-config/sync-notes/2026-05-30-client-source-and-om-profiles.md +0 -39
  214. package/reference/claude-config/sync-notes/2026-06-02-knowledge-nested-group-routing.md +0 -27
  215. package/reference/claude-config/sync-notes/2026-06-02-nest-projects-under-platform.md +0 -45
  216. package/reference/claude-config/sync-notes/2026-06-03-skill-autogen-and-client-skill.md +0 -34
  217. package/reference/claude-config/sync-notes/2026-06-04-scaffold-registry-lane-severity.md +0 -34
  218. package/reference/claude-config/sync-notes/2026-06-05-appearance-app-mode-decouple.md +0 -29
  219. package/reference/claude-config/sync-notes/2026-06-05-ontology-endpoint-rename-and-knowledge-browser-ui.md +0 -86
  220. package/reference/claude-config/sync-notes/2026-06-06-om-build-systems-scaffold.md +0 -47
  221. package/reference/claude-config/sync-notes/2026-06-06-om-item-copy-references.md +0 -50
  222. package/reference/claude-config/sync-notes/2026-06-08-knowledge-base-page-not-found-fix.md +0 -76
  223. package/reference/claude-config/sync-notes/2026-06-09-agent-sessions-public-agent-chat-route.md +0 -75
  224. package/reference/claude-config/sync-notes/2026-06-09-sdk-cli-load-org-model-resolution.md +0 -42
  225. package/reference/claude-config/sync-notes/2026-06-12-agent-grants-visualizer-operations.md +0 -30
  226. package/reference/claude-config/sync-notes/2026-06-14-session-ux-and-project-cli-json.md +0 -33
  227. package/reference/claude-config/sync-notes/2026-06-14-shared-session-conversation-view.md +0 -26
  228. package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +0 -46
  229. package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +0 -34
  230. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +0 -52
  231. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +0 -47
  232. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +0 -75
  233. package/reference/claude-config/sync-notes/2026-07-23-agent-session-memory.md +0 -49
  234. package/reference/claude-config/sync-notes/2026-07-23-workos-org-marker.md +0 -50
  235. package/reference/claude-config/sync-notes/2026-07-24-claude-5-models-and-session-surface-fixes.md +0 -116
  236. package/reference/claude-config/sync-notes/2026-07-27-agent-strict-output-and-turn-drift.md +0 -73
  237. package/reference/claude-config/sync-notes/2026-07-28-agent-reply-is-its-own-field.md +0 -84
  238. package/reference/claude-config/sync-notes/2026-07-30-login-screen-and-member-provisioning-state.md +0 -114
  239. package/reference/claude-config/sync-notes/2026-08-02-auth-guard-defaults-and-truncation-fix.md +0 -122
  240. package/reference/claude-config/sync-notes/2026-08-03-agent-prose-escape-normalization.md +0 -88
  241. package/reference/claude-config/sync-notes/2026-08-03-cli-gateway-errors-and-request-timeout.md +0 -120
  242. package/reference/claude-config/sync-notes/README.md +0 -43
  243. package/reference/sdk/framework/interaction-guidance.mdx +0 -182
  244. package/reference/sdk/framework/memory.mdx +0 -326
  245. package/reference/sdk/framework/resource-documentation.mdx +0 -90
  246. package/reference/sdk/roadmap.mdx +0 -164
@@ -263,6 +263,31 @@ interface AgentScopedLogger {
263
263
  lifecycle(lifecycle: AgentLifecycle, stage: 'failed', data: AgentLifecycleFailedData): void;
264
264
  reasoning(output: string, iteration: number, startTime: number, endTime: number, duration: number): void;
265
265
  action(actionType: string, message: string, iteration: number, startTime: number, endTime: number, duration: number): void;
266
+ /**
267
+ * Time a unit of work and emit the single `action` event it produces.
268
+ *
269
+ * Captures `Date.now()` immediately before and after `work()`, then emits the same event
270
+ * `action()` would -- collapsing the repeated `startTime = Date.now(); ...work...; endTime =
271
+ * Date.now(); action(actionType, message, iteration, startTime, endTime, endTime - startTime)`
272
+ * boilerplate found at memory-write and tool-result call sites into a single call.
273
+ *
274
+ * `actionType` may be a function of the work's result for the rare call site where the emitted
275
+ * type itself depends on the outcome (e.g. "deleted" vs "delete of a missing key") -- most
276
+ * callers just pass a fixed string.
277
+ *
278
+ * **Throw behavior:** if `work` throws synchronously or its promise rejects, the error propagates
279
+ * to the caller UNCHANGED and NO `action` event is emitted -- there is no completed unit of work
280
+ * to describe, so this deliberately does not swallow the error or log a synthetic failure action.
281
+ * A call site that needs an error-path log keeps calling `action()` manually from its own
282
+ * `catch` block.
283
+ *
284
+ * @param actionType - Action type string, or a function deriving it from the result
285
+ * @param iteration - Current iteration number
286
+ * @param work - The unit of work to time (sync or async)
287
+ * @param message - Builds the human-readable message from the work's result
288
+ * @returns The value returned by `work`
289
+ */
290
+ timed<T>(actionType: string | ((result: T) => string), iteration: number, work: () => Promise<T> | T, message: (result: T) => string): Promise<T>;
266
291
  toolCall(toolName: string, iteration: number, startTime: number, endTime: number, duration: number, success: boolean, error?: string, input?: unknown, output?: unknown): void;
267
292
  }
268
293
 
@@ -279,7 +304,19 @@ declare const ResourceGovernanceStatusSchema: z.ZodEnum<{
279
304
  deprecated: "deprecated";
280
305
  archived: "archived";
281
306
  }>;
282
- declare const WorkflowResourceEntrySchema$1: z.ZodObject<{
307
+ declare const ResourceOntologyBindingSchema: z.ZodObject<{
308
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
309
+ primaryAction: z.ZodOptional<z.ZodString>;
310
+ reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
311
+ writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
312
+ usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
313
+ emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
314
+ contract: z.ZodOptional<z.ZodObject<{
315
+ input: z.ZodOptional<z.ZodString>;
316
+ output: z.ZodOptional<z.ZodString>;
317
+ }, z.core.$strip>>;
318
+ }, z.core.$strip>;
319
+ declare const WorkflowResourceEntrySchema: z.ZodObject<{
283
320
  id: z.ZodString;
284
321
  order: z.ZodDefault<z.ZodNumber>;
285
322
  systemPath: z.ZodString;
@@ -330,7 +367,7 @@ declare const WorkflowResourceEntrySchema$1: z.ZodObject<{
330
367
  }>>;
331
368
  }, z.core.$strip>>>;
332
369
  }, z.core.$strip>;
333
- declare const AgentResourceEntrySchema$1: z.ZodObject<{
370
+ declare const AgentResourceEntrySchema: z.ZodObject<{
334
371
  id: z.ZodString;
335
372
  order: z.ZodDefault<z.ZodNumber>;
336
373
  systemPath: z.ZodString;
@@ -412,6 +449,46 @@ declare const AgentResourceEntrySchema$1: z.ZodObject<{
412
449
  }>>;
413
450
  }, z.core.$strip>>>;
414
451
  }, z.core.$strip>;
452
+ declare const IntegrationResourceEntrySchema: z.ZodObject<{
453
+ id: z.ZodString;
454
+ order: z.ZodDefault<z.ZodNumber>;
455
+ systemPath: z.ZodString;
456
+ title: z.ZodOptional<z.ZodString>;
457
+ description: z.ZodOptional<z.ZodString>;
458
+ ownerRoleId: z.ZodOptional<z.ZodString>;
459
+ status: z.ZodEnum<{
460
+ active: "active";
461
+ deprecated: "deprecated";
462
+ archived: "archived";
463
+ }>;
464
+ ontology: z.ZodOptional<z.ZodObject<{
465
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
466
+ primaryAction: z.ZodOptional<z.ZodString>;
467
+ reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
468
+ writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
469
+ usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
470
+ emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
471
+ contract: z.ZodOptional<z.ZodObject<{
472
+ input: z.ZodOptional<z.ZodString>;
473
+ output: z.ZodOptional<z.ZodString>;
474
+ }, z.core.$strip>>;
475
+ }, z.core.$strip>>;
476
+ codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
477
+ path: z.ZodString;
478
+ role: z.ZodEnum<{
479
+ entrypoint: "entrypoint";
480
+ handler: "handler";
481
+ schema: "schema";
482
+ test: "test";
483
+ docs: "docs";
484
+ config: "config";
485
+ }>;
486
+ symbol: z.ZodOptional<z.ZodString>;
487
+ description: z.ZodOptional<z.ZodString>;
488
+ }, z.core.$strip>>>;
489
+ kind: z.ZodLiteral<"integration">;
490
+ provider: z.ZodString;
491
+ }, z.core.$strip>;
415
492
  declare const ResourceEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
416
493
  id: z.ZodString;
417
494
  order: z.ZodDefault<z.ZodNumber>;
@@ -631,8 +708,8 @@ declare const ResourceEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
631
708
  }, z.core.$strip>]>;
632
709
  }, z.core.$strip>], "kind">;
633
710
  type ResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>;
634
- type WorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema$1>;
635
- type AgentResourceEntry = z.infer<typeof AgentResourceEntrySchema$1>;
711
+ type WorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>;
712
+ type AgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>;
636
713
  type ResourceEntry = z.infer<typeof ResourceEntrySchema>;
637
714
 
638
715
  /**
@@ -753,13 +830,6 @@ interface MemoryStatus {
753
830
  storedHistoryPercent: number;
754
831
  historyBudget: number;
755
832
  }
756
- /**
757
- * Memory constraints (optional limits)
758
- */
759
- interface MemoryConstraints {
760
- maxSessionMemoryKeys?: number;
761
- maxMemoryTokens?: number;
762
- }
763
833
 
764
834
  /**
765
835
  * Types for the schema compiler. `compile.ts` walks a `JsonSchema` once, driven entirely by a
@@ -1156,14 +1226,13 @@ declare class MemoryManager {
1156
1226
  private memory;
1157
1227
  private constraints;
1158
1228
  private logger?;
1159
- private cachedSnapshot?;
1160
1229
  /**
1161
1230
  * Rolling correction for `estimateTokens`'s bias, learned from real provider usage.
1162
1231
  * `undefined` until the first `recordActualUsage` call -- the cold-start state, where
1163
1232
  * `estimate()` returns the raw `estimateTokens` output unscaled. See `recordActualUsage`.
1164
1233
  */
1165
1234
  private tokenCorrectionFactor?;
1166
- constructor(memory: AgentMemory, constraints?: MemoryConstraints, logger?: AgentScopedLogger | undefined);
1235
+ constructor(memory: AgentMemory, constraints?: AgentConstraints, logger?: AgentScopedLogger | undefined);
1167
1236
  /**
1168
1237
  * Record how far `estimateTokens` was from reality on a real provider call, and roll it into a
1169
1238
  * correction applied to every estimate this instance makes from here on -- `getStatus`'s three
@@ -1258,17 +1327,14 @@ declare class MemoryManager {
1258
1327
  */
1259
1328
  getStatus(currentTurn?: number): MemoryStatus;
1260
1329
  /**
1261
- * Create memory snapshot for persistence
1262
- * Caches snapshot internally for later retrieval
1330
+ * Create a memory snapshot for persistence.
1331
+ *
1332
+ * Stateless: every call returns a fresh `structuredClone` of the current memory, so the caller
1333
+ * owns caching if it needs to hold onto the result across calls (see `Agent.memorySnapshot`).
1334
+ *
1263
1335
  * @returns Deep copy of current memory state
1264
1336
  */
1265
- toSnapshot(): AgentMemory;
1266
- /**
1267
- * Get cached memory snapshot
1268
- * Returns snapshot created by toSnapshot()
1269
- * @returns Cached snapshot (undefined if toSnapshot() not called yet)
1270
- */
1271
- getSnapshot(): AgentMemory | undefined;
1337
+ snapshot(): AgentMemory;
1272
1338
  /**
1273
1339
  * Build the framework framing and the untrusted data envelope for an LLM call.
1274
1340
  *
@@ -1571,8 +1637,7 @@ declare const SystemApiInterfaceSchema: z.ZodObject<{
1571
1637
  resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
1572
1638
  readinessContract: z.ZodOptional<z.ZodObject<{
1573
1639
  requiredObjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
1574
- requiredCatalogs: z.ZodDefault<z.ZodArray<z.ZodString>>;
1575
- requiredKinds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1640
+ requiredCatalogs: z.ZodArray<z.ZodString>;
1576
1641
  }, z.core.$strict>>;
1577
1642
  }, z.core.$strict>;
1578
1643
  type JsonPrimitive = string | number | boolean | null;
@@ -1678,7 +1743,7 @@ declare const LinkSchema: z.ZodObject<{
1678
1743
  }, z.core.$strip>;
1679
1744
  type Link = z.infer<typeof LinkSchema>;
1680
1745
 
1681
- declare const OrganizationModelSchema$1: z.ZodObject<{
1746
+ declare const OrganizationModelSchema: z.ZodObject<{
1682
1747
  version: z.ZodDefault<z.ZodLiteral<1>>;
1683
1748
  snapshotHash: z.ZodOptional<z.ZodString>;
1684
1749
  domainMetadata: z.ZodPipe<z.ZodDefault<z.ZodObject<{
@@ -2740,7 +2805,11 @@ declare const OrganizationModelSchema$1: z.ZodObject<{
2740
2805
  }, z.core.$strip>>>>;
2741
2806
  }, z.core.$strip>;
2742
2807
 
2743
- type OrganizationModel$1 = z.infer<typeof OrganizationModelSchema$1>;
2808
+ type OrganizationModel = z.infer<typeof OrganizationModelSchema>;
2809
+ type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>;
2810
+ type OrganizationModelWorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>;
2811
+ type OrganizationModelAgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>;
2812
+ type OrganizationModelIntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>;
2744
2813
 
2745
2814
  /**
2746
2815
  * AIUsageCollector
@@ -3036,10 +3105,15 @@ interface ResourceMetricsConfig {
3036
3105
  * - API process: provides createLLMAdapter (real SDKs + process.env API keys)
3037
3106
  * - SDK worker: provides PostMessageLLMAdapter (proxies via platform.call)
3038
3107
  *
3039
- * Uses `any` for optional params so both the real createLLMAdapter (with typed
3040
- * AIUsageCollector/AICallContext) and the worker proxy (which ignores them) satisfy the type.
3041
- */
3042
- type LLMAdapterFactory = (config: ModelConfig, ...args: any[]) => LLMAdapter;
3108
+ * Signature mirrors `createLLMAdapter`'s real parameter list. `context` is narrowed to the two
3109
+ * shapes an agent ever actually builds (`processReasoning` passes `AgentReasoningContext`,
3110
+ * `Agent.callLLMForOutput` passes `AgentCompletionContext`) rather than the full `AICallContext`
3111
+ * union `createLLMAdapter` accepts -- a narrower optional param here is still assignable to the
3112
+ * wider one there. `createPostMessageAdapterFactory()`'s worker proxy ignores every param past
3113
+ * `config`; a shorter-arity function remains assignable to a longer optional-param function type,
3114
+ * so it still satisfies this type unchanged.
3115
+ */
3116
+ type LLMAdapterFactory = (config: ModelConfig, aiUsageCollector?: AIUsageCollector, callType?: BaseAICall['callType'], context?: AgentReasoningContext | AgentCompletionContext, organizationId?: string) => LLMAdapter;
3043
3117
  type AgentKind = 'orchestrator' | 'specialist' | 'utility' | 'platform';
3044
3118
  interface AgentConfig extends ResourceDefinition {
3045
3119
  type: 'agent';
@@ -3669,7 +3743,7 @@ interface DeploymentSpec {
3669
3743
  /** Deployment version (semver) */
3670
3744
  version: string;
3671
3745
  /** Optional full Organization Model snapshot used for OM-code validation and deployment persistence */
3672
- organizationModel?: OrganizationModel$1;
3746
+ organizationModel?: OrganizationModel;
3673
3747
  /** Workflow definitions */
3674
3748
  workflows?: WorkflowDefinition[];
3675
3749
  /** Agent definitions */
@@ -3719,72 +3793,6 @@ interface ResolvedKnowledgeLayout {
3719
3793
  }
3720
3794
  declare function runKnowledgeCodegen(layout: ResolvedKnowledgeLayout): Promise<void>;
3721
3795
 
3722
- declare const ResourceOntologyBindingSchema = z
3723
- .object({
3724
- actions: z.array(OntologyIdSchema).optional(),
3725
- primaryAction: OntologyIdSchema.optional(),
3726
- reads: z.array(OntologyIdSchema).optional(),
3727
- writes: z.array(OntologyIdSchema).optional(),
3728
- usesCatalogs: z.array(OntologyIdSchema).optional(),
3729
- emits: z.array(OntologyIdSchema).optional(),
3730
- /**
3731
- * Optional typed contract binding for this resource's workflow I/O.
3732
- * Each ref is a `package/subpath#ExportName` string that resolves to a
3733
- * Zod schema in the tenant-owned organization model package.
3734
- *
3735
- * Absence of this field preserves all existing behavior — it is additive + optional.
3736
- * Tier-1 validation (schema.ts): ref-string shape only (browser-safe, no imports).
3737
- * Tier-2 validation (om:verify): intra-package typed-map resolution asserts ZodType.
3738
- */
3739
- contract: z
3740
- .object({
3741
- input: ContractRefSchema.optional(),
3742
- output: ContractRefSchema.optional()
3743
- })
3744
- .optional()
3745
- })
3746
- .superRefine((binding, ctx) => {
3747
- if (binding.primaryAction === undefined) return
3748
- if (binding.actions?.includes(binding.primaryAction)) return
3749
-
3750
- ctx.addIssue({
3751
- code: z.ZodIssueCode.custom,
3752
- path: ['primaryAction'],
3753
- message: 'Resource ontology primaryAction must be included in actions'
3754
- })
3755
- })
3756
-
3757
- declare const WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
3758
- kind: z.literal('workflow'),
3759
- emits: z.array(EventEmissionDescriptorSchema).optional()
3760
- })
3761
-
3762
- declare const AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
3763
- kind: z.literal('agent'),
3764
- /** Mirrors code-side AgentConfig.kind. */
3765
- agentKind: AgentKindSchema,
3766
- /** Role this agent embodies, if any. */
3767
- actsAsRoleId: ModelIdSchema.meta({ ref: 'role' }).optional(),
3768
- /** Mirrors AgentConfig.sessionCapable. */
3769
- sessionCapable: z.boolean(),
3770
- /** Broad/composite callable entry points orchestrated by this agent. */
3771
- invocations: z.array(ActionInvocationSchema).default([]),
3772
- emits: z.array(EventEmissionDescriptorSchema).optional()
3773
- })
3774
-
3775
- declare const IntegrationResourceEntrySchema = ResourceEntryBaseSchema.extend({
3776
- kind: z.literal('integration'),
3777
- provider: z.string().trim().min(1).max(100)
3778
- })
3779
-
3780
- declare const OrganizationModelSchema = OrganizationModelSchemaBase.superRefine(refineOrganizationModel)
3781
-
3782
- type OrganizationModel = z.infer<typeof OrganizationModelSchema>
3783
- type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
3784
- type OrganizationModelWorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>
3785
- type OrganizationModelAgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>
3786
- type OrganizationModelIntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>
3787
-
3788
3796
  type ResourceOntologyBindingResolver = (resourceId: string) => OrganizationModelResourceOntologyBinding | undefined;
3789
3797
  type WorkflowResourceDescriptorResolver = (resourceId: string) => OrganizationModelWorkflowResourceEntry;
3790
3798
  type AgentResourceDescriptorResolver = (resourceId: string) => OrganizationModelAgentResourceEntry;
@@ -226,6 +226,31 @@ interface AgentScopedLogger {
226
226
  lifecycle(lifecycle: AgentLifecycle, stage: 'failed', data: AgentLifecycleFailedData): void;
227
227
  reasoning(output: string, iteration: number, startTime: number, endTime: number, duration: number): void;
228
228
  action(actionType: string, message: string, iteration: number, startTime: number, endTime: number, duration: number): void;
229
+ /**
230
+ * Time a unit of work and emit the single `action` event it produces.
231
+ *
232
+ * Captures `Date.now()` immediately before and after `work()`, then emits the same event
233
+ * `action()` would -- collapsing the repeated `startTime = Date.now(); ...work...; endTime =
234
+ * Date.now(); action(actionType, message, iteration, startTime, endTime, endTime - startTime)`
235
+ * boilerplate found at memory-write and tool-result call sites into a single call.
236
+ *
237
+ * `actionType` may be a function of the work's result for the rare call site where the emitted
238
+ * type itself depends on the outcome (e.g. "deleted" vs "delete of a missing key") -- most
239
+ * callers just pass a fixed string.
240
+ *
241
+ * **Throw behavior:** if `work` throws synchronously or its promise rejects, the error propagates
242
+ * to the caller UNCHANGED and NO `action` event is emitted -- there is no completed unit of work
243
+ * to describe, so this deliberately does not swallow the error or log a synthetic failure action.
244
+ * A call site that needs an error-path log keeps calling `action()` manually from its own
245
+ * `catch` block.
246
+ *
247
+ * @param actionType - Action type string, or a function deriving it from the result
248
+ * @param iteration - Current iteration number
249
+ * @param work - The unit of work to time (sync or async)
250
+ * @param message - Builds the human-readable message from the work's result
251
+ * @returns The value returned by `work`
252
+ */
253
+ timed<T>(actionType: string | ((result: T) => string), iteration: number, work: () => Promise<T> | T, message: (result: T) => string): Promise<T>;
229
254
  toolCall(toolName: string, iteration: number, startTime: number, endTime: number, duration: number, success: boolean, error?: string, input?: unknown, output?: unknown): void;
230
255
  }
231
256
 
@@ -716,13 +741,6 @@ interface MemoryStatus {
716
741
  storedHistoryPercent: number;
717
742
  historyBudget: number;
718
743
  }
719
- /**
720
- * Memory constraints (optional limits)
721
- */
722
- interface MemoryConstraints {
723
- maxSessionMemoryKeys?: number;
724
- maxMemoryTokens?: number;
725
- }
726
744
 
727
745
  /**
728
746
  * Types for the schema compiler. `compile.ts` walks a `JsonSchema` once, driven entirely by a
@@ -1119,14 +1137,13 @@ declare class MemoryManager {
1119
1137
  private memory;
1120
1138
  private constraints;
1121
1139
  private logger?;
1122
- private cachedSnapshot?;
1123
1140
  /**
1124
1141
  * Rolling correction for `estimateTokens`'s bias, learned from real provider usage.
1125
1142
  * `undefined` until the first `recordActualUsage` call -- the cold-start state, where
1126
1143
  * `estimate()` returns the raw `estimateTokens` output unscaled. See `recordActualUsage`.
1127
1144
  */
1128
1145
  private tokenCorrectionFactor?;
1129
- constructor(memory: AgentMemory, constraints?: MemoryConstraints, logger?: AgentScopedLogger | undefined);
1146
+ constructor(memory: AgentMemory, constraints?: AgentConstraints, logger?: AgentScopedLogger | undefined);
1130
1147
  /**
1131
1148
  * Record how far `estimateTokens` was from reality on a real provider call, and roll it into a
1132
1149
  * correction applied to every estimate this instance makes from here on -- `getStatus`'s three
@@ -1221,17 +1238,14 @@ declare class MemoryManager {
1221
1238
  */
1222
1239
  getStatus(currentTurn?: number): MemoryStatus;
1223
1240
  /**
1224
- * Create memory snapshot for persistence
1225
- * Caches snapshot internally for later retrieval
1241
+ * Create a memory snapshot for persistence.
1242
+ *
1243
+ * Stateless: every call returns a fresh `structuredClone` of the current memory, so the caller
1244
+ * owns caching if it needs to hold onto the result across calls (see `Agent.memorySnapshot`).
1245
+ *
1226
1246
  * @returns Deep copy of current memory state
1227
1247
  */
1228
- toSnapshot(): AgentMemory;
1229
- /**
1230
- * Get cached memory snapshot
1231
- * Returns snapshot created by toSnapshot()
1232
- * @returns Cached snapshot (undefined if toSnapshot() not called yet)
1233
- */
1234
- getSnapshot(): AgentMemory | undefined;
1248
+ snapshot(): AgentMemory;
1235
1249
  /**
1236
1250
  * Build the framework framing and the untrusted data envelope for an LLM call.
1237
1251
  *
@@ -4535,10 +4549,6 @@ type Database = {
4535
4549
  Args: Record<PropertyKey, never>;
4536
4550
  Returns: string;
4537
4551
  };
4538
- detect_stalled_executions: {
4539
- Args: Record<PropertyKey, never>;
4540
- Returns: undefined;
4541
- };
4542
4552
  execute_session_turn: {
4543
4553
  Args: {
4544
4554
  p_session_id: string;
@@ -6140,8 +6150,7 @@ declare const SystemApiInterfaceSchema: z.ZodObject<{
6140
6150
  resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
6141
6151
  readinessContract: z.ZodOptional<z.ZodObject<{
6142
6152
  requiredObjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
6143
- requiredCatalogs: z.ZodDefault<z.ZodArray<z.ZodString>>;
6144
- requiredKinds: z.ZodOptional<z.ZodArray<z.ZodString>>;
6153
+ requiredCatalogs: z.ZodArray<z.ZodString>;
6145
6154
  }, z.core.$strict>>;
6146
6155
  }, z.core.$strict>;
6147
6156
  type JsonPrimitive = string | number | boolean | null;
@@ -10609,10 +10618,15 @@ interface ResourceMetricsConfig {
10609
10618
  * - API process: provides createLLMAdapter (real SDKs + process.env API keys)
10610
10619
  * - SDK worker: provides PostMessageLLMAdapter (proxies via platform.call)
10611
10620
  *
10612
- * Uses `any` for optional params so both the real createLLMAdapter (with typed
10613
- * AIUsageCollector/AICallContext) and the worker proxy (which ignores them) satisfy the type.
10614
- */
10615
- type LLMAdapterFactory = (config: ModelConfig, ...args: any[]) => LLMAdapter;
10621
+ * Signature mirrors `createLLMAdapter`'s real parameter list. `context` is narrowed to the two
10622
+ * shapes an agent ever actually builds (`processReasoning` passes `AgentReasoningContext`,
10623
+ * `Agent.callLLMForOutput` passes `AgentCompletionContext`) rather than the full `AICallContext`
10624
+ * union `createLLMAdapter` accepts -- a narrower optional param here is still assignable to the
10625
+ * wider one there. `createPostMessageAdapterFactory()`'s worker proxy ignores every param past
10626
+ * `config`; a shorter-arity function remains assignable to a longer optional-param function type,
10627
+ * so it still satisfies this type unchanged.
10628
+ */
10629
+ type LLMAdapterFactory = (config: ModelConfig, aiUsageCollector?: AIUsageCollector, callType?: BaseAICall['callType'], context?: AgentReasoningContext | AgentCompletionContext, organizationId?: string) => LLMAdapter;
10616
10630
  type AgentKind = 'orchestrator' | 'specialist' | 'utility' | 'platform';
10617
10631
  interface AgentConfig extends ResourceDefinition {
10618
10632
  type: 'agent';