@inneranimalmedia/agentsam-sdk 2.6.5 → 2.6.8

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 (400) hide show
  1. package/AGENTSAM.md +29 -0
  2. package/README.md +37 -0
  3. package/apps/README.md +5 -0
  4. package/apps/cad-creator/README.md +4 -4
  5. package/apps/cad-creator/shared/cad/package.json +1 -1
  6. package/apps/client-cms-editor/AGENTS.md +12 -7
  7. package/apps/client-cms-editor/README.md +76 -48
  8. package/apps/client-cms-editor/agentsam.app.json +26 -9
  9. package/apps/client-cms-editor/backend/package.json +20 -3
  10. package/apps/client-cms-editor/backend/src/api/client.ts +134 -101
  11. package/apps/client-cms-editor/backend/src/index.ts +1 -1
  12. package/apps/client-cms-editor/backend/src/model.ts +11 -115
  13. package/apps/client-cms-editor/backend/src/preview/bridge.ts +1 -1
  14. package/apps/client-cms-editor/backend/tsconfig.json +6 -1
  15. package/apps/client-cms-editor/bin/agentsam-cms.js +262 -0
  16. package/apps/client-cms-editor/bin/agentsam-cms.mjs +2 -228
  17. package/apps/client-cms-editor/frontend/package.json +16 -7
  18. package/apps/client-cms-editor/frontend/src/AgentSamDrawer.tsx +9 -41
  19. package/apps/client-cms-editor/frontend/src/CmsAgentSurface.tsx +19 -174
  20. package/apps/client-cms-editor/frontend/src/adapters/heuristic.ts +29 -0
  21. package/apps/client-cms-editor/frontend/src/adapters/http.ts +628 -0
  22. package/apps/client-cms-editor/frontend/src/adapters/memory.ts +510 -0
  23. package/apps/client-cms-editor/frontend/src/editor/CmsEditor.tsx +213 -0
  24. package/apps/client-cms-editor/frontend/src/editor/CmsEditorProvider.tsx +20 -0
  25. package/apps/client-cms-editor/frontend/src/editor/canvas/PreviewCanvas.tsx +53 -0
  26. package/apps/client-cms-editor/frontend/src/{CmsEditor.tsx → editor/legacy/CmsEditorPrototype.tsx} +52 -23
  27. package/apps/client-cms-editor/frontend/src/editor/useCmsEditorController.ts +218 -0
  28. package/apps/client-cms-editor/frontend/src/index.ts +19 -5
  29. package/apps/client-cms-editor/frontend/src/lib/agent-host.ts +24 -0
  30. package/apps/client-cms-editor/frontend/src/main.tsx +82 -8
  31. package/apps/client-cms-editor/frontend/src/mount.tsx +92 -30
  32. package/apps/client-cms-editor/frontend/src/styles/agentsam-drawer.css +1 -1
  33. package/apps/client-cms-editor/frontend/src/styles/cmsShell.css +8 -8
  34. package/apps/client-cms-editor/frontend/src/styles/studio.css +55 -3
  35. package/apps/client-cms-editor/frontend/tsconfig.json +12 -1
  36. package/apps/client-cms-editor/frontend/vite.config.ts +12 -0
  37. package/apps/client-cms-editor/package-lock.json +973 -134
  38. package/apps/client-cms-editor/package.json +118 -6
  39. package/apps/client-cms-editor/reference/harvest/HARVEST_RECEIPT.json +201 -0
  40. package/apps/client-cms-editor/reference/harvest/PROVENANCE_HISTORY.txt +10 -0
  41. package/apps/client-cms-editor/reference/harvest/README.md +8 -0
  42. package/apps/client-cms-editor/reference/harvest/plans/ARCHIVE-INTAKE.md +135 -0
  43. package/apps/client-cms-editor/reference/harvest/plans/CHATGPT-IDENTITY-HARVEST.md +83 -0
  44. package/apps/client-cms-editor/reference/harvest/plans/CMS-EDITOR-HARVEST.md +166 -0
  45. package/apps/client-cms-editor/reference/harvest/plans/HARVEST-INDEX.md +196 -0
  46. package/apps/client-cms-editor/reference/harvest/plans/INNERANIMALS-CONTENT-001.md +137 -0
  47. package/apps/client-cms-editor/reference/harvest/plans/NO-IMPLICIT-SIDE-EFFECTS.md +87 -0
  48. package/apps/client-cms-editor/reference/harvest/plans/STOREFRONT-SURFACE-MAP.md +140 -0
  49. package/apps/client-cms-editor/reference/harvest/plans/THEME-INNERANIMALS-HARVEST.md +137 -0
  50. package/apps/client-cms-editor/reference/harvest/plans/TOOLING-LAB.md +63 -0
  51. package/apps/client-cms-editor/reference/harvest/plans/harvest-manifest.json +97 -0
  52. package/apps/client-cms-editor/reference/harvest/plans/local-cms-harvest-schema.sql +328 -0
  53. package/apps/client-cms-editor/shared/cms/package.json +17 -7
  54. package/apps/client-cms-editor/shared/cms/src/adapter.ts +204 -0
  55. package/apps/client-cms-editor/shared/cms/src/agent-context.ts +7 -5
  56. package/apps/client-cms-editor/shared/cms/src/editor-types.ts +32 -0
  57. package/apps/client-cms-editor/shared/cms/src/host.ts +82 -0
  58. package/apps/client-cms-editor/shared/cms/src/index.ts +4 -0
  59. package/apps/client-cms-editor/shared/cms/src/map.ts +115 -0
  60. package/apps/client-cms-editor/shared/cms/src/starter-pack.ts +158 -0
  61. package/contracts/source-types.v1.json +353 -0
  62. package/docs/CMS_CONTEXTUAL_COMPOSER.md +1 -1
  63. package/docs/PRODUCT_LIFECYCLE.md +566 -0
  64. package/docs/REPO_FILE_MAP.txt +132 -0
  65. package/docs/THEME_REFINERY.md +2 -2
  66. package/docs/architecture/AGENTSAM_RUNTIME_PROTOCOL.md +40 -20
  67. package/docs/content-studio/REVISION_GATE_2026-09-27.md +1 -1
  68. package/docs/plans/LOCAL_STUDIO_DESKTOP_RELEASE_2026-09-29.md +150 -0
  69. package/migrations/d1/0017_identity_native_oauth.sql +21 -0
  70. package/migrations/d1/0018_goap_control_plane_remaster.sql +40 -0
  71. package/migrations/d1/0019_agentsam_agent_run_plan_todo.sql +14 -0
  72. package/migrations/d1/README_PORTABLE_CONTROL_PLANE.md +20 -9
  73. package/migrations/runtime/0002_goap_blackboard_v1.sql +15 -0
  74. package/migrations/runtime/0004_agent_run_plan_linkage.sql +8 -0
  75. package/native/agentsam-machine/Cargo.lock +426 -0
  76. package/native/agentsam-machine/Cargo.toml +9 -0
  77. package/native/agentsam-machine/cli/Cargo.toml +21 -0
  78. package/native/agentsam-machine/cli/README.md +21 -0
  79. package/native/agentsam-machine/cli/src/main.rs +77 -0
  80. package/native/agentsam-machine/core/Cargo.toml +22 -0
  81. package/native/agentsam-machine/core/README.md +14 -0
  82. package/native/agentsam-machine/core/build.rs +33 -0
  83. package/native/agentsam-machine/core/contracts/source-types.v1.json +353 -0
  84. package/native/agentsam-machine/core/src/assets.rs +790 -0
  85. package/native/agentsam-machine/core/src/bound.rs +298 -0
  86. package/native/agentsam-machine/core/src/enrich.rs +706 -0
  87. package/native/agentsam-machine/core/src/frontend.rs +442 -0
  88. package/native/agentsam-machine/core/src/lib.rs +1092 -0
  89. package/native/agentsam-machine/core/src/liquid.rs +528 -0
  90. package/native/agentsam-machine/core/src/source_types.rs +78 -0
  91. package/package.json +64 -24
  92. package/packages/agentsam-brand/README.md +1 -1
  93. package/packages/agentsam-brand/package.json +4 -4
  94. package/packages/agentsam-brand/src/index.js +1 -1
  95. package/packages/agentsam-contracts/package.json +13 -3
  96. package/packages/agentsam-contracts/src/tools.ts +22 -0
  97. package/packages/agentsam-errors/package.json +13 -3
  98. package/packages/agentsam-errors/src/index.js +1 -0
  99. package/packages/agentsam-errors/src/tool.js +56 -0
  100. package/packages/agentsam-errors/test/tool.test.mjs +58 -0
  101. package/packages/agentsam-goap/README.md +52 -0
  102. package/packages/agentsam-goap/package.json +37 -0
  103. package/packages/agentsam-goap/src/adapters/d1-sqlite.js +570 -0
  104. package/packages/agentsam-goap/src/adapters/memory.js +199 -0
  105. package/packages/agentsam-goap/src/contracts.js +226 -0
  106. package/packages/agentsam-goap/src/control-plane.js +112 -0
  107. package/packages/agentsam-goap/src/errors.js +157 -0
  108. package/packages/agentsam-goap/src/index.js +5 -0
  109. package/packages/agentsam-goap/src/world.js +202 -0
  110. package/packages/agentsam-goap/test/goap-control-plane.test.mjs +245 -0
  111. package/packages/agentsam-goap/test/world.test.mjs +79 -0
  112. package/packages/agentsam-knowledge/package.json +18 -4
  113. package/packages/agentsam-knowledge/src/autorag/index.js +10 -3
  114. package/packages/agentsam-knowledge/src/backends/index.js +33 -1
  115. package/packages/agentsam-knowledge/test/autorag.test.mjs +60 -1
  116. package/packages/agentsam-nav/dist/browser.global.js +21 -18
  117. package/packages/agentsam-nav/dist/browser.js +6807 -130
  118. package/packages/agentsam-nav/dist/index.js +6799 -122
  119. package/packages/agentsam-nav/package.json +24 -6
  120. package/packages/agentsam-queue-control/README.md +1 -1
  121. package/packages/agentsam-queue-control/package.json +7 -2
  122. package/packages/agentsam-rapid-rust/src/main.rs +1 -1
  123. package/packages/agentsam-repository/package.json +13 -3
  124. package/packages/agentsam-repository/src/goap.js +13 -14
  125. package/packages/agentsam-repository/src/source-types.js +8 -0
  126. package/packages/agentsam-repository/src/tickets.js +15 -22
  127. package/packages/agentsam-repository/test/goap-tickets-workspace-state.test.mjs +19 -8
  128. package/packages/agentsam-vault/package.json +14 -4
  129. package/packages/agentsam-workbench/package.json +15 -4
  130. package/packages/agentsam-workbench/src/agent/ToolPermissionRequest.tsx +94 -0
  131. package/packages/agentsam-workbench/src/agent/index.ts +2 -0
  132. package/packages/agentsam-workbench/src/agent/tool-permission.css +134 -0
  133. package/packages/connectors/cloudflare/package.json +15 -3
  134. package/packages/connectors/cloudflare/src/api-client.js +3 -2
  135. package/packages/connectors/cloudflare/src/families/vectorize.js +127 -0
  136. package/packages/connectors/cloudflare/src/index.js +1 -0
  137. package/packages/heuristic-theme/README.md +2 -2
  138. package/packages/heuristic-theme/package.json +8 -3
  139. package/packages/heuristic-theme/src/registry.js +2 -2
  140. package/packages/heuristic-theme/src/theme.js +1 -1
  141. package/packages/heuristic-theme/test/theme.test.mjs +1 -1
  142. package/packages/identity/.agentsam/features/oauth-login-portal/agentsam.feature.json +1 -1
  143. package/packages/identity/.agentsam/features/oauth-login-portal/providers.json +27 -7
  144. package/packages/identity/README.md +2 -2
  145. package/packages/identity/migrations/D1_SCHEMA_MAPPING.md +18 -15
  146. package/packages/identity/migrations/apply-portable.js +109 -0
  147. package/packages/identity/migrations/sqlite/004_identity_oauth_consent_catalog.sql +1 -1
  148. package/packages/identity/migrations/sqlite/005_identity_company_native.sql +52 -0
  149. package/packages/identity/package.json +27 -6
  150. package/packages/identity/schema/agentsam.identity/manifest.json +101 -0
  151. package/packages/identity/scripts/local-identity-bridge.mjs +13 -7
  152. package/packages/identity/scripts/preview-auth-portal.mjs +6 -6
  153. package/packages/identity/src/adapters/cloudflare-d1/index.js +8 -401
  154. package/packages/identity/src/adapters/iam-compat/index.js +540 -0
  155. package/packages/identity/src/adapters/portable-d1/index.js +18 -0
  156. package/packages/identity/src/adapters/portable-store.js +479 -0
  157. package/packages/identity/src/adapters/sqlite/index.js +13 -312
  158. package/packages/identity/src/contracts/auth-config.js +0 -1
  159. package/packages/identity/src/contracts/identity-store.js +56 -5
  160. package/packages/identity/src/contracts/provider.js +1 -0
  161. package/packages/identity/src/contracts/sign-in-options.js +104 -0
  162. package/packages/identity/src/core/constants.js +1 -1
  163. package/packages/identity/src/core/session-policy.js +31 -0
  164. package/packages/identity/src/frontend/auth-portal/pages/login.html +6 -6
  165. package/packages/identity/src/frontend/auth-portal/pages/reset.html +5 -5
  166. package/packages/identity/src/frontend/auth-portal/pages/signup.html +5 -5
  167. package/packages/identity/src/frontend/auth-portal/shared/company-branding.js +1 -1
  168. package/packages/identity/src/frontend/auth-portal/shared/desktop-identity-bridge.js +6 -37
  169. package/packages/identity/src/index.js +28 -1
  170. package/packages/identity/src/migrations/README.md +23 -23
  171. package/packages/identity/src/oauth/README.md +1 -1
  172. package/packages/identity/src/oauth/credentials.js +10 -11
  173. package/packages/identity/src/oauth/google-desktop-exchange.js +195 -27
  174. package/packages/identity/src/oauth/iam-platform.js +21 -9
  175. package/packages/identity/src/oauth/native-handoff.js +136 -0
  176. package/packages/identity/src/providers/chatgpt/headers.js +65 -0
  177. package/packages/identity/src/providers/chatgpt/index.js +86 -0
  178. package/packages/identity/src/providers/chatgpt/mapper.js +43 -0
  179. package/packages/identity/src/providers/chatgpt/paths.js +45 -0
  180. package/packages/identity/src/providers/github/oauth.js +1 -2
  181. package/packages/identity/src/providers/github/profile.js +16 -2
  182. package/packages/identity/src/providers/index.js +11 -3
  183. package/packages/identity/src/server/identity-service.js +2 -1
  184. package/packages/identity/src/server/worker-router.js +71 -18
  185. package/packages/identity/tests/chatgpt-provider.test.mjs +75 -0
  186. package/packages/identity/tests/google-desktop-identity-login.test.mjs +210 -0
  187. package/packages/identity/tests/identity-init-scaffold.test.mjs +15 -4
  188. package/packages/identity/tests/lane1-identity-store-parity.test.mjs +527 -0
  189. package/packages/identity/tests/lane1-packed-consumer.test.mjs +175 -0
  190. package/packages/identity/tests/native-oauth-handoff.test.mjs +292 -0
  191. package/packages/identity/tests/oauth-credentials.test.mjs +4 -4
  192. package/packages/identity/tests/preview-auth-portal.test.mjs +4 -2
  193. package/packages/identity/tests/session-routes-policy.test.mjs +13 -1
  194. package/packages/identity/tests/worker-runtime-boundary.test.mjs +11 -0
  195. package/packages/providers/completeful/package.json +7 -2
  196. package/packages/theme-church-site/package.json +17 -6
  197. package/packages/theme-church-site/src/harvest.json +4 -2
  198. package/packages/theme-church-site/src/index.js +7 -3
  199. package/packages/theme-church-site/test/theme.test.mjs +4 -2
  200. package/packages/theme-companions-site/package.json +17 -6
  201. package/packages/theme-companions-site/src/harvest.json +4 -2
  202. package/packages/theme-companions-site/src/index.js +7 -3
  203. package/packages/theme-companions-site/test/theme.test.mjs +4 -2
  204. package/packages/theme-floors-site/package.json +17 -6
  205. package/packages/theme-floors-site/src/harvest.json +4 -2
  206. package/packages/theme-floors-site/src/index.js +7 -3
  207. package/packages/theme-floors-site/test/theme.test.mjs +4 -2
  208. package/packages/theme-fuelnfree-site/package.json +17 -6
  209. package/packages/theme-fuelnfree-site/src/harvest.json +4 -2
  210. package/packages/theme-fuelnfree-site/src/index.js +7 -3
  211. package/packages/theme-fuelnfree-site/test/theme.test.mjs +4 -2
  212. package/packages/theme-handyman-site/package.json +17 -6
  213. package/packages/theme-handyman-site/src/harvest.json +4 -2
  214. package/packages/theme-handyman-site/src/index.js +7 -3
  215. package/packages/theme-handyman-site/test/theme.test.mjs +4 -2
  216. package/packages/theme-insurance-site/package.json +17 -6
  217. package/packages/theme-insurance-site/src/harvest.json +4 -2
  218. package/packages/theme-insurance-site/src/index.js +7 -3
  219. package/packages/theme-insurance-site/test/theme.test.mjs +4 -2
  220. package/packages/theme-scenes/README.md +1 -1
  221. package/packages/theme-scenes/package.json +4 -3
  222. package/packages/theme-scenes/src/registry.js +187 -0
  223. package/packages/theme-shinshu-site/package.json +17 -6
  224. package/packages/theme-shinshu-site/src/harvest.json +4 -2
  225. package/packages/theme-shinshu-site/src/index.js +7 -3
  226. package/packages/theme-shinshu-site/test/theme.test.mjs +4 -2
  227. package/packages/work-graph/package.json +14 -4
  228. package/protocol/FILEMETA_V1.md +2 -2
  229. package/protocol/capabilities/manifest.json +1 -1
  230. package/protocol/database/agentsam.schema-pack.v1.schema.json +72 -0
  231. package/protocol/presets/catalog.json +2 -2
  232. package/protocol/theme-refinery/lineage-registry.json +105 -0
  233. package/protocol/theme-refinery/product-metadata.schema.json +21 -1
  234. package/python/agentsam_sdk/repository/intelligence/discovery.py +27 -2
  235. package/python/agentsam_sdk/repository/intelligence/git.py +4 -0
  236. package/python/tests/test_repository_intelligence.py +30 -0
  237. package/src/cli/command-catalog.js +48 -5
  238. package/src/cli/dispatch.js +1 -0
  239. package/src/cli.js +20 -1
  240. package/src/cloudflare/runtime-status.js +2 -1
  241. package/src/commands/autorag.js +67 -13
  242. package/src/commands/cheat-sheet.js +29 -4
  243. package/src/commands/codebaseindex.js +45 -2
  244. package/src/commands/goap-world.js +134 -0
  245. package/src/commands/goap.js +11 -4
  246. package/src/commands/knowledge.js +59 -2
  247. package/src/commands/machine-binary.js +109 -0
  248. package/src/commands/machine-runtime.js +266 -0
  249. package/src/commands/machine.js +208 -0
  250. package/src/commands/package.js +530 -0
  251. package/src/commands/plan-ledger.js +370 -0
  252. package/src/commands/plan.js +183 -0
  253. package/src/commands/security.js +67 -4
  254. package/src/commands/setup.js +33 -16
  255. package/src/commands/skill.js +78 -17
  256. package/src/commands/status.js +8 -1
  257. package/src/features/resolve.js +1 -0
  258. package/src/knowledge/engine.js +21 -2
  259. package/src/knowledge/runtime-discovery.js +127 -0
  260. package/src/knowledge/source.js +1 -1
  261. package/src/lib/identity-scaffold.js +53 -13
  262. package/src/lib/setup/recipes.js +1 -1
  263. package/src/lib/slash-commands.js +1 -1
  264. package/src/local/runtime-store.js +24 -2
  265. package/src/local/sqlite.js +17 -0
  266. package/src/models/discovery.js +40 -22
  267. package/src/models/inventory-core.d.ts +105 -0
  268. package/src/models/inventory-core.js +54 -6
  269. package/src/sam/operations/package-audit.js +41 -0
  270. package/src/sam/seed.js +2 -0
  271. package/src/security/logs.js +3 -0
  272. package/src/ui/cli/help.js +41 -0
  273. package/apps/client-cms-editor/backend/src/demo-bootstrap.ts +0 -145
  274. package/test/account-session.test.mjs +0 -101
  275. package/test/agent-capabilities.test.mjs +0 -67
  276. package/test/app-authority-context.test.mjs +0 -32
  277. package/test/app-building-skills.test.mjs +0 -61
  278. package/test/apps-scaffold-contract.test.mjs +0 -114
  279. package/test/blender-cad.test.mjs +0 -146
  280. package/test/cad-docker.test.mjs +0 -96
  281. package/test/capabilities.test.mjs +0 -133
  282. package/test/cli/api-key-env-whoami.test.mjs +0 -129
  283. package/test/cli/codebaseindex-plan-ux.test.mjs +0 -37
  284. package/test/cli/eval-live.test.mjs +0 -219
  285. package/test/cli/go.test.mjs +0 -128
  286. package/test/cli/local-vault-and-provider-setup.test.mjs +0 -268
  287. package/test/cli/mcp-client.test.mjs +0 -256
  288. package/test/cli/preferences-runtime.test.mjs +0 -11
  289. package/test/cli/runtime-persist.test.mjs +0 -56
  290. package/test/cli/runtime-ui.test.mjs +0 -141
  291. package/test/cli/rust-command.test.mjs +0 -21
  292. package/test/cli/skill-npm-and-env.test.mjs +0 -52
  293. package/test/cli/status-actions.test.mjs +0 -88
  294. package/test/cli/wireframes-go-registry.test.mjs +0 -139
  295. package/test/cli-preferences.test.mjs +0 -46
  296. package/test/cloudflare-connector.test.mjs +0 -93
  297. package/test/cloudflare-runtime.test.mjs +0 -82
  298. package/test/context.test.mjs +0 -159
  299. package/test/credentials-audit.test.mjs +0 -113
  300. package/test/deploy-health-scan.test.mjs +0 -95
  301. package/test/deploy-receipt.test.mjs +0 -91
  302. package/test/dockerize.test.mjs +0 -93
  303. package/test/error-diagnostics.test.mjs +0 -124
  304. package/test/eval-context.test.mjs +0 -37
  305. package/test/execution-approvals.test.mjs +0 -27
  306. package/test/fixtures/cad/courtyard-house.json +0 -208
  307. package/test/fixtures/knowledge-rpc-worker.mjs +0 -16
  308. package/test/gcloud-auth.test.mjs +0 -111
  309. package/test/go/build-source-identity.test.mjs +0 -31
  310. package/test/go/cloudflare-probe.test.mjs +0 -317
  311. package/test/go/distribution.test.mjs +0 -28
  312. package/test/google-cloud-connection.test.mjs +0 -83
  313. package/test/google-cloud-inventory.test.mjs +0 -64
  314. package/test/indexing-provider.test.mjs +0 -29
  315. package/test/init-options.test.mjs +0 -35
  316. package/test/integration/ai-access-onboarding.test.mjs +0 -47
  317. package/test/integration/app-command.test.mjs +0 -85
  318. package/test/integration/cad-discovery.test.mjs +0 -158
  319. package/test/integration/cad-docker-executor.test.mjs +0 -249
  320. package/test/integration/cad-execution.test.mjs +0 -184
  321. package/test/integration/cad-project-app.test.mjs +0 -31
  322. package/test/integration/cad-project-d1.test.mjs +0 -25
  323. package/test/integration/cad-project-native.test.mjs +0 -24
  324. package/test/integration/cad-project-workflow.test.mjs +0 -9
  325. package/test/integration/cad-project.test.mjs +0 -85
  326. package/test/integration/cli-help.test.mjs +0 -41
  327. package/test/integration/cms-app-scaffold.test.mjs +0 -71
  328. package/test/integration/cms-site-tenancy-contract.test.mjs +0 -257
  329. package/test/integration/codebaseindex-ingest.test.mjs +0 -214
  330. package/test/integration/core-client.integration.test.mjs +0 -55
  331. package/test/integration/error-runtime-rpc.test.mjs +0 -71
  332. package/test/integration/features-resolve.test.mjs +0 -147
  333. package/test/integration/icon-registry.test.mjs +0 -67
  334. package/test/integration/ingest-discover-models.test.mjs +0 -30
  335. package/test/integration/inspect-path-cli.test.mjs +0 -46
  336. package/test/integration/install-script.test.mjs +0 -110
  337. package/test/integration/inventory-core.test.mjs +0 -53
  338. package/test/integration/inventory-evidence.test.mjs +0 -125
  339. package/test/integration/knowledge-rpc.test.mjs +0 -112
  340. package/test/integration/local-fs.test.mjs +0 -113
  341. package/test/integration/merkle-cli.test.mjs +0 -61
  342. package/test/integration/merkle-persistence-identity.test.mjs +0 -48
  343. package/test/integration/plugins-cloudflare.integration.test.mjs +0 -28
  344. package/test/integration/provider-env-cli.test.mjs +0 -50
  345. package/test/integration/provider-factory.test.mjs +0 -197
  346. package/test/integration/repository-company-graph.test.mjs +0 -90
  347. package/test/integration/runtime-migrations.test.mjs +0 -87
  348. package/test/integration/runtime-status.integration.test.mjs +0 -212
  349. package/test/integration/sam-activity-recovery.test.mjs +0 -147
  350. package/test/integration/sam-decision.test.mjs +0 -584
  351. package/test/integration/sam-kernel.test.mjs +0 -99
  352. package/test/integration/sam-planning-astar.test.mjs +0 -279
  353. package/test/integration/scaffold-cloudflare.test.mjs +0 -46
  354. package/test/integration/skill-runtime.test.mjs +0 -240
  355. package/test/integration/storage-architecture.test.mjs +0 -154
  356. package/test/integration/store-discovery.test.mjs +0 -44
  357. package/test/integration/studio-fs-pty-e2e.test.mjs +0 -294
  358. package/test/integration/terminal-exec.integration.test.mjs +0 -86
  359. package/test/integration/tool-runtime.test.mjs +0 -124
  360. package/test/integration/tool-schema.test.mjs +0 -59
  361. package/test/jr-dev-skill.test.mjs +0 -26
  362. package/test/knowledge-context-pack.test.mjs +0 -19
  363. package/test/knowledge-postgres.test.mjs +0 -40
  364. package/test/knowledge-service.test.mjs +0 -110
  365. package/test/knowledge.test.mjs +0 -206
  366. package/test/live/terminal-transport.live.test.mjs +0 -24
  367. package/test/local-sessions.test.mjs +0 -57
  368. package/test/local-studio-deploy.test.mjs +0 -83
  369. package/test/loopback-oauth.test.mjs +0 -53
  370. package/test/merkle-render.test.mjs +0 -31
  371. package/test/mini.test.mjs +0 -140
  372. package/test/model-catalog.test.mjs +0 -70
  373. package/test/models.test.mjs +0 -309
  374. package/test/npm10-lock.test.mjs +0 -29
  375. package/test/ollama.test.mjs +0 -137
  376. package/test/open-url.test.mjs +0 -64
  377. package/test/openai-responses.test.mjs +0 -155
  378. package/test/portable-context.test.mjs +0 -94
  379. package/test/project-config.test.mjs +0 -81
  380. package/test/project-rules.test.mjs +0 -44
  381. package/test/provider-credentials.test.mjs +0 -106
  382. package/test/rehydrate.test.mjs +0 -25
  383. package/test/release-hygiene.test.mjs +0 -42
  384. package/test/repository-snapshot-view.test.mjs +0 -112
  385. package/test/responses-runner.test.mjs +0 -465
  386. package/test/runtime-activity.test.mjs +0 -98
  387. package/test/sdk-worker-contract.test.mjs +0 -72
  388. package/test/security.test.mjs +0 -252
  389. package/test/setup-planner.test.mjs +0 -74
  390. package/test/setup-runtime.test.mjs +0 -51
  391. package/test/shell.test.mjs +0 -281
  392. package/test/skills.test.mjs +0 -22
  393. package/test/smoke.mjs +0 -122
  394. package/test/telemetry.test.mjs +0 -79
  395. package/test/terminal/local-pty.mock.test.mjs +0 -153
  396. package/test/terminal-machine-identity.test.mjs +0 -88
  397. package/test/theme-portability.test.mjs +0 -14
  398. package/test/tools-search.test.mjs +0 -73
  399. package/test/unit/website-assets-bindings.test.mjs +0 -60
  400. package/test/whoami-resume.test.mjs +0 -157
