@inneranimalmedia/agentsam-sdk 2.6.5 → 2.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (371) hide show
  1. package/AGENTSAM.md +29 -0
  2. package/apps/README.md +5 -0
  3. package/apps/cad-creator/README.md +4 -4
  4. package/apps/cad-creator/shared/cad/package.json +1 -1
  5. package/apps/client-cms-editor/AGENTS.md +12 -7
  6. package/apps/client-cms-editor/README.md +76 -48
  7. package/apps/client-cms-editor/agentsam.app.json +26 -9
  8. package/apps/client-cms-editor/backend/package.json +20 -3
  9. package/apps/client-cms-editor/backend/src/api/client.ts +134 -101
  10. package/apps/client-cms-editor/backend/src/index.ts +1 -1
  11. package/apps/client-cms-editor/backend/src/model.ts +11 -115
  12. package/apps/client-cms-editor/backend/src/preview/bridge.ts +1 -1
  13. package/apps/client-cms-editor/backend/tsconfig.json +6 -1
  14. package/apps/client-cms-editor/bin/agentsam-cms.js +262 -0
  15. package/apps/client-cms-editor/bin/agentsam-cms.mjs +2 -228
  16. package/apps/client-cms-editor/frontend/package.json +16 -7
  17. package/apps/client-cms-editor/frontend/src/AgentSamDrawer.tsx +9 -41
  18. package/apps/client-cms-editor/frontend/src/CmsAgentSurface.tsx +19 -174
  19. package/apps/client-cms-editor/frontend/src/adapters/heuristic.ts +29 -0
  20. package/apps/client-cms-editor/frontend/src/adapters/http.ts +628 -0
  21. package/apps/client-cms-editor/frontend/src/adapters/memory.ts +510 -0
  22. package/apps/client-cms-editor/frontend/src/editor/CmsEditor.tsx +213 -0
  23. package/apps/client-cms-editor/frontend/src/editor/CmsEditorProvider.tsx +20 -0
  24. package/apps/client-cms-editor/frontend/src/editor/canvas/PreviewCanvas.tsx +53 -0
  25. package/apps/client-cms-editor/frontend/src/{CmsEditor.tsx → editor/legacy/CmsEditorPrototype.tsx} +52 -23
  26. package/apps/client-cms-editor/frontend/src/editor/useCmsEditorController.ts +218 -0
  27. package/apps/client-cms-editor/frontend/src/index.ts +19 -5
  28. package/apps/client-cms-editor/frontend/src/lib/agent-host.ts +24 -0
  29. package/apps/client-cms-editor/frontend/src/main.tsx +82 -8
  30. package/apps/client-cms-editor/frontend/src/mount.tsx +92 -30
  31. package/apps/client-cms-editor/frontend/src/styles/agentsam-drawer.css +1 -1
  32. package/apps/client-cms-editor/frontend/src/styles/cmsShell.css +8 -8
  33. package/apps/client-cms-editor/frontend/src/styles/studio.css +55 -3
  34. package/apps/client-cms-editor/frontend/tsconfig.json +12 -1
  35. package/apps/client-cms-editor/frontend/vite.config.ts +12 -0
  36. package/apps/client-cms-editor/package-lock.json +973 -134
  37. package/apps/client-cms-editor/package.json +118 -6
  38. package/apps/client-cms-editor/reference/harvest/HARVEST_RECEIPT.json +201 -0
  39. package/apps/client-cms-editor/reference/harvest/PROVENANCE_HISTORY.txt +10 -0
  40. package/apps/client-cms-editor/reference/harvest/README.md +8 -0
  41. package/apps/client-cms-editor/reference/harvest/plans/ARCHIVE-INTAKE.md +135 -0
  42. package/apps/client-cms-editor/reference/harvest/plans/CHATGPT-IDENTITY-HARVEST.md +83 -0
  43. package/apps/client-cms-editor/reference/harvest/plans/CMS-EDITOR-HARVEST.md +166 -0
  44. package/apps/client-cms-editor/reference/harvest/plans/HARVEST-INDEX.md +196 -0
  45. package/apps/client-cms-editor/reference/harvest/plans/INNERANIMALS-CONTENT-001.md +137 -0
  46. package/apps/client-cms-editor/reference/harvest/plans/NO-IMPLICIT-SIDE-EFFECTS.md +87 -0
  47. package/apps/client-cms-editor/reference/harvest/plans/STOREFRONT-SURFACE-MAP.md +140 -0
  48. package/apps/client-cms-editor/reference/harvest/plans/THEME-INNERANIMALS-HARVEST.md +137 -0
  49. package/apps/client-cms-editor/reference/harvest/plans/TOOLING-LAB.md +63 -0
  50. package/apps/client-cms-editor/reference/harvest/plans/harvest-manifest.json +97 -0
  51. package/apps/client-cms-editor/reference/harvest/plans/local-cms-harvest-schema.sql +328 -0
  52. package/apps/client-cms-editor/shared/cms/package.json +17 -7
  53. package/apps/client-cms-editor/shared/cms/src/adapter.ts +204 -0
  54. package/apps/client-cms-editor/shared/cms/src/agent-context.ts +7 -5
  55. package/apps/client-cms-editor/shared/cms/src/editor-types.ts +32 -0
  56. package/apps/client-cms-editor/shared/cms/src/host.ts +82 -0
  57. package/apps/client-cms-editor/shared/cms/src/index.ts +4 -0
  58. package/apps/client-cms-editor/shared/cms/src/map.ts +115 -0
  59. package/apps/client-cms-editor/shared/cms/src/starter-pack.ts +158 -0
  60. package/contracts/source-types.v1.json +353 -0
  61. package/docs/CMS_CONTEXTUAL_COMPOSER.md +1 -1
  62. package/docs/PRODUCT_LIFECYCLE.md +566 -0
  63. package/docs/THEME_REFINERY.md +2 -2
  64. package/docs/architecture/AGENTSAM_RUNTIME_PROTOCOL.md +40 -20
  65. package/docs/content-studio/REVISION_GATE_2026-09-27.md +1 -1
  66. package/docs/plans/LOCAL_STUDIO_DESKTOP_RELEASE_2026-09-29.md +150 -0
  67. package/migrations/d1/0017_identity_native_oauth.sql +21 -0
  68. package/native/agentsam-machine/Cargo.lock +426 -0
  69. package/native/agentsam-machine/Cargo.toml +9 -0
  70. package/native/agentsam-machine/cli/Cargo.toml +14 -0
  71. package/native/agentsam-machine/cli/src/main.rs +77 -0
  72. package/native/agentsam-machine/core/Cargo.toml +15 -0
  73. package/native/agentsam-machine/core/src/assets.rs +790 -0
  74. package/native/agentsam-machine/core/src/bound.rs +298 -0
  75. package/native/agentsam-machine/core/src/enrich.rs +706 -0
  76. package/native/agentsam-machine/core/src/frontend.rs +442 -0
  77. package/native/agentsam-machine/core/src/lib.rs +1086 -0
  78. package/native/agentsam-machine/core/src/liquid.rs +528 -0
  79. package/native/agentsam-machine/core/src/source_types.rs +78 -0
  80. package/package.json +51 -21
  81. package/packages/agentsam-brand/README.md +1 -1
  82. package/packages/agentsam-brand/package.json +4 -4
  83. package/packages/agentsam-brand/src/index.js +1 -1
  84. package/packages/agentsam-contracts/package.json +13 -3
  85. package/packages/agentsam-contracts/src/tools.ts +22 -0
  86. package/packages/agentsam-errors/package.json +13 -3
  87. package/packages/agentsam-knowledge/package.json +18 -4
  88. package/packages/agentsam-knowledge/src/autorag/index.js +10 -3
  89. package/packages/agentsam-knowledge/src/backends/index.js +33 -1
  90. package/packages/agentsam-knowledge/test/autorag.test.mjs +60 -1
  91. package/packages/agentsam-nav/package.json +24 -6
  92. package/packages/agentsam-queue-control/README.md +1 -1
  93. package/packages/agentsam-queue-control/package.json +7 -2
  94. package/packages/agentsam-rapid-rust/src/main.rs +1 -1
  95. package/packages/agentsam-repository/package.json +13 -3
  96. package/packages/agentsam-repository/src/source-types.js +8 -0
  97. package/packages/agentsam-vault/package.json +14 -4
  98. package/packages/agentsam-workbench/package.json +15 -4
  99. package/packages/agentsam-workbench/src/agent/ToolPermissionRequest.tsx +94 -0
  100. package/packages/agentsam-workbench/src/agent/index.ts +2 -0
  101. package/packages/agentsam-workbench/src/agent/tool-permission.css +134 -0
  102. package/packages/connectors/cloudflare/package.json +13 -3
  103. package/packages/connectors/cloudflare/src/api-client.js +3 -2
  104. package/packages/connectors/cloudflare/src/families/vectorize.js +127 -0
  105. package/packages/connectors/cloudflare/src/index.js +1 -0
  106. package/packages/heuristic-theme/README.md +2 -2
  107. package/packages/heuristic-theme/package.json +8 -3
  108. package/packages/heuristic-theme/src/registry.js +2 -2
  109. package/packages/heuristic-theme/src/theme.js +1 -1
  110. package/packages/heuristic-theme/test/theme.test.mjs +1 -1
  111. package/packages/identity/.agentsam/features/oauth-login-portal/agentsam.feature.json +1 -1
  112. package/packages/identity/.agentsam/features/oauth-login-portal/providers.json +27 -7
  113. package/packages/identity/README.md +2 -2
  114. package/packages/identity/migrations/D1_SCHEMA_MAPPING.md +18 -15
  115. package/packages/identity/migrations/apply-portable.js +109 -0
  116. package/packages/identity/migrations/sqlite/004_identity_oauth_consent_catalog.sql +1 -1
  117. package/packages/identity/migrations/sqlite/005_identity_company_native.sql +52 -0
  118. package/packages/identity/package.json +27 -6
  119. package/packages/identity/schema/agentsam.identity/manifest.json +101 -0
  120. package/packages/identity/scripts/local-identity-bridge.mjs +13 -7
  121. package/packages/identity/scripts/preview-auth-portal.mjs +6 -6
  122. package/packages/identity/src/adapters/cloudflare-d1/index.js +8 -401
  123. package/packages/identity/src/adapters/iam-compat/index.js +540 -0
  124. package/packages/identity/src/adapters/portable-d1/index.js +18 -0
  125. package/packages/identity/src/adapters/portable-store.js +479 -0
  126. package/packages/identity/src/adapters/sqlite/index.js +13 -312
  127. package/packages/identity/src/contracts/auth-config.js +0 -1
  128. package/packages/identity/src/contracts/identity-store.js +56 -5
  129. package/packages/identity/src/contracts/provider.js +1 -0
  130. package/packages/identity/src/contracts/sign-in-options.js +104 -0
  131. package/packages/identity/src/core/constants.js +1 -1
  132. package/packages/identity/src/core/session-policy.js +31 -0
  133. package/packages/identity/src/frontend/auth-portal/pages/login.html +6 -6
  134. package/packages/identity/src/frontend/auth-portal/pages/reset.html +5 -5
  135. package/packages/identity/src/frontend/auth-portal/pages/signup.html +5 -5
  136. package/packages/identity/src/frontend/auth-portal/shared/company-branding.js +1 -1
  137. package/packages/identity/src/frontend/auth-portal/shared/desktop-identity-bridge.js +6 -37
  138. package/packages/identity/src/index.js +28 -1
  139. package/packages/identity/src/migrations/README.md +23 -23
  140. package/packages/identity/src/oauth/README.md +1 -1
  141. package/packages/identity/src/oauth/credentials.js +10 -11
  142. package/packages/identity/src/oauth/google-desktop-exchange.js +195 -27
  143. package/packages/identity/src/oauth/iam-platform.js +21 -9
  144. package/packages/identity/src/oauth/native-handoff.js +136 -0
  145. package/packages/identity/src/providers/chatgpt/headers.js +65 -0
  146. package/packages/identity/src/providers/chatgpt/index.js +86 -0
  147. package/packages/identity/src/providers/chatgpt/mapper.js +43 -0
  148. package/packages/identity/src/providers/chatgpt/paths.js +45 -0
  149. package/packages/identity/src/providers/github/oauth.js +1 -2
  150. package/packages/identity/src/providers/github/profile.js +16 -2
  151. package/packages/identity/src/providers/index.js +11 -3
  152. package/packages/identity/src/server/identity-service.js +2 -1
  153. package/packages/identity/src/server/worker-router.js +71 -18
  154. package/packages/identity/tests/chatgpt-provider.test.mjs +75 -0
  155. package/packages/identity/tests/google-desktop-identity-login.test.mjs +210 -0
  156. package/packages/identity/tests/identity-init-scaffold.test.mjs +15 -4
  157. package/packages/identity/tests/lane1-identity-store-parity.test.mjs +527 -0
  158. package/packages/identity/tests/lane1-packed-consumer.test.mjs +175 -0
  159. package/packages/identity/tests/native-oauth-handoff.test.mjs +292 -0
  160. package/packages/identity/tests/oauth-credentials.test.mjs +4 -4
  161. package/packages/identity/tests/preview-auth-portal.test.mjs +4 -2
  162. package/packages/identity/tests/session-routes-policy.test.mjs +13 -1
  163. package/packages/identity/tests/worker-runtime-boundary.test.mjs +11 -0
  164. package/packages/providers/completeful/package.json +7 -2
  165. package/packages/theme-church-site/package.json +17 -6
  166. package/packages/theme-church-site/src/harvest.json +4 -2
  167. package/packages/theme-church-site/src/index.js +7 -3
  168. package/packages/theme-church-site/test/theme.test.mjs +4 -2
  169. package/packages/theme-companions-site/package.json +17 -6
  170. package/packages/theme-companions-site/src/harvest.json +4 -2
  171. package/packages/theme-companions-site/src/index.js +7 -3
  172. package/packages/theme-companions-site/test/theme.test.mjs +4 -2
  173. package/packages/theme-floors-site/package.json +17 -6
  174. package/packages/theme-floors-site/src/harvest.json +4 -2
  175. package/packages/theme-floors-site/src/index.js +7 -3
  176. package/packages/theme-floors-site/test/theme.test.mjs +4 -2
  177. package/packages/theme-fuelnfree-site/package.json +17 -6
  178. package/packages/theme-fuelnfree-site/src/harvest.json +4 -2
  179. package/packages/theme-fuelnfree-site/src/index.js +7 -3
  180. package/packages/theme-fuelnfree-site/test/theme.test.mjs +4 -2
  181. package/packages/theme-handyman-site/package.json +17 -6
  182. package/packages/theme-handyman-site/src/harvest.json +4 -2
  183. package/packages/theme-handyman-site/src/index.js +7 -3
  184. package/packages/theme-handyman-site/test/theme.test.mjs +4 -2
  185. package/packages/theme-insurance-site/package.json +17 -6
  186. package/packages/theme-insurance-site/src/harvest.json +4 -2
  187. package/packages/theme-insurance-site/src/index.js +7 -3
  188. package/packages/theme-insurance-site/test/theme.test.mjs +4 -2
  189. package/packages/theme-scenes/README.md +1 -1
  190. package/packages/theme-scenes/package.json +4 -3
  191. package/packages/theme-scenes/src/registry.js +187 -0
  192. package/packages/theme-shinshu-site/package.json +17 -6
  193. package/packages/theme-shinshu-site/src/harvest.json +4 -2
  194. package/packages/theme-shinshu-site/src/index.js +7 -3
  195. package/packages/theme-shinshu-site/test/theme.test.mjs +4 -2
  196. package/packages/work-graph/package.json +14 -4
  197. package/protocol/FILEMETA_V1.md +2 -2
  198. package/protocol/capabilities/manifest.json +1 -1
  199. package/protocol/database/agentsam.schema-pack.v1.schema.json +72 -0
  200. package/protocol/presets/catalog.json +2 -2
  201. package/protocol/theme-refinery/lineage-registry.json +105 -0
  202. package/protocol/theme-refinery/product-metadata.schema.json +21 -1
  203. package/skills/grok-auth/SKILL.md +110 -0
  204. package/skills/grok-auth/agentsam.skill.json +25 -0
  205. package/skills/grok-auth/references/grok-identity.md +64 -0
  206. package/skills/grok-auth/references/per-user-data.md +49 -0
  207. package/skills/grok-auth/references/prewired-and-env.md +54 -0
  208. package/skills/grok-auth/references/session-ui.md +133 -0
  209. package/skills/grok-auth/references/sign-in-methods.md +55 -0
  210. package/skills/grok-auth/references/wiring.md +71 -0
  211. package/skills/grok-building-games/SKILL.md +213 -0
  212. package/skills/grok-building-games/agentsam.skill.json +25 -0
  213. package/skills/grok-building-games/references/3d-libs.md +64 -0
  214. package/skills/grok-building-games/references/ai-pathfinding.md +122 -0
  215. package/skills/grok-building-games/references/audio.md +129 -0
  216. package/skills/grok-building-games/references/babylon.md +202 -0
  217. package/skills/grok-building-games/references/collision-physics.md +122 -0
  218. package/skills/grok-building-games/references/ecs-architecture.md +111 -0
  219. package/skills/grok-building-games/references/game-feel-juice.md +110 -0
  220. package/skills/grok-building-games/references/genres/board-card-chess.md +89 -0
  221. package/skills/grok-building-games/references/genres/endless-runner.md +83 -0
  222. package/skills/grok-building-games/references/genres/fps.md +105 -0
  223. package/skills/grok-building-games/references/genres/platformer-2d.md +97 -0
  224. package/skills/grok-building-games/references/genres/puzzle-match3-tetris.md +131 -0
  225. package/skills/grok-building-games/references/genres/racing-kart.md +106 -0
  226. package/skills/grok-building-games/references/genres/topdown-twin-stick.md +97 -0
  227. package/skills/grok-building-games/references/genres/tower-defense.md +84 -0
  228. package/skills/grok-building-games/references/genres/voxel-minecraft.md +89 -0
  229. package/skills/grok-building-games/references/input.md +139 -0
  230. package/skills/grok-building-games/references/phaser.md +277 -0
  231. package/skills/grok-building-games/references/procedural-generation.md +141 -0
  232. package/skills/grok-building-games/references/save-persistence.md +108 -0
  233. package/skills/grok-building-games/references/threejs-foundational.md +148 -0
  234. package/skills/grok-controls/SKILL.md +274 -0
  235. package/skills/grok-controls/agentsam.skill.json +25 -0
  236. package/skills/grok-design-ui/SKILL.md +122 -0
  237. package/skills/grok-design-ui/agentsam.skill.json +25 -0
  238. package/skills/grok-design-ui/references/animations.md +379 -0
  239. package/skills/grok-design-ui/references/performance.md +88 -0
  240. package/skills/grok-design-ui/references/refined-ui.md +384 -0
  241. package/skills/grok-design-ui/references/surfaces.md +247 -0
  242. package/skills/grok-design-ui/references/typography.md +123 -0
  243. package/skills/grok-game-animation-frames/SKILL.md +84 -0
  244. package/skills/grok-game-animation-frames/agentsam.skill.json +25 -0
  245. package/skills/grok-game-asset-core/SKILL.md +69 -0
  246. package/skills/grok-game-asset-core/agentsam.skill.json +25 -0
  247. package/skills/grok-game-character-consistency/SKILL.md +69 -0
  248. package/skills/grok-game-character-consistency/agentsam.skill.json +25 -0
  249. package/skills/grok-game-tilesets/SKILL.md +65 -0
  250. package/skills/grok-game-tilesets/agentsam.skill.json +25 -0
  251. package/skills/grok-game-ui-icons/SKILL.md +56 -0
  252. package/skills/grok-game-ui-icons/agentsam.skill.json +25 -0
  253. package/skills/grok-generate2dmap/LICENSE +21 -0
  254. package/skills/grok-generate2dmap/SKILL.md +120 -0
  255. package/skills/grok-generate2dmap/SOURCE.md +6 -0
  256. package/skills/grok-generate2dmap/agentsam.skill.json +25 -0
  257. package/skills/grok-generate2dmap/references/deliverables.md +101 -0
  258. package/skills/grok-generate2dmap/references/layered-map-contract.md +209 -0
  259. package/skills/grok-generate2dmap/references/map-strategies.md +341 -0
  260. package/skills/grok-generate2dmap/references/object-production-gate.md +24 -0
  261. package/skills/grok-generate2dmap/references/pipeline.md +149 -0
  262. package/skills/grok-generate2dmap/references/prop-pack-contract.md +174 -0
  263. package/skills/grok-generate2dmap/references/side-scroll-stages.md +29 -0
  264. package/skills/grok-generate2dmap/scripts/compose_layered_preview.py +157 -0
  265. package/skills/grok-generate2dmap/scripts/extract_prop_pack.py +369 -0
  266. package/skills/grok-generate2dsprite/LICENSE +21 -0
  267. package/skills/grok-generate2dsprite/SKILL.md +313 -0
  268. package/skills/grok-generate2dsprite/SOURCE.md +6 -0
  269. package/skills/grok-generate2dsprite/agentsam.skill.json +25 -0
  270. package/skills/grok-generate2dsprite/references/modes.md +124 -0
  271. package/skills/grok-generate2dsprite/references/prompt-rules.md +315 -0
  272. package/skills/grok-generate2dsprite/scripts/generate2dsprite.py +1031 -0
  273. package/skills/grok-generate2dsprite/scripts/make_layout_guide.py +109 -0
  274. package/skills/grok-imagine/SKILL.md +201 -0
  275. package/skills/grok-imagine/agentsam.skill.json +25 -0
  276. package/skills/grok-multiplayer-p2p/SKILL.md +111 -0
  277. package/skills/grok-multiplayer-p2p/agentsam.skill.json +25 -0
  278. package/skills/grok-multiplayer-p2p/references/react-binding.md +144 -0
  279. package/skills/grok-multiplayer-p2p/references/signaling-relay.md +269 -0
  280. package/skills/grok-neon/SKILL.md +157 -0
  281. package/skills/grok-neon/agentsam.skill.json +25 -0
  282. package/skills/grok-og/SKILL.md +102 -0
  283. package/skills/grok-og/agentsam.skill.json +25 -0
  284. package/skills/grok-og/references/brand-pass.md +53 -0
  285. package/skills/grok-og/references/custom-card.md +107 -0
  286. package/skills/grok-og/references/favicon-and-icons.md +48 -0
  287. package/skills/grok-og/references/og-type-contract.md +18 -0
  288. package/skills/grok-og/references/placeholder-card.md +21 -0
  289. package/skills/grok-og/references/x-banner.md +41 -0
  290. package/skills/grok-threejs/SKILL.md +67 -0
  291. package/skills/grok-threejs/agentsam.skill.json +25 -0
  292. package/skills/grok-threejs/references/llms-full.txt +2780 -0
  293. package/skills/grok-video2dsprite/LICENSE +21 -0
  294. package/skills/grok-video2dsprite/SKILL.md +236 -0
  295. package/skills/grok-video2dsprite/SOURCE.md +6 -0
  296. package/skills/grok-video2dsprite/agentsam.skill.json +25 -0
  297. package/skills/grok-video2dsprite/references/pipeline.md +90 -0
  298. package/skills/grok-video2dsprite/references/prompt-rules.md +63 -0
  299. package/skills/grok-video2dsprite/scripts/video2dsprite.py +490 -0
  300. package/skills/grok-xai-api/SKILL.md +152 -0
  301. package/skills/grok-xai-api/agentsam.skill.json +25 -0
  302. package/src/cli/command-catalog.js +46 -4
  303. package/src/cli/dispatch.js +1 -0
  304. package/src/cli.js +10 -0
  305. package/src/cloudflare/runtime-status.js +2 -1
  306. package/src/commands/autorag.js +67 -13
  307. package/src/commands/cheat-sheet.js +29 -4
  308. package/src/commands/codebaseindex.js +45 -2
  309. package/src/commands/knowledge.js +59 -2
  310. package/src/commands/machine-binary.js +103 -0
  311. package/src/commands/machine.js +137 -0
  312. package/src/commands/security.js +67 -4
  313. package/src/commands/setup.js +33 -16
  314. package/src/commands/status.js +8 -1
  315. package/src/features/resolve.js +1 -0
  316. package/src/knowledge/engine.js +21 -2
  317. package/src/knowledge/runtime-discovery.js +127 -0
  318. package/src/lib/identity-scaffold.js +53 -13
  319. package/src/lib/setup/recipes.js +1 -1
  320. package/src/models/discovery.js +40 -22
  321. package/src/models/inventory-core.d.ts +105 -0
  322. package/src/models/inventory-core.js +54 -6
  323. package/src/security/logs.js +3 -0
  324. package/src/ui/cli/help.js +41 -0
  325. package/test/apps-scaffold-contract.test.mjs +3 -2
  326. package/test/cli/api-key-env-whoami.test.mjs +2 -2
  327. package/test/cli/catalog-authority.test.mjs +64 -0
  328. package/test/cli/machine-command.test.mjs +34 -0
  329. package/test/fixtures/project-authority/customer-app/.agentsam/app.json +5 -0
  330. package/test/fixtures/project-authority/customer-app/apps/my-product/index.ts +1 -0
  331. package/test/fixtures/project-authority/customer-app/wrangler.toml +17 -0
  332. package/test/integration/autorag-project-authority.integration.test.mjs +51 -0
  333. package/test/integration/autorag-runtime-discovery.test.mjs +107 -0
  334. package/test/integration/cms-app-scaffold.test.mjs +37 -31
  335. package/test/integration/cms-site-tenancy-contract.test.mjs +28 -17
  336. package/test/integration/codebaseindex-ingest.test.mjs +41 -0
  337. package/test/integration/database-hosted-honesty.test.mjs +49 -0
  338. package/test/integration/desktop-keychain-boundary.test.mjs +45 -0
  339. package/test/integration/hosted-work-host-authority.test.mjs +47 -0
  340. package/test/integration/inventory-eligibility.test.mjs +59 -0
  341. package/test/integration/local-provider-bridge.test.mjs +65 -0
  342. package/test/integration/local-studio-settings-production.test.mjs +40 -0
  343. package/test/integration/lockfile-sync.test.mjs +26 -0
  344. package/test/integration/provider-env-cli.test.mjs +13 -3
  345. package/test/integration/runtime-status.integration.test.mjs +16 -1
  346. package/test/integration/theme-package-registry.test.mjs +31 -0
  347. package/test/repository-snapshot-view.test.mjs +2 -2
  348. package/test/security.test.mjs +14 -0
  349. package/test/terminal-machine-identity.test.mjs +2 -2
  350. package/apps/client-cms-editor/backend/src/demo-bootstrap.ts +0 -145
  351. package/packages/agentsam-nav/dist/Nav.d.ts +0 -43
  352. package/packages/agentsam-nav/dist/NavCollapsible.d.ts +0 -10
  353. package/packages/agentsam-nav/dist/NavContent.d.ts +0 -2
  354. package/packages/agentsam-nav/dist/NavFooter.d.ts +0 -2
  355. package/packages/agentsam-nav/dist/NavGroup.d.ts +0 -3
  356. package/packages/agentsam-nav/dist/NavHeader.d.ts +0 -2
  357. package/packages/agentsam-nav/dist/NavMenu.d.ts +0 -22
  358. package/packages/agentsam-nav/dist/NavProvider.d.ts +0 -35
  359. package/packages/agentsam-nav/dist/NavTrigger.d.ts +0 -2
  360. package/packages/agentsam-nav/dist/Surfaces.d.ts +0 -41
  361. package/packages/agentsam-nav/dist/browser.d.ts +0 -11
  362. package/packages/agentsam-nav/dist/browser.global.js +0 -132
  363. package/packages/agentsam-nav/dist/browser.js +0 -613
  364. package/packages/agentsam-nav/dist/contracts.d.ts +0 -76
  365. package/packages/agentsam-nav/dist/index.d.ts +0 -11
  366. package/packages/agentsam-nav/dist/index.js +0 -614
  367. package/packages/agentsam-nav/dist/legacy.css +0 -83
  368. package/packages/agentsam-nav/dist/shell.css +0 -113
  369. package/packages/agentsam-nav/dist/theme.css +0 -113
  370. package/packages/agentsam-nav/dist/utils.d.ts +0 -1
  371. package/packages/agentsam-repository/src/goap.js.bak-20260922011251 +0 -670
