@inneranimalmedia/agentsam-sdk 2.6.9 → 2.6.11

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 (392) hide show
  1. package/README.md +21 -0
  2. package/TRADEMARKS.md +22 -0
  3. package/apps/README.md +3 -0
  4. package/apps/cad-creator/LICENSE +21 -0
  5. package/apps/cad-creator/README.md +4 -1
  6. package/apps/cad-creator/shared/cad/package.json +1 -1
  7. package/apps/client-cms-editor/LICENSE +21 -0
  8. package/apps/client-cms-editor/README.md +3 -0
  9. package/apps/client-cms-editor/backend/package.json +3 -3
  10. package/apps/client-cms-editor/frontend/package.json +4 -4
  11. package/apps/client-cms-editor/package-lock.json +43 -43
  12. package/apps/client-cms-editor/package.json +3 -3
  13. package/apps/client-cms-editor/reference/harvest/HARVEST_RECEIPT.json +1 -1
  14. package/apps/client-cms-editor/reference/harvest/README.md +1 -1
  15. package/apps/client-cms-editor/reference/harvest/plans/ARCHIVE-INTAKE.md +1 -1
  16. package/apps/client-cms-editor/reference/harvest/plans/HARVEST-INDEX.md +1 -1
  17. package/apps/client-cms-editor/reference/harvest/plans/TOOLING-LAB.md +1 -1
  18. package/apps/client-cms-editor/shared/cms/package.json +2 -2
  19. package/docs/MINI.md +4 -2
  20. package/docs/REPO_FILE_MAP.txt +0 -1
  21. package/docs/SOURCE_ARCHITECTURE.md +1 -1
  22. package/docs/architecture/DUAL_ANALYTICS_PRODUCT.md +140 -0
  23. package/docs/architecture/HOOKS-MODELS-SELF-HOSTING-PLAN.md +199 -0
  24. package/docs/content-studio/REVISION_GATE_2026-09-27.md +1 -1
  25. package/docs/engineering/go-portability/01-product-project-deployment-authority.md +69 -0
  26. package/docs/engineering/provider-internal-renames/01-lane-initialization.md +20 -0
  27. package/docs/engineering/provider-internal-renames/01a-runtime-environment-contract.md +115 -0
  28. package/docs/engineering/provider-internal-renames/02-cfoa.md +57 -0
  29. package/docs/engineering/provider-internal-renames/03-gclioa.md +32 -0
  30. package/docs/engineering/provider-internal-renames/04-goaude.md +50 -0
  31. package/docs/engineering/provider-internal-renames/05-gdrv.md +33 -0
  32. package/docs/engineering/provider-internal-renames/06-verification.md +103 -0
  33. package/docs/engineering/provider-internal-renames/README.md +77 -0
  34. package/docs/engineering/provider-internal-renames/runtime-environment-contract.json +220 -0
  35. package/docs/engineering/test-diagnostics/go-cli-test-hang-20261003.md +49 -0
  36. package/docs/engineering/test-diagnostics/go-skip-deploy-docker-fix.md +90 -0
  37. package/docs/knowledge-service-verification.md +3 -3
  38. package/docs/plans/AGENTSAM-SUSPEND-QUEUE-KNOWLEDGE-RDP-2026-10-03.md +870 -0
  39. package/docs/plans/LOCAL-STUDIO-GRADUATION-2026-09-26.md +9 -9
  40. package/docs/plans/MACHINE-FIRST-APPS-TUI-2026-09-24.md +11 -11
  41. package/docs/plans/RECONCILIATION-2026-09-19.md +6 -6
  42. package/docs/plans/SAM_WORK_PROTOCOL.md +667 -0
  43. package/docs/plans/TOMORROW-EXTENSIVE-TODO-2026-09-26.md +2 -2
  44. package/docs/plans/UNIVERSAL-INGEST-MACHINE-FIRST-2026-09-24.md +3 -3
  45. package/examples/hyperspace-demo/index.html +16 -0
  46. package/examples/hyperspace-demo/package.json +21 -0
  47. package/examples/hyperspace-demo/src/main.tsx +277 -0
  48. package/examples/hyperspace-demo/tsconfig.json +9 -0
  49. package/examples/hyperspace-demo/vite.config.ts +24 -0
  50. package/migrations/d1/0020_agentsam_receipt_catalog.sql +35 -0
  51. package/migrations/runtime/0005_agentsam_hooks.sql +87 -0
  52. package/migrations/runtime/0006_agent_run_suspend_activity.sql +53 -0
  53. package/migrations/runtime/0007_queue_control.sql +40 -0
  54. package/migrations/runtime/0008_agent_run_dependencies.sql +24 -0
  55. package/migrations/runtime/0008_analytics_legacy_bootstrap.sql +43 -0
  56. package/migrations/runtime/0009_analytics_authority.sql +108 -0
  57. package/package.json +45 -14
  58. package/packages/agentsam-brand/README.md +3 -0
  59. package/packages/agentsam-brand/package.json +2 -2
  60. package/packages/agentsam-brand/src/core/v2/compile.js +1 -1
  61. package/packages/agentsam-brand/src/core/v2/schema.js +1 -1
  62. package/packages/agentsam-contracts/dist/adapter.d.ts +22 -0
  63. package/packages/agentsam-contracts/dist/adapter.js +0 -0
  64. package/packages/agentsam-contracts/dist/agent.d.ts +66 -0
  65. package/packages/agentsam-contracts/dist/agent.js +15 -0
  66. package/packages/agentsam-contracts/dist/artifacts.d.ts +70 -0
  67. package/packages/agentsam-contracts/dist/artifacts.js +0 -0
  68. package/packages/agentsam-contracts/dist/authority.d.ts +21 -0
  69. package/packages/agentsam-contracts/dist/authority.js +0 -0
  70. package/packages/agentsam-contracts/dist/context.d.ts +14 -0
  71. package/packages/agentsam-contracts/dist/context.js +0 -0
  72. package/packages/agentsam-contracts/dist/errors.d.ts +121 -0
  73. package/packages/agentsam-contracts/dist/errors.js +5 -0
  74. package/packages/agentsam-contracts/dist/events.d.ts +53 -0
  75. package/packages/agentsam-contracts/dist/events.js +0 -0
  76. package/packages/agentsam-contracts/dist/execution.d.ts +38 -0
  77. package/packages/agentsam-contracts/dist/execution.js +0 -0
  78. package/packages/agentsam-contracts/dist/hooks.d.ts +31 -0
  79. package/packages/agentsam-contracts/dist/hooks.js +0 -0
  80. package/packages/agentsam-contracts/dist/identity.d.ts +15 -0
  81. package/packages/agentsam-contracts/dist/identity.js +0 -0
  82. package/packages/agentsam-contracts/dist/index.d.ts +16 -0
  83. package/packages/agentsam-contracts/dist/index.js +164 -0
  84. package/packages/agentsam-contracts/dist/models.d.ts +9 -0
  85. package/packages/agentsam-contracts/dist/models.js +0 -0
  86. package/packages/agentsam-contracts/dist/providers.d.ts +27 -0
  87. package/packages/agentsam-contracts/dist/providers.js +0 -0
  88. package/packages/agentsam-contracts/dist/repository.d.ts +56 -0
  89. package/packages/agentsam-contracts/dist/repository.js +15 -0
  90. package/packages/agentsam-contracts/dist/run.d.ts +113 -0
  91. package/packages/agentsam-contracts/dist/run.js +132 -0
  92. package/packages/agentsam-contracts/dist/tools.d.ts +82 -0
  93. package/packages/agentsam-contracts/dist/tools.js +0 -0
  94. package/packages/agentsam-contracts/dist/widgets.d.ts +38 -0
  95. package/packages/agentsam-contracts/dist/widgets.js +0 -0
  96. package/packages/agentsam-contracts/package.json +9 -1
  97. package/packages/agentsam-contracts/scripts/build.mjs +1 -1
  98. package/packages/agentsam-contracts/src/agent.ts +78 -3
  99. package/packages/agentsam-contracts/src/errors.ts +19 -10
  100. package/packages/agentsam-contracts/src/index.ts +2 -0
  101. package/packages/agentsam-contracts/src/run.ts +320 -0
  102. package/packages/agentsam-contracts/src/widgets.ts +58 -0
  103. package/packages/agentsam-contracts/test/contracts.test.mjs +1 -1
  104. package/packages/agentsam-contracts/test/run-contract.test.mjs +94 -0
  105. package/packages/agentsam-errors/package.json +11 -3
  106. package/packages/agentsam-errors/protocol/agentsam.error.v2.schema.json +821 -0
  107. package/packages/agentsam-errors/protocol/error-catalog.json +3512 -0
  108. package/packages/agentsam-errors/src/envelope.js +63 -11
  109. package/packages/agentsam-errors/src/error.js +6 -0
  110. package/packages/agentsam-errors/src/fingerprint.js +9 -1
  111. package/packages/agentsam-errors/src/normalize.js +51 -6
  112. package/packages/agentsam-errors/src/recovery.js +9 -35
  113. package/packages/agentsam-errors/src/transport.js +6 -1
  114. package/packages/agentsam-errors/src/vocabulary.js +515 -126
  115. package/packages/agentsam-errors/test/catalog-v2.test.mjs +106 -0
  116. package/packages/agentsam-errors/types/index.d.ts +157 -0
  117. package/packages/agentsam-goap/README.md +3 -0
  118. package/packages/agentsam-goap/package.json +2 -2
  119. package/packages/agentsam-hooks/README.md +206 -0
  120. package/packages/agentsam-hooks/bin/agentsam-hooks.mjs +64 -0
  121. package/packages/agentsam-hooks/bindings/go/command.go +55 -0
  122. package/packages/agentsam-hooks/bindings/go/errors_generated.go +402 -0
  123. package/packages/agentsam-hooks/bindings/go/go.mod +3 -0
  124. package/packages/agentsam-hooks/bindings/go/hooks.go +285 -0
  125. package/packages/agentsam-hooks/bindings/go/hooks_test.go +48 -0
  126. package/packages/agentsam-hooks/bindings/rust/Cargo.toml +11 -0
  127. package/packages/agentsam-hooks/bindings/rust/src/errors_generated.rs +396 -0
  128. package/packages/agentsam-hooks/bindings/rust/src/lib.rs +397 -0
  129. package/packages/agentsam-hooks/package.json +69 -0
  130. package/packages/agentsam-hooks/schema/manifest.json +54 -0
  131. package/packages/agentsam-hooks/scripts/clean-protocol.mjs +17 -0
  132. package/packages/agentsam-hooks/scripts/sync-protocol.mjs +27 -0
  133. package/packages/agentsam-hooks/src/adapters/agents.js +108 -0
  134. package/packages/agentsam-hooks/src/adapters/callback.js +4 -0
  135. package/packages/agentsam-hooks/src/adapters/capability.js +122 -0
  136. package/packages/agentsam-hooks/src/adapters/command.js +104 -0
  137. package/packages/agentsam-hooks/src/adapters/composite.js +31 -0
  138. package/packages/agentsam-hooks/src/adapters/http.js +58 -0
  139. package/packages/agentsam-hooks/src/adapters/lsp.js +116 -0
  140. package/packages/agentsam-hooks/src/adapters/mcp.js +76 -0
  141. package/packages/agentsam-hooks/src/adapters/provider.js +129 -0
  142. package/packages/agentsam-hooks/src/config.js +143 -0
  143. package/packages/agentsam-hooks/src/contracts.js +284 -0
  144. package/packages/agentsam-hooks/src/errors-generated.js +2732 -0
  145. package/packages/agentsam-hooks/src/index.d.ts +209 -0
  146. package/packages/agentsam-hooks/src/index.js +14 -0
  147. package/packages/agentsam-hooks/src/policy.js +34 -0
  148. package/packages/agentsam-hooks/src/runtime.js +312 -0
  149. package/packages/agentsam-hooks/src/store.js +264 -0
  150. package/packages/agentsam-hooks/test/adapters.test.mjs +216 -0
  151. package/packages/agentsam-hooks/test/runtime.test.mjs +258 -0
  152. package/packages/agentsam-knowledge/package.json +1 -1
  153. package/packages/agentsam-knowledge/src/backends/index.js +1 -1
  154. package/packages/agentsam-merch/README.md +62 -0
  155. package/packages/agentsam-merch/bin/agentsam-merch.mjs +16 -0
  156. package/packages/agentsam-merch/package.json +65 -0
  157. package/packages/agentsam-merch/profiles/completeful/dtg-back-large.json +42 -0
  158. package/packages/agentsam-merch/profiles/completeful/laser-engraving.json +39 -0
  159. package/packages/agentsam-merch/profiles/generic/embroidery-digitization.json +22 -0
  160. package/packages/agentsam-merch/schemas/collection-candidate.schema.json +66 -0
  161. package/packages/agentsam-merch/schemas/manufacturing-profile.schema.json +221 -0
  162. package/packages/agentsam-merch/src/adapters-completeful.js +50 -0
  163. package/packages/agentsam-merch/src/cli.js +93 -0
  164. package/packages/agentsam-merch/src/collection-lab.js +60 -0
  165. package/packages/agentsam-merch/src/compatibility.js +501 -0
  166. package/packages/agentsam-merch/src/derivatives.js +112 -0
  167. package/packages/agentsam-merch/src/index.d.ts +316 -0
  168. package/packages/agentsam-merch/src/index.js +46 -0
  169. package/packages/agentsam-merch/src/node/index.d.ts +58 -0
  170. package/packages/agentsam-merch/src/node/index.js +6 -0
  171. package/packages/agentsam-merch/src/node/raster.js +142 -0
  172. package/packages/agentsam-merch/src/node/vector.js +239 -0
  173. package/packages/agentsam-merch/src/product-concepts.js +118 -0
  174. package/packages/agentsam-merch/src/profile-registry.js +104 -0
  175. package/packages/agentsam-merch/src/profile.js +158 -0
  176. package/packages/agentsam-merch/src/transforms.js +215 -0
  177. package/packages/agentsam-merch/test/merch.test.mjs +332 -0
  178. package/packages/agentsam-merch/test/node-transforms.test.mjs +149 -0
  179. package/packages/agentsam-nav/dist/Nav.d.ts +43 -0
  180. package/packages/agentsam-nav/dist/NavCollapsible.d.ts +10 -0
  181. package/packages/agentsam-nav/dist/NavContent.d.ts +2 -0
  182. package/packages/agentsam-nav/dist/NavFooter.d.ts +2 -0
  183. package/packages/agentsam-nav/dist/NavGroup.d.ts +3 -0
  184. package/packages/agentsam-nav/dist/NavHeader.d.ts +2 -0
  185. package/packages/agentsam-nav/dist/NavMenu.d.ts +22 -0
  186. package/packages/agentsam-nav/dist/NavProvider.d.ts +35 -0
  187. package/packages/agentsam-nav/dist/NavTrigger.d.ts +2 -0
  188. package/packages/agentsam-nav/dist/Surfaces.d.ts +41 -0
  189. package/packages/agentsam-nav/dist/browser.d.ts +11 -0
  190. package/packages/agentsam-nav/dist/browser.global.js +172 -0
  191. package/packages/agentsam-nav/dist/browser.js +9688 -0
  192. package/packages/agentsam-nav/dist/contracts.d.ts +76 -0
  193. package/packages/agentsam-nav/dist/index.d.ts +11 -0
  194. package/packages/agentsam-nav/dist/index.js +9689 -0
  195. package/packages/agentsam-nav/dist/legacy.css +83 -0
  196. package/packages/agentsam-nav/dist/shell.css +113 -0
  197. package/packages/agentsam-nav/dist/theme.css +113 -0
  198. package/packages/agentsam-nav/dist/utils.d.ts +1 -0
  199. package/packages/agentsam-nav/package.json +1 -1
  200. package/packages/agentsam-queue-control/README.md +4 -1
  201. package/packages/agentsam-queue-control/package.json +4 -3
  202. package/packages/agentsam-queue-control/schemas/job-envelope.schema.json +111 -11
  203. package/packages/agentsam-queue-control/src/adapters/cloudflare.js +34 -6
  204. package/packages/agentsam-queue-control/src/adapters/memory.js +11 -2
  205. package/packages/agentsam-queue-control/src/adapters/sqlite.js +259 -0
  206. package/packages/agentsam-queue-control/src/contracts.js +207 -3
  207. package/packages/agentsam-queue-control/src/control-plane.js +62 -2
  208. package/packages/agentsam-queue-control/src/index.js +1 -0
  209. package/packages/agentsam-queue-control/test/queue-control.test.mjs +310 -0
  210. package/packages/agentsam-queue-control/test/sqlite-adapter.test.mjs +91 -0
  211. package/packages/agentsam-rapid-rust/README.md +3 -0
  212. package/packages/agentsam-repository/README.md +3 -0
  213. package/packages/agentsam-repository/package.json +1 -1
  214. package/packages/agentsam-vault/package.json +1 -1
  215. package/packages/agentsam-workbench/README.md +43 -0
  216. package/packages/agentsam-workbench/package.json +14 -4
  217. package/packages/agentsam-workbench/src/agent/AgentConversationSurface.tsx +108 -0
  218. package/packages/agentsam-workbench/src/agent/AgentPanel.tsx +25 -8
  219. package/packages/agentsam-workbench/src/agent/AgentRuntimeField.tsx +152 -0
  220. package/packages/agentsam-workbench/src/agent/Composer.tsx +10 -1
  221. package/packages/agentsam-workbench/src/agent/RunMode.ts +26 -0
  222. package/packages/agentsam-workbench/src/agent/Thread.tsx +18 -3
  223. package/packages/agentsam-workbench/src/agent/index.ts +3 -0
  224. package/packages/agentsam-workbench/src/index.ts +4 -0
  225. package/packages/agentsam-workbench/src/manufacturing/PreflightIndicator.tsx +203 -0
  226. package/packages/agentsam-workbench/src/manufacturing/index.ts +2 -0
  227. package/packages/agentsam-workbench/src/manufacturing/loading.ts +147 -0
  228. package/packages/agentsam-workbench/src/widgets/BuiltinWidget.tsx +22 -0
  229. package/packages/agentsam-workbench/src/widgets/CountdownWidget.tsx +68 -0
  230. package/packages/agentsam-workbench/src/widgets/WidgetFrame.tsx +56 -0
  231. package/packages/agentsam-workbench/src/widgets/countdown.ts +25 -0
  232. package/packages/agentsam-workbench/src/widgets/index.ts +6 -0
  233. package/packages/agentsam-workbench/src/widgets/registry.ts +13 -0
  234. package/packages/agentsam-workbench/src/widgets/useCountdown.ts +128 -0
  235. package/packages/agentsam-workbench/src/widgets/widgets.css +102 -0
  236. package/packages/connectors/{cloudflare → cfoa}/package.json +3 -3
  237. package/packages/heuristic-theme/package.json +1 -1
  238. package/packages/identity/README.md +3 -0
  239. package/packages/identity/backend/README.md +3 -0
  240. package/packages/identity/package.json +2 -2
  241. package/packages/identity/src/frontend/auth-portal/README.md +3 -0
  242. package/packages/identity/src/index.js +1 -1
  243. package/packages/identity/src/oauth/README.md +4 -1
  244. package/packages/identity/src/oauth/credentials.js +1 -1
  245. package/packages/identity/src/server/worker-router.js +1 -1
  246. package/packages/identity/tests/google-desktop-identity-login.test.mjs +1 -1
  247. package/packages/identity/tests/lane1-packed-consumer.test.mjs +1 -1
  248. package/packages/identity/tests/oauth-presets-accounts-ssot.test.mjs +1 -1
  249. package/packages/providers/completeful/package.json +1 -1
  250. package/packages/theme-church-site/package.json +2 -2
  251. package/packages/theme-companions-site/package.json +2 -2
  252. package/packages/theme-floors-site/package.json +2 -2
  253. package/packages/theme-fuelnfree-site/package.json +2 -2
  254. package/packages/theme-handyman-site/package.json +2 -2
  255. package/packages/theme-insurance-site/package.json +2 -2
  256. package/packages/theme-scenes/package.json +1 -1
  257. package/packages/theme-shinshu-site/package.json +2 -2
  258. package/packages/work-graph/package.json +1 -1
  259. package/protocol/apps/agentsam.app.v1.schema.json +1 -1
  260. package/protocol/apps/agentsam.host-install.v1.schema.json +1 -1
  261. package/protocol/assets/asset-record.v1.schema.json +1 -1
  262. package/protocol/brand/brandpack.v1.schema.json +1 -1
  263. package/protocol/capabilities/capability-manifest.schema.json +1 -1
  264. package/protocol/capabilities/knowledge-search-input.schema.json +1 -0
  265. package/protocol/credentials/issue.v1.schema.json +1 -1
  266. package/protocol/database/agentsam.schema-pack.v1.schema.json +1 -1
  267. package/protocol/database/connection.v1.schema.json +1 -1
  268. package/protocol/embeddings/embedding-profile.v1.schema.json +1 -1
  269. package/protocol/errors/README.md +36 -0
  270. package/protocol/errors/agentsam.error.v2.schema.json +821 -0
  271. package/protocol/errors/error-catalog.json +3506 -158
  272. package/protocol/errors/error-envelope.schema.json +195 -52
  273. package/protocol/errors/recovery.v1.schema.json +1 -1
  274. package/protocol/features/agentsam.feature.v1.schema.json +1 -1
  275. package/protocol/hooks/README.md +18 -0
  276. package/protocol/hooks/agentsam.hook.output.v1.schema.json +27 -0
  277. package/protocol/hooks/agentsam.hook.receipt.v1.schema.json +61 -0
  278. package/protocol/hooks/agentsam.hook.v1.schema.json +35 -0
  279. package/protocol/hooks/agentsam.hooks.config.v1.schema.json +78 -0
  280. package/protocol/local-engine/benchmark.v1.schema.json +1 -1
  281. package/protocol/local-engine/engine.v1.schema.json +1 -1
  282. package/protocol/models/README.md +3 -0
  283. package/protocol/models/model-inventory-v2.schema.json +1 -1
  284. package/protocol/models/provider-model-snapshot.v1.schema.json +22 -0
  285. package/protocol/receipts/agentsam.receipt.v1.json +95 -0
  286. package/protocol/rpc/v1/errors.proto +1 -0
  287. package/protocol/runtime/agentsam.runtime.v1.schema.json +1 -1
  288. package/protocol/runtime/workspace-fs.v1.schema.json +1 -1
  289. package/protocol/sam/activity.v1.schema.json +1 -1
  290. package/protocol/sam/answer.v1.schema.json +1 -1
  291. package/protocol/sam/calibration.v1.schema.json +1 -1
  292. package/protocol/sam/decision-receipt.v1.schema.json +1 -1
  293. package/protocol/sam/evaluation.v1.schema.json +1 -1
  294. package/protocol/sam/operation.schema.json +1 -1
  295. package/protocol/sam/outcome.v1.schema.json +1 -1
  296. package/protocol/sam/question.v1.schema.json +1 -1
  297. package/protocol/sam/result.schema.json +1 -1
  298. package/protocol/sam/state.v1.schema.json +1 -1
  299. package/protocol/scoring/scorecard.v1.schema.json +1 -1
  300. package/protocol/skills/agentsam.interaction.v1.schema.json +1 -1
  301. package/protocol/skills/agentsam.skill.v1.schema.json +1 -1
  302. package/protocol/theme-refinery/product-metadata.schema.json +1 -1
  303. package/protocol/theme-refinery/receipts/products-registry-batch-20260924.json +6 -6
  304. package/protocol/theme-refinery/receipts/theme-harvest-20260924.json +6 -6
  305. package/protocol/theme-refinery/reconciliation-receipt.schema.json +1 -1
  306. package/protocol/ui/icon.v1.schema.json +1 -1
  307. package/python/README.md +20 -0
  308. package/python/agentsam_sdk/errors/__init__.py +4 -0
  309. package/python/agentsam_sdk/errors/vocabulary.py +2730 -0
  310. package/python/agentsam_sdk/hooks/__init__.py +32 -0
  311. package/python/agentsam_sdk/hooks/adapters.py +132 -0
  312. package/python/agentsam_sdk/hooks/contracts.py +121 -0
  313. package/python/agentsam_sdk/hooks/runtime.py +253 -0
  314. package/python/tests/test_hooks.py +115 -0
  315. package/skills/README.md +3 -0
  316. package/src/acp/agent-executor.js +106 -0
  317. package/src/acp/client.js +316 -0
  318. package/src/acp/dependencies.js +426 -0
  319. package/src/acp/http.js +207 -0
  320. package/src/acp/index.js +22 -0
  321. package/src/acp/runs.js +125 -0
  322. package/src/acp/runtime-selection.js +180 -0
  323. package/src/agent/responses-runner.js +145 -1
  324. package/src/cli/command-catalog.js +4 -0
  325. package/src/cli.js +33 -0
  326. package/src/commands/cheat-sheet.js +1 -0
  327. package/src/commands/cloudflare-login.js +1 -1
  328. package/src/commands/cloudflare.js +2 -2
  329. package/src/commands/connections.js +1 -1
  330. package/src/commands/go.js +76 -6
  331. package/src/commands/hooks.js +260 -0
  332. package/src/commands/merch.js +5 -0
  333. package/src/commands/mini.js +1 -1
  334. package/src/commands/models.js +1 -1
  335. package/src/commands/receipts.js +140 -0
  336. package/src/commands/run.js +253 -0
  337. package/src/commands/shell.js +114 -9
  338. package/src/errors/diagnostic.js +9 -9
  339. package/src/go/container.js +1 -1
  340. package/src/go/contract.js +61 -18
  341. package/src/go/discover.js +0 -4
  342. package/src/go/index.js +13 -1
  343. package/src/go/probe.js +109 -0
  344. package/src/go/{cloudflare.js → providers/cloudflare.js} +36 -136
  345. package/src/go/verify.js +1 -1
  346. package/src/index.js +32 -0
  347. package/src/indexing/ingest/inventory.js +1 -1
  348. package/src/knowledge/service/grpc-codec.js +2 -0
  349. package/src/lib/deploy/local-studio.js +2 -2
  350. package/src/lib/mini/scaffold.js +1 -1
  351. package/src/lib/slash-commands.js +1 -0
  352. package/src/lib/whoami-capabilities.js +1 -1
  353. package/src/local/runtime-store.js +54 -0
  354. package/src/mcp/cloudflare-bundles.js +1 -1
  355. package/src/models/catalog.js +0 -49
  356. package/src/models/inventory-core.js +69 -0
  357. package/src/plugins/index.js +9 -1
  358. package/src/plugins/registry.js +115 -6
  359. package/src/receipts/contract.js +68 -0
  360. package/src/receipts/index.js +20 -0
  361. package/src/receipts/prune.js +64 -0
  362. package/src/receipts/sinks.js +285 -0
  363. package/src/rpc/generated/errors_pb.js +49 -1
  364. package/src/tools/runtime.js +13 -5
  365. package/templates/mini/gadget/app.js +15 -40
  366. package/templates/mini/gadget/index.html +7 -7
  367. package/templates/mini/shared/style.css +1 -1
  368. /package/packages/connectors/{cloudflare → cfoa}/OAUTH_STORAGE_AUDIT.md +0 -0
  369. /package/packages/connectors/{cloudflare → cfoa}/src/api-client.js +0 -0
  370. /package/packages/connectors/{cloudflare → cfoa}/src/capabilities.js +0 -0
  371. /package/packages/connectors/{cloudflare → cfoa}/src/credential.js +0 -0
  372. /package/packages/connectors/{cloudflare → cfoa}/src/families/brand-protection.js +0 -0
  373. /package/packages/connectors/{cloudflare → cfoa}/src/families/keyless.js +0 -0
  374. /package/packages/connectors/{cloudflare → cfoa}/src/families/pages.js +0 -0
  375. /package/packages/connectors/{cloudflare → cfoa}/src/families/scanner.js +0 -0
  376. /package/packages/connectors/{cloudflare → cfoa}/src/families/snippets.js +0 -0
  377. /package/packages/connectors/{cloudflare → cfoa}/src/families/tag-gateway.js +0 -0
  378. /package/packages/connectors/{cloudflare → cfoa}/src/families/tags.js +0 -0
  379. /package/packages/connectors/{cloudflare → cfoa}/src/families/token-validation.js +0 -0
  380. /package/packages/connectors/{cloudflare → cfoa}/src/families/vectorize.js +0 -0
  381. /package/packages/connectors/{cloudflare → cfoa}/src/families/workflows.js +0 -0
  382. /package/packages/connectors/{cloudflare → cfoa}/src/index.js +0 -0
  383. /package/packages/connectors/{cloudflare → cfoa}/src/oauth-persist.js +0 -0
  384. /package/packages/connectors/{cloudflare → cfoa}/src/owner.js +0 -0
  385. /package/packages/connectors/{cloudflare → cfoa}/src/permission-options.js +0 -0
  386. /package/packages/connectors/{cloudflare → cfoa}/src/routes.js +0 -0
  387. /package/packages/connectors/{cloudflare → cfoa}/src/scope-catalog.js +0 -0
  388. /package/packages/connectors/{cloudflare → cfoa}/src/vault.js +0 -0
  389. /package/packages/connectors/{cloudflare → cfoa}/tests/capabilities.test.mjs +0 -0
  390. /package/packages/connectors/{cloudflare → cfoa}/tests/connector.test.mjs +0 -0
  391. /package/packages/connectors/{cloudflare → cfoa}/tests/oauth-persist.test.mjs +0 -0
  392. /package/packages/identity/src/oauth/{google-desktop-exchange.js → goaude.js} +0 -0