@@ -1,85 +0,0 @@
1
- import assert from 'node:assert/strict';
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import { spawnSync } from 'node:child_process';
5
- import test from 'node:test';
6
- import { listAppManifests } from '../../src/commands/app.js';
7
-
8
- test('lists agentsam.app.json manifests for product apps', () => {
9
- const apps = listAppManifests();
10
- const ids = apps.map((row) => row.id).sort();
11
- assert.ok(ids.includes('cad-creator'));
12
- assert.ok(ids.includes('local-studio'));
13
- assert.ok(ids.includes('client-cms-editor'));
14
- assert.ok(ids.includes('ecommerce-cms-agentsam'));
15
- });
16
-
17
- test('agentsam app validate passes for all product apps', async () => {
18
- const { validateApps } = await import('../../src/commands/app.js');
19
- const report = validateApps();
20
- assert.equal(report.ok, true, report.errors.join('\n'));
21
- assert.ok(report.apps.length >= 4);
22
- });
23
-
24
- test('CMS app scaffold source is included in the SDK distribution contract', async () => {
25
- const { validateApps } = await import('../../src/commands/app.js');
26
- const report = validateApps({ appId: 'client-cms-editor' });
27
- assert.equal(report.ok, true, report.errors.join('\n'));
28
- assert.deepEqual(report.warnings, []);
29
- });
30
-
31
- test('CAD and CMS workers load APP identity from agentsam.app.json', () => {
32
- const cad = fs.readFileSync(path.resolve('apps/cad-creator/backend/worker/index.js'), 'utf8');
33
- const cms = fs.readFileSync(path.resolve('apps/client-cms-editor/backend/worker/index.js'), 'utf8');
34
- assert.match(cad, /import appManifest from ['"]\.\.\/\.\.\/agentsam\.app\.json['"]/);
35
- assert.match(cms, /import appManifest from ['"]\.\.\/\.\.\/agentsam\.app\.json['"]/);
36
- assert.doesNotMatch(cad, /const\s+APP\s*=\s*["']/);
37
- assert.doesNotMatch(cms, /const\s+APP\s*=\s*["']/);
38
- });
39
-
40
- test('desktop CMS shell app_id resolves to client-cms-editor', () => {
41
- const manifest = JSON.parse(
42
- fs.readFileSync(path.resolve('packages/agentsam-desktop-shell/manifests/cms-editor.json'), 'utf8'),
43
- );
44
- assert.equal(manifest.app_id, 'client-cms-editor');
45
- });
46
-
47
-
48
- test('Ecommerce CMS app bin exposes truthful runnable doctor state', () => {
49
- const bin = path.resolve('apps/ecommerce-cms-agentsam/bin/agentsam-ecommerce.mjs');
50
- const result = spawnSync(process.execPath, [bin, 'doctor', '--json'], {
51
- cwd: path.resolve('.'),
52
- encoding: 'utf8',
53
- });
54
-
55
- assert.equal(result.status, 0, result.stderr);
56
- const report = JSON.parse(result.stdout);
57
- assert.equal(report.app_id, 'ecommerce-cms-agentsam');
58
- assert.equal(report.source.frontend, true);
59
- assert.equal(report.runtime.package_json, true);
60
- assert.equal(report.runtime.runnable, true);
61
- assert.equal(report.manifest_runtime.local_preview, 'ready');
62
- assert.equal(report.manifest_runtime.source_scaffold, 'ready');
63
- assert.equal(report.contract_consistent, true);
64
- });
65
-
66
- test('Ecommerce CMS app manifest and package agree on executable preview', () => {
67
- const manifest = JSON.parse(
68
- fs.readFileSync(path.resolve('apps/ecommerce-cms-agentsam/agentsam.app.json'), 'utf8'),
69
- );
70
- const pkg = JSON.parse(
71
- fs.readFileSync(path.resolve('apps/ecommerce-cms-agentsam/package.json'), 'utf8'),
72
- );
73
- const frontendPkg = JSON.parse(
74
- fs.readFileSync(path.resolve('apps/ecommerce-cms-agentsam/frontend/package.json'), 'utf8'),
75
- );
76
-
77
- assert.equal(manifest.package, pkg.name);
78
- assert.equal(manifest.bin, 'bin/agentsam-ecommerce.mjs');
79
- assert.equal(manifest.runtime.local_preview, 'ready');
80
- assert.equal(manifest.runtime.source_scaffold, 'ready');
81
- assert.equal(manifest.preview.entry, '/admin');
82
- assert.equal(manifest.preview.port, 4174);
83
- assert.equal(typeof pkg.scripts.preview, 'string');
84
- assert.equal(typeof frontendPkg.scripts.preview, 'string');
85
- });
@@ -1,158 +0,0 @@
1
- import test from 'node:test';
2
- import assert from 'node:assert/strict';
3
- import fs from 'node:fs';
4
- import os from 'node:os';
5
- import path from 'node:path';
6
- import {
7
- discoverOpenScad,
8
- openScadStatus,
9
- discoverFreeCad,
10
- freeCadStatus,
11
- meshyStatus,
12
- mujocoStatus,
13
- discoverAllCadTools,
14
- getInstallGuidance,
15
- } from '../../src/lib/cad/index.js';
16
-
17
- function makeFixture(t, name) {
18
- const root = fs.mkdtempSync(path.join(os.tmpdir(), `agentsam-${name}-test-`));
19
- t.after(() => fs.rmSync(root, { recursive: true, force: true }));
20
- const binary = path.join(root, process.platform === 'win32' ? `${name}.exe` : name);
21
- fs.writeFileSync(binary, `fake ${name}\n`);
22
- return { root, binary };
23
- }
24
-
25
- test('discoverOpenScad honors explicit binary before env and path', (t) => {
26
- const { binary } = makeFixture(t, 'openscad');
27
- const result = discoverOpenScad({
28
- openscadBin: binary,
29
- env: { AGENTSAM_OPENSCAD_BIN: '/nonexistent/bin' },
30
- });
31
- assert.equal(result.source, 'explicit');
32
- assert.equal(result.binary, fs.realpathSync(binary));
33
- });
34
-
35
- test('discoverOpenScad honors AGENTSAM_OPENSCAD_BIN when explicit is not set', (t) => {
36
- const { binary } = makeFixture(t, 'openscad');
37
- const result = discoverOpenScad({
38
- env: { AGENTSAM_OPENSCAD_BIN: binary },
39
- });
40
- assert.equal(result.source, 'env');
41
- assert.equal(result.binary, fs.realpathSync(binary));
42
- });
43
-
44
- test('openScadStatus probes version boundedly and returns deterministic receipt', async (t) => {
45
- const { binary } = makeFixture(t, 'openscad');
46
- const calls = [];
47
- const status = await openScadStatus({
48
- openscadBin: binary,
49
- runProcessImpl: async (command, args) => {
50
- calls.push({ command, args });
51
- return { code: 0, stdout: '', stderr: 'OpenSCAD version 2026.04.26\n' };
52
- },
53
- });
54
-
55
- assert.equal(status.tool, 'openscad');
56
- assert.equal(status.available, true);
57
- assert.equal(status.version, '2026.04.26');
58
- assert.equal(status.execution_lane, 'native');
59
- assert.deepEqual(calls[0], { command: fs.realpathSync(binary), args: ['-v'] });
60
- });
61
-
62
- test('discoverFreeCad honors explicit binary and AGENTSAM_FREECAD_BIN', (t) => {
63
- const { binary } = makeFixture(t, 'FreeCADCmd');
64
- const result = discoverFreeCad({
65
- freecadBin: binary,
66
- env: { AGENTSAM_FREECAD_BIN: '/nonexistent/path' },
67
- });
68
- assert.equal(result.source, 'explicit');
69
- assert.equal(result.binary, fs.realpathSync(binary));
70
-
71
- const envResult = discoverFreeCad({
72
- env: { AGENTSAM_FREECAD_BIN: binary },
73
- });
74
- assert.equal(envResult.source, 'env');
75
- assert.equal(envResult.binary, fs.realpathSync(binary));
76
- });
77
-
78
- test('freeCadStatus probes version and returns deterministic receipt', async (t) => {
79
- const { binary } = makeFixture(t, 'FreeCADCmd');
80
- const calls = [];
81
- const status = await freeCadStatus({
82
- freecadBin: binary,
83
- runProcessImpl: async (command, args) => {
84
- calls.push({ command, args });
85
- return { code: 0, stdout: 'FreeCAD 1.1.1 Revision: 20260414 (Git shallow)\n', stderr: '' };
86
- },
87
- });
88
-
89
- assert.equal(status.tool, 'freecad');
90
- assert.equal(status.available, true);
91
- assert.equal(status.version, 'FreeCAD 1.1.1 Revision: 20260414 (Git shallow)');
92
- assert.equal(status.execution_lane, 'native');
93
- assert.deepEqual(calls[0], { command: fs.realpathSync(binary), args: ['--version'] });
94
- });
95
-
96
- test('meshyStatus discovers API key configuration via environment', () => {
97
- const noKey = meshyStatus({ env: {} });
98
- assert.equal(noKey.available, false);
99
- assert.equal(noKey.source, 'none');
100
- assert.equal(noKey.execution_lane, 'cloud_byok');
101
-
102
- const withKey = meshyStatus({ env: { MESHY_API_KEY: 'msy_test_secret_key' } });
103
- assert.equal(withKey.available, true);
104
- assert.equal(withKey.source, 'env');
105
- assert.equal(withKey.version, 'v2-api');
106
- });
107
-
108
- test('mujocoStatus returns browser WASM bundled capability', () => {
109
- const status = mujocoStatus();
110
- assert.equal(status.tool, 'mujoco');
111
- assert.equal(status.available, true);
112
- assert.equal(status.execution_lane, 'browser_wasm');
113
- });
114
-
115
- test('discoverAllCadTools aggregates deterministic receipts across engines', async (t) => {
116
- const { binary: openscad } = makeFixture(t, 'openscad');
117
- const { binary: freecad } = makeFixture(t, 'FreeCADCmd');
118
- const { binary: blender } = makeFixture(t, 'blender');
119
-
120
- const report = await discoverAllCadTools({
121
- openscadBin: openscad,
122
- freecadBin: freecad,
123
- blenderBin: blender,
124
- env: { MESHY_API_KEY: 'test_key' },
125
- runProcessImpl: async (command, args) => {
126
- if (args[0] === '-v') return { code: 0, stdout: '', stderr: 'OpenSCAD version 2026.04.26\n' };
127
- if (command.includes('FreeCAD')) return { code: 0, stdout: 'FreeCAD 1.1.1 Revision: 20260414\n', stderr: '' };
128
- return { code: 0, stdout: 'Blender 5.0.1\n', stderr: '' };
129
- },
130
- });
131
-
132
- assert.equal(report.schema_version, 1);
133
- assert.equal(report.total_tools, 5);
134
- assert.equal(report.available_tools, 5);
135
- assert.equal(report.all_systems_ready, true);
136
- assert.equal(report.tools.length, 5);
137
- });
138
-
139
- test('getInstallGuidance provides exact OS package manager commands', () => {
140
- const darwinOpenScad = getInstallGuidance('openscad', 'darwin');
141
- assert.equal(darwinOpenScad.command, 'brew install openscad');
142
-
143
- const linuxFreeCad = getInstallGuidance('freecad', 'linux');
144
- assert.match(linuxFreeCad.command, /apt-get install.*freecad/);
145
-
146
- const winBlender = getInstallGuidance('blender', 'win32');
147
- assert.equal(winBlender.command, 'winget install BlenderFoundation.Blender');
148
- });
149
-
150
- test('discoverOpenScad returns binary: null when not found on host (no hardcoded defaults)', () => {
151
- const emptyDiscovery = discoverOpenScad({
152
- env: { PATH: '' },
153
- platform: 'unknown_os',
154
- });
155
- assert.equal(emptyDiscovery.binary, null);
156
- assert.equal(emptyDiscovery.source, 'none');
157
- });
158
-
@@ -1,249 +0,0 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert/strict';
3
- import http from 'node:http';
4
- import fs from 'node:fs';
5
- import os from 'node:os';
6
- import path from 'node:path';
7
- import {
8
- DEFAULT_CAD_DOCKER_PORT,
9
- DEFAULT_CAD_DOCKER_URL,
10
- resolveDockerServiceConfig,
11
- probeDockerServiceHealth,
12
- executeOpenScadDocker,
13
- executeFreeCadDocker,
14
- executeBlenderDocker,
15
- } from '../../src/lib/cad/docker-executor.js';
16
- import { discoverAllCadTools } from '../../src/lib/cad/discovery.js';
17
-
18
- test('resolveDockerServiceConfig resolves URL and token from env or options', () => {
19
- const conf1 = resolveDockerServiceConfig({
20
- serviceUrl: 'http://custom-host:9999/',
21
- token: 'secret-token-123',
22
- });
23
- assert.equal(conf1.url, 'http://custom-host:9999');
24
- assert.equal(conf1.token, 'secret-token-123');
25
-
26
- const conf2 = resolveDockerServiceConfig({
27
- env: {
28
- AGENTSAM_CAD_SERVICE_URL: 'http://env-host:8888',
29
- AGENTSAM_CAD_TOKEN: 'env-tok',
30
- },
31
- });
32
- assert.equal(conf2.url, 'http://env-host:8888');
33
- assert.equal(conf2.token, 'env-tok');
34
-
35
- const confDefault = resolveDockerServiceConfig({ env: {} });
36
- assert.equal(confDefault.url, DEFAULT_CAD_DOCKER_URL);
37
- assert.equal(confDefault.token, null);
38
- });
39
-
40
- test('probeDockerServiceHealth returns offline gracefully when unreachable', async () => {
41
- const result = await probeDockerServiceHealth({
42
- serviceUrl: 'http://127.0.0.1:54321', // Unused port
43
- timeoutMs: 150,
44
- });
45
- assert.equal(result.available, false);
46
- assert.equal(result.url, 'http://127.0.0.1:54321');
47
- });
48
-
49
- test('Docker CAD service executor routes compile, build, and inspect requests', async () => {
50
- const recordedRequests = [];
51
- const mockServer = http.createServer((req, res) => {
52
- let body = '';
53
- req.on('data', chunk => { body += chunk; });
54
- req.on('end', () => {
55
- recordedRequests.push({
56
- url: req.url,
57
- method: req.method,
58
- auth: req.headers['authorization'],
59
- body: body ? JSON.parse(body) : null,
60
- });
61
-
62
- if (req.url === '/healthz') {
63
- res.writeHead(200, { 'Content-Type': 'application/json' });
64
- res.end(JSON.stringify({
65
- ok: true,
66
- service: 'agentsam-cad',
67
- version: '1',
68
- tools: {
69
- openscad: { installed: true, version: 'OpenSCAD 2021.01-docker' },
70
- freecad: { installed: true, version: 'FreeCAD 0.21.2-docker' },
71
- blender: { installed: true, version: 'Blender 4.2.0-docker' },
72
- },
73
- }));
74
- return;
75
- }
76
-
77
- if (req.url === '/v1/openscad/compile') {
78
- res.writeHead(200, { 'Content-Type': 'application/json' });
79
- res.end(JSON.stringify({
80
- ok: true,
81
- tool: 'openscad',
82
- format: 'stl',
83
- filename: 'bracket.stl',
84
- size_bytes: 128,
85
- sha256: 'abc123sha',
86
- artifact_base64: Buffer.from('solid bracket\nendsolid').toString('base64'),
87
- logs: ['[DOCKER] OpenSCAD compiled successfully'],
88
- }));
89
- return;
90
- }
91
-
92
- if (req.url === '/v1/freecad/execute') {
93
- res.writeHead(200, { 'Content-Type': 'application/json' });
94
- res.end(JSON.stringify({
95
- ok: true,
96
- tool: 'freecad',
97
- format: 'step',
98
- filename: 'part.step',
99
- size_bytes: 512,
100
- sha256: 'step123sha',
101
- artifact_base64: Buffer.from('ISO-10303-21;').toString('base64'),
102
- metrics: { volume: 1500, surface_area: 800, faces_count: 6 },
103
- logs: ['[DOCKER] FreeCAD built STEP model'],
104
- }));
105
- return;
106
- }
107
-
108
- if (req.url === '/v1/blender/execute') {
109
- res.writeHead(200, { 'Content-Type': 'application/json' });
110
- res.end(JSON.stringify({
111
- ok: true,
112
- tool: 'blender',
113
- operation: 'build',
114
- format: 'glb',
115
- filename: 'scene.glb',
116
- size_bytes: 1024,
117
- sha256: 'glb123sha',
118
- artifact_base64: Buffer.from('glTF binary mock').toString('base64'),
119
- result: { ok: true, blender_version: '4.2.0', objects: ['Cube', 'Camera'] },
120
- logs: ['[DOCKER] Blender rendered glb scene'],
121
- }));
122
- return;
123
- }
124
-
125
- res.writeHead(404, { 'Content-Type': 'application/json' });
126
- res.end(JSON.stringify({ ok: false, error: 'not_found' }));
127
- });
128
- });
129
-
130
- await new Promise((resolve) => mockServer.listen(0, '127.0.0.1', resolve));
131
- const port = mockServer.address().port;
132
- const serviceUrl = `http://127.0.0.1:${port}`;
133
- const token = 'test-token-xyz';
134
-
135
- try {
136
- // 1. Health probe
137
- const health = await probeDockerServiceHealth({ serviceUrl, token });
138
- assert.equal(health.available, true);
139
- assert.equal(health.tools.openscad.installed, true);
140
- assert.equal(health.tools.freecad.installed, true);
141
- assert.equal(health.tools.blender.installed, true);
142
-
143
- // 2. OpenSCAD execution
144
- const oscadRes = await executeOpenScadDocker({
145
- source: 'cube([10, 10, 10]);',
146
- outputFormat: 'stl',
147
- filename: 'bracket.stl',
148
- serviceUrl,
149
- token,
150
- });
151
- assert.equal(oscadRes.success, true);
152
- assert.equal(oscadRes.filename, 'bracket.stl');
153
- assert.match(oscadRes.artifactContent, /solid bracket/);
154
- assert.equal(oscadRes.mimeType, 'model/stl');
155
-
156
- // 3. FreeCAD execution
157
- const freecadRes = await executeFreeCadDocker({
158
- operations: [{ op: 'box', length: 10, width: 10, height: 10 }],
159
- format: 'step',
160
- filename: 'part.step',
161
- serviceUrl,
162
- token,
163
- });
164
- assert.equal(freecadRes.success, true);
165
- assert.equal(freecadRes.format, 'step');
166
- assert.equal(freecadRes.metrics.volume, 1500);
167
- assert.match(freecadRes.artifactText, /ISO-10303-21;/);
168
-
169
- // 4. Blender execution
170
- const blenderRes = await executeBlenderDocker({
171
- operation: 'build',
172
- operations: [{ op: 'add', primitive: 'cube' }],
173
- format: 'glb',
174
- serviceUrl,
175
- token,
176
- });
177
- assert.equal(blenderRes.success, true);
178
- assert.equal(blenderRes.format, 'glb');
179
- assert.equal(blenderRes.result.blender_version, '4.2.0');
180
-
181
- // 5. Verify recorded request signatures
182
- assert.equal(recordedRequests[0].url, '/healthz');
183
- assert.equal(recordedRequests[0].auth, 'Bearer test-token-xyz');
184
- assert.equal(recordedRequests[1].url, '/v1/openscad/compile');
185
- assert.equal(recordedRequests[2].url, '/v1/freecad/execute');
186
- assert.equal(recordedRequests[3].url, '/v1/blender/execute');
187
- } finally {
188
- await new Promise((resolve) => mockServer.close(resolve));
189
- }
190
- });
191
-
192
- test('discoverAllCadTools adopts Docker service execution lane when host tools are absent', async () => {
193
- const mockServer = http.createServer((req, res) => {
194
- if (req.url === '/healthz') {
195
- res.writeHead(200, { 'Content-Type': 'application/json' });
196
- res.end(JSON.stringify({
197
- ok: true,
198
- service: 'agentsam-cad',
199
- version: '1',
200
- tools: {
201
- openscad: { installed: true, version: 'OpenSCAD 2021.01-docker' },
202
- freecad: { installed: true, version: 'FreeCAD 0.21.2-docker' },
203
- blender: { installed: true, version: 'Blender 4.2.0-docker' },
204
- },
205
- }));
206
- return;
207
- }
208
- res.writeHead(404);
209
- res.end();
210
- });
211
-
212
- await new Promise((resolve) => mockServer.listen(0, '127.0.0.1', resolve));
213
- const port = mockServer.address().port;
214
- const serviceUrl = `http://127.0.0.1:${port}`;
215
-
216
- try {
217
- const report = await discoverAllCadTools({
218
- openscadBin: '/nonexistent/openscad',
219
- freecadBin: '/nonexistent/freecad',
220
- blenderBin: '/nonexistent/blender',
221
- env: {
222
- AGENTSAM_CAD_SERVICE_URL: serviceUrl,
223
- PATH: '/empty',
224
- },
225
- cache: false,
226
- });
227
-
228
- const openscad = report.tools.find(t => t.tool === 'openscad');
229
- const freecad = report.tools.find(t => t.tool === 'freecad');
230
- const blender = report.tools.find(t => t.tool === 'blender');
231
-
232
- assert.equal(openscad.available, true);
233
- assert.equal(openscad.execution_lane, 'docker_service');
234
- assert.equal(openscad.source, 'docker_service');
235
- assert.match(openscad.binary, /^docker:\/\//);
236
-
237
- assert.equal(freecad.available, true);
238
- assert.equal(freecad.execution_lane, 'docker_service');
239
- assert.equal(freecad.source, 'docker_service');
240
- assert.match(freecad.binary, /^docker:\/\//);
241
-
242
- assert.equal(blender.available, true);
243
- assert.equal(blender.execution_lane, 'docker_service');
244
- assert.equal(blender.source, 'docker_service');
245
- assert.match(blender.binary, /^docker:\/\//);
246
- } finally {
247
- await new Promise((resolve) => mockServer.close(resolve));
248
- }
249
- });
@@ -1,184 +0,0 @@
1
- import test from 'node:test';
2
- import assert from 'node:assert/strict';
3
- import fs from 'node:fs';
4
- import os from 'node:os';
5
- import path from 'node:path';
6
- import {
7
- openScadCompile,
8
- validateOpenScadSource,
9
- freeCadBuild,
10
- freeCadInspect,
11
- blenderBuild,
12
- blenderInspect,
13
- blenderExport,
14
- discoverAllCadTools,
15
- } from '../../src/lib/cad/index.js';
16
-
17
- // These tests exercise real local CAD/3D engine binaries (OpenSCAD, FreeCAD,
18
- // Blender). They are not installed on the generic CI runner and are heavy
19
- // desktop applications — deliberately not force-installed there (matches
20
- // the local-first storage/tooling stance elsewhere in this repo). Each
21
- // execution test below skips itself with a clear reason when its engine
22
- // isn't present, rather than failing CI for an environment gap. On a
23
- // machine that has the tool installed (e.g. local dev), the test runs for
24
- // real with the full original assertions, unchanged.
25
- const cadReport = await discoverAllCadTools();
26
- const toolAvailable = (name) => cadReport.tools.find((t) => t.tool === name)?.available === true;
27
-
28
- test('CAD Tool Discovery identifies local engines on the machine (schema is always validated; per-tool availability is informational)', async () => {
29
- const report = await discoverAllCadTools();
30
- assert.equal(report.schema_version, 1);
31
- assert.ok(report.total_tools >= 5);
32
-
33
- for (const toolName of ['openscad', 'freecad', 'blender']) {
34
- const tool = report.tools.find((t) => t.tool === toolName);
35
- assert.ok(tool, `${toolName} entry missing from discovery report`);
36
- assert.equal(typeof tool.available, 'boolean');
37
- if (tool.available) {
38
- assert.ok(tool.binary, `${toolName} reported available but has no binary path`);
39
- assert.ok(tool.version, `${toolName} reported available but has no version`);
40
- } else {
41
- assert.ok(tool.install_guidance, `${toolName} reported unavailable but has no install_guidance`);
42
- }
43
- }
44
- });
45
-
46
- test('OpenSCAD execution rejects security-violating scripts', async () => {
47
- assert.throws(
48
- () => validateOpenScadSource('use <child_process>;'),
49
- /Security Violation/
50
- );
51
- assert.throws(
52
- () => validateOpenScadSource('exec("cat /etc/passwd");'),
53
- /Security Violation/
54
- );
55
- assert.throws(
56
- () => validateOpenScadSource('import("../../secret.scad");'),
57
- /Security Violation/
58
- );
59
- });
60
-
61
- test('OpenSCAD real compilation produces watertight geometry and returns typed receipt', { skip: !toolAvailable('openscad') && 'openscad binary not available on this machine' }, async (t) => {
62
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-openscad-test-'));
63
- t.after(() => fs.rmSync(tmpDir, { recursive: true, force: true }));
64
-
65
- const source = `
66
- difference() {
67
- cube([width, depth, height], center=true);
68
- cylinder(h=height + 2, r=holeRadius, center=true, $fn=24);
69
- }
70
- `;
71
-
72
- const result = await openScadCompile({
73
- source,
74
- outputFormat: 'stl',
75
- parameters: {
76
- width: 30,
77
- depth: 20,
78
- height: 10,
79
- holeRadius: 4,
80
- },
81
- filename: 'flange.stl',
82
- });
83
-
84
- assert.equal(result.success, true);
85
- assert.equal(result.engine, 'openscad-native');
86
- assert.equal(result.filename, 'flange.stl');
87
- assert.equal(result.outputFormat, 'stl');
88
- assert.equal(result.mimeType, 'model/stl');
89
- assert.ok(result.sizeBytes > 0);
90
- assert.ok(result.artifactContent.includes('solid OpenSCAD_Model'));
91
- assert.ok(result.artifactContent.includes('facet normal'));
92
- assert.ok(result.artifactContent.includes('outer loop'));
93
- assert.ok(result.logs.some(l => l.includes('[KERNEL] OpenSCAD Native Compiler')));
94
- });
95
-
96
- test('FreeCAD solid kernel executes precision B-Rep operations and exports valid ISO STEP', { skip: !toolAvailable('freecad') && 'freecad binary not available on this machine' }, async (t) => {
97
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-freecad-test-'));
98
- t.after(() => fs.rmSync(tmpDir, { recursive: true, force: true }));
99
-
100
- const stepOutput = path.join(tmpDir, 'bracket.step');
101
-
102
- const recipe = {
103
- operations: [
104
- { op: 'box', name: 'main_block', length: 40.0, width: 25.0, height: 12.0 },
105
- { op: 'cylinder', name: 'bore', radius: 5.0, height: 14.0, translate: [20.0, 12.5, -1.0] },
106
- { op: 'cut', base: 'main_block', tool: 'bore' },
107
- ],
108
- };
109
-
110
- const buildResult = await freeCadBuild({
111
- recipe,
112
- output: stepOutput,
113
- format: 'step',
114
- });
115
-
116
- assert.equal(buildResult.ok, true);
117
- assert.equal(buildResult.capability, 'freecad.build');
118
- assert.equal(buildResult.format, 'step');
119
- assert.ok(buildResult.sizeBytes > 0);
120
- assert.ok(fs.existsSync(stepOutput));
121
-
122
- // Verify solid shape metrics
123
- const expectedSolidVolume = 40.0 * 25.0 * 12.0 - Math.PI * 25.0 * 12.0;
124
- assert.ok(Math.abs(buildResult.metrics.volume - expectedSolidVolume) < 1.0, 'Volume matches geometry');
125
- assert.equal(buildResult.metrics.faces_count, 7);
126
-
127
- // Read raw STEP content to verify ISO-10303 signature
128
- const stepText = fs.readFileSync(stepOutput, 'utf8');
129
- assert.ok(stepText.includes('ISO-10303-21;'));
130
- assert.ok(stepText.includes('Open CASCADE STEP processor'));
131
-
132
- // Inspect the exported STEP file using FreeCAD inspection
133
- const inspectResult = await freeCadInspect({ input: stepOutput });
134
- assert.equal(inspectResult.ok, true);
135
- assert.equal(inspectResult.capability, 'freecad.inspect');
136
- assert.ok(Math.abs(inspectResult.metrics.volume - expectedSolidVolume) < 1.0);
137
- assert.equal(inspectResult.metrics.faces_count, 7);
138
- });
139
-
140
- test('Blender real execution builds, inspects, and exports production 3D assets', { skip: !toolAvailable('blender') && 'blender binary not available on this machine' }, async (t) => {
141
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'agentsam-blender-test-'));
142
- t.after(() => fs.rmSync(tmpDir, { recursive: true, force: true }));
143
-
144
- const blendPath = path.join(tmpDir, 'scene.blend');
145
- const glbPath = path.join(tmpDir, 'scene.glb');
146
-
147
- const recipe = {
148
- schema_version: 1,
149
- operations: [
150
- { op: 'clear_scene' },
151
- { op: 'add', primitive: 'cylinder', name: 'Pillar', radius: 1.5, depth: 4.0 },
152
- { op: 'add_light', light_type: 'SUN', energy: 2.5 },
153
- ],
154
- };
155
-
156
- // 1. Build .blend file
157
- const buildResult = await blenderBuild({
158
- recipe,
159
- output: blendPath,
160
- });
161
-
162
- assert.equal(buildResult.ok, true);
163
- assert.equal(buildResult.capability, 'blender.build');
164
- assert.ok(fs.existsSync(blendPath));
165
- assert.ok(buildResult.objects.includes('Pillar'));
166
-
167
- // 2. Inspect built scene
168
- const inspectResult = await blenderInspect({ input: blendPath });
169
- assert.equal(inspectResult.ok, true);
170
- assert.equal(inspectResult.capability, 'blender.inspect');
171
- assert.ok(inspectResult.scene.objects.some(o => o.name === 'Pillar'));
172
-
173
- // 3. Export to GLB
174
- const exportResult = await blenderExport({
175
- input: blendPath,
176
- output: glbPath,
177
- format: 'glb',
178
- });
179
-
180
- assert.equal(exportResult.ok, true);
181
- assert.equal(exportResult.capability, 'blender.export');
182
- assert.ok(fs.existsSync(glbPath));
183
- assert.ok(fs.statSync(glbPath).size > 0);
184
- });