create-workframe 0.1.0

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 (415) hide show
  1. package/.dockerignore +22 -0
  2. package/.gitignore +73 -0
  3. package/LICENSE +201 -0
  4. package/NOTICE +12 -0
  5. package/README.md +111 -0
  6. package/SECURITY.md +40 -0
  7. package/bin/create-workframe.js +2814 -0
  8. package/bin/workframe.js +329 -0
  9. package/docs/workspace-instructions/WORKFRAME_DISCORD.md +20 -0
  10. package/docs/workspace-instructions/WORKFRAME_DOCUMENTS_AND_ARTIFACTS.md +20 -0
  11. package/docs/workspace-instructions/WORKFRAME_KANBAN.md +20 -0
  12. package/docs/workspace-instructions/WORKFRAME_ONBOARDING.md +21 -0
  13. package/docs/workspace-instructions/WORKFRAME_ROUTING.md +29 -0
  14. package/docs/workspace-instructions/WORKFRAME_TELEGRAM.md +19 -0
  15. package/package.json +67 -0
  16. package/profiles/README.md +15 -0
  17. package/profiles/architect/AGENTS.md +29 -0
  18. package/profiles/architect/SOUL.md +44 -0
  19. package/profiles/architect/skills/devops/kanban-worker/SKILL.md +27 -0
  20. package/profiles/designer/AGENTS.md +26 -0
  21. package/profiles/designer/SOUL.md +31 -0
  22. package/profiles/designer/skills/devops/kanban-worker/SKILL.md +27 -0
  23. package/profiles/dev/AGENTS.md +28 -0
  24. package/profiles/dev/SOUL.md +31 -0
  25. package/profiles/dev/skills/devops/kanban-worker/SKILL.md +27 -0
  26. package/profiles/docs/AGENTS.md +27 -0
  27. package/profiles/docs/SOUL.md +30 -0
  28. package/profiles/docs/skills/devops/kanban-worker/SKILL.md +27 -0
  29. package/profiles/research/AGENTS.md +26 -0
  30. package/profiles/research/SOUL.md +31 -0
  31. package/profiles/research/skills/devops/kanban-worker/SKILL.md +27 -0
  32. package/profiles/visionary/AGENTS.md +25 -0
  33. package/profiles/visionary/SOUL.md +31 -0
  34. package/profiles/visionary/skills/devops/kanban-worker/SKILL.md +27 -0
  35. package/profiles/workframe-agent/AGENTS.md +37 -0
  36. package/profiles/workframe-agent/SETUP.md +185 -0
  37. package/profiles/workframe-agent/SOUL.md +61 -0
  38. package/profiles/workframe-agent/skills/devops/botfather/SKILL.md +85 -0
  39. package/profiles/workframe-agent/skills/devops/kanban-handoff-pattern/SKILL.md +58 -0
  40. package/profiles/workframe-agent/skills/devops/workframe-cohort/SKILL.md +54 -0
  41. package/prompts/WORKFRAME_PROMPT_TEMPLATES.md +16 -0
  42. package/rules/.hermes.md +11 -0
  43. package/rules/AGENTS.md +22 -0
  44. package/rules/workspace-README.md +5 -0
  45. package/scripts/apply-update-hermes.sh +17 -0
  46. package/scripts/apply-update-workframe.sh +77 -0
  47. package/scripts/bootstrap-workspace-link.sh +8 -0
  48. package/scripts/bundle-workframe-ui.mjs +77 -0
  49. package/scripts/compose-docker-host.sh +37 -0
  50. package/scripts/create_workframe_scaffold.py +648 -0
  51. package/scripts/ensure-compose-host-paths.mjs +51 -0
  52. package/scripts/fix-zk-encryption-key.sh +35 -0
  53. package/scripts/lib/install-identity.mjs +212 -0
  54. package/scripts/lib/workframe-registry.mjs +290 -0
  55. package/scripts/new-project.mjs +68 -0
  56. package/scripts/restart-gateway-hermes.sh +12 -0
  57. package/scripts/security_audit.py +156 -0
  58. package/scripts/select_agent_pack.py +31 -0
  59. package/scripts/set-compose-public-url.mjs +92 -0
  60. package/scripts/setup-stack-secrets.sh +50 -0
  61. package/scripts/sync-canonical-to-package.mjs +146 -0
  62. package/scripts/test-scaffold.mjs +390 -0
  63. package/scripts/verify-public-deploy.sh +105 -0
  64. package/shared/WORKFRAME_AGENT_LIBRARY.md +31 -0
  65. package/shared/WORKFRAME_AGENT_OPERATIONS.md +29 -0
  66. package/shared/WORKFRAME_AGENT_PACKS.json +64 -0
  67. package/shared/WORKFRAME_AGENT_PACKS.yaml +20 -0
  68. package/shared/WORKFRAME_CHAT_PERMISSION_MODEL.md +20 -0
  69. package/shared/WORKFRAME_HANDOFF_SCHEMA.md +25 -0
  70. package/shared/WORKFRAME_SKILL_CURATION.md +27 -0
  71. package/shared/agent-avatars/ada.png +0 -0
  72. package/shared/agent-avatars/aibert.png +0 -0
  73. package/shared/agent-avatars/amelia.png +0 -0
  74. package/shared/agent-avatars/andy.png +0 -0
  75. package/shared/agent-avatars/arc.png +0 -0
  76. package/shared/agent-avatars/bob.png +0 -0
  77. package/shared/agent-avatars/buzz.png +0 -0
  78. package/shared/agent-avatars/carl.png +0 -0
  79. package/shared/agent-avatars/catalog.json +171 -0
  80. package/shared/agent-avatars/corbu.png +0 -0
  81. package/shared/agent-avatars/diana.png +0 -0
  82. package/shared/agent-avatars/ella.png +0 -0
  83. package/shared/agent-avatars/elvis.png +0 -0
  84. package/shared/agent-avatars/f1.png +0 -0
  85. package/shared/agent-avatars/f2.png +0 -0
  86. package/shared/agent-avatars/f3.png +0 -0
  87. package/shared/agent-avatars/f4.png +0 -0
  88. package/shared/agent-avatars/f5.png +0 -0
  89. package/shared/agent-avatars/f6.png +0 -0
  90. package/shared/agent-avatars/frida.png +0 -0
  91. package/shared/agent-avatars/george.png +0 -0
  92. package/shared/agent-avatars/grace.png +0 -0
  93. package/shared/agent-avatars/hedy.png +0 -0
  94. package/shared/agent-avatars/hermes.png +0 -0
  95. package/shared/agent-avatars/isaac.png +0 -0
  96. package/shared/agent-avatars/jes.png +0 -0
  97. package/shared/agent-avatars/john.png +0 -0
  98. package/shared/agent-avatars/joni.png +0 -0
  99. package/shared/agent-avatars/leo.png +0 -0
  100. package/shared/agent-avatars/louis.png +0 -0
  101. package/shared/agent-avatars/ludwig.png +0 -0
  102. package/shared/agent-avatars/m1.png +0 -0
  103. package/shared/agent-avatars/m2.png +0 -0
  104. package/shared/agent-avatars/m3.png +0 -0
  105. package/shared/agent-avatars/m4.png +0 -0
  106. package/shared/agent-avatars/m5.png +0 -0
  107. package/shared/agent-avatars/m6.png +0 -0
  108. package/shared/agent-avatars/marie.png +0 -0
  109. package/shared/agent-avatars/marilyn.png +0 -0
  110. package/shared/agent-avatars/neil.png +0 -0
  111. package/shared/agent-avatars/nikola.png +0 -0
  112. package/shared/agent-avatars/nina.png +0 -0
  113. package/shared/agent-avatars/paul.png +0 -0
  114. package/shared/agent-avatars/ringo.png +0 -0
  115. package/shared/agent-avatars/rosie.png +0 -0
  116. package/shared/agent-avatars/ste.png +0 -0
  117. package/shared/agent-avatars/steve.png +0 -0
  118. package/shared/agent-avatars/sun.png +0 -0
  119. package/shared/agent-avatars/tom.png +0 -0
  120. package/shared/agent-avatars/warren.png +0 -0
  121. package/shared/agent-avatars/woz.png +0 -0
  122. package/shared/agent-avatars/zaha.png +0 -0
  123. package/workframe-api/Dockerfile +14 -0
  124. package/workframe-api/README.md +28 -0
  125. package/workframe-api/action_proxy.py +131 -0
  126. package/workframe-api/auth_rate_limit.py +49 -0
  127. package/workframe-api/catalog/avatar-catalog.json +171 -0
  128. package/workframe-api/catalog/logo-catalog.json +86 -0
  129. package/workframe-api/catalog/user-avatar-catalog.json +171 -0
  130. package/workframe-api/credential_vault.py +445 -0
  131. package/workframe-api/data/.gitkeep +0 -0
  132. package/workframe-api/data/avatar-catalog.json +41 -0
  133. package/workframe-api/data/logo-catalog.json +14 -0
  134. package/workframe-api/data/user-avatar-catalog.json +18 -0
  135. package/workframe-api/email_sender.py +220 -0
  136. package/workframe-api/google_auth.py +90 -0
  137. package/workframe-api/install_api.py +359 -0
  138. package/workframe-api/internal_proxy_auth.py +150 -0
  139. package/workframe-api/llm_proxy.py +277 -0
  140. package/workframe-api/oidc_jwt.py +108 -0
  141. package/workframe-api/package.json +13 -0
  142. package/workframe-api/platform_auth.py +194 -0
  143. package/workframe-api/profile_secret_policy.py +86 -0
  144. package/workframe-api/public/assets/index-DPXu_lGn.css +1 -0
  145. package/workframe-api/public/assets/index-DYnLrCZZ.js +9 -0
  146. package/workframe-api/public/assets/index-DglUqFB_.js +9 -0
  147. package/workframe-api/public/index.html +12 -0
  148. package/workframe-api/requirements.txt +2 -0
  149. package/workframe-api/server.py +19646 -0
  150. package/workframe-api/site_meta.py +271 -0
  151. package/workframe-api/stack_config.py +427 -0
  152. package/workframe-api/tests/__init__.py +0 -0
  153. package/workframe-api/tests/db_setup.py +13 -0
  154. package/workframe-api/tests/test_admin_updates_gated.py +30 -0
  155. package/workframe-api/tests/test_agent_dm_bootstrap.py +196 -0
  156. package/workframe-api/tests/test_agent_profile_sync.py +76 -0
  157. package/workframe-api/tests/test_auth_email.py +222 -0
  158. package/workframe-api/tests/test_auth_hole_fix_selfcheck.py +99 -0
  159. package/workframe-api/tests/test_auth_rate_limit.py +19 -0
  160. package/workframe-api/tests/test_avatar_resolve.py +77 -0
  161. package/workframe-api/tests/test_child_soul_template.py +71 -0
  162. package/workframe-api/tests/test_credential_canary.py +135 -0
  163. package/workframe-api/tests/test_credential_isolation.py +448 -0
  164. package/workframe-api/tests/test_credential_resolution.py +206 -0
  165. package/workframe-api/tests/test_device_oauth.py +108 -0
  166. package/workframe-api/tests/test_doctor_repair.py +103 -0
  167. package/workframe-api/tests/test_ensure_profile_api.py +77 -0
  168. package/workframe-api/tests/test_gateway_compose_security.py +136 -0
  169. package/workframe-api/tests/test_install_secure_host.py +39 -0
  170. package/workframe-api/tests/test_internal_proxy_auth.py +125 -0
  171. package/workframe-api/tests/test_invite_runtime_bootstrap.py +72 -0
  172. package/workframe-api/tests/test_kanban_delegation.py +185 -0
  173. package/workframe-api/tests/test_llm_proxy.py +155 -0
  174. package/workframe-api/tests/test_login_access_policy.py +183 -0
  175. package/workframe-api/tests/test_mvp_model_bootstrap.py +75 -0
  176. package/workframe-api/tests/test_onboarding_bootstrap.py +248 -0
  177. package/workframe-api/tests/test_platform_auth.py +47 -0
  178. package/workframe-api/tests/test_profile_config_path.py +56 -0
  179. package/workframe-api/tests/test_profile_config_yaml_repair.py +63 -0
  180. package/workframe-api/tests/test_profile_create.py +72 -0
  181. package/workframe-api/tests/test_profile_identity_overlay.py +61 -0
  182. package/workframe-api/tests/test_profile_install_health.py +45 -0
  183. package/workframe-api/tests/test_profile_secret_policy.py +57 -0
  184. package/workframe-api/tests/test_profile_workspace_cwd.py +34 -0
  185. package/workframe-api/tests/test_provider_bootstrap.py +75 -0
  186. package/workframe-api/tests/test_provider_connect.py +54 -0
  187. package/workframe-api/tests/test_room_crud.py +192 -0
  188. package/workframe-api/tests/test_room_tenancy.py +701 -0
  189. package/workframe-api/tests/test_runtime_identity_backfill.py +34 -0
  190. package/workframe-api/tests/test_site_meta.py +81 -0
  191. package/workframe-api/tests/test_soul_stub.py +42 -0
  192. package/workframe-api/tests/test_space_member_sync.py +99 -0
  193. package/workframe-api/tests/test_stripe_stack_config.py +37 -0
  194. package/workframe-api/tests/test_supervisor_lifecycle.py +52 -0
  195. package/workframe-api/tests/test_turn_credential_vault.py +125 -0
  196. package/workframe-api/tests/test_updates.py +176 -0
  197. package/workframe-api/tests/test_user_cohort.py +113 -0
  198. package/workframe-api/tests/test_vault_envelope.py +110 -0
  199. package/workframe-api/tests/test_workspace_members.py +183 -0
  200. package/workframe-api/tests/test_workspace_messaging_sync.py +125 -0
  201. package/workframe-api/tests/test_workspace_provider_list.py +57 -0
  202. package/workframe-api/time-bind-chat.py +99 -0
  203. package/workframe-api/turn_credentials.py +226 -0
  204. package/workframe-api/updates.py +417 -0
  205. package/workframe-api/vault_kek.py +159 -0
  206. package/workframe-api/zk_auth.py +633 -0
  207. package/workframe-supervisor/Dockerfile +11 -0
  208. package/workframe-supervisor/profile_secret_policy.py +76 -0
  209. package/workframe-supervisor/server.py +787 -0
  210. package/workframe-supervisor/tests/test_exec_guard.py +42 -0
  211. package/workframe-supervisor/tests/test_server_import.py +21 -0
  212. package/workframe-ui/docker/nginx.conf +85 -0
  213. package/workframe-ui/public/assets/1-DLJbBkOb.png +0 -0
  214. package/workframe-ui/public/assets/10-uwRwj5ce.png +0 -0
  215. package/workframe-ui/public/assets/11-5OuV9F_e.png +0 -0
  216. package/workframe-ui/public/assets/12-u_axjxW-.png +0 -0
  217. package/workframe-ui/public/assets/13-ldSvcMsH.png +0 -0
  218. package/workframe-ui/public/assets/14-xdcALEYD.png +0 -0
  219. package/workframe-ui/public/assets/15-aZ4snEFB.png +0 -0
  220. package/workframe-ui/public/assets/16-L_5-DttY.png +0 -0
  221. package/workframe-ui/public/assets/2-zOPZTppD.png +0 -0
  222. package/workframe-ui/public/assets/3-Dc3WoVu5.png +0 -0
  223. package/workframe-ui/public/assets/4-C50hk7_m.png +0 -0
  224. package/workframe-ui/public/assets/5-Eweetkq4.png +0 -0
  225. package/workframe-ui/public/assets/6-5sOXgfkw.png +0 -0
  226. package/workframe-ui/public/assets/7-BqRBCbiC.png +0 -0
  227. package/workframe-ui/public/assets/8-DEDKS94h.png +0 -0
  228. package/workframe-ui/public/assets/9-DNj34GW-.png +0 -0
  229. package/workframe-ui/public/assets/ada-DsvuOc9n.png +0 -0
  230. package/workframe-ui/public/assets/aibert-BCz8Lo8H.png +0 -0
  231. package/workframe-ui/public/assets/amelia-DUf3EBGu.png +0 -0
  232. package/workframe-ui/public/assets/andy-Cpymuhhx.png +0 -0
  233. package/workframe-ui/public/assets/arc-CBDYvkAF.js +1 -0
  234. package/workframe-ui/public/assets/architecture-7EHR7CIX-CtbQKTuT.js +1 -0
  235. package/workframe-ui/public/assets/architectureDiagram-3BPJPVTR-XnBRKeW0.js +36 -0
  236. package/workframe-ui/public/assets/array-BifhSqXX.js +1 -0
  237. package/workframe-ui/public/assets/avatars/ada.png +0 -0
  238. package/workframe-ui/public/assets/avatars/aibert.png +0 -0
  239. package/workframe-ui/public/assets/avatars/amelia.png +0 -0
  240. package/workframe-ui/public/assets/avatars/andy.png +0 -0
  241. package/workframe-ui/public/assets/avatars/bob.png +0 -0
  242. package/workframe-ui/public/assets/avatars/buzz.png +0 -0
  243. package/workframe-ui/public/assets/avatars/carl.png +0 -0
  244. package/workframe-ui/public/assets/avatars/catalog.json +171 -0
  245. package/workframe-ui/public/assets/avatars/corbu.png +0 -0
  246. package/workframe-ui/public/assets/avatars/diana.png +0 -0
  247. package/workframe-ui/public/assets/avatars/elvis.png +0 -0
  248. package/workframe-ui/public/assets/avatars/frida.png +0 -0
  249. package/workframe-ui/public/assets/avatars/george.png +0 -0
  250. package/workframe-ui/public/assets/avatars/grace.png +0 -0
  251. package/workframe-ui/public/assets/avatars/hedy.png +0 -0
  252. package/workframe-ui/public/assets/avatars/hermes.png +0 -0
  253. package/workframe-ui/public/assets/avatars/isaac.png +0 -0
  254. package/workframe-ui/public/assets/avatars/john.png +0 -0
  255. package/workframe-ui/public/assets/avatars/joni.png +0 -0
  256. package/workframe-ui/public/assets/avatars/leo.png +0 -0
  257. package/workframe-ui/public/assets/avatars/louis.png +0 -0
  258. package/workframe-ui/public/assets/avatars/ludwig.png +0 -0
  259. package/workframe-ui/public/assets/avatars/marie.png +0 -0
  260. package/workframe-ui/public/assets/avatars/marilyn.png +0 -0
  261. package/workframe-ui/public/assets/avatars/nikola.png +0 -0
  262. package/workframe-ui/public/assets/avatars/nina.png +0 -0
  263. package/workframe-ui/public/assets/avatars/paul.png +0 -0
  264. package/workframe-ui/public/assets/avatars/ringo.png +0 -0
  265. package/workframe-ui/public/assets/avatars/rosie.png +0 -0
  266. package/workframe-ui/public/assets/avatars/steve.png +0 -0
  267. package/workframe-ui/public/assets/avatars/sun.png +0 -0
  268. package/workframe-ui/public/assets/avatars/warren.png +0 -0
  269. package/workframe-ui/public/assets/avatars/woz.png +0 -0
  270. package/workframe-ui/public/assets/avatars/zaha.png +0 -0
  271. package/workframe-ui/public/assets/blockDiagram-GPEHLZMM-VYHUfVhd.js +132 -0
  272. package/workframe-ui/public/assets/bob-DRz-48Id.png +0 -0
  273. package/workframe-ui/public/assets/branding/banner.png +0 -0
  274. package/workframe-ui/public/assets/branding/og-default.png +0 -0
  275. package/workframe-ui/public/assets/branding/workframe'white.png +0 -0
  276. package/workframe-ui/public/assets/branding/workframe-1.png +0 -0
  277. package/workframe-ui/public/assets/branding/workframe-2.png +0 -0
  278. package/workframe-ui/public/assets/branding/workframe-3.png +0 -0
  279. package/workframe-ui/public/assets/branding/workframe-4.png +0 -0
  280. package/workframe-ui/public/assets/branding/workframe-5.png +0 -0
  281. package/workframe-ui/public/assets/branding/workframe-banner.png +0 -0
  282. package/workframe-ui/public/assets/branding/workframe-logo-horizontal-mini.png +0 -0
  283. package/workframe-ui/public/assets/branding/workframe-logo-horizontal-nano.png +0 -0
  284. package/workframe-ui/public/assets/branding/workframe-logo-horizontal.png +0 -0
  285. package/workframe-ui/public/assets/branding/workframe-logo-vertical-alt.png +0 -0
  286. package/workframe-ui/public/assets/branding/workframe-logo-vertical.png +0 -0
  287. package/workframe-ui/public/assets/branding/workframe.png +0 -0
  288. package/workframe-ui/public/assets/buzz-mC4PtMvC.png +0 -0
  289. package/workframe-ui/public/assets/c4Diagram-AAUBKEIU-BTjUcJpm.js +10 -0
  290. package/workframe-ui/public/assets/carl-CtE74db_.png +0 -0
  291. package/workframe-ui/public/assets/channel-Dy4Z4-jn.js +1 -0
  292. package/workframe-ui/public/assets/chunk-2J33WTMH-w7uu7R-b.js +1 -0
  293. package/workframe-ui/public/assets/chunk-3OPIFGDE-Cb9LtnDX.js +62 -0
  294. package/workframe-ui/public/assets/chunk-4BX2VUAB-DiQ-qCwH.js +1 -0
  295. package/workframe-ui/public/assets/chunk-55IACEB6-C-mLFr7z.js +1 -0
  296. package/workframe-ui/public/assets/chunk-5ZQYHXKU-DOesfiCI.js +2 -0
  297. package/workframe-ui/public/assets/chunk-727SXJPM-BJ3oBZuz.js +206 -0
  298. package/workframe-ui/public/assets/chunk-AQP2D5EJ-CCA6xpGs.js +231 -0
  299. package/workframe-ui/public/assets/chunk-BSJP7CBP-a0cMNFb2.js +1 -0
  300. package/workframe-ui/public/assets/chunk-CSCIHK7Q-kuqN8EIY.js +122 -0
  301. package/workframe-ui/public/assets/chunk-FMBD7UC4-DyPgYHCg.js +15 -0
  302. package/workframe-ui/public/assets/chunk-KSCS5N6A-CdUuvR0V.js +10 -0
  303. package/workframe-ui/public/assets/chunk-L5ZTLDWV-Dq9NoWmK.js +1 -0
  304. package/workframe-ui/public/assets/chunk-LZXEDZCA-p74rddlO.js +2 -0
  305. package/workframe-ui/public/assets/chunk-ND2GUHAM-DBD2u1Gz.js +1 -0
  306. package/workframe-ui/public/assets/chunk-NNHCCRGN-DlpIbxXb.js +159 -0
  307. package/workframe-ui/public/assets/chunk-NZK2D7GU-BeIeYFnd.js +1 -0
  308. package/workframe-ui/public/assets/chunk-O5CBEL6O-ClHc56ib.js +70 -0
  309. package/workframe-ui/public/assets/chunk-QZHKN3VN-CtBEchFK.js +1 -0
  310. package/workframe-ui/public/assets/chunk-WU5MYG2G-B9pBtriN.js +1 -0
  311. package/workframe-ui/public/assets/chunk-XPW4576I-EFr8R_1p.js +32 -0
  312. package/workframe-ui/public/assets/classDiagram-4FO5ZUOK-BMAEA8jI.js +1 -0
  313. package/workframe-ui/public/assets/classDiagram-v2-Q7XG4LA2-BMAEA8jI.js +1 -0
  314. package/workframe-ui/public/assets/corbu-KiaMXzXQ.png +0 -0
  315. package/workframe-ui/public/assets/cose-bilkent-S5V4N54A-C7aPBODd.js +1 -0
  316. package/workframe-ui/public/assets/cytoscape.esm-h6BdjjI9.js +321 -0
  317. package/workframe-ui/public/assets/dagre-BM42HDAG-BdU1Rv-H.js +4 -0
  318. package/workframe-ui/public/assets/dagre-Bx709z4p.js +1 -0
  319. package/workframe-ui/public/assets/defaultLocale-C8Fc0cco.js +1 -0
  320. package/workframe-ui/public/assets/diagram-2AECGRRQ-DWowSo85.js +43 -0
  321. package/workframe-ui/public/assets/diagram-5GNKFQAL-MnxBbceO.js +10 -0
  322. package/workframe-ui/public/assets/diagram-KO2AKTUF-DQaLRXFf.js +3 -0
  323. package/workframe-ui/public/assets/diagram-LMA3HP47-CQaBud9k.js +24 -0
  324. package/workframe-ui/public/assets/diagram-OG6HWLK6-D8bAXbY9.js +24 -0
  325. package/workframe-ui/public/assets/diana-DW0MsL38.png +0 -0
  326. package/workframe-ui/public/assets/dist-DGpTLHr_.js +1 -0
  327. package/workframe-ui/public/assets/elvis-LCFaZIcT.png +0 -0
  328. package/workframe-ui/public/assets/erDiagram-TEJ5UH35-1E-xSvBK.js +85 -0
  329. package/workframe-ui/public/assets/eventmodeling-FCH6USID-D75cstNT.js +1 -0
  330. package/workframe-ui/public/assets/flowDiagram-I6XJVG4X-CgOVD5hu.js +162 -0
  331. package/workframe-ui/public/assets/frida-CXFA0w3F.png +0 -0
  332. package/workframe-ui/public/assets/ganttDiagram-6RSMTGT7-JFYAIauo.js +292 -0
  333. package/workframe-ui/public/assets/george-DBSH2Sm2.png +0 -0
  334. package/workframe-ui/public/assets/gitGraph-WXDBUCRP-B9REenIl.js +1 -0
  335. package/workframe-ui/public/assets/gitGraphDiagram-PVQCEYII-BQ7NcMSn.js +106 -0
  336. package/workframe-ui/public/assets/grace-BhV0UPc0.png +0 -0
  337. package/workframe-ui/public/assets/graphlib-B8gBHxth.js +1 -0
  338. package/workframe-ui/public/assets/hedy-BR2IHift.png +0 -0
  339. package/workframe-ui/public/assets/hermes-CqCzcE0y.png +0 -0
  340. package/workframe-ui/public/assets/index-Dnw6vjqb.js +133 -0
  341. package/workframe-ui/public/assets/index-DpAGxump.css +1 -0
  342. package/workframe-ui/public/assets/info-J43DQDTF-CL6-eTjH.js +1 -0
  343. package/workframe-ui/public/assets/infoDiagram-5YYISTIA-LJTODW4W.js +2 -0
  344. package/workframe-ui/public/assets/init-D6jRqBbL.js +1 -0
  345. package/workframe-ui/public/assets/isaac-D1nhJAuv.png +0 -0
  346. package/workframe-ui/public/assets/ishikawaDiagram-YF4QCWOH-bchrQVuo.js +70 -0
  347. package/workframe-ui/public/assets/john-zSPWwNi4.png +0 -0
  348. package/workframe-ui/public/assets/joni-BFLoyfJP.png +0 -0
  349. package/workframe-ui/public/assets/journeyDiagram-JHISSGLW-DkrvYuxP.js +139 -0
  350. package/workframe-ui/public/assets/kanban-definition-UN3LZRKU-DFRbj0IG.js +89 -0
  351. package/workframe-ui/public/assets/katex-Vhh-h91d.js +257 -0
  352. package/workframe-ui/public/assets/leo-C_3IOL11.png +0 -0
  353. package/workframe-ui/public/assets/line-Vd48P7-O.js +1 -0
  354. package/workframe-ui/public/assets/linear-Ckizh2G7.js +1 -0
  355. package/workframe-ui/public/assets/louis-DEEECFSX.png +0 -0
  356. package/workframe-ui/public/assets/ludwig-_hoKhhyK.png +0 -0
  357. package/workframe-ui/public/assets/marie-DET6MsfO.png +0 -0
  358. package/workframe-ui/public/assets/marilyn-DTqwt8Yh.png +0 -0
  359. package/workframe-ui/public/assets/mermaid-parser.core-Bkimsnqj.js +4 -0
  360. package/workframe-ui/public/assets/mermaid.core-x0TvVuPo.js +9 -0
  361. package/workframe-ui/public/assets/mindmap-definition-RKZ34NQL-6ykAFPEz.js +96 -0
  362. package/workframe-ui/public/assets/nikola-B4PtHrJv.png +0 -0
  363. package/workframe-ui/public/assets/nina-BYbrOn0d.png +0 -0
  364. package/workframe-ui/public/assets/ordinal-hYBb2elL.js +1 -0
  365. package/workframe-ui/public/assets/packet-YPE3B663-Dw3xgMDt.js +1 -0
  366. package/workframe-ui/public/assets/path-BWPyau1x.js +1 -0
  367. package/workframe-ui/public/assets/paul-CGURYQIn.png +0 -0
  368. package/workframe-ui/public/assets/pie-LRSECV5Y-DATysawG.js +1 -0
  369. package/workframe-ui/public/assets/pieDiagram-4H26LBE5-SJKD1S0S.js +30 -0
  370. package/workframe-ui/public/assets/project-logos/1.png +0 -0
  371. package/workframe-ui/public/assets/project-logos/10.png +0 -0
  372. package/workframe-ui/public/assets/project-logos/11.png +0 -0
  373. package/workframe-ui/public/assets/project-logos/12.png +0 -0
  374. package/workframe-ui/public/assets/project-logos/13.png +0 -0
  375. package/workframe-ui/public/assets/project-logos/14.png +0 -0
  376. package/workframe-ui/public/assets/project-logos/15.png +0 -0
  377. package/workframe-ui/public/assets/project-logos/16.png +0 -0
  378. package/workframe-ui/public/assets/project-logos/2.png +0 -0
  379. package/workframe-ui/public/assets/project-logos/3.png +0 -0
  380. package/workframe-ui/public/assets/project-logos/4.png +0 -0
  381. package/workframe-ui/public/assets/project-logos/5.png +0 -0
  382. package/workframe-ui/public/assets/project-logos/6.png +0 -0
  383. package/workframe-ui/public/assets/project-logos/7.png +0 -0
  384. package/workframe-ui/public/assets/project-logos/8.png +0 -0
  385. package/workframe-ui/public/assets/project-logos/9.png +0 -0
  386. package/workframe-ui/public/assets/project-logos/catalog.json +86 -0
  387. package/workframe-ui/public/assets/quadrantDiagram-W4KKPZXB-BrYDZX8q.js +7 -0
  388. package/workframe-ui/public/assets/radar-GUYGQ44K-BmWYPCds.js +1 -0
  389. package/workframe-ui/public/assets/requirementDiagram-4Y6WPE33-DwL9Mc8e.js +84 -0
  390. package/workframe-ui/public/assets/ringo-WhfUNOyY.png +0 -0
  391. package/workframe-ui/public/assets/rosie-CAtcIf87.png +0 -0
  392. package/workframe-ui/public/assets/rough.esm-CSKSodPl.js +1 -0
  393. package/workframe-ui/public/assets/sankeyDiagram-5OEKKPKP-DYIFsL8h.js +40 -0
  394. package/workframe-ui/public/assets/sequenceDiagram-3UESZ5HK-0-FPkFk8.js +162 -0
  395. package/workframe-ui/public/assets/src-B_od6b6h.js +1 -0
  396. package/workframe-ui/public/assets/stateDiagram-AJRCARHV-BQCiBk6u.js +1 -0
  397. package/workframe-ui/public/assets/stateDiagram-v2-BHNVJYJU-B89jAMFF.js +1 -0
  398. package/workframe-ui/public/assets/steve-CgXXJ9EZ.png +0 -0
  399. package/workframe-ui/public/assets/sun-BLNAhoZd.png +0 -0
  400. package/workframe-ui/public/assets/timeline-definition-PNZ67QCA-DS3tFcXj.js +120 -0
  401. package/workframe-ui/public/assets/treeView-BLDUP644-DSyUCKLY.js +1 -0
  402. package/workframe-ui/public/assets/treemap-LRROVOQU-CEZaNh5Y.js +1 -0
  403. package/workframe-ui/public/assets/vennDiagram-CIIHVFJN-CD-Vc9NF.js +34 -0
  404. package/workframe-ui/public/assets/wardley-L42UT6IY-Drq5w1Mc.js +1 -0
  405. package/workframe-ui/public/assets/wardleyDiagram-YWT4CUSO-DouXDJoF.js +78 -0
  406. package/workframe-ui/public/assets/warren-DIH7UKMY.png +0 -0
  407. package/workframe-ui/public/assets/woz-D2yleG-V.png +0 -0
  408. package/workframe-ui/public/assets/xychartDiagram-2RQKCTM6-DDf_Lol5.js +7 -0
  409. package/workframe-ui/public/assets/zaha-wersOEq9.png +0 -0
  410. package/workframe-ui/public/favicon.ico +0 -0
  411. package/workframe-ui/public/favicon.svg +7 -0
  412. package/workframe-ui/public/icons.svg +24 -0
  413. package/workframe-ui/public/index.html +50 -0
  414. package/workframe-ui/public/manifest.webmanifest +18 -0
  415. package/workframe-ui/public/workframe-config.json +4 -0
