@inneranimalmedia/agentsam-sdk 2.6.4 → 2.6.5

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 (418) hide show
  1. package/AGENTSAM.md +11 -0
  2. package/README.md +15 -9
  3. package/apps/client-cms-editor/AGENTS.md +12 -0
  4. package/apps/client-cms-editor/IMPORT_PROVENANCE.json +8 -0
  5. package/apps/client-cms-editor/README.md +72 -0
  6. package/apps/client-cms-editor/agentsam.app.json +57 -0
  7. package/apps/client-cms-editor/backend/README.md +5 -0
  8. package/apps/client-cms-editor/backend/package.json +22 -0
  9. package/apps/client-cms-editor/backend/src/api/client.ts +200 -0
  10. package/apps/client-cms-editor/backend/src/demo-bootstrap.ts +145 -0
  11. package/apps/client-cms-editor/backend/src/index.ts +6 -0
  12. package/apps/client-cms-editor/backend/src/model.ts +115 -0
  13. package/apps/client-cms-editor/backend/src/preview/bridge.ts +79 -0
  14. package/apps/client-cms-editor/backend/src/preview/urls.ts +55 -0
  15. package/apps/client-cms-editor/backend/src/routing/cms-route.js +293 -0
  16. package/apps/client-cms-editor/backend/src/routing/index.js +10 -0
  17. package/apps/client-cms-editor/backend/src/storefront.ts +52 -0
  18. package/apps/client-cms-editor/backend/tsconfig.json +15 -0
  19. package/apps/client-cms-editor/backend/worker/index.js +34 -0
  20. package/apps/client-cms-editor/backend/wrangler.jsonc +11 -0
  21. package/apps/client-cms-editor/bin/agentsam-cms.mjs +229 -0
  22. package/apps/client-cms-editor/frontend/index.html +12 -0
  23. package/apps/client-cms-editor/frontend/package.json +33 -0
  24. package/apps/client-cms-editor/frontend/src/AgentSamDrawer.tsx +188 -0
  25. package/apps/client-cms-editor/frontend/src/CmsAgentSurface.tsx +191 -0
  26. package/apps/client-cms-editor/frontend/src/CmsEditor.tsx +1345 -0
  27. package/apps/client-cms-editor/frontend/src/env.d.ts +14 -0
  28. package/apps/client-cms-editor/frontend/src/index.ts +8 -0
  29. package/apps/client-cms-editor/frontend/src/lib/content-safety.ts +63 -0
  30. package/apps/client-cms-editor/frontend/src/main.tsx +17 -0
  31. package/apps/client-cms-editor/frontend/src/mount.tsx +51 -0
  32. package/apps/client-cms-editor/frontend/src/styles/agentsam-drawer.css +214 -0
  33. package/apps/client-cms-editor/frontend/src/styles/cmsShell.css +1739 -0
  34. package/apps/client-cms-editor/frontend/src/styles/studio.css +106 -0
  35. package/apps/client-cms-editor/frontend/src/surfaces/CmsDashboard.tsx +313 -0
  36. package/apps/client-cms-editor/frontend/src/surfaces/CmsGuidedChatHero.tsx +121 -0
  37. package/apps/client-cms-editor/frontend/src/surfaces/CmsHubPage.tsx +132 -0
  38. package/apps/client-cms-editor/frontend/src/surfaces/CmsSiteSwitcher.tsx +176 -0
  39. package/apps/client-cms-editor/frontend/src/surfaces/index.ts +5 -0
  40. package/apps/client-cms-editor/frontend/src/surfaces/types.ts +48 -0
  41. package/apps/client-cms-editor/frontend/tsconfig.json +25 -0
  42. package/apps/client-cms-editor/frontend/vite.config.ts +13 -0
  43. package/apps/client-cms-editor/package-lock.json +3832 -0
  44. package/apps/client-cms-editor/package.json +23 -0
  45. package/apps/client-cms-editor/reference/DONOR_README.md +52 -0
  46. package/apps/client-cms-editor/reference/DONOR_package-lock.json +1253 -0
  47. package/apps/client-cms-editor/reference/DONOR_tsconfig.json +15 -0
  48. package/apps/client-cms-editor/shared/cms/package.json +21 -0
  49. package/apps/client-cms-editor/shared/cms/src/agent-context.ts +35 -0
  50. package/apps/client-cms-editor/shared/cms/src/cloudflare-bindings.ts +51 -0
  51. package/apps/client-cms-editor/shared/cms/src/editor-types.ts +58 -0
  52. package/apps/client-cms-editor/shared/cms/src/index.ts +5 -0
  53. package/apps/client-cms-editor/shared/cms/src/publication.ts +24 -0
  54. package/apps/client-cms-editor/shared/cms/src/routes.ts +11 -0
  55. package/apps/client-cms-editor/shared/cms/tsconfig.json +12 -0
  56. package/bin/agentsam-rapid-rust +36 -0
  57. package/docs/AUTH_IDENTITY_CONTRACT.md +2 -0
  58. package/docs/MACHINE_INTELLIGENCE.md +120 -0
  59. package/docs/WINDOWS_RUNTIME_INSTALL.md +30 -0
  60. package/docs/architecture/AGENTSAM_APPLICATION_CONTRACT.md +188 -0
  61. package/docs/architecture/AGENTSAM_RUNTIME_PROTOCOL.md +151 -0
  62. package/docs/architecture/LOCAL_STUDIO_CLOUDFLARE_OAUTH.md +12 -4
  63. package/docs/architecture/R2_SLUG_NAMESPACE.md +20 -0
  64. package/docs/architecture/WORK_PRODUCT_EXTRACTION.md +97 -0
  65. package/docs/brand/AGENT_SAM_ICON_GRAMMAR.md +70 -0
  66. package/docs/content-studio/HOST_MOUNT_CHECKLIST.md +71 -0
  67. package/docs/content-studio/REVISION_GATE_2026-09-27.md +501 -0
  68. package/docs/contracts/capability-install-planner.md +67 -0
  69. package/docs/contracts/environment-vocabulary.md +195 -0
  70. package/docs/contracts/google-cloud-oauth-setup.md +199 -0
  71. package/docs/local-studio/WORKMODE_DONOR_NOTES.md +1 -1
  72. package/docs/plans/LOCAL-STUDIO-GRADUATION-2026-09-26.md +290 -0
  73. package/docs/plans/LOCAL-STUDIO-REAL-APP-CONTRACT-ADDENDUM-2026-09-27.md +394 -0
  74. package/docs/plans/MACHINE-FIRST-APPS-TUI-2026-09-24.md +227 -0
  75. package/docs/plans/TOMORROW-EXTENSIVE-TODO-2026-09-26.md +221 -0
  76. package/docs/plans/TOMORROW-MACHINE-FIRST-BRIEFING.md +145 -0
  77. package/docs/plans/UNIVERSAL-INGEST-MACHINE-FIRST-2026-09-24.md +215 -0
  78. package/docs/plugins.md +2 -2
  79. package/docs/product/AGENTSAM_PRODUCT_EXPERIENCE_STANDARD.md +280 -0
  80. package/docs/product/LOCAL_STUDIO_DESKTOP_EXPERIENCE.md +139 -0
  81. package/docs/product/README.md +8 -0
  82. package/docs/rapid-rust-wasm.md +35 -0
  83. package/migrations/d1/0016_cloudflare_oauth_user_oauth_tokens_ssot.sql +14 -0
  84. package/package.json +73 -14
  85. package/packages/agentsam-brand/README.md +106 -11
  86. package/packages/agentsam-brand/bin/agentsam-brand.mjs +9 -0
  87. package/packages/agentsam-brand/package.json +39 -7
  88. package/packages/agentsam-brand/src/adapters/cloudflare-images.js +453 -0
  89. package/packages/agentsam-brand/src/adapters/cloudflare-r2.js +74 -0
  90. package/packages/agentsam-brand/src/adapters/d1-registry.js +26 -0
  91. package/packages/agentsam-brand/src/adapters/filesystem.js +59 -0
  92. package/packages/agentsam-brand/src/adapters/memory.js +31 -0
  93. package/packages/agentsam-brand/src/cli/controller.js +503 -0
  94. package/packages/agentsam-brand/src/cli/wizard.js +526 -0
  95. package/packages/agentsam-brand/src/core/capabilities.js +201 -0
  96. package/packages/agentsam-brand/src/core/derivatives.js +211 -0
  97. package/packages/agentsam-brand/src/core/errors.js +12 -0
  98. package/packages/agentsam-brand/src/core/ingest.js +195 -0
  99. package/packages/agentsam-brand/src/core/inspect.js +109 -0
  100. package/packages/agentsam-brand/src/core/keys.js +83 -0
  101. package/packages/agentsam-brand/src/core/naming.js +142 -0
  102. package/packages/agentsam-brand/src/core/optimize.js +316 -0
  103. package/packages/agentsam-brand/src/core/pack.js +305 -0
  104. package/packages/agentsam-brand/src/core/plan.js +276 -0
  105. package/packages/agentsam-brand/src/core/preview.js +159 -0
  106. package/packages/agentsam-brand/src/core/processors/cloudflare.js +68 -0
  107. package/packages/agentsam-brand/src/core/processors/contract.js +203 -0
  108. package/packages/agentsam-brand/src/core/processors/index.js +148 -0
  109. package/packages/agentsam-brand/src/core/processors/native.js +82 -0
  110. package/packages/agentsam-brand/src/core/processors/sharp.js +113 -0
  111. package/packages/agentsam-brand/src/core/processors/squoosh-binary.js +195 -0
  112. package/packages/agentsam-brand/src/core/promote.js +288 -0
  113. package/packages/agentsam-brand/src/core/receipts.js +155 -0
  114. package/packages/agentsam-brand/src/core/v2/compile.js +280 -0
  115. package/packages/agentsam-brand/src/core/v2/derivatives-semantic.js +207 -0
  116. package/packages/agentsam-brand/src/core/v2/ingest-graph.js +387 -0
  117. package/packages/agentsam-brand/src/core/v2/roles.js +180 -0
  118. package/packages/agentsam-brand/src/core/v2/schema.js +209 -0
  119. package/packages/agentsam-brand/src/core/v2/templates.js +114 -0
  120. package/packages/agentsam-brand/src/index.js +193 -36
  121. package/packages/agentsam-brand/src/presets/app-icon.json +16 -0
  122. package/packages/agentsam-brand/src/presets/favicon.json +17 -0
  123. package/packages/agentsam-brand/src/presets/hero.json +12 -0
  124. package/packages/agentsam-brand/src/presets/index.js +40 -0
  125. package/packages/agentsam-brand/src/presets/logo.json +12 -0
  126. package/packages/agentsam-brand/src/presets/model.json +8 -0
  127. package/packages/agentsam-brand/src/presets/og-image.json +10 -0
  128. package/packages/agentsam-brand/src/presets/product-shot.json +11 -0
  129. package/packages/agentsam-brand/src/presets/social-image.json +10 -0
  130. package/packages/agentsam-brand/src/presets/web-image.json +10 -0
  131. package/packages/agentsam-contracts/src/artifacts.ts +41 -0
  132. package/packages/agentsam-knowledge/src/autorag/index.js +1 -1
  133. package/packages/agentsam-knowledge/src/providers/index.js +6 -4
  134. package/packages/agentsam-knowledge/src/providers/ollama-endpoint.js +31 -0
  135. package/packages/agentsam-knowledge/test/autorag.test.mjs +22 -1
  136. package/packages/agentsam-nav/package.json +2 -2
  137. package/packages/agentsam-rapid-rust/Cargo.lock +344 -0
  138. package/packages/agentsam-rapid-rust/Cargo.toml +18 -0
  139. package/packages/agentsam-rapid-rust/README.md +5 -0
  140. package/packages/agentsam-rapid-rust/src/main.rs +718 -0
  141. package/packages/agentsam-rapid-rust/templates/api/Cargo.toml.tmpl +18 -0
  142. package/packages/agentsam-rapid-rust/templates/api/src/lib.rs.tmpl +17 -0
  143. package/packages/agentsam-rapid-rust/templates/common/README.md.tmpl +22 -0
  144. package/packages/agentsam-rapid-rust/templates/common/package.json.tmpl +12 -0
  145. package/packages/agentsam-rapid-rust/templates/common/wrangler.toml.tmpl +6 -0
  146. package/packages/agentsam-rapid-rust/templates/crypto-auth/Cargo.toml.tmpl +21 -0
  147. package/packages/agentsam-rapid-rust/templates/crypto-auth/src/lib.rs.tmpl +32 -0
  148. package/packages/agentsam-rapid-rust/templates/data-processor/Cargo.toml.tmpl +18 -0
  149. package/packages/agentsam-rapid-rust/templates/data-processor/src/lib.rs.tmpl +41 -0
  150. package/packages/agentsam-rapid-rust/templates/shared-core/Cargo.toml.tmpl +9 -0
  151. package/packages/agentsam-rapid-rust/templates/shared-core/core/Cargo.toml.tmpl +7 -0
  152. package/packages/agentsam-rapid-rust/templates/shared-core/core/src/lib.rs.tmpl +23 -0
  153. package/packages/agentsam-rapid-rust/templates/shared-core/worker/Cargo.toml.tmpl +12 -0
  154. package/packages/agentsam-rapid-rust/templates/shared-core/worker/src/lib.rs.tmpl +16 -0
  155. package/packages/agentsam-rapid-rust/templates/shared-core/wrangler.toml.tmpl +6 -0
  156. package/packages/agentsam-repository/src/index.js +1 -0
  157. package/packages/agentsam-repository/src/merkle/semantic.js +3 -10
  158. package/packages/agentsam-repository/src/source-types.js +85 -0
  159. package/packages/agentsam-vault/README.md +96 -0
  160. package/packages/agentsam-vault/package.json +32 -0
  161. package/packages/agentsam-vault/src/contracts/credential.d.ts +78 -0
  162. package/packages/agentsam-vault/src/contracts/credential.js +132 -0
  163. package/packages/agentsam-vault/src/crypto/aes-gcm.d.ts +30 -0
  164. package/packages/agentsam-vault/src/crypto/aes-gcm.js +107 -0
  165. package/packages/agentsam-vault/src/crypto/oauth-envelope.js +150 -0
  166. package/packages/agentsam-vault/src/index.d.ts +9 -0
  167. package/packages/agentsam-vault/src/index.js +27 -0
  168. package/packages/agentsam-vault/src/providers/registry.js +90 -0
  169. package/packages/agentsam-vault/src/runtime/resolver.js +77 -0
  170. package/packages/agentsam-workbench/README.md +24 -0
  171. package/packages/agentsam-workbench/package.json +38 -0
  172. package/packages/agentsam-workbench/src/agent/AgentPanel.tsx +41 -0
  173. package/packages/agentsam-workbench/src/agent/ArtifactCard.tsx +9 -0
  174. package/packages/agentsam-workbench/src/agent/Composer.tsx +102 -0
  175. package/packages/agentsam-workbench/src/agent/ConnectedAgentPanel.tsx +194 -0
  176. package/packages/agentsam-workbench/src/agent/ContextualComposer.tsx +788 -0
  177. package/packages/agentsam-workbench/src/agent/GoalStatusStrip.tsx +38 -0
  178. package/packages/agentsam-workbench/src/agent/MiniAgentSam.tsx +86 -0
  179. package/packages/agentsam-workbench/src/agent/ModelSelect.tsx +19 -0
  180. package/packages/agentsam-workbench/src/agent/Thread.tsx +56 -0
  181. package/packages/agentsam-workbench/src/agent/ToolReceipt.tsx +11 -0
  182. package/packages/agentsam-workbench/src/agent/contextual-composer.css +611 -0
  183. package/packages/agentsam-workbench/src/agent/index.ts +10 -0
  184. package/packages/agentsam-workbench/src/agent/mini-agentsam.css +12 -0
  185. package/packages/agentsam-workbench/src/browser/BrowserFrame.tsx +37 -0
  186. package/packages/agentsam-workbench/src/browser/index.ts +1 -0
  187. package/packages/agentsam-workbench/src/index.ts +6 -0
  188. package/packages/agentsam-workbench/src/project-control.css +160 -0
  189. package/packages/agentsam-workbench/src/projects/ProjectsSurface.tsx +131 -0
  190. package/packages/agentsam-workbench/src/projects/index.ts +1 -0
  191. package/packages/agentsam-workbench/src/shell/Breadcrumb.tsx +35 -0
  192. package/packages/agentsam-workbench/src/shell/ResizableStage.tsx +99 -0
  193. package/packages/agentsam-workbench/src/shell/SidePanel.tsx +5 -0
  194. package/packages/agentsam-workbench/src/shell/index.ts +4 -0
  195. package/packages/agentsam-workbench/src/shell/surfaceRegistry.ts +29 -0
  196. package/packages/agentsam-workbench/src/terminal/TerminalSurface.tsx +5 -0
  197. package/packages/agentsam-workbench/src/terminal/index.ts +1 -0
  198. package/packages/agentsam-workbench/src/timeline/GanttBoard.tsx +258 -0
  199. package/packages/agentsam-workbench/src/timeline/index.ts +1 -0
  200. package/packages/agentsam-workbench/tsconfig.json +13 -0
  201. package/packages/connectors/cloudflare/OAUTH_STORAGE_AUDIT.md +53 -0
  202. package/packages/connectors/cloudflare/package.json +3 -1
  203. package/packages/connectors/cloudflare/src/api-client.js +279 -0
  204. package/packages/connectors/cloudflare/src/capabilities.js +585 -0
  205. package/packages/connectors/cloudflare/src/credential.js +318 -0
  206. package/packages/connectors/cloudflare/src/families/brand-protection.js +123 -0
  207. package/packages/connectors/cloudflare/src/families/keyless.js +114 -0
  208. package/packages/connectors/cloudflare/src/families/pages.js +151 -0
  209. package/packages/connectors/cloudflare/src/families/scanner.js +123 -0
  210. package/packages/connectors/cloudflare/src/families/snippets.js +207 -0
  211. package/packages/connectors/cloudflare/src/families/tag-gateway.js +46 -0
  212. package/packages/connectors/cloudflare/src/families/tags.js +124 -0
  213. package/packages/connectors/cloudflare/src/families/token-validation.js +95 -0
  214. package/packages/connectors/cloudflare/src/families/workflows.js +156 -0
  215. package/packages/connectors/cloudflare/src/index.js +102 -265
  216. package/packages/connectors/cloudflare/src/oauth-persist.js +336 -0
  217. package/packages/connectors/cloudflare/src/owner.js +42 -12
  218. package/packages/connectors/cloudflare/src/permission-options.js +1064 -0
  219. package/packages/connectors/cloudflare/src/routes.js +309 -144
  220. package/packages/connectors/cloudflare/src/scope-catalog.js +345 -0
  221. package/packages/connectors/cloudflare/src/vault.js +2 -2
  222. package/packages/connectors/cloudflare/tests/capabilities.test.mjs +276 -0
  223. package/packages/connectors/cloudflare/tests/connector.test.mjs +26 -30
  224. package/packages/connectors/cloudflare/tests/oauth-persist.test.mjs +125 -0
  225. package/packages/identity/.agentsam/features/oauth-login-portal/providers.json +22 -2
  226. package/packages/identity/.agentsam/features/oauth-login-portal/resources.json +10 -4
  227. package/packages/identity/.agentsam/features/oauth-login-portal/routes.json +20 -0
  228. package/packages/identity/README.md +1 -1
  229. package/packages/identity/backend/README.md +1 -1
  230. package/packages/identity/migrations/D1_SCHEMA_MAPPING.md +3 -2
  231. package/packages/identity/migrations/sqlite/004_identity_oauth_consent_catalog.sql +48 -0
  232. package/packages/identity/package.json +4 -3
  233. package/packages/identity/scripts/local-identity-bridge.mjs +184 -0
  234. package/packages/identity/scripts/preview-auth-portal.mjs +7 -7
  235. package/packages/identity/src/adapters/cloudflare-d1/index.js +31 -2
  236. package/packages/identity/src/adapters/sqlite/index.js +4 -1
  237. package/packages/identity/src/contracts/auth-config.js +28 -8
  238. package/packages/identity/src/contracts/external-identity.js +1 -1
  239. package/packages/identity/src/contracts/provider.js +1 -0
  240. package/packages/identity/src/frontend/auth-portal/README.md +2 -1
  241. package/packages/identity/src/frontend/auth-portal/pages/login.html +6 -5
  242. package/packages/identity/src/frontend/auth-portal/pages/reset.html +6 -5
  243. package/packages/identity/src/frontend/auth-portal/pages/signup.html +6 -5
  244. package/packages/identity/src/frontend/auth-portal/shared/company-branding.js +1 -1
  245. package/packages/identity/src/frontend/auth-portal/shared/desktop-identity-bridge.js +207 -0
  246. package/packages/identity/src/index.js +16 -0
  247. package/packages/identity/src/migrations/0001_identity_core.sql +19 -2
  248. package/packages/identity/src/migrations/0003_accounts_ssot.sql +20 -0
  249. package/packages/identity/src/migrations/README.md +5 -2
  250. package/packages/identity/src/oauth/README.md +10 -5
  251. package/packages/identity/src/oauth/consent-view.js +388 -0
  252. package/packages/identity/src/oauth/credentials.js +31 -11
  253. package/packages/identity/src/oauth/google-desktop-exchange.js +173 -0
  254. package/packages/identity/src/providers/cloudflare/oauth.js +3 -4
  255. package/packages/identity/src/providers/cloudflare/profile.js +49 -14
  256. package/packages/identity/src/providers/iam/index.js +27 -5
  257. package/packages/identity/src/server/identity-service.js +31 -2
  258. package/packages/identity/src/server/worker-router.js +111 -81
  259. package/packages/identity/tests/auth-config.test.mjs +3 -2
  260. package/packages/identity/tests/identity-init-scaffold.test.mjs +3 -0
  261. package/packages/identity/tests/identity-service.test.mjs +16 -0
  262. package/packages/identity/tests/native-session-worker.test.mjs +64 -0
  263. package/packages/identity/tests/oauth-consent-view.test.mjs +106 -0
  264. package/packages/identity/tests/oauth-credentials.test.mjs +17 -4
  265. package/packages/identity/tests/oauth-presets-accounts-ssot.test.mjs +58 -0
  266. package/packages/identity/tests/preview-auth-portal.test.mjs +3 -3
  267. package/packages/runtime-protocol/src/index.js +154 -0
  268. package/packages/theme-scenes/README.md +164 -0
  269. package/packages/theme-scenes/package.json +53 -0
  270. package/packages/theme-scenes/src/blocks/index.js +30 -0
  271. package/packages/theme-scenes/src/contracts/index.js +286 -0
  272. package/packages/theme-scenes/src/demos/index.js +65 -0
  273. package/packages/theme-scenes/src/index.js +75 -0
  274. package/packages/theme-scenes/src/presets/index.js +263 -0
  275. package/packages/theme-scenes/src/runtime/compile.js +119 -0
  276. package/packages/theme-scenes/src/scenes/index.js +146 -0
  277. package/packages/theme-scenes/src/shell/index.js +47 -0
  278. package/packages/theme-scenes/src/themes/index.js +129 -0
  279. package/packages/theme-scenes/src/visuals/index.js +41 -0
  280. package/packages/theme-scenes/test/theme-scenes.test.mjs +179 -0
  281. package/packages/work-graph/src/index.js +34 -1
  282. package/packages/work-graph/src/renderers/gantt-model.js +24 -0
  283. package/packages/work-graph/test/work-graph.test.mjs +27 -7
  284. package/protocol/README.md +15 -7
  285. package/protocol/apps/agentsam.app.v1.schema.json +89 -7
  286. package/protocol/apps/agentsam.host-install.v1.schema.json +36 -0
  287. package/protocol/assets/README.md +9 -0
  288. package/protocol/assets/asset-record.v1.schema.json +64 -0
  289. package/protocol/runtime/agentsam.runtime.v1.schema.json +75 -0
  290. package/protocol/scoring/README.md +10 -0
  291. package/protocol/scoring/scorecard.v1.schema.json +65 -0
  292. package/protocol/ui/icon-registry.mjs +1 -0
  293. package/registry/cms-rust-machine-20260928/installable-products.json +31 -0
  294. package/registry/cms-rust-machine-20260928/manifest.json +22 -0
  295. package/registry/cms-rust-machine-20260928/migration.sql +237 -0
  296. package/registry/cms-rust-machine-20260928/receipt.json +21 -0
  297. package/registry/cms-rust-machine-20260928/receipt.sql +27 -0
  298. package/scripts/build_rapid_rust_cli.py +83 -0
  299. package/src/attachments/index.js +6 -0
  300. package/src/attachments/intake.js +235 -0
  301. package/src/capabilities/repository-snapshot.js +19 -2
  302. package/src/cli/command-catalog.js +8 -0
  303. package/src/cli.js +182 -26
  304. package/src/commands/account-auth.js +94 -8
  305. package/src/commands/app.js +307 -3
  306. package/src/commands/billing.js +127 -0
  307. package/src/commands/brand.js +74 -60
  308. package/src/commands/cheat-sheet.js +154 -0
  309. package/src/commands/cloudflare-login.js +222 -0
  310. package/src/commands/cloudflare.js +453 -23
  311. package/src/commands/codebaseindex.js +6 -1
  312. package/src/commands/compute.js +4 -0
  313. package/src/commands/connections.js +11 -5
  314. package/src/commands/credentials.js +116 -0
  315. package/src/commands/gcloud-auth.js +427 -0
  316. package/src/commands/google-cloud.js +375 -0
  317. package/src/commands/identity-init.js +2 -2
  318. package/src/commands/mcp.js +226 -33
  319. package/src/commands/ollama.js +3 -2
  320. package/src/commands/plugins.js +7 -2
  321. package/src/commands/product.js +36 -0
  322. package/src/commands/runtime-status.js +28 -9
  323. package/src/commands/runtime.js +313 -0
  324. package/src/commands/rust.js +24 -0
  325. package/src/commands/setup.js +279 -0
  326. package/src/commands/shell.js +16 -3
  327. package/src/commands/start-local.js +2 -2
  328. package/src/commands/terminal.js +171 -0
  329. package/src/commands/update.js +140 -0
  330. package/src/commands/whoami.js +329 -65
  331. package/src/features/resolve.js +1 -0
  332. package/src/index.js +4 -0
  333. package/src/indexing/ingest/inventory.js +254 -19
  334. package/src/indexing/ingest/materials.js +3 -9
  335. package/src/indexing/ingest/style-evidence.js +181 -0
  336. package/src/knowledge/source.js +3 -3
  337. package/src/lib/account-session.js +11 -4
  338. package/src/lib/app-authority.js +172 -0
  339. package/src/lib/auth.js +94 -21
  340. package/src/lib/core-client.js +5 -6
  341. package/src/lib/credentials-audit.js +451 -0
  342. package/src/lib/deploy/health.js +24 -6
  343. package/src/lib/detect-context.js +7 -1
  344. package/src/lib/google-cloud-connection.js +270 -0
  345. package/src/lib/google-cloud-inventory.js +385 -0
  346. package/src/lib/google-desktop-oauth.js +372 -0
  347. package/src/lib/google-studio-brokered-oauth.js +158 -0
  348. package/src/lib/identity-scaffold.js +24 -6
  349. package/src/lib/init-options.js +192 -0
  350. package/src/lib/local-scaffold.js +48 -16
  351. package/src/lib/provider-command-remediation.js +308 -0
  352. package/src/lib/provider-credentials.js +8 -0
  353. package/src/lib/scaffold/index.js +8 -2
  354. package/src/lib/scaffold/mcp-server.js +43 -0
  355. package/src/lib/scaffold/templates/mcp-server/index.js +397 -0
  356. package/src/lib/scaffold/templates/mcp-server/presets.js +39 -0
  357. package/src/lib/scaffold/wizards/cms.js +93 -0
  358. package/src/lib/scaffold/wizards/mcp-server.js +61 -0
  359. package/src/lib/setup/contract.js +26 -0
  360. package/src/lib/setup/discover.js +116 -0
  361. package/src/lib/setup/execute.js +205 -0
  362. package/src/lib/setup/planner.js +134 -0
  363. package/src/lib/setup/recipes.js +235 -0
  364. package/src/lib/setup/runtime-persist.js +197 -0
  365. package/src/lib/setup/runtime.js +394 -0
  366. package/src/lib/slash-commands.js +2 -0
  367. package/src/lib/terminal/machine-identity.js +95 -0
  368. package/src/lib/terminal-local.js +164 -0
  369. package/src/lib/terminal-scopes.js +52 -0
  370. package/src/lib/whoami-capabilities.js +184 -0
  371. package/src/local-pty/server.js +34 -5
  372. package/src/mcp/authority.js +58 -108
  373. package/src/mcp/client-adapters.js +68 -144
  374. package/src/mcp/client.js +142 -122
  375. package/src/mcp/cloudflare-bundles.js +225 -0
  376. package/src/mcp/index.js +12 -0
  377. package/src/plugins/cloudflare.js +1 -1
  378. package/src/providers/ollama-chat.js +2 -1
  379. package/src/sam/types.js +27 -2
  380. package/src/security/inventory.js +12 -2
  381. package/src/security/local-vault.js +2 -0
  382. package/src/security/scan.js +1 -1
  383. package/test/account-session.test.mjs +3 -3
  384. package/test/app-authority-context.test.mjs +32 -0
  385. package/test/cli/codebaseindex-plan-ux.test.mjs +1 -1
  386. package/test/cli/mcp-client.test.mjs +21 -10
  387. package/test/cli/runtime-persist.test.mjs +56 -0
  388. package/test/cli/rust-command.test.mjs +21 -0
  389. package/test/credentials-audit.test.mjs +113 -0
  390. package/test/deploy-health-scan.test.mjs +29 -1
  391. package/test/gcloud-auth.test.mjs +111 -0
  392. package/test/google-cloud-connection.test.mjs +83 -0
  393. package/test/google-cloud-inventory.test.mjs +64 -0
  394. package/test/init-options.test.mjs +35 -0
  395. package/test/integration/app-command.test.mjs +30 -0
  396. package/test/integration/cad-project.test.mjs +4 -1
  397. package/test/integration/cms-app-scaffold.test.mjs +71 -0
  398. package/test/integration/cms-site-tenancy-contract.test.mjs +3 -2
  399. package/test/integration/codebaseindex-ingest.test.mjs +48 -0
  400. package/test/integration/features-resolve.test.mjs +30 -11
  401. package/test/integration/inspect-path-cli.test.mjs +46 -0
  402. package/test/integration/inventory-evidence.test.mjs +125 -0
  403. package/test/integration/runtime-status.integration.test.mjs +2 -1
  404. package/test/knowledge.test.mjs +35 -1
  405. package/test/loopback-oauth.test.mjs +53 -0
  406. package/test/ollama.test.mjs +22 -0
  407. package/test/security.test.mjs +23 -0
  408. package/test/setup-planner.test.mjs +74 -0
  409. package/test/setup-runtime.test.mjs +51 -0
  410. package/test/terminal/local-pty.mock.test.mjs +3 -1
  411. package/test/terminal-machine-identity.test.mjs +88 -0
  412. package/test/whoami-resume.test.mjs +27 -6
  413. package/packages/agentsam-brand/test/brand-scan.test.mjs +0 -106
  414. package/packages/work-graph/prototype/README.md +0 -32
  415. package/packages/work-graph/prototype/data/demo-workgraph.js +0 -47
  416. package/packages/work-graph/prototype/renderers/timeline-model.js +0 -21
  417. package/packages/work-graph/prototype/renderers/workgraph-runtime.js +0 -38
  418. package/packages/work-graph/prototype-gnantt.html +0 -655
