@inneranimalmedia/agentsam-sdk 2.6.7 → 2.6.9

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 (371) hide show
  1. package/README.md +37 -0
  2. package/apps/README.md +25 -0
  3. package/apps/cad-creator/shared/cad/package.json +1 -1
  4. package/apps/client-cms-editor/backend/package.json +4 -6
  5. package/apps/client-cms-editor/frontend/package.json +6 -8
  6. package/apps/client-cms-editor/frontend/tsconfig.json +27 -8
  7. package/apps/client-cms-editor/package.json +1 -1
  8. package/apps/client-cms-editor/shared/cms/package.json +4 -6
  9. package/docs/LOCAL_ENGINE_COMPUTE_AUDIT_PLAN.md +299 -0
  10. package/docs/REPO_FILE_MAP.txt +132 -0
  11. package/migrations/d1/0018_goap_control_plane_remaster.sql +40 -0
  12. package/migrations/d1/0019_agentsam_agent_run_plan_todo.sql +14 -0
  13. package/migrations/d1/README_PORTABLE_CONTROL_PLANE.md +20 -9
  14. package/migrations/runtime/0002_goap_blackboard_v1.sql +15 -0
  15. package/migrations/runtime/0004_agent_run_plan_linkage.sql +8 -0
  16. package/native/agentsam-machine/cli/Cargo.toml +8 -1
  17. package/native/agentsam-machine/cli/README.md +21 -0
  18. package/native/agentsam-machine/core/Cargo.toml +7 -0
  19. package/native/agentsam-machine/core/README.md +14 -0
  20. package/native/agentsam-machine/core/build.rs +33 -0
  21. package/native/agentsam-machine/core/contracts/source-types.v1.json +353 -0
  22. package/native/agentsam-machine/core/src/lib.rs +6 -0
  23. package/native/agentsam-machine/core/src/source_types.rs +2 -2
  24. package/package.json +31 -10
  25. package/packages/agentsam-brand/package.json +1 -1
  26. package/packages/agentsam-contracts/package.json +71 -20
  27. package/packages/agentsam-contracts/scripts/build.mjs +18 -0
  28. package/packages/agentsam-contracts/test/contracts.test.mjs +4 -1
  29. package/packages/agentsam-contracts/test/repository.test.mjs +4 -1
  30. package/packages/agentsam-contracts/tsconfig.build.json +10 -0
  31. package/packages/agentsam-errors/package.json +3 -2
  32. package/packages/agentsam-errors/src/index.js +1 -0
  33. package/packages/agentsam-errors/src/tool.js +56 -0
  34. package/packages/agentsam-errors/test/tool.test.mjs +58 -0
  35. package/packages/agentsam-goap/README.md +52 -0
  36. package/packages/agentsam-goap/package.json +37 -0
  37. package/packages/agentsam-goap/src/adapters/d1-sqlite.js +570 -0
  38. package/packages/agentsam-goap/src/adapters/memory.js +199 -0
  39. package/packages/agentsam-goap/src/contracts.js +226 -0
  40. package/packages/agentsam-goap/src/control-plane.js +112 -0
  41. package/packages/agentsam-goap/src/errors.js +157 -0
  42. package/packages/agentsam-goap/src/index.js +5 -0
  43. package/packages/agentsam-goap/src/world.js +202 -0
  44. package/packages/agentsam-goap/test/goap-control-plane.test.mjs +245 -0
  45. package/packages/agentsam-goap/test/world.test.mjs +79 -0
  46. package/packages/agentsam-knowledge/package.json +3 -2
  47. package/packages/agentsam-nav/package.json +1 -1
  48. package/packages/agentsam-queue-control/package.json +1 -1
  49. package/packages/agentsam-rapid-rust/src/main.rs +1 -0
  50. package/packages/agentsam-repository/package.json +3 -2
  51. package/packages/agentsam-repository/src/goap.js +13 -14
  52. package/packages/agentsam-repository/src/tickets.js +15 -22
  53. package/packages/agentsam-repository/test/goap-tickets-workspace-state.test.mjs +19 -8
  54. package/packages/agentsam-vault/package.json +8 -5
  55. package/packages/agentsam-workbench/package.json +44 -17
  56. package/packages/connectors/cloudflare/package.json +4 -2
  57. package/packages/heuristic-theme/package.json +1 -1
  58. package/packages/identity/package.json +4 -3
  59. package/packages/identity/tests/lane1-packed-consumer.test.mjs +10 -2
  60. package/packages/providers/completeful/package.json +1 -1
  61. package/packages/theme-church-site/README.md +2 -2
  62. package/packages/theme-church-site/package.json +3 -4
  63. package/packages/theme-church-site/src/index.js +1 -1
  64. package/packages/theme-church-site/test/theme.test.mjs +1 -1
  65. package/packages/theme-companions-site/README.md +2 -2
  66. package/packages/theme-companions-site/package.json +3 -4
  67. package/packages/theme-companions-site/src/index.js +1 -1
  68. package/packages/theme-companions-site/test/theme.test.mjs +1 -1
  69. package/packages/theme-floors-site/README.md +2 -2
  70. package/packages/theme-floors-site/package.json +3 -4
  71. package/packages/theme-floors-site/src/index.js +1 -1
  72. package/packages/theme-floors-site/test/theme.test.mjs +1 -1
  73. package/packages/theme-fuelnfree-site/README.md +2 -2
  74. package/packages/theme-fuelnfree-site/package.json +3 -4
  75. package/packages/theme-fuelnfree-site/src/index.js +1 -1
  76. package/packages/theme-fuelnfree-site/test/theme.test.mjs +1 -1
  77. package/packages/theme-handyman-site/README.md +2 -2
  78. package/packages/theme-handyman-site/package.json +3 -4
  79. package/packages/theme-handyman-site/src/index.js +1 -1
  80. package/packages/theme-handyman-site/test/theme.test.mjs +1 -1
  81. package/packages/theme-insurance-site/README.md +2 -2
  82. package/packages/theme-insurance-site/package.json +3 -4
  83. package/packages/theme-insurance-site/src/index.js +1 -1
  84. package/packages/theme-insurance-site/test/theme.test.mjs +1 -1
  85. package/packages/theme-scenes/package.json +1 -1
  86. package/packages/theme-shinshu-site/README.md +2 -2
  87. package/packages/theme-shinshu-site/package.json +3 -4
  88. package/packages/theme-shinshu-site/src/index.js +1 -1
  89. package/packages/theme-shinshu-site/test/theme.test.mjs +1 -1
  90. package/packages/work-graph/package.json +3 -2
  91. package/protocol/local-engine/benchmark.v1.schema.json +14 -0
  92. package/protocol/local-engine/engine.v1.schema.json +17 -0
  93. package/python/agentsam_sdk/repository/intelligence/discovery.py +27 -2
  94. package/python/agentsam_sdk/repository/intelligence/git.py +4 -0
  95. package/python/tests/test_repository_intelligence.py +30 -0
  96. package/src/cli/command-catalog.js +3 -1
  97. package/src/cli.js +20 -1
  98. package/src/commands/app.js +10 -0
  99. package/src/commands/engine.js +10 -0
  100. package/src/commands/goap-world.js +134 -0
  101. package/src/commands/goap.js +11 -4
  102. package/src/commands/machine-binary.js +33 -27
  103. package/src/commands/machine-runtime.js +266 -0
  104. package/src/commands/machine.js +155 -51
  105. package/src/commands/package.js +537 -0
  106. package/src/commands/plan-ledger.js +370 -0
  107. package/src/commands/plan.js +183 -0
  108. package/src/commands/runtime.js +25 -10
  109. package/src/commands/setup.js +30 -6
  110. package/src/commands/skill.js +78 -17
  111. package/src/commands/terminal.js +20 -8
  112. package/src/errors/contract.js +4 -4
  113. package/src/errors/diagnostic.js +1 -1
  114. package/src/errors/index.js +1 -1
  115. package/src/index.js +20 -0
  116. package/src/indexing/ingest/materials.js +237 -30
  117. package/src/knowledge/source.js +1 -1
  118. package/src/lib/setup/runtime.js +4 -2
  119. package/src/lib/slash-commands.js +1 -1
  120. package/src/local/runtime-store.js +24 -2
  121. package/src/local/sqlite.js +17 -0
  122. package/src/local-engine/assets.js +37 -0
  123. package/src/local-engine/audit.js +133 -0
  124. package/src/local-engine/benchmark.js +26 -0
  125. package/src/local-engine/contracts.js +101 -0
  126. package/src/local-engine/engines.js +142 -0
  127. package/src/local-engine/index.js +18 -0
  128. package/src/local-engine/runtime.js +39 -0
  129. package/src/sam/operations/package-audit.js +41 -0
  130. package/src/sam/seed.js +2 -0
  131. package/skills/grok-auth/SKILL.md +0 -110
  132. package/skills/grok-auth/agentsam.skill.json +0 -25
  133. package/skills/grok-auth/references/grok-identity.md +0 -64
  134. package/skills/grok-auth/references/per-user-data.md +0 -49
  135. package/skills/grok-auth/references/prewired-and-env.md +0 -54
  136. package/skills/grok-auth/references/session-ui.md +0 -133
  137. package/skills/grok-auth/references/sign-in-methods.md +0 -55
  138. package/skills/grok-auth/references/wiring.md +0 -71
  139. package/skills/grok-building-games/SKILL.md +0 -213
  140. package/skills/grok-building-games/agentsam.skill.json +0 -25
  141. package/skills/grok-building-games/references/3d-libs.md +0 -64
  142. package/skills/grok-building-games/references/ai-pathfinding.md +0 -122
  143. package/skills/grok-building-games/references/audio.md +0 -129
  144. package/skills/grok-building-games/references/babylon.md +0 -202
  145. package/skills/grok-building-games/references/collision-physics.md +0 -122
  146. package/skills/grok-building-games/references/ecs-architecture.md +0 -111
  147. package/skills/grok-building-games/references/game-feel-juice.md +0 -110
  148. package/skills/grok-building-games/references/genres/board-card-chess.md +0 -89
  149. package/skills/grok-building-games/references/genres/endless-runner.md +0 -83
  150. package/skills/grok-building-games/references/genres/fps.md +0 -105
  151. package/skills/grok-building-games/references/genres/platformer-2d.md +0 -97
  152. package/skills/grok-building-games/references/genres/puzzle-match3-tetris.md +0 -131
  153. package/skills/grok-building-games/references/genres/racing-kart.md +0 -106
  154. package/skills/grok-building-games/references/genres/topdown-twin-stick.md +0 -97
  155. package/skills/grok-building-games/references/genres/tower-defense.md +0 -84
  156. package/skills/grok-building-games/references/genres/voxel-minecraft.md +0 -89
  157. package/skills/grok-building-games/references/input.md +0 -139
  158. package/skills/grok-building-games/references/phaser.md +0 -277
  159. package/skills/grok-building-games/references/procedural-generation.md +0 -141
  160. package/skills/grok-building-games/references/save-persistence.md +0 -108
  161. package/skills/grok-building-games/references/threejs-foundational.md +0 -148
  162. package/skills/grok-controls/SKILL.md +0 -274
  163. package/skills/grok-controls/agentsam.skill.json +0 -25
  164. package/skills/grok-design-ui/SKILL.md +0 -122
  165. package/skills/grok-design-ui/agentsam.skill.json +0 -25
  166. package/skills/grok-design-ui/references/animations.md +0 -379
  167. package/skills/grok-design-ui/references/performance.md +0 -88
  168. package/skills/grok-design-ui/references/refined-ui.md +0 -384
  169. package/skills/grok-design-ui/references/surfaces.md +0 -247
  170. package/skills/grok-design-ui/references/typography.md +0 -123
  171. package/skills/grok-game-animation-frames/SKILL.md +0 -84
  172. package/skills/grok-game-animation-frames/agentsam.skill.json +0 -25
  173. package/skills/grok-game-asset-core/SKILL.md +0 -69
  174. package/skills/grok-game-asset-core/agentsam.skill.json +0 -25
  175. package/skills/grok-game-character-consistency/SKILL.md +0 -69
  176. package/skills/grok-game-character-consistency/agentsam.skill.json +0 -25
  177. package/skills/grok-game-tilesets/SKILL.md +0 -65
  178. package/skills/grok-game-tilesets/agentsam.skill.json +0 -25
  179. package/skills/grok-game-ui-icons/SKILL.md +0 -56
  180. package/skills/grok-game-ui-icons/agentsam.skill.json +0 -25
  181. package/skills/grok-generate2dmap/LICENSE +0 -21
  182. package/skills/grok-generate2dmap/SKILL.md +0 -120
  183. package/skills/grok-generate2dmap/SOURCE.md +0 -6
  184. package/skills/grok-generate2dmap/agentsam.skill.json +0 -25
  185. package/skills/grok-generate2dmap/references/deliverables.md +0 -101
  186. package/skills/grok-generate2dmap/references/layered-map-contract.md +0 -209
  187. package/skills/grok-generate2dmap/references/map-strategies.md +0 -341
  188. package/skills/grok-generate2dmap/references/object-production-gate.md +0 -24
  189. package/skills/grok-generate2dmap/references/pipeline.md +0 -149
  190. package/skills/grok-generate2dmap/references/prop-pack-contract.md +0 -174
  191. package/skills/grok-generate2dmap/references/side-scroll-stages.md +0 -29
  192. package/skills/grok-generate2dmap/scripts/compose_layered_preview.py +0 -157
  193. package/skills/grok-generate2dmap/scripts/extract_prop_pack.py +0 -369
  194. package/skills/grok-generate2dsprite/LICENSE +0 -21
  195. package/skills/grok-generate2dsprite/SKILL.md +0 -313
  196. package/skills/grok-generate2dsprite/SOURCE.md +0 -6
  197. package/skills/grok-generate2dsprite/agentsam.skill.json +0 -25
  198. package/skills/grok-generate2dsprite/references/modes.md +0 -124
  199. package/skills/grok-generate2dsprite/references/prompt-rules.md +0 -315
  200. package/skills/grok-generate2dsprite/scripts/generate2dsprite.py +0 -1031
  201. package/skills/grok-generate2dsprite/scripts/make_layout_guide.py +0 -109
  202. package/skills/grok-imagine/SKILL.md +0 -201
  203. package/skills/grok-imagine/agentsam.skill.json +0 -25
  204. package/skills/grok-multiplayer-p2p/SKILL.md +0 -111
  205. package/skills/grok-multiplayer-p2p/agentsam.skill.json +0 -25
  206. package/skills/grok-multiplayer-p2p/references/react-binding.md +0 -144
  207. package/skills/grok-multiplayer-p2p/references/signaling-relay.md +0 -269
  208. package/skills/grok-neon/SKILL.md +0 -157
  209. package/skills/grok-neon/agentsam.skill.json +0 -25
  210. package/skills/grok-og/SKILL.md +0 -102
  211. package/skills/grok-og/agentsam.skill.json +0 -25
  212. package/skills/grok-og/references/brand-pass.md +0 -53
  213. package/skills/grok-og/references/custom-card.md +0 -107
  214. package/skills/grok-og/references/favicon-and-icons.md +0 -48
  215. package/skills/grok-og/references/og-type-contract.md +0 -18
  216. package/skills/grok-og/references/placeholder-card.md +0 -21
  217. package/skills/grok-og/references/x-banner.md +0 -41
  218. package/skills/grok-threejs/SKILL.md +0 -67
  219. package/skills/grok-threejs/agentsam.skill.json +0 -25
  220. package/skills/grok-threejs/references/llms-full.txt +0 -2780
  221. package/skills/grok-video2dsprite/LICENSE +0 -21
  222. package/skills/grok-video2dsprite/SKILL.md +0 -236
  223. package/skills/grok-video2dsprite/SOURCE.md +0 -6
  224. package/skills/grok-video2dsprite/agentsam.skill.json +0 -25
  225. package/skills/grok-video2dsprite/references/pipeline.md +0 -90
  226. package/skills/grok-video2dsprite/references/prompt-rules.md +0 -63
  227. package/skills/grok-video2dsprite/scripts/video2dsprite.py +0 -490
  228. package/skills/grok-xai-api/SKILL.md +0 -152
  229. package/skills/grok-xai-api/agentsam.skill.json +0 -25
  230. package/test/account-session.test.mjs +0 -101
  231. package/test/agent-capabilities.test.mjs +0 -67
  232. package/test/app-authority-context.test.mjs +0 -32
  233. package/test/app-building-skills.test.mjs +0 -61
  234. package/test/apps-scaffold-contract.test.mjs +0 -115
  235. package/test/blender-cad.test.mjs +0 -146
  236. package/test/cad-docker.test.mjs +0 -96
  237. package/test/capabilities.test.mjs +0 -133
  238. package/test/cli/api-key-env-whoami.test.mjs +0 -129
  239. package/test/cli/catalog-authority.test.mjs +0 -64
  240. package/test/cli/codebaseindex-plan-ux.test.mjs +0 -37
  241. package/test/cli/eval-live.test.mjs +0 -219
  242. package/test/cli/go.test.mjs +0 -128
  243. package/test/cli/local-vault-and-provider-setup.test.mjs +0 -268
  244. package/test/cli/machine-command.test.mjs +0 -34
  245. package/test/cli/mcp-client.test.mjs +0 -256
  246. package/test/cli/preferences-runtime.test.mjs +0 -11
  247. package/test/cli/runtime-persist.test.mjs +0 -56
  248. package/test/cli/runtime-ui.test.mjs +0 -141
  249. package/test/cli/rust-command.test.mjs +0 -21
  250. package/test/cli/skill-npm-and-env.test.mjs +0 -52
  251. package/test/cli/status-actions.test.mjs +0 -88
  252. package/test/cli/wireframes-go-registry.test.mjs +0 -139
  253. package/test/cli-preferences.test.mjs +0 -46
  254. package/test/cloudflare-connector.test.mjs +0 -93
  255. package/test/cloudflare-runtime.test.mjs +0 -82
  256. package/test/context.test.mjs +0 -159
  257. package/test/credentials-audit.test.mjs +0 -113
  258. package/test/deploy-health-scan.test.mjs +0 -95
  259. package/test/deploy-receipt.test.mjs +0 -91
  260. package/test/dockerize.test.mjs +0 -93
  261. package/test/error-diagnostics.test.mjs +0 -124
  262. package/test/eval-context.test.mjs +0 -37
  263. package/test/execution-approvals.test.mjs +0 -27
  264. package/test/fixtures/cad/courtyard-house.json +0 -208
  265. package/test/fixtures/knowledge-rpc-worker.mjs +0 -16
  266. package/test/fixtures/project-authority/customer-app/.agentsam/app.json +0 -5
  267. package/test/fixtures/project-authority/customer-app/apps/my-product/index.ts +0 -1
  268. package/test/fixtures/project-authority/customer-app/wrangler.toml +0 -17
  269. package/test/gcloud-auth.test.mjs +0 -111
  270. package/test/go/build-source-identity.test.mjs +0 -31
  271. package/test/go/cloudflare-probe.test.mjs +0 -317
  272. package/test/go/distribution.test.mjs +0 -28
  273. package/test/google-cloud-connection.test.mjs +0 -83
  274. package/test/google-cloud-inventory.test.mjs +0 -64
  275. package/test/indexing-provider.test.mjs +0 -29
  276. package/test/init-options.test.mjs +0 -35
  277. package/test/integration/ai-access-onboarding.test.mjs +0 -47
  278. package/test/integration/app-command.test.mjs +0 -85
  279. package/test/integration/autorag-project-authority.integration.test.mjs +0 -51
  280. package/test/integration/autorag-runtime-discovery.test.mjs +0 -107
  281. package/test/integration/cad-discovery.test.mjs +0 -158
  282. package/test/integration/cad-docker-executor.test.mjs +0 -249
  283. package/test/integration/cad-execution.test.mjs +0 -184
  284. package/test/integration/cad-project-app.test.mjs +0 -31
  285. package/test/integration/cad-project-d1.test.mjs +0 -25
  286. package/test/integration/cad-project-native.test.mjs +0 -24
  287. package/test/integration/cad-project-workflow.test.mjs +0 -9
  288. package/test/integration/cad-project.test.mjs +0 -85
  289. package/test/integration/cli-help.test.mjs +0 -41
  290. package/test/integration/cms-app-scaffold.test.mjs +0 -77
  291. package/test/integration/cms-site-tenancy-contract.test.mjs +0 -268
  292. package/test/integration/codebaseindex-ingest.test.mjs +0 -255
  293. package/test/integration/core-client.integration.test.mjs +0 -55
  294. package/test/integration/database-hosted-honesty.test.mjs +0 -49
  295. package/test/integration/desktop-keychain-boundary.test.mjs +0 -45
  296. package/test/integration/error-runtime-rpc.test.mjs +0 -71
  297. package/test/integration/features-resolve.test.mjs +0 -147
  298. package/test/integration/hosted-work-host-authority.test.mjs +0 -47
  299. package/test/integration/icon-registry.test.mjs +0 -67
  300. package/test/integration/ingest-discover-models.test.mjs +0 -30
  301. package/test/integration/inspect-path-cli.test.mjs +0 -46
  302. package/test/integration/install-script.test.mjs +0 -110
  303. package/test/integration/inventory-core.test.mjs +0 -53
  304. package/test/integration/inventory-eligibility.test.mjs +0 -59
  305. package/test/integration/inventory-evidence.test.mjs +0 -125
  306. package/test/integration/knowledge-rpc.test.mjs +0 -112
  307. package/test/integration/local-fs.test.mjs +0 -113
  308. package/test/integration/local-provider-bridge.test.mjs +0 -65
  309. package/test/integration/local-studio-settings-production.test.mjs +0 -40
  310. package/test/integration/lockfile-sync.test.mjs +0 -26
  311. package/test/integration/merkle-cli.test.mjs +0 -61
  312. package/test/integration/merkle-persistence-identity.test.mjs +0 -48
  313. package/test/integration/plugins-cloudflare.integration.test.mjs +0 -28
  314. package/test/integration/provider-env-cli.test.mjs +0 -60
  315. package/test/integration/provider-factory.test.mjs +0 -197
  316. package/test/integration/repository-company-graph.test.mjs +0 -90
  317. package/test/integration/runtime-migrations.test.mjs +0 -87
  318. package/test/integration/runtime-status.integration.test.mjs +0 -227
  319. package/test/integration/sam-activity-recovery.test.mjs +0 -147
  320. package/test/integration/sam-decision.test.mjs +0 -584
  321. package/test/integration/sam-kernel.test.mjs +0 -99
  322. package/test/integration/sam-planning-astar.test.mjs +0 -279
  323. package/test/integration/scaffold-cloudflare.test.mjs +0 -46
  324. package/test/integration/skill-runtime.test.mjs +0 -240
  325. package/test/integration/storage-architecture.test.mjs +0 -154
  326. package/test/integration/store-discovery.test.mjs +0 -44
  327. package/test/integration/studio-fs-pty-e2e.test.mjs +0 -294
  328. package/test/integration/terminal-exec.integration.test.mjs +0 -86
  329. package/test/integration/theme-package-registry.test.mjs +0 -31
  330. package/test/integration/tool-runtime.test.mjs +0 -124
  331. package/test/integration/tool-schema.test.mjs +0 -59
  332. package/test/jr-dev-skill.test.mjs +0 -26
  333. package/test/knowledge-context-pack.test.mjs +0 -19
  334. package/test/knowledge-postgres.test.mjs +0 -40
  335. package/test/knowledge-service.test.mjs +0 -110
  336. package/test/knowledge.test.mjs +0 -206
  337. package/test/live/terminal-transport.live.test.mjs +0 -24
  338. package/test/local-sessions.test.mjs +0 -57
  339. package/test/local-studio-deploy.test.mjs +0 -83
  340. package/test/loopback-oauth.test.mjs +0 -53
  341. package/test/merkle-render.test.mjs +0 -31
  342. package/test/mini.test.mjs +0 -140
  343. package/test/model-catalog.test.mjs +0 -70
  344. package/test/models.test.mjs +0 -309
  345. package/test/npm10-lock.test.mjs +0 -29
  346. package/test/ollama.test.mjs +0 -137
  347. package/test/open-url.test.mjs +0 -64
  348. package/test/openai-responses.test.mjs +0 -155
  349. package/test/portable-context.test.mjs +0 -94
  350. package/test/project-config.test.mjs +0 -81
  351. package/test/project-rules.test.mjs +0 -44
  352. package/test/provider-credentials.test.mjs +0 -106
  353. package/test/rehydrate.test.mjs +0 -25
  354. package/test/release-hygiene.test.mjs +0 -42
  355. package/test/repository-snapshot-view.test.mjs +0 -112
  356. package/test/responses-runner.test.mjs +0 -465
  357. package/test/runtime-activity.test.mjs +0 -98
  358. package/test/sdk-worker-contract.test.mjs +0 -72
  359. package/test/security.test.mjs +0 -266
  360. package/test/setup-planner.test.mjs +0 -74
  361. package/test/setup-runtime.test.mjs +0 -51
  362. package/test/shell.test.mjs +0 -281
  363. package/test/skills.test.mjs +0 -22
  364. package/test/smoke.mjs +0 -122
  365. package/test/telemetry.test.mjs +0 -79
  366. package/test/terminal/local-pty.mock.test.mjs +0 -153
  367. package/test/terminal-machine-identity.test.mjs +0 -88
  368. package/test/theme-portability.test.mjs +0 -14
  369. package/test/tools-search.test.mjs +0 -73
  370. package/test/unit/website-assets-bindings.test.mjs +0 -60
  371. package/test/whoami-resume.test.mjs +0 -157
