@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,134 @@
1
+ # Agent handoff: land Superbash, make AgentSam models capable, make runs observable
2
+
3
+ Branch: `feat/sam-superbash-local-runtime-20261015` (worktree `~/agent-worktrees/sam-superbash-local-runtime-20261015`). Finish in place on this branch. Do not open new branches for this work. Prune the branch and worktree once merged.
4
+
5
+ ## Goal
6
+
7
+ When Sam boots `agentsam` in a project and picks a model, that model must be MORE capable than in a plain chat, because it has his machine, his repo and the SAM tools (`sam.superbash`, `sam.script.save/get`, repository, media, etc.). Today the opposite happens: the same model that is excellent in Claude chat behaves poorly inside AgentSam. Fix the cause, prove it with measurements, and leave a loop that keeps improving it without Sam hand-testing external agents.
8
+
9
+ Standing rules (from Sam, apply to every change):
10
+ - SDK-first. Portable behavior lives in `agentsam-sdk`. IAM and MCP stay thin hosts. Do not grow parallel execution engines elsewhere.
11
+ - Anything shipped must work for a random installer: no hidden env vars, no Sam-specific ids/emails/paths, config in one clean source (the app manifest), no half-baked setup. Fix portability leaks in the same pass.
12
+ - No `.bak` copies; git is the backup. Prefer TypeScript for new code. No new tables or lookup tables; reuse existing ones.
13
+ - AgentSam capabilities only act when the user asks in that turn (no unprovoked autonomy).
14
+ - Naming: where inneranimalmedia provides identity/OAuth, spell it `inneranimalmedia` (never `iam`).
15
+
16
+ ## State of the Superbash branch (audited 2026-10-14)
17
+
18
+ DONE and tested (29 of 29 pass: `node --test test/integration/sam-superbash-local.integration.test.mjs test/integration/sam-shell-runtime.test.mjs src/sam/operation-packs/generated-v2/test/*.test.mjs`):
19
+ - `src/sam/adapters/local-script-runtime.js`: Bash `-e -o pipefail`, no rc files, restricted env (no API keys), cwd verified against project root incl. symlinks, 120s default / 300s max timeout, 256 KiB output (1 MiB max), 2 concurrent runs per host process, structured failures only.
20
+ - `src/sam/adapters/local-script-store.js`: immutable versioned scripts in `~/.agentsam/scripts/account/actor/installation/scriptId`, mode 0600, compare-and-swap, SHA-256 integrity.
21
+ - Operations `sam.superbash`, `sam.script.save`, `sam.script.get` registered through `createShellSamAdapter`; exposed only with a trusted identity and Bash on PATH. Approvals are per script + working directory. Subpath export `@inneranimalmedia/agentsam-sdk/sam/local-execution`. Doc: `docs/engineering/SUPERBASH_LOCAL_RUNTIME.md`.
22
+ - Branch is based on current `main`, merges cleanly.
23
+
24
+ KNOWN GAPS (documented in the doc): no cross-process concurrency queue; `idempotencyKey` is a hint only; Bash is not a sandbox (real isolation needs a separately consented executor); Local Studio / desktop does not dispatch these tools yet (`git grep sam.superbash -- apps packages` returns nothing).
25
+
26
+ GIT STATE TO FIX FIRST: local `e1ebf0e0` and `origin/feat/sam-superbash-local-runtime-20261015` (`46a907f0`) are two commits with identical content and the same parent. Run `git reset --hard origin/feat/sam-superbash-local-runtime-20261015` in the worktree (no force-push). Then commit this file.
27
+
28
+ ## Why models feel "dumb" in AgentSam: evidence from the code (hypotheses until measured)
29
+
30
+ All paths below are in this repo.
31
+
32
+ 1. Tool visibility (strongest suspect). `src/agent/responses-runner.js` `buildAgentToolSurface()` calls `searchToolCards(catalog, objective, { maxItems: options.maxTools ?? 8 })` then `hydrateToolSchemas(..., { maxTools: 8 })`. The model only sees up to 8 tools, chosen by a keyword scorer (`src/tools/search.js`) run against the user's objective text. There is no model-callable tool-discovery tool (grep for `tool_search|search_tools|discover_tools` finds none). A task like "fix the failing build" may never score `sam.superbash` into the top 8, so the model cannot use a capability that exists. `resolveCapabilityFallback()` only rescues tools the model already named.
33
+ 2. Thin instructions. When `options.instructions == null`, the system text is project card + resolved context + `.agentsamrules` (`compileAgentInstructions` in `src/lib/agent-instructions.js` reads only the runtime contract and `.agentsamrules`). There is no capability playbook: nothing tells the model how to plan, when to use shell vs repository tools, how to verify, or how to read tool failures. If a project has no rules file the model gets almost no behavioral guidance.
34
+ 3. Anthropic adapter defaults (`src/providers/anthropic-messages.js`): `max_tokens` falls back to 8192, no extended thinking or effort parameter, `cache_control` only on the system block (not tools or rolling messages). The runner is Responses-shaped, so Anthropic runs through a translation layer; verify tool_use/tool_result round-tripping, streaming and error surfacing there.
35
+ 4. Intent gate (`src/agent/intent.js`): `isStandaloneKnowledgeQuestion` strips tools and project context for short general questions. Reasonable, but check false positives.
36
+ 5. Run budget is fine: shell uses `runMode: 'agent'` (128 rounds, see `RUN_MODE_BUDGETS`). No-progress limit is 4.
37
+
38
+ Do not assume these are the causes. Measure first (workstream C1).
39
+
40
+ ## Workstreams, in order
41
+
42
+ ### A. Land Superbash
43
+ 1. Reset worktree to origin (see above), commit this handoff, push.
44
+ 2. Open the PR: `https://github.com/SamPrimeaux/agentsam-sdk/pull/new/feat/sam-superbash-local-runtime-20261015`. Run the full test suite and `npm run release:train:check` if the package version needs aligning. Merge, then prune branch and worktree.
45
+
46
+ ### B. Make the tools actually usable in the products
47
+ 1. Local Studio: bind `sam.script.save/get` and `sam.superbash` to the in-app AgentSam dispatcher through agentsamd (the existing terminal is agentsamd-backed). Reuse `createShellSamAdapter` / `src/sam/local-execution.js`; do not write a second runner in `apps/`. Approval UI must show the exact script and cwd. Web (no local host) must show the tools as unavailable, never fall back to a remote runner.
48
+ 2. Add a host conformance test that the CLI and Local Studio expose the same operation set for the same identity.
49
+ 3. Optional hardening if time remains: cross-process concurrency limit; do NOT claim exactly-once for `idempotencyKey`.
50
+
51
+ ### C. Model capability and observability (the main objective)
52
+ C1. Baseline (do before changing anything). Build a fixed suite of 10 to 15 realistic tasks (fix a failing test, refactor a module, find and explain a bug, write a script and run it, multi-file edit with verification, repo question, etc.) in a throwaway fixture repo. Run each through `agentsam` with Sonnet 5.5 and one OpenAI-class model. Record per run from existing telemetry: `toolSurface.receipt` (`catalog_tools`, `hydrated_tools`, `deferred_tools`), tools offered vs tools called, rounds, no-progress stops, tokens and cost (`calculateModelCost`), final outcome (pass/fail by test). Use `src/eval/` (`live.js`, `context.js`), `src/telemetry/`, `src/receipts/`; extend rather than add a new framework. Output: a baseline table committed under `docs/eval/`.
53
+ C2. Fixes, one at a time, each judged against the baseline (revert if no gain):
54
+ a. Tool surface: always include a small core set (read/search/edit/shell/git/`sam.superbash`/repository); raise the cap per model context window; add a model-callable `agentsam.tools.search` that hydrates additional tools on demand; keep deferred tools visible by name in the system text.
55
+ b. A provider-aware default agent playbook in the system prompt (plan, use the right tool, verify with tests, read structured tool errors, ask only when blocked). Keep it short and versioned; honor `.agentsamrules` after it.
56
+ c. Anthropic adapter: sane `max_tokens` for agent work, extended thinking/effort wired to run mode, `cache_control` on tools and conversation prefix, streaming, faithful tool error passthrough. Check the same for the other providers.
57
+ d. Review `buildProjectCard` / context budget so the card is useful, not noisy.
58
+ C3. Observability and learning loop:
59
+ - One standard run record per run (task, model, provider, tool surface receipt, tool calls with outcomes, failures, rounds, tokens/cost, verified outcome). Sink through the existing receipts sinks; local-first, host-agnostic, no required cloud account.
60
+ - `agentsam eval` runs the suite and fails on regression versus the stored baseline; wire it into CI as an opt-in job.
61
+ - A report that ranks: tools offered but never called, tools called but failing, tasks that stall, cost per success. Turn findings into concrete suggestions (tool card text, playbook edits, surface rules) that Sam approves. The system suggests; it never edits itself unprompted.
62
+
63
+ ## Definition of done
64
+ - Superbash merged and published through the normal release train; available in CLI and Local Studio with approvals and receipts; documented gaps unchanged or reduced.
65
+ - Baseline and post-change eval tables exist; on the suite the primary models complete at least as many tasks as before with fewer rounds and fewer tool-not-visible failures; `sam.superbash` appears in the offered surface for every task that needs a script.
66
+ - Run records are produced for every run and `agentsam eval` guards regressions.
67
+ - No new parallel execution engine added under `inneranimalmedia`/IAM/MCP apps.
68
+
69
+ ## Context to read first
70
+ `docs/engineering/SUPERBASH_LOCAL_RUNTIME.md`, `src/agent/responses-runner.js`, `src/agent/capability-adapter.js`, `src/tools/search.js`, `src/lib/agent-instructions.js`, `src/providers/anthropic-messages.js`, `src/sam/shell-host.js`, `src/telemetry/`, `src/receipts/`, `src/eval/`.
71
+
72
+ ## ADDENDUM (2026-10-15): make the tools reliably ready and pleasant to use
73
+
74
+ Sam's report: when the tools work they are excellent, but the CLI feels clunky and he cannot count on the tools being available in whatever repo he opens. Finishing the capability work is not enough. The product must (1) be installed and current, (2) tell him exactly what is ready the moment it boots, and (3) fail loudly and helpfully instead of silently degrading. Build on what already exists: `src/cli.js` already has `doctor`, `status`, `setup`, `update`, `whoami`, plus `agentsam sam status --json`, `runtime-status`, `mini`, and `interactive`. Extend these; do not add a parallel command family.
75
+
76
+ ### D. Readiness: one truth about "can I use it here, now?"
77
+ 1. `agentsam doctor` is the single readiness check. It must report, for the current directory: git repo root found (also from a nested folder); `.agentsam/config.json` and `.agentsamrules` found or sensibly defaulted; identity/session valid and expiry; selected model and provider reachable; the full list of SAM capabilities with state `ready`, `unavailable (reason)` or `needs approval`, including `sam.superbash` and the script tools (Bash on PATH, trusted identity); local runtime health (agentsamd, SQLite, terminal); installed SDK version versus latest published; and any host skew (CLI, Local Studio, MCP, IAM on different SDK versions). Exit nonzero with a clear fix command for each failure. Support `--json` for CI and for the app.
78
+ 2. On every interactive boot print a compact readiness banner (3 to 6 lines): repo, model, tools ready N of M, anything unavailable with the one-line reason, version skew warning. No scrolling walls of text. A degraded state must never be silent: if a tool the user expects is unbound, say so at boot and when the model tries to use it.
79
+ 3. Every unavailable capability returns a structured error with a code, the reason, and the exact remedy (log in, install Bash, start agentsamd, update package). The model sees the same error text, so it can explain it instead of guessing.
80
+
81
+ ### E. Fresh-install and any-repo certification (the "regardless of repo" guarantee)
82
+ 1. Add a fresh-install smoke test that runs in CI and locally via `npm run smoke:fresh`: pack the SDK tarball, install it into a brand new temp directory with a clean HOME, `git init` a throwaway repo (plus a nested subfolder), run `agentsam setup`, `agentsam doctor --json`, `repository.snapshot`, `sam.script.save` + `sam.superbash` (with an approved test identity), and confirm receipts are produced. It must pass with no env vars, no Cloudflare, no IAM, no network beyond the model call (stub the model).
83
+ 2. Run the same capability contract suite against four targets: `agentsam-sdk`, `inneranimalmedia`, `inneranimalmedia-cms`, and the fresh repo, through CLI, MCP and Local Studio. Same capability ids, schemas, failure codes, receipts. A new capability is not "done" until it is in this suite.
84
+ 3. Version alignment gate: `doctor` and CI fail when consumers pin different SDK versions. The previous agent reported IAM locked at 2.4.1 while the SDK manifest is 2.6.12 and `docs/RELEASES.md` last records 2.6.0. Verify these facts against npm (`npm view @inneranimalmedia/agentsam-sdk dist-tags`) and the lockfiles before acting; do not trust this note.
85
+
86
+ ### F. Release path (do not publish from a dirty tree)
87
+ Work lands in this order, each through its own PR into `main`: Superbash branch (this one), then the Work workspace branch (`feat/work-workspace-crud-20261014`), then Repo Intelligence consolidation into `packages/agentsam-repository` and the root `/repository` exports (no new "v2" package). Only then cut a release from a clean `main`: `npm run release:train:check`, `npm run verify:release`, `npm run release:publish:preflight`, publish, tag. Afterwards upgrade IAM's SDK dependency and lockfile, remove its duplicated algorithms, deploy IAM and the MCP Worker if they changed, and rebuild Local Studio desktop only if bundled frontend, SDK code or the native bridge changed. Record the exact versions shipped per host in `docs/RELEASES.md`.
88
+ Rules: IAM owns Cloudflare bindings, account authorization, persisted records. MCP is a thin transport. Portable behavior lives in the SDK. Preserve the already-working Repo Intelligence behavior and move it, do not rewrite it.
89
+
90
+ ### G. CLI experience polish (product level)
91
+ The CLI is clunky. Do not guess: run these scripted first-run scenarios in a clean HOME and record every point of friction (extra keystrokes, unclear prompts, unexplained waits, walls of text, confusing errors, missing next-step hints): install, `setup`, first `agentsam` in a repo, choose model, ask a code question, run a task that needs a script, approve and deny an action, resume a previous session, update. Fix the top friction items first. Targets: first useful answer without reading docs; approval prompts that show exactly what will run and where; progress shown for any step over 2 seconds; consistent concise output (human by default, `--json` for machines); `Ctrl-C` always cancels cleanly and says what stopped; a visible "what just happened" summary with the receipt id after tool use; one consistent way to see model, cost and tools in play (`status`).
92
+ Keep a running `docs/product/CLI_FRICTION_LOG.md` (observed, fix, verified) so polish is cumulative and not rediscovered.
93
+
94
+ ### H. Definition of done for this addendum
95
+ - `agentsam doctor` and the boot banner exist, are accurate, and are covered by tests.
96
+ - `npm run smoke:fresh` passes in CI from a clean HOME with no env vars.
97
+ - The capability contract suite passes on all four target repos and all three hosts.
98
+ - A released SDK, with IAM, MCP and Local Studio recorded at that version.
99
+ - Sam can open any of his repos, run `agentsam`, and see within seconds which tools are ready and why any are not.
100
+
101
+ ## ADDENDUM 2 (2026-10-15): live transcript evidence and the "team" gap
102
+
103
+ Source: Sam's screenshots of a real interactive run (session `asess_71438eeb-4c95-4ab7-a1a7-c8c96ac4906a`, model `gpt-6-luna`, Model/Reasoning set to Automatic). The CLI boots fine (directory trust, runtime, model policy all green, session summary with tokens, cost and a resume command). The product shell works. The agent behavior does not yet.
104
+
105
+ ### I1. What happened (observed)
106
+ Sam typed `agentsam doctor` into the agent prompt. After "Thinking" the run ended "Done · 3 tool calls · 11s" with: "I couldn't run `agentsam doctor`: the registered command isn't allowlisted for invocation in this environment. Run it in your project terminal." Run directly in zsh, the same command works and prints a toolchain report (Node 22.23.3, npm, rustc, cargo, rustup, worker-build, Wrangler, wasm target, "AgentSam CLI: ready").
107
+ So the agent could not run the product's own read-only diagnostic, burned three tool calls, then handed the job back to the human. That is the exact opposite of the intended product. Make this transcript the first regression case in the eval suite: "run agentsam doctor and summarize" must succeed end to end with no handoff to the user.
108
+
109
+ ### I2. Likely causes (verify each; these come from reading the code, not from a debugger)
110
+ 1. `src/agent/capability-adapter.js` defines the meta-tools `capability.search`, `capability.describe`, `capability.status`, `capability.invoke`. `capability.invoke` returns `{ ok:false, error:'capability_not_allowlisted' }` unless the id is in `allowAgentInvoke`. The message Sam saw matches this. The error carries no remedy and no alternative.
111
+ 2. CORRECTION to the first handoff: it said no model-callable discovery tool exists. `capability.search/describe/status/invoke` do exist in the capability adapter. What still needs checking is whether they are reliably in the offered tool surface (the runner's `buildAgentToolSurface` keeps only 8 keyword-scored tools) and whether the model is told to use them.
112
+ 3. Probable build mismatch: the screenshot shows the global `agentsam` binary (`~/.nvm/versions/node/v22.23.3/bin/agentsam`) running inside the Superbash worktree. Sam's notes say the global binary is `npm link`ed to `~/agentsam-sdk`, which is on a different branch. If so, this run did NOT contain the Superbash code and `sam.superbash` could not have been available. Verify with `readlink -f $(which agentsam)` and by running `node <worktree>/bin/agentsam` from the worktree.
113
+ 4. `doctor` today is `runCatalogDoctor` (toolchain and catalog), not a capability readiness check. The readiness doctor described in the first addendum should include this toolchain report as one section.
114
+
115
+ ### I3. Required fixes
116
+ 1. Self-service diagnostics. Classify capabilities by side effect (read-only, local write, network, destructive). Read-only product diagnostics (`doctor`, `status`, `whoami`, `runtime-status`, `sam status`, repository snapshot) must be agent-invocable by default with no approval, and exposed as first-class capabilities returning structured JSON (not by shelling out). Writes follow the approval rules.
117
+ 2. Denials must be useful. `capability_not_allowlisted` and every permission error returns: code, plain-language reason, the exact remedy ("approve in /permissions", "log in", "run X"), and a list of allowed alternatives. The model prompt rule: after one denial, try the sanctioned alternative (for a local command: `sam.superbash` with the user's approval prompt) before ever telling the user to run something themselves. Never end a run with "run it in your terminal" unless the user declined approval or no sanctioned path exists.
118
+ 3. Build provenance. `agentsam --version --verbose` and the boot banner show the executable's real path, SDK version, git branch/commit of the linked checkout if any, and the list of bound capabilities. `doctor` warns when the running build differs from the checkout in the current directory.
119
+ 4. Warning leak. The prompt is polluted by `ExperimentalWarning: SQLite is an experimental feature`. `bin/agentsam` registers `process.on('warning')`, but that does not stop Node's own default warning printer, which is also a `warning` listener. Remove or replace the default listener (`process.removeAllListeners('warning')` before adding the filtered one) or launch with `--disable-warning=ExperimentalWarning`; keep other warnings visible. Add a test that starting the CLI on Node 22 prints no SQLite warning.
120
+ 5. Status line honesty. The footer shows `ctx unknown` and `auto auto` with no explanation. Show the actual model chosen by Automatic routing and why (short reason), and the real context usage or a clear "unknown for this model". Make "Done · 3 tool calls · 11s" expandable (`/trace`, or `--verbose`) so every tool call, argument summary and outcome is visible. Failures must name the failing call.
121
+
122
+ ### I4. Make it behave like a tailored team (design, then build on what exists)
123
+ Sam's experience: models respond, but they do not act like a coordinated team with the right specialist on each part. Build team behavior from existing primitives, not a new orchestration engine. Inspect first: `src/acp/agent-executor.js`, `src/acp/client.js`, `src/commands/run.js`, `src/skills/runtime.js`, `src/telemetry/contracts.js` (multitask mode), `packages/agentsam-goap`.
124
+ 1. Define a small fixed set of roles as versioned playbooks (system prompt, allowed tools, output contract): Scout (read, map the repo, answer questions), Planner (turn the request into a short verified plan and acceptance checks), Builder (edit and run), Verifier (run tests, type checks, diff review, no edits), Reviewer (risk and regression read of the diff). Each hands the next a compact, typed handoff artifact (goal, files touched, evidence, open questions) instead of a transcript dump.
125
+ 2. Routing. A request is classified (question, small fix, multi-file change, investigation, release task) and the right roles are engaged automatically; trivial asks stay single-agent and fast. Show the plan and active role in the status line.
126
+ 3. Model policy per role. "Automatic" must pick a stronger model/reasoning level for Planner/Builder on hard work and a cheap fast one for Scout and trivial asks, escalate on repeated failure, and always explain the choice. Record model, tokens and cost per role in the run record.
127
+ 4. Verification is mandatory for Builder output: the Verifier runs the project's real checks before the run reports success. A run that did not verify says so.
128
+ 5. All of it is invoked only when the user asks in that turn (no unprovoked autonomy), shares one context budget, and reuses the tool surface and approval rules above.
129
+
130
+ ### I5. Acceptance (add to the eval suite)
131
+ - "run agentsam doctor and summarize": passes in the CLI on the SDK build under test, in under about 15 seconds, no user handoff, no allowlist error, no SQLite warning.
132
+ - "run this script and tell me what it printed" (needs `sam.superbash`): offered in the surface, approval prompt shows exact script and cwd, receipt id printed.
133
+ - A multi-file change task completes with Planner, Builder and Verifier roles visible in the trace, with real test results in the final summary.
134
+ - `agentsam --version --verbose` proves which build is running.
@@ -0,0 +1,232 @@
1
+ /**
2
+ * One product system: distribute software today, manufacture physical goods tomorrow.
3
+ * No new tables. Product identity stays in the existing authority:
4
+ * software -> agentsam_products (kind, status, tags, metadata)
5
+ * other -> reconciled through the CMS product contract (never copied into agentsam_products)
6
+ * Collections: cms_collections (identity + smart rule). Media: cms_assets.
7
+ *
8
+ * Three ideas kept apart:
9
+ * type (kind) -> what the product IS (fixed fields)
10
+ * collection -> a named, ordered view of items (slug, SKU, SEO, rule)
11
+ * tag -> an attribute used by rules and facets
12
+ * Registered is NOT published, purchasable, installable or manufacturing-ready.
13
+ */
14
+
15
+ /* ---------- capabilities: one id per surface + interaction, each verified separately ---------- */
16
+
17
+ /** Where a person (or agent) touches a product. Product Studio tabs are ONE surface family, not separate screens. */
18
+ export type Surface =
19
+ | "studio" // Product Studio editor tabs (merchant)
20
+ | "collection" // collection editor / smart-rule preview (merchant)
21
+ | "storefront" // public listing + cart (customer)
22
+ | "checkout" // payment (customer)
23
+ | "install" // distribution / licensing / updates (customer + merchant)
24
+ | "template" // preview + apply to a site (merchant)
25
+ | "automation" // run / schedule (merchant, agent)
26
+ | "fulfillment"; // manufacturer order + tracking (system, merchant)
27
+
28
+ export type Interaction = "view" | "edit" | "generate" | "publish" | "add" | "purchase" | "run" | "grant" | "apply" | "submit";
29
+ export type Actor = "merchant" | "customer" | "agent" | "system";
30
+ /** supported = kind + adapter allow it (editor surfaces). verified = a check passed (anything a customer touches). */
31
+ export type Gate = "supported" | "verified";
32
+
33
+ /** Single source of truth. The CapabilityId union is derived from these keys; add a capability here and nowhere else. */
34
+ export const CAPABILITIES = {
35
+ // ---- studio: merchant editor tabs
36
+ "studio.overview.edit": { surface: "studio", interaction: "edit", actors: ["merchant", "agent"], gate: "supported", kinds: "*" },
37
+ "studio.media.edit": { surface: "studio", interaction: "edit", actors: ["merchant", "agent"], gate: "supported", kinds: "*" },
38
+ "studio.pricing.edit": { surface: "studio", interaction: "edit", actors: ["merchant"], gate: "supported", kinds: ["app", "theme", "physical"] },
39
+ "studio.tags.edit": { surface: "studio", interaction: "edit", actors: ["merchant", "agent"], gate: "supported", kinds: "*" },
40
+ "studio.release.manage": { surface: "studio", interaction: "edit", actors: ["merchant"], gate: "supported", kinds: ["app", "sdk-package", "integration", "theme", "section", "block"] },
41
+ "studio.variants.edit": { surface: "studio", interaction: "edit", actors: ["merchant"], gate: "supported", kinds: ["physical"], adapter: "variants" },
42
+ "studio.print_locations.edit": { surface: "studio", interaction: "edit", actors: ["merchant"], gate: "supported", kinds: ["physical"], adapter: "printLocations" },
43
+ "studio.mockups.generate": { surface: "studio", interaction: "generate", actors: ["merchant", "agent"], gate: "supported", kinds: ["physical"], adapter: "mockups" },
44
+ "studio.specs.view": { surface: "studio", interaction: "view", actors: ["merchant"], gate: "supported", kinds: ["physical"], adapter: "specifications" },
45
+ "studio.inventory.view": { surface: "studio", interaction: "view", actors: ["merchant"], gate: "supported", kinds: ["physical"], adapter: "inventory" },
46
+ // ---- collection
47
+ "collection.rule.edit": { surface: "collection", interaction: "edit", actors: ["merchant", "agent"], gate: "supported", kinds: "*" },
48
+ "collection.membership.view": { surface: "collection", interaction: "view", actors: ["merchant", "agent"], gate: "supported", kinds: "*" },
49
+ "collection.publish": { surface: "collection", interaction: "publish", actors: ["merchant"], gate: "supported", kinds: "*" },
50
+ // ---- storefront (customer-facing => verified)
51
+ "storefront.listing.publish": { surface: "storefront", interaction: "publish", actors: ["merchant"], gate: "verified", kinds: ["app", "sdk-package", "integration", "theme", "physical"] },
52
+ "storefront.cart.add": { surface: "storefront", interaction: "add", actors: ["customer"], gate: "verified", kinds: ["app", "theme", "physical"], requires: ["storefront.listing.publish", "checkout.purchase"] },
53
+ // ---- checkout
54
+ "checkout.purchase": { surface: "checkout", interaction: "purchase", actors: ["customer"], gate: "verified", kinds: ["app", "theme", "physical"] },
55
+ // ---- install / distribution
56
+ "install.package.run": { surface: "install", interaction: "run", actors: ["customer", "agent"], gate: "verified", kinds: ["app", "sdk-package", "integration"] },
57
+ "install.license.grant": { surface: "install", interaction: "grant", actors: ["system"], gate: "verified", kinds: ["app", "theme"], requires: ["checkout.purchase"] },
58
+ "install.update.apply": { surface: "install", interaction: "apply", actors: ["customer", "agent"], gate: "verified", kinds: ["app", "sdk-package", "integration"], requires: ["install.package.run"] },
59
+ // ---- template
60
+ "template.preview.view": { surface: "template", interaction: "view", actors: ["merchant", "customer"], gate: "verified", kinds: ["theme", "section", "block"] },
61
+ "template.site.apply": { surface: "template", interaction: "apply", actors: ["merchant", "agent"], gate: "verified", kinds: ["theme", "section", "block"] },
62
+ // ---- automation
63
+ "automation.run.start": { surface: "automation", interaction: "run", actors: ["merchant", "agent"], gate: "verified", kinds: ["automation"] },
64
+ // ---- fulfillment (manufacturer)
65
+ "fulfillment.order.submit": { surface: "fulfillment", interaction: "submit", actors: ["system"], gate: "verified", kinds: ["physical"], adapter: "fulfillment", requires: ["checkout.purchase"] },
66
+ "fulfillment.status.view": { surface: "fulfillment", interaction: "view", actors: ["merchant", "customer"], gate: "verified", kinds: ["physical"], adapter: "fulfillment" },
67
+ } as const satisfies Record<string, CapabilitySpec>;
68
+
69
+ export type CapabilityId = keyof typeof CAPABILITIES;
70
+
71
+ export interface CapabilitySpec {
72
+ surface: Surface;
73
+ interaction: Interaction;
74
+ actors: readonly Actor[];
75
+ gate: Gate;
76
+ kinds: "*" | readonly string[];
77
+ adapter?: keyof ManufacturingProviderAdapter; // capability exists only if the provider implements this
78
+ requires?: readonly string[]; // other capabilities that must be ENABLED first
79
+ }
80
+
81
+ /** Ids written by the first draft. Old metadata.capability_states rows keep working; rewrite on next save. */
82
+ export const LEGACY_CAPABILITY_ALIASES: Record<string, CapabilityId> = {
83
+ "storefront.publish": "storefront.listing.publish",
84
+ "commerce.purchase": "checkout.purchase",
85
+ "distribution.install": "install.package.run",
86
+ "template.apply": "template.site.apply",
87
+ "automation.run": "automation.run.start",
88
+ "mfg.variants": "studio.variants.edit",
89
+ "mfg.print_locations": "studio.print_locations.edit",
90
+ "mfg.mockups": "studio.mockups.generate",
91
+ "mfg.specs": "studio.specs.view",
92
+ "mfg.inventory": "studio.inventory.view",
93
+ "mfg.fulfillment": "fulfillment.order.submit",
94
+ };
95
+
96
+ export type VerificationState = "unverified" | "verified" | "failed" | "revoked";
97
+
98
+ /** Stored at agentsam_products.metadata.capability_states (and the CMS product record for other providers). */
99
+ export interface CapabilityState {
100
+ capability: CapabilityId | keyof typeof LEGACY_CAPABILITY_ALIASES;
101
+ state: VerificationState;
102
+ verifiedAt?: number; // unix seconds
103
+ verifier?: string; // job, CLI command or person that checked it
104
+ evidence?: string; // receipt id, release tag, URL, manifest hash
105
+ }
106
+
107
+ /* ---------- what each kind is allowed to offer (derived: support, not proof) ---------- */
108
+
109
+ const ALL_IDS = Object.keys(CAPABILITIES) as CapabilityId[];
110
+ const spec = (id: CapabilityId): CapabilitySpec => CAPABILITIES[id];
111
+ const kindAllows = (id: CapabilityId, kind: string) => { const k = spec(id).kinds; return k === "*" || k.includes(kind); };
112
+
113
+ export const capabilitiesForKind = (kind: string): CapabilityId[] => ALL_IDS.filter(id => kindAllows(id, kind));
114
+
115
+ /* ---------- manufacturing providers plug in here; a capability appears only if implemented ---------- */
116
+
117
+ export interface ManufacturingProviderAdapter {
118
+ id: string; // registry id, never hardcoded in the editor
119
+ catalog(): Promise<ProviderCatalogItem[]>; // approved products only
120
+ variants?(sku: string): Promise<unknown[]>;
121
+ printLocations?(sku: string): Promise<unknown[]>;
122
+ mockups?(input: { sku: string; assetId: string }): Promise<{ assetId: string }[]>; // results land in cms_assets
123
+ specifications?(sku: string): Promise<Record<string, unknown>>;
124
+ inventory?(sku: string): Promise<unknown>;
125
+ fulfillment?(orderRef: string): Promise<unknown>;
126
+ }
127
+ export interface ProviderCatalogItem { providerSku: string; name: string; approved: boolean }
128
+
129
+ /* ---------- what each surface shows ---------- */
130
+
131
+ export interface ProductLike {
132
+ kind: string;
133
+ metadata?: { capability_states?: CapabilityState[] } | null;
134
+ }
135
+
136
+ export interface ResolvedCapability {
137
+ capability: CapabilityId;
138
+ surface: Surface;
139
+ supported: boolean; // kind allows it AND provider implements the adapter method
140
+ state: VerificationState;
141
+ enabled: boolean; // gate met AND every `requires` capability is enabled
142
+ reason?: "kind" | "adapter" | "unverified" | "blocked_by" | "actor";
143
+ blockedBy?: string[];
144
+ }
145
+
146
+ function stateMap(p: ProductLike): Map<CapabilityId, VerificationState> {
147
+ const m = new Map<CapabilityId, VerificationState>();
148
+ for (const s of p.metadata?.capability_states ?? []) {
149
+ const id = (LEGACY_CAPABILITY_ALIASES[s.capability] ?? s.capability) as CapabilityId;
150
+ if (id in CAPABILITIES) m.set(id, s.state);
151
+ }
152
+ return m;
153
+ }
154
+
155
+ /** Resolve every capability for a product. Pass `surface`/`actor` to get exactly what that screen or person may do. */
156
+ export function resolveCapabilities(
157
+ p: ProductLike,
158
+ opts: { provider?: ManufacturingProviderAdapter; surface?: Surface; actor?: Actor } = {},
159
+ ): ResolvedCapability[] {
160
+ const states = stateMap(p);
161
+ const base = new Map<CapabilityId, ResolvedCapability>();
162
+ for (const id of ALL_IDS) {
163
+ const c = spec(id);
164
+ let supported = kindAllows(id, p.kind);
165
+ let reason: ResolvedCapability["reason"];
166
+ if (!supported) reason = "kind";
167
+ else if (c.adapter && typeof opts.provider?.[c.adapter] !== "function") { supported = false; reason = "adapter"; }
168
+ const state = supported ? states.get(id) ?? "unverified" : "unverified";
169
+ const gateMet = supported && (c.gate === "supported" || state === "verified");
170
+ base.set(id, { capability: id, surface: c.surface, supported, state, enabled: gateMet, reason: gateMet ? undefined : reason ?? "unverified" });
171
+ }
172
+ // dependencies: a capability is enabled only if everything it requires is enabled (single pass is enough: graph is shallow, checked below)
173
+ for (const id of ALL_IDS) {
174
+ const r = base.get(id)!;
175
+ const needs = (spec(id).requires ?? []) as CapabilityId[];
176
+ const blocked = needs.filter(n => !base.get(n)?.enabled);
177
+ if (r.enabled && blocked.length) { r.enabled = false; r.reason = "blocked_by"; r.blockedBy = blocked; }
178
+ }
179
+ let out = [...base.values()].filter(r => r.supported || r.reason === "adapter");
180
+ if (opts.surface) out = out.filter(r => r.surface === opts.surface);
181
+ if (opts.actor) out = out.filter(r => spec(r.capability).actors.includes(opts.actor!));
182
+ return out;
183
+ }
184
+
185
+ export const isEnabled = (r: ResolvedCapability) => r.enabled;
186
+
187
+ /** Surface -> ids, for building nav/tabs without hardcoding per screen. */
188
+ export const SURFACE_CAPABILITIES: Record<Surface, CapabilityId[]> =
189
+ Object.fromEntries((["studio","collection","storefront","checkout","install","template","automation","fulfillment"] as Surface[])
190
+ .map(s => [s, ALL_IDS.filter(id => spec(id).surface === s)])) as Record<Surface, CapabilityId[]>;
191
+
192
+ /** Guard for server routes: one call per user interaction. */
193
+ export function canDo(p: ProductLike, id: CapabilityId, actor: Actor, provider?: ManufacturingProviderAdapter): ResolvedCapability & { allowed: boolean } {
194
+ const r = resolveCapabilities(p, { provider }).find(x => x.capability === id);
195
+ if (!r) return { capability: id, surface: spec(id).surface, supported: false, state: "unverified", enabled: false, reason: "kind", allowed: false };
196
+ const actorOk = spec(id).actors.includes(actor);
197
+ return { ...r, allowed: r.enabled && actorOk, reason: actorOk ? r.reason : "actor" };
198
+ }
199
+
200
+ /* ---------- smart collection rules: validated, allowlisted, parameterized ---------- */
201
+
202
+ export interface SmartCollectionRule {
203
+ operator: "and" | "or";
204
+ conditions: Array<{ field: string; comparison: "eq" | "in" | "contains"; value: string | string[] }>;
205
+ }
206
+
207
+ /** field -> SQL expression, per item type. Anything not listed is rejected, never interpolated. */
208
+ export const RULE_FIELDS: Record<string, Record<string, { sql: string; allow: Array<"eq" | "in" | "contains"> }>> = {
209
+ product: {
210
+ kind: { sql: "kind", allow: ["eq", "in"] },
211
+ status: { sql: "status", allow: ["eq", "in"] },
212
+ tags: { sql: "EXISTS (SELECT 1 FROM json_each(agentsam_products.tags) t WHERE t.value = ?)", allow: ["contains"] },
213
+ },
214
+ };
215
+
216
+ export function compileRule(itemType: string, rule: SmartCollectionRule): { where: string; params: string[] } {
217
+ const fields = RULE_FIELDS[itemType];
218
+ if (!fields) throw new Error(`No rule fields allowlisted for item type "${itemType}"`);
219
+ if (!rule.conditions.length) throw new Error("Smart collection needs at least one condition");
220
+ const parts: string[] = [], params: string[] = [];
221
+ for (const c of rule.conditions) {
222
+ const f = fields[c.field];
223
+ if (!f) throw new Error(`Field "${c.field}" is not allowed for ${itemType}`);
224
+ if (!f.allow.includes(c.comparison)) throw new Error(`"${c.comparison}" is not allowed on ${c.field}`);
225
+ if (c.comparison === "eq") { parts.push(`${f.sql} = ?`); params.push(String(c.value)); }
226
+ else if (c.comparison === "in") {
227
+ const vals = Array.isArray(c.value) ? c.value : [c.value];
228
+ parts.push(`${f.sql} IN (${vals.map(() => "?").join(",")})`); params.push(...vals);
229
+ } else { parts.push(f.sql); params.push(String(c.value)); } // contains -> tag EXISTS
230
+ }
231
+ return { where: parts.join(rule.operator === "and" ? " AND " : " OR "), params };
232
+ }
@@ -0,0 +1,51 @@
1
+ # Knowledge: existing Supabase Edge / node-api semantic lane
2
+
3
+ The CLI and SDK reuse a project's **existing** authorized Supabase Edge adapter. This is **not** a new database authority, schema, or standalone indexing engine. Parsing/source hashes and local generation history remain SDK Knowledge/Repository responsibilities; the existing Edge `node-api` performs remote Gemini embeddings and writes account-scoped pgvector projections.
4
+
5
+ ## What is executable now
6
+
7
+ - The portable Node API client lives in `packages/agentsam-knowledge/src/backends/supabase-node-api.js`; it is available from the Knowledge backend registry (`supabase_pgvector.connect`).
8
+ - Public `node-api/health` and `/capabilities` are verified before configuration. Model/dimensions come from the **actual selected endpoint**, not a hardcoded SDK customer profile.
9
+ - `agentsam autorag setup --yes --backend supabase_pgvector --resource <EDGE-URL>` persists **only** project scope, a URL, backend, and embedding profile. The default new-project scope is `.` (all applicable project source files); `--scope` is an explicit user override. No IAM or other user's repository ID is assumed.
10
+ - `agentsam index plan` and `agentsam index run` prepare a source-hashed structural/text generation in the selected local store without paid embedding requests. `agentsam autorag remote --publish --allow-paid --max-inputs 100 --account-id <AUTHORIZED-ID>` submits that generation's content to Edge, which performs Gemini embedding. `autorag remote --query ... --allow-paid --account-id <AUTHORIZED-ID>` queries the Edge's account/repository-filtered pgvector RPC.
11
+ - A host must inject the bridge authorization into the server-side Node/API runtime. **Never put `AGENTSAM_BRIDGE_KEY` in `.agentsam/knowledge.json`, a browser, Tauri webview, or a project README.** Programmatic hosts may inject `getAuthHeaders`; no user-specific credential is shipped by the SDK. Local CLI remote query/publish fails closed until a trusted host makes authorization available.
12
+ - The CLI refuses `index run --embed` and `search --semantic` for this backend, rather than silently doing local semantic work while labeling it Supabase.
13
+ - `autorag doctor` distinguishes **endpoint reachable**, **profile compatible**, **protected endpoint authenticated**, **current local generation**, and **remote generation proof**. Health/capability metadata alone cannot make the remote lane `READY`.
14
+
15
+ ## Example
16
+
17
+ ```sh
18
+ agentsam autorag setup --yes --backend supabase_pgvector \
19
+ --resource "https://<your-project-ref>.supabase.co/functions/v1/node-api" \
20
+ --scope .
21
+ agentsam autorag remote # Public health and profile compatibility, no paid API call
22
+ agentsam index plan # Current source inventory, no remote write
23
+ agentsam index run # Deterministic local facts and generation
24
+
25
+ # Run only within an authorized host/operator environment with a server-side bridge key.
26
+ agentsam autorag remote --publish --allow-paid --max-inputs 100 --account-id <authorized-account>
27
+ agentsam autorag remote --query "Where is the checkout handler?" \
28
+ --allow-paid --account-id <authorized-account>
29
+ ```
30
+
31
+ You can run without a Supabase-specific binary, Python scripts, Docker, or a fixed `src`/`docs` scope. The same SDK remains usable with `local_exact`, a direct Postgres/pgvector storage adapter, and optional Cloudflare Vectorize.
32
+
33
+ ## Current limits and honesty
34
+
35
+ This is a **single selected lane** in the existing `knowledge.json` v2 schema. Multiple independent, simultaneous code/docs/memory lanes per project remain a future schema upgrade. The Edge's existing codebase corpus is Gemini Embedding 2 at 1,536 dimensions; choosing another incompatible provider or dimension **does not silently reconfigure its physical table**. Use an independently configured compatible target or migration when changing embedding spaces.
36
+
37
+ Remote publishing is a distinct explicit action, not an automatic side effect of local `index run`. The Node API ingestion receipt proves accepted/completed batch handling, **not** that the application's canonical D1 generation was activated, that the Worker has read-after-write visibility, or that a current generation passed an authorized semantic query. Those require separate end-to-end evidence from the owning host. No production migration or automatic host deployment is performed by the SDK command.
38
+
39
+ Current project connections may offer a private host proxy that supplies credentials without exposing them to consumers. A user who lacks host authorization will receive `authorized_host_required`, not a faux-success fallback or an arbitrary personal SDK key.
40
+
41
+ Paid remote publication is budget-capped at 100 selected chunks by default; raise `--max-inputs N` explicitly after reviewing the current `index plan`. This is a **cost guard**, not a fixed source scope.
42
+
43
+ For a document corpus, pass `--corpus documents` to both `autorag remote --publish` and `autorag remote --query`. The adapter marks and queries each repository using its own `source_type` selector, because the existing documents matching RPC has no `repository_id` argument. The codebase corpus uses the RPC's native repository filter.
44
+
45
+ ## Connected Local Studio Worker bridge
46
+
47
+ A self-hosted Studio Worker can expose an **authenticated** same-origin route under `/api/knowledge/node-api/` forwarding only `health`, `capabilities`, `codebase/status`, `vectors/status`, `memory/status`, `generations`, `vectors/query`, `codebase/ingest`, and `vectors/ingest`. This route derives account identity from the validated Studio session and supplies its own `AGENTSAM_BRIDGE_KEY` to Edge; the caller never receives the secret. The selected upstream address is configured with the Worker-side `AGENTSAM_NODE_API_URL` (deployment-specific; not required by the generic SDK).
48
+
49
+ The CLI's `--session-auth` switch deliberately consumes only an **already validated Studio-native session** injected on the host side as `AGENTSAM_STUDIO_SESSION_TOKEN`, together with an explicit `--trusted-origin` matching the configured gateway endpoint. This credential must not be put into project config, frontend JavaScript, `.env` committed files or CLI command-line arguments. An IAM CLI OAuth access token is **not** a Studio session ID and is not substituted for one. In-app Studio fetches may instead use the existing HttpOnly session cookie on the same origin.
50
+
51
+ For the gateway, protected `/codebase/status` is the bridge-secret equality check, while public `/health` and `/capabilities` prove endpoint availability only. Query/ingest require the caller to explicitly approve paid operations and the Worker caps each request to 20 chunks and a bounded payload, while retaining user-controlled repository scope. A successful Edge ingest response is **not** a canonical generation activation receipt.
@@ -0,0 +1,31 @@
1
+ # Media Truth / BrandOps source recovery — October 8, 2026
2
+
3
+ ## Ownership and scope
4
+ The nine scripts under scripts/brandops/ were recovered from the old
5
+ feat/media-truth-v1 worktree. They are developer/operator evidence tools,
6
+ not a second media service and not a production transform implementation.
7
+
8
+ The current media-kit/runtime remains the source of truth for derivatives,
9
+ delivery URLs, and original media. The scripts may inspect, plan, or verify,
10
+ but must not manufacture a ready release receipt without real provider output.
11
+
12
+ ## Evidence run (read-only source, scratch output outside the repository)
13
+ - Python source compiled successfully using python3.14.
14
+ - Repo/media inventory: 109 assets / 7.6 MB / 15 duplicate groups.
15
+ - Derivative plan: 146 planned variants.
16
+ - Sprint receipt: NOT READY.
17
+ - Blocker: no materialized-derivatives.json; no physical transform output
18
+ or delivery URLs have been demonstrated by the product pipeline.
19
+ - No R2 writes or asset deletions occurred.
20
+
21
+ ## Closure gate
22
+ 1. Connect actual media-kit Prepare/transform execution to persisted artifacts.
23
+ 2. Record per output: immutable source identity, transform settings, output
24
+ object key/URL, byte size, checksum, capability provenance, and status.
25
+ 3. Generate the manifest from outputs, not from a planned-only inventory.
26
+ 4. Run verify_media_truth.py over those outputs with a real delivery probe.
27
+ 5. Only then permit sprint_receipt.py to mark READY.
28
+ 6. Preserve master assets and avoid eager derivatives without explicit Prepare.
29
+
30
+ Original untracked .agentsam/brandops/ remains in the old worktree; this
31
+ recovery deliberately does not put runtime receipts or local SQLite into Git.
@@ -0,0 +1,104 @@
1
+ # Agent handoff — full package catalog + offline software decision helper
2
+
3
+ ## Scope
4
+
5
+ Treat every real package under `packages/` consistently.
6
+
7
+ Do not manually write 57 manifests from package names.
8
+
9
+ Use deterministic machinery to extract facts and create reviewable drafts.
10
+
11
+ Required end-state:
12
+
13
+ ```text
14
+ agentsam explain rust
15
+ agentsam explain workers
16
+ agentsam explain wasm
17
+ agentsam explain rapid-rust
18
+ agentsam explain package agentsam-hooks
19
+ agentsam explain package agentsam-workbench
20
+
21
+ agentsam choose runtime --goal reusable-native-logic
22
+ agentsam assist
23
+ agentsam doctor
24
+ ```
25
+
26
+ All must work from the packed product without an LLM.
27
+
28
+ ## `assist` must teach, not just choose
29
+
30
+ The helper should reason through explicit, deterministic questions:
31
+
32
+ 1. What are you building?
33
+ 2. Where must it run?
34
+ 3. Is it request/response or long-running?
35
+ 4. Does it need native OS/process/filesystem access?
36
+ 5. Is there a browser/UI surface?
37
+ 6. Must business/domain logic be reusable across hosts?
38
+ 7. Are incoming requests signed/authenticated?
39
+ 8. Is the workload bounded or heavy/long-running?
40
+ 9. Is portability more important than native system access?
41
+ 10. Does the user already have a preferred language/runtime constraint?
42
+
43
+ Then return:
44
+
45
+ - primary recommendation;
46
+ - why it fits;
47
+ - why obvious alternatives do not fit as well;
48
+ - packages/templates to use;
49
+ - prerequisites;
50
+ - install commands;
51
+ - verification commands;
52
+ - starter commands;
53
+ - related `agentsam explain ...` topics.
54
+
55
+ Never answer only "missing cargo" / "missing worker-build".
56
+ Give repair instructions and continuation commands.
57
+
58
+ ## Full package treatment
59
+
60
+ Every package gets an `agentsam.package.json`.
61
+
62
+ But there are two stages:
63
+
64
+ ### Stage A — machine draft
65
+
66
+ Facts may be derived from:
67
+ - npm/Cargo manifest;
68
+ - README;
69
+ - exports;
70
+ - dependency names;
71
+ - source-language extensions;
72
+ - explicit package description;
73
+ - workspace/public/private flags.
74
+
75
+ Draft status:
76
+
77
+ ```json
78
+ "catalog_status": "needs-review"
79
+ ```
80
+
81
+ unless all required product fields are already explicit and trustworthy.
82
+
83
+ ### Stage B — reviewed authority
84
+
85
+ Only after review:
86
+
87
+ ```json
88
+ "catalog_status": "classified"
89
+ ```
90
+
91
+ The build gate may allow `needs-review` in development but release/public publication must report or reject incomplete public records.
92
+
93
+ ## No rediscovery tax
94
+
95
+ The package manifest becomes the package-owned product knowledge authority.
96
+
97
+ Do not duplicate the same prose in:
98
+ - CLI command handlers;
99
+ - public website;
100
+ - docs app;
101
+ - Local Studio;
102
+ - random root-level catalog files.
103
+
104
+ Generate aggregates from package-owned data.