@@ -0,0 +1,501 @@
1
+ # Content Studio revision gate — SSOT lock + normalize plan
2
+
3
+ **Acceptance sentence (every package):**
4
+
5
+ > Could this exact capability be consumed tomorrow by Local Studio, IAM,
6
+ > Fuel & Free Time, and an unknown customer app without modifying the package?
7
+
8
+ If the answer is no because of branding, routes, credentials, storage, RAG,
9
+ or a hardcoded provider — it is not finished.
10
+
11
+ ---
12
+
13
+ ## REPLACE THE OLD INVARIANT
14
+
15
+ **OLD (retired — do not use):**
16
+
17
+ > Content owns assets. BrandPack owns brand meaning. Providers own bytes.
18
+
19
+ **LOCKED SSOT:**
20
+
21
+ 1. **Account/Auth** owns identity, tenancy and permissions.
22
+
23
+ 2. **Shared Asset Core** (`@inneranimalmedia/agentsam-assets-core` /
24
+ `protocol/assets/`) owns canonical asset identity (`ast_*`), machine facts,
25
+ provenance and provider **representations**.
26
+
27
+ 3. **BrandPack** (`brand.pack.json` / `@inneranimalmedia/agentsam-sdk-brand`)
28
+ owns the canonical brand system **AND brand-scoped assets**: logos, icons,
29
+ fonts, imagery, video, models, themes, styles, tokens, motion, semantic
30
+ roles and brand delivery rules. BrandPack does **not** own physical storage
31
+ implementation — representations live on providers via Asset Core.
32
+
33
+ 4. **Content** (`@inneranimalmedia/agentsam-content`) owns general
34
+ content/library concerns: lifecycle, collections, CMS imports, generated
35
+ content, live/draft state, page/product usage and non-brand organization.
36
+
37
+ 5. **BrandPack and Content are PEER domains** over shared Asset Core.
38
+ Neither owns the other. One photograph may be both a BrandPack
39
+ `image.hero` and a Content live `/about` usage of the same `ast_*`.
40
+
41
+ 6. **Providers own representations/transport only**: R2 keys, CF Image IDs,
42
+ Stream UIDs, Drive IDs, local handles. Provider identity is never
43
+ canonical asset identity. Deleting a provider object ≠ deleting `ast_*`.
44
+
45
+ 7. **Local is a first-class** source/storage/execution environment
46
+ (`LocalContentHost`), not a cloud fallback.
47
+
48
+ 8. **Host runtime** supplies credentials, capabilities and provider adapters
49
+ (Local Studio, IAM, F&F, customers — each different).
50
+
51
+ 9. **Knowledge/vector/RAG** systems are **derived indexes** via host-injected
52
+ `ContentKnowledgeAdapter` / `BrandSimilarityAdapter` and are never source
53
+ of truth. Rebuildable. Matching may use embeddings, but never imports a
54
+ host vector backend into Content/Brand packages.
55
+
56
+ 10. **BrandPack remains the canonical CLI-first brand workflow**
57
+ (`agentsam brand ingest|build|preview|optimize|publish` + brand asset
58
+ subcommands). Content adds peer `agentsam content *` over the same
59
+ Asset Core operations. **Brand inference is not BrandPack authority** —
60
+ see Brand matching law below.
61
+
62
+ 11. **Every GUI operation** must map to a reusable programmatic operation
63
+ and CLI surface (same operation contract).
64
+
65
+ 12. **Every CLI operation** must be callable through the same operation
66
+ layer used by GUI and agents.
67
+
68
+ 13. **No production feature** is accepted if it requires an app-specific fork.
69
+
70
+ 14. **No generic package** may contain real customer/product presets,
71
+ credentials, routes or provider assumptions.
72
+
73
+ 15. **Compiled ZIPs, previews, R2 copies, CF Images variants and exports**
74
+ are projections/materializations — not SSOT. `brand.pack.json` remains
75
+ BrandPack SoT.
76
+
77
+ 16. A feature is not finished until: contract · CLI · GUI can consume same
78
+ operation · tests · account scope · local behavior where relevant ·
79
+ injectable providers · documentation identifies authority.
80
+
81
+ ### Domain authority table
82
+
83
+ | Domain | Single authority | Owns |
84
+ |---|---|---|
85
+ | Identity/account | auth/account runtime | `account_id`, actor, permissions, ownership |
86
+ | Asset identity | Asset Core | `ast_*`, hashes, provenance, representations, revisions |
87
+ | Brand | `brand.pack.json` / agentsam-brand | brand system + brand-scoped assets/roles/rules |
88
+ | General content | agentsam-content | library lifecycle, collections, CMS/usage |
89
+ | Storage/delivery | provider adapters | bytes/refs only |
90
+ | Local machine | LocalContentHost | FS handles, watch, native processing |
91
+ | Jobs/events | AgentSam runtime | durable work, receipts, activity |
92
+ | Knowledge | host-injected adapter | derived Vectorize/AutoRAG/pgvector/SQLite/… |
93
+ | Brand inference | Content intelligence (proposals only) | association proposals with evidence/confidence |
94
+ | Harvest productization | SiteGraph / TokenGraph → proposals | Theme/Template/Section/Component candidates |
95
+ | UI | Studio/CLI | clients of shared operations — never a second implementation |
96
+
97
+ ### Peer shape (not a stack)
98
+
99
+ ```
100
+ Asset Core (ast_*)
101
+ ↑ ↑
102
+ BrandPack Content
103
+ │ │
104
+ └────┬─────┘
105
+ ▼
106
+ Content Studio / Brand Studio / CLI / Agent tools
107
+ ```
108
+
109
+ ### Brand matching law (authority vs intelligence)
110
+
111
+ `agentsam-brand` / BrandPack and brand inference **coexist with different jobs**:
112
+
113
+ | Capability | Job | Authority? |
114
+ |---|---|---|
115
+ | **BrandPack** | Canonical brand definition (logos, icons, fonts, colors, themes, style, voice, imagery, video, 3D, roles, delivery rules, known assets) | **Yes — truth** |
116
+ | **ContentBrandResolver** | Host projection of BrandPack into Content (ids, names, aliases, signal projections). Content must not import agentsam-brand upward. | Projection only |
117
+ | **Exact lookup** | `resolveBrand` / `matchKnownBrandId` / `resolver.get(id)` — deterministic id/alias resolution | Lookup against truth |
118
+ | **`inferBrandAssociation`** | Intelligence: given unknown asset/content, which known BrandPack does it most likely belong to? | **No — proposal** |
119
+
120
+ ```
121
+ BrandPack
122
+ canonical brand authority
123
+ │
124
+ │ projection
125
+ ▼
126
+ ContentBrandResolver
127
+ │
128
+ ┌────────────┴─────────────┐
129
+ ▼ ▼
130
+ exact brand lookup inferBrandAssociation()
131
+ │
132
+ deterministic signals
133
+ embeddings / vector
134
+ optional semantic AI
135
+ │
136
+ ▼
137
+ association proposal
138
+ │
139
+ human / AgentSam policy
140
+ │
141
+ ▼
142
+ ContentAsset.brandId → BrandPack id
143
+ ```
144
+
145
+ **Amended Commit 2 instruction (replaces “remove matchBrand()”):**
146
+
147
+ > Remove the competing local BrandPack schema/type. Preserve brand inference
148
+ > as a reusable intelligence capability. Refactor it to operate on
149
+ > projections/candidates obtained through ContentBrandResolver. Matching may
150
+ > use deterministic signals, embeddings, semantic retrieval, or host-injected
151
+ > intelligence, and must return evidence/confidence rather than establish
152
+ > BrandPack authority.
153
+
154
+ Rename guidance:
155
+
156
+ - `inferBrandAssociation(asset, candidates, …)` — classification / proposal
157
+ - reserve `matchBrand` / `resolveBrand` / `matchKnownBrandId` for exact/resolved lookup if kept
158
+ - local mini type becomes `BrandCandidate` / `BrandProjection` (signals only), never `BrandPack`
159
+
160
+ Multi-stage inference (cheap → expensive):
161
+
162
+ 1. Deterministic: filename, directory, tags, project, source URL/domain, known usage, colors, hash/duplicate, metadata
163
+ 2. Machine/semantic: image/text embeddings, CLIP-style similarity, OCR, caption embedding, logo / known-asset similarity
164
+ 3. Optional LLM adjudication only when ambiguous
165
+
166
+ Host-injected similarity (do **not** import Vectorize/AutoRAG into Content):
167
+
168
+ ```
169
+ interface BrandSimilarityAdapter {
170
+ rank(asset: AssetRecord, candidates: BrandProjection[]): Promise<BrandMatchCandidate[]>;
171
+ }
172
+ ```
173
+
174
+ Hosts may implement with Vectorize, Supabase pgvector, local Ollama+SQLite, or no embeddings.
175
+
176
+ **Never** silently write inference into BrandPack or treat a keyword mini-registry as brand meaning. Policy acceptance → `ContentAsset.brandId` reference only.
177
+
178
+ ### Semantic token states (observation ≠ truth)
179
+
180
+ | State | Meaning |
181
+ |---|---|
182
+ | **OBSERVED** | Literal source evidence (`#0e1015`, `bg-zinc-950`, `var(--surface)`, …) |
183
+ | **CANDIDATE** | Inferred semantic normalization (`surface.canvas.dark`, confidence, cluster) |
184
+ | **CANONICAL** | Accepted token in a ThemePack / BrandPack / package after review |
185
+
186
+ Never silently promote OBSERVED/CANDIDATE → CANONICAL.
187
+
188
+ ### Harvest classification taxonomy
189
+
190
+ Not every scanned site is a BrandPack. Classification targets:
191
+
192
+ | Kind | Role |
193
+ |---|---|
194
+ | **SiteProfile** | Evidence for one scanned build — not necessarily installable |
195
+ | **BrandPack** | Owner-specific identity |
196
+ | **ThemePack** | Reusable visual system (colors, surfaces, type scale, motion) |
197
+ | **TemplatePack** | Reusable page/app composition |
198
+ | **SectionPack** | Reusable scene/section |
199
+ | **ComponentPack** | Buttons, cards, drawers, nav, media viewer, … |
200
+
201
+ Owner association (repo, customer, commit, paths) stays on evidence; reusable packages may be owner-neutral.
202
+
203
+ ### Harvest pipeline shape (deterministic-first)
204
+
205
+ ```
206
+ DISCOVER → PARSE → NORMALIZE → FINGERPRINT → CLUSTER
207
+ → EMBED (only worth comparing) → CLASSIFY → PROPOSE → REVIEW → COMPILE
208
+ ```
209
+
210
+ ```
211
+ HARVEST
212
+ │
213
+ ┌───────────────┼────────────────┐
214
+ ▼ ▼ ▼
215
+ Asset Core SiteGraph TokenGraph
216
+ │ │ │
217
+ └──────────┬────┴──────────┬─────┘
218
+ ▼ ▼
219
+ clustering semantics
220
+ │ │
221
+ └──────┬────────┘
222
+ ▼
223
+ Productization
224
+ │
225
+ ┌───────────┼───────────┐
226
+ ▼ ▼ ▼
227
+ BrandPack ThemePack TemplatePack
228
+ SectionPack
229
+ ComponentPack
230
+ ```
231
+
232
+ Go/local runtime owns high-volume deterministic work (walk, hash, MIME, light parse, inventories, checkpoints). TypeScript owns shared contracts/compilers. AI owns ambiguous naming/classification only. Embedding backends remain host adapters over neutral `SemanticArtifact` emissions.
233
+
234
+ Scan output must produce **actionable proposals** (package-readiness scores, token families, duplicates, section clusters) — not stop at indexes/embeddings. No package becomes canonical without review. CLI and GUI share the same harvest operations.
235
+
236
+ ---
237
+
238
+ ## Severity / product context
239
+
240
+ Paying customer galleries (e.g. Fuel & Free Time) underperform vs the donor
241
+ gallery that already includes R2, Google Drive, Cloudflare Images, tagging,
242
+ editing, multi-size variants, and inspect. The same portable gallery must
243
+ serve **at least three hosts without forks**:
244
+
245
+ 1. Fuel & Free Time (customer)
246
+ 2. Inner Animal Media platform dashboard
247
+ 3. AgentSam Local Studio
248
+
249
+ Plus video gallery dual-use (Stream delivery + R2 masters), in-app AgentSam
250
+ create/edit/post → organize/tag/document → host knowledge adapters so brands
251
+ and sites actually learn. Quality, load, and display performance are
252
+ first-class acceptance criteria — not polish.
253
+
254
+ Portability gate: if a host difference (storage, OAuth, RAG, routes, brand)
255
+ forces a package change, the seam is wrong.
256
+
257
+ ---
258
+
259
+ ## Audit snapshot (pre-normalize)
260
+
261
+ | Field | Value |
262
+ |---|---|
263
+ | Worktree | `/Users/samprimeaux/agent-worktrees/content-studio-audit` |
264
+ | Branch | `audit/agentsam-content-studio-transplant-20260927` |
265
+ | Base head | `28ef451` (transplant on main) |
266
+ | Brand audit | `/tmp/agentsam-brand-authority-audit.json` |
267
+ | Provider audit | `/tmp/agentsam-provider-authority-audit.txt` |
268
+ | Status | Contracts normalize in progress; **not** host-ready |
269
+
270
+ ### Pre-normalize FAIL highlights (still true until later commits)
271
+
272
+ | Issue | Status |
273
+ |---|---|
274
+ | Competing local `BrandPack` type in content (+ demo keyword packs) | FAIL → commit 2 scrub schema; **keep** inference as `inferBrandAssociation` |
275
+ | Real customer literals as brand-authority fixtures | FAIL → scrub commit 2 (fictional fixtures only) |
276
+ | No ScoreCard / independent score families | FAIL → scoring package + gate section |
277
+ | Duplicate CF Images clients | FAIL → commit 3 |
278
+ | Monolithic `ContentProvider` | FAIL → contracts in commit 1; migrate commit 3+ |
279
+ | `RagSink` Vectorize/AutoRAG-shaped | FAIL → `ContentKnowledgeAdapter` in commit 1 |
280
+ | No `LocalContentHost` | FAIL → contract commit 1; impl commit 4 |
281
+ | Fixed UI collections / no `runtime.capabilities()` | FAIL → contract commit 1; UI commit 5 |
282
+ | R2 Data Catalog as media registry | PASS (absent) |
283
+ | `.bundle` | DEFERRED (repository package) |
284
+ | Semantic harvest product loop (SiteGraph / TokenGraph → proposals) | MANDATED — contracts/shape in gate; pipeline impl after normalize series |
285
+
286
+ ---
287
+
288
+ ## SCORING / CALIBRATION REQUIREMENT
289
+
290
+ Raw evidence is SSOT. Scores are **versioned derived views** — recomputable from
291
+ evidence + weight configs. Never treat a ScoreCard as authority over BrandPack,
292
+ Asset Core, or OBSERVED tokens.
293
+
294
+ ### ScoreCard contract
295
+
296
+ ```ts
297
+ interface ScoreCard {
298
+ id: string;
299
+ kind:
300
+ | "theme-similarity"
301
+ | "brand-affinity"
302
+ | "template-similarity"
303
+ | "section-reuse"
304
+ | "token-consistency"
305
+ | "portability"
306
+ | "package-readiness"
307
+ | "drift"
308
+ | "confidence"
309
+ | "structural-similarity"
310
+ | "reuse";
311
+ score: number; // 0..100
312
+ confidence: number; // 0..1
313
+ algorithm: string;
314
+ weightsVersion: string;
315
+ components: Record<string, { raw: number; normalized: number; weight: number; contribution: number }>;
316
+ penalties: Record<string, number>;
317
+ evidenceRefs: string[];
318
+ computedAt: string;
319
+ }
320
+ ```
321
+
322
+ Package: `@inneranimalmedia/agentsam-scoring` (+ `protocol/scoring/`).
323
+ Content/brand re-export helpers as needed; they do **not** own scoring SSOT.
324
+
325
+ ### Rules
326
+
327
+ 1. **Independent score families** — NEVER one grand `similarity_score`.
328
+ 2. **Weights in versioned config files** (`weights/brand-affinity.v1.json`,
329
+ `weights/package-readiness.v1.json`, …) — not scattered magic constants.
330
+ 3. **Deterministic first**; embeddings via injected adapters; LLM last.
331
+ 4. **Human accept/reject calibrates recommendations** (Beta / outcome receipts).
332
+ Calibration does **not** mutate deterministic evidence.
333
+ 5. Export helpers for `brand_affinity` / `package_readiness` v1 even when the
334
+ harvest pipeline is incomplete.
335
+ 6. `inferBrandAssociation` returns ScoreCard-shaped **brand-affinity** evidence
336
+ (proposal only — never BrandPack authority).
337
+
338
+ ### brand_affinity v1 weights
339
+
340
+ | Component | Weight |
341
+ |---|---|
342
+ | known-asset | 0.30 |
343
+ | logo/mark | 0.20 |
344
+ | names/domains/metadata | 0.15 |
345
+ | palette | 0.10 |
346
+ | typography | 0.10 |
347
+ | imagery-style | 0.10 |
348
+ | contextual usage | 0.05 |
349
+
350
+ ### package_readiness v1 weights
351
+
352
+ | Component | Weight |
353
+ |---|---|
354
+ | recurrence | 0.22 |
355
+ | structural | 0.18 |
356
+ | portability | 0.16 |
357
+ | token coverage | 0.14 |
358
+ | responsive | 0.10 |
359
+ | stability | 0.08 |
360
+ | framework independence | 0.07 |
361
+ | testability | 0.05 |
362
+
363
+ Minus penalties (owner-specific literals, hardcoded routes, secrets, host
364
+ coupling, silent CANONICAL promotion, …).
365
+
366
+ ---
367
+
368
+ ## SEMANTIC HARVEST / PRODUCTIZATION REQUIREMENT
369
+
370
+ The Asset/Content/Brand architecture must support future bulk harvesting of
371
+ large local codebases **without introducing another parallel schema**.
372
+
373
+ AgentSam must be able to scan arbitrary HTML, CSS, JS/TS/TSX, Vue/Svelte,
374
+ theme/config files, and media references, and emit normalized evidence for:
375
+
376
+ - semantic design tokens
377
+ - layout primitives
378
+ - page structure
379
+ - reusable sections / components
380
+ - animation/motion patterns
381
+ - typography systems
382
+ - media roles
383
+ - asset references
384
+
385
+ Token processing preserves **OBSERVED → CANDIDATE → CANONICAL** (never silent
386
+ promotion). Brand identity and reusable visual/theme systems are separate
387
+ concepts (BrandPack ≠ ThemePack).
388
+
389
+ Bulk pipeline is deterministic-first (discover → parse → normalize →
390
+ fingerprint → cluster → then embeddings / semantic inference). Go/local
391
+ runtime handles high-volume deterministic scanning where useful.
392
+ Embedding/vector/RAG is host-injected.
393
+
394
+ Outputs must cause action: reusable section/theme/template candidates, token
395
+ normalization opportunities, duplicated assets, near-duplicate components,
396
+ package-readiness scores, owner-specific literals blocking extraction.
397
+ Every proposal preserves provenance (repo, commit, path, symbol/DOM, owner/app).
398
+ No package is generated as canonical without review/approval.
399
+ CLI and GUI use the same scan and proposal operations.
400
+
401
+ Target ROI shape (example): scanned N projects → theme families, section
402
+ families, shells, real brands, duplicate assets, package candidates above a
403
+ readiness threshold — not merely “indexed lines of code.”
404
+
405
+ ---
406
+
407
+ ## Machine-enforced production gates (target)
408
+
409
+ `verify` / package verify MUST reject:
410
+
411
+ - real customer literals in generic `src/`
412
+ - app-specific routes in generic packages
413
+ - host names in package contracts
414
+ - direct secret reads from React/UI
415
+ - direct Tauri / raw `fs` imports in reusable UI / browser graph
416
+ - duplicate BrandPack **schema/authority** outside agentsam-brand
417
+ (brand **inference** proposals are allowed; mini BrandPack registries are not)
418
+ - duplicate CF Images transport
419
+ - permissive `allowAll` as production default (tests/demo only)
420
+ - account-unscoped stores
421
+ - fixed provider tabs / fixed intelligence backend
422
+ - fake local runtime / Demo product configuration in packages
423
+ - silent promotion of OBSERVED/CANDIDATE tokens to CANONICAL without review
424
+
425
+ Commit 1 adds contracts + documents these gates. Enforcement lands with
426
+ authority scrub / verify hooks in later commits.
427
+
428
+ ---
429
+
430
+ ## Normalize commit series
431
+
432
+ | Commit | Scope | Explicitly out |
433
+ |---|---|---|
434
+ | **1** | Asset Core · ContentBrandResolver · ContentKnowledgeAdapter · capability split · LocalContentHost · `runtime.capabilities()` · account/permission boundary types | No app host wiring · no OAuth · no provider client migration · no demo wiring · no `.bundle` |
435
+ | **2** | Authority scrub: remove competing local BrandPack schema/type; refactor brand inference → `inferBrandAssociation` on resolver projections + evidence/confidence; fictional fixtures only; optional `BrandSimilarityAdapter` seam; **ScoreCard foundation** (`agentsam-scoring`) | Host UI · full harvest pipeline · embedding backends |
436
+ | **3** | Shared CF Images (and related) transport extract | Host mounts |
437
+ | **4** | LocalContentHost host-side boundary (Tauri/agentsamd behind) | App screens |
438
+ | **5** | Generic Content Studio UI consumes `runtime.capabilities()` | App-specific mounts |
439
+ | **6** | Host mounts: Local Studio · IAM · F&F | — |
440
+ | later | `.bundle` in agentsam-repository · harvest SiteGraph/TokenGraph productization CLI/GUI | — |
441
+
442
+ **“NO host UI” clarification:** commit 1 must not modify
443
+ `apps/local-studio/...`, IAM dashboard routes, or F&F admin screens.
444
+ **Generic** `packages/agentsam-content-studio` may change for contracts/types
445
+ only — no app-specific behavior.
446
+
447
+ ---
448
+
449
+ ## GUI ↔ CLI law
450
+
451
+ ```
452
+ operation contract (Asset Core + domain)
453
+
454
+ drag/drop ──────┐
455
+ file picker ────┤
456
+ Studio button ──┤
457
+ CLI filepath ───┼──→ asset.ingest / brand.asset.* / content.*
458
+ stdin ──────────┤
459
+ URL / Drive ────┤
460
+ Agent tool ─────┘
461
+ ```
462
+
463
+ A GUI-only capability is incomplete. A CLI-only capability that cannot be
464
+ surfaced programmatically is incomplete. Intake normalizes to
465
+ `AttachmentIntake → AssetInput → operation`.
466
+
467
+ ---
468
+
469
+ ## Normalize commit 1 checklist
470
+
471
+ - [x] Rewrite this gate with locked SSOT (this document)
472
+ - [x] `@inneranimalmedia/agentsam-assets-core` + `protocol/assets/`
473
+ - [x] `ContentBrandResolver` / brand projection (not BrandPack schema)
474
+ - [x] `ContentKnowledgeAdapter` (neutral; RagSink → adapter shim)
475
+ - [x] Capability-split adapter contracts (source / storage / delivery / video)
476
+ - [x] `LocalContentHost` + availability states
477
+ - [x] `runtime.capabilities()`
478
+ - [x] Account-scoped actor/permission boundary types on runtime config
479
+ - [x] No app host wiring / demo / OAuth / `.bundle`
480
+
481
+ **STOP host mounts until commit 1 contracts are stable.** Next: commit 2
482
+ authority scrub (**keep** brand inference; remove competing BrandPack schema)
483
+ + ScoreCard foundation.
484
+
485
+ ### Normalize commit 2 checklist
486
+
487
+ - [x] Remove competing local `BrandPack` type → `BrandCandidate` / `BrandProjection`
488
+ - [x] `inferBrandAssociation()` returns proposal + brand-affinity ScoreCard
489
+ - [x] Optional `BrandSimilarityAdapter` seam (no Vectorize/AutoRAG in content)
490
+ - [x] Exact lookup reserved via `ContentBrandResolver.get` / `matchKnownBrandId`
491
+ - [x] Fictional fixtures only in demos/tests
492
+ - [x] Content does not import agentsam-brand for brand meaning
493
+ - [x] `@inneranimalmedia/agentsam-scoring` + protocol/scoring + gate SCORING section
494
+ - [x] Tests for ScoreCard compute + explainability + brand association
495
+
496
+ ### Normalize commit 3–5 targets
497
+
498
+ - [x] Shared CF Images transport (`@inneranimalmedia/agentsam-cloudflare-images`)
499
+ - [x] LocalContentHost host-side stubs (memory / attachable seams)
500
+ - [x] Content Studio UI derives provider/capability chrome from `runtime.capabilities()`
501
+ - [x] Mount checklist for Local Studio / IAM / F&F (commit 6 / Path B)
@@ -0,0 +1,67 @@
1
+ # Capability install planner (Homebrew-style)
2
+
3
+ Agent Sam **orchestrates** installs. It does not replace Homebrew, apt, winget, or npm.
4
+
5
+ ## Stages
6
+
7
+ ```text
8
+ DISCOVER → PLAN → EXPLAIN → APPROVE → EXECUTE → VERIFY + RECEIPT
9
+ ```
10
+
11
+ | Stage | Owner |
12
+ | --- | --- |
13
+ | Discover | Agent Sam (`agentsam setup`) |
14
+ | Plan / explain / approve | Agent Sam |
15
+ | Execute packages | Native provider (`brew`, `apt`, `winget`, `npm`) |
16
+ | Verify + receipt | Agent Sam → `~/.agentsam/receipts/setup-*.json` |
17
+
18
+ ## Commands
19
+
20
+ ```bash
21
+ agentsam setup --list
22
+ agentsam setup --dry-run
23
+ agentsam setup # interactive approve
24
+ agentsam setup --yes # non-interactive approve
25
+ agentsam setup image.vectorize
26
+ agentsam setup google.cloud
27
+ agentsam setup google.cloud --inventory
28
+ ```
29
+
30
+ ## Recipe contract
31
+
32
+ Each installable capability exposes:
33
+
34
+ ```js
35
+ {
36
+ id, displayName, description,
37
+ detect(), supportedPlatforms,
38
+ installPlans: { darwin|linux|win32: { provider, packages|commands, notes } },
39
+ dependencies, mutations, risk, requiresApproval,
40
+ verify(), uninstallHint(), capabilityProvided
41
+ }
42
+ ```
43
+
44
+ Never silently: install software, trust third-party taps, edit shell profiles, enable paid cloud APIs, or change provider credentials without approval + explicit mutation listing.
45
+
46
+ ## Google Cloud inventory
47
+
48
+ ```bash
49
+ agentsam setup google.cloud --inventory
50
+ ```
51
+
52
+ Collects (read-only): auth accounts, active config, OAuth token scopes, projects, billing accounts, IAM roles for the active user. Use after install / login to programmatically drive:
53
+
54
+ ```bash
55
+ agentsam gcloud auth login
56
+ agentsam google-cloud connection set --identity EMAIL --project PROJECT
57
+ agentsam google-cloud doctor
58
+ ```
59
+
60
+ ## Image vectorize (Homebrew analogy)
61
+
62
+ ```bash
63
+ agentsam setup image.vectorize
64
+ # plans: brew install imagemagick potrace
65
+ ```
66
+
67
+ Failed “tool missing” paths should become this planner state — not a dead end.