package/README.md CHANGED
@@ -114,6 +114,43 @@ The JavaScript/TypeScript parser records syntactic relationships, not a fully re
114
114
  semantic call graph. Model/dimension changes create a distinct embedding profile.
115
115
  Python-backed snapshots capture repository composition and Git churn.
116
116
 
117
+ ## Native Machine engine
118
+
119
+ AgentSam's deterministic Rust perception engine is also published independently
120
+ on crates.io. A clean machine does not need this repository checked out:
121
+
122
+ ```sh
123
+ cargo install agentsam-machine-cli
124
+ agentsam-machine --help
125
+ agentsam-machine inspect . --json
126
+ ```
127
+
128
+ The Cargo package is named `agentsam-machine-cli`; the installed executable is
129
+ `agentsam-machine`. Standalone Cargo installs normally place it in `~/.cargo/bin`.
130
+
131
+ The AgentSam npm CLI also owns one user-level Machine runtime shared by every
132
+ repository on that computer:
133
+
134
+ ```sh
135
+ agentsam machine status
136
+ agentsam machine install
137
+ agentsam machine update
138
+ agentsam machine doctor
139
+ ```
140
+
141
+ Managed versions live under `~/.agentsam/runtimes/machine/versions/<version>/`
142
+ with `current.json` selecting the active version. AgentSam resolves this managed
143
+ runtime before environment overrides, PATH binaries, or contributor source-tree
144
+ fallbacks. Projects keep their own evidence/state under `<repo>/.agentsam/`; they
145
+ do not install or choose a Machine executable.
146
+
147
+ The crates.io distribution is self-contained: the published CLI resolves the
148
+ published `agentsam-machine-core` crate by version. Deleting a local AgentSam SDK
149
+ checkout does not affect a registry installation. Install/update are explicit and
150
+ do not run just because a user enters a repository. Precompiled npm-native
151
+ platform binaries remain a separate future distribution lane; the current managed
152
+ installer uses Cargo and therefore requires a Rust/Cargo toolchain.
153
+
117
154
  ## Capability discovery and available kits
