@inneranimalmedia/agentsam-sdk 2.6.2 → 2.6.3

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 (497) hide show
  1. package/AGENTSAM.md +45 -1
  2. package/README.md +80 -0
  3. package/apps/README.md +34 -0
  4. package/apps/cad-creator/README.md +728 -0
  5. package/apps/cad-creator/shared/cad/package.json +19 -0
  6. package/apps/cad-creator/shared/cad/src/domain/operations.ts +7 -0
  7. package/apps/cad-creator/shared/cad/src/domain/project-contract.d.ts +3 -0
  8. package/apps/cad-creator/shared/cad/src/domain/project-contract.js +75 -0
  9. package/apps/cad-creator/shared/cad/src/domain/project-tools.d.ts +1 -0
  10. package/apps/cad-creator/shared/cad/src/domain/project-tools.js +24 -0
  11. package/apps/cad-creator/shared/cad/src/domain/validation.ts +191 -0
  12. package/apps/cad-creator/shared/cad/src/index.ts +4 -0
  13. package/apps/cad-creator/shared/cad/src/robotics/types.ts +232 -0
  14. package/apps/cad-creator/shared/cad/src/types.ts +507 -0
  15. package/apps/cad-creator/shared/cad/tsconfig.json +14 -0
  16. package/docs/AUTORAG.md +58 -0
  17. package/docs/BRAND_INTELLIGENCE.md +30 -0
  18. package/docs/CLI_SHELL.md +4 -2
  19. package/docs/CMS_CONTEXTUAL_COMPOSER.md +38 -0
  20. package/docs/MERKLE.md +4 -0
  21. package/docs/PROJECT_CONFIG.md +3 -0
  22. package/docs/REPOSITORY_KNOWLEDGE.md +2 -0
  23. package/docs/THEME_REFINERY.md +120 -0
  24. package/docs/architecture/PROVIDER-TOOLS-AND-COMPACTION.md +60 -0
  25. package/docs/architecture/STORAGE.md +87 -0
  26. package/docs/cad-project-tools.md +69 -0
  27. package/docs/cms-scaffolding-pattern-reference.md +73 -0
  28. package/docs/plans/AGENTSAM-INTERACTIVE-UI-REQUIREMENTS-codex-tui-20260919.md +113 -0
  29. package/docs/plans/AGENTSAM-INTERACTIVE-UI-REQUIREMENTS.md +85 -0
  30. package/docs/plans/AGENTSAM-MCP-CLIENT-2026-09-19.md +181 -0
  31. package/docs/plans/ASBD-PORTABLE-WORKGRAPH-UI-DEFERRED.md +34 -0
  32. package/docs/plans/ASTRA-BRIEF-2026-09-18.md +258 -0
  33. package/docs/plans/MULTI-AGENT-SPRINTS-2026-09-19.md +373 -0
  34. package/docs/plans/NEXT-AGENT-HANDOFF.md +167 -0
  35. package/docs/plans/RECONCILIATION-2026-09-19.md +178 -0
  36. package/docs/plugins.md +43 -0
  37. package/docs/tools/README.md +57 -0
  38. package/docs/tools/agent-and-orchestration.md +49 -0
  39. package/docs/tools/browser-and-research.md +46 -0
  40. package/docs/tools/cloudflare-platform.md +32 -0
  41. package/docs/tools/cms.md +25 -0
  42. package/docs/tools/communications.md +41 -0
  43. package/docs/tools/database-and-storage.md +62 -0
  44. package/docs/tools/design-and-media.md +64 -0
  45. package/docs/tools/filesystem-and-code.md +55 -0
  46. package/docs/tools/github.md +56 -0
  47. package/docs/tools/integrations-and-misc.md +16 -0
  48. package/docs/tools/memory.md +21 -0
  49. package/docs/tools/terminal-and-execution.md +29 -0
  50. package/docs/tools/tickets-and-platform.md +30 -0
  51. package/migrations/d1/0001_agentsam_plugin_runtime.sql +177 -0
  52. package/migrations/d1/0002_agentsam_ticket_ownership.sql +8 -0
  53. package/migrations/d1/0002_dynamic_model_policies.sql +23 -0
  54. package/migrations/d1/0003_expand_tool_handler_families.sql +18 -0
  55. package/migrations/d1/0004_project_aware_retrieval_lanes.sql +24 -0
  56. package/migrations/d1/0005_portable_knowledge_identity.sql +104 -0
  57. package/migrations/d1/0006_repair_ops_trail_account_scope.sql +14 -0
  58. package/migrations/d1/0007_repair_ops_trail_agent_run_account.sql +13 -0
  59. package/migrations/d1/0008_backfill_knowledge_run_legacy_tenant.sql +14 -0
  60. package/migrations/d1/0009_normalize_cloudflare_plugin_installations.sql +137 -0
  61. package/migrations/runtime/0001_cli_runtime.sql +67 -0
  62. package/migrations/runtime/0002_project_sessions.sql +15 -0
  63. package/migrations/runtime/0003_provider_continuations.sql +8 -0
  64. package/package.json +92 -12
  65. package/packages/agentsam-brand/README.md +21 -0
  66. package/packages/agentsam-brand/package.json +22 -0
  67. package/packages/agentsam-brand/src/contract.js +59 -0
  68. package/packages/agentsam-brand/src/extract.js +126 -0
  69. package/packages/agentsam-brand/src/goap-actions.js +73 -0
  70. package/packages/agentsam-brand/src/index.js +48 -0
  71. package/packages/agentsam-brand/src/plan.js +115 -0
  72. package/packages/agentsam-brand/src/resolve.js +139 -0
  73. package/packages/agentsam-brand/src/scan.js +250 -0
  74. package/packages/agentsam-brand/test/brand-scan.test.mjs +106 -0
  75. package/packages/agentsam-contracts/README.md +23 -0
  76. package/packages/agentsam-contracts/package.json +32 -0
  77. package/packages/agentsam-contracts/src/adapter.ts +25 -0
  78. package/packages/agentsam-contracts/src/agent.ts +35 -0
  79. package/packages/agentsam-contracts/src/artifacts.ts +33 -0
  80. package/packages/agentsam-contracts/src/authority.ts +29 -0
  81. package/packages/agentsam-contracts/src/context.ts +16 -0
  82. package/packages/agentsam-contracts/src/errors.ts +46 -0
  83. package/packages/agentsam-contracts/src/events.ts +47 -0
  84. package/packages/agentsam-contracts/src/execution.ts +50 -0
  85. package/packages/agentsam-contracts/src/hooks.ts +40 -0
  86. package/packages/agentsam-contracts/src/identity.ts +16 -0
  87. package/packages/agentsam-contracts/src/index.ts +14 -0
  88. package/packages/agentsam-contracts/src/models.ts +9 -0
  89. package/packages/agentsam-contracts/src/providers.ts +33 -0
  90. package/packages/agentsam-contracts/src/repository.ts +64 -0
  91. package/packages/agentsam-contracts/src/tools.ts +98 -0
  92. package/packages/agentsam-contracts/test/contracts.test.mjs +16 -0
  93. package/packages/agentsam-contracts/test/errors-catalog.test.mjs +25 -0
  94. package/packages/agentsam-contracts/test/repository.test.mjs +18 -0
  95. package/packages/agentsam-contracts/tsconfig.json +12 -0
  96. package/packages/agentsam-errors/package.json +17 -0
  97. package/packages/agentsam-errors/src/adapters/anthropic.js +15 -0
  98. package/packages/agentsam-errors/src/adapters/cad.js +109 -0
  99. package/packages/agentsam-errors/src/adapters/cloudflare.js +21 -0
  100. package/packages/agentsam-errors/src/adapters/cursor.js +4 -0
  101. package/packages/agentsam-errors/src/adapters/device.js +38 -0
  102. package/packages/agentsam-errors/src/adapters/docker.js +28 -0
  103. package/packages/agentsam-errors/src/adapters/gcp.js +14 -0
  104. package/packages/agentsam-errors/src/adapters/github.js +22 -0
  105. package/packages/agentsam-errors/src/adapters/google.js +17 -0
  106. package/packages/agentsam-errors/src/adapters/index.js +55 -0
  107. package/packages/agentsam-errors/src/adapters/internal.js +40 -0
  108. package/packages/agentsam-errors/src/adapters/oauth.js +24 -0
  109. package/packages/agentsam-errors/src/adapters/openai.js +17 -0
  110. package/packages/agentsam-errors/src/adapters/process.js +35 -0
  111. package/packages/agentsam-errors/src/adapters/provider.js +114 -0
  112. package/packages/agentsam-errors/src/envelope.js +186 -0
  113. package/packages/agentsam-errors/src/error.js +24 -0
  114. package/packages/agentsam-errors/src/fingerprint.js +35 -0
  115. package/packages/agentsam-errors/src/index.js +10 -0
  116. package/packages/agentsam-errors/src/normalize.js +30 -0
  117. package/packages/agentsam-errors/src/redaction.js +52 -0
  118. package/packages/agentsam-errors/src/render.js +16 -0
  119. package/packages/agentsam-errors/src/retry.js +10 -0
  120. package/packages/agentsam-errors/src/transport.js +52 -0
  121. package/packages/agentsam-errors/src/vocabulary.js +320 -0
  122. package/packages/agentsam-errors/test/envelope.test.mjs +70 -0
  123. package/packages/agentsam-errors/test/providers.test.mjs +99 -0
  124. package/packages/agentsam-errors/test/redaction.test.mjs +21 -0
  125. package/packages/agentsam-errors/test/runtime-cad-device.test.mjs +76 -0
  126. package/packages/agentsam-errors/test/transport.test.mjs +46 -0
  127. package/packages/agentsam-knowledge/package.json +15 -0
  128. package/packages/agentsam-knowledge/src/autorag/index.js +64 -0
  129. package/packages/agentsam-knowledge/src/backends/index.js +26 -0
  130. package/packages/agentsam-knowledge/src/index.js +3 -0
  131. package/packages/agentsam-knowledge/src/providers/index.js +95 -0
  132. package/packages/agentsam-knowledge/test/autorag.test.mjs +42 -0
  133. package/packages/agentsam-nav/README.md +40 -0
  134. package/packages/agentsam-nav/dist/Nav.d.ts +43 -0
  135. package/packages/agentsam-nav/dist/NavCollapsible.d.ts +10 -0
  136. package/packages/agentsam-nav/dist/NavContent.d.ts +2 -0
  137. package/packages/agentsam-nav/dist/NavFooter.d.ts +2 -0
  138. package/packages/agentsam-nav/dist/NavGroup.d.ts +3 -0
  139. package/packages/agentsam-nav/dist/NavHeader.d.ts +2 -0
  140. package/packages/agentsam-nav/dist/NavMenu.d.ts +22 -0
  141. package/packages/agentsam-nav/dist/NavProvider.d.ts +35 -0
  142. package/packages/agentsam-nav/dist/NavTrigger.d.ts +2 -0
  143. package/packages/agentsam-nav/dist/Surfaces.d.ts +41 -0
  144. package/packages/agentsam-nav/dist/browser.d.ts +11 -0
  145. package/packages/agentsam-nav/dist/browser.global.js +132 -0
  146. package/packages/agentsam-nav/dist/browser.js +613 -0
  147. package/packages/agentsam-nav/dist/contracts.d.ts +76 -0
  148. package/packages/agentsam-nav/dist/index.d.ts +11 -0
  149. package/packages/agentsam-nav/dist/index.js +614 -0
  150. package/packages/agentsam-nav/dist/legacy.css +83 -0
  151. package/packages/agentsam-nav/dist/shell.css +113 -0
  152. package/packages/agentsam-nav/dist/theme.css +113 -0
  153. package/packages/agentsam-nav/dist/utils.d.ts +1 -0
  154. package/packages/agentsam-nav/package.json +43 -0
  155. package/packages/agentsam-queue-control/README.md +107 -0
  156. package/packages/agentsam-queue-control/package.json +31 -0
  157. package/packages/agentsam-queue-control/schemas/job-envelope.schema.json +56 -0
  158. package/packages/agentsam-queue-control/src/adapters/cloudflare.js +152 -0
  159. package/packages/agentsam-queue-control/src/adapters/memory.js +38 -0
  160. package/packages/agentsam-queue-control/src/contracts.js +130 -0
  161. package/packages/agentsam-queue-control/src/control-plane.js +141 -0
  162. package/packages/agentsam-queue-control/src/dispatch.js +43 -0
  163. package/packages/agentsam-queue-control/src/index.js +7 -0
  164. package/packages/agentsam-queue-control/src/policy.js +88 -0
  165. package/packages/agentsam-queue-control/src/topology.js +66 -0
  166. package/packages/agentsam-queue-control/test/queue-control.test.mjs +100 -0
  167. package/packages/agentsam-repository/src/goap.js +718 -0
  168. package/packages/agentsam-repository/src/goap.js.bak-20260922011251 +670 -0
  169. package/packages/agentsam-repository/src/index.js +5 -0
  170. package/packages/agentsam-repository/src/merkle/cloudflare-persistence.js +2 -2
  171. package/packages/agentsam-repository/src/tickets.js +184 -0
  172. package/packages/agentsam-repository/src/work-tracking.js +199 -0
  173. package/packages/agentsam-repository/src/workspace-state.js +176 -0
  174. package/packages/agentsam-repository/test/goap-tickets-workspace-state.test.mjs +152 -0
  175. package/packages/connectors/cloudflare/src/index.js +297 -15
  176. package/packages/connectors/cloudflare/src/owner.js +43 -40
  177. package/packages/connectors/cloudflare/src/routes.js +167 -26
  178. package/packages/connectors/cloudflare/tests/connector.test.mjs +112 -2
  179. package/packages/heuristic-theme/README.md +11 -0
  180. package/packages/heuristic-theme/package.json +25 -0
  181. package/packages/heuristic-theme/src/index.js +2 -0
  182. package/packages/heuristic-theme/src/registry.js +36 -0
  183. package/packages/heuristic-theme/src/theme.js +41 -0
  184. package/packages/heuristic-theme/test/theme.test.mjs +26 -0
  185. package/packages/identity/.agentsam/features/oauth-login-portal/agentsam.feature.json +64 -0
  186. package/packages/identity/.agentsam/features/oauth-login-portal/providers.json +96 -0
  187. package/packages/identity/.agentsam/features/oauth-login-portal/resources.json +47 -0
  188. package/packages/identity/.agentsam/features/oauth-login-portal/routes.json +74 -0
  189. package/packages/identity/.agentsam/features/oauth-login-portal/ui.json +35 -0
  190. package/packages/identity/package.json +3 -2
  191. package/packages/identity/src/adapters/cloudflare-d1/ids.js +4 -0
  192. package/packages/identity/src/adapters/cloudflare-d1/index.js +39 -1
  193. package/packages/identity/src/contracts/provider.js +3 -2
  194. package/packages/identity/src/frontend/auth-portal/pages/login.html +7 -0
  195. package/packages/identity/src/index.js +2 -0
  196. package/packages/identity/src/oauth/credentials.js +13 -0
  197. package/packages/identity/src/oauth/iam-platform.js +5 -5
  198. package/packages/identity/src/providers/cloudflare/index.js +19 -0
  199. package/packages/identity/src/providers/cloudflare/mapper.js +21 -0
  200. package/packages/identity/src/providers/cloudflare/oauth.js +48 -0
  201. package/packages/identity/src/providers/cloudflare/profile.js +28 -0
  202. package/packages/identity/src/providers/index.js +18 -2
  203. package/packages/identity/src/server/identity-service.js +13 -3
  204. package/packages/identity/src/server/worker-router.js +63 -8
  205. package/packages/identity/tests/identity-service.test.mjs +15 -0
  206. package/packages/providers/completeful/README.md +38 -0
  207. package/packages/providers/completeful/package.json +29 -0
  208. package/packages/providers/completeful/src/client.js +162 -0
  209. package/packages/providers/completeful/src/events.js +49 -0
  210. package/packages/providers/completeful/src/index.js +22 -0
  211. package/packages/providers/completeful/src/tools.js +579 -0
  212. package/packages/providers/completeful/src/webhooks.js +55 -0
  213. package/packages/providers/completeful/test/provider.test.mjs +196 -0
  214. package/packages/theme-church-site/README.md +10 -0
  215. package/packages/theme-church-site/package.json +30 -0
  216. package/packages/theme-church-site/src/harvest.json +14 -0
  217. package/packages/theme-church-site/src/index.js +84 -0
  218. package/packages/theme-church-site/test/theme.test.mjs +19 -0
  219. package/packages/theme-companions-site/README.md +10 -0
  220. package/packages/theme-companions-site/package.json +30 -0
  221. package/packages/theme-companions-site/src/harvest.json +12 -0
  222. package/packages/theme-companions-site/src/index.js +82 -0
  223. package/packages/theme-companions-site/test/theme.test.mjs +19 -0
  224. package/packages/theme-floors-site/README.md +10 -0
  225. package/packages/theme-floors-site/package.json +30 -0
  226. package/packages/theme-floors-site/src/harvest.json +14 -0
  227. package/packages/theme-floors-site/src/index.js +82 -0
  228. package/packages/theme-floors-site/test/theme.test.mjs +19 -0
  229. package/packages/theme-fuelnfree-site/README.md +10 -0
  230. package/packages/theme-fuelnfree-site/package.json +30 -0
  231. package/packages/theme-fuelnfree-site/src/harvest.json +13 -0
  232. package/packages/theme-fuelnfree-site/src/index.js +81 -0
  233. package/packages/theme-fuelnfree-site/test/theme.test.mjs +19 -0
  234. package/packages/theme-handyman-site/README.md +10 -0
  235. package/packages/theme-handyman-site/package.json +30 -0
  236. package/packages/theme-handyman-site/src/harvest.json +10 -0
  237. package/packages/theme-handyman-site/src/index.js +83 -0
  238. package/packages/theme-handyman-site/test/theme.test.mjs +19 -0
  239. package/packages/theme-insurance-site/README.md +10 -0
  240. package/packages/theme-insurance-site/package.json +30 -0
  241. package/packages/theme-insurance-site/src/harvest.json +10 -0
  242. package/packages/theme-insurance-site/src/index.js +83 -0
  243. package/packages/theme-insurance-site/test/theme.test.mjs +19 -0
  244. package/packages/theme-shinshu-site/README.md +10 -0
  245. package/packages/theme-shinshu-site/package.json +30 -0
  246. package/packages/theme-shinshu-site/src/harvest.json +12 -0
  247. package/packages/theme-shinshu-site/src/index.js +83 -0
  248. package/packages/theme-shinshu-site/test/theme.test.mjs +19 -0
  249. package/packages/work-graph/README.md +49 -0
  250. package/packages/work-graph/package.json +19 -0
  251. package/packages/work-graph/prototype/README.md +32 -0
  252. package/packages/work-graph/prototype/data/demo-workgraph.js +47 -0
  253. package/packages/work-graph/prototype/renderers/timeline-model.js +21 -0
  254. package/packages/work-graph/prototype/renderers/workgraph-runtime.js +38 -0
  255. package/packages/work-graph/prototype-gnantt.html +655 -0
  256. package/packages/work-graph/src/adapters/business/projects.js +23 -0
  257. package/packages/work-graph/src/adapters/engineering/git.js +22 -0
  258. package/packages/work-graph/src/adapters/engineering/mcp.js +22 -0
  259. package/packages/work-graph/src/index.js +76 -0
  260. package/packages/work-graph/src/renderers/gantt-model.js +11 -0
  261. package/packages/work-graph/src/renderers/timeline.js +16 -0
  262. package/packages/work-graph/test/work-graph.test.mjs +37 -0
  263. package/protocol/README.md +12 -0
  264. package/protocol/capabilities/cloudflare-cpu-audit-input.schema.json +30 -6
  265. package/protocol/capabilities/cloudflare-cpu-profile-input.schema.json +18 -4
  266. package/protocol/capabilities/cloudflare-wrangler-native-input.schema.json +59 -10
  267. package/protocol/capabilities/knowledge-search-input.schema.json +35 -0
  268. package/protocol/capabilities/manifest.json +163 -1
  269. package/protocol/capabilities/repository-audit-input.schema.json +39 -6
  270. package/protocol/capabilities/repository-snapshot-input.schema.json +15 -3
  271. package/protocol/capabilities/terminal-exec-input.schema.json +55 -0
  272. package/protocol/commerce/catalog.v1.json +50 -0
  273. package/protocol/errors/error-catalog.json +164 -0
  274. package/protocol/errors/error-envelope.schema.json +544 -0
  275. package/protocol/features/README.md +57 -0
  276. package/protocol/features/agentsam.feature.v1.schema.json +290 -0
  277. package/protocol/features/catalog.json +65 -0
  278. package/protocol/features/examples/provider-resend.feature.json +17 -0
  279. package/protocol/go/agentsam-go-runtime.v1.json +17 -0
  280. package/protocol/knowledge/LIFECYCLE.md +140 -0
  281. package/protocol/knowledge/README.md +4 -0
  282. package/protocol/presets/catalog.json +128 -19
  283. package/protocol/rpc/v1/errors.proto +24 -0
  284. package/protocol/theme-refinery/d1-reconciliation.md +48 -0
  285. package/protocol/theme-refinery/product-metadata.schema.json +27 -0
  286. package/protocol/theme-refinery/receipts/products-registry-batch-20260924.json +318 -0
  287. package/protocol/theme-refinery/receipts/theme-harvest-20260924.json +472 -0
  288. package/protocol/theme-refinery/reconciliation-receipt.schema.json +83 -0
  289. package/services/cad/server.py +249 -2
  290. package/src/agent/capability-adapter.js +15 -5
  291. package/src/agent/index.js +2 -1
  292. package/src/agent/model-turn.js +51 -0
  293. package/src/agent/responses-runner.js +304 -38
  294. package/src/capabilities/index.js +1 -0
  295. package/src/capabilities/terminal-exec.js +78 -0
  296. package/src/cli.js +117 -9
  297. package/src/cloudflare/index.js +6 -0
  298. package/src/cloudflare/runtime-status.js +393 -0
  299. package/src/cloudflare/wrangler.js +17 -1
  300. package/src/commands/app.js +106 -0
  301. package/src/commands/autorag.js +77 -0
  302. package/src/commands/brand.js +293 -0
  303. package/src/commands/cad.js +1 -0
  304. package/src/commands/connections.js +126 -29
  305. package/src/commands/context-economics.js +8 -0
  306. package/src/commands/db.js +7 -0
  307. package/src/commands/env.js +5 -4
  308. package/src/commands/eval.js +209 -14
  309. package/src/commands/go.js +365 -0
  310. package/src/commands/goap.js +176 -0
  311. package/src/commands/identity-init.js +27 -3
  312. package/src/commands/identity-protocol.js +195 -0
  313. package/src/commands/knowledge.js +64 -5
  314. package/src/commands/mcp.js +341 -0
  315. package/src/commands/merkle-persist.js +3 -1
  316. package/src/commands/merkle.js +18 -3
  317. package/src/commands/models.js +109 -23
  318. package/src/commands/plugins.js +175 -0
  319. package/src/commands/preferences.js +28 -8
  320. package/src/commands/product.js +53 -10
  321. package/src/commands/providers.js +118 -37
  322. package/src/commands/resume.js +9 -5
  323. package/src/commands/runtime-status.js +154 -0
  324. package/src/commands/shell.js +466 -55
  325. package/src/commands/status.js +82 -7
  326. package/src/commands/tunnel.js +228 -195
  327. package/src/commands/whoami.js +78 -6
  328. package/src/context/budget.js +6 -0
  329. package/src/context/index.js +2 -1
  330. package/src/context/project-card.js +75 -0
  331. package/src/errors/contract.js +34 -211
  332. package/src/errors/diagnostic.js +95 -51
  333. package/src/errors/index.js +6 -13
  334. package/src/eval/index.js +6 -0
  335. package/src/eval/live.js +439 -0
  336. package/src/features/resolve.js +242 -0
  337. package/src/go/build.js +108 -0
  338. package/src/go/cloudflare.js +207 -0
  339. package/src/go/contract.js +139 -0
  340. package/src/go/discover.js +96 -0
  341. package/src/go/index.js +13 -0
  342. package/src/go/receipts.js +77 -0
  343. package/src/go/registry.js +223 -0
  344. package/src/go/verify.js +31 -0
  345. package/src/index.js +100 -1
  346. package/src/knowledge/config.js +13 -5
  347. package/src/knowledge/engine.js +23 -8
  348. package/src/knowledge/index.js +1 -0
  349. package/src/knowledge/lane-registry.js +46 -0
  350. package/src/knowledge/providers/gemini.js +48 -8
  351. package/src/knowledge/service/client.js +13 -1
  352. package/src/knowledge/service/grpc-codec.js +156 -53
  353. package/src/knowledge/service/job-engine.js +133 -11
  354. package/src/knowledge/service/job-worker.js +34 -5
  355. package/src/knowledge/service/server.js +10 -1
  356. package/src/knowledge/store-discovery.js +77 -0
  357. package/src/lib/account-session.js +8 -2
  358. package/src/lib/agent-instructions.js +3 -0
  359. package/src/lib/auth.js +7 -3
  360. package/src/lib/cad/blender.js +42 -3
  361. package/src/lib/cad/d1-project-store.js +43 -0
  362. package/src/lib/cad/discovery.js +616 -0
  363. package/src/lib/cad/docker-executor.js +352 -0
  364. package/src/lib/cad/freecad.js +253 -0
  365. package/src/lib/cad/index.js +40 -0
  366. package/src/lib/cad/openscad.js +198 -0
  367. package/src/lib/cad/project-cli.d.ts +2 -0
  368. package/src/lib/cad/project-cli.js +21 -0
  369. package/src/lib/cad/project-contract.d.ts +3 -0
  370. package/src/lib/cad/project-contract.js +1 -0
  371. package/src/lib/cad/project-recipe.js +30 -0
  372. package/src/lib/cad/project-runtime.d.ts +2 -0
  373. package/src/lib/cad/project-runtime.js +53 -0
  374. package/src/lib/cad/project-store.js +25 -0
  375. package/src/lib/cad/project-workflows.js +31 -0
  376. package/src/lib/cad-docker.js +21 -2
  377. package/src/lib/cli-preferences.js +17 -2
  378. package/src/lib/core-client.js +37 -18
  379. package/src/lib/deploy/local-studio.js +6 -5
  380. package/src/lib/dockerize.js +3 -0
  381. package/src/lib/execution-approvals.js +1 -0
  382. package/src/lib/identity-scaffold.js +4 -1
  383. package/src/lib/knowledge-docker.js +9 -1
  384. package/src/lib/local-sessions.js +124 -34
  385. package/src/lib/local-status.js +35 -14
  386. package/src/lib/project-config.js +9 -0
  387. package/src/lib/provider-credentials.js +73 -11
  388. package/src/lib/scaffold/resolve-cloudflare-account.js +37 -0
  389. package/src/lib/scaffold/wizards/cms.js +2 -8
  390. package/src/lib/scaffold/wizards/worker-api.js +2 -8
  391. package/src/lib/slash-commands.js +9 -2
  392. package/src/local/migrations.js +109 -1
  393. package/src/local/runtime-store.js +31 -5
  394. package/src/local/sqlite.js +36 -1
  395. package/src/mcp/authority.js +348 -0
  396. package/src/mcp/client-adapters.js +431 -0
  397. package/src/mcp/client.js +172 -0
  398. package/src/mcp/index.js +47 -0
  399. package/src/mcp/telemetry.js +103 -0
  400. package/src/models/catalog.js +329 -51
  401. package/src/models/discovery.js +24 -4
  402. package/src/models/index.js +2 -0
  403. package/src/models/inventory-core.js +182 -0
  404. package/src/models/policy.js +20 -0
  405. package/src/plugins/cloudflare.js +103 -0
  406. package/src/plugins/completeful.js +69 -0
  407. package/src/plugins/contracts.js +86 -0
  408. package/src/plugins/index.js +11 -0
  409. package/src/plugins/registry.js +207 -0
  410. package/src/plugins/resource-scope.js +45 -0
  411. package/src/plugins/runtime.js +118 -0
  412. package/src/plugins/vectorize.js +31 -0
  413. package/src/progression/engine.js +171 -0
  414. package/src/progression/index.js +1 -0
  415. package/src/providers/cloudflare-chat.js +1 -1
  416. package/src/providers/gemini-generate-content.js +2 -1
  417. package/src/providers/openai-responses.js +45 -16
  418. package/src/providers/tool-schema.js +85 -0
  419. package/src/repository/index.js +29 -0
  420. package/src/rpc/generated/errors_pb.js +961 -1
  421. package/src/security/local-vault.js +415 -0
  422. package/src/security/process.js +20 -4
  423. package/src/status/actions.js +192 -0
  424. package/src/tools/hydrate.js +5 -1
  425. package/src/tools/index.js +7 -0
  426. package/src/tools/redact.js +64 -0
  427. package/src/tools/registry.js +83 -0
  428. package/src/tools/runtime.js +257 -0
  429. package/src/tools/search.js +21 -8
  430. package/src/ui/ansi.js +117 -3
  431. package/src/ui/cli/activity.js +76 -7
  432. package/src/ui/cli/footer.js +110 -9
  433. package/src/ui/cli/help.js +11 -4
  434. package/src/ui/wireframes.js +166 -0
  435. package/test/account-session.test.mjs +28 -0
  436. package/test/apps-scaffold-contract.test.mjs +16 -1
  437. package/test/capabilities.test.mjs +1 -1
  438. package/test/cli/eval-live.test.mjs +219 -0
  439. package/test/cli/go.test.mjs +71 -0
  440. package/test/cli/local-vault-and-provider-setup.test.mjs +268 -0
  441. package/test/cli/mcp-client.test.mjs +245 -0
  442. package/test/cli/runtime-ui.test.mjs +69 -2
  443. package/test/cli/status-actions.test.mjs +88 -0
  444. package/test/cli/wireframes-go-registry.test.mjs +54 -0
  445. package/test/cloudflare-connector.test.mjs +3 -6
  446. package/test/cloudflare-runtime.test.mjs +8 -1
  447. package/test/context.test.mjs +15 -0
  448. package/test/error-diagnostics.test.mjs +9 -0
  449. package/test/fixtures/cad/courtyard-house.json +208 -0
  450. package/test/go/cloudflare-probe.test.mjs +53 -0
  451. package/test/integration/app-command.test.mjs +55 -0
  452. package/test/integration/cad-discovery.test.mjs +158 -0
  453. package/test/integration/cad-docker-executor.test.mjs +249 -0
  454. package/test/integration/cad-execution.test.mjs +184 -0
  455. package/test/integration/cad-project-app.test.mjs +31 -0
  456. package/test/integration/cad-project-d1.test.mjs +25 -0
  457. package/test/integration/cad-project-native.test.mjs +24 -0
  458. package/test/integration/cad-project-workflow.test.mjs +9 -0
  459. package/test/integration/cad-project.test.mjs +82 -0
  460. package/test/integration/cli-help.test.mjs +4 -0
  461. package/test/integration/cms-site-tenancy-contract.test.mjs +256 -0
  462. package/test/integration/core-client.integration.test.mjs +55 -0
  463. package/test/integration/error-runtime-rpc.test.mjs +71 -0
  464. package/test/integration/features-resolve.test.mjs +128 -0
  465. package/test/integration/install-script.test.mjs +107 -0
  466. package/test/integration/inventory-core.test.mjs +53 -0
  467. package/test/integration/plugins-cloudflare.integration.test.mjs +28 -0
  468. package/test/integration/provider-env-cli.test.mjs +1 -1
  469. package/test/integration/runtime-migrations.test.mjs +6 -1
  470. package/test/integration/runtime-status.integration.test.mjs +211 -0
  471. package/test/integration/scaffold-cloudflare.test.mjs +46 -0
  472. package/test/integration/storage-architecture.test.mjs +154 -0
  473. package/test/integration/store-discovery.test.mjs +44 -0
  474. package/test/integration/terminal-exec.integration.test.mjs +86 -0
  475. package/test/integration/tool-runtime.test.mjs +124 -0
  476. package/test/integration/tool-schema.test.mjs +59 -0
  477. package/test/knowledge-service.test.mjs +4 -0
  478. package/test/local-sessions.test.mjs +11 -2
  479. package/test/local-studio-deploy.test.mjs +1 -1
  480. package/test/model-catalog.test.mjs +28 -1
  481. package/test/models.test.mjs +159 -5
  482. package/test/openai-responses.test.mjs +60 -0
  483. package/test/provider-credentials.test.mjs +15 -5
  484. package/test/responses-runner.test.mjs +321 -6
  485. package/test/shell.test.mjs +149 -4
  486. package/test/smoke.mjs +2 -2
  487. package/test/tools-search.test.mjs +33 -0
  488. package/test/unit/website-assets-bindings.test.mjs +60 -0
  489. package/test/whoami-resume.test.mjs +82 -3
  490. package/examples/gorilla-shell/README.md +0 -15
  491. package/src/lib/gorilla-template.js +0 -54
  492. package/templates/gorilla-shell/App.tsx +0 -639
  493. package/templates/gorilla-shell/README.md +0 -34
  494. package/templates/gorilla-shell/index.html +0 -15
  495. package/templates/gorilla-shell/main.jsx +0 -9
  496. package/templates/gorilla-shell/package.json +0 -19
  497. package/templates/gorilla-shell/vite.config.js +0 -21
