@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
@@ -0,0 +1,21 @@
1
+ {
2
+ "bytes": 191705,
3
+ "directories": 4,
4
+ "edges_total": 20,
5
+ "excluded_subtrees": 1,
6
+ "facts_total": 31,
7
+ "files": 31,
8
+ "findings_total": 6,
9
+ "ignored_directories": 1,
10
+ "network_used": false,
11
+ "schema": "agentsam.machine.summary.v1",
12
+ "skipped_noise_files": 0,
13
+ "source_mutated": false,
14
+ "source_type_counts": {
15
+ "javascript": 27,
16
+ "json": 2,
17
+ "markdown": 1,
18
+ "unknown": 1
19
+ },
20
+ "symlinks": 0
21
+ }
@@ -16,3 +16,28 @@ The workspace is private while the extraction stabilizes. Cross-repository consu
16
16
 
17
17
  <!-- agentsam:trademark-notice -->
18
18
  > Independent project. Not affiliated with, endorsed by, or sponsored by Cloudflare, Inc. or by any other company whose products are named here. Cloudflare is a registered trademark of Cloudflare, Inc. Other names are trademarks of their respective owners. See [TRADEMARKS](https://github.com/SamPrimeaux/agentsam-sdk/blob/main/TRADEMARKS.md).
19
+
20
+ ## Machine-backed repository crawl and refinery
21
+
22
+ Rust Machine is the sole filesystem scanner. Repository normalizes its existing
23
+ receipts into stable, source-linked resource/edge graphs using the canonical
24
+ TypeScript semantic parser. Knowledge accepts this graph as `repositoryCrawl` in
25
+ `planIndex` and `runIndex`; it verifies hashes and reuses the inventory.
26
+
27
+ agentsam machine crawl /path/to/repository --json
28
+ agentsam machine mine /path/to/repo-a --against /path/to/repo-b --json
29
+
30
+ Crawl detects package manifests, imports, declarations, configured Worker
31
+ bindings, migrations and database tables, and capability declarations.
32
+ Worker bindings are **configuration evidence**, not deployed-resource proof.
33
+ The snapshot hash excludes runtime timestamps and local absolute paths.
34
+
35
+ Mine compares exact file hashes, token-normalized hashes and AST signatures.
36
+ Candidates retain file hashes, paths, likely package owners, and review steps.
37
+ A matching symbol signature is not proof of equivalent behavior. No source
38
+ rewrites, promotions, deletes, LLM calls or extra vector databases occur.
39
+
40
+ The native inspect runtime externalizes reusable evidence under the target's
41
+ `.agentsam/machine/runs/`; Git should ignore this runtime output. Knowledge
42
+ indexing is an explicit API choice, not a background side effect. Hosted
43
+ website crawling and domain-specific CMS promotion remain separate concerns.
@@ -0,0 +1,42 @@
1
+ {
2
+ "avoid_when": [],
3
+ "catalog_status": "needs-review",
4
+ "class": "package",
5
+ "commands": [],
6
+ "evidence": {
7
+ "directory": "packages/agentsam-repository",
8
+ "purpose_source": "package-manifest-description",
9
+ "readme": "packages/agentsam-repository/README.md"
10
+ },
11
+ "execution_domains": [],
12
+ "id": "agentsam-repository",
13
+ "install": [
14
+ {
15
+ "command": "npm install @inneranimalmedia/agentsam-repository",
16
+ "package": "@inneranimalmedia/agentsam-repository",
17
+ "type": "npm"
18
+ }
19
+ ],
20
+ "languages": [
21
+ "javascript"
22
+ ],
23
+ "name": "@inneranimalmedia/agentsam-repository",
24
+ "purpose": "Portable AgentSam repository identity, Merkle, semantic file metadata, persistence, and repository graph runtime contracts.",
25
+ "registry": {
26
+ "kind": "npm",
27
+ "name": "@inneranimalmedia/agentsam-repository",
28
+ "public_claim": true
29
+ },
30
+ "review_required": [
31
+ "avoid_when",
32
+ "execution_domains",
33
+ "status",
34
+ "topics",
35
+ "use_when"
36
+ ],
37
+ "schema": "agentsam.package.v1",
38
+ "status": "unknown",
39
+ "topics": [],
40
+ "use_when": [],
41
+ "version": "2.6.12"
42
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/agentsam-repository",
3
- "version": "2.6.12",
3
+ "version": "2.6.13",
4
4
  "description": "Portable AgentSam repository identity, Merkle, semantic file metadata, persistence, and repository graph runtime contracts.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -10,13 +10,16 @@
10
10
  "./contracts": "./src/contracts.js",
11
11
  "./merkle": "./src/merkle/index.js",
12
12
  "./merkle/persistence": "./src/merkle/persistence.js",
13
- "./merkle/cloudflare-persistence": "./src/merkle/cloudflare-persistence.js"
13
+ "./merkle/cloudflare-persistence": "./src/merkle/cloudflare-persistence.js",
14
+ "./crawl": "./src/crawl.js",
15
+ "./refinery": "./src/refinery.js"
14
16
  },
15
17
  "scripts": {
16
18
  "test": "node --test test/*.test.mjs"
17
19
  },
18
20
  "dependencies": {
19
- "typescript": "5.9.3"
21
+ "typescript": "5.9.3",
22
+ "jsonc-parser": "^3.3.1"
20
23
  },
21
24
  "engines": {
22
25
  "node": ">=22 <25"
@@ -0,0 +1,220 @@
1
+ /** Repository semantic graph from an existing Rust Machine receipt; NEVER walks the filesystem. */
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { parse as parseJsonc } from 'jsonc-parser';
5
+ import { createHash } from 'node:crypto';
6
+ import { analyzeSemanticSource, normalizeSemanticTokens, resolveSemanticLocalImport } from './merkle/semantic.js';
7
+
8
+ export const REPOSITORY_CRAWL_SCHEMA = 'agentsam.repository.crawl.v1';
9
+ const MAX_SOURCE_BYTES = 512 * 1024;
10
+ const sha = (v) => createHash('sha256').update(v).digest('hex');
11
+ const stable = (v) => JSON.stringify(v);
12
+ const normPath = (p) => String(p).replaceAll('\\', '/');
13
+ const unique = (arr) => [...new Set(arr)].sort();
14
+
15
+ /** Load only Machine's bounded receipt or its explicit full artifact; reject swapped artifact roots. */
16
+ export function machineEvidence(receipt, { root = receipt.root } = {}) {
17
+ if (receipt.schema !== 'agentsam.machine.receipt.v1' || receipt.capability !== 'machine.inspect') {
18
+ throw new TypeError('expected the canonical machine.inspect receipt');
19
+ }
20
+ const base = fs.realpathSync(root);
21
+ if (fs.realpathSync(receipt.root) !== base) throw new Error('machine receipt root mismatch');
22
+ let facts = receipt.facts || [];
23
+ let edges = receipt.edges || [];
24
+ const directory = receipt.detail?.artifact_dir;
25
+ if (directory) {
26
+ const expected = path.join(base, '.agentsam', 'machine', 'runs', receipt.run_id);
27
+ if (path.resolve(directory) !== expected || fs.realpathSync(directory) !== expected) throw new Error('untrusted Machine artifact directory');
28
+ facts = JSON.parse(fs.readFileSync(path.join(expected, 'inventory.json'), 'utf8'));
29
+ edges = JSON.parse(fs.readFileSync(path.join(expected, 'graph.json'), 'utf8'));
30
+ } else if (receipt.summary?.facts_total > facts.length || receipt.summary?.edges_total > edges.length) {
31
+ throw new Error('truncated Machine receipt without complete artifacts');
32
+ }
33
+ return { root: base, facts, edges };
34
+ }
35
+
36
+ /** Content reads are limited to exact hashed facts from Machine, never new discovery. */
37
+ function verifiedText(root, fact, errors) {
38
+ if (!fact || fact.fs_kind !== 'file' || fact.size > MAX_SOURCE_BYTES) return null;
39
+ const candidate = path.resolve(root, fact.path);
40
+ if (candidate !== root && !candidate.startsWith(root + path.sep)) throw new Error('Machine fact escapes root');
41
+ try {
42
+ const actual = fs.realpathSync(candidate);
43
+ if (actual !== root && !actual.startsWith(root + path.sep)) throw new Error('Machine source escaped root through symlink');
44
+ const st = fs.lstatSync(candidate);
45
+ if (!st.isFile() || st.isSymbolicLink() || st.size !== fact.size) throw new Error('file changed since Machine scan');
46
+ const bytes = fs.readFileSync(candidate);
47
+ if (sha(bytes) !== fact.sha256) throw new Error('hash mismatch since Machine scan');
48
+ return bytes.toString('utf8');
49
+ } catch (e) {
50
+ errors.push({ path: fact.path, operation: 'verified_read', reason: e.message });
51
+ return null;
52
+ }
53
+ }
54
+
55
+ function kindFor(fact) {
56
+ const name = fact.path.toLowerCase();
57
+ if (/\.(test|spec)\.[cm]?[jt]sx?$/.test(name) || /(^|\/)(__tests__|tests?)\//.test(name)) return 'test';
58
+ if (/(^|\/)migrations?\//.test(name) || name.endsWith('.sql')) return 'migration';
59
+ if (name.endsWith('.schema.json')) return 'schema';
60
+ if (fact.source?.kind === 'asset') return 'asset';
61
+ if (fact.source?.kind === 'code') return 'source_module';
62
+ return 'file';
63
+ }
64
+
65
+ /** Enrich Machine facts with existing Repository AST parsing and manifest semantics. */
66
+ export function createRepositoryCrawl(receipt, options = {}) {
67
+ const { root, facts, edges: machineEdges } = machineEvidence(receipt, options);
68
+ const errors = [...(receipt.errors || []).map(e => ({ path: e.path, operation: e.operation, reason: e.message }))];
69
+ const resources = new Map();
70
+ const edges = new Map();
71
+ const sources = [];
72
+ const add = (r) => { if (!resources.has(r.id)) resources.set(r.id, r); };
73
+ const link = (from, to, type, evidence) => {
74
+ if (!resources.has(from) || !resources.has(to)) return;
75
+ const id = `edge:${sha(stable([from,to,type])).slice(0,24)}`;
76
+ edges.set(id, { id, from, to, type, evidence });
77
+ };
78
+ add({ id: 'repository:.', kind: 'repository', path: '.', provenance: 'machine.inspect' });
79
+ const files = new Map();
80
+ for (const fact of [...facts].sort((a,b)=>a.path.localeCompare(b.path))) {
81
+ if (fact.fs_kind !== 'file' || !fact.path || path.posix.isAbsolute(normPath(fact.path)) || normPath(fact.path).split('/').includes('..')) continue;
82
+ const id = `file:${normPath(fact.path)}`;
83
+ files.set(normPath(fact.path), fact);
84
+ add({ id, kind: kindFor(fact), path: normPath(fact.path), hash: fact.sha256,
85
+ bytes: fact.size, source_type: fact.source?.type ?? null, provenance: `machine:${fact.id}` });
86
+ link('repository:.', id, 'contains', { fact_id: fact.id });
87
+ }
88
+ const fileSet = new Set(files.keys());
89
+ const packageRoots = [];
90
+ for (const [p, fact] of files) {
91
+ if (path.posix.basename(p) !== 'package.json') continue;
92
+ const source = verifiedText(root, fact, errors);
93
+ if (source === null) continue;
94
+ try {
95
+ const pkg = JSON.parse(source);
96
+ if (!pkg.name) continue;
97
+ const pkgId = `package:${p}`;
98
+ add({ id: pkgId, kind: 'package', path: p, name: pkg.name, version: pkg.version || null, provenance: `file:${p}` });
99
+ packageRoots.push({ prefix: path.posix.dirname(p), id: pkgId, name: pkg.name });
100
+ link('repository:.', pkgId, 'contains', { path: p });
101
+ link(pkgId, `file:${p}`, 'configured_by', { path: p });
102
+ for (const [dep, version] of Object.entries({ ...pkg.dependencies, ...pkg.devDependencies })) {
103
+ add({ id: `dependency:${dep}`, kind: 'dependency', name: dep, provenance: `file:${p}` });
104
+ link(pkgId, `dependency:${dep}`, 'depends_on', { manifest: p, version });
105
+ }
106
+ } catch (e) { errors.push({ path:p, operation:'parse_manifest', reason:e.message }); }
107
+ }
108
+ packageRoots.sort((a,b)=>b.prefix.length-a.prefix.length);
109
+ for (const [p, fact] of files) {
110
+ const nearest = packageRoots.find(pkg => pkg.prefix === '.' || p.startsWith(pkg.prefix + '/'));
111
+ if (nearest) link(nearest.id, `file:${p}`, 'contains', { package: nearest.name });
112
+ if (!/\.[cm]?[jt]sx?$/.test(p) || fact.size > MAX_SOURCE_BYTES) continue;
113
+ const content = verifiedText(root, fact, errors);
114
+ if (content === null) continue;
115
+ const ast = analyzeSemanticSource(p, content);
116
+ const normalized_hash = sha(normalizeSemanticTokens(content));
117
+ sources.push({ path: p, hash: fact.sha256, normalized_hash, symbols: ast.symbols,
118
+ imports: ast.imports, package: nearest?.name || null, repository: options.repository || path.basename(root) });
119
+ for (const name of ast.symbols) {
120
+ const sym = `symbol:${p}#${name}`;
121
+ add({ id: sym, kind: 'symbol', name, path:p, provenance:`file:${p}` });
122
+ link(`file:${p}`, sym, 'declares', { parser: 'typescript', source: p, declaration: name });
123
+ }
124
+ for (const specifier of ast.imports) {
125
+ const target = resolveSemanticLocalImport(p, specifier, fileSet);
126
+ if (target) link(`file:${p}`, `file:${target}`, 'imports', { specifier, parser:'typescript' });
127
+ else if (!specifier.startsWith('.')) {
128
+ add({ id:`dependency:${specifier}`,kind:'dependency',name:specifier,provenance:`file:${p}` });
129
+ link(`file:${p}`, `dependency:${specifier}`, 'imports', { specifier, parser:'typescript' });
130
+ }
131
+ }
132
+ }
133
+ // Manifest and SQL facts below were already discovered by Machine. No second traversal.
134
+ for (const [p, fact] of files) {
135
+ if (p === 'protocol/capabilities/manifest.json') {
136
+ const text = verifiedText(root, fact, errors);
137
+ if (text !== null) {
138
+ try {
139
+ const catalog = JSON.parse(text);
140
+ for (const key of Object.keys(catalog.capabilities || {}).sort()) {
141
+ const cap = `capability:${key}`;
142
+ add({ id:cap, kind:'capability', name:key, provenance:`file:${p}`, status:catalog.capabilities[key]?.status || null });
143
+ link(cap, `file:${p}`, 'configured_by', { manifest:p });
144
+ }
145
+ } catch (e) { errors.push({ path:p, operation:'parse_capabilities', reason:e.message }); }
146
+ }
147
+ }
148
+ if (p.endsWith('.sql') && (p.includes('migrations/') || p.includes('migration/'))) {
149
+ const text = verifiedText(root, fact, errors);
150
+ if (text === null) continue;
151
+ for (const match of text.replace(/--[^\r\n]*/g, '').matchAll(/\bCREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["`]?([\w.]+)["`]?/gi)) {
152
+ const table = `database_table:${match[1]}`;
153
+ add({ id:table, kind:'database_table', name:match[1], provenance:`file:${p}` });
154
+ link(`file:${p}`, table, 'defines', { statement:'CREATE TABLE', path:p });
155
+ }
156
+ }
157
+ if (!/(^|\/)wrangler(?:\.[\w.-]+)?\.(toml|jsonc?)$/i.test(p)) continue;
158
+ const configText = verifiedText(root, fact, errors);
159
+ if (configText === null) continue;
160
+ let name = p, configured = [];
161
+ if (p.endsWith('.toml')) {
162
+ let section = '', current = {};
163
+ const finish = () => {
164
+ if (current.binding && section) configured.push({ category:section.split('.').at(-1), binding:current.binding,
165
+ target:current.bucket_name || current.database_name || current.index_name || current.queue || null });
166
+ };
167
+ for (const line of configText.split(/\r?\n/)) {
168
+ const heading = line.match(/^\s*\[\[?([^\]]+)\]\]?\s*(?:#.*)?$/);
169
+ if (heading) { finish(); section=heading[1];current={};continue; }
170
+ const kv = line.match(/^\s*([\w_]+)\s*=\s*["']([^"']+)["']/);
171
+ if (!kv) continue;
172
+ if (!section && kv[1]==='name') name=kv[2];
173
+ if (['binding','bucket_name','database_name','index_name','queue'].includes(kv[1])) current[kv[1]]=kv[2];
174
+ }
175
+ finish();
176
+ } else {
177
+ try {
178
+ // Configuration observation is intentionally limited to binding names, never vars/secrets.
179
+ const diagnostics = [];
180
+ const conf = parseJsonc(configText, diagnostics, { allowTrailingComma:true });
181
+ if (diagnostics.length || !conf || typeof conf !== 'object') throw new Error('invalid wrangler JSONC');
182
+ name = conf.name || p;
183
+ for (const category of ['r2_buckets','d1_databases','vectorize','kv_namespaces']) {
184
+ for (const entry of conf[category] || []) if (entry.binding) configured.push({ category,binding:entry.binding,
185
+ target:entry.bucket_name || entry.database_name || entry.index_name || null });
186
+ }
187
+ } catch (e) { errors.push({ path:p, operation:'parse_wrangler', reason:e.message }); }
188
+ }
189
+ const worker=`worker:${p}`;
190
+ add({id:worker,kind:'worker',name,path:p,provenance:`file:${p}`,evidence_status:'configured_not_deployed'});
191
+ link(worker,`file:${p}`,'configured_by',{config:p});
192
+ for (const conf of configured) {
193
+ const binding=`binding:${p}:${conf.binding}`;
194
+ add({id:binding,kind:'binding',name:conf.binding,category:conf.category,provenance:`file:${p}`});
195
+ link(worker,binding,'binds_to',{config:p,declared:true});
196
+ if (conf.target) {
197
+ const kind = {r2_buckets:'r2_bucket',d1_databases:'d1_database',vectorize:'vectorize_index',kv_namespaces:'kv_namespace'}[conf.category] || 'external_resource';
198
+ const target=`${kind}:${conf.target}`;
199
+ add({id:target,kind,name:conf.target,provenance:`file:${p}`,evidence_status:'configured_not_verified'});
200
+ link(binding,target,'configured_by',{config:p});
201
+ }
202
+ }
203
+ }
204
+ for (const edge of machineEdges) {
205
+ if (edge.type !== 'asset_reference' || !edge.from?.startsWith('file:')) continue;
206
+ const id = String(edge.to || '');
207
+ if (!id.startsWith('asset:')) continue;
208
+ add({ id, kind:'asset_reference', path:id.slice(6), provenance:'machine.inspect' });
209
+ link(edge.from, id, 'references', { machine_edge_id:edge.id, ...edge.evidence });
210
+ }
211
+ const sortedResources = [...resources.values()].sort((a,b)=>a.id.localeCompare(b.id));
212
+ const sortedEdges = [...edges.values()].sort((a,b)=>a.id.localeCompare(b.id));
213
+ const snapshot_hash = sha(stable({ resources: sortedResources, edges: sortedEdges }));
214
+ return { schema:REPOSITORY_CRAWL_SCHEMA, capability:'repository.crawl', schema_version:1,
215
+ repository: options.repository || path.basename(root), machine_run_id: receipt.run_id,
216
+ snapshot_id:`repo_${snapshot_hash.slice(0,24)}`, snapshot_hash:`sha256:${snapshot_hash}`,
217
+ counts:{ files:files.size, resources:sortedResources.length, edges:sortedEdges.length, sources:sources.length },
218
+ resources:sortedResources, edges:sortedEdges, sources:sources.sort((a,b)=>a.path.localeCompare(b.path)),
219
+ errors, provenance:{ collector:'agentsam-machine', parser:'agentsam-repository/merkle/semantic', source_mutated:false } };
220
+ }
@@ -7,3 +7,6 @@ export * from './tickets.js';
7
7
  export * from './workspace-state.js';
8
8
  export * from './goap.js';
9
9
 
10
+
11
+ export * from './crawl.js';
12
+ export * from './refinery.js';
@@ -199,6 +199,26 @@ function astMetadata(relative, source) {
199
199
  };
200
200
  }
201
201
 
202
+ /** Reuse the canonical TypeScript parser on Machine-verified source material. */
203
+ export function analyzeSemanticSource(relative, source) { return astMetadata(relative, source); }
204
+
205
+ /** Fingerprint lexer tokens, excluding comments/whitespace but preserving literal values. */
206
+ export function normalizeSemanticTokens(source) {
207
+ const scanner = ts.createScanner(ts.ScriptTarget.Latest, false, ts.LanguageVariant.Standard, source);
208
+ const tokens = [];
209
+ for (let token = scanner.scan(); token !== ts.SyntaxKind.EndOfFileToken; token = scanner.scan()) {
210
+ if (token !== ts.SyntaxKind.WhitespaceTrivia && token !== ts.SyntaxKind.NewLineTrivia &&
211
+ token !== ts.SyntaxKind.SingleLineCommentTrivia && token !== ts.SyntaxKind.MultiLineCommentTrivia) {
212
+ tokens.push([token, scanner.getTokenText()]);
213
+ }
214
+ }
215
+ return JSON.stringify(tokens);
216
+ }
217
+
218
+ export function resolveSemanticLocalImport(sourcePath, specifier, files) {
219
+ return resolveLocalImport(sourcePath, specifier, files);
220
+ }
221
+
202
222
  function resolveLocalImport(sourcePath, specifier, files) {
203
223
  if (!specifier.startsWith('.')) return null;
204
224
  const base = path.posix.normalize(path.posix.join(path.posix.dirname(sourcePath), specifier));
@@ -0,0 +1,96 @@
1
+ /** Evidence-only reuse proposals. This module neither scans nor modifies source trees. */
2
+ import { createHash } from 'node:crypto';
3
+
4
+ export const REFINERY_SCHEMA = 'agentsam.refinery.proposal.v1';
5
+ const digest = (v) => createHash('sha256').update(JSON.stringify(v)).digest('hex');
6
+ const ratio = (a,b) => { const x=new Set(a),y=new Set(b); const n=[...x].filter(v=>y.has(v)).length; return n / (x.size + y.size - n || 1); };
7
+ function sourceKey(source) { return `${source.repository}:${source.path}`; }
8
+ function compare(a,b) {
9
+ if (a.hash === b.hash) return { type:'exact_hash', score:1 };
10
+ if (a.normalized_hash === b.normalized_hash) return { type:'normalized_hash', score:.98 };
11
+ const sym = ratio(a.symbols, b.symbols);
12
+ const imp = ratio(a.imports, b.imports);
13
+ const nameA = a.path.split('/').pop(), nameB=b.path.split('/').pop();
14
+ if (a.symbols.length >= 2 && b.symbols.length >= 2 && sym >= .66 && (nameA === nameB || imp >= .5)) {
15
+ return { type:'symbol_signature', score: Number((sym*.8+imp*.2).toFixed(3)) };
16
+ }
17
+ return null;
18
+ }
19
+ function canonicalOwner(implementations, graphs) {
20
+ const names = [...new Set(implementations.map(s => s.package).filter(Boolean))];
21
+ const explicit = names.filter(name => name.startsWith('@inneranimalmedia/'));
22
+ if (explicit.length === 1) return { package:explicit[0], confidence:'manifest', evidence:['package.json:name'] };
23
+ if (names.length === 1) return { package:names[0], confidence:'manifest', evidence:['package.json:name'] };
24
+ return null;
25
+ }
26
+
27
+ /** Find cross-repository candidate pairs using indexed deterministic fingerprints. */
28
+ export function findRefineryCandidates(graphs, { limit = 100 } = {}) {
29
+ if (!Array.isArray(graphs) || graphs.length < 2) throw new TypeError('mine requires at least two repository graphs');
30
+ for (const graph of graphs) if (graph.schema !== 'agentsam.repository.crawl.v1') throw new TypeError('expected repository.crawl graphs');
31
+ const all = graphs.flatMap(graph => graph.sources.map(s => ({ ...s, repository:graph.repository, snapshot_id:graph.snapshot_id })));
32
+ const candidates = new Map();
33
+ const buckets = new Map();
34
+ for (const s of all) {
35
+ if (s.path.includes('/__tests__/') || /\.(test|spec)\.[cm]?[jt]sx?$/.test(s.path)) continue;
36
+ const keys = [`hash:${s.hash}`,`normalized:${s.normalized_hash}`];
37
+ const basename=s.path.split('/').pop();
38
+ if (basename !== 'index.js' && basename !== 'index.ts') keys.push(`name:${basename}`);
39
+ for (const symbol of s.symbols) if (symbol.length >= 5) keys.push(`symbol:${symbol}`);
40
+ for (const key of keys) {
41
+ const entries = buckets.get(key) || [];
42
+ entries.push(s);
43
+ buckets.set(key, entries);
44
+ }
45
+ }
46
+ const pairs = new Map();
47
+ for (const entries of buckets.values()) {
48
+ if (entries.length > 100) continue; // common exports are not useful evidence
49
+ for (let i=0;i<entries.length;i++) for (let j=i+1;j<entries.length;j++) {
50
+ const a=entries[i],b=entries[j];
51
+ if (a.repository === b.repository) continue;
52
+ const [first,second] = [a,b].sort((x,y)=>sourceKey(x).localeCompare(sourceKey(y)));
53
+ const key=sourceKey(first)+'|'+sourceKey(second);
54
+ if (!pairs.has(key)) pairs.set(key,[first,second]);
55
+ }
56
+ }
57
+ for (const [key,[a,b]] of [...pairs.entries()].sort(([x],[y])=>x.localeCompare(y))) {
58
+ const match=compare(a,b);
59
+ if (!match || match.score < .7) continue;
60
+ const owner=canonicalOwner([a,b], graphs);
61
+ const implementations=[a,b].map(s => ({repository:s.repository, path:s.path, source_hash:s.hash,
62
+ normalized_hash:s.normalized_hash, snapshot_id:s.snapshot_id, declared_package:s.package,
63
+ symbols:s.symbols, imports:s.imports }));
64
+ const id='cand_'+digest(implementations.map(s=>[s.repository,s.path,s.source_hash])).slice(0,20);
65
+ candidates.set(key,{ candidate_id:id, capability_hint:null, match,
66
+ implementations, likely_owner:owner,
67
+ evidence:[{type:match.type, source_paths:implementations.map(x=>`${x.repository}:${x.path}`)}],
68
+ differences:{ symbols:{first:a.symbols.filter(x=>!b.symbols.includes(x)), second:b.symbols.filter(x=>!a.symbols.includes(x))},
69
+ imports:{first:a.imports.filter(x=>!b.imports.includes(x)), second:b.imports.filter(x=>!a.imports.includes(x))} },
70
+ recommendation: owner ? 'review_for_canonical_reuse' : 'review_ownership_before_promotion',
71
+ promotion:{ approval_required:true, source_mutated:false,
72
+ steps:['compare behavior and licenses','identify missing canonical behavior','add parity tests','obtain approval','migrate verified consumers','run existing package/security/product proof checks'] } });
73
+ }
74
+ const found=[...candidates.values()].sort((a,b)=>b.match.score-a.match.score||a.candidate_id.localeCompare(b.candidate_id));
75
+ return { schema: REFINERY_SCHEMA, capability:'repository.mine', status:'proposals_only',
76
+ sources: graphs.map(g=>({repository:g.repository,snapshot_id:g.snapshot_id,machine_run_id:g.machine_run_id,files:g.counts.files})),
77
+ candidates:found.slice(0,limit), counts:{ compared_repositories:graphs.length, candidate_pairs:found.length, returned:Math.min(limit,found.length) },
78
+ provenance:{ approach:'hash+existing-semantic-ast', model_required:false, source_mutated:false } };
79
+ }
80
+
81
+ /** Aggregate supplied gate references, without trusting or certifying their claims. */
82
+ export function aggregateRefineryQuality(candidate, { approved = false, checks = [] } = {}) {
83
+ if (!candidate?.candidate_id || !Array.isArray(candidate.implementations)) throw new TypeError('expected a refinery candidate');
84
+ if (!Array.isArray(checks)) throw new TypeError('checks must be an array');
85
+ const required = ['package.audit','package.verify','security.scan','consumer.parity','product.proof'];
86
+ const byTool = new Map(checks.map(c => [c.tool,c]));
87
+ const gates = required.map(tool => {
88
+ const check = byTool.get(tool);
89
+ const status = ['passed','failed'].includes(check?.status) && check?.receipt_ref ? check.status : 'missing';
90
+ return { tool, status, receipt_ref: status === 'missing' ? null : check.receipt_ref };
91
+ });
92
+ const status = !approved ? 'awaiting_approval' : gates.some(g=>g.status==='failed') ? 'blocked' :
93
+ gates.every(g=>g.status==='passed') ? 'receipt_review_required' : 'incomplete';
94
+ return { schema:'agentsam.refinery.quality.v1', candidate_id:candidate.candidate_id,
95
+ approved, status, gates, source_mutated:false, authority:'external_gate_receipts_only' };
96
+ }
@@ -0,0 +1,113 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { createHash } from 'node:crypto';
7
+ import { createRepositoryCrawl, machineEvidence } from '../src/crawl.js';
8
+ import { findRefineryCandidates } from '../src/refinery.js';
9
+
10
+ const hash = value => createHash('sha256').update(value).digest('hex');
11
+ const fixture = (files) => {
12
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-crawl-test-'));
13
+ const facts = [];
14
+ for (const [name, content] of Object.entries(files)) {
15
+ const dest = path.join(root, name);
16
+ fs.mkdirSync(path.dirname(dest), { recursive:true });
17
+ fs.writeFileSync(dest, content);
18
+ facts.push({ id:`file:${name}`, fs_kind:'file', path:name, sha256:hash(content), size:Buffer.byteLength(content),
19
+ source:{kind:'code',type:'javascript'}, classification:{generated:false} });
20
+ }
21
+ const receipt = { schema:'agentsam.machine.receipt.v1', capability:'machine.inspect', root,run_id:'run_test',
22
+ facts,edges:[],errors:[],summary:{facts_total:facts.length,edges_total:0} };
23
+ return { root, receipt, close:()=>fs.rmSync(root,{recursive:true,force:true}) };
24
+ };
25
+ const pkg = name => JSON.stringify({name,version:'1.0.0',dependencies:{'@example/util':'^1.0.0'}});
26
+ const implementation = "import { widget } from '@example/util';\nexport function renderWidget(a) { return widget(a); }\nexport function createWidget(b) { return b; }\n";
27
+
28
+ test('Machine receipts normalize to stable Repository graphs, manifest dependencies, symbols and imports', t => {
29
+ const f = fixture({'package.json':pkg('@inneranimalmedia/media-kit'),'src/widget.js':implementation,'src/other.js':"import './widget.js';\n"});
30
+ t.after(f.close);
31
+ const first = createRepositoryCrawl(f.receipt,{repository:'one'});
32
+ const second = createRepositoryCrawl({...f.receipt,facts:[...f.receipt.facts].reverse()},{repository:'one'});
33
+ assert.equal(first.snapshot_hash,second.snapshot_hash);
34
+ assert.equal(first.snapshot_id,second.snapshot_id);
35
+ assert.equal(first.errors.length,0);
36
+ assert.ok(first.resources.some(r=>r.kind==='package'&&r.name==='@inneranimalmedia/media-kit'));
37
+ assert.ok(first.edges.some(e=>e.type==='imports'&&e.from==='file:src/other.js'&&e.to==='file:src/widget.js'));
38
+ assert.ok(first.edges.some(e=>e.type==='depends_on'&&e.to==='dependency:@example/util'));
39
+ assert.ok(first.edges.some(e=>e.type==='declares'&&e.to==='symbol:src/widget.js#renderWidget'));
40
+ assert.ok(first.sources.some(s=>s.path==='src/widget.js'&&s.symbols.includes('createWidget')));
41
+ assert.deepEqual(first.resources,[...first.resources].sort((a,b)=>a.id.localeCompare(b.id)));
42
+ });
43
+
44
+ test('miner finds exact reuse in independent repos with provenance and manifest-based owner', t => {
45
+ const a=fixture({'package.json':pkg('@inneranimalmedia/media-kit'),'src/image.js':implementation});
46
+ const b=fixture({'package.json':pkg('customer-store'),'lib/image.js':implementation});
47
+ t.after(()=>{a.close();b.close();});
48
+ const graphs=[createRepositoryCrawl(a.receipt,{repository:'sdk'}), createRepositoryCrawl(b.receipt,{repository:'customer'})];
49
+ const mined=findRefineryCandidates(graphs);
50
+ assert.equal(mined.counts.candidate_pairs,1);
51
+ const [candidate]=mined.candidates;
52
+ assert.equal(candidate.match.type,'exact_hash');
53
+ assert.equal(candidate.likely_owner.package,'@inneranimalmedia/media-kit');
54
+ assert.equal(candidate.promotion.approval_required,true);
55
+ assert.equal(candidate.promotion.source_mutated,false);
56
+ assert.equal(candidate.implementations[0].source_hash,hash(implementation));
57
+ assert.equal(fs.readFileSync(path.join(a.root,'src/image.js'),'utf8'),implementation);
58
+ });
59
+
60
+ test('token normalized matches tolerate trivia but not changed string literals', t => {
61
+ const a=fixture({'src/example.js':implementation});
62
+ const b=fixture({'src/example.js':implementation.replace('return widget(a);','return /* same */ widget(a);')});
63
+ const c=fixture({'src/example.js':implementation.replace("'@example/util'","'@other/util'")});
64
+ t.after(()=>{a.close();b.close();c.close();});
65
+ const ga=createRepositoryCrawl(a.receipt,{repository:'A'});
66
+ const gb=createRepositoryCrawl(b.receipt,{repository:'B'});
67
+ const gc=createRepositoryCrawl(c.receipt,{repository:'C'});
68
+ assert.equal(findRefineryCandidates([ga,gb]).candidates[0].match.type,'normalized_hash');
69
+ assert.notEqual(ga.sources[0].normalized_hash,gc.sources[0].normalized_hash);
70
+ });
71
+
72
+ test('miner rejects unrelated exports and protects safety boundaries', t => {
73
+ const a=fixture({'src/a.js':'export function a() { return 1 }'});
74
+ const b=fixture({'src/b.js':'export function b() { return 2 }'});
75
+ t.after(()=>{a.close();b.close();});
76
+ assert.equal(findRefineryCandidates([createRepositoryCrawl(a.receipt,{repository:'A'}),createRepositoryCrawl(b.receipt,{repository:'B'})]).counts.candidate_pairs,0);
77
+ assert.throws(()=>machineEvidence({...a.receipt,root:b.root},{root:a.root}),/root mismatch/);
78
+ a.receipt.facts[0].sha256='0'.repeat(64);
79
+ const g=createRepositoryCrawl(a.receipt);
80
+ assert.equal(g.sources.length,0);
81
+ assert.ok(g.errors.some(e=>e.reason.includes('hash mismatch')));
82
+ });
83
+
84
+ test('Wrangler JSONC and migration/capability manifests produce config-only, source-linked evidence', t => {
85
+ const sample = fixture({
86
+ 'wrangler.jsonc':'{ // worker config\n "name":"sample-worker", "r2_buckets":[{"binding":"ASSETS","bucket_name":"site-assets",}],\n "vars":{"PRIVATE_TOKEN":"never-include-secret"}, }',
87
+ 'db/migrations/0001_init.sql':'-- CREATE TABLE fake;\nCREATE TABLE IF NOT EXISTS real_orders (id TEXT);',
88
+ 'protocol/capabilities/manifest.json':JSON.stringify({capabilities:{'site.scrape':{status:'stable'}}}),
89
+ });
90
+ t.after(sample.close);
91
+ const g = createRepositoryCrawl(sample.receipt,{repository:'sample'});
92
+ assert.equal(g.errors.length,0);
93
+ assert.ok(g.resources.some(r=>r.kind==='worker' && r.name==='sample-worker' && r.evidence_status==='configured_not_deployed'));
94
+ assert.ok(g.resources.some(r=>r.kind==='r2_bucket' && r.name==='site-assets' && r.evidence_status==='configured_not_verified'));
95
+ assert.ok(g.edges.some(e=>e.type==='binds_to' && e.to==='binding:wrangler.jsonc:ASSETS'));
96
+ assert.ok(g.edges.some(e=>e.type==='defines' && e.to==='database_table:real_orders'));
97
+ assert.ok(g.resources.some(r=>r.id==='capability:site.scrape'));
98
+ assert.ok(!JSON.stringify(g).includes('never-include-secret'));
99
+ assert.ok(!g.resources.some(r=>r.id==='database_table:fake'));
100
+ });
101
+
102
+ test('quality aggregator uses existing receipt evidence and never invents a pass', async () => {
103
+ const { aggregateRefineryQuality } = await import('../src/refinery.js');
104
+ const candidate = {candidate_id:'cand_test',implementations:[{repository:'A',path:'src/a.js'}]};
105
+ assert.equal(aggregateRefineryQuality(candidate).status,'awaiting_approval');
106
+ assert.equal(aggregateRefineryQuality(candidate,{approved:true}).status,'incomplete');
107
+ const checks=['package.audit','package.verify','security.scan','consumer.parity','product.proof'].map(tool=>({tool,status:'passed',receipt_ref:`receipt:${tool}`}));
108
+ const result=aggregateRefineryQuality(candidate,{approved:true,checks});
109
+ assert.equal(result.status,'receipt_review_required');
110
+ assert.equal(result.source_mutated,false);
111
+ assert.equal(aggregateRefineryQuality(candidate,{approved:true,checks:[...checks.slice(0,1),{...checks[1],status:'failed'},...checks.slice(2)]}).status,'blocked');
112
+ assert.equal(aggregateRefineryQuality(candidate,{approved:true,checks:[{tool:'package.audit',status:'passed'}]}).status,'incomplete');
113
+ });