@inneranimalmedia/agentsam-sdk 2.6.12 → 2.6.13

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 (651) hide show
  1. package/AGENTSAM.md +32 -0
  2. package/DEVELOPMENT.md +69 -74
  3. package/README.md +11 -0
  4. package/apps/cad-creator/README.md +12 -0
  5. package/apps/cad-creator/shared/cad/package.json +1 -1
  6. package/apps/cad-creator/shared/cad/src/domain/project-contract.js +2 -75
  7. package/apps/cad-creator/shared/cad/src/domain/project-tools.js +2 -24
  8. package/apps/cad-creator/shared/cad/src/types.ts +2 -2
  9. package/apps/client-cms-editor/backend/package.json +2 -2
  10. package/apps/client-cms-editor/frontend/package.json +3 -3
  11. package/apps/client-cms-editor/frontend/src/adapters/http.ts +25 -13
  12. package/apps/client-cms-editor/frontend/src/editor/CmsEditor.tsx +7 -4
  13. package/apps/client-cms-editor/frontend/src/editor/canvas/PreviewCanvas.tsx +31 -3
  14. package/apps/client-cms-editor/frontend/src/editor/host-preview.test.tsx +104 -0
  15. package/apps/client-cms-editor/package-lock.json +8 -8
  16. package/apps/client-cms-editor/package.json +2 -1
  17. package/apps/client-cms-editor/shared/cms/package.json +1 -1
  18. package/docs/AUTORAG.md +2 -0
  19. package/docs/CAPABILITIES.md +28 -0
  20. package/docs/adr/ADR-0003-copro-clean-room-product-architecture.md +6 -0
  21. package/docs/architecture/AGENTSAM-CANONICAL-DISCOVERY-FIRST-SLICE.md +70 -0
  22. package/docs/architecture/AGENTSAM-REGISTRY-CLI-AGENT-PARITY.md +133 -0
  23. package/docs/architecture/AGENTSAM_APPLICATION_CONTRACT.md +6 -0
  24. package/docs/architecture/CAD_OPERATOR_CAPABILITIES.md +64 -0
  25. package/docs/architecture/CAD_ROBOTICS_RELEASE_LEDGER_20261016.md +43 -0
  26. package/docs/architecture/CAD_RUN_MODES.md +34 -0
  27. package/docs/architecture/CLI-BOOT-REMOTE-DB-READINESS-20261015.md +65 -0
  28. package/docs/architecture/EXISTING-MCP-D1-AGENT-BRIDGE.md +47 -0
  29. package/docs/architecture/PLAN-PORTABILITY-SAM-FIRST-SPRINT-20261015.md +36 -0
  30. package/docs/architecture/PLUGIN-PRODUCTIZATION-SPINE.md +101 -0
  31. package/docs/architecture/SAMOS_PRODUCT_MODEL.md +49 -0
  32. package/docs/architecture/SAM_KERNEL.md +40 -0
  33. package/docs/architecture/SAM_RESOURCE_CRUD_STANDARD.md +96 -0
  34. package/docs/architecture/SAM_SYSTEMATIC_AUTONOMOUS_MACHINERY.md +79 -0
  35. package/docs/architecture/USER_GLOBAL_AGENT_INSTRUCTIONS.md +55 -0
  36. package/docs/autorag-workflow.md +13 -0
  37. package/docs/brand/AGENT_SAM_ICON_GRAMMAR.md +4 -0
  38. package/docs/contracts/capability-install-planner.md +66 -38
  39. package/docs/contracts/environment-vocabulary.md +5 -5
  40. package/docs/engineering/SUPERBASH_LOCAL_RUNTIME.md +100 -0
  41. package/docs/generated/SDK_CAPABILITY_INVENTORY.md +313 -0
  42. package/docs/handoffs/AGENT_HANDOFF_SUPERBASH_AND_MODEL_PERFORMANCE_2026-10-14.md +134 -0
  43. package/docs/intake/product-capabilities.proposed.ts +232 -0
  44. package/docs/knowledge-supabase-node-api.md +51 -0
  45. package/docs/plans/MEDIA_TRUTH_SOURCE_RECOVERY_20261008.md +31 -0
  46. package/docs/plans/OFFLINE_CLI_KNOWLEDGE_AGENT_HANDOFF.md +104 -0
  47. package/docs/plans/OFFLINE_CLI_KNOWLEDGE_RUNBOOK.md +81 -0
  48. package/docs/plans/SAM_EXPERIENCE_AGENT_DISPATCH_2026-10-15.md +107 -0
  49. package/docs/plans/SAM_MACHINERY_TO_EXPERIENCE_2026-10-15.md +172 -0
  50. package/docs/plans/UI_POLISH_DESKTOP_2026-10-16.md +102 -0
  51. package/docs/plans/WORK-UX-REMASTER-2026-10-15.md +48 -0
  52. package/docs/plans/WORK-WORKSPACE-PLAN-2026-10-14.md +212 -0
  53. package/docs/product/AGENTSAM-UI-QUALITY-GATE.md +148 -0
  54. package/docs/product/AGENTSAM_PRODUCT_EXPERIENCE_STANDARD.md +2 -0
  55. package/docs/product/MEDIA-PRODUCTION-FAMILY.md +47 -0
  56. package/docs/product/OFFER-PORTFOLIO.md +14 -0
  57. package/docs/product/PACKAGE-TAXONOMY.md +17 -0
  58. package/docs/product/PLUGIN-GALLERY-DISCOVERY-AND-INSTALL.md +97 -0
  59. package/docs/product/README.md +2 -0
  60. package/docs/product/WIDGET-GALLERY-PHASE-ONE.md +43 -0
  61. package/docs/reference/AGENTSAM-CLI-WORKFLOWS.md +73 -0
  62. package/docs/reference/AGENTSAM-ERROR-REASONS.md +267 -0
  63. package/docs/reference/AGENTSAM-REGISTRY.generated.md +288 -0
  64. package/docs/reference/INNERANIMALMEDIA_EXPERIENCE_ACCEPTANCE_2026-10-15.md +99 -0
  65. package/docs/releases/cad-v2-sdk-2.6.13.md +25 -0
  66. package/docs/roadmaps/ROAD_TO_REAL_DISTRIBUTION.md +97 -0
  67. package/docs/robotics-chess-handoff.md +15 -0
  68. package/docs/standards/DELIVERY_CLOSURE.md +33 -0
  69. package/docs/standards/SAM_MACHINE_BUILD_AND_GAPS.md +91 -0
  70. package/docs/workflows/ISSUE_TO_SAMOS.md +59 -0
  71. package/package.json +60 -8
  72. package/packages/agentsam-brand/package.json +1 -1
  73. package/packages/agentsam-cms/README.md +56 -0
  74. package/packages/agentsam-cms/agentsam.package.json +46 -0
  75. package/packages/agentsam-cms/package.json +36 -0
  76. package/packages/agentsam-cms/src/aliases.js +74 -0
  77. package/packages/agentsam-cms/src/contracts.js +105 -0
  78. package/packages/agentsam-cms/src/index.d.ts +80 -0
  79. package/packages/agentsam-cms/src/index.js +3 -0
  80. package/packages/agentsam-cms/src/machine.js +221 -0
  81. package/packages/agentsam-cms/src/node-sqlite-repository.js +148 -0
  82. package/packages/agentsam-cms/src/node.d.ts +7 -0
  83. package/packages/agentsam-cms/src/node.js +1 -0
  84. package/packages/agentsam-cms/src/schema/cms-local-runtime.v1.sql +365 -0
  85. package/packages/agentsam-cms/test/standalone.test.mjs +28 -0
  86. package/packages/agentsam-contracts/agentsam.package.json +43 -0
  87. package/packages/agentsam-contracts/dist/errors.d.ts +1 -1
  88. package/packages/agentsam-contracts/dist/widgets.d.ts +7 -0
  89. package/packages/agentsam-contracts/package.json +1 -1
  90. package/packages/agentsam-contracts/src/errors.ts +1 -1
  91. package/packages/agentsam-contracts/src/widgets.ts +7 -0
  92. package/packages/agentsam-desktop-shell/README.md +38 -0
  93. package/packages/agentsam-desktop-shell/scripts/app-discovery.mjs +43 -0
  94. package/packages/agentsam-errors/README.md +14 -0
  95. package/packages/agentsam-errors/agentsam.package.json +43 -0
  96. package/packages/agentsam-errors/package.json +1 -1
  97. package/packages/agentsam-errors/protocol/error-catalog.json +12 -0
  98. package/packages/agentsam-errors/src/cli.js +56 -0
  99. package/packages/agentsam-errors/src/index.js +2 -0
  100. package/packages/agentsam-errors/src/vocabulary.js +2 -0
  101. package/packages/agentsam-errors/test/approval-contract.test.mjs +12 -0
  102. package/packages/agentsam-errors/types/index.d.ts +5 -1
  103. package/packages/agentsam-goap/agentsam.package.json +42 -0
  104. package/packages/agentsam-goap/package.json +2 -2
  105. package/packages/agentsam-hooks/agentsam.package.json +45 -0
  106. package/packages/agentsam-hooks/bindings/go/errors_generated.go +1 -0
  107. package/packages/agentsam-hooks/bindings/rust/src/errors_generated.rs +1 -0
  108. package/packages/agentsam-hooks/package.json +1 -1
  109. package/packages/agentsam-hooks/src/errors-generated.js +10 -0
  110. package/packages/agentsam-ide/README.md +59 -0
  111. package/packages/agentsam-ide/src/lsp/host.d.mts +13 -0
  112. package/packages/agentsam-ide/src/lsp/host.mjs +133 -0
  113. package/packages/agentsam-knowledge/agentsam.package.json +42 -0
  114. package/packages/agentsam-knowledge/package.json +1 -1
  115. package/packages/agentsam-knowledge/src/autorag/index.js +25 -4
  116. package/packages/agentsam-knowledge/src/backends/index.js +21 -1
  117. package/packages/agentsam-knowledge/src/backends/supabase-node-api.js +91 -0
  118. package/packages/agentsam-knowledge/test/autorag.test.mjs +13 -0
  119. package/packages/agentsam-knowledge/test/supabase-node-api.test.mjs +59 -0
  120. package/packages/agentsam-merch/agentsam.package.json +43 -0
  121. package/packages/agentsam-merch/package.json +1 -1
  122. package/packages/agentsam-nav/dist/browser.global.js +18 -21
  123. package/packages/agentsam-nav/dist/browser.js +4 -3
  124. package/packages/agentsam-nav/dist/index.js +4 -3
  125. package/packages/agentsam-nav/package.json +1 -1
  126. package/packages/agentsam-queue-control/agentsam.package.json +42 -0
  127. package/packages/agentsam-queue-control/package.json +1 -1
  128. package/packages/agentsam-rapid-rust/Cargo.toml +5 -0
  129. package/packages/agentsam-rapid-rust/agentsam.package.json +42 -0
  130. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/0b22ca9c5f8cddc15e6816df4a2467a28d41aa174361cdfed9019ee4e04dfbb8.json +1 -0
  131. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/0c5064875a5d7645013880f04d71f56c0dfa1bc87ac9fd59adc3e9a93a2745da.json +1 -0
  132. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/11ebd15702c169ee0666656be851cc549f70f84498dbca3c5b72d2ceaa91c851.json +1 -0
  133. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/1d7f2c8ad9588cd2077a1d07fce156e0bd47be686d8c9f26885bab14874c4ab5.json +1 -0
  134. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/1f21ba21e7b631b0d4893cbdd7a6bb7345d34e8b1a0ee9cf644cc30aeb3c8b8d.json +1 -0
  135. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/23f4d4b90def0782de32e7a57558cba24525f12ba3c009728ea4881259a74099.json +1 -0
  136. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/26b60985b6ef62e4f20e06c37e47c6996c1a2f457335fa9eb4a68d1288e18490.json +1 -0
  137. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/2b27d15a1b8c3637a56f631d583cc9ba584bed2b7018dd962a9340d5e1c50a1d.json +1 -0
  138. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/3110a5568a544c4c38de6585dcdabc21fa5f54a5772ecf4e1f4076ee0d49e933.json +1 -0
  139. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/357ce3db8299e01866bf4fc3d8ee1c784ef53c7455cf86bb17c52f3dad20d050.json +1 -0
  140. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/4516c6e03636538cacc7a6e4063d98a7ed2f0090c3a02c5ee817f1c512b1070e.json +1 -0
  141. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/649e02dbaec2edabbd40372e0c5f72f114164fe7704e7825220b1955f6a7c74e.json +1 -0
  142. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/81c266d4c150a4f6c5a73c9c4fef6541577fd0acd8c1f911f02781deb5f0be0f.json +1 -0
  143. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/86b4b8de30eed9902750b3de9fb54276d229244671a8b6035345bbe705463d82.json +1 -0
  144. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/8a877fdc5dbc6a66c344b4ebc4d9b746d47f95153e98872210becd85ca941ddd.json +1 -0
  145. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/96a11200f7b42ddd1281e4f749e88dcb8455ab0e3883f943934e0a9a7935147a.json +1 -0
  146. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/9e2df2335cfc73ec021bdd6b2d34af798f6ed9c52e3061ce16b6ceabae4e275f.json +1 -0
  147. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/a405fe3addeaab2908ed58836997be3b679d990ec9102d06bece3569e4bd4a81.json +1 -0
  148. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/a63915da0a45f86a5938ba9a2b2e87d469e7d07f7ea9cc531136fdc9e055557e.json +1 -0
  149. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/a8452c2dcaa959ced25e3597931b311999c0aa5b257ca8610fe415e8cfa598cc.json +1 -0
  150. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/b35fc2ae65ea07fbbfdd242a3d76489947462399e7a2db91f8545ca50d97d86f.json +1 -0
  151. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/b966932defe9c7b5ec9599c9276d333bd09ad1605adae80300d825d2161ad20c.json +1 -0
  152. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/ca9060e5ccb91f3a2663f57afd47a25099b6b3313c2a7436c4634993ff6e9afc.json +1 -0
  153. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/d0eba82a259be203c68c3ebf6d5b8a376f31a3b84fad418fdb9b5e2715c59869.json +1 -0
  154. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/d8838513009c65079aba67314ab130920484c674c5f0b8a356c8777eb6174eb2.json +1 -0
  155. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/dda01925b7f0a213215b983979ce23625dd0f6cfdb49c483ec1ff73e64def56f.json +1 -0
  156. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/e4956d8f97608f8324607b22cc93635d8183b23021d79cb4c21668c8b8a6ce87.json +1 -0
  157. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/e80c1e517e7173dcbde78869d2bf67a24a11b0bb9df5a87fb12934e39497abc8.json +1 -0
  158. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/eeeaa9394ac979eb4ffa557e97d67ed96dbd61437e09058f7c776bdc0483f050.json +1 -0
  159. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/f9264d8d7d1ccfb415362a28b4a1b4fa0dfbdf828ff970d1aaecfb0ebe208978.json +1 -0
  160. package/packages/agentsam-repository/.agentsam/machine/cache/machine-parser.v1/f957a80b89d32af4f33f9f840b4795af1b5145fc44780ad88a6a3b1b3a7ea3bc.json +1 -0
  161. package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/asset-manifest.json +418 -0
  162. package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/findings.json +308 -0
  163. package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/frontend-manifest.json +70 -0
  164. package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/graph.json +322 -0
  165. package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/inventory.json +932 -0
  166. package/packages/agentsam-repository/.agentsam/machine/runs/run_2b0d196f16961f88/summary.json +21 -0
  167. package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/asset-manifest.json +418 -0
  168. package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/findings.json +308 -0
  169. package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/frontend-manifest.json +70 -0
  170. package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/graph.json +322 -0
  171. package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/inventory.json +932 -0
  172. package/packages/agentsam-repository/.agentsam/machine/runs/run_2d70e3d4fe8290fb/summary.json +21 -0
  173. package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/asset-manifest.json +418 -0
  174. package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/findings.json +308 -0
  175. package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/frontend-manifest.json +70 -0
  176. package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/graph.json +322 -0
  177. package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/inventory.json +932 -0
  178. package/packages/agentsam-repository/.agentsam/machine/runs/run_63fab76b2f18c2f0/summary.json +21 -0
  179. package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/asset-manifest.json +418 -0
  180. package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/findings.json +300 -0
  181. package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/frontend-manifest.json +70 -0
  182. package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/graph.json +322 -0
  183. package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/inventory.json +932 -0
  184. package/packages/agentsam-repository/.agentsam/machine/runs/run_72fe856b80b0c46f/summary.json +21 -0
  185. package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/asset-manifest.json +418 -0
  186. package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/findings.json +308 -0
  187. package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/frontend-manifest.json +70 -0
  188. package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/graph.json +322 -0
  189. package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/inventory.json +932 -0
  190. package/packages/agentsam-repository/.agentsam/machine/runs/run_a5834156504f3050/summary.json +21 -0
  191. package/packages/agentsam-repository/README.md +25 -0
  192. package/packages/agentsam-repository/agentsam.package.json +42 -0
  193. package/packages/agentsam-repository/package.json +6 -3
  194. package/packages/agentsam-repository/src/crawl.js +220 -0
  195. package/packages/agentsam-repository/src/index.js +3 -0
  196. package/packages/agentsam-repository/src/merkle/semantic.js +20 -0
  197. package/packages/agentsam-repository/src/refinery.js +96 -0
  198. package/packages/agentsam-repository/test/crawl-refinery.test.mjs +113 -0
  199. package/packages/agentsam-site-scrape/README.md +357 -0
  200. package/packages/agentsam-site-scrape/agentsam_site_scrape/__init__.py +4 -0
  201. package/packages/agentsam-site-scrape/agentsam_site_scrape/__main__.py +349 -0
  202. package/packages/agentsam-site-scrape/agentsam_site_scrape/classify.py +80 -0
  203. package/packages/agentsam-site-scrape/agentsam_site_scrape/config.py +83 -0
  204. package/packages/agentsam-site-scrape/agentsam_site_scrape/contract.py +108 -0
  205. package/packages/agentsam-site-scrape/agentsam_site_scrape/crawl.py +395 -0
  206. package/packages/agentsam-site-scrape/agentsam_site_scrape/evidence.py +226 -0
  207. package/packages/agentsam-site-scrape/agentsam_site_scrape/htmlparse.py +109 -0
  208. package/packages/agentsam-site-scrape/agentsam_site_scrape/imageops.py +121 -0
  209. package/packages/agentsam-site-scrape/agentsam_site_scrape/jsonrun.py +127 -0
  210. package/packages/agentsam-site-scrape/agentsam_site_scrape/net.py +121 -0
  211. package/packages/agentsam-site-scrape/agentsam_site_scrape/pageextract.py +202 -0
  212. package/packages/agentsam-site-scrape/agentsam_site_scrape/r2_upload.py +140 -0
  213. package/packages/agentsam-site-scrape/agentsam_site_scrape/ssrf.py +57 -0
  214. package/packages/agentsam-site-scrape/agentsam_site_scrape/storage.py +57 -0
  215. package/packages/agentsam-site-scrape/agentsam_site_scrape/wrangler_bucket.py +98 -0
  216. package/packages/agentsam-site-scrape/pyproject.toml +21 -0
  217. package/packages/agentsam-site-scrape/runtime/client.mjs +32 -0
  218. package/packages/agentsam-site-scrape/runtime/core.mjs +211 -0
  219. package/packages/agentsam-site-scrape/runtime/index.mjs +31 -0
  220. package/packages/agentsam-site-scrape/runtime/knowledge.mjs +38 -0
  221. package/packages/agentsam-site-scrape/runtime/node-runner.mjs +231 -0
  222. package/packages/agentsam-site-scrape/runtime/node-storage.mjs +146 -0
  223. package/packages/agentsam-site-scrape/runtime/project-site.mjs +74 -0
  224. package/packages/agentsam-site-scrape/runtime/secure-fetch.mjs +88 -0
  225. package/packages/agentsam-site-scrape/runtime/test/knowledge-handoff.test.mjs +51 -0
  226. package/packages/agentsam-site-scrape/runtime/test/project-index-command.test.mjs +109 -0
  227. package/packages/agentsam-site-scrape/runtime/test/runtime.test.mjs +145 -0
  228. package/packages/agentsam-site-scrape/tests/__init__.py +0 -0
  229. package/packages/agentsam-site-scrape/tests/test_contract.py +83 -0
  230. package/packages/agentsam-site-scrape/tests/test_core.py +119 -0
  231. package/packages/agentsam-site-scrape/tests/test_evidence.py +88 -0
  232. package/packages/agentsam-site-scrape/tests/test_evidence_pipeline.py +112 -0
  233. package/packages/agentsam-site-scrape/tests/test_jsonrun.py +63 -0
  234. package/packages/agentsam-site-scrape/tests/test_redirects.py +68 -0
  235. package/packages/agentsam-site-scrape/tests/test_storage.py +34 -0
  236. package/packages/agentsam-site-scrape/worker/index.mjs +259 -0
  237. package/packages/agentsam-site-scrape/worker/project-config.mjs +57 -0
  238. package/packages/agentsam-site-scrape/worker/test/worker.test.mjs +191 -0
  239. package/packages/agentsam-vault/package.json +1 -1
  240. package/packages/agentsam-workbench/README.md +18 -0
  241. package/packages/agentsam-workbench/package.json +13 -4
  242. package/packages/agentsam-workbench/src/agent/capability-catalog.ts +96 -0
  243. package/packages/agentsam-workbench/src/agent/index.ts +2 -0
  244. package/packages/agentsam-workbench/src/knowledge/AutoRagWorkflowDialog.tsx +166 -0
  245. package/packages/agentsam-workbench/src/knowledge/README.md +14 -0
  246. package/packages/agentsam-workbench/src/knowledge/autorag-workflow.css +6 -0
  247. package/packages/agentsam-workbench/src/knowledge/index.ts +2 -0
  248. package/packages/agentsam-workbench/src/widgets/registry.ts +266 -1
  249. package/packages/catalog/README.md +69 -0
  250. package/packages/catalog/assist/questions.json +205 -0
  251. package/packages/catalog/assist/rules.json +149 -0
  252. package/packages/catalog/doctor/toolchains.json +12 -0
  253. package/packages/catalog/evidence/agentsam-abs.json +76 -0
  254. package/packages/catalog/evidence/agentsam-analytics.json +59 -0
  255. package/packages/catalog/evidence/agentsam-assets-core.json +38 -0
  256. package/packages/catalog/evidence/agentsam-brand.json +73 -0
  257. package/packages/catalog/evidence/agentsam-browser-surface.json +42 -0
  258. package/packages/catalog/evidence/agentsam-campaign.json +48 -0
  259. package/packages/catalog/evidence/agentsam-cloudflare-images.json +38 -0
  260. package/packages/catalog/evidence/agentsam-content-studio.json +42 -0
  261. package/packages/catalog/evidence/agentsam-content.json +70 -0
  262. package/packages/catalog/evidence/agentsam-contracts.json +92 -0
  263. package/packages/catalog/evidence/agentsam-database-editor.json +82 -0
  264. package/packages/catalog/evidence/agentsam-desktop-shell.json +56 -0
  265. package/packages/catalog/evidence/agentsam-docs-theme.json +35 -0
  266. package/packages/catalog/evidence/agentsam-errors.json +42 -0
  267. package/packages/catalog/evidence/agentsam-goap.json +52 -0
  268. package/packages/catalog/evidence/agentsam-hooks.json +100 -0
  269. package/packages/catalog/evidence/agentsam-ide.json +64 -0
  270. package/packages/catalog/evidence/agentsam-identity.json +91 -0
  271. package/packages/catalog/evidence/agentsam-key-manager.json +46 -0
  272. package/packages/catalog/evidence/agentsam-knowledge.json +42 -0
  273. package/packages/catalog/evidence/agentsam-loading-scene.json +54 -0
  274. package/packages/catalog/evidence/agentsam-merch.json +68 -0
  275. package/packages/catalog/evidence/agentsam-nav.json +63 -0
  276. package/packages/catalog/evidence/agentsam-queue-control.json +60 -0
  277. package/packages/catalog/evidence/agentsam-rapid-rust.json +46 -0
  278. package/packages/catalog/evidence/agentsam-repository.json +56 -0
  279. package/packages/catalog/evidence/agentsam-scoring.json +39 -0
  280. package/packages/catalog/evidence/agentsam-sections.json +52 -0
  281. package/packages/catalog/evidence/agentsam-settings.json +58 -0
  282. package/packages/catalog/evidence/agentsam-shell-kit.json +56 -0
  283. package/packages/catalog/evidence/agentsam-vault.json +61 -0
  284. package/packages/catalog/evidence/agentsam-work-graph.json +51 -0
  285. package/packages/catalog/evidence/agentsam-work.json +64 -0
  286. package/packages/catalog/evidence/agentsam-workbench.json +96 -0
  287. package/packages/catalog/evidence/analytics-ui.json +43 -0
  288. package/packages/catalog/evidence/cms-runtime.json +49 -0
  289. package/packages/catalog/evidence/copro-editor.json +42 -0
  290. package/packages/catalog/evidence/copro-media.json +42 -0
  291. package/packages/catalog/evidence/copro-project.json +42 -0
  292. package/packages/catalog/evidence/copro-proof.json +48 -0
  293. package/packages/catalog/evidence/copro-provider-contracts.json +40 -0
  294. package/packages/catalog/evidence/copro-render.json +40 -0
  295. package/packages/catalog/evidence/copro-storage.json +44 -0
  296. package/packages/catalog/evidence/copro-templates.json +42 -0
  297. package/packages/catalog/evidence/copro-timeline.json +44 -0
  298. package/packages/catalog/evidence/copro-ui.json +52 -0
  299. package/packages/catalog/evidence/fnf-theme.json +34 -0
  300. package/packages/catalog/evidence/theme-contract.json +34 -0
  301. package/packages/catalog/evidence/theme-cypress.json +41 -0
  302. package/packages/catalog/evidence/theme-ember.json +41 -0
  303. package/packages/catalog/evidence/theme-forge.json +41 -0
  304. package/packages/catalog/evidence/theme-grove.json +41 -0
  305. package/packages/catalog/evidence/theme-harbor.json +41 -0
  306. package/packages/catalog/evidence/theme-heuristic.json +50 -0
  307. package/packages/catalog/evidence/theme-iasf.json +48 -0
  308. package/packages/catalog/evidence/theme-resolve.json +41 -0
  309. package/packages/catalog/evidence/theme-scenes.json +68 -0
  310. package/packages/catalog/evidence/theme-summit.json +41 -0
  311. package/packages/catalog/evidence/theme-violet.json +41 -0
  312. package/packages/catalog/generated/packages.json +2649 -0
  313. package/packages/catalog/topics/runtime.json +33 -0
  314. package/packages/connectors/cfoa/agentsam.package.json +46 -0
  315. package/packages/connectors/cfoa/package.json +1 -1
  316. package/packages/connectors/cfoa/src/capabilities.js +22 -2
  317. package/packages/connectors/cfoa/src/families/analytics-sql.js +44 -0
  318. package/packages/connectors/cfoa/src/families/basin.js +30 -0
  319. package/packages/connectors/cfoa/src/index.js +3 -0
  320. package/packages/connectors/cfoa/src/routes.js +11 -2
  321. package/packages/connectors/cfoa/test/analytics-sql.test.mjs +27 -0
  322. package/packages/connectors/cfoa/test/basin.test.mjs +30 -0
  323. package/packages/heuristic-theme/README.md +14 -0
  324. package/packages/heuristic-theme/agentsam.package.json +42 -0
  325. package/packages/heuristic-theme/contracts/README.md +15 -0
  326. package/packages/heuristic-theme/contracts/block.schema.json +33 -0
  327. package/packages/heuristic-theme/contracts/header-presets.json +20 -0
  328. package/packages/heuristic-theme/contracts/page.schema.json +18 -0
  329. package/packages/heuristic-theme/contracts/preset.schema.json +18 -0
  330. package/packages/heuristic-theme/contracts/section.schema.json +83 -0
  331. package/packages/heuristic-theme/package.json +13 -3
  332. package/packages/heuristic-theme/presets/fuel-free-time/assets.json +8 -0
  333. package/packages/heuristic-theme/presets/fuel-free-time/globals/shell.json +30 -0
  334. package/packages/heuristic-theme/presets/fuel-free-time/pages/about.json +4 -0
  335. package/packages/heuristic-theme/presets/fuel-free-time/pages/cart.json +4 -0
  336. package/packages/heuristic-theme/presets/fuel-free-time/pages/collection.json +4 -0
  337. package/packages/heuristic-theme/presets/fuel-free-time/pages/collections.json +4 -0
  338. package/packages/heuristic-theme/presets/fuel-free-time/pages/community.json +4 -0
  339. package/packages/heuristic-theme/presets/fuel-free-time/pages/home.json +92 -0
  340. package/packages/heuristic-theme/presets/fuel-free-time/pages/order-confirmation.json +39 -0
  341. package/packages/heuristic-theme/presets/fuel-free-time/pages/product.json +4 -0
  342. package/packages/heuristic-theme/presets/fuel-free-time/pages/shop.json +9 -0
  343. package/packages/heuristic-theme/presets/fuel-free-time/preset.json +23 -0
  344. package/packages/heuristic-theme/presets/fuel-free-time/tokens.json +23 -0
  345. package/packages/heuristic-theme/storefront/about.html +1103 -0
  346. package/packages/heuristic-theme/storefront/assets/presets/fuel-free-time/GENERATED-ASSETS.md +15 -0
  347. package/packages/heuristic-theme/storefront/assets/presets/fuel-free-time/earned-hours-hero.webp +0 -0
  348. package/packages/heuristic-theme/storefront/assets/presets/fuel-free-time/essentials.webp +0 -0
  349. package/packages/heuristic-theme/storefront/assets/presets/fuel-free-time/masters.webp +0 -0
  350. package/packages/heuristic-theme/storefront/cart.html +64 -0
  351. package/packages/heuristic-theme/storefront/collaborate.html +58 -0
  352. package/packages/heuristic-theme/storefront/collection.html +10 -0
  353. package/packages/heuristic-theme/storefront/collections.html +10 -0
  354. package/packages/heuristic-theme/storefront/community.html +921 -0
  355. package/packages/heuristic-theme/storefront/css/content-page.css +199 -0
  356. package/packages/heuristic-theme/storefront/css/global-footer.css +401 -0
  357. package/packages/heuristic-theme/storefront/css/heuristic-theme.css +81 -0
  358. package/packages/heuristic-theme/storefront/css/page-composer.css +76 -0
  359. package/packages/heuristic-theme/storefront/css/shop-hero.css +230 -0
  360. package/packages/heuristic-theme/storefront/css/store-cart.css +422 -0
  361. package/packages/heuristic-theme/storefront/css/store-collections.css +36 -0
  362. package/packages/heuristic-theme/storefront/css/store-pdp.css +459 -0
  363. package/packages/heuristic-theme/storefront/css/store-shell.css +474 -0
  364. package/packages/heuristic-theme/storefront/css/store-shop.css +117 -0
  365. package/packages/heuristic-theme/storefront/home.html +25 -0
  366. package/packages/heuristic-theme/storefront/js/cms-hydrate.js +395 -0
  367. package/packages/heuristic-theme/storefront/js/cms-structure.js +85 -0
  368. package/packages/heuristic-theme/storefront/js/fnf-attribution.js +98 -0
  369. package/packages/heuristic-theme/storefront/js/fnf-head.js +47 -0
  370. package/packages/heuristic-theme/storefront/js/fnf-newsletter.js +64 -0
  371. package/packages/heuristic-theme/storefront/js/global-footer.js +277 -0
  372. package/packages/heuristic-theme/storefront/js/heuristic-runtime.js +78 -0
  373. package/packages/heuristic-theme/storefront/js/order-confirmation.js +109 -0
  374. package/packages/heuristic-theme/storefront/js/page-composer.js +310 -0
  375. package/packages/heuristic-theme/storefront/js/shop-hero.js +85 -0
  376. package/packages/heuristic-theme/storefront/js/store-cart.js +276 -0
  377. package/packages/heuristic-theme/storefront/js/store-catalog.js +140 -0
  378. package/packages/heuristic-theme/storefront/js/store-collections.js +45 -0
  379. package/packages/heuristic-theme/storefront/js/store-product.js +287 -0
  380. package/packages/heuristic-theme/storefront/js/store-shell.js +449 -0
  381. package/packages/heuristic-theme/storefront/order-confirmation.html +30 -0
  382. package/packages/heuristic-theme/storefront/policies.html +43 -0
  383. package/packages/heuristic-theme/storefront/product.html +27 -0
  384. package/packages/heuristic-theme/storefront/shop.html +113 -0
  385. package/packages/heuristic-theme/storefront/terms.html +45 -0
  386. package/packages/heuristic-theme/test/commerce-portability.test.mjs +16 -0
  387. package/packages/heuristic-theme/theme.json +55 -0
  388. package/packages/heuristic-theme/theme.schema.json +32 -0
  389. package/packages/identity/agentsam.package.json +42 -0
  390. package/packages/identity/package.json +1 -1
  391. package/packages/identity/src/oauth/iam-platform.js +4 -2
  392. package/packages/identity/src/recovery/password-reset.js +8 -8
  393. package/packages/identity/src/server/worker-router.js +63 -1
  394. package/packages/identity/tests/lane1-packed-consumer.test.mjs +12 -1
  395. package/packages/identity/tests/password-enrollment.test.mjs +82 -0
  396. package/packages/identity/tests/password-reset.test.mjs +43 -0
  397. package/packages/providers/completeful/package.json +1 -1
  398. package/packages/theme-cypress/agentsam.package.json +42 -0
  399. package/packages/theme-cypress/package.json +1 -1
  400. package/packages/theme-ember/agentsam.package.json +42 -0
  401. package/packages/theme-ember/package.json +1 -1
  402. package/packages/theme-forge/agentsam.package.json +42 -0
  403. package/packages/theme-forge/package.json +1 -1
  404. package/packages/theme-grove/agentsam.package.json +42 -0
  405. package/packages/theme-grove/package.json +1 -1
  406. package/packages/theme-harbor/agentsam.package.json +42 -0
  407. package/packages/theme-harbor/package.json +1 -1
  408. package/packages/theme-resolve/agentsam.package.json +42 -0
  409. package/packages/theme-resolve/package.json +1 -1
  410. package/packages/theme-scenes/agentsam.package.json +42 -0
  411. package/packages/theme-scenes/package.json +1 -1
  412. package/packages/theme-summit/agentsam.package.json +42 -0
  413. package/packages/theme-summit/package.json +1 -1
  414. package/packages/theme-violet/agentsam.package.json +42 -0
  415. package/packages/theme-violet/package.json +1 -1
  416. package/packages/work-graph/agentsam.package.json +42 -0
  417. package/packages/work-graph/package.json +1 -1
  418. package/protocol/apps/agentsam.app.v1.schema.json +27 -1
  419. package/protocol/cad/README.md +77 -0
  420. package/protocol/cad/cad.project.v2.schema.json +451 -0
  421. package/protocol/cad/v2/core/artifact-receipt.schema.json +126 -0
  422. package/protocol/cad/v2/core/coordinate-system.schema.json +364 -0
  423. package/protocol/cad/v2/core/geometry-constraint.schema.json +136 -0
  424. package/protocol/cad/v2/core/geometry-entity.schema.json +73 -0
  425. package/protocol/cad/v2/core/geometry-feature.schema.json +115 -0
  426. package/protocol/cad/v2/core/geometry-relationship.schema.json +67 -0
  427. package/protocol/cad/v2/core/project-revision.schema.json +111 -0
  428. package/protocol/cad/v2/core/topology-reference.schema.json +80 -0
  429. package/protocol/cad/v2/intent/design-decision.schema.json +126 -0
  430. package/protocol/cad/v2/intent/design-option.schema.json +88 -0
  431. package/protocol/cad/v2/interchange/ifc-mapping.schema.json +145 -0
  432. package/protocol/cad/v2/interchange/native-document.schema.json +130 -0
  433. package/protocol/cad/v2/interchange/reference-model.schema.json +141 -0
  434. package/protocol/cad/v2/modules/architecture.v1.schema.json +278 -0
  435. package/protocol/cad/v2/modules/landscape.v1.schema.json +157 -0
  436. package/protocol/cad/v2/modules/mechanical.v1.schema.json +325 -0
  437. package/protocol/cad/v2/modules/parametric.v1.schema.json +89 -0
  438. package/protocol/cad/v2/modules/product-design.v1.schema.json +178 -0
  439. package/protocol/cad/v2/modules/robotics.v1.schema.json +246 -0
  440. package/protocol/cad/v2/presentation/camera-path.schema.json +143 -0
  441. package/protocol/cad/v2/presentation/drawing.schema.json +162 -0
  442. package/protocol/cad/v2/presentation/production.schema.json +166 -0
  443. package/protocol/cad/v2/presentation/scene.schema.json +198 -0
  444. package/protocol/cad/v2/presentation/sheet.schema.json +254 -0
  445. package/protocol/cad/v2/presentation/view.schema.json +190 -0
  446. package/protocol/cad/v2/presentation/walkthrough.schema.json +199 -0
  447. package/protocol/cad/v2/schema-pack.manifest.json +189 -0
  448. package/protocol/cad/v2/validation/deliverable-manifest.schema.json +199 -0
  449. package/protocol/cad/v2/validation/result.schema.json +141 -0
  450. package/protocol/capabilities/evidence-manifest.schema.json +404 -0
  451. package/protocol/capabilities/manifest.json +101 -10
  452. package/protocol/capabilities/repository-crawl-input.schema.json +17 -0
  453. package/protocol/capabilities/repository-crawl-result.schema.json +79 -0
  454. package/protocol/capabilities/repository-mine-input.schema.json +27 -0
  455. package/protocol/capabilities/repository-mine-result.schema.json +51 -0
  456. package/protocol/capabilities/site-index.schema.json +15 -0
  457. package/protocol/capabilities/site-scrape-evidence-manifest.schema.json +114 -0
  458. package/protocol/capabilities/site-scrape-input.schema.json +90 -0
  459. package/protocol/capabilities/site-scrape-project-authority.schema.json +15 -0
  460. package/protocol/capabilities/site-scrape-result.schema.json +198 -0
  461. package/protocol/capabilities/site-scrape-worker-job.schema.json +18 -0
  462. package/protocol/errors/error-catalog.json +12 -0
  463. package/protocol/governance/distribution-roadmap.v1.json +335 -0
  464. package/protocol/governance/github-labels.v1.json +232 -0
  465. package/protocol/models/workers-ai-curated.mjs +14 -0
  466. package/protocol/plugins/agentsam.plugin-evidence-bundle.v1.schema.json +55 -0
  467. package/protocol/plugins/agentsam.plugin-product.v1.schema.json +227 -0
  468. package/protocol/plugins/agentsam.plugin-quality-evidence.v1.schema.json +47 -0
  469. package/protocol/plugins/agentsam.plugin-quality-receipt.v1.schema.json +160 -0
  470. package/protocol/ui/agentsam.ui-quality.v1.schema.json +31 -0
  471. package/python/agentsam_sdk/__init__.py +4 -0
  472. package/python/agentsam_sdk/client.py +202 -0
  473. package/python/agentsam_sdk/errors/vocabulary.py +10 -0
  474. package/python/tests/test_public_client.py +82 -0
  475. package/services/cad/blender/adapter.py +0 -0
  476. package/services/cad/occt/CMakeLists.txt +43 -0
  477. package/services/cad/occt/README.md +38 -0
  478. package/services/cad/occt/main.cpp +95 -0
  479. package/services/cad/server.py +103 -21
  480. package/skills/README.md +6 -0
  481. package/skills/agentsam-cad/SKILL.md +59 -0
  482. package/skills/agentsam-plan-and-goap/SKILL.md +77 -0
  483. package/skills/agentsam-repo-recon/SKILL.md +63 -0
  484. package/skills/agentsam-sam-operations/SKILL.md +71 -0
  485. package/skills/agentsam-sdk-orientation/SKILL.md +75 -0
  486. package/skills/catalog.json +85 -0
  487. package/src/AgentSam.js +2 -0
  488. package/src/agent/capability-adapter.js +207 -9
  489. package/src/agent/index.js +1 -0
  490. package/src/agent/intent.js +12 -0
  491. package/src/agent/project-discovery.js +47 -0
  492. package/src/agent/project-resources.js +157 -0
  493. package/src/agent/responses-runner.js +64 -12
  494. package/src/capabilities/cloudflare-d1-provision.js +48 -0
  495. package/src/capabilities/knowledge-operations.js +87 -0
  496. package/src/capabilities/local-sqlite-resources.js +124 -0
  497. package/src/capabilities/machine-inspect.js +28 -0
  498. package/src/capabilities/mcp-d1-bridge.js +98 -0
  499. package/src/capabilities/plan-operation-ids.js +6 -0
  500. package/src/capabilities/plan-operations.js +85 -0
  501. package/src/capabilities/repository-awareness.js +52 -0
  502. package/src/capabilities/test-run.js +10 -0
  503. package/src/capabilities/workspace-files.js +125 -0
  504. package/src/cli/command-catalog.js +16 -3
  505. package/src/cli.js +71 -116
  506. package/src/commands/app.js +43 -44
  507. package/src/commands/autorag-node-api.js +96 -0
  508. package/src/commands/autorag.js +178 -17
  509. package/src/commands/catalog-doctor.js +52 -0
  510. package/src/commands/catalog.js +151 -0
  511. package/src/commands/cheat-sheet.js +92 -63
  512. package/src/commands/cloudflare.js +64 -2
  513. package/src/commands/codebaseindex.js +2 -2
  514. package/src/commands/db.js +17 -0
  515. package/src/commands/goap-world.js +4 -0
  516. package/src/commands/interactive.js +21 -1
  517. package/src/commands/knowledge.js +8 -3
  518. package/src/commands/machine-binary.js +3 -2
  519. package/src/commands/machine.js +66 -15
  520. package/src/commands/mcp.js +98 -8
  521. package/src/commands/plan-ledger.js +60 -22
  522. package/src/commands/plan.js +3 -3
  523. package/src/commands/plugins.js +34 -2
  524. package/src/commands/product.js +21 -0
  525. package/src/commands/rust.js +4 -1
  526. package/src/commands/sam-evidence.js +87 -0
  527. package/src/commands/sam-media.js +78 -0
  528. package/src/commands/sam.js +117 -0
  529. package/src/commands/shell.js +97 -8
  530. package/src/commands/site-scrape.js +9 -0
  531. package/src/context/resolve.js +5 -1
  532. package/src/index.js +13 -0
  533. package/src/knowledge/d1-schema.js +65 -0
  534. package/src/knowledge/engine.js +55 -15
  535. package/src/knowledge/source.js +8 -0
  536. package/src/knowledge/store-discovery.js +9 -3
  537. package/src/knowledge/stores/sqlite.js +8 -0
  538. package/src/knowledge/wrangler-binding-discovery.js +43 -0
  539. package/src/lib/agent-instructions.js +29 -5
  540. package/src/lib/auth.js +46 -7
  541. package/src/lib/cad/delivery-profiles.d.ts +7 -0
  542. package/src/lib/cad/delivery-profiles.js +122 -0
  543. package/src/lib/cad/docker-executor.js +1 -1
  544. package/src/lib/cad/editable-project-contract.js +75 -0
  545. package/src/lib/cad/index.js +6 -0
  546. package/src/lib/cad/occt-native-provider.mjs +138 -0
  547. package/src/lib/cad/openscad.js +13 -1
  548. package/src/lib/cad/production-operations.d.ts +8 -0
  549. package/src/lib/cad/production-operations.js +74 -0
  550. package/src/lib/cad/project-cli.d.ts +1 -1
  551. package/src/lib/cad/project-contract.js +1 -1
  552. package/src/lib/cad/project-runtime.d.ts +1 -1
  553. package/src/lib/cad/project-runtime.js +48 -3
  554. package/src/lib/cad/project-tools.js +24 -0
  555. package/src/lib/cad/project-v2.d.ts +48 -0
  556. package/src/lib/cad/project-v2.js +288 -0
  557. package/src/lib/cad-docker.js +48 -4
  558. package/src/lib/dockerize.js +3 -3
  559. package/src/lib/execution-approvals.js +29 -3
  560. package/src/local-fs/capability.js +5 -0
  561. package/src/local-lsp/host.js +2 -0
  562. package/src/local-pty/server.js +21 -0
  563. package/src/mcp/client.js +2 -1
  564. package/src/mcp/oauth-connection.js +109 -0
  565. package/src/models/inventory-core.js +2 -10
  566. package/src/plugins/index.js +13 -0
  567. package/src/plugins/productization.js +348 -0
  568. package/src/providers/gemini-generate-content.js +18 -0
  569. package/src/registry/generated/inventory.json +4266 -0
  570. package/src/registry/index.js +96 -0
  571. package/src/registry/turn-one.js +45 -0
  572. package/src/sam/adapters/local-media-store.js +71 -0
  573. package/src/sam/adapters/local-script-runtime.js +122 -0
  574. package/src/sam/adapters/local-script-store.js +103 -0
  575. package/src/sam/adapters/object-media-store.js +89 -0
  576. package/src/sam/adapters/workspace-media.js +78 -0
  577. package/src/sam/artifacts/render.js +94 -0
  578. package/src/sam/bridge/stdio.mjs +59 -0
  579. package/src/sam/client.js +269 -22
  580. package/src/sam/index.js +30 -1
  581. package/src/sam/local-execution.js +8 -0
  582. package/src/sam/media/environment.js +96 -0
  583. package/src/sam/model-adapter.js +45 -0
  584. package/src/sam/operation-packs/generated-v2/background.js +54 -0
  585. package/src/sam/operation-packs/generated-v2/catalog.js +1746 -0
  586. package/src/sam/operation-packs/generated-v2/generated-execution-policies.json +401 -0
  587. package/src/sam/operation-packs/generated-v2/generated-tool-descriptors.json +1352 -0
  588. package/src/sam/operation-packs/generated-v2/glb.js +41 -0
  589. package/src/sam/operation-packs/generated-v2/inneranimalmedia-provider.js +24 -0
  590. package/src/sam/operation-packs/generated-v2/operation-pack.js +126 -0
  591. package/src/sam/operation-packs/generated-v2/raster.js +140 -0
  592. package/src/sam/operation-packs/generated-v2/scripts.js +63 -0
  593. package/src/sam/operation-packs/generated-v2/sdk-adapter.js +9 -0
  594. package/src/sam/operation-packs/generated-v2/test/alias-runtime.test.mjs +51 -0
  595. package/src/sam/operation-packs/generated-v2/test/background.test.mjs +19 -0
  596. package/src/sam/operation-packs/generated-v2/test/glb.test.mjs +19 -0
  597. package/src/sam/operation-packs/generated-v2/test/raster.test.mjs +38 -0
  598. package/src/sam/operation-packs/generated-v2/test/real-asset-bindings.test.mjs +74 -0
  599. package/src/sam/operation-packs/generated-v2/test/registration.test.mjs +65 -0
  600. package/src/sam/operation-packs/generated-v2/test/scripts.test.mjs +32 -0
  601. package/src/sam/operation-packs/generated-v2/test/superbash-client-integration.test.mjs +215 -0
  602. package/src/sam/operation-packs/generated-v2/tool-types.d.ts +53 -0
  603. package/src/sam/operations/artifact-render.js +13 -0
  604. package/src/sam/operations/repository-inspect.js +12 -2
  605. package/src/sam/operations/robotics.js +45 -0
  606. package/src/sam/os.js +117 -0
  607. package/src/sam/packs/authoring/README.md +13 -0
  608. package/src/sam/packs/authoring/index.js +108 -0
  609. package/src/sam/packs/cad/http-ports.js +55 -0
  610. package/src/sam/packs/cad/index.js +158 -0
  611. package/src/sam/packs/cad/model-tools.js +22 -0
  612. package/src/sam/packs/cad/modes.js +87 -0
  613. package/src/sam/packs/cms/aliases.js +1 -0
  614. package/src/sam/packs/cms/contracts.js +1 -0
  615. package/src/sam/packs/cms/machine.js +6 -0
  616. package/src/sam/packs/cms/node.js +1 -0
  617. package/src/sam/packs/core.js +27 -0
  618. package/src/sam/packs/evidence/README.md +65 -0
  619. package/src/sam/packs/evidence/compare.js +98 -0
  620. package/src/sam/packs/evidence/contract.js +56 -0
  621. package/src/sam/packs/evidence/derive.js +59 -0
  622. package/src/sam/packs/evidence/driver-blender.js +96 -0
  623. package/src/sam/packs/evidence/driver-playwright.js +91 -0
  624. package/src/sam/packs/evidence/exporter-copro.js +70 -0
  625. package/src/sam/packs/evidence/facts.js +37 -0
  626. package/src/sam/packs/evidence/host-local.js +74 -0
  627. package/src/sam/packs/evidence/index.js +494 -0
  628. package/src/sam/packs/evidence/media.js +44 -0
  629. package/src/sam/packs/evidence/naming.js +67 -0
  630. package/src/sam/packs/evidence/normalize.js +117 -0
  631. package/src/sam/packs/evidence/review-page.js +102 -0
  632. package/src/sam/packs/evidence/screenplay.js +34 -0
  633. package/src/sam/packs/evidence/seal.js +55 -0
  634. package/src/sam/packs/evidence/serve.js +74 -0
  635. package/src/sam/packs/evidence/store.js +93 -0
  636. package/src/sam/packs/evidence/viewports.js +23 -0
  637. package/src/sam/robotics/chess-adapter.js +14 -0
  638. package/src/sam/robotics/franka.js +44 -0
  639. package/src/sam/robotics/index.js +4 -0
  640. package/src/sam/robotics/receipt.js +21 -0
  641. package/src/sam/robotics/world.js +57 -0
  642. package/src/sam/seed.js +10 -40
  643. package/src/sam/shell-host.js +120 -0
  644. package/src/sam/validation.js +40 -0
  645. package/src/security/local-vault.js +6 -1
  646. package/src/ui/cli/help.js +6 -0
  647. package/templates/clay/clay-blueprint-template.html +481 -0
  648. package/templates/clay/clay-case-study-blueprint.html +269 -0
  649. package/templates/clay/conversion-showcase-section.html +534 -0
  650. package/templates/clay/enhancing-conversion-section.html +141 -0
  651. package/templates/clay/nuant-wireframe.html +117 -0