118
155
 
119
156
  The canonical machine-readable capability registry is available through `agentsam capabilities --json`
package/apps/README.md CHANGED
@@ -37,3 +37,28 @@ Rules:
37
37
  - The SDK root owns package/tooling release concerns; app workspace dependencies stay inside each app.
38
38
 
39
39
  Current product apps governed by the architecture test are `local-studio/`, `cad-creator/`, and `client-cms-editor/`. `frontend/` remains a public-site seed lane rather than a self-contained product workspace, and `_incoming/` is an import drop zone.
40
+
41
+ ## Portable packaging checklist
42
+
43
+ Run from the repository root before publishing an APP:
44
+
45
+ ```sh
46
+ npm run app:validate
47
+ npm run app:packaging
48
+ agentsam app package <app-id> --dry-run
49
+ ```
50
+
51
+ `app:packaging` audits every APP manifest in `apps/` and package-owned APP under `packages/`. It verifies the package name/manifest relationship, explicit npm `files` allowlists, app-owned lockfiles, CLI bins, frontend/backend package boundaries where declared, and excludes donor/reference/attachment payloads from packed artifacts. It does not download dependencies, build a frontend, deploy a Worker, or claim a release is ready.
52
+
53
+ For an app workspace, the release sequence is:
54
+
55
+ ```sh
56
+ cd apps/<app-id>
57
+ npm ci
58
+ npm run build
59
+ npm run typecheck --workspaces --if-present
60
+ npm test
61
+ npm pack --dry-run --json
62
+ ```
63
+
64
+ Frontend packages must publish compiled browser-safe assets only when they are intentionally public. Backend packages must keep secrets, `.dev.vars`, local databases, and host credentials out of `files`. Cloudflare Worker configuration remains backend-owned and is deployed separately from the npm tarball unless the app's package contract explicitly includes it.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/agentsam-cad-shared",
3
- "version": "2.6.7",
3
+ "version": "2.6.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/agentsam-cms-backend",
3
- "version": "2.6.7",
3
+ "version": "2.6.9",
4
4
  "description": "Internal CMS backend bridge (bundled into @inneranimalmedia/client-cms-editor \u2014 not published separately).",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,14 +14,11 @@