@@ -0,0 +1,34 @@
1
+ """Runtime identity backfill from template profiles."""
2
+ from __future__ import annotations
3
+
4
+ import tempfile
5
+ import unittest
6
+ from pathlib import Path
7
+ from unittest import mock
8
+
9
+ import server
10
+
11
+
12
+ class RuntimeIdentityBackfillTests(unittest.TestCase):
13
+ def test_backfill_copies_missing_soul_and_skills_only(self) -> None:
14
+ with tempfile.TemporaryDirectory() as tmp:
15
+ root = Path(tmp)
16
+ template = root / "profiles" / "workframe-agent"
17
+ runtime = root / "profiles" / "u-user-workframe-agent"
18
+ template.mkdir(parents=True)
19
+ runtime.mkdir(parents=True)
20
+ (template / "SOUL.md").write_text("template soul\n", encoding="utf-8")
21
+ (runtime / "SOUL.md").write_text("custom soul\n", encoding="utf-8")
22
+ skill = template / "skills" / "devops" / "botfather" / "SKILL.md"
23
+ skill.parent.mkdir(parents=True)
24
+ skill.write_text("botfather\n", encoding="utf-8")
25
+
26
+ with mock.patch.object(server, "_profile_dir", side_effect=lambda p: root / "profiles" / p):
27
+ server._backfill_runtime_identity("u-user-workframe-agent", "workframe-agent")
28
+
29
+ self.assertEqual((runtime / "SOUL.md").read_text(encoding="utf-8"), "custom soul\n")
30
+ self.assertTrue((runtime / "skills" / "devops" / "botfather" / "SKILL.md").is_file())
31
+
32
+
33
+ if __name__ == "__main__":
34
+ unittest.main()
@@ -0,0 +1,81 @@
1
+ import tempfile
2
+ import unittest
3
+ from pathlib import Path
4
+
5
+ import site_meta
6
+ import stack_config
7
+
8
+
9
+ class SiteMetaTests(unittest.TestCase):
10
+ def setUp(self) -> None:
11
+ self._tmpdir = tempfile.TemporaryDirectory()
12
+ stack_config.DATA_DIR = Path(self._tmpdir.name)
13
+ stack_config.CONFIG_PATH = stack_config.DATA_DIR / "stack_config.json"
14
+
15
+ def tearDown(self) -> None:
16
+ self._tmpdir.cleanup()
17
+
18
+ def test_defaults_before_install(self) -> None:
19
+ meta = site_meta.resolve_site_meta(
20
+ app_base_url="https://dev.alanborger.com",
21
+ install_complete=False,
22
+ )
23
+ self.assertEqual(meta["title"], "Workframe")
24
+ self.assertIn("Hermes", meta["description"])
25
+ self.assertTrue(meta["og_image"].endswith("/assets/branding/og-default.png"))
26
+ self.assertEqual(meta["source"]["title"], "default")
27
+
28
+ def test_workspace_identity_when_configured(self) -> None:
29
+ meta = site_meta.resolve_site_meta(
30
+ app_base_url="https://dev.alanborger.com",
31
+ install_complete=True,
32
+ workspace={
33
+ "display_name": "Acme Labs",
34
+ "description": "Agent ops for the product team",
35
+ "tagline": "Ship with agents",
36
+ "avatar_url": "/assets/project-logos/7.png",
37
+ },
38
+ normalize_logo=lambda url: url,
39
+ )
40
+ self.assertEqual(meta["title"], "Acme Labs")
41
+ self.assertEqual(meta["description"], "Agent ops for the product team")
42
+ self.assertEqual(meta["tagline"], "Ship with agents")
43
+ self.assertTrue(meta["og_image"].endswith("/assets/project-logos/7.png"))
44
+ self.assertEqual(meta["source"]["title"], "workspace")
45
+
46
+ def test_stack_overrides_win(self) -> None:
47
+ stack_config.patch_stack_config(
48
+ {
49
+ "site_branding": {
50
+ "title": "Custom Public Name",
51
+ "description": "Custom public pitch",
52
+ },
53
+ },
54
+ )
55
+ meta = site_meta.resolve_site_meta(
56
+ app_base_url="https://dev.alanborger.com",
57
+ install_complete=True,
58
+ workspace={"display_name": "Acme Labs", "description": "ignored"},
59
+ )
60
+ self.assertEqual(meta["title"], "Custom Public Name")
61
+ self.assertEqual(meta["description"], "Custom public pitch")
62
+ self.assertEqual(meta["source"]["title"], "stack")
63
+
64
+ def test_uploaded_og_image_url(self) -> None:
65
+ site_meta.save_branding_asset("og", b"\x89PNG\r\n\x1a\n", "image/png")
66
+ meta = site_meta.resolve_site_meta(app_base_url="https://dev.alanborger.com", install_complete=False)
67
+ self.assertIn("/api/public/branding/og", meta["og_image"])
68
+ self.assertEqual(meta["source"]["og_image"], "upload")
69
+
70
+ def test_loopback_base_uses_relative_browser_assets(self) -> None:
71
+ meta = site_meta.resolve_site_meta(
72
+ app_base_url="http://127.0.0.1:28644",
73
+ install_complete=False,
74
+ )
75
+ self.assertEqual(meta["favicon"], "/favicon.svg")
76
+ self.assertEqual(meta["manifest_url"], "/manifest.webmanifest")
77
+ self.assertTrue(meta["og_image"].startswith("/assets/"))
78
+
79
+
80
+ if __name__ == "__main__":
81
+ unittest.main()
@@ -0,0 +1,42 @@
1
+ """SOUL stub detection and Workframe identity rendering."""
2
+ from __future__ import annotations
3
+
4
+ import tempfile
5
+ import unittest
6
+ from pathlib import Path
7
+ from unittest import mock
8
+
9
+ import server
10
+
11
+
12
+ class SoulStubTests(unittest.TestCase):
13
+ def test_stub_detects_test_placeholder(self) -> None:
14
+ self.assertTrue(server._soul_is_stub("test"))
15
+ self.assertTrue(server._soul_is_stub("{nativeAgentName} concierge"))
16
+
17
+ def test_profile_soul_text_falls_back_to_template(self) -> None:
18
+ with tempfile.TemporaryDirectory() as tmp:
19
+ root = Path(tmp)
20
+ template = root / "profiles" / "workframe-agent"
21
+ runtime = root / "profiles" / "u-user-workframe-agent"
22
+ template.mkdir(parents=True)
23
+ runtime.mkdir(parents=True)
24
+ (template / "SOUL.md").write_text(
25
+ "# {nativeAgentName}\n\nWorkframe concierge for {projectName}.\n" + ("x" * 80),
26
+ encoding="utf-8",
27
+ )
28
+ (runtime / "SOUL.md").write_text("test", encoding="utf-8")
29
+
30
+ with mock.patch.object(server, "_profile_dir", side_effect=lambda p: root / "profiles" / p), mock.patch.object(
31
+ server, "PROJECT_NAME", "Workframe"
32
+ ), mock.patch.object(server, "NATIVE_PROFILE", "workframe-agent"), mock.patch.object(
33
+ server, "_runtime_template_slug", return_value="workframe-agent"
34
+ ), mock.patch.object(server, "_is_runtime_profile_slug", return_value=True):
35
+ text = server._profile_soul_text("u-user-workframe-agent")
36
+ self.assertIn("Workframe Agent", text)
37
+ self.assertIn("Workframe concierge", text)
38
+ self.assertNotIn("OWL", text.split("\n")[0])
39
+
40
+
41
+ if __name__ == "__main__":
42
+ unittest.main()
@@ -0,0 +1,99 @@
1
+ import tempfile
2
+ import unittest
3
+ from pathlib import Path
4
+
5
+ import server
6
+ from db_setup import ensure_workframe_schemas
7
+
8
+
9
+ class SpaceMemberSyncTests(unittest.TestCase):
10
+ def setUp(self) -> None:
11
+ self._tmp = tempfile.TemporaryDirectory()
12
+ self.addCleanup(self._tmp.cleanup)
13
+ self._old_data_dir = server.DATA_DIR
14
+ self._old_auth_db_path = server.AUTH_DB_PATH
15
+ server.DATA_DIR = Path(self._tmp.name)
16
+ server.AUTH_DB_PATH = Path(self._tmp.name) / "auth.db"
17
+ ensure_workframe_schemas()
18
+ self.workspace_id = "ws-space"
19
+ self.owner_id = "user-owner"
20
+ self.member_id = "user-member"
21
+ conn = server._workframe_db()
22
+ try:
23
+ now = "1"
24
+ for uid, name in ((self.owner_id, "Owner"), (self.member_id, "Member")):
25
+ conn.execute(
26
+ "INSERT INTO users (id, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?)",
27
+ (uid, name, "member", "active", now, now),
28
+ )
29
+ conn.execute(
30
+ """
31
+ INSERT INTO workspaces (id, slug, display_name, owner_id, status, created_at, updated_at)
32
+ VALUES (?, ?, ?, ?, ?, ?, ?)
33
+ """,
34
+ (self.workspace_id, "biz", "My Business", self.owner_id, "active", now, now),
35
+ )
36
+ for uid, role in ((self.owner_id, "owner"), (self.member_id, "member")):
37
+ conn.execute(
38
+ """
39
+ INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at)
40
+ VALUES (?, ?, ?, ?, ?, ?, ?)
41
+ """,
42
+ (f"wm-{uid}", self.workspace_id, uid, role, "active", now, now),
43
+ )
44
+ conn.commit()
45
+ finally:
46
+ conn.close()
47
+
48
+ def tearDown(self) -> None:
49
+ server.DATA_DIR = self._old_data_dir
50
+ server.AUTH_DB_PATH = self._old_auth_db_path
51
+
52
+ def test_new_space_adds_all_workspace_members(self) -> None:
53
+ status, payload = server._create_room(
54
+ self.workspace_id,
55
+ {"name": "Engineering", "slug": "engineering", "room_type": "channel"},
56
+ self.owner_id,
57
+ )
58
+ self.assertEqual(status, 201)
59
+ room_id = payload["room"]["id"]
60
+
61
+ conn = server._workframe_db()
62
+ try:
63
+ self.assertTrue(server._user_can_access_room(conn, room_id, self.owner_id))
64
+ self.assertTrue(server._user_can_access_room(conn, room_id, self.member_id))
65
+ finally:
66
+ conn.close()
67
+
68
+ def test_onboard_joins_existing_spaces(self) -> None:
69
+ status, payload = server._create_room(
70
+ self.workspace_id,
71
+ {"name": "Engineering", "slug": "engineering", "room_type": "channel"},
72
+ self.owner_id,
73
+ )
74
+ self.assertEqual(status, 201)
75
+ room_id = payload["room"]["id"]
76
+
77
+ late_user = "user-late"
78
+ conn = server._workframe_db()
79
+ try:
80
+ conn.execute(
81
+ "INSERT INTO users (id, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?)",
82
+ (late_user, "Late", "member", "active", "2", "2"),
83
+ )
84
+ conn.execute(
85
+ """
86
+ INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at)
87
+ VALUES (?, ?, ?, ?, ?, ?, ?)
88
+ """,
89
+ ("wm-late", self.workspace_id, late_user, "member", "active", "2", "2"),
90
+ )
91
+ server._onboard_workspace_member_rooms(conn, self.workspace_id, late_user)
92
+ conn.commit()
93
+ self.assertTrue(server._user_can_access_room(conn, room_id, late_user))
94
+ finally:
95
+ conn.close()
96
+
97
+
98
+ if __name__ == "__main__":
99
+ unittest.main()
@@ -0,0 +1,37 @@
1
+ import tempfile
2
+ import unittest
3
+ from pathlib import Path
4
+
5
+ import stack_config
6
+
7
+
8
+ class StripeStackConfigTests(unittest.TestCase):
9
+ def setUp(self) -> None:
10
+ self._tmpdir = tempfile.TemporaryDirectory()
11
+ stack_config.DATA_DIR = Path(self._tmpdir.name)
12
+ stack_config.CONFIG_PATH = stack_config.DATA_DIR / "stack_config.json"
13
+
14
+ def tearDown(self) -> None:
15
+ self._tmpdir.cleanup()
16
+
17
+ def test_stripe_connect_patch_and_public_payload(self) -> None:
18
+ stack_config.patch_stack_config(
19
+ {
20
+ "stripe_connect": {
21
+ "client_id": "ca_test123",
22
+ "client_secret": "sk_test_secret",
23
+ },
24
+ },
25
+ )
26
+ resolved = stack_config.resolved_stripe_connect()
27
+ self.assertEqual(resolved["client_id"], "ca_test123")
28
+ self.assertEqual(resolved["client_secret"], "sk_test_secret")
29
+ public = stack_config.get_stack_config()["stripe_connect"]
30
+ self.assertEqual(public["client_id"], "ca_test123")
31
+ self.assertTrue(public["has_secret"])
32
+ self.assertTrue(public["enabled"])
33
+ self.assertNotIn("client_secret", public)
34
+
35
+
36
+ if __name__ == "__main__":
37
+ unittest.main()
@@ -0,0 +1,52 @@
1
+ import importlib.util
2
+ import unittest
3
+ from pathlib import Path
4
+ from unittest.mock import patch
5
+
6
+ ROOT = Path(__file__).resolve().parents[2]
7
+ SUPERVISOR = ROOT / "workframe-supervisor" / "server.py"
8
+ API = ROOT / "workframe-api" / "server.py"
9
+
10
+
11
+ def _load(path: Path, name: str):
12
+ spec = importlib.util.spec_from_file_location(name, path)
13
+ mod = importlib.util.module_from_spec(spec)
14
+ assert spec and spec.loader
15
+ spec.loader.exec_module(mod)
16
+ return mod
17
+
18
+
19
+ class SupervisorAuthTest(unittest.TestCase):
20
+ def test_secrets_compare(self) -> None:
21
+ sup = _load(SUPERVISOR, "workframe_supervisor")
22
+ self.assertTrue(sup.secrets_compare("abc", "abc"))
23
+ self.assertFalse(sup.secrets_compare("abc", "abd"))
24
+
25
+
26
+ class SecureModeLifecycleTest(unittest.TestCase):
27
+ def test_secure_mode_delegates_start_to_supervisor(self) -> None:
28
+ api = _load(API, "workframe_api")
29
+ with patch.object(api, "SECURE_MODE", True), patch.object(
30
+ api, "_primary_profile", return_value="workframe-agent"
31
+ ), patch.object(api, "resolve_validated_profile", return_value="architect"), patch.object(
32
+ api, "_supervisor_profile_lifecycle", return_value={"ok": True, "profile": "architect"}
33
+ ) as delegate:
34
+ out = api.profile_gateway_lifecycle("architect", "start")
35
+ delegate.assert_called_once_with("architect", "start")
36
+ self.assertTrue(out["ok"])
37
+
38
+ def test_secure_mode_gateway_exec_uses_supervisor(self) -> None:
39
+ api = _load(API, "workframe_api")
40
+ with patch.object(api, "SECURE_MODE", True), patch.object(
41
+ api, "resolve_validated_profile", return_value="architect"
42
+ ), patch.object(
43
+ api, "_supervisor_gateway_exec", return_value=(0, "ok")
44
+ ) as delegate:
45
+ code, out = api._gateway_exec("architect", ["gateway", "start"])
46
+ delegate.assert_called_once_with("architect", ["gateway", "start"])
47
+ self.assertEqual(code, 0)
48
+ self.assertEqual(out, "ok")
49
+
50
+
51
+ if __name__ == "__main__":
52
+ unittest.main()
@@ -0,0 +1,125 @@
1
+ """Per-run credential vault + lease tests."""
2
+
3
+ import tempfile
4
+ import unittest
5
+ from pathlib import Path
6
+ from unittest.mock import patch
7
+
8
+ import credential_vault
9
+ import server
10
+ import turn_credentials
11
+ import vault_kek
12
+ from db_setup import ensure_workframe_schemas
13
+
14
+
15
+ class TurnCredentialVaultTests(unittest.TestCase):
16
+ def setUp(self) -> None:
17
+ self._tmp = tempfile.TemporaryDirectory()
18
+ self.addCleanup(self._tmp.cleanup)
19
+ self._old_data = server.DATA_DIR
20
+ self._old_auth = server.AUTH_DB_PATH
21
+ self._old_hermes = server.HERMES_DATA
22
+ server.DATA_DIR = Path(self._tmp.name) / "api-data"
23
+ server.DATA_DIR.mkdir(parents=True)
24
+ server.AUTH_DB_PATH = server.DATA_DIR / "auth.db"
25
+ server.HERMES_DATA = Path(self._tmp.name) / "hermes"
26
+ (server.HERMES_DATA / "profiles").mkdir(parents=True)
27
+ (server._profile_dir("workframe-agent")).mkdir(parents=True, exist_ok=True)
28
+ credential_vault.DATA_DIR = server.DATA_DIR
29
+ credential_vault.VAULT_DB = server.DATA_DIR / "credential_vault.db"
30
+ vault_kek.DATA_DIR = server.DATA_DIR
31
+ vault_kek.VAULT_KEK_FILE = server.DATA_DIR / ".vault_kek"
32
+ turn_credentials.DATA_DIR = server.DATA_DIR
33
+ turn_credentials.WORKFRAME_DB = server.DATA_DIR / "workframe.db"
34
+ ensure_workframe_schemas()
35
+ credential_vault.ensure_schema()
36
+ credential_vault.unseal_for_tests()
37
+ turn_credentials.ensure_schema()
38
+
39
+ def tearDown(self) -> None:
40
+ server.DATA_DIR = self._old_data
41
+ server.AUTH_DB_PATH = self._old_auth
42
+ server.HERMES_DATA = self._old_hermes
43
+
44
+ def test_store_user_credential_uses_vault_not_agents_env(self) -> None:
45
+ user_id = "user-vault-1"
46
+ payload = server._store_user_credential(
47
+ user_id, "openrouter", "api_key", "sk-secret", "OPENROUTER_API_KEY", "test",
48
+ )
49
+ self.assertTrue(str(payload["credential_ref"]).startswith("vault:"))
50
+ env_path = server._user_hermes_env_path(user_id)
51
+ if env_path.is_file():
52
+ self.assertNotIn("sk-secret", env_path.read_text(encoding="utf-8"))
53
+ bid = credential_vault.parse_vault_ref(payload["credential_ref"])
54
+ self.assertEqual(credential_vault.read_secret(bid), "sk-secret")
55
+
56
+ @patch.object(server, "_wait_profile_api_healthy", return_value=True)
57
+ def test_overlay_writes_lease_token_not_raw_secret(self, _wait_mock) -> None:
58
+ user_id = "user-vault-overlay-1"
59
+ workspace_id = "ws-vault-test"
60
+ self.workspace_id = workspace_id
61
+ self.user_a = user_id
62
+ conn = server._workframe_db()
63
+ try:
64
+ now = "1"
65
+ conn.execute(
66
+ "INSERT INTO workspaces (id, slug, display_name, owner_id, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
67
+ (workspace_id, "ws-vault-test", "Iso", user_id, "active", now, now),
68
+ )
69
+ conn.execute(
70
+ "INSERT INTO users (id, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?)",
71
+ (user_id, "Fab", "member", "active", now, now),
72
+ )
73
+ conn.execute(
74
+ """
75
+ INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at)
76
+ VALUES (?, ?, ?, 'member', 'active', ?, ?)
77
+ """,
78
+ ("wm-1", workspace_id, user_id, now, now),
79
+ )
80
+ conn.execute(
81
+ """
82
+ INSERT INTO agent_profiles (id, workspace_id, slug, display_name, is_native, status, created_at, updated_at)
83
+ VALUES (?, ?, ?, ?, ?, 'available', ?, ?)
84
+ """,
85
+ ("ap-arch", workspace_id, "architect", "Architect", 0, now, now),
86
+ )
87
+ cred_id = "cred-or-1"
88
+ conn.execute(
89
+ """
90
+ INSERT INTO credential_bindings (
91
+ id, workspace_id, user_id, agent_profile_id, provider,
92
+ credential_type, credential_ref, label, is_active,
93
+ expires_at, created_by, created_at, updated_at, deleted_at
94
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
95
+ """,
96
+ (
97
+ cred_id, None, user_id, None, "openrouter",
98
+ "api_key", credential_vault.vault_ref(cred_id), "OR", 1, None, user_id,
99
+ now, now, None,
100
+ ),
101
+ )
102
+ conn.commit()
103
+ finally:
104
+ conn.close()
105
+ credential_vault.store_secret(cred_id, "sk-fab-only", env_var="OPENROUTER_API_KEY", provider="openrouter", user_id=user_id)
106
+ runtime = server._runtime_profile_slug(user_id, "architect")
107
+ prof_dir = server._profile_dir(runtime)
108
+ prof_dir.mkdir(parents=True, exist_ok=True)
109
+ run_id = "run-test-1"
110
+ server._overlay_turn_provider_env(runtime, user_id, workspace_id, "openrouter", run_id)
111
+ text = (prof_dir / ".env").read_text(encoding="utf-8")
112
+ self.assertIn("wf_rt_", text)
113
+ self.assertNotIn("sk-fab-only", text)
114
+ lease_line = [ln for ln in text.splitlines() if "OPENROUTER_API_KEY" in ln][0]
115
+ token = lease_line.split("=", 1)[1].strip().strip("\"'")
116
+ meta = turn_credentials.validate_lease(token)
117
+ self.assertIsNotNone(meta)
118
+ assert meta is not None
119
+ self.assertEqual(meta["run_id"], run_id)
120
+ server._revoke_turn_credential_lease(run_id, runtime)
121
+ self.assertIsNone(turn_credentials.validate_lease(token))
122
+
123
+
124
+ if __name__ == "__main__":
125
+ unittest.main()
@@ -0,0 +1,176 @@
1
+ """Stack update checks — version compare + safe apply hooks."""
2
+ import json
3
+ import os
4
+ import tempfile
5
+ import unittest
6
+ from pathlib import Path
7
+ from unittest import mock
8
+
9
+ import updates
10
+
11
+
12
+ class UpdatesModuleTests(unittest.TestCase):
13
+ def test_version_lt(self) -> None:
14
+ self.assertTrue(updates._version_lt("0.1.0", "0.1.1"))
15
+ self.assertFalse(updates._version_lt("0.1.0", "0.1.0"))
16
+ self.assertFalse(updates._version_lt("0.2.0", "0.1.9"))
17
+
18
+ def test_parse_hermes_version_output(self) -> None:
19
+ self.assertEqual(
20
+ updates.parse_hermes_version_output("Hermes Agent v0.17.0 (2026.6.19) · upstream 50386786"),
21
+ "0.17.0",
22
+ )
23
+ self.assertEqual(updates.parse_hermes_version_output(""), "")
24
+
25
+ @mock.patch.object(updates, "_http_json")
26
+ def test_docker_hub_digest_prefers_tag_digest_over_first_image(self, http_json: mock.MagicMock) -> None:
27
+ http_json.return_value = {
28
+ "digest": "sha256:tag-level",
29
+ "images": [{"digest": "sha256:arm64-first", "architecture": "arm64", "os": "linux"}],
30
+ }
31
+ self.assertEqual(updates._docker_hub_digest("nousresearch/hermes-agent", "latest"), "sha256:tag-level")
32
+
33
+ @mock.patch.object(updates, "_http_json")
34
+ def test_docker_hub_digest_prefers_amd64_when_no_tag_digest(self, http_json: mock.MagicMock) -> None:
35
+ http_json.return_value = {
36
+ "images": [
37
+ {"digest": "sha256:arm64", "architecture": "arm64", "os": "linux"},
38
+ {"digest": "sha256:amd64", "architecture": "amd64", "os": "linux"},
39
+ ],
40
+ }
41
+ self.assertEqual(updates._docker_hub_digest("repo", "latest"), "sha256:amd64")
42
+
43
+ @mock.patch.object(updates, "_npm_latest_version", return_value="0.1.1")
44
+ @mock.patch.object(updates, "_container_image_digest", return_value=("digest-a", "nousresearch/hermes-agent:latest"))
45
+ @mock.patch.object(updates, "_docker_hub_digest", return_value="digest-b")
46
+ @mock.patch.object(updates.Path, "exists", return_value=True)
47
+ def test_updates_available_flags_workframe_and_hermes(
48
+ self,
49
+ _exists: mock.MagicMock,
50
+ _hub: mock.MagicMock,
51
+ _container: mock.MagicMock,
52
+ _npm: mock.MagicMock,
53
+ ) -> None:
54
+ with tempfile.TemporaryDirectory() as tmp:
55
+ root = Path(tmp)
56
+ (root / "workframe-manifest.json").write_text(
57
+ json.dumps({"package_version": "0.1.0"}),
58
+ encoding="utf-8",
59
+ )
60
+ (root / "docker-compose.yml").write_text("services: {}\n", encoding="utf-8")
61
+ with mock.patch.dict(
62
+ os.environ,
63
+ {
64
+ "WORKFRAME_PROJECT_ROOT": str(root),
65
+ "WORKFRAME_COMPOSE_DIR": str(root),
66
+ "WORKFRAME_API_VERSION": "0.1.0",
67
+ },
68
+ clear=False,
69
+ ):
70
+ status = updates.updates_available(desktop_version="0.0.9")
71
+ self.assertTrue(status["workframe"]["update_available"])
72
+ self.assertTrue(status["hermes"]["update_available"])
73
+ self.assertTrue(status["desktop"]["update_available"])
74
+ self.assertFalse(status["workframe"]["can_update"])
75
+ self.assertFalse(status["hermes"]["can_update"])
76
+ self.assertIn("WORKFRAME_HOST_COMPOSE_DIR", status["workframe"]["reason"] or "")
77
+
78
+ @mock.patch.object(updates, "_npm_latest_version", return_value="0.1.1")
79
+ @mock.patch.object(updates, "_container_image_digest", return_value=("digest-a", "nousresearch/hermes-agent:latest"))
80
+ @mock.patch.object(updates, "_docker_hub_digest", return_value="digest-b")
81
+ @mock.patch.object(updates, "_script_path")
82
+ @mock.patch.object(updates.Path, "exists", return_value=True)
83
+ def test_updates_available_can_update_when_host_compose_ready(
84
+ self,
85
+ _exists: mock.MagicMock,
86
+ script_path: mock.MagicMock,
87
+ _hub: mock.MagicMock,
88
+ _container: mock.MagicMock,
89
+ _npm: mock.MagicMock,
90
+ ) -> None:
91
+ script_path.side_effect = lambda name: Path(f"/tmp/{name}")
92
+ with tempfile.TemporaryDirectory() as tmp:
93
+ root = Path(tmp)
94
+ (root / "workframe-manifest.json").write_text(
95
+ json.dumps({"package_version": "0.1.0"}),
96
+ encoding="utf-8",
97
+ )
98
+ (root / "docker-compose.yml").write_text("services: {}\n", encoding="utf-8")
99
+ with mock.patch.dict(
100
+ os.environ,
101
+ {
102
+ "WORKFRAME_PROJECT_ROOT": str(root),
103
+ "WORKFRAME_COMPOSE_DIR": str(root),
104
+ "WORKFRAME_HOST_COMPOSE_DIR": str(root),
105
+ "WORKFRAME_API_VERSION": "0.1.0",
106
+ },
107
+ clear=False,
108
+ ):
109
+ status = updates.updates_available()
110
+ self.assertTrue(status["hermes"]["can_update"])
111
+ self.assertTrue(status["hermes"]["can_restart_gateway"])
112
+ self.assertEqual(status["hermes"]["state"], "available")
113
+
114
+ @mock.patch.object(updates, "_npm_latest_version", return_value="0.1.0")
115
+ @mock.patch.object(updates, "_container_image_digest", return_value=("digest-a", "img"))
116
+ @mock.patch.object(updates, "_docker_hub_digest", return_value="digest-a")
117
+ @mock.patch.object(updates.Path, "exists", return_value=True)
118
+ def test_updates_available_when_digest_unknown_no_hermes_flag(
119
+ self,
120
+ _exists: mock.MagicMock,
121
+ _hub: mock.MagicMock,
122
+ _container: mock.MagicMock,
123
+ _npm: mock.MagicMock,
124
+ ) -> None:
125
+ with tempfile.TemporaryDirectory() as tmp:
126
+ root = Path(tmp)
127
+ (root / "workframe-manifest.json").write_text(
128
+ json.dumps({"package_version": "0.1.0"}),
129
+ encoding="utf-8",
130
+ )
131
+ with mock.patch.dict(
132
+ os.environ,
133
+ {"WORKFRAME_PROJECT_ROOT": str(root), "WORKFRAME_COMPOSE_DIR": str(root)},
134
+ clear=False,
135
+ ):
136
+ status = updates.updates_available()
137
+ self.assertFalse(status["hermes"]["update_available"])
138
+ self.assertFalse(status["workframe"]["update_available"])
139
+
140
+ @mock.patch.object(updates.subprocess, "run")
141
+ @mock.patch.object(updates, "_script_path")
142
+ @mock.patch.object(updates.Path, "exists", return_value=True)
143
+ def test_apply_update_runs_scripts(
144
+ self,
145
+ _exists: mock.MagicMock,
146
+ script_path: mock.MagicMock,
147
+ run: mock.MagicMock,
148
+ ) -> None:
149
+ script_path.side_effect = lambda name: Path(f"/tmp/{name}")
150
+ run.return_value = mock.Mock(returncode=0, stdout="ok", stderr="")
151
+ with mock.patch.dict(os.environ, {"WORKFRAME_COMPOSE_DIR": "/tmp", "WORKFRAME_PROJECT_ROOT": "/tmp", "WORKFRAME_ENABLE_ADMIN_UPDATES": "1"}, clear=False):
152
+ result = updates.apply_update("hermes")
153
+ self.assertTrue(result["ok"])
154
+ run.assert_called_once()
155
+
156
+ @mock.patch.object(updates.subprocess, "run")
157
+ @mock.patch.object(updates, "_script_path")
158
+ @mock.patch.object(updates, "_docker_apply_ready", return_value=(True, None))
159
+ @mock.patch.object(updates.Path, "exists", return_value=True)
160
+ def test_restart_gateway_runs_script(
161
+ self,
162
+ _exists: mock.MagicMock,
163
+ _ready: mock.MagicMock,
164
+ script_path: mock.MagicMock,
165
+ run: mock.MagicMock,
166
+ ) -> None:
167
+ script_path.return_value = Path("/tmp/restart-gateway-hermes.sh")
168
+ run.return_value = mock.Mock(returncode=0, stdout="ok", stderr="")
169
+ with mock.patch.dict(os.environ, {"WORKFRAME_COMPOSE_DIR": "/tmp", "WORKFRAME_PROJECT_ROOT": "/tmp", "WORKFRAME_ENABLE_ADMIN_UPDATES": "1"}, clear=False):
170
+ result = updates.restart_gateway()
171
+ self.assertTrue(result["ok"])
172
+ run.assert_called_once()
173
+
174
+
175
+ if __name__ == "__main__":
176
+ unittest.main()