@@ -1,614 +0,0 @@
1
- // src/Nav.tsx
2
- import { useCallback as useCallback2 } from "react";
3
-
4
- // src/NavCollapsible.tsx
5
- import { cloneElement, createContext as createContext2, useContext as useContext2, useId, useState as useState2 } from "react";
6
-
7
- // src/utils.ts
8
- function cx(...values) {
9
- return values.filter(Boolean).join(" ");
10
- }
11
-
12
- // src/NavProvider.tsx
13
- import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
14
- import { jsx } from "react/jsx-runtime";
15
- var NavContext = createContext(null);
16
- function NavProvider({
17
- children,
18
- value: data = {},
19
- tokens = {},
20
- theme = "dark",
21
- accentColor = "#8B5CF6",
22
- defaultOpen = true,
23
- mobileBreakpoint = 768,
24
- peekable = false,
25
- resizable = false
26
- }) {
27
- const [menu, setMenu] = useState(null);
28
- const [desktopOpen, setDesktopOpen] = useState(defaultOpen);
29
- const [mobileOpen, setMobileOpen] = useState(false);
30
- const [isMobile, setIsMobile] = useState(false);
31
- const [isPeeking, setPeeking] = useState(false);
32
- const [width, setWidthState] = useState(268);
33
- useEffect(() => {
34
- const query = window.matchMedia(`(max-width: ${mobileBreakpoint - 1}px)`);
35
- const update = () => {
36
- setIsMobile(query.matches);
37
- if (query.matches) setMobileOpen(false);
38
- else setPeeking(false);
39
- };
40
- update();
41
- query.addEventListener("change", update);
42
- return () => query.removeEventListener("change", update);
43
- }, [mobileBreakpoint]);
44
- const open = isMobile ? mobileOpen : desktopOpen;
45
- const setOpen = useCallback((next) => {
46
- if (isMobile) setMobileOpen(next);
47
- else setDesktopOpen(next);
48
- }, [isMobile]);
49
- const close = useCallback(() => setOpen(false), [setOpen]);
50
- const toggle = useCallback(() => setOpen(!open), [open, setOpen]);
51
- const setWidth = useCallback((next) => {
52
- setWidthState(Math.max(208, Math.min(400, Math.round(next))));
53
- }, []);
54
- useEffect(() => {
55
- if (!isMobile || !open) return void 0;
56
- const onKeyDown = (event) => {
57
- if (event.key === "Escape") close();
58
- };
59
- document.addEventListener("keydown", onKeyDown);
60
- return () => document.removeEventListener("keydown", onKeyDown);
61
- }, [close, isMobile, open]);
62
- const scrollToItem = useCallback((itemId) => {
63
- document.querySelector(`[data-nav-item-id="${CSS.escape(itemId)}"]`)?.scrollIntoView({ block: "nearest", behavior: "smooth" });
64
- }, []);
65
- const value = useMemo(() => ({
66
- data,
67
- tokens,
68
- theme,
69
- accentColor,
70
- menu,
71
- setMenu,
72
- open,
73
- isMobile,
74
- isPeeking,
75
- peekable,
76
- resizable,
77
- width,
78
- mobileBreakpoint,
79
- setOpen,
80
- toggle,
81
- close,
82
- setPeeking,
83
- setWidth,
84
- scrollToItem
85
- }), [data, tokens, theme, accentColor, menu, close, isMobile, isPeeking, mobileBreakpoint, open, peekable, resizable, scrollToItem, setOpen, setWidth, toggle, width]);
86
- return /* @__PURE__ */ jsx(NavContext.Provider, { value, children });
87
- }
88
- function useNav() {
89
- const context = useContext(NavContext);
90
- if (!context) throw new Error("useNav must be used inside Nav.Provider");
91
- return context;
92
- }
93
-
94
- // src/NavCollapsible.tsx
95
- import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
96
- var CollapsibleContext = createContext2(null);
97
- function useCollapsible() {
98
- const context = useContext2(CollapsibleContext);
99
- if (!context) throw new Error("Nav.Collapsible components must be nested inside Nav.Collapsible");
100
- return context;
101
- }
102
- function NavCollapsible({ children, defaultOpen = false }) {
103
- const [open, setOpen] = useState2(defaultOpen);
104
- const contentId = useId();
105
- return /* @__PURE__ */ jsx2(CollapsibleContext.Provider, { value: { open, setOpen, contentId }, children });
106
- }
107
- function NavCollapsibleTrigger({ render, children, className, ...props }) {
108
- const { open, setOpen, contentId } = useCollapsible();
109
- const renderedProps = render?.props;
110
- const triggerProps = {
111
- "aria-expanded": open,
112
- "aria-controls": contentId,
113
- onClick: (event) => {
114
- renderedProps?.onClick?.(event);
115
- if (!event.defaultPrevented) setOpen(!open);
116
- }
117
- };
118
- if (render) return /* @__PURE__ */ jsx2(Fragment, { children: cloneElement(render, triggerProps) });
119
- return /* @__PURE__ */ jsx2("button", { type: "button", className: cx("agentsam-nav__menu-button", className), ...props, ...triggerProps, children });
120
- }
121
- function NavCollapsibleContent({ className, ...props }) {
122
- const { open, setOpen, contentId } = useCollapsible();
123
- const { isMobile } = useNav();
124
- if (isMobile && open) {
125
- return /* @__PURE__ */ jsxs("div", { id: contentId, className: cx("agentsam-nav__collapsible-content", "agentsam-nav__mobile-subview", className), ...props, children: [
126
- /* @__PURE__ */ jsxs("button", { type: "button", className: "agentsam-nav__mobile-back", onClick: () => setOpen(false), children: [
127
- /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", children: "\u2039" }),
128
- " Back"
129
- ] }),
130
- props.children
131
- ] });
132
- }
133
- return /* @__PURE__ */ jsx2("div", { id: contentId, hidden: !open, className: cx("agentsam-nav__collapsible-content", className), ...props });
134
- }
135
-
136
- // src/NavContent.tsx
137
- import { jsx as jsx3 } from "react/jsx-runtime";
138
- function NavContent({ className, ...props }) {
139
- return /* @__PURE__ */ jsx3("div", { className: cx("agentsam-nav__content", className), ...props });
140
- }
141
-
142
- // src/NavFooter.tsx
143
- import { jsx as jsx4 } from "react/jsx-runtime";
144
- function NavFooter({ className, ...props }) {
145
- return /* @__PURE__ */ jsx4("div", { className: cx("agentsam-nav__footer", className), ...props });
146
- }
147
-
148
- // src/NavGroup.tsx
149
- import { jsx as jsx5 } from "react/jsx-runtime";
150
- function NavGroup({ className, ...props }) {
151
- return /* @__PURE__ */ jsx5("section", { className: cx("agentsam-nav__group", className), ...props });
152
- }
153
- function NavGroupLabel({ className, ...props }) {
154
- return /* @__PURE__ */ jsx5("p", { className: cx("agentsam-nav__group-label", className), ...props });
155
- }
156
-
157
- // src/NavHeader.tsx
158
- import { jsx as jsx6 } from "react/jsx-runtime";
159
- function NavHeader({ className, ...props }) {
160
- return /* @__PURE__ */ jsx6("div", { className: cx("agentsam-nav__header", className), ...props });
161
- }
162
-
163
- // src/NavMenu.tsx
164
- import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
165
- function NavMenu({ className, ...props }) {
166
- return /* @__PURE__ */ jsx7("ul", { className: cx("agentsam-nav__menu", className), ...props });
167
- }
168
- function NavMenuItem({ className, ...props }) {
169
- return /* @__PURE__ */ jsx7("li", { className: cx("agentsam-nav__menu-item", className), ...props });
170
- }
171
- function NavMenuButton({ icon: Icon, active = false, itemId, className, children, ...props }) {
172
- const IconComponent = Icon;
173
- return /* @__PURE__ */ jsxs2(
174
- "button",
175
- {
176
- type: "button",
177
- "data-nav-item-id": itemId,
178
- "data-active": active ? "true" : void 0,
179
- "aria-current": active ? "page" : void 0,
180
- className: cx("agentsam-nav__menu-button", className),
181
- ...props,
182
- children: [
183
- IconComponent ? /* @__PURE__ */ jsx7(IconComponent, { className: "agentsam-nav__menu-icon", "aria-hidden": true }) : null,
184
- /* @__PURE__ */ jsx7("span", { className: "agentsam-nav__menu-label", children })
185
- ]
186
- }
187
- );
188
- }
189
- function NavMenuSub({ className, ...props }) {
190
- return /* @__PURE__ */ jsx7("ul", { className: cx("agentsam-nav__menu-sub", className), ...props });
191
- }
192
- function NavMenuSubButton({ active = false, className, children, ...props }) {
193
- return /* @__PURE__ */ jsx7("a", { "data-active": active ? "true" : void 0, "aria-current": active ? "page" : void 0, className: cx("agentsam-nav__menu-sub-button", className), ...props, children });
194
- }
195
- function NavMenuChevron({ className }) {
196
- return /* @__PURE__ */ jsx7("svg", { className: cx("agentsam-nav__chevron", className), "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx7("path", { d: "m6 3 5 5-5 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
197
- }
198
-
199
- // src/NavTrigger.tsx
200
- import { jsx as jsx8 } from "react/jsx-runtime";
201
- function NavTrigger({ className, "aria-label": ariaLabel = "Toggle navigation", ...props }) {
202
- const { open, toggle } = useNav();
203
- return /* @__PURE__ */ jsx8("button", { type: "button", "aria-label": ariaLabel, "aria-expanded": open, className: cx("agentsam-nav__trigger", className), onClick: toggle, ...props, children: /* @__PURE__ */ jsx8("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx8("path", { d: "M4 7h16M4 12h16M4 17h16", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" }) }) });
204
- }
205
-
206
- // src/Surfaces.tsx
207
- import { Fragment as Fragment2, useId as useId2, useState as useState3 } from "react";
208
- import * as Menu from "@radix-ui/react-dropdown-menu";
209
- import * as Dialog from "@radix-ui/react-dialog";
210
- import { ChevronDown, Files, Folder, MessageSquare, MoreHorizontal, PanelLeft, PanelTop, Pin, Pencil, Plus, Search, Share, Trash2, User } from "lucide-react";
211
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
212
- function useNavStyle() {
213
- const { accentColor, tokens } = useNav();
214
- return { ...Object.fromEntries(Object.entries(tokens).map(([key, value]) => [`--nav-${key}`, value])), "--nav-accent": accentColor };
215
- }
216
- function NavScope({ className, style, ...props }) {
217
- const { theme } = useNav();
218
- return /* @__PURE__ */ jsx9("div", { ...props, "data-nav-theme": theme, className: cx("as-nav-scope", className), style: { ...useNavStyle(), ...style } });
219
- }
220
- function MenuActions({ actions }) {
221
- const { theme } = useNav();
222
- const style = useNavStyle();
223
- return /* @__PURE__ */ jsx9(Fragment3, { children: actions.map((action) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
224
- action.separatorBefore ? /* @__PURE__ */ jsx9(Menu.Separator, { className: "as-nav-menu-separator" }) : null,
225
- action.children?.length ? /* @__PURE__ */ jsxs3(Menu.Sub, { children: [
226
- /* @__PURE__ */ jsxs3(Menu.SubTrigger, { className: "as-nav-menu-row", disabled: action.disabled, children: [
227
- action.icon,
228
- /* @__PURE__ */ jsx9("span", { children: action.label }),
229
- /* @__PURE__ */ jsx9(ChevronDown, {})
230
- ] }),
231
- /* @__PURE__ */ jsx9(Menu.Portal, { children: /* @__PURE__ */ jsx9(Menu.SubContent, { "data-nav-theme": theme, style, className: "as-nav-scope as-nav-popover", sideOffset: 6, collisionPadding: 12, children: /* @__PURE__ */ jsx9(MenuActions, { actions: action.children }) }) })
232
- ] }) : /* @__PURE__ */ jsxs3(Menu.Item, { className: "as-nav-menu-row", disabled: action.disabled || !action.onSelect, "data-destructive": action.destructive || void 0, onSelect: action.onSelect, children: [
233
- action.icon ? /* @__PURE__ */ jsx9("span", { className: "as-nav-icon", children: action.icon }) : null,
234
- /* @__PURE__ */ jsx9("span", { children: action.label })
235
- ] })
236
- ] }, action.id)) });
237
- }
238
- function NavOverflowMenu({ label = "More options", actions = [], children, id: suppliedId, align = "end" }) {
239
- const { menu, setMenu, theme } = useNav();
240
- const generatedId = useId2();
241
- const id = suppliedId ?? generatedId;
242
- const style = useNavStyle();
243
- return /* @__PURE__ */ jsxs3(Menu.Root, { open: menu === id, onOpenChange: (open) => setMenu(open ? id : null), children: [
244
- /* @__PURE__ */ jsx9(Menu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx9("button", { type: "button", className: "as-nav-button", "aria-label": label, title: label, children: children ?? /* @__PURE__ */ jsx9(MoreHorizontal, {}) }) }),
245
- /* @__PURE__ */ jsx9(Menu.Portal, { children: /* @__PURE__ */ jsxs3(Menu.Content, { "data-nav-theme": theme, style, className: "as-nav-scope as-nav-popover", align, sideOffset: 8, collisionPadding: 12, children: [
246
- /* @__PURE__ */ jsx9(Menu.Label, { className: "as-nav-menu-heading", children: label }),
247
- actions.length ? /* @__PURE__ */ jsx9(MenuActions, { actions }) : /* @__PURE__ */ jsx9("div", { className: "as-nav-empty", children: "No actions available" })
248
- ] }) })
249
- ] });
250
- }
251
- function NavTopbarLogo({ variant = "mark", onClick, toggle = false }) {
252
- const { data, toggle: toggleNav } = useNav();
253
- const label = toggle ? "Toggle sidebar" : data.brand?.name ?? "Home";
254
- return /* @__PURE__ */ jsxs3("button", { type: "button", className: cx("as-nav-button as-nav-brand", toggle && "as-nav-brand--toggle"), "aria-label": label, title: label, onClick: onClick ?? (toggle ? toggleNav : () => data.brand?.home && data.onNavigate?.(data.brand.home)), children: [
255
- /* @__PURE__ */ jsx9("span", { className: "as-nav-brand-mark", children: data.brand?.logo ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
256
- /* @__PURE__ */ jsx9("img", { className: "as-nav-logo-dark", src: data.brand.logo, alt: "" }),
257
- /* @__PURE__ */ jsx9("img", { className: "as-nav-logo-light", "data-fallback": !data.brand.lightLogo || void 0, src: data.brand.lightLogo ?? data.brand.logo, alt: "" })
258
- ] }) : /* @__PURE__ */ jsx9(PanelLeft, {}) }),
259
- variant === "expanded" ? /* @__PURE__ */ jsx9("span", { children: data.brand?.name }) : null
260
- ] });
261
- }
262
- function NavProjectContext() {
263
- const { data } = useNav();
264
- return /* @__PURE__ */ jsxs3("div", { className: "as-nav-context", children: [
265
- data.project ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
266
- /* @__PURE__ */ jsxs3(NavOverflowMenu, { label: data.project.name, actions: data.projectActions, children: [
267
- /* @__PURE__ */ jsx9(Folder, {}),
268
- /* @__PURE__ */ jsx9("span", { className: "as-nav-project-name", children: data.project.name }),
269
- /* @__PURE__ */ jsx9(ChevronDown, {})
270
- ] }),
271
- /* @__PURE__ */ jsx9("span", { className: "as-nav-separator", children: "/" })
272
- ] }) : null,
273
- /* @__PURE__ */ jsx9("span", { className: "as-nav-title", title: data.conversation?.title, children: data.conversation?.title ?? data.brand?.name }),
274
- data.mode ? /* @__PURE__ */ jsxs3("span", { className: "as-nav-mode-label", children: [
275
- "\xB7 ",
276
- data.mode === "work" ? "Work" : "Chat"
277
- ] }) : null
278
- ] });
279
- }
280
- function NavTopbarSpacer() {
281
- return /* @__PURE__ */ jsx9("span", { className: "as-nav-spacer" });
282
- }
283
- function NavFilesResources() {
284
- const { data } = useNav();
285
- return /* @__PURE__ */ jsx9(NavOverflowMenu, { label: "Files & resources", actions: data.resourceActions, children: /* @__PURE__ */ jsx9(Files, {}) });
286
- }
287
- function NavPinnedSummary() {
288
- const { data } = useNav();
289
- if (!data.resourceActions?.length) return null;
290
- return /* @__PURE__ */ jsx9(NavOverflowMenu, { label: "Toggle pinned summary", actions: data.resourceActions, children: /* @__PURE__ */ jsx9(PanelTop, {}) });
291
- }
292
- function NavConversationActions() {
293
- const { data } = useNav();
294
- return /* @__PURE__ */ jsx9(NavOverflowMenu, { label: "Conversation options", actions: data.conversationActions });
295
- }
296
- function NavShareButton() {
297
- const { data } = useNav();
298
- if (!data.onShare) return null;
299
- return /* @__PURE__ */ jsxs3("button", { type: "button", className: "as-nav-button", onClick: data.onShare, "aria-label": "Share conversation", title: "Share", children: [
300
- /* @__PURE__ */ jsx9(Share, {}),
301
- /* @__PURE__ */ jsx9("span", { className: "as-nav-share-label", children: "Share" })
302
- ] });
303
- }
304
- function NavAccountSwitcher({ accounts, activeAccountId, onAccountChange, expanded = false }) {
305
- const { data } = useNav();
306
- const options = accounts ?? data.accounts ?? (data.account ? [data.account] : []);
307
- const account = options.find((item) => item.id === (activeAccountId ?? data.account?.id)) ?? data.account;
308
- const change = onAccountChange ?? data.onAccountChange;
309
- const actions = [
310
- ...options.filter((item) => item.id !== account?.id).map((item) => ({ id: item.id, label: item.name, disabled: !change, onSelect: () => change?.(item.id) })),
311
- ...data.accountActions ?? []
312
- ];
313
- return /* @__PURE__ */ jsx9("div", { className: cx("as-nav-account", expanded && "as-nav-account--expanded"), children: /* @__PURE__ */ jsxs3(NavOverflowMenu, { label: account?.name ?? "Account", actions, align: "start", children: [
314
- /* @__PURE__ */ jsx9("span", { className: "as-nav-avatar", children: account?.avatar ? /* @__PURE__ */ jsx9("img", { src: account.avatar, alt: "" }) : /* @__PURE__ */ jsx9(User, {}) }),
315
- expanded ? /* @__PURE__ */ jsxs3("span", { className: "as-nav-account-copy", children: [
316
- /* @__PURE__ */ jsx9("strong", { children: account?.name ?? "Account" }),
317
- account?.plan ? /* @__PURE__ */ jsx9("small", { children: account.plan }) : null
318
- ] }) : null,
319
- expanded ? /* @__PURE__ */ jsx9(ChevronDown, {}) : null
320
- ] }) });
321
- }
322
- function NavModeSwitcher() {
323
- const { data } = useNav();
324
- return /* @__PURE__ */ jsx9("div", { className: "as-nav-mode-switch", role: "group", "aria-label": "Conversation mode", children: ["chat", "work"].map((mode) => /* @__PURE__ */ jsx9("button", { type: "button", "aria-pressed": data.mode === mode, onClick: () => data.onModeChange?.(mode), disabled: !data.onModeChange, children: mode === "chat" ? "Chat" : "Work" }, mode)) });
325
- }
326
- function NavTopbar({
327
- children,
328
- rightSlot,
329
- modeSlot,
330
- contextSlot,
331
- startup = false,
332
- className,
333
- showNavigationTrigger = true,
334
- showAccount = false
335
- }) {
336
- return /* @__PURE__ */ jsx9(NavScope, { className: cx("as-nav-topbar", startup && "as-nav-topbar--startup", className), children: children ?? /* @__PURE__ */ jsxs3(Fragment3, { children: [
337
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-topbar-leading", children: [
338
- showNavigationTrigger ? /* @__PURE__ */ jsx9(NavTopbarLogo, { toggle: true }) : null,
339
- !startup ? contextSlot ?? /* @__PURE__ */ jsx9(NavProjectContext, {}) : null
340
- ] }),
341
- startup ? /* @__PURE__ */ jsx9("div", { className: "as-nav-topbar-center", children: modeSlot ?? /* @__PURE__ */ jsx9(NavModeSwitcher, {}) }) : modeSlot,
342
- /* @__PURE__ */ jsx9(NavTopbarSpacer, {}),
343
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-topbar-actions", children: [
344
- !startup ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
345
- /* @__PURE__ */ jsx9(NavShareButton, {}),
346
- /* @__PURE__ */ jsx9(NavConversationActions, {}),
347
- /* @__PURE__ */ jsx9(NavPinnedSummary, {})
348
- ] }) : null,
349
- rightSlot,
350
- showAccount ? /* @__PURE__ */ jsx9(NavAccountSwitcher, {}) : null
351
- ] })
352
- ] }) });
353
- }
354
- function RenameDialog({ open, onOpenChange, title, value, onSave }) {
355
- const { theme } = useNav();
356
- const [draft, setDraft] = useState3(value);
357
- const style = useNavStyle();
358
- return /* @__PURE__ */ jsx9(Dialog.Root, { open, onOpenChange: (next) => {
359
- if (next) setDraft(value);
360
- onOpenChange(next);
361
- }, children: /* @__PURE__ */ jsxs3(Dialog.Portal, { children: [
362
- /* @__PURE__ */ jsx9(Dialog.Overlay, { className: "as-nav-dialog-overlay" }),
363
- /* @__PURE__ */ jsxs3(Dialog.Content, { "data-nav-theme": theme, style, className: "as-nav-scope as-nav-dialog", children: [
364
- /* @__PURE__ */ jsx9(Dialog.Title, { children: title }),
365
- /* @__PURE__ */ jsx9(Dialog.Description, { children: "Choose a clear name." }),
366
- /* @__PURE__ */ jsxs3("form", { onSubmit: (event) => {
367
- event.preventDefault();
368
- if (draft.trim()) {
369
- onSave(draft.trim());
370
- onOpenChange(false);
371
- }
372
- }, children: [
373
- /* @__PURE__ */ jsx9("input", { autoFocus: true, "aria-label": title, value: draft, onChange: (event) => setDraft(event.target.value), maxLength: 200 }),
374
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-dialog-actions", children: [
375
- /* @__PURE__ */ jsx9(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx9("button", { type: "button", className: "as-nav-button", children: "Cancel" }) }),
376
- /* @__PURE__ */ jsx9("button", { type: "submit", className: "as-nav-button", disabled: !draft.trim(), children: "Save" })
377
- ] })
378
- ] })
379
- ] })
380
- ] }) });
381
- }
382
- function ConversationRow({ item }) {
383
- const { data, close, isMobile } = useNav();
384
- const [rename, setRename] = useState3(false);
385
- const selected = item.id === data.conversation?.id;
386
- const actions = data.getConversationActions?.(item) ?? [
387
- ...data.onPinConversation ? [{ id: "pin", label: item.pinned ? "Unpin chat" : "Pin chat", icon: /* @__PURE__ */ jsx9(Pin, {}), onSelect: () => data.onPinConversation?.(item.id) }] : [],
388
- ...data.onDeleteConversation ? [{ id: "delete", label: "Delete chat", icon: /* @__PURE__ */ jsx9(Trash2, {}), destructive: true, separatorBefore: true, onSelect: () => data.onDeleteConversation?.(item.id) }] : []
389
- ];
390
- return /* @__PURE__ */ jsxs3("div", { className: "as-nav-conversation", "data-active": selected || void 0, "data-nav-item-id": item.id, children: [
391
- /* @__PURE__ */ jsxs3("button", { type: "button", className: "as-nav-conversation-link", title: item.title, "aria-current": selected ? "page" : void 0, onClick: () => {
392
- data.onSelectConversation?.(item.id);
393
- if (isMobile) close();
394
- }, children: [
395
- /* @__PURE__ */ jsx9(MessageSquare, {}),
396
- /* @__PURE__ */ jsx9("span", { children: item.title })
397
- ] }),
398
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-row-actions", children: [
399
- data.onRenameConversation ? /* @__PURE__ */ jsx9("button", { type: "button", className: "as-nav-button", "aria-label": `Rename ${item.title}`, title: "Rename", onClick: (event) => {
400
- event.stopPropagation();
401
- setRename(true);
402
- }, children: /* @__PURE__ */ jsx9(Pencil, {}) }) : null,
403
- actions.length ? /* @__PURE__ */ jsx9(NavOverflowMenu, { id: `conversation-${item.id}`, label: `${item.title} options`, actions }) : null
404
- ] }),
405
- data.onRenameConversation ? /* @__PURE__ */ jsx9(RenameDialog, { open: rename, onOpenChange: setRename, title: "Rename conversation", value: item.title, onSave: (title) => data.onRenameConversation?.(item.id, title) }) : null
406
- ] });
407
- }
408
- function ProjectRow({ item, conversations }) {
409
- const { data, close, isMobile } = useNav();
410
- const [expanded, setExpanded] = useState3(item.id === data.project?.id);
411
- const [rename, setRename] = useState3(false);
412
- const actions = data.getProjectActions?.(item) ?? [
413
- ...data.onPinProject ? [{ id: "pin", label: item.pinned ? "Unpin project" : "Pin project", icon: /* @__PURE__ */ jsx9(Pin, {}), onSelect: () => data.onPinProject?.(item.id) }] : [],
414
- ...data.onDeleteProject ? [{ id: "delete", label: "Delete project", icon: /* @__PURE__ */ jsx9(Trash2, {}), destructive: true, separatorBefore: true, onSelect: () => data.onDeleteProject?.(item.id) }] : []
415
- ];
416
- return /* @__PURE__ */ jsxs3("div", { className: "as-nav-project", "data-active": item.id === data.project?.id || void 0, "data-nav-item-id": item.id, children: [
417
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-project-row", children: [
418
- /* @__PURE__ */ jsxs3("button", { type: "button", className: "as-nav-project-toggle", title: item.name, "aria-expanded": expanded, onClick: () => setExpanded((value) => !value), children: [
419
- /* @__PURE__ */ jsx9(Folder, {}),
420
- /* @__PURE__ */ jsx9("span", { children: item.name }),
421
- /* @__PURE__ */ jsx9(ChevronDown, {})
422
- ] }),
423
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-row-actions", children: [
424
- data.onRenameProject ? /* @__PURE__ */ jsx9("button", { type: "button", className: "as-nav-button", "aria-label": `Rename ${item.name}`, title: "Rename", onClick: () => setRename(true), children: /* @__PURE__ */ jsx9(Pencil, {}) }) : null,
425
- actions.length ? /* @__PURE__ */ jsx9(NavOverflowMenu, { id: `project-${item.id}`, label: `${item.name} options`, actions }) : null
426
- ] })
427
- ] }),
428
- expanded ? /* @__PURE__ */ jsxs3("div", { className: "as-nav-project-conversations", children: [
429
- conversations.filter((conversation) => conversation.projectId === item.id && !conversation.pinned).map((conversation) => /* @__PURE__ */ jsx9(ConversationRow, { item: conversation }, conversation.id)),
430
- data.onSelectProject ? /* @__PURE__ */ jsx9("button", { className: "as-nav-project-home", type: "button", onClick: () => {
431
- data.onSelectProject?.(item.id);
432
- if (isMobile) close();
433
- }, children: "Open project" }) : null
434
- ] }) : null,
435
- data.onRenameProject ? /* @__PURE__ */ jsx9(RenameDialog, { open: rename, onOpenChange: setRename, title: "Rename project", value: item.name, onSave: (name) => data.onRenameProject?.(item.id, name) }) : null
436
- ] });
437
- }
438
- function SidenavContents() {
439
- const { data, close, isMobile } = useNav();
440
- const [query, setQuery] = useState3("");
441
- const normalized = query.trim().toLowerCase();
442
- const conversations = (data.conversations ?? []).filter((item) => !normalized || item.title.toLowerCase().includes(normalized));
443
- const projects = (data.projects ?? []).filter((item) => !normalized || item.name.toLowerCase().includes(normalized) || conversations.some((conversation) => conversation.projectId === item.id));
444
- const pinnedConversations = conversations.filter((item) => item.pinned);
445
- const pinnedProjects = projects.filter((item) => item.pinned);
446
- const recent = conversations.filter((item) => !item.pinned && (!item.projectId || !projects.some((project) => project.id === item.projectId)));
447
- return /* @__PURE__ */ jsxs3(Fragment3, { children: [
448
- /* @__PURE__ */ jsx9("div", { className: "as-nav-sidenav-head", children: /* @__PURE__ */ jsx9(NavTopbarLogo, { toggle: true }) }),
449
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-sidenav-main", children: [
450
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-destinations", children: [
451
- data.onCreateConversation ? /* @__PURE__ */ jsxs3("button", { type: "button", className: "as-nav-destination", title: "New chat", "aria-label": "New chat", onClick: () => {
452
- data.onCreateConversation?.();
453
- if (isMobile) close();
454
- }, children: [
455
- /* @__PURE__ */ jsx9(Plus, {}),
456
- /* @__PURE__ */ jsx9("span", { children: "New chat" })
457
- ] }) : null,
458
- (data.destinations ?? []).map((item) => /* @__PURE__ */ jsxs3("button", { type: "button", className: "as-nav-destination", title: item.label, "aria-label": item.label, "data-active": item.active || void 0, onClick: () => {
459
- if (item.onSelect) item.onSelect();
460
- else if (item.href) data.onNavigate?.(item.href);
461
- if (isMobile) close();
462
- }, children: [
463
- item.icon,
464
- /* @__PURE__ */ jsx9("span", { children: item.label })
465
- ] }, item.id))
466
- ] }),
467
- /* @__PURE__ */ jsxs3("div", { className: "as-nav-expanded-only as-nav-history", children: [
468
- /* @__PURE__ */ jsxs3("label", { className: "as-nav-search", children: [
469
- /* @__PURE__ */ jsx9(Search, {}),
470
- /* @__PURE__ */ jsx9("input", { "aria-label": "Search conversations", placeholder: "Search conversations", value: query, onChange: (event) => setQuery(event.target.value) })
471
- ] }),
472
- pinnedProjects.length || pinnedConversations.length ? /* @__PURE__ */ jsxs3("section", { children: [
473
- /* @__PURE__ */ jsx9("h2", { children: "Pinned" }),
474
- pinnedProjects.map((item) => /* @__PURE__ */ jsx9(ProjectRow, { item, conversations }, item.id)),
475
- pinnedConversations.map((item) => /* @__PURE__ */ jsx9(ConversationRow, { item }, item.id))
476
- ] }) : null,
477
- projects.length ? /* @__PURE__ */ jsxs3("section", { children: [
478
- /* @__PURE__ */ jsx9("h2", { children: "Projects" }),
479
- projects.map((project) => /* @__PURE__ */ jsx9(ProjectRow, { item: project, conversations }, project.id))
480
- ] }) : null,
481
- recent.length ? /* @__PURE__ */ jsxs3("section", { children: [
482
- /* @__PURE__ */ jsx9("h2", { children: "Recent conversations" }),
483
- recent.map((item) => /* @__PURE__ */ jsx9(ConversationRow, { item }, item.id))
484
- ] }) : null,
485
- !conversations.length && !projects.length ? /* @__PURE__ */ jsx9("p", { className: "as-nav-empty", children: query ? "No matching conversations or projects" : "Your conversations will appear here." }) : null
486
- ] })
487
- ] }),
488
- /* @__PURE__ */ jsx9("div", { className: "as-nav-sidenav-foot", children: /* @__PURE__ */ jsx9(NavAccountSwitcher, { expanded: true }) })
489
- ] });
490
- }
491
- function NavSidenav() {
492
- const { open, isMobile, isPeeking, peekable, setPeeking, setOpen, menu, theme } = useNav();
493
- const style = useNavStyle();
494
- if (isMobile) return /* @__PURE__ */ jsx9(Dialog.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs3(Dialog.Portal, { children: [
495
- /* @__PURE__ */ jsx9(Dialog.Overlay, { className: "as-nav-dialog-overlay" }),
496
- /* @__PURE__ */ jsxs3(Dialog.Content, { "data-nav-theme": theme, style, className: "as-nav-scope as-nav-mobile-drawer", children: [
497
- /* @__PURE__ */ jsx9(Dialog.Title, { className: "as-nav-sr-only", children: "Navigation" }),
498
- /* @__PURE__ */ jsx9(Dialog.Description, { className: "as-nav-sr-only", children: "Projects and conversations" }),
499
- /* @__PURE__ */ jsx9(SidenavContents, {})
500
- ] })
501
- ] }) });
502
- return /* @__PURE__ */ jsx9(NavScope, { className: "as-nav-sidenav-reserve", "data-open": open, children: /* @__PURE__ */ jsx9("aside", { "aria-label": "Application navigation", className: "as-nav-sidenav", "data-expanded": open || isPeeking, onMouseEnter: () => {
503
- if (peekable && !open) setPeeking(true);
504
- }, onMouseLeave: () => {
505
- if (!menu) setPeeking(false);
506
- }, children: /* @__PURE__ */ jsx9(SidenavContents, {}) }) });
507
- }
508
-
509
- // src/Nav.tsx
510
- import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
511
- function NavRoot({ className, children, ...props }) {
512
- const { close, isMobile, isPeeking, open, peekable, resizable, setPeeking, setWidth, width } = useNav();
513
- const startResize = useCallback2((event) => {
514
- if (isMobile) return;
515
- event.preventDefault();
516
- const startX = event.clientX;
517
- const startWidth = width;
518
- const onPointerMove = (move) => setWidth(startWidth + move.clientX - startX);
519
- const stop = () => {
520
- window.removeEventListener("pointermove", onPointerMove);
521
- window.removeEventListener("pointerup", stop);
522
- };
523
- window.addEventListener("pointermove", onPointerMove);
524
- window.addEventListener("pointerup", stop, { once: true });
525
- }, [isMobile, setWidth, width]);
526
- return /* @__PURE__ */ jsxs4(Fragment4, { children: [
527
- isMobile && open ? /* @__PURE__ */ jsx10("button", { type: "button", className: "agentsam-nav__backdrop", "aria-label": "Close navigation", onClick: close }) : null,
528
- /* @__PURE__ */ jsxs4(
529
- "aside",
530
- {
531
- "aria-label": "Application navigation",
532
- "data-mobile": isMobile ? "true" : "false",
533
- "data-open": open ? "true" : "false",
534
- "data-peeking": isPeeking ? "true" : "false",
535
- className: cx("agentsam-nav", className),
536
- style: { "--agentsam-nav-width": `${width}px`, ...props.style },
537
- onMouseEnter: () => {
538
- if (peekable && !open && !isMobile) setPeeking(true);
539
- },
540
- onMouseLeave: () => setPeeking(false),
541
- ...props,
542
- children: [
543
- children,
544
- resizable && !isMobile && open ? /* @__PURE__ */ jsx10("div", { className: "agentsam-nav__resize-handle", role: "separator", "aria-label": "Resize navigation", "aria-orientation": "vertical", onPointerDown: startResize }) : null
545
- ]
546
- }
547
- )
548
- ] });
549
- }
550
- var Nav = Object.assign(NavRoot, {
551
- Scope: NavScope,
552
- Sidenav: NavSidenav,
553
- Topbar: NavTopbar,
554
- TopbarLogo: NavTopbarLogo,
555
- TopbarSpacer: NavTopbarSpacer,
556
- ProjectContext: NavProjectContext,
557
- AccountSwitcher: NavAccountSwitcher,
558
- FilesResources: NavFilesResources,
559
- PinnedSummary: NavPinnedSummary,
560
- ConversationActions: NavConversationActions,
561
- ShareButton: NavShareButton,
562
- OverflowMenu: NavOverflowMenu,
563
- ModeSwitcher: NavModeSwitcher,
564
- Provider: NavProvider,
565
- Header: NavHeader,
566
- Content: NavContent,
567
- Footer: NavFooter,
568
- Group: NavGroup,
569
- GroupLabel: NavGroupLabel,
570
- Menu: NavMenu,
571
- MenuItem: NavMenuItem,
572
- MenuButton: NavMenuButton,
573
- MenuSub: NavMenuSub,
574
- MenuSubButton: NavMenuSubButton,
575
- MenuChevron: NavMenuChevron,
576
- Collapsible: NavCollapsible,
577
- CollapsibleTrigger: NavCollapsibleTrigger,
578
- CollapsibleContent: NavCollapsibleContent,
579
- Trigger: NavTrigger
580
- });
581
- export {
582
- Nav,
583
- NavAccountSwitcher,
584
- NavCollapsible,
585
- NavCollapsibleContent,
586
- NavCollapsibleTrigger,
587
- NavContent,
588
- NavConversationActions,
589
- NavFilesResources,
590
- NavFooter,
591
- NavGroup,
592
- NavGroupLabel,
593
- NavHeader,
594
- NavMenu,
595
- NavMenuButton,
596
- NavMenuChevron,
597
- NavMenuItem,
598
- NavMenuSub,
599
- NavMenuSubButton,
600
- NavModeSwitcher,
601
- NavOverflowMenu,
602
- NavPinnedSummary,
603
- NavProjectContext,
604
- NavProvider,
605
- NavScope,
606
- NavShareButton,
607
- NavSidenav,
608
- NavTopbar,
609
- NavTopbarLogo,
610
- NavTopbarSpacer,
611
- NavTrigger,
612
- useNav,
613
- useNavStyle
614
- };