14
14
  "typecheck": "tsc --noEmit -p tsconfig.json"
15
15
  },
16
16
  "dependencies": {
17
- "@inneranimalmedia/agentsam-cms-shared": "2.6.7"
17
+ "@inneranimalmedia/agentsam-cms-shared": "2.6.9"
18
18
  },
19
19
  "devDependencies": {
20
20
  "typescript": "^5.9.3"
21
21
  },
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
22
  "repository": {
26
23
  "type": "git",
27
24
  "url": "git+https://github.com/SamPrimeaux/agentsam-sdk.git",
@@ -35,5 +32,6 @@
35
32
  "worker",
36
33
  "wrangler.jsonc"
37
34
  ]
38
- }
35
+ },
36
+ "private": true
39
37
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/agentsam-cms-frontend",
3
- "version": "2.6.7",
4
- "description": "Internal CMS frontend (bundled into @inneranimalmedia/client-cms-editor — not published separately).",
3
+ "version": "2.6.9",
4
+ "description": "Internal CMS frontend (bundled into @inneranimalmedia/client-cms-editor \u2014 not published separately).",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
@@ -15,8 +15,8 @@
15
15
  "test": "vitest run --passWithNoTests"
16
16
  },
17
17
  "dependencies": {
18
- "@inneranimalmedia/agentsam-cms-backend": "2.6.7",
19
- "@inneranimalmedia/agentsam-cms-shared": "2.6.7",
18
+ "@inneranimalmedia/agentsam-cms-backend": "2.6.9",
19
+ "@inneranimalmedia/agentsam-cms-shared": "2.6.9",
20
20
  "react": "^19.2.0",
21
21
  "react-dom": "^19.2.0"
22
22
  },