@@ -0,0 +1,373 @@
1
+ # Multi-agent sprint plan — remaining AgentSam work
2
+
3
+ **Purpose:** Finish the open post-PR51 backlog end-to-end across bounded
4
+ AgentSam / Cursor Cloud Agent sessions, and produce a comparable grade for
5
+ Cursor Cloud Agent API value on real AgentSam work (not toy prompts).
6
+
7
+ **Status authority:** [`RECONCILIATION-2026-09-19.md`](./RECONCILIATION-2026-09-19.md)
8
+ **Canonical contract:** `AGENTSAM.md` (via `AGENTS.md` shim)
9
+ **Repo:** `SamPrimeaux/agentsam-sdk` · start every session from current `origin/main`
10
+
11
+ **Baseline after push (2026-09-19):**
12
+ ```text
13
+ origin/main: 67f4a75541855d16c5baecf29007cab05512b532
14
+ f6dafed feat(instructions): AGENTSAM + AGENTS/CLAUDE shims
15
+ 67f4a75 docs: post-PR51 reconciliation status authority
16
+ ```
17
+
18
+ **Global hard rules (every session)**
19
+
20
+ 1. Read `./AGENTSAM.md` first. Do not redesign storage / invent Durable Object defaults.
21
+ 2. `git fetch --all --prune` · `git worktree list` · `git status -sb` before edits.
22
+ 3. No `npm publish`, Worker deploy, worktree delete, force-push, or branch rewrite without Sam approval.
23
+ 4. Prefer `git worktree add` / feature branch + PR over direct `main` commits for implementation sessions.
24
+ 5. Inspect named parallel branches before rebuilding equivalent work.
25
+ 6. Evidence required: commands run, test output, SHAs. No “should work.”
26
+ 7. Stop at the session’s Done definition — do not expand into the next session’s scope.
27
+
28
+ **Recommended models (Cursor Cloud Agent)**
29
+
30
+ | Session type | Model | Effort |
31
+ | --- | --- | --- |
32
+ | Default AgentSam implementation | Gemini 3.8 Flash | High |
33
+ | Long tool-chain / multi-branch recon | Muse Spark 1.3 1M | Medium → High if stuck |
34
+ | Already-approved mechanical apply | GPT-5.6 Terra | Fast |
35
+ | Architecture stuck / merge conflict hell | GPT-5.6 Sol | default |
36
+
37
+ **A/B grade track (optional, after S1–S2 have a golden brief):** run the *same*
38
+ S1 brief on Gemini 3.8 Flash High vs Muse Spark 1.3 1M Medium and score both
39
+ with the rubric in §Grade.
40
+
41
+ ---
42
+
43
+ ## Cloud Agent API evaluation design
44
+
45
+ Each session below is a **Cloud Agent job unit**: fixed prompt, fixed repo,
46
+ fixed Done checklist, fixed grade dimensions. Run them as separate API
47
+ invocations (or sequential AgentSam CLI sessions) so you can score:
48
+
49
+ | Dimension | What to score (1–5) |
50
+ | --- | --- |
51
+ | D1 Inspect-before-invent | Opens existing files/branches before writing parallel systems |
52
+ | D2 Architecture fidelity | Honors AGENTSAM.md, storage law, session boundaries |
53
+ | D3 Tool-chain survival | Completes 15–40+ tool steps without abandoning |
54
+ | D4 Finish | Hits Done definition; opens PR or leaves reviewable branch |
55
+ | D5 Verify | Runs named tests / live CLI checks; pastes evidence |
56
+ | D6 No rebuild | Does not recreate studio-auth / CMS / connections / help-all |
57
+ | D7 Prose junk | Low fluff; high signal in final report |
58
+ | D8 Cost / latency | Tokens + wall time for the same brief (A/B only) |
59
+
60
+ **Scorecard file (create once, append per job):**
61
+ `docs/plans/CLOUD-AGENT-SCORECARD-2026-09.md` (session id, model, SHA in/out,
62
+ D1–D8, notes, PR URL).
63
+
64
+ ---
65
+
66
+ ## Dependency graph
67
+
68
+ ```text
69
+ S0 bootstrap (track UI draft + scorecard stub)
70
+ │
71
+ ├─► S1 interactive presence (UI req §§1–5)
72
+ │ └─► S2 status chrome + /model catalog surface
73
+ │
74
+ ├─► S3 studio-auth branch decision (parallel with S1)
75
+ ├─► S4 connections-binding branch decision (parallel with S1)
76
+ ├─► S5 CMS pattern docs + scaffold design (parallel)
77
+ │ └─► S6 scaffold-from-real-app implement
78
+ │
79
+ └─► S7 terminal_remote enrollment (platform; may touch IAM)
80
+ ⚠ not blocked by S1–S6; do NOT treat as OAuth
81
+
82
+ S8 optional Muse vs Gemini A/B on frozen S1 brief
83
+ S9 backlog only if capacity (errors / command manifest) — out of critical path
84
+ ```
85
+
86
+ **Critical path to “remaining sprints done”:** S0 → S1 → S2 → (S3∨S4 as needed) → S5 → S6, with S7 on a platform track.
87
+
88
+ ---
89
+
90
+ ## S0 — Bootstrap · ~15–30 min · Terra Fast or Flash Medium
91
+
92
+ **Goal:** Make the interactive UI brief git-tracked and give Cloud Agents a
93
+ scorecard stub + updated recon tip SHA.
94
+
95
+ **Branch:** `chore/sprint-bootstrap-20260919`
96
+
97
+ **Prompt (paste into Cloud Agent):**
98
+ ```text
99
+ Repo: agentsam-sdk. Start from origin/main. Read AGENTSAM.md.
100
+
101
+ 1. git fetch --all --prune; git worktree list; do not delete worktrees.
102
+ 2. Add and commit the currently untracked file
103
+ docs/plans/AGENTSAM-INTERACTIVE-UI-REQUIREMENTS.md if present locally;
104
+ if missing, stop and report.
105
+ 3. Create docs/plans/CLOUD-AGENT-SCORECARD-2026-09.md with a table template
106
+ (session, model, effort, sha_in, sha_out, D1–D8, pr_url, notes).
107
+ 4. Patch docs/plans/RECONCILIATION-2026-09-19.md baseline SHA to current
108
+ origin/main and note UI draft is now tracked.
109
+ 5. Open a PR. No npm publish. No deploy. No other features.
110
+ ```
111
+
112
+ **Done when:** PR merges (or is merge-ready); UI requirements tracked; scorecard exists.
113
+
114
+ **Grade focus:** D4 Finish, D5 Verify (file presence), D6 No rebuild.
115
+
116
+ ---
117
+
118
+ ## S1 — Interactive shell presence · ~1–2 h · Gemini 3.8 Flash High
119
+
120
+ **Goal:** Implement UI requirements §§1,3,5 then §2, then scope §4 — presence,
121
+ not architecture.
122
+
123
+ **Depends on:** S0 (or attach the untracked UI file in the job context).
124
+ **Branch:** `feat/cli-interactive-presence`
125
+ **Inspect first:** `src/ui/cli/activity.js`, `footer.js`, `src/commands/shell.js`,
126
+ existing diff helpers under `src/ui/` / `src/lib/`.
127
+
128
+ **Prompt:**
129
+ ```text
130
+ Repo: agentsam-sdk. origin/main. Read AGENTSAM.md and
131
+ docs/plans/AGENTSAM-INTERACTIVE-UI-REQUIREMENTS.md completely.
132
+
133
+ Implement in order: §1 interrupt hint, §3 footer project+action, §5 paste-collapse,
134
+ then §2 shimmer (with truecolor/256 fallback), then §4 only after searching for an
135
+ existing diff formatter (reuse; do not reinvent).
136
+
137
+ Rules: extend existing helpers; no storage changes; no DO; no publish/deploy;
138
+ run git worktree list first; open a PR with screenshots or CLI transcript evidence.
139
+
140
+ Verify: node --check on edited files; focused tests if present; manual
141
+ `node src/cli.js` interactive smoke notes in the PR.
142
+ ```
143
+
144
+ **Done when:** All five sections addressed (§4 may be “reuse X + wire call sites”
145
+ if a renderer already exists); PR + evidence.
146
+
147
+ **Grade focus:** D1–D7 (primary Cloud Agent value test for TUI work).
148
+
149
+ ---
150
+
151
+ ## S2 — Status chrome + provider-agnostic `/model` · ~2–3 h · Flash High / Muse Medium
152
+
153
+ **Goal:** Product surface that combines Codex run chrome + Cursor model menu:
154
+
155
+ ```text
156
+ project · git · contract AGENTSAM.md ✓ · runtime local SQLite ·
157
+ provider · model · effort · context · usage
158
+ ```
159
+
160
+ `/model` opens scrollable provider-agnostic catalog (reuse existing models
161
+ command / account-visible catalog — do not invent a second registry).
162
+
163
+ **Depends on:** S1 footer foundation.
164
+ **Branch:** `feat/cli-status-model-catalog`
165
+ **Inspect first:** `src/commands/models.js`, shell slash commands, footer from S1,
166
+ `feat/studio-auth-and-ai-wiring` (1 commit) before touching studio auth UI.
167
+
168
+ **Prompt:**
169
+ ```text
170
+ Build the persistent AgentSam session status strip and /model catalog UX
171
+ described in docs/plans/MULTI-AGENT-SPRINTS-2026-09-19.md S2.
172
+ Reuse account-visible models and existing provider credential surfaces.
173
+ Do not rebuild OAuth. Do not change storage authority.
174
+ Before any local-studio auth UI: git log / diff
175
+ origin/feat/studio-auth-and-ai-wiring...main and report whether to cherry-pick.
176
+ PR with before/after footer transcript.
177
+ ```
178
+
179
+ **Done when:** Footer/status shows contract + runtime + model/effort/context/usage;
180
+ `/model` lists real catalog entries; tests or transcript evidence; PR.
181
+
182
+ **Grade focus:** D1, D2, D6 (highest risk of reinventing models/auth).
183
+
184
+ ---
185
+
186
+ ## S3 — Studio auth branch triage · ~45–90 min · Flash High
187
+
188
+ **Goal:** Decide keep/merge/abandon for `feat/studio-auth-and-ai-wiring`
189
+ (1 commit ahead / 7 behind) — no blind rewrite.
190
+
191
+ **Branch:** `integrate/studio-auth-ai-wiring` or PR from rebased tip.
192
+
193
+ **Prompt:**
194
+ ```text
195
+ Inspect origin/feat/studio-auth-and-ai-wiring vs origin/main.
196
+ Summarize the single unique commit. Rebase or cherry-pick onto a fresh branch
197
+ from main if still valuable. Fix conflicts. Run relevant local-studio / auth tests.
198
+ Open PR or document “abandon because already on main” with evidence.
199
+ Do not expand into full identity redesign.
200
+ ```
201
+
202
+ **Done when:** Merged PR **or** written abandon receipt with SHA evidence.
203
+
204
+ ---
205
+
206
+ ## S4 — Connections / binding evidence triage · ~1–2 h · Flash High / Muse Medium
207
+
208
+ **Goal:** Land or extract useful bits from
209
+ `origin/fix/connections-binding-evidence` (11 ahead) without breaking
210
+ terminal bindings; feed evidence into later terminal work.
211
+
212
+ **Prompt:**
213
+ ```text
214
+ Diff origin/fix/connections-binding-evidence...origin/main.
215
+ Classify commits: merge as-is / cherry-pick subset / abandon.
216
+ If mergeable, rebase onto main, fix tests, open PR.
217
+ Explicitly state how this relates (or does not) to terminal_remote
218
+ platform_identity_missing — do NOT claim it fixes enrollment.
219
+ ```
220
+
221
+ **Done when:** PR or abandon receipt; note for S7 updated.
222
+
223
+ ---
224
+
225
+ ## S5 — CMS pattern docs + scaffold design · ~1–2 h · Flash High
226
+
227
+ **Goal:** Merge `docs/cms-scaffolding-pattern-reference` (4 commits) and write
228
+ a short design for scaffold-from-real-app (`apps/client-cms-editor`,
229
+ `apps/cad-creator`) — design only, no generator rewrite yet.
230
+
231
+ **Prompt:**
232
+ ```text
233
+ 1. Rebase/merge origin/docs/cms-scaffolding-pattern-reference onto main → PR.
234
+ 2. Add docs/plans/SCAFFOLD-FROM-REAL-APP-DESIGN.md answering:
235
+ template vs fixed platform files; D1/R2/Worker per project vs shared;
236
+ subtree vs copy-parameterize; how IMPORT_PROVENANCE.json is used.
237
+ 3. Do not implement scaffold generators in this session.
238
+ ```
239
+
240
+ **Done when:** Docs PR + design merged or merge-ready.
241
+
242
+ ---
243
+
244
+ ## S6 — Scaffold-from-real-app implement · ~2–4 h · Muse Medium/High or Flash High
245
+
246
+ **Depends on:** S5 design approval (Sam ack in PR or chat).
247
+ **Branch:** `feat/scaffold-from-real-apps`
248
+
249
+ **Prompt:**
250
+ ```text
251
+ Implement agentsam scaffold cms (and cad-creator if design says so) per
252
+ docs/plans/SCAFFOLD-FROM-REAL-APP-DESIGN.md.
253
+ Stand up parameterized instances of apps/client-cms-editor / apps/cad-creator —
254
+ do not regenerate the thin toy templates as the primary path.
255
+ Keep thin templates only if design marks them deprecated/compat.
256
+ Tests: scaffold dry-run or integration assertions; node --check; PR.
257
+ ```
258
+
259
+ **Done when:** Scaffold produces real-app-shaped tree; tests green; PR.
260
+
261
+ **Grade focus:** D1, D6 (reinvention risk extreme).
262
+
263
+ ---
264
+
265
+ ## S7 — terminal_remote enrollment (platform track) · separate job · Sol or Flash High
266
+
267
+ **Repo note:** Likely spans `agentsam-sdk` **and** IAM / terminal host config.
268
+ Treat as Cloud Agent job against the repo(s) Sam designates; SDK-only agents
269
+ must stop at diagnosis + SDK-side receipts if host access is missing.
270
+
271
+ **Prompt:**
272
+ ```text
273
+ terminal_remote fails with platform_identity_missing under platform_bridge.
274
+ Prior live evidence:
275
+ connection_key_set: false
276
+ platform_bridge_key_set: true
277
+ machine_key_set: true
278
+ account_id / connection_id / instance_id: null
279
+
280
+ This is NOT the CLI OAuth bug. Do not reopen PR #450 / auth-closure as the fix.
281
+
282
+ Mission: reconfirm fingerprint on remote exec host; implement enrollment/
283
+ pairing/provisioning so connection identity is non-null; prove
284
+ agentsam_terminal_remote (or equivalent) succeeds with evidence.
285
+ If this session lacks host credentials, produce an exact ops runbook +
286
+ SDK instrumentation PR only — do not invent OAuth token reshaping.
287
+ ```
288
+
289
+ **Done when:** Live exec succeeds **or** blocked with precise missing secret/host
290
+ access listed for Sam.
291
+
292
+ **Grade focus:** D2 (correct diagnosis), D6 (no OAuth rebuild), D5 (live proof).
293
+
294
+ ---
295
+
296
+ ## S8 — Model A/B (optional) · same brief as S1 frozen
297
+
298
+ Run identical S1 prompt on:
299
+
300
+ 1. Gemini 3.8 Flash High
301
+ 2. Muse Spark 1.3 1M Medium (escalate High only if stalled)
302
+
303
+ Fill scorecard D1–D8 + cost. Prefer the winner for S6/S7.
304
+
305
+ ---
306
+
307
+ ## S9 — Explicit non-goals / later backlog
308
+
309
+ Do **not** assign as Cloud Agent “finish remaining sprints” work:
310
+
311
+ - Storage / DO architecture redesign
312
+ - Errors-v1 divergent branches (56/40 ahead, 200+ behind) without a dedicated
313
+ errors mission
314
+ - Full command-manifest unification / lineage object / vocabulary CI
315
+ - `npm publish` / production Worker deploy
316
+ - Deleting worktrees
317
+
318
+ ---
319
+
320
+ ## Suggested Cloud Agent schedule (calendar)
321
+
322
+ | Day | Sessions | Parallelism |
323
+ | --- | --- | --- |
324
+ | Day 1 | S0 → S1 | S3 and S4 can start after S0 in parallel |
325
+ | Day 2 | S2 · finish S3/S4 | S5 in parallel |
326
+ | Day 3 | S6 after Sam approves S5 | S7 platform track anytime |
327
+ | Day 4 | S8 A/B if desired · merge lag · smoke | — |
328
+
329
+ **Human gates (Sam only):**
330
+
331
+ 1. Approve S5 design before S6.
332
+ 2. Approve any publish/deploy.
333
+ 3. Provide remote host / IAM access for S7 if agents are blocked.
334
+ 4. Pick A/B winner after S8.
335
+
336
+ ---
337
+
338
+ ## Session handoff packet (attach to every Cloud Agent job)
339
+
340
+ ```text
341
+ AGENTSAM.md
342
+ docs/plans/RECONCILIATION-2026-09-19.md
343
+ docs/plans/MULTI-AGENT-SPRINTS-2026-09-19.md (this file — your session id only)
344
+ docs/plans/AGENTSAM-INTERACTIVE-UI-REQUIREMENTS.md (S0–S2)
345
+ docs/plans/CLOUD-AGENT-SCORECARD-2026-09.md (append your row)
346
+ ```
347
+
348
+ **Return format required from every agent:**
349
+
350
+ ```text
351
+ ## Session <id>
352
+ Model / effort:
353
+ SHA in / SHA out:
354
+ Branch / PR:
355
+ Done checklist: [ ] ...
356
+ Grade self-score D1–D7:
357
+ Evidence (commands + outcomes):
358
+ Stopped because (if incomplete):
359
+ Next session should start at:
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Definition of “remaining sprints done”
365
+
366
+ All of the following are true:
367
+
368
+ - [ ] S0–S2 merged (interactive presence + status/`/model` chrome)
369
+ - [ ] S3–S4 decided (merged or abandon receipts)
370
+ - [ ] S5–S6 merged (CMS docs + real-app scaffold path)
371
+ - [ ] S7 live green **or** blocked only on Sam-held host secrets (runbook filed)
372
+ - [ ] Scorecard has ≥3 scored Cloud Agent jobs (enough to grade API value)
373
+ - [ ] Still no surprise npm publish / Worker deploy / storage redesign
@@ -0,0 +1,167 @@
1
+ # Next-agent handoff — stack on inventory PR
2
+
3
+ **Read first:** `AGENTSAM.md` · this file · open PR branch below
4
+ **Do not** start from stale Astra notes. Do not redesign storage. Do not invent DOs.
5
+
6
+ ## Where we are (2026-09-19)
7
+
8
+ ```text
9
+ Branch (pushed): feat/per-user-model-inventory-dist @ dc24e62
10
+ Open PR: https://github.com/SamPrimeaux/agentsam-sdk/pull/new/feat/per-user-model-inventory-dist
11
+ (gh auth was 401 last push — create/merge PR if not open yet)
12
+ main tip before this work: 5affb1f (recon + AGENTS shims + sprint plan)
13
+ verify:release: PASS on this branch
14
+ ```
15
+
16
+ Commits on the branch (do not redo):
17
+
18
+ 1. Cursor in `API_PROVIDERS` + live discovery
19
+ 2. Shared `src/models/inventory-core.js`
20
+ 3. Studio inventory picker + fail-closed `{provider, model_id}` chat
21
+ 4. `/usage` panel + activity chrome
22
+ 5. `agentsam app` + CMS/Studio manifests/bins
23
+ 6. `scripts/install.sh` npm-bootstrap installer
24
+
25
+ Untracked (leave unless Sam says incorporate):
26
+ `docs/plans/AGENTSAM-INTERACTIVE-UI-REQUIREMENTS.md`
27
+
28
+ ---
29
+
30
+ ## Critical correction — “platform” is not a stub
31
+
32
+ Local Studio **already ships with real production bindings and secrets**.
33
+ `credential_plane: platform` means **desk/org Worker secrets + bindings**, not
34
+ “we haven’t set anything up.”
35
+
36
+ ### Documented production surface (`agentsam-sdk` Worker)
37
+
38
+ **Bindings (honor these):**
39
+
40
+ | Binding | Type | Value |
41
+ | --- | --- | --- |
42
+ | `AGENTSAM_WAI` | Workers AI | catalog |
43
+ | `DB` | D1 | `inneranimalmedia-business` |
44
+ | `EXECOS` | Service | `execos` |
45
+ | `HYPERDRIVE` | Hyperdrive | supabase hyperdrive |
46
+ | `PTY_SERVICE` | VPC Service | `iam-vpc` |
47
+ | `WEBSITE_ASSETS` | R2 | `agentsam-os-blueprint-content` |
48
+ | `ASSETS` | Assets | `.output/public` |
49
+
50
+ **Runtime secrets/vars already present (do not print values):**
51
+
52
+ - `OPENAI_API_KEY`, `GEMINI_API_KEY`, `CURSOR_API_KEY`
53
+ - `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_OAUTH_*`, break-glass admin token
54
+ - `AGENTSAM_BRIDGE_KEY`
55
+ - `IAM_CLIENT_ID` / `IAM_CLIENT_SECRET` / `IAM_OAUTH_ISSUER`
56
+
57
+ So Studio inventory/chat **can and should** discover models from these
58
+ platform credentials today. That is intentional desk authority.
59
+
60
+ ### What is still missing (your job)
61
+
62
+ **Layer vault BYOK on top of platform — prefer vault when the logged-in user has it.**
63
+
64
+ ```text
65
+ authenticated session
66
+ │
67
+ ▼
68
+ user_id / account_id
69
+ │
70
+ ├─► D1 user_secrets unwrap (DB + VAULT_MASTER_KEY) → source: user_vault
71
+ │ preferred per provider when present
72
+ │
73
+ └─► else platform Worker secret / AGENTSAM_WAI → source: platform
74
+ ```
75
+
76
+ Hard rules (unchanged):
77
+
78
+ - Never read `~/.agentsam` from Studio.
79
+ - Never return secrets to the browser.
80
+ - Never silently swap providers (no XAI→OpenAI).
81
+ - Selection stays `{ provider, model_id }`.
82
+ - Sam’s machine `env.d` ≠ Connor’s Studio options.
83
+
84
+ Worker already has vault routes + `GET /api/llm/inventory` provenance.
85
+ TanStack `/api/llm/inventory` + `/api/chat` currently use **platform** via
86
+ `apps/local-studio/shared/agentsam/src/studio-inventory.ts`.
87
+
88
+ **Next implementation slice:** bind IAM/browser session → `user_id`, unwrap
89
+ that user’s `user_secrets` server-side, merge vault-over-platform into
90
+ `buildStudioInventory` / chat credential resolve. Reuse
91
+ `apps/local-studio/backend/worker/index.js` vault decrypt path — do not invent
92
+ a second vault.
93
+
94
+ Inspect before rebuild:
95
+
96
+ - `feat/studio-auth-and-ai-wiring` (worktree) — **auth portal / session gate only**;
97
+ **reject** any XAI→OpenAI chat fallback hunk.
98
+
99
+ ---
100
+
101
+ ## Exact next batches (pick one, finish it, PR)
102
+
103
+ ### A — Session→vault inventory (highest leverage) · Flash High
104
+
105
+ 1. Checkout `feat/per-user-model-inventory-dist` (or merge it to main first if Sam approves).
106
+ 2. Wire Studio auth session so inventory/chat get a real `user_id` (not `studio-local`).
107
+ 3. Server-side: vault unwrap for that user → merge over platform credentials.
108
+ 4. Prove: user A inventory ≠ user B; secrets never in JSON; mismatch still 409.
109
+ 5. Route Cloudflare curated models through `env.AGENTSAM_WAI` when provider is
110
+ `cloudflare` / Workers AI lane (binding already exists).
111
+
112
+ ### B — Auth portal live · Flash High
113
+
114
+ 1. Inspect `feat/studio-auth-and-ai-wiring` vs main.
115
+ 2. Cherry-pick **portal + Worker identity routes only** (no AI fallback).
116
+ 3. Prove `/auth/login` `/auth/signup` `/auth/reset` on Studio host.
117
+ 4. That unblocks A’s session→user_id.
118
+
119
+ ### C — Host `/install` · Terra Fast / Flash Medium
120
+
121
+ SDK already has `scripts/install.sh`. IAM/host must serve:
122
+
123
+ `GET https://agentsam.inneranimalmedia.com/install` → that script body.
124
+
125
+ App selectors: `/install/cad` `/install/cms` `/install/studio` (same engine, different `--app`).
126
+
127
+ ### D — Interactive UI polish · Flash High
128
+
129
+ Use untracked `docs/plans/AGENTSAM-INTERACTIVE-UI-REQUIREMENTS.md` against
130
+ activity/footer/shell (partially done by `/usage` commit). Finish interrupt
131
+ hint / paste-collapse / shimmer if still open — extend, don’t rebuild.
132
+
133
+ ---
134
+
135
+ ## Do not touch / already done
136
+
137
+ | Item | Status |
138
+ | --- | --- |
139
+ | Project SQLite storage / no default DOs | Done (PR #51) |
140
+ | `agentsam help all` | Works on main |
141
+ | Cursor machine discovery | Done on this branch |
142
+ | Static Studio Grok-only menu | Replaced on this branch |
143
+ | `agentsam app` manifests | Done on this branch |
144
+ | npm publish / surprise deploy | Forbidden without Sam |
145
+
146
+ ---
147
+
148
+ ## Operating rules for this handoff
149
+
150
+ 1. `git fetch --all --prune` · `git worktree list` before create/delete.
151
+ 2. One focused PR; keep stacking on `feat/per-user-model-inventory-dist` unless merged.
152
+ 3. Run `npm run verify:release` before claiming done.
153
+ 4. End with: SHA, tests, remaining blockers with evidence, next slice letter (A/B/C/D).
154
+ 5. If blocked on IAM session cookies / vault master key / deploy, stop with exact missing access — don’t invent OAuth reshapes.
155
+
156
+ ## Return format
157
+
158
+ ```text
159
+ ## Session
160
+ Slice: A|B|C|D
161
+ SHA in / out:
162
+ PR:
163
+ Done:
164
+ Evidence:
165
+ Blocked (if any):
166
+ Next slice:
167
+ ```