@@ -0,0 +1,121 @@
1
+ export declare const AGENTSAM_ERROR_SCHEMA_VERSION: 2;
2
+ export type AgentSamErrorCode = "OK" | "CANCELLED" | "UNKNOWN" | "INVALID_ARGUMENT" | "DEADLINE_EXCEEDED" | "NOT_FOUND" | "ALREADY_EXISTS" | "PERMISSION_DENIED" | "RESOURCE_EXHAUSTED" | "FAILED_PRECONDITION" | "ABORTED" | "OUT_OF_RANGE" | "UNIMPLEMENTED" | "INTERNAL" | "UNAVAILABLE" | "DATA_LOSS" | "UNAUTHENTICATED";
3
+ export type AgentSamErrorReason = "unknown" | "input_invalid" | "input_out_of_range" | "precondition_failed" | "unsupported_operation" | "auth_missing" | "auth_invalid" | "permission_denied" | "user_permission_denied" | "provider_not_connected" | "provider_credential_missing" | "provider_credential_invalid" | "provider_credential_expired" | "provider_scope_insufficient" | "provider_budget_exhausted" | "provider_quota_exhausted" | "provider_rate_limited" | "provider_capacity_exhausted" | "provider_unavailable" | "provider_overloaded" | "provider_request_invalid" | "provider_model_not_found" | "provider_region_unsupported" | "provider_content_blocked" | "context_window_exceeded" | "service_tier_unsupported" | "continuation_invalid" | "target_not_found" | "already_exists" | "conflict" | "stale_version" | "rate_limited" | "quota_exhausted" | "capacity_exhausted" | "transport_unreachable" | "transport_refused" | "transport_timeout" | "upstream_invalid_response" | "dns_unresolved" | "tls_handshake_failed" | "tls_certificate_invalid" | "tunnel_connector_unavailable" | "cancelled" | "deadline_exceeded" | "execution_timeout" | "execution_failed" | "process_spawn_failed" | "process_crashed" | "process_output_limit" | "device_not_enrolled" | "device_credential_missing" | "device_credential_invalid" | "device_credential_expired" | "device_registration_missing" | "device_registration_stale" | "connection_revoked" | "connection_disabled" | "identity_resolution_failed" | "identity_mismatch" | "repository_scope_violation" | "repository_changed" | "index_stale" | "index_failed" | "embedding_failed" | "vector_store_failed" | "github_installation_missing" | "github_repository_not_found" | "github_rate_limited" | "github_secondary_rate_limited" | "github_scope_insufficient" | "cloudflare_workers_cpu_exhausted" | "cloudflare_service_binding_unavailable" | "cloudflare_durable_object_unavailable" | "cloudflare_d1_unavailable" | "cloudflare_r2_unavailable" | "docker_daemon_unavailable" | "docker_image_not_found" | "docker_build_failed" | "docker_container_failed" | "docker_registry_auth_failed" | "docker_pull_rate_limited" | "gcp_project_missing" | "gcp_api_disabled" | "gcp_quota_exhausted" | "gcp_vm_not_found" | "gcp_vm_unavailable" | "cad_tool_not_installed" | "cad_tool_not_executable" | "cad_tool_version_incompatible" | "cad_component_missing" | "cad_dependency_missing" | "cad_dependency_version_incompatible" | "cad_source_parse_failed" | "cad_input_format_unsupported" | "cad_import_failed" | "cad_model_recompute_failed" | "cad_constraint_unsatisfied" | "cad_geometry_invalid" | "cad_null_shape" | "cad_boolean_failed" | "cad_kernel_failed" | "cad_script_failed" | "cad_export_format_unsupported" | "cad_export_failed" | "cad_output_missing" | "cad_output_invalid" | "cad_render_engine_unavailable" | "cad_gpu_unavailable" | "cad_render_failed" | "cad_memory_exhausted" | "cad_process_crashed" | "cad_warning_escalated" | "policy_blocked" | "copyright_blocked" | "persistence_failed" | "data_corrupt" | "data_loss" | "internal" | "internal_invariant_violation" | "internal_configuration_invalid" | "internal_contract_violation" | "internal_adapter_failed" | "internal_dependency_failed" | "hook_definition_invalid" | "hook_duplicate_id" | "hook_not_found" | "hook_disabled" | "hook_event_unsupported" | "hook_configuration_invalid" | "hook_adapter_unknown" | "hook_adapter_unavailable" | "hook_handler_unavailable" | "hook_handler_timeout" | "hook_handler_failed" | "hook_output_invalid" | "hook_output_limit_exceeded" | "hook_output_field_unsupported" | "hook_http_timeout" | "hook_http_request_failed" | "hook_http_response_invalid" | "hook_http_response_limit_exceeded" | "hook_http_protocol_unsupported" | "hook_http_credentials_forbidden" | "hook_mcp_timeout" | "hook_mcp_server_unavailable" | "hook_mcp_capability_missing" | "hook_mcp_capability_duplicate" | "hook_mcp_response_invalid" | "hook_mcp_transport_failed" | "hook_lsp_timeout" | "hook_lsp_server_unavailable" | "hook_lsp_language_required" | "hook_lsp_capability_unsupported" | "hook_lsp_initialize_failed" | "hook_lsp_response_invalid" | "hook_command_required" | "hook_command_timeout" | "hook_command_spawn_failed" | "hook_command_exit_nonzero" | "hook_command_output_limit_exceeded" | "hook_command_output_invalid" | "hook_permission_denied" | "hook_capability_unavailable" | "hook_capability_duplicate" | "hook_error_handling_invalid" | "hook_error_handling_unsupported" | "hook_retry_limit_exceeded" | "hook_stop_decision_invalid" | "package_manifest_invalid" | "package_export_missing" | "package_file_missing" | "package_unwanted_file_included" | "package_dependency_missing" | "package_dependency_version_mismatch" | "lockfile_missing" | "lockfile_stale" | "lockfile_incompatible" | "workspace_not_installed" | "workspace_resolution_failed" | "workspace_boundary_invalid" | "build_dependency_missing" | "build_failed" | "build_output_missing" | "build_output_stale" | "pack_failed" | "pack_contents_invalid" | "pack_provenance_violation" | "distribution_artifact_missing" | "distribution_identity_mismatch" | "distribution_version_mismatch" | "distribution_install_failed" | "distribution_smoke_failed" | "release_train_misaligned" | "published_artifact_stale" | "published_artifact_missing" | "schema_invalid" | "schema_version_unsupported" | "schema_contract_mismatch" | "schema_pack_missing" | "schema_pack_dependency_missing" | "schema_pack_dependency_cycle" | "schema_pack_ownership_conflict" | "migration_missing" | "migration_failed" | "migration_checksum_mismatch" | "migration_order_invalid" | "migration_already_applied_conflict" | "migration_requires_manual_repair" | "database_unreachable" | "database_driver_unsupported" | "database_authority_unresolved" | "database_authorization_failed" | "database_schema_drift" | "model_discovery_failed" | "model_catalog_stale" | "model_snapshot_missing" | "model_snapshot_stale" | "model_capability_unknown" | "model_capability_unsupported" | "model_provider_mismatch" | "model_identity_conflict" | "model_probe_failed" | "model_probe_partial" | "runtime_not_installed" | "runtime_not_running" | "runtime_version_incompatible" | "runtime_capability_missing" | "runtime_protocol_mismatch" | "runtime_connection_unresolved" | "runtime_connection_revoked" | "pty_create_failed" | "pty_attach_failed" | "pty_session_not_found" | "pty_session_expired" | "pty_replay_cursor_invalid" | "transport_not_configured" | "transport_auth_failed" | "transport_attach_failed" | "sidecar_missing" | "sidecar_start_failed" | "sidecar_health_failed" | "tool_not_found" | "tool_disabled" | "tool_handler_unavailable" | "tool_execution_failed" | "tool_timeout" | "tool_output_invalid" | "tool_permission_denied" | "mcp_timeout" | "mcp_server_unavailable" | "mcp_capability_unsupported" | "mcp_response_invalid" | "mcp_transport_failed" | "lsp_timeout" | "lsp_server_unavailable" | "lsp_capability_unsupported" | "lsp_response_invalid" | "lsp_transport_failed" | "mcp_call_failed" | "lsp_request_failed";
4
+ export type AgentSamErrorSeverity = "transient" | "blocking_user_fixable" | "blocking_internal" | "policy_blocking";
5
+ export type AgentSamErrorSourceKind = "user" | "agentsam" | "provider" | "dependency" | "runtime" | "policy";
6
+ export type AgentSamErrorResolutionOwner = "user" | "agentsam" | "provider" | "organization_admin" | "policy" | "unknown";
7
+ export type AgentSamErrorDomain = "runtime" | "provider" | "auth" | "identity" | "device" | "terminal" | "transport" | "repository" | "indexing" | "knowledge" | "cad" | "hook" | "model" | "configuration" | "schema" | "migration" | "database" | "package" | "build" | "distribution" | "deployment" | "workflow" | "persistence" | "policy" | "tool";
8
+ export type AgentSamErrorFailureClass = "input" | "validation" | "authentication" | "authorization" | "policy" | "discovery" | "resolution" | "availability" | "transport" | "protocol" | "timeout" | "rate_limit" | "capacity" | "resource" | "configuration" | "dependency" | "filesystem" | "persistence" | "consistency" | "conflict" | "process" | "ipc" | "data_integrity" | "cancellation" | "cancelled" | "build" | "distribution" | "migration" | "schema" | "identity" | "execution" | "internal" | "unknown";
9
+ export type AgentSamErrorStage = "discover" | "resolve" | "load" | "configure" | "validate" | "authorize" | "connect" | "prepare" | "install" | "build" | "start" | "execute" | "transform" | "persist" | "migrate" | "verify" | "publish" | "attach" | "detach" | "cleanup" | "shutdown";
10
+ export type AgentSamErrorFailureBehavior = "fail_closed" | "fail_open" | "observe_only" | "retry_bounded" | "skip" | "abort" | "no_replay";
11
+ export type AgentSamRemediationAction = "none" | "retry" | "retry_later" | "reauthenticate" | "connect_provider" | "configure_provider_credential" | "refresh_provider_credential" | "request_permission" | "reenroll_device" | "reconnect_service" | "install_dependency" | "upgrade_dependency" | "configure_dependency" | "change_configuration" | "change_input" | "reduce_scope" | "increase_quota" | "add_budget" | "select_model" | "change_region" | "restart_runtime" | "inspect_platform" | "contact_provider" | "contact_agentsam" | "contact_organization_admin" | "restart_service" | "repair_schema" | "run_migration" | "regenerate_artifact" | "update_lockfile" | "reinstall_workspace" | "republish_artifact";
12
+ export type AgentSamErrorSideEffectState = "none" | "not_started" | "confirmed_not_applied" | "confirmed_applied" | "partially_applied" | "unknown";
13
+ export type AgentSamErrorOutcomeStatus = "success" | "partial" | "failure";
14
+ export interface AgentSamErrorSource {
15
+ kind: AgentSamErrorSourceKind;
16
+ name: string;
17
+ service: string | null;
18
+ }
19
+ export interface AgentSamErrorRemediation {
20
+ action: AgentSamRemediationAction;
21
+ message: string | null;
22
+ automatic: boolean;
23
+ command: string | null;
24
+ url: string | null;
25
+ }
26
+ export interface AgentSamErrorResource {
27
+ type: string;
28
+ id: string | null;
29
+ name: string | null;
30
+ }
31
+ export interface AgentSamNativeErrorEvidence {
32
+ code: string | null;
33
+ exception_type: string | null;
34
+ exit_code: number | null;
35
+ signal: string | null;
36
+ stderr: string | null;
37
+ stdout: string | null;
38
+ stack: string | null;
39
+ }
40
+ export interface AgentSamEnvironmentEvidence {
41
+ detected_version: string | null;
42
+ required_version: string | null;
43
+ component: string | null;
44
+ runtime: string | null;
45
+ platform: string | null;
46
+ }
47
+ export interface AgentSamErrorOperation {
48
+ kind?: string | null;
49
+ action?: string | null;
50
+ resource_type?: string | null;
51
+ resource_id?: string | null;
52
+ read_only?: boolean;
53
+ idempotent?: boolean;
54
+ side_effect_state?: AgentSamErrorSideEffectState;
55
+ }
56
+ export interface AgentSamErrorRetry {
57
+ allowed?: boolean;
58
+ strategy?: string;
59
+ retry_after_ms?: number | null;
60
+ max_attempts?: number | null;
61
+ requires_idempotency_key?: boolean;
62
+ }
63
+ export interface AgentSamErrorFallback {
64
+ allowed?: boolean;
65
+ strategy?: string | null;
66
+ preserve_semantics?: boolean;
67
+ target?: string | null;
68
+ }
69
+ export interface AgentSamErrorNotification {
70
+ user?: string;
71
+ operator?: string;
72
+ agent?: string;
73
+ }
74
+ export interface AgentSamErrorPartialResult {
75
+ completed?: number;
76
+ failed?: number;
77
+ failures?: unknown[];
78
+ }
79
+ export interface AgentSamErrorEnvelope {
80
+ ok: false;
81
+ schema_version: typeof AGENTSAM_ERROR_SCHEMA_VERSION;
82
+ code: AgentSamErrorCode;
83
+ reason: AgentSamErrorReason | (string & {});
84
+ domain: AgentSamErrorDomain;
85
+ failure_class: AgentSamErrorFailureClass;
86
+ stage: AgentSamErrorStage;
87
+ native_stage: string | null;
88
+ feature: string | null;
89
+ failure_behavior: AgentSamErrorFailureBehavior | null;
90
+ severity: AgentSamErrorSeverity;
91
+ retryable: boolean;
92
+ side_effect_state: AgentSamErrorSideEffectState;
93
+ resolution_owner: AgentSamErrorResolutionOwner;
94
+ source: AgentSamErrorSource;
95
+ adapter: string | null;
96
+ protocol: string | null;
97
+ transport: string | null;
98
+ tool: string | null;
99
+ message: string;
100
+ retry_after_ms: number | null;
101
+ remediation: AgentSamErrorRemediation;
102
+ resource: AgentSamErrorResource | null;
103
+ native: AgentSamNativeErrorEvidence | null;
104
+ environment: AgentSamEnvironmentEvidence | null;
105
+ http_status: number | null;
106
+ grpc_status: number | null;
107
+ provider: string | null;
108
+ provider_code: string | null;
109
+ request_id: string | null;
110
+ trace_id: string | null;
111
+ fingerprint: string;
112
+ occurrence_count: number;
113
+ details: unknown;
114
+ operation?: AgentSamErrorOperation;
115
+ retry?: AgentSamErrorRetry;
116
+ fallback?: AgentSamErrorFallback;
117
+ notify?: AgentSamErrorNotification;
118
+ cause?: unknown;
119
+ status?: AgentSamErrorOutcomeStatus;
120
+ partial?: AgentSamErrorPartialResult;
121
+ }
@@ -0,0 +1,5 @@
1
+ // src/errors.ts
2
+ var AGENTSAM_ERROR_SCHEMA_VERSION = 2;
3
+ export {
4
+ AGENTSAM_ERROR_SCHEMA_VERSION
5
+ };
@@ -0,0 +1,53 @@
1
+ import type { AgentArtifact } from './artifacts';
2
+ import type { AgentMessage, AgentRunStatus } from './agent';
3
+ import type { AgentToolCall } from './tools';
4
+ /**
5
+ * Workbench-facing event stream retained for UI/runtime compatibility.
6
+ */
7
+ export type AgentEvent = {
8
+ type: 'message';
9
+ message: AgentMessage;
10
+ } | {
11
+ type: 'message.delta';
12
+ messageId: string;
13
+ delta: string;
14
+ } | {
15
+ type: 'run.status';
16
+ runId: string;
17
+ status: AgentRunStatus;
18
+ error?: string;
19
+ } | {
20
+ type: 'tool';
21
+ toolCall: AgentToolCall;
22
+ } | {
23
+ type: 'artifact';
24
+ artifact: AgentArtifact;
25
+ } | {
26
+ type: 'error';
27
+ runId?: string;
28
+ error: string;
29
+ };
30
+ export type AgentEventSourceKind = 'webhook' | 'tool' | 'workflow' | 'provider' | 'system' | 'user';
31
+ export interface AgentEventSource {
32
+ kind: AgentEventSourceKind;
33
+ provider?: string;
34
+ ref?: string;
35
+ metadata?: Record<string, unknown>;
36
+ }
37
+ /**
38
+ * Portable orchestration/domain event. Provider events can be retained while a host
39
+ * additionally emits normalized domain events (for example completeful.order.created
40
+ * followed by commerce.order.created).
41
+ */
42
+ export interface AgentOrchestrationEvent<TPayload = unknown> {
43
+ id: string;
44
+ eventKey: string;
45
+ occurredAt: number;
46
+ source: AgentEventSource;
47
+ payload: TPayload;
48
+ accountId?: string;
49
+ subject?: string;
50
+ correlationId?: string;
51
+ causationId?: string;
52
+ metadata?: Record<string, unknown>;
53
+ }
File without changes
@@ -0,0 +1,38 @@
1
+ import type { AgentSamErrorEnvelope } from './errors';
2
+ export type AgentExecutionStatus = 'queued' | 'running' | 'retrying' | 'awaiting_input' | 'completed' | 'failed' | 'cancelled' | 'timed_out';
3
+ export interface AgentToolInvocation<TInput = unknown> {
4
+ id: string;
5
+ toolKey: string;
6
+ input: TInput;
7
+ requestedAt: number;
8
+ accountId?: string;
9
+ correlationId?: string;
10
+ causationId?: string;
11
+ idempotencyKey?: string;
12
+ metadata?: Record<string, unknown>;
13
+ }
14
+ export interface AgentToolExecutionResult<TOutput = unknown> {
15
+ output?: TOutput;
16
+ providerRequestId?: string;
17
+ usage?: Record<string, unknown>;
18
+ metadata?: Record<string, unknown>;
19
+ }
20
+ export interface AgentToolExecutionReceipt<TOutput = unknown> {
21
+ invocationId: string;
22
+ toolKey: string;
23
+ status: AgentExecutionStatus;
24
+ ok: boolean;
25
+ attempt: number;
26
+ queuedAt?: number;
27
+ startedAt?: number;
28
+ completedAt?: number;
29
+ durationMs?: number;
30
+ provider?: string;
31
+ input?: unknown;
32
+ output?: TOutput;
33
+ error?: AgentSamErrorEnvelope;
34
+ emittedEventIds?: string[];
35
+ providerRequestId?: string;
36
+ usage?: Record<string, unknown>;
37
+ metadata?: Record<string, unknown>;
38
+ }
File without changes
@@ -0,0 +1,31 @@
1
+ export type AgentHookActionType = 'tool' | 'workflow' | 'event';
2
+ export interface AgentHookAction {
3
+ actionId?: string;
4
+ type: AgentHookActionType;
5
+ target: string;
6
+ input?: unknown;
7
+ metadata?: Record<string, unknown>;
8
+ }
9
+ export interface AgentHookDefinition {
10
+ hookKey: string;
11
+ displayName?: string;
12
+ description?: string;
13
+ eventKeys: string[];
14
+ enabled: boolean;
15
+ filter?: Record<string, unknown>;
16
+ actions: AgentHookAction[];
17
+ metadata?: Record<string, unknown>;
18
+ }
19
+ export type AgentHookExecutionStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
20
+ export interface AgentHookExecutionReceipt {
21
+ executionId: string;
22
+ hookKey: string;
23
+ eventId: string;
24
+ status: AgentHookExecutionStatus;
25
+ startedAt?: number;
26
+ completedAt?: number;
27
+ durationMs?: number;
28
+ actionExecutionIds?: string[];
29
+ error?: unknown;
30
+ metadata?: Record<string, unknown>;
31
+ }
File without changes
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Identity is established outside the workbench. These contracts only carry the
3
+ * authenticated principal into product authorization and runtime adapters.
4
+ */
5
+ export interface AgentPrincipal {
6
+ accountId: string;
7
+ authUserId: string;
8
+ displayName?: string;
9
+ email?: string;
10
+ claims?: Record<string, unknown>;
11
+ }
12
+ export interface AgentIdentityProvider {
13
+ getPrincipal(): AgentPrincipal | null | Promise<AgentPrincipal | null>;
14
+ subscribe?(onChange: (principal: AgentPrincipal | null) => void): () => void;
15
+ }
File without changes
@@ -0,0 +1,16 @@
1
+ export * from './agent';
2
+ export * from './events';
3
+ export * from './run';
4
+ export * from './tools';
5
+ export * from './authority';
6
+ export * from './execution';
7
+ export * from './providers';
8
+ export * from './hooks';
9
+ export * from './artifacts';
10
+ export * from './context';
11
+ export * from './adapter';
12
+ export * from './models';
13
+ export * from './identity';
14
+ export * from './repository';
15
+ export * from './errors';
16
+ export * from './widgets';
@@ -0,0 +1,164 @@
1
+ // src/agent.ts
2
+ function isAgentRunTerminalStatus(status) {
3
+ return status === "completed" || status === "cancelled" || status === "failed" || status === "timed_out";
4
+ }
5
+ function isAgentRunWaitingStatus(status) {
6
+ return status === "waiting_external" || status === "waiting_child" || status === "awaiting_input" || status === "awaiting_approval" || status === "sleeping" || status === "retry_scheduled";
7
+ }
8
+ function isAgentRunModelActiveStatus(status) {
9
+ return status === "queued" || status === "running";
10
+ }
11
+
12
+ // src/run.ts
13
+ var WAIT_CODES = /* @__PURE__ */ new Set([
14
+ "approval_required",
15
+ "input_required",
16
+ "external_pending",
17
+ "dependency_pending"
18
+ ]);
19
+ var REPLAN_CODES = /* @__PURE__ */ new Set([
20
+ "precondition_failed",
21
+ "repository_changed",
22
+ "capability_unavailable"
23
+ ]);
24
+ var TRANSIENT_CODES = /* @__PURE__ */ new Set([
25
+ "timeout",
26
+ "request_timeout",
27
+ "rate_limited",
28
+ "provider_unavailable",
29
+ "runtime_unavailable",
30
+ "econnreset",
31
+ "econnrefused",
32
+ "etimedout",
33
+ "eai_again"
34
+ ]);
35
+ function classifyAgentRunRetry(input = {}) {
36
+ const code = String(input.code || "").trim().toLowerCase();
37
+ const statusCode = Number(input.statusCode);
38
+ if (input.retryable === true) {
39
+ return { class: "transient", automaticRetry: true, reason: code || "explicit_retryable" };
40
+ }
41
+ if (input.retryable === false) {
42
+ return { class: "terminal", automaticRetry: false, reason: code || "explicit_non_retryable" };
43
+ }
44
+ if (WAIT_CODES.has(code)) {
45
+ return { class: "wait", automaticRetry: false, reason: code };
46
+ }
47
+ if (REPLAN_CODES.has(code)) {
48
+ return { class: "replan", automaticRetry: false, reason: code };
49
+ }
50
+ if (TRANSIENT_CODES.has(code) || [408, 425, 429, 500, 502, 503, 504].includes(statusCode)) {
51
+ return { class: "transient", automaticRetry: true, reason: code || `http_${statusCode}` };
52
+ }
53
+ return { class: "terminal", automaticRetry: false, reason: code || "unclassified_failure" };
54
+ }
55
+ function evaluateAgentRunWake(suspension, wake, options = {}) {
56
+ const consumed = new Set(options.consumedDedupeKeys || []);
57
+ if (consumed.has(wake.dedupeKey)) return { accepted: false, reason: "duplicate" };
58
+ if (suspension.runId !== wake.runId) return { accepted: false, reason: "run_mismatch" };
59
+ const now = options.now ?? wake.occurredAt;
60
+ if (suspension.expiresAt != null && now > suspension.expiresAt) {
61
+ return { accepted: false, reason: "expired" };
62
+ }
63
+ const matched = wake.kind === "manual" || Boolean(suspension.wakeEvent && wake.eventKey === suspension.wakeEvent) || Boolean(
64
+ wake.kind === "dependency" && wake.dependencyRunId && (suspension.dependencyRunIds || []).includes(wake.dependencyRunId)
65
+ ) || Boolean(wake.kind === "scheduled" && suspension.wakeAt != null && now >= suspension.wakeAt);
66
+ return matched ? { accepted: true, reason: "accepted", nextStatus: "queued" } : { accepted: false, reason: "condition_not_met" };
67
+ }
68
+ function wakeMatchesSuspension(suspension, wake, now = wake.occurredAt) {
69
+ return evaluateAgentRunWake(suspension, wake, { now }).accepted;
70
+ }
71
+ function transitionAgentRunStatus(status, action) {
72
+ if (status === "completed" || status === "failed" || status === "cancelled" || status === "timed_out") {
73
+ return status;
74
+ }
75
+ if (action.type === "cancel") return "cancelled";
76
+ if (action.type === "timeout") return "timed_out";
77
+ if (action.type === "complete") return "completed";
78
+ if (action.type === "fail") return "failed";
79
+ if (action.type === "suspend") return action.status;
80
+ if (action.type === "wake") return "queued";
81
+ if (action.type === "start") return "running";
82
+ return status;
83
+ }
84
+ function phaseForRunEvent(event) {
85
+ if (event.phase) return event.phase;
86
+ if (event.eventType === "run.created" || event.eventType === "run.queued" || event.eventType === "run.started") return "boot";
87
+ if (event.eventType === "run.suspended") return "waiting";
88
+ if (event.eventType === "run.woken" || event.eventType === "run.cancel_requested") return "recover";
89
+ if (event.eventType === "verification.completed") return "verify";
90
+ if (event.eventType === "run.completed" || event.eventType === "run.cancelled" || event.eventType === "run.timed_out") return "complete";
91
+ if (event.eventType === "run.failed") return "complete";
92
+ return "execute";
93
+ }
94
+ function activityTypeForRunEvent(event) {
95
+ if (event.eventType === "run.started") return "run.started";
96
+ if (event.eventType === "run.completed") return "run.completed";
97
+ if (event.eventType === "run.failed" || event.eventType === "run.timed_out") return "run.failed";
98
+ if (event.eventType === "run.cancelled" || event.eventType === "run.suspended" || event.eventType === "run.woken" || event.eventType === "run.status" || event.eventType === "run.cancel_requested" || event.eventType === "run.created" || event.eventType === "run.queued") return "phase.changed";
99
+ if (event.eventType === "step.started") return "step.started";
100
+ if (event.eventType === "step.completed") return "step.completed";
101
+ if (event.eventType === "decision.made") return "decision.made";
102
+ if (event.eventType === "tool.started") return "tool.started";
103
+ if (event.eventType === "tool.completed") return "tool.completed";
104
+ if (event.eventType === "artifact.created") return "artifact.created";
105
+ if (event.eventType === "file.changed") return "file.changed";
106
+ if (event.eventType === "approval.required") return "approval.required";
107
+ if (event.eventType === "input.required") return "input.required";
108
+ if (event.eventType === "verification.completed") return "verification.completed";
109
+ return "step.progress";
110
+ }
111
+ function projectRunEventToActivity(event) {
112
+ const evidence = {
113
+ ...event.evidence || {},
114
+ run_event_id: event.id,
115
+ run_event_type: event.eventType,
116
+ ...event.status ? { run_status: event.status } : {}
117
+ };
118
+ return {
119
+ schema: "agentsam.activity.v1",
120
+ run_id: event.runId,
121
+ seq: event.seq,
122
+ timestamp: new Date(event.createdAt).toISOString(),
123
+ phase: phaseForRunEvent(event),
124
+ event: activityTypeForRunEvent(event),
125
+ step_id: event.stepId ?? null,
126
+ parent_id: event.parentRunId ?? null,
127
+ label: event.label || "",
128
+ detail: event.detail ?? null,
129
+ progress: event.progress ?? null,
130
+ source: {
131
+ kind: event.source?.kind || "sam",
132
+ name: event.source?.name ?? null
133
+ },
134
+ evidence
135
+ };
136
+ }
137
+
138
+ // src/repository.ts
139
+ var REPOSITORY_STATUSES = ["active", "archived", "disabled"];
140
+ var REPOSITORY_CONTRACT_TYPES = ["api", "schema", "runtime", "cli", "event", "receipt", "package"];
141
+ var REPOSITORY_CONTRACT_STATUSES = ["active", "deprecated", "retired"];
142
+ var REPOSITORY_DEPENDENCY_TYPES = ["runtime", "build", "contract", "package", "deploy", "tool", "data"];
143
+ var REPOSITORY_DEPENDENCY_CRITICALITIES = ["informational", "compatible", "strict", "critical"];
144
+ var REPOSITORY_FAILURE_POLICIES = ["warn", "block_certification", "block_deploy", "degrade"];
145
+
146
+ // src/errors.ts
147
+ var AGENTSAM_ERROR_SCHEMA_VERSION = 2;
148
+ export {
149
+ AGENTSAM_ERROR_SCHEMA_VERSION,
150
+ REPOSITORY_CONTRACT_STATUSES,
151
+ REPOSITORY_CONTRACT_TYPES,
152
+ REPOSITORY_DEPENDENCY_CRITICALITIES,
153
+ REPOSITORY_DEPENDENCY_TYPES,
154
+ REPOSITORY_FAILURE_POLICIES,
155
+ REPOSITORY_STATUSES,
156
+ classifyAgentRunRetry,
157
+ evaluateAgentRunWake,
158
+ isAgentRunModelActiveStatus,
159
+ isAgentRunTerminalStatus,
160
+ isAgentRunWaitingStatus,
161
+ projectRunEventToActivity,
162
+ transitionAgentRunStatus,
163
+ wakeMatchesSuspension
164
+ };
@@ -0,0 +1,9 @@
1
+ export interface ModelOption {
2
+ id: string;
3
+ label: string;
4
+ short?: string;
5
+ description?: string;
6
+ provider?: string;
7
+ disabled?: boolean;
8
+ metadata?: Record<string, unknown>;
9
+ }
File without changes
@@ -0,0 +1,27 @@
1
+ import type { AgentAuthorityRequirement, AgentResolvedAuthorityReference } from './authority';
2
+ import type { AgentToolExecutionResult, AgentToolInvocation } from './execution';
3
+ import type { AgentToolDefinition } from './tools';
4
+ export interface AgentProviderDefinition {
5
+ providerKey: string;
6
+ displayName: string;
7
+ description?: string;
8
+ capabilityKeys?: string[];
9
+ toolKeys?: string[];
10
+ authority?: AgentAuthorityRequirement[];
11
+ metadata?: Record<string, unknown>;
12
+ }
13
+ export interface AgentProviderExecutionContext {
14
+ authority?: AgentResolvedAuthorityReference[];
15
+ accountId?: string;
16
+ deadlineAt?: number;
17
+ metadata?: Record<string, unknown>;
18
+ }
19
+ /**
20
+ * Provider adapters implement provider-specific mechanics only.
21
+ * Generic retries, receipts, hooks, queueing and event dispatch remain execution-plane concerns.
22
+ */
23
+ export interface AgentProviderAdapter<TContext extends AgentProviderExecutionContext = AgentProviderExecutionContext> {
24
+ readonly providerKey: string;
25
+ listTools?(): AgentToolDefinition[] | Promise<AgentToolDefinition[]>;
26
+ invoke<TInput = unknown, TOutput = unknown>(invocation: AgentToolInvocation<TInput>, context: TContext): Promise<AgentToolExecutionResult<TOutput>>;
27
+ }
File without changes
@@ -0,0 +1,56 @@
1
+ export declare const REPOSITORY_STATUSES: readonly ["active", "archived", "disabled"];
2
+ export type RepositoryStatus = (typeof REPOSITORY_STATUSES)[number];
3
+ export declare const REPOSITORY_CONTRACT_TYPES: readonly ["api", "schema", "runtime", "cli", "event", "receipt", "package"];
4
+ export type RepositoryContractType = (typeof REPOSITORY_CONTRACT_TYPES)[number];
5
+ export declare const REPOSITORY_CONTRACT_STATUSES: readonly ["active", "deprecated", "retired"];
6
+ export type RepositoryContractStatus = (typeof REPOSITORY_CONTRACT_STATUSES)[number];
7
+ export declare const REPOSITORY_DEPENDENCY_TYPES: readonly ["runtime", "build", "contract", "package", "deploy", "tool", "data"];
8
+ export type RepositoryDependencyType = (typeof REPOSITORY_DEPENDENCY_TYPES)[number];
9
+ export declare const REPOSITORY_DEPENDENCY_CRITICALITIES: readonly ["informational", "compatible", "strict", "critical"];
10
+ export type RepositoryDependencyCriticality = (typeof REPOSITORY_DEPENDENCY_CRITICALITIES)[number];
11
+ export declare const REPOSITORY_FAILURE_POLICIES: readonly ["warn", "block_certification", "block_deploy", "degrade"];
12
+ export type RepositoryFailurePolicy = (typeof REPOSITORY_FAILURE_POLICIES)[number];
13
+ /** Portable repository identity. Account ownership belongs to the host registry, not this object. */
14
+ export interface RepositoryIdentity {
15
+ schema_version: 1;
16
+ repository_id: string;
17
+ full_name: string;
18
+ role: string;
19
+ default_branch: string;
20
+ canonical_url: string | null;
21
+ status: RepositoryStatus;
22
+ }
23
+ /** Account-bound declaration of one contract provided by a repository. */
24
+ export interface RepositoryContract {
25
+ schema_version: 1;
26
+ id: string;
27
+ account_id: string;
28
+ repository_id: string;
29
+ contract_key: string;
30
+ contract_version: string;
31
+ contract_type: RepositoryContractType;
32
+ name: string;
33
+ description: string | null;
34
+ manifest_path: string | null;
35
+ contract_hash: string;
36
+ status: RepositoryContractStatus;
37
+ created_at: number | null;
38
+ updated_at: number | null;
39
+ }
40
+ /** Account-bound cross-repository dependency edge. */
41
+ export interface RepositoryDependency {
42
+ schema_version: 1;
43
+ id: string;
44
+ account_id: string;
45
+ source_repository_id: string;
46
+ target_repository_id: string;
47
+ dependency_type: RepositoryDependencyType;
48
+ contract_id: string | null;
49
+ criticality: RepositoryDependencyCriticality;
50
+ required_version: string | null;
51
+ required_contract_hash: string | null;
52
+ failure_policy: RepositoryFailurePolicy;
53
+ description: string | null;
54
+ created_at: number | null;
55
+ updated_at: number | null;
56
+ }
@@ -0,0 +1,15 @@
1
+ // src/repository.ts
2
+ var REPOSITORY_STATUSES = ["active", "archived", "disabled"];
3
+ var REPOSITORY_CONTRACT_TYPES = ["api", "schema", "runtime", "cli", "event", "receipt", "package"];
4
+ var REPOSITORY_CONTRACT_STATUSES = ["active", "deprecated", "retired"];
5
+ var REPOSITORY_DEPENDENCY_TYPES = ["runtime", "build", "contract", "package", "deploy", "tool", "data"];
6
+ var REPOSITORY_DEPENDENCY_CRITICALITIES = ["informational", "compatible", "strict", "critical"];
7
+ var REPOSITORY_FAILURE_POLICIES = ["warn", "block_certification", "block_deploy", "degrade"];
8
+ export {
9
+ REPOSITORY_CONTRACT_STATUSES,
10
+ REPOSITORY_CONTRACT_TYPES,
11
+ REPOSITORY_DEPENDENCY_CRITICALITIES,
12
+ REPOSITORY_DEPENDENCY_TYPES,
13
+ REPOSITORY_FAILURE_POLICIES,
14
+ REPOSITORY_STATUSES
15
+ };