@@ -28,9 +28,6 @@
28
28
  "vite": "^6.4.3",
29
29
  "vitest": "^4.1.11"
30
30
  },
31
- "publishConfig": {
32
- "access": "public"
33
- },
34
31
  "repository": {
35
32
  "type": "git",
36
33
  "url": "git+https://github.com/SamPrimeaux/agentsam-sdk.git",
@@ -38,5 +35,6 @@
38
35
  },
39
36
  "files": [
40
37
  "src"
41
- ]
38
+ ],
39
+ "private": true
42
40
  }
@@ -20,17 +20,36 @@
20
20
  "preserveSymlinks": true,
21
21
  "baseUrl": ".",
22
22
  "paths": {
23
- "@inneranimalmedia/agentsam-cms-shared": ["../shared/cms/src/index.ts"],
24
- "@inneranimalmedia/agentsam-cms-shared/*": ["../shared/cms/src/*"],
25
- "@inneranimalmedia/agentsam-cms-backend/api": ["../backend/src/api/client.ts"],
26
- "@inneranimalmedia/agentsam-cms-backend/model": ["../backend/src/model.ts"],
27
- "@inneranimalmedia/agentsam-cms-backend/preview": ["../backend/src/preview/bridge.ts"],
28
- "@inneranimalmedia/agentsam-cms-backend/routing": ["../backend/src/routing/index.js"],
29
- "@inneranimalmedia/agentsam-cms-backend": ["../backend/src/index.ts"],
30
- "@inneranimalmedia/agentsam-cms-backend/*": ["../backend/src/*"]
23
+ "@inneranimalmedia/agentsam-cms-shared": [
24
+ "../shared/cms/src/index.ts"
25
+ ],
26
+ "@inneranimalmedia/agentsam-cms-shared/*": [
27
+ "../shared/cms/src/*"
28
+ ],
29
+ "@inneranimalmedia/agentsam-cms-backend/api": [
30
+ "../backend/src/api/client.ts"
31
+ ],
32
+ "@inneranimalmedia/agentsam-cms-backend/model": [
33
+ "../backend/src/model.ts"
34
+ ],
35
+ "@inneranimalmedia/agentsam-cms-backend/preview": [
36
+ "../backend/src/preview/bridge.ts"
37
+ ],
38
+ "@inneranimalmedia/agentsam-cms-backend/routing": [
39
+ "../backend/src/routing/index.js"
40
+ ],
41
+ "@inneranimalmedia/agentsam-cms-backend": [
42
+ "../backend/src/index.ts"
43
+ ],
44
+ "@inneranimalmedia/agentsam-cms-backend/*": [
45
+ "../backend/src/*"
46
+ ]
31
47
  }
32
48
  },
33
49
  "include": [
34
50
  "src"
51
+ ],
52
+ "exclude": [
53
+ "src/editor/legacy"
35
54
  ]
36
55
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/client-cms-editor",
3
- "version": "2.6.7",
3
+ "version": "2.6.9",
4
4
  "private": false,
5
5
  "description": "Reusable full-stack website + CMS kit with multi-page public sites, a protected authoring dashboard, local SQLite, starter/theme import, and pluggable auth, storage, and deployment adapters.",
6
6
  "type": "module",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inneranimalmedia/agentsam-cms-shared",
3
- "version": "2.6.7",
4
- "description": "Internal CMS shared contracts (bundled into @inneranimalmedia/client-cms-editor — not published separately).",
3
+ "version": "2.6.9",
4
+ "description": "Internal CMS shared contracts (bundled into @inneranimalmedia/client-cms-editor \u2014 not published separately).",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
@@ -17,9 +17,6 @@
17
17
  "devDependencies": {
18
18
  "typescript": "^5.9.3"
19
19
  },
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
20
  "repository": {
24
21
  "type": "git",
25
22
  "url": "git+https://github.com/SamPrimeaux/agentsam-sdk.git",
@@ -27,5 +24,6 @@
27
24
  },
28
25
  "files": [
29
26
  "src"
30
- ]
27
+ ],
28
+ "private": true
31
29
  }