@@ -5,6 +5,8 @@
5
5
  import os from 'node:os';
6
6
  import path from 'node:path';
7
7
  import pc from 'picocolors';
8
+ import fs from 'node:fs';
9
+ import { usageError, processError } from '../../packages/agentsam-errors/src/cli.js';
8
10
  import { resolveMachineBinary, spawnMachine } from './machine-binary.js';
9
11
  import {
10
12
  installManagedMachine,
@@ -23,12 +25,16 @@ function usage() {
23
25
  ` ${pc.cyan('agentsam machine install')} [--version <semver>] Install the managed runtime`,
24
26
  ` ${pc.cyan('agentsam machine update')} Update the managed runtime`,
25
27
  ` ${pc.cyan('agentsam machine inspect <path>')} Inspect a repository or directory`,
28
+ ` ${pc.cyan('agentsam machine crawl <path> --json')} Normalize Machine evidence into a repository graph`,
29
+ ` ${pc.cyan('agentsam machine mine <path> --against <path>')} Compare repository implementations safely`,
26
30
  '',
27
31
  pc.bold('Options'),
28
32
  ` ${pc.dim('--json')} Machine-readable output`,
29
33
  ` ${pc.dim('--force')} Replace an existing managed version`,
30
34
  ` ${pc.dim('--run-id <id>')} Reuse an externalized inspection run`,
31
35
  ` ${pc.dim('--include-generated')} Include generated and cache trees`,
36
+ ` ${pc.dim('--against <path>')} Second repository for mine`,
37
+ ` ${pc.dim('--limit <n>')} Limit displayed proposals`,
32
38
  ` ${pc.dim('--help')} Show this help`,
33
39
  '',
34
40
  pc.bold('Runtime authority'),
@@ -56,6 +62,8 @@ function parseArgs(argv = []) {
56
62
  subcommand: null,
57
63
  target: null,
58
64
  positionals: [],
65
+ against: [],
66
+ limit: 50,
59
67
  };
60
68
 
61
69
  for (let i = 0; i < argv.length; i += 1) {
@@ -64,16 +72,24 @@ function parseArgs(argv = []) {
64
72
  else if (arg === '--json') out.json = true;
65
73
  else if (arg === '--force') out.force = true;
66
74
  else if (arg === '--include-generated') out.includeGenerated = true;
67
- else if (arg === '--run-id') {
75
+ else if (arg === '--against') {
68
76
  const value = argv[++i];
69
- if (value == null || value.startsWith('--')) throw new Error('--run-id requires a value');
77
+ if (!value || value.startsWith('--')) throw usageError('--against requires a path',{command:'agentsam machine',hints:{example:'agentsam machine mine . --against ../other-repo'}});
78
+ out.against.push(value);
79
+ } else if (arg === '--limit') {
80
+ const value = Number(argv[++i]);
81
+ if (!Number.isInteger(value) || value < 1 || value > 500) throw usageError('--limit must be 1..500',{command:'agentsam machine'});
82
+ out.limit = value;
83
+ } else if (arg === '--run-id') {
84
+ const value = argv[++i];
85
+ if (value == null || value.startsWith('--')) throw usageError('--run-id requires a value',{command:'agentsam machine'});
70
86
  out.runId = value;
71
87
  } else if (arg === '--version') {
72
88
  const value = argv[++i];
73
- if (value == null || value.startsWith('--')) throw new Error('--version requires a value');
89
+ if (value == null || value.startsWith('--')) throw usageError('--version requires a value',{command:'agentsam machine'});
74
90
  out.version = value;
75
91
  } else if (arg.startsWith('-')) {
76
- throw new Error('unknown machine option: ' + arg);
92
+ throw usageError('unknown machine option: ' + arg,{command:'agentsam machine'});
77
93
  } else {
78
94
  out.positionals.push(arg);
79
95
  }
@@ -160,6 +176,7 @@ function printInstallResult(action, result) {
160
176
  }
161
177
 
162
178
  export async function runMachine(argv = []) {
179
+ if (argv.includes('--help') || argv.includes('-h')) { console.log(usage()); return 0; }
163
180
  const args = parseArgs(argv);
164
181
  if (args.help || !args.subcommand) {
165
182
  console.log(usage());
@@ -201,10 +218,43 @@ export async function runMachine(argv = []) {
201
218
  return 0;
202
219
  }
203
220
 
221
+ if (args.subcommand === 'crawl' || args.subcommand === 'mine') {
222
+ const { createRepositoryCrawl, findRefineryCandidates } = await import('../../packages/agentsam-repository/src/index.js');
223
+ const resolution = resolveMachineBinary();
224
+ const targets = [args.target || process.cwd(), ...(args.subcommand === 'mine' ? args.against : [])];
225
+ if (args.subcommand === 'mine' && targets.length < 2) throw usageError('machine mine finds cross-repository code reuse; supply --against <second-repository>',{command:'agentsam machine',hints:{example:'agentsam machine mine . --against ../other-repo'}});
226
+ const graphs = targets.map(target => {
227
+ const abs = path.resolve(target);
228
+ if (!fs.existsSync(abs)) throw usageError('Machine target not found: '+abs,{command:'agentsam machine',reason:'target_not_found'});
229
+ const result = spawnMachine(resolution, ['inspect', abs, '--json'], {
230
+ stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 128 * 1024 * 1024,
231
+ });
232
+ if (result.error) throw processError(result.error.message || 'Machine process spawn failed',{
233
+ command:'agentsam machine',
234
+ reason:['ENOBUFS','ERR_CHILD_PROCESS_STDIO_MAXBUFFER'].includes(result.error.code) ? 'process_output_limit' : 'process_spawn_failed',
235
+ cause:result.error,hints:{example:'agentsam machine install'},
236
+ });
237
+ if (result.status !== 0) throw processError(String(result.stderr || `Machine inspection failed: ${abs}`).trim());
238
+ let inspection;
239
+ try { inspection = JSON.parse(String(result.stdout)); }
240
+ catch (cause) { throw processError('Machine inspection output is not JSON',{command:'agentsam machine',reason:'upstream_invalid_response',cause}); }
241
+ return createRepositoryCrawl(inspection, { root: abs });
242
+ });
243
+ const output = args.subcommand === 'mine' ? findRefineryCandidates(graphs, { limit: args.limit }) : graphs[0];
244
+ if (args.json) console.log(JSON.stringify(output));
245
+ else if (args.subcommand === 'crawl') console.log(`repository.crawl ${output.repository}: ${output.counts.files} files, ${output.counts.resources} resources, ${output.counts.edges} edges, ${output.errors.length} errors`);
246
+ else {
247
+ console.log(`repository.mine ${output.counts.compared_repositories} repositories: ${output.counts.candidate_pairs} candidate pairs`);
248
+ for (const item of output.candidates) console.log(` ${item.match.type} ${item.implementations.map(x=>x.repository + '/' + x.path).join(' <> ')} | owner: ${item.likely_owner?.package || 'unresolved'}`);
249
+ }
250
+ return 0;
251
+ }
252
+
204
253
  if (args.subcommand === 'inspect') {
205
254
  const resolution = resolveMachineBinary();
206
255
  const target = args.target || process.cwd();
207
256
  const abs = path.resolve(target);
257
+ if (!fs.existsSync(abs)) throw usageError('Machine target not found: '+abs,{command:'agentsam machine',reason:'target_not_found'});
208
258
  const machineArgv = ['inspect', abs];
209
259
  if (args.runId) machineArgv.push('--run-id', args.runId);
210
260
  if (args.includeGenerated) machineArgv.push('--include-generated');
@@ -215,27 +265,28 @@ export async function runMachine(argv = []) {
215
265
  maxBuffer: 32 * 1024 * 1024,
216
266
  });
217
267
 
218
- if (result.error) throw result.error;
268
+ if (result.error) throw processError(result.error.message || 'Machine process spawn failed',{
269
+ command:'agentsam machine',
270
+ reason:['ENOBUFS','ERR_CHILD_PROCESS_STDIO_MAXBUFFER'].includes(result.error.code) ? 'process_output_limit' : 'process_spawn_failed',
271
+ cause:result.error,hints:{example:'agentsam machine install'},
272
+ });
219
273
  if (args.json) {
220
274
  const stdout = String(result.stdout || '');
221
275
  const stderr = String(result.stderr || '');
222
276
  if (result.status && result.status !== 0) {
223
- const err = new Error(stderr.trim() || 'agentsam-machine exited with code ' + result.status);
224
- err.exitCode = result.status;
277
+ const err = processError(stderr.trim() || 'agentsam-machine exited with code ' + result.status,{command:'agentsam machine',reason:'execution_failed',nativeExitCode:result.status,stderr_tail:stderr.slice(-500)});
278
+ err.exitCode = 1;
225
279
  throw err;
226
280
  }
227
- try {
228
- console.log(JSON.stringify(JSON.parse(stdout)));
229
- } catch {
230
- process.stdout.write(stdout);
231
- }
281
+ try { console.log(JSON.stringify(JSON.parse(stdout))); }
282
+ catch (cause) { throw processError('Machine inspection output is not JSON',{command:'agentsam machine',reason:'upstream_invalid_response',cause}); }
232
283
  if (stderr.trim()) process.stderr.write(stderr);
233
284
  }
234
- return result.status ?? 0;
285
+ return result.status ? 1 : 0;
235
286
  }
236
287
 
237
288
  console.log(usage());
238
- const err = new Error('Unknown machine subcommand: ' + args.subcommand);
239
- err.exitCode = 1;
289
+ const err = usageError('Unknown machine subcommand: ' + args.subcommand,{command:'agentsam machine'});
290
+ err.exitCode = 2;
240
291
  throw err;
241
292
  }
@@ -17,9 +17,36 @@ import {
17
17
  syncServerToClient,
18
18
  writeMcpServer,
19
19
  } from '../mcp/index.js';
20
+ import { authenticateViaBrowser } from '../lib/auth.js';
21
+ import {
22
+ IAM_MCP_RESOURCE, IAM_MCP_SCOPE, IAM_MCP_WRITE_SCOPE, IAM_MCP_SERVER, describeMcpServer, resolveMcpResourceServer, McpResourceError,
23
+ } from '../mcp/oauth-connection.js';
20
24
  import { createMcpServerProject } from '../lib/scaffold/mcp-server.js';
21
25
  import { listMcpServerPresets } from '../lib/scaffold/templates/mcp-server/presets.js';
22
26
 
27
+ async function probeMcpServer(server, name, options) {
28
+ if (name !== IAM_MCP_SERVER) return { server, error: null };
29
+ try {
30
+ return { server: await (options.resolveMcpServerImpl || resolveMcpResourceServer)({
31
+ home: options.home,
32
+ }), error: null };
33
+ } catch (error) {
34
+ return { server: null, error: error.code || 'mcp_resource_authority_unavailable',
35
+ next: error.next || 'agentsam mcp connect inneranimalmedia' };
36
+ }
37
+ }
38
+
39
+ function publicMcpServer(server) {
40
+ if (!server) return null;
41
+ const { auth, ...safe } = server;
42
+ return { ...safe, auth: {
43
+ type: auth?.type || null,
44
+ configured: Boolean(auth?.token),
45
+ refreshable: Boolean(auth?.refresh_token),
46
+ expires_at: auth?.expires_at || null,
47
+ } };
48
+ }
49
+
23
50
  function clean(value) {
24
51
  return value == null ? '' : String(value).trim();
25
52
  }
@@ -45,6 +72,7 @@ export function parseMcpArgs(argv = []) {
45
72
  let audience = '';
46
73
  let displayName = '';
47
74
  let authMode = '';
75
+ let writeAccess = false;
48
76
  let force = false;
49
77
 
50
78
  for (let i = 1; i < argv.length; i += 1) {
@@ -60,6 +88,7 @@ export function parseMcpArgs(argv = []) {
60
88
  else if (arg === '--display-name') displayName = argv[++i] || '';
61
89
  else if (arg === '--public') authMode = 'public';
62
90
  else if (arg === '--oauth') authMode = 'oauth';
91
+ else if (arg === '--write') writeAccess = true;
63
92
  else if (arg === '--force') force = true;
64
93
  else if (arg === '--json') json = true;
65
94
  else if (arg === '--catalog' || arg === '--all') catalog = true;
@@ -80,6 +109,7 @@ export function parseMcpArgs(argv = []) {
80
109
  audience,
81
110
  displayName,
82
111
  authMode,
112
+ writeAccess,
83
113
  force,
84
114
  json,
85
115
  catalog,
@@ -118,6 +148,7 @@ function renderHelp(options = {}) {
118
148
  Usage:
119
149
  agentsam mcp create <name> [--preset <preset>] [--output <dir>] [--issuer <url>] [--audience <url>] [--oauth|--public] [--force]
120
150
  agentsam mcp add <name> [--client <client>|all] [--url <url>] [--token <token>]
151
+ agentsam mcp connect inneranimalmedia [--write] Authorize resource-scoped MCP via existing IAM PKCE
121
152
  agentsam mcp list [--catalog|--bundles] [--json]
122
153
  agentsam mcp status [<name>] [--json]
123
154
  agentsam mcp doctor [<name>] [--json]
@@ -184,6 +215,59 @@ export async function runMcp(argv = [], options = {}) {
184
215
  return result;
185
216
  }
186
217
 
218
+ if (subcommand === 'connect') {
219
+ const name = target || IAM_MCP_SERVER;
220
+ if (name !== IAM_MCP_SERVER) throw new McpResourceError('mcp_oauth_connection_unsupported:' + name);
221
+ // This is user-consented, resource-scoped OAuth. Do not reuse the CLI
222
+ // account token: its scope/audience may be invalid for the MCP worker.
223
+ const login = options.authenticateImpl || authenticateViaBrowser;
224
+ const grant = await login({
225
+ home: options.home, env: options.env || process.env,
226
+ input: options.input, output: options.output,
227
+ scope: args.writeAccess ? IAM_MCP_WRITE_SCOPE : IAM_MCP_SCOPE,
228
+ resource: IAM_MCP_RESOURCE,
229
+ saveSession: false,
230
+ });
231
+ const grantedScopes = clean(grant?.scope).split(/\s+/);
232
+ if (!clean(grant?.access_token) || !grantedScopes.includes('mcp:tools')) {
233
+ throw new McpResourceError('mcp_oauth_scope_not_granted');
234
+ }
235
+ if (args.writeAccess && !grantedScopes.includes('iam:agent')) {
236
+ throw new McpResourceError('mcp_oauth_agent_scope_not_granted');
237
+ }
238
+ if (grant.audience && grant.audience !== IAM_MCP_RESOURCE) {
239
+ throw new McpResourceError('mcp_oauth_wrong_audience');
240
+ }
241
+ const lifetime = Number(grant.expires_in);
242
+ const expiresAt = Number.isFinite(lifetime) && lifetime > 0
243
+ ? new Date(Date.now() + lifetime * 1000).toISOString() : null;
244
+ const existing = readMcpServer(name, options);
245
+ const record = writeMcpServer(name, {
246
+ name,
247
+ url: IAM_MCP_RESOURCE,
248
+ protocol: 'streamable_http',
249
+ clients: existing?.clients?.length ? existing.clients : ['agentsam'],
250
+ metadata: { ...(existing?.metadata || {}), provider: 'inneranimalmedia', resource_scoped_oauth: true },
251
+ auth: {
252
+ type: 'oauth',
253
+ token: grant.access_token,
254
+ refresh_token: grant.refresh_token || null,
255
+ client_id: grant.client_id,
256
+ scope: grant.scope,
257
+ resource: IAM_MCP_RESOURCE,
258
+ expires_at: expiresAt,
259
+ },
260
+ }, options);
261
+ const status = describeMcpServer(record);
262
+ if (args.json) write(JSON.stringify({ ok: true, connection: status }, null, 2) + '\n');
263
+ else {
264
+ write(' InnerAnimalMedia MCP OAuth connection saved.\n');
265
+ write(' Resource: ' + IAM_MCP_RESOURCE + '\n');
266
+ write(' Next: agentsam mcp doctor inneranimalmedia --json\n');
267
+ }
268
+ return { ok: true, connection: status };
269
+ }
270
+
187
271
  if (subcommand === 'list') {
188
272
  if (args.bundles) {
189
273
  const bundles = listCloudflareMcpBundles().map((b) => ({
@@ -223,8 +307,8 @@ export async function runMcp(argv = [], options = {}) {
223
307
 
224
308
  const servers = listMcpServers(options);
225
309
  if (args.json) {
226
- write(JSON.stringify({ servers }, null, 2) + '\n');
227
- return servers;
310
+ write(JSON.stringify({ servers: servers.map(publicMcpServer) }, null, 2) + '\n');
311
+ return servers.map(publicMcpServer);
228
312
  }
229
313
  if (servers.length === 0) {
230
314
  write(' No MCP servers configured yet. Add one with: agentsam mcp add inneranimalmedia\n');
@@ -340,7 +424,7 @@ export async function runMcp(argv = [], options = {}) {
340
424
  if (args.json) {
341
425
  const payload = {
342
426
  ok: true,
343
- server: written,
427
+ server: publicMcpServer(written),
344
428
  syncedAdapters,
345
429
  ping,
346
430
  cloudflare_bundle: cfBundle
@@ -374,7 +458,7 @@ export async function runMcp(argv = [], options = {}) {
374
458
  write(` (CF-connected users: ensure agentsam pack includes mcp-portals.*)\n`);
375
459
  }
376
460
  write('\n');
377
- return { ok: true, server: written, syncedAdapters, ping };
461
+ return { ok: true, server: publicMcpServer(written), syncedAdapters, ping };
378
462
  }
379
463
 
380
464
  if (subcommand === 'status') {
@@ -385,11 +469,14 @@ export async function runMcp(argv = [], options = {}) {
385
469
  write(JSON.stringify({ ok: false, error: 'server_not_configured', name }) + '\n');
386
470
  return null;
387
471
  }
388
- write(` MCP server "${name}" is not configured. Run: agentsam mcp add ${name}\n`);
472
+ write(` MCP server "${name}" is not configured. Run: agentsam mcp connect ${name}\n`);
389
473
  return null;
390
474
  }
391
475
 
392
- const ping = await pingMcpServer(server, options);
476
+ const resource = await probeMcpServer(server, name, options);
477
+ const ping = resource.error
478
+ ? { ok:false, error:resource.error, next:resource.next }
479
+ : await pingMcpServer(resource.server, options);
393
480
  const clientStatuses = (server.clients || ['cursor']).map((c) =>
394
481
  inspectClientAdapter(c, name, options),
395
482
  );
@@ -432,11 +519,14 @@ export async function runMcp(argv = [], options = {}) {
432
519
  }
433
520
 
434
521
  const preset = resolveServerPreset(name, options);
435
- const ping = await pingMcpServer(server, options);
522
+ const resource = await probeMcpServer(server, name, options);
523
+ const ping = resource.error
524
+ ? { ok:false, error:resource.error, next:resource.next }
525
+ : await pingMcpServer(resource.server, options);
436
526
  const clientStatuses = (server.clients || ['cursor']).map((c) =>
437
527
  inspectClientAdapter(c, name, options),
438
528
  );
439
- const toolsProbe = ping.ok ? await listMcpTools(server, options) : { count: 0, tools: [] };
529
+ const toolsProbe = ping.ok ? await listMcpTools(resource.server, options) : { count: 0, tools: [] };
440
530
 
441
531
  const detectedClients = detectInstalledClients(options);
442
532
  const cfBundle = getCloudflareMcpBundle(name);
@@ -1,8 +1,11 @@
1
1
  import path from 'node:path';
2
+ import fs from 'node:fs';
3
+ import { createRequire } from 'node:module';
4
+ const requireSqlite = createRequire(import.meta.url);
2
5
  import { randomBytes } from 'node:crypto';
3
6
  import { createLocalSqliteDatabaseSync } from '../local/sqlite.js';
4
7
  import { applyRuntimeMigrationsSync } from '../local/migrations.js';
5
- import { getLocalDatabasePath, readProjectConfig } from '../lib/project-config.js';
8
+ import { getLocalDatabasePath, tryReadProjectConfig } from '../lib/project-config.js';
6
9
  import { tryResolveGitContext } from '../../packages/agentsam-repository/src/git-context.js';
7
10
 
8
11
  function id(prefix) {
@@ -20,18 +23,30 @@ function repositoryIdFor(root, git, config) {
20
23
  || 'local:' + root;
21
24
  }
22
25
 
23
- export function openPlanLedger(cwd = process.cwd()) {
26
+ export function openPlanLedger(cwd = process.cwd(), { readOnly = false } = {}) {
24
27
  const git = tryResolveGitContext({ cwd });
25
28
  const root = git?.root || path.resolve(cwd);
26
- const config = readProjectConfig(root);
29
+ // A repository is not required to adopt AgentSam configuration to use plans.
30
+ const config = tryReadProjectConfig(root);
27
31
  const dbPath = path.resolve(root, getLocalDatabasePath(config));
28
- const db = createLocalSqliteDatabaseSync(dbPath);
29
- applyRuntimeMigrationsSync(db);
30
- db.exec('PRAGMA foreign_keys = ON;');
32
+ // Reads must not create a database or apply migrations as a side effect.
33
+ let db = null;
34
+ if (readOnly) {
35
+ if (fs.existsSync(dbPath)) {
36
+ const { DatabaseSync } = requireSqlite('node:sqlite');
37
+ db = new DatabaseSync(dbPath, { readOnly: true });
38
+ const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('agentsam_plans','agentsam_todo')").all();
39
+ if (tables.length !== 2) { db.close(); db = null; }
40
+ }
41
+ } else {
42
+ db = createLocalSqliteDatabaseSync(dbPath);
43
+ applyRuntimeMigrationsSync(db);
44
+ db.exec('PRAGMA foreign_keys = ON;');
45
+ }
31
46
  return {
32
- db, dbPath, root, git,
47
+ db, dbPath, root, git, readOnly,
33
48
  repositoryId: repositoryIdFor(root, git, config),
34
- close() { db.close(); },
49
+ close() { db?.close(); },
35
50
  };
36
51
  }
37
52
 
@@ -108,6 +123,7 @@ export function createPlan(ctx, input) {
108
123
  }
109
124
 
110
125
  export function listPlans(ctx, { all = false } = {}) {
126
+ if (!ctx.db) return [];
111
127
  const sql =
112
128
  "SELECT * FROM agentsam_plans " +
113
129
  "WHERE json_extract(metadata_json, '$.repository_id') = ? " +
@@ -117,6 +133,7 @@ export function listPlans(ctx, { all = false } = {}) {
117
133
  }
118
134
 
119
135
  export function getCurrentPlan(ctx) {
136
+ if (!ctx.db) return null;
120
137
  const row = ctx.db.prepare(
121
138
  "SELECT p.* FROM agentsam_plans p " +
122
139
  "WHERE json_extract(p.metadata_json, '$.repository_id') = ? " +
@@ -129,10 +146,11 @@ export function getCurrentPlan(ctx) {
129
146
  }
130
147
 
131
148
  export function getPlan(ctx, planId = 'current') {
149
+ if (!ctx.db) return null;
132
150
  const plan = planId === 'current'
133
151
  ? getCurrentPlan(ctx)
134
152
  : hydratePlan(ctx.db.prepare('SELECT * FROM agentsam_plans WHERE id = ? LIMIT 1').get(planId));
135
- if (!plan) return null;
153
+ if (!plan || plan.metadata?.repository_id !== ctx.repositoryId) return null;
136
154
  const tasks = ctx.db.prepare(
137
155
  'SELECT * FROM agentsam_todo WHERE plan_id = ? ORDER BY sort_order ASC, created_at_unix ASC'
138
156
  ).all(plan.id).map(hydrateTask);
@@ -172,7 +190,11 @@ export function addPlanStep(ctx, input) {
172
190
  const PRIORITY_ORDER = Object.freeze({ critical: 0, high: 1, medium: 2, low: 3 });
173
191
 
174
192
  function getTask(ctx, taskId) {
175
- return hydrateTask(ctx.db.prepare('SELECT * FROM agentsam_todo WHERE id = ? LIMIT 1').get(taskId));
193
+ if (!ctx.db) return null;
194
+ const task = hydrateTask(ctx.db.prepare('SELECT * FROM agentsam_todo WHERE id = ? LIMIT 1').get(taskId));
195
+ if (!task) return null;
196
+ // IDs alone do not grant access when a custom shared SQLite store is used.
197
+ return getPlan(ctx, task.plan_id) ? task : null;
176
198
  }
177
199
 
178
200
  function dependencyBlockers(ctx, task) {
@@ -203,7 +225,8 @@ function pendingAcceptance(task) {
203
225
 
204
226
  export function getNextPlanStep(ctx, { planId = 'current', start = false } = {}) {
205
227
  const plan = getPlan(ctx, planId);
206
- if (!plan) throw new Error('plan_not_found');
228
+ if (!plan && !ctx.db) return {plan:null,step:null,selection:'uninitialized',blocked:[],evidence:[],acceptance:[],depends_on:[],recommended_action:null};
229
+ if (!plan) return {plan:null,step:null,selection:'no_active_plan',blocked:[],evidence:[],acceptance:[],depends_on:[],recommended_action:null};
207
230
  const rank = (a, b) => {
208
231
  const priority = (PRIORITY_ORDER[a.priority] ?? 99) - (PRIORITY_ORDER[b.priority] ?? 99);
209
232
  if (priority !== 0) return priority;
@@ -249,7 +272,9 @@ export function getNextPlanStep(ctx, { planId = 'current', start = false } = {})
249
272
  evidence: selected?.metadata?.evidence || [],
250
273
  acceptance: selected?.metadata?.acceptance || [],
251
274
  depends_on: selected?.metadata?.depends_on || [],
252
- recommended_action: selected ? ('agentsam plan ' + (start ? 'show ' : 'start ') + selected.id) : null,
275
+ recommended_action: selected
276
+ ? (start ? 'agentsam plan show ' + plan.id : 'agentsam plan start ' + selected.id)
277
+ : null,
253
278
  };
254
279
  }
255
280
 
@@ -284,6 +309,11 @@ export function acceptPlanStep(ctx, taskId, criterion, { evidenceRef = null } =
284
309
  if (!text) throw new Error('acceptance_criterion_required');
285
310
  const metadata = { ...task.metadata };
286
311
  const entries = Array.isArray(metadata.acceptance) ? [...metadata.acceptance] : [];
312
+ if (!entries.some(entry => (typeof entry === 'string' ? entry : entry?.criterion) === text))
313
+ throw new RangeError('acceptance_criterion_not_declared');
314
+ const evidence = Array.isArray(metadata.evidence) ? metadata.evidence : [];
315
+ if (!evidenceRef || !evidence.some(entry => entry?.ref === evidenceRef))
316
+ throw new RangeError('acceptance_evidence_not_recorded');
287
317
  const now = Math.floor(Date.now() / 1000);
288
318
  let matched = false;
289
319
  metadata.acceptance = entries.map((entry) => {
@@ -298,15 +328,6 @@ export function acceptPlanStep(ctx, taskId, criterion, { evidenceRef = null } =
298
328
  evidence_ref: evidenceRef || (typeof entry === 'object' ? entry.evidence_ref || null : null),
299
329
  };
300
330
  });
301
- if (!matched) {
302
- metadata.acceptance.push({
303
- criterion: text,
304
- required: true,
305
- status: 'accepted',
306
- accepted_at_unix: now,
307
- evidence_ref: evidenceRef || null,
308
- });
309
- }
310
331
  ctx.db.prepare('UPDATE agentsam_todo SET metadata_json = ?, updated_at_unix = unixepoch() WHERE id = ?')
311
332
  .run(JSON.stringify(metadata), taskId);
312
333
  return getTask(ctx, taskId);
@@ -319,6 +340,17 @@ export function addPlanDependency(ctx, taskId, dependencyId) {
319
340
  if (!dependency) throw new Error('dependency_not_found:' + dependencyId);
320
341
  if (task.plan_id !== dependency.plan_id) throw new Error('dependency_cross_plan_not_allowed');
321
342
  if (task.id === dependency.id) throw new Error('dependency_self_reference');
343
+ // An A -> B -> A cycle would leave no executable next step.
344
+ const stack = [dependency.id];
345
+ const seen = new Set();
346
+ while (stack.length) {
347
+ const current = stack.pop();
348
+ if (current === task.id) throw new RangeError('dependency_cycle_not_allowed');
349
+ if (seen.has(current)) continue;
350
+ seen.add(current);
351
+ const node = getTask(ctx, current);
352
+ for (const ref of node?.metadata?.depends_on || []) stack.push(ref);
353
+ }
322
354
  const metadata = { ...task.metadata };
323
355
  const dependsOn = new Set(Array.isArray(metadata.depends_on) ? metadata.depends_on : []);
324
356
  dependsOn.add(dependency.id);
@@ -333,9 +365,11 @@ export function setPlanStepStatus(ctx, taskId, status, { reason = null } = {}) {
333
365
  if (!allowed.has(status)) throw new Error('invalid_step_status:' + status);
334
366
  const task = getTask(ctx, taskId);
335
367
  if (!task) throw new Error('step_not_found:' + taskId);
336
- if (status === 'complete') {
368
+ if (status === 'running' || status === 'complete') {
337
369
  const blockers = dependencyBlockers(ctx, task);
338
370
  if (blockers.length) throw new Error('step_dependencies_incomplete:' + blockers.map((row) => row.id).join(','));
371
+ }
372
+ if (status === 'complete') {
339
373
  const acceptance = pendingAcceptance(task);
340
374
  if (acceptance.length) {
341
375
  const labels = acceptance.map((entry) => typeof entry === 'string' ? entry : entry.criterion).filter(Boolean);
@@ -365,6 +399,10 @@ export function setPlanStatus(ctx, planId, status) {
365
399
  if (!allowed.has(status)) throw new Error('invalid_plan_status:' + status);
366
400
  const plan = getPlan(ctx, planId || 'current');
367
401
  if (!plan) throw new Error('plan_not_found');
402
+ if (status === 'complete') {
403
+ const incomplete = plan.tasks.filter(task => task.status !== 'complete');
404
+ if (incomplete.length) throw new RangeError('plan_steps_incomplete:' + incomplete.map(task => task.id).join(','));
405
+ }
368
406
  ctx.db.prepare('UPDATE agentsam_plans SET status = ?, updated_at_unix = unixepoch() WHERE id = ?').run(status, plan.id);
369
407
  return getPlan(ctx, plan.id);
370
408
  }
@@ -63,8 +63,8 @@ function help() {
63
63
  '',
64
64
  'agentsam plan - durable project-local work plans',
65
65
  '',
66
- ' agentsam plan new "<title>" [--goal "..."] [--type feature|sprint|refactor|incident|daily|run]',
67
- ' agentsam plan list [--all] [--json]',
66
+ ' agentsam plan new "<title>" [--goal "..."] [--type feature|sprint|refactor|incident|daily|run] [--cwd PATH]',
67
+ ' agentsam plan list [--all] [--json] [--cwd PATH]',
68
68
  ' agentsam plan show [current|PLAN_ID] [--json]',
69
69
  ' agentsam plan next [--plan PLAN_ID] [--start] [--json]',
70
70
  ' agentsam plan add "<step>" [--plan PLAN_ID] [--kind inspect|implement|verify|deploy|decision] [--acceptance "..."]',
@@ -92,7 +92,7 @@ export async function runPlan(argv = []) {
92
92
  return runBrand(['plan', ...rest, ...(opts.json ? ['--json'] : []), ...(opts.goap ? ['--goap'] : []), ...(opts.write ? ['--write'] : [])]);
93
93
  }
94
94
 
95
- const ctx = openPlanLedger(process.cwd());
95
+ const ctx = openPlanLedger(opts.cwd || process.cwd(), { readOnly: ['list','show','next'].includes(sub) && !opts.start });
96
96
  try {
97
97
  let result;
98
98
  if (sub === 'new') {
@@ -1,6 +1,13 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- import { AGENTSAM_MCP_PLUGIN_MANIFEST, normalizePluginKey } from '../plugins/index.js';
3
+ import {
4
+ AGENTSAM_MCP_PLUGIN_MANIFEST,
5
+ buildPluginQualityReceipt,
6
+ inspectPluginProduct,
7
+ readPluginEvidenceBundle,
8
+ normalizePluginKey,
9
+ verifyPluginProduct,
10
+ } from '../plugins/index.js';
4
11
  import { authenticateViaBrowser } from '../lib/auth.js';
5
12
  import { promptToOpenUrl } from '../lib/open-url.js';
6
13
  import { readAccountSession, resolveAccountApiKey, saveAccountSession } from '../lib/account-session.js';
@@ -27,13 +34,14 @@ function installMigration(cwd) {
27
34
  function parse(argv) {
28
35
  const out = {
29
36
  action: argv[0] || 'list', key: '', cwd: process.cwd(), json: false,
30
- origin: '',
37
+ origin: '', evidence: '',
31
38
  timeoutMs: 180_000, noOpen: false,
32
39
  };
33
40
  for (let i = 1; i < argv.length; i += 1) {
34
41
  if (argv[i] === '--cwd') out.cwd = argv[++i] || out.cwd;
35
42
  else if (argv[i] === '--json') out.json = true;
36
43
  else if (argv[i] === '--origin') out.origin = argv[++i] || out.origin;
44
+ else if (argv[i] === '--evidence') out.evidence = argv[++i] || out.evidence;
37
45
  else if (argv[i] === '--timeout') out.timeoutMs = Math.max(1_000, Number(argv[++i]) || out.timeoutMs);
38
46
  else if (argv[i] === '--no-open') out.noOpen = true;
39
47
  else if (!out.key) out.key = argv[i];
@@ -143,6 +151,30 @@ async function statusPlugin(opts, key) {
143
151
 
144
152
  export async function runPlugins(argv = []) {
145
153
  const opts = parse(argv);
154
+ if (['inspect','verify','receipt'].includes(opts.action)) {
155
+ const target = path.resolve(opts.cwd, opts.key || '.');
156
+ const evidenceBundle = opts.evidence ? readPluginEvidenceBundle(path.resolve(opts.cwd, opts.evidence)) : null;
157
+ const verification = opts.action === 'inspect' ? null : verifyPluginProduct(target,{evidenceBundle});
158
+ const result = opts.action === 'inspect'
159
+ ? inspectPluginProduct(target,{evidenceBundle})
160
+ : opts.action === 'verify'
161
+ ? verification
162
+ : buildPluginQualityReceipt(target,{verification,evidenceBundle});
163
+ if (opts.json || opts.action === 'receipt') writeJson(result);
164
+ else {
165
+ console.log(`\n Plugin ${result.product?.identity?.id || path.basename(target)}`);
166
+ console.log(` status: ${result.status}`);
167
+ for (const row of result.findings || []) console.log(` ${row.severity.toUpperCase().padEnd(5)} ${row.code}: ${row.message}`);
168
+ if (opts.action === 'verify') {
169
+ for (const [id, check] of Object.entries(result.checks || {})) {
170
+ console.log(` ${String(check.status).padEnd(12)} ${id}`);
171
+ }
172
+ }
173
+ console.log('');
174
+ }
175
+ if (opts.action !== 'inspect' && result.status !== 'READY') process.exitCode = 1;
176
+ return result;
177
+ }
146
178
  if (opts.action === 'list') {
147
179
  const state = readState(opts.cwd);
148
180
  const rows = Object.values(CATALOG).map((manifest) => ({
@@ -145,8 +145,29 @@ export async function runInspect(argv = []) {
145
145
  return output;
146
146
  }
147
147
 
148
+ // Query the same canonical registry used by the agent's capability view.
149
+ import { createRegistry } from '../registry/index.js';
150
+
148
151
  export async function runCapabilities(argv = []) {
149
152
  const opts = parseCommon(argv);
153
+ const registry = createRegistry();
154
+ if (argv.includes('--inventory') || argv.includes('--commands') || argv.includes('--packages') || argv.includes('--search')) {
155
+ const kind = argv.includes('--commands') ? 'command' : argv.includes('--packages') ? 'package' : null;
156
+ const idx = argv.indexOf('--search');
157
+ const query = idx >= 0 ? (argv[idx+1] || '') : '';
158
+ const rows = registry.search(query, { type:kind, limit:500 });
159
+ if (opts.json) console.log(JSON.stringify(rows,null,2));
160
+ else {
161
+ console.log('AgentSam inventory (declared does not imply runnable):');
162
+ for(const row of rows)console.log(' '+row.type.padEnd(11)+' '+row.id.padEnd(32)+' '+(row.summary||row.description||row.purpose||''));
163
+ }
164
+ return rows;
165
+ }
166
+ if (argv.includes('--help')) {
167
+ console.log('agentsam capabilities [capability-id] [--json]');
168
+ console.log('agentsam capabilities --inventory [--commands|--packages] [--search <text>] [--json]');
169
+ return null;
170
+ }
150
171
  const id = opts.positionals[0] || '';
151
172
  const result = id ? getCapability(id) : getCapabilityManifest();
152
173
  if (id && !result) throw new Error(`unknown_capability:${id}`);
@@ -6,10 +6,13 @@ const here = path.dirname(fileURLToPath(import.meta.url));
6
6
  const entry = path.resolve(here, '../../bin/agentsam-rapid-rust');
7
7
 
8
8
  export async function runRust(argv = [], options = {}) {
9
+ // Bare `agentsam rust` is a help request, not a failing operation.
10
+ // clap exits 2 on bare invocation, but `help` exits 0.
11
+ const args = argv.length ? (argv[0] === 'status' ? ['doctor', ...argv.slice(1)] : argv) : ['help'];
9
12
  const node = options.node || process.execPath;
10
13
  const stdio = options.stdio || 'inherit';
11
14
  return await new Promise((resolve, reject) => {
12
- const child = spawn(node, [entry, ...argv], { stdio, env: process.env });
15
+ const child = spawn(node, [entry, ...args], { stdio, env: process.env });
13
16
  child.on('error', reject);
14
17
  child.on('exit', (code, signal) => {
15
18
  if (signal) return reject(new Error(`agentsam rust terminated by ${signal}`));