@@ -0,0 +1,299 @@
1
+ # AgentSam Local Engine & Compute Audit Plan
2
+
3
+ **Audit date:** 2026-10-02 (UTC)
4
+ **Repository:** `@inneranimalmedia/agentsam-sdk`
5
+ **Branch:** `arena/01a0fae5-agentsam-sdk`
6
+ **Scope:** Apple Silicon inventory, portable local-engine contract, benchmark harness, and model/cache governance.
7
+
8
+ This is an implementation plan grounded in the current checkout. It deliberately does not claim that the repository's build host is an Apple Silicon machine or that any local engine is installed: those are runtime facts that the future audit command must discover on the operator's machine.
9
+
10
+ ## 1. Executive assessment
11
+
12
+ AgentSam already has useful foundations, but not the requested universal local-engine layer.
13
+
14
+ ### Existing strengths
15
+
16
+ - Local-first runtime and user-space ownership are established conventions. `~/.agentsam` is already used for managed Machine and AgentSam runtimes, while project state remains under `.agentsam/`.
17
+ - The repository has a strong deterministic-machinery boundary in `AGENTSAM.md`: inspectable evidence owns facts; models may augment but must not override capability evidence.
18
+ - Hardware identity primitives exist in `src/lib/terminal/machine-identity.js` and can normalize platform, architecture, hostname, and hardware model without a host-specific path.
19
+ - A managed native Machine runtime exists under `native/agentsam-machine`, with portable resolution/install logic in `src/commands/machine-binary.js` and `src/commands/machine-runtime.js`.
20
+ - Ollama is the only meaningful local model integration today. `src/commands/ollama.js` supports local setup/status/list/pull and `/api/tags` plus `/api/show` probing. `src/providers/ollama-chat.js` supports chat, tool calls, usage events, continuation state, and compaction.
21
+ - Model discovery and credential-scoped inventory already exist in `src/models/inventory-core.js`, `src/models/discovery.js`, `src/indexing/ingest/discover-models.js`, and `src/commands/models.js`.
22
+ - Existing provider adapters and telemetry/receipt primitives can be reused rather than creating a second model-router stack.
23
+ - The test layout already separates deterministic release-blocking suites from live-daemon tests, which is the correct pattern for local engines.
24
+
25
+ ### Missing or incomplete capabilities
26
+
27
+ - No `agentsam.local-engine.v1` schema, TypeScript/JavaScript contract, registry, or capability negotiation layer exists.
28
+ - No unified `discover()`, `capabilities()`, `chat()`, `embed()`, and `unload()` interface spans Ollama, MLX-LM, and llama.cpp.
29
+ - MLX-LM and llama.cpp/`llama-server` discovery and adapters are absent.
30
+ - Current Ollama support is a provider-specific command/adapter, not an engine implementation behind a capability-driven router.
31
+ - No deterministic Apple hardware audit covers chip family, core counts, unified memory, Metal feature set, or OS/toolchain evidence.
32
+ - No benchmark protocol or persistence format exists for TTFT, tokens/sec, VRAM/unified-memory use, repeatability, or structured-output validity.
33
+ - No GBNF/JSON validity evaluator exists, and the current Ollama adapter does not expose streaming timestamps required for TTFT.
34
+ - No storage auditor inventories `~/.agentsam` model assets, detects duplicate weights, or records references/links without copying model files.
35
+ - The current `~/.agentsam` convention is not yet centralized for all future engine/model paths; the new layer should use an injected home/root resolver and `AGENTSAM_HOME`, not scattered `os.homedir()` calls.
36
+ - Engine-specific routing is not yet capability-driven. Existing model inventory/provider code should remain compatible, but local engine selection needs to move behind an engine registry and normalized capability cards.
37
+
38
+ ## 2. Current repository map and authorities
39
+
40
+ | Concern | Current authority | Reuse in the build |
41
+ |---|---|---|
42
+ | Public SDK exports | `src/index.js`, package `exports` | Add stable local-engine exports only after contract tests |
43
+ | CLI dispatch/help | `src/cli.js`, `src/cli/command-catalog.js` | Add `engine`/`benchmark` commands without changing existing `ollama` behavior abruptly |
44
+ | Local Ollama setup | `src/commands/ollama.js` | Refactor into an Ollama engine adapter while retaining compatibility wrapper |
45
+ | Ollama chat/tools | `src/providers/ollama-chat.js` | Adapt to normalized chat stream/result and structured-output evidence |
46
+ | Local model catalog | `src/models/catalog.js`, `src/models/index.js` | Keep hosted catalog separate; add runtime-discovered local records |
47
+ | Provider/model discovery | `src/models/inventory-core.js`, `src/models/discovery.js` | Extend with local engine inventory, never expose credentials |
48
+ | Machine identity | `src/lib/terminal/machine-identity.js` | Base platform/arch identity; add Apple-specific read-only probes |
49
+ | Managed user runtime | `src/commands/machine-runtime.js` | Follow its `AGENTSAM_HOME` and versioned runtime pattern |
50
+ | Deterministic capabilities | `src/capabilities/` and capability manifest | Register local audit/benchmark capabilities with schemas and receipts |
51
+ | Receipts/usage | `src/telemetry/`, runtime SQLite/migrations | Persist benchmark metadata/results, not raw prompts or weight data by default |
52
+ | Tests | `test/`, `test/cli/`, `test/integration/`, `test/terminal/` | Add pure fakes and explicit opt-in live Apple/engine tiers |
53
+ | Protocol schemas | `protocol/` | Add versioned JSON schemas and validate them in tests/verification |
54
+
55
+ ## 3. Target architecture
56
+
57
+ ```text
58
+ CLI / SDK
59
+ └─ LocalEngineRegistry
60
+ ├─ AppleComputeAudit (read-only host facts)
61
+ ├─ Engine adapters
62
+ │ ├─ OllamaEngine
63
+ │ ├─ MlxLmEngine
64
+ │ └─ LlamaCppEngine
65
+ ├─ CapabilityNegotiator / policy
66
+ ├─ EngineRouter (capabilities, not engine names)
67
+ ├─ BenchmarkRunner
68
+ │ ├─ timing + token accounting
69
+ │ ├─ resource sampler
70
+ │ └─ JSON/GBNF validator
71
+ └─ AssetGovernance
72
+ ├─ ~/.agentsam/models manifest
73
+ ├─ path/link/reference inventory
74
+ └─ duplicate-weight detector
75
+ ```
76
+
77
+ ### Non-negotiable boundaries
78
+
79
+ 1. **Read-only audit:** inventory probes may execute bounded version/info commands and read system APIs, but must not install, start, stop, unload, mutate model files, or transmit prompts.
80
+ 2. **User-space ownership:** managed binaries, manifests, logs, and optional caches live below `${AGENTSAM_HOME:-$HOME/.agentsam}`. Large weights remain where the engine already owns them; record canonical paths, inode/file IDs where available, symlink/clone relationships, and hashes only when explicitly requested.
81
+ 3. **Capability-first routing:** routers ask for capabilities such as `chat.streaming`, `chat.tools`, `output.json_schema`, `embedding`, `model.unload`, `metrics.memory`, and `format.gguf`; they do not branch on `provider === 'mlx'` in core execution code.
82
+ 4. **No implicit network:** local-engine discovery and benchmark commands default to loopback/local process probes. Any remote endpoint requires explicit configuration and is marked non-local in receipts.
83
+ 5. **Truthful unknowns:** unsupported metrics are `null` with an evidence/status reason, never guessed. Apple unified memory is not mislabeled as discrete VRAM.
84
+ 6. **Safe process control:** argv arrays, bounded timeouts, process-group cleanup, no shell interpolation, redacted errors, and explicit approval for launch/pull/unload actions.
85
+
86
+ ## 4. Contract proposal: `agentsam.local-engine.v1`
87
+
88
+ Add:
89
+
90
+ - `protocol/local-engine/engine.v1.schema.json`
91
+ - `protocol/local-engine/capability-card.v1.schema.json`
92
+ - `protocol/local-engine/chat-result.v1.schema.json`
93
+ - `protocol/local-engine/embed-result.v1.schema.json`
94
+ - `protocol/local-engine/inventory.v1.schema.json`
95
+ - `src/local-engine/contracts.js`
96
+ - `src/local-engine/registry.js`
97
+ - `src/local-engine/errors.js`
98
+
99
+ The JS contract should be dependency-light and usable from Node hosts; adapters can use Node process APIs behind the host boundary.
100
+
101
+ ```js
102
+ const engine = {
103
+ id: 'ollama',
104
+ version: '...',
105
+ discover: async ({ signal }) => inventory,
106
+ capabilities: async ({ model, signal }) => capabilityCard,
107
+ chat: async ({ model, messages, tools, responseFormat, stream, signal, onEvent }) => chatResult,
108
+ embed: async ({ model, inputs, signal }) => embedResult,
109
+ unload: async ({ model, signal }) => unloadResult,
110
+ };
111
+ ```
112
+
113
+ Every result includes `schema_version`, `engine_id`, `model`, `status`, `evidence`, and normalized error information. Capability cards should describe support and evidence, for example:
114
+
115
+ - `chat`, `chat.streaming`, `chat.tools`
116
+ - `embed`, `embed.batch`
117
+ - `output.json`, `output.json_schema`, `output.grammar`
118
+ - `model.unload`, `model.load`
119
+ - `metrics.ttft`, `metrics.tokens_per_second`, `metrics.memory`
120
+ - `format.gguf`, `format.safetensors`, `runtime.metal`, `runtime.mlx`
121
+
122
+ The contract must distinguish `supported`, `unsupported`, `unknown`, and `available_now`; an engine can support JSON schema in principle while a selected model/backend does not.
123
+
124
+ ## 5. Hardware and engine inventory implementation
125
+
126
+ ### 5.1 Cross-platform host audit
127
+
128
+ The compute audit is universal. Apple Silicon is a high-value specialization, not the host assumption. Implement platform modules behind one `auditHost()` dispatcher with injectable command/filesystem readers:
129
+
130
+ - **macOS:** Apple Silicon, unified memory, Metal, system profiler, and MLX evidence.
131
+ - **Linux:** distribution/kernel, CPU topology, system memory, NVIDIA/AMD accelerator discovery when vendor tools are present, and shell/runtime inventory.
132
+ - **Windows:** PowerShell or `pwsh`, WMI/CIM hardware facts, GPU controller discovery, system memory, and shell/runtime inventory.
133
+ - **Other platforms:** return normalized host identity and explicit unavailable fields; never emulate Apple/VRAM facts.
134
+
135
+ All platform implementations must report `vram_bytes: null` unless a vendor/API probe provides a defensible value. PowerShell, Bash, Zsh, and POSIX shell availability are inventory facts, not engine assumptions.
136
+
137
+ ### 5.2 Apple Silicon audit
138
+
139
+ Implement the macOS specialization with injectable command/filesystem readers. On macOS, collect only available facts using bounded probes:
140
+
141
+ - `uname`/Node OS facts: platform, kernel, architecture, Rosetta indicators.
142
+ - `sysctl`: `hw.model`, `hw.memsize`, CPU brand/core counts where available.
143
+ - `system_profiler SPHardwareDataType SPDisplaysDataType`: chip/GPU and display/Metal-adjacent evidence, parsed defensively.
144
+ - `ioreg` or supported system APIs only when needed and documented.
145
+ - Metal capability probe as a small signed/managed helper or native Machine extension, not an unbounded shell scrape.
146
+
147
+ Normalize to `chip_family`, `chip_generation`, `gpu_cores`, `performance_cores`, `efficiency_cores`, `unified_memory_bytes`, `metal_features`, and `evidence[]`. Mark memory as `unified_memory`, with `vram_bytes: null` unless a platform-specific measurement is genuinely available.
148
+
149
+ ### 5.2 Engine discovery
150
+
151
+ Each adapter gets a read-only `discover()` implementation:
152
+
153
+ - **Ollama:** binary/version, configured endpoint, `/api/version`, `/api/tags`, per-model `/api/show`; preserve current local-only endpoint semantics.
154
+ - **MLX-LM:** discover managed binary/module and PATH commands, version, model roots, server/listen endpoint if running, and whether Metal/MLX is importable. Do not assume a Python environment or install dependencies during discovery.
155
+ - **llama.cpp:** discover `llama-server`/`llama-cli`, version/help feature evidence, running server health, model path(s), GGUF metadata where readable. Keep command names configurable because package managers vary.
156
+
157
+ Discovery output must include `installed`, `reachable`, `version`, `models`, `capabilities`, `source`, `paths` (redacted/portable as appropriate), and `warnings`.
158
+
159
+ ## 6. Benchmark harness: `agentsam.engine.benchmark.v1`
160
+
161
+ Add a separate harness, not a hidden side effect of chat routing:
162
+
163
+ - `src/local-engine/benchmark/runner.js`
164
+ - `src/local-engine/benchmark/timing.js`
165
+ - `src/local-engine/benchmark/resources.js`
166
+ - `src/local-engine/benchmark/structured-output.js`
167
+ - `protocol/local-engine/benchmark.v1.schema.json`
168
+ - CLI: `agentsam engine benchmark <engine|all> [--model ...] [--json]`
169
+
170
+ ### Measurement rules
171
+
172
+ - Warmup runs are separate from measured runs and reported.
173
+ - Use a monotonic clock. TTFT is request-send to first non-empty model token/event; tokens/sec uses generated tokens and excludes setup time, with an explicit fallback when token counts are unavailable.
174
+ - Capture load time separately from generation time.
175
+ - Resource sampling is engine/platform-specific. On Apple Silicon, report unified-memory current/peak if measurable and `unknown` otherwise; do not call it VRAM without evidence.
176
+ - Capture engine/model revision, prompt fixture ID/hash, options, temperature/seed, run count, OS/hardware audit reference, and timestamp.
177
+ - Never persist full prompts or generated output by default. Store fixture IDs/hashes and validation summaries; allow an explicit `--include-output` diagnostic mode with redaction policy.
178
+ - Repeatability requires fixed seed/options where supported, isolated model state where possible, and a declared warm/cold mode.
179
+
180
+ ### Structured-output validity
181
+
182
+ Provide canonical fixtures for:
183
+
184
+ 1. plain JSON object,
185
+ 2. nested JSON with arrays and optional values,
186
+ 3. AgentSam tool-call envelope,
187
+ 4. invalid/truncated output.
188
+
189
+ Validate with JSON parsing plus JSON Schema (and grammar/GBNF enforcement evidence where the engine supports it). Report `valid`, `parse_error`, `schema_error`, `grammar_enforced`, and `tool_arguments_valid`. Do not infer GBNF enforcement from valid output alone.
190
+
191
+ ## 7. Cache and storage governance
192
+
193
+ Create a user-space asset manifest, for example `${AGENTSAM_HOME}/models/manifest.v1.json`, containing model identity, engine ownership, source URI/provider, revision/digest, format, size, canonical path, link/reference type, and last-seen timestamp.
194
+
195
+ Governance operations:
196
+
197
+ - `agentsam engine assets audit [--json]` — read-only inventory.
198
+ - `agentsam engine assets adopt <path>` — record an existing asset; never copy by default.
199
+ - `agentsam engine assets verify` — check existence/size/digest according to policy.
200
+ - `agentsam engine assets gc --plan` — produce a deletion plan only; deletion requires explicit confirmation.
201
+
202
+ Default search roots are engine-reported and user-configurable, not hardcoded host paths. Use `AGENTSAM_HOME`, XDG conventions where applicable, and engine APIs. Deduplication should prefer references/symlinks/engine-native stores; never duplicate multi-GB weight files merely to make them “managed.”
203
+
204
+ Security requirements: do not follow symlinks outside an approved root without explicit opt-in, avoid reading credential files, redact home paths in portable receipts unless `--verbose`, and hash incrementally with a bounded resource policy.
205
+
206
+ ## 8. Router and model integration plan
207
+
208
+ 1. Introduce `LocalEngineRegistry` and register Ollama first behind the new interface.
209
+ 2. Add a normalized local model record source to inventory; preserve current hosted `MODEL_CATALOG` semantics.
210
+ 3. Update model selection to filter by capability cards (`chat`, `embed`, tools, structured output, context limits), not engine-specific conditionals.
211
+ 4. Adapt `createOllamaChatAdapter` to implement the contract and preserve current telemetry/provider-state behavior.
212
+ 5. Add MLX-LM and llama.cpp adapters only after contract tests and subprocess safety utilities exist.
213
+ 6. Make the agent runner accept an engine-resolved adapter through dependency injection. Core routers must not import MLX, llama.cpp, or Ollama modules.
214
+ 7. Keep `agentsam ollama` as a compatibility command; add `agentsam engine status`, `agentsam engine audit`, and `agentsam engine benchmark` as the universal surface.
215
+
216
+ ## 9. Delivery sequence
217
+
218
+ ### Phase 0 — Contract and safety foundation
219
+
220
+ - Freeze schemas, error vocabulary, capability identifiers, home/path resolver, subprocess runner, redaction rules.
221
+ - Add schema fixtures and registry tests.
222
+ - Add an architecture guard that rejects absolute operator paths and engine imports from core routers.
223
+
224
+ ### Phase 1 — Inventory MVP
225
+
226
+ - Apple audit with mocked command fixtures and a real macOS smoke test that skips off macOS.
227
+ - Ollama adapter discovery migrated from existing code.
228
+ - `agentsam engine audit --json` with honest unavailable/unknown states.
229
+ - Asset manifest read-only audit.
230
+
231
+ ### Phase 2 — Unified Ollama execution
232
+
233
+ - Contract-backed chat/embed/unload behavior.
234
+ - Streaming event timestamps and normalized usage.
235
+ - JSON/tool-schema validation fixtures.
236
+ - Router injection and compatibility tests.
237
+
238
+ ### Phase 3 — MLX-LM and llama.cpp
239
+
240
+ - Read-only discovery first, then chat/embed adapters.
241
+ - Explicit format/model capability negotiation.
242
+ - Process lifecycle, unload, crash diagnostics, and model path governance.
243
+
244
+ ### Phase 4 — Benchmarks and receipts
245
+
246
+ - Warm/cold benchmark runner, resource samplers, structured-output suite.
247
+ - Versioned benchmark receipts and comparison command.
248
+ - Opt-in live tests on Apple Silicon and installed daemons; never release-blocking.
249
+
250
+ ### Phase 5 — Graduation and packaging
251
+
252
+ - Pack/clean-room consumer tests verify exports and CLI behavior.
253
+ - Full release gate: unit, CLI, mocked integration, terminal mock, workspaces, package/boundary/bootstrap/security checks.
254
+ - Document supported combinations truthfully; unsupported hosts/engines remain discoverable as unavailable, not silently emulated.
255
+
256
+ ## 10. Test matrix and acceptance criteria
257
+
258
+ ### Release-blocking deterministic tests
259
+
260
+ - contract/schema normalization and capability negotiation
261
+ - Apple parser fixtures for M1/M2/M3/M4 and non-Apple hosts
262
+ - subprocess argv, timeout, signal, redaction, and path portability
263
+ - fake Ollama/MLX/llama.cpp servers and process adapters
264
+ - chat/embed/unload lifecycle and error mapping
265
+ - JSON Schema/tool argument/GBNF evidence evaluation
266
+ - benchmark math using deterministic clocks and token/resource samples
267
+ - asset governance: no-copy adoption, duplicate detection, symlink boundaries, manifest migration
268
+ - CLI JSON/text snapshots and packed export checks
269
+
270
+ ### Explicit live tests
271
+
272
+ - macOS Apple Silicon hardware audit
273
+ - installed MLX-LM, `llama-server`, and Ollama discovery
274
+ - actual model generation/embedding and unload behavior
275
+ - memory sampling and Metal capability helper
276
+ - benchmark execution against user-selected models
277
+
278
+ ### Definition of done
279
+
280
+ - All new public schemas, exports, docs, CLI entries, and tests agree.
281
+ - `npm test` and the affected workspace/release gates pass without a local daemon or Apple host.
282
+ - Live engine tests are opt-in, clearly labeled, and skipped with an honest reason when unavailable.
283
+ - No absolute operator paths, credentials, model weights, or machine-specific assumptions enter source, fixtures, or shipped receipts.
284
+ - Core routers consume capability cards and injected engine adapters, with no hardcoded engine-specific branching.
285
+ - A clean-room packed install can run discovery/status without this monorepo, private paths, or pre-existing model files.
286
+
287
+ ## 11. Recommended first implementation slice
288
+
289
+ The safest first PR should be **Phase 0 + Phase 1**, limited to:
290
+
291
+ 1. versioned local-engine and inventory schemas;
292
+ 2. `LocalEngineRegistry` plus a fake engine;
293
+ 3. portable `AGENTSAM_HOME`/asset manifest utilities;
294
+ 4. Apple audit parser with fixtures and non-macOS skip behavior;
295
+ 5. Ollama discovery adapter wrapping current probes;
296
+ 6. `agentsam engine audit --json` and focused tests;
297
+ 7. this plan plus protocol README and support matrix.
298
+
299
+ Do not begin by installing MLX, downloading model weights, or changing the model router. Establish the contract and evidence model first; then each engine can be added without weakening portability or the release gate.