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.
- package/.dockerignore +22 -0
- package/.gitignore +73 -0
- package/LICENSE +201 -0
- package/NOTICE +12 -0
- package/README.md +111 -0
- package/SECURITY.md +40 -0
- package/bin/create-workframe.js +2814 -0
- package/bin/workframe.js +329 -0
- package/docs/workspace-instructions/WORKFRAME_DISCORD.md +20 -0
- package/docs/workspace-instructions/WORKFRAME_DOCUMENTS_AND_ARTIFACTS.md +20 -0
- package/docs/workspace-instructions/WORKFRAME_KANBAN.md +20 -0
- package/docs/workspace-instructions/WORKFRAME_ONBOARDING.md +21 -0
- package/docs/workspace-instructions/WORKFRAME_ROUTING.md +29 -0
- package/docs/workspace-instructions/WORKFRAME_TELEGRAM.md +19 -0
- package/package.json +67 -0
- package/profiles/README.md +15 -0
- package/profiles/architect/AGENTS.md +29 -0
- package/profiles/architect/SOUL.md +44 -0
- package/profiles/architect/skills/devops/kanban-worker/SKILL.md +27 -0
- package/profiles/designer/AGENTS.md +26 -0
- package/profiles/designer/SOUL.md +31 -0
- package/profiles/designer/skills/devops/kanban-worker/SKILL.md +27 -0
- package/profiles/dev/AGENTS.md +28 -0
- package/profiles/dev/SOUL.md +31 -0
- package/profiles/dev/skills/devops/kanban-worker/SKILL.md +27 -0
- package/profiles/docs/AGENTS.md +27 -0
- package/profiles/docs/SOUL.md +30 -0
- package/profiles/docs/skills/devops/kanban-worker/SKILL.md +27 -0
- package/profiles/research/AGENTS.md +26 -0
- package/profiles/research/SOUL.md +31 -0
- package/profiles/research/skills/devops/kanban-worker/SKILL.md +27 -0
- package/profiles/visionary/AGENTS.md +25 -0
- package/profiles/visionary/SOUL.md +31 -0
- package/profiles/visionary/skills/devops/kanban-worker/SKILL.md +27 -0
- package/profiles/workframe-agent/AGENTS.md +37 -0
- package/profiles/workframe-agent/SETUP.md +185 -0
- package/profiles/workframe-agent/SOUL.md +61 -0
- package/profiles/workframe-agent/skills/devops/botfather/SKILL.md +85 -0
- package/profiles/workframe-agent/skills/devops/kanban-handoff-pattern/SKILL.md +58 -0
- package/profiles/workframe-agent/skills/devops/workframe-cohort/SKILL.md +54 -0
- package/prompts/WORKFRAME_PROMPT_TEMPLATES.md +16 -0
- package/rules/.hermes.md +11 -0
- package/rules/AGENTS.md +22 -0
- package/rules/workspace-README.md +5 -0
- package/scripts/apply-update-hermes.sh +17 -0
- package/scripts/apply-update-workframe.sh +77 -0
- package/scripts/bootstrap-workspace-link.sh +8 -0
- package/scripts/bundle-workframe-ui.mjs +77 -0
- package/scripts/compose-docker-host.sh +37 -0
- package/scripts/create_workframe_scaffold.py +648 -0
- package/scripts/ensure-compose-host-paths.mjs +51 -0
- package/scripts/fix-zk-encryption-key.sh +35 -0
- package/scripts/lib/install-identity.mjs +212 -0
- package/scripts/lib/workframe-registry.mjs +290 -0
- package/scripts/new-project.mjs +68 -0
- package/scripts/restart-gateway-hermes.sh +12 -0
- package/scripts/security_audit.py +156 -0
- package/scripts/select_agent_pack.py +31 -0
- package/scripts/set-compose-public-url.mjs +92 -0
- package/scripts/setup-stack-secrets.sh +50 -0
- package/scripts/sync-canonical-to-package.mjs +146 -0
- package/scripts/test-scaffold.mjs +390 -0
- package/scripts/verify-public-deploy.sh +105 -0
- package/shared/WORKFRAME_AGENT_LIBRARY.md +31 -0
- package/shared/WORKFRAME_AGENT_OPERATIONS.md +29 -0
- package/shared/WORKFRAME_AGENT_PACKS.json +64 -0
- package/shared/WORKFRAME_AGENT_PACKS.yaml +20 -0
- package/shared/WORKFRAME_CHAT_PERMISSION_MODEL.md +20 -0
- package/shared/WORKFRAME_HANDOFF_SCHEMA.md +25 -0
- package/shared/WORKFRAME_SKILL_CURATION.md +27 -0
- package/shared/agent-avatars/ada.png +0 -0
- package/shared/agent-avatars/aibert.png +0 -0
- package/shared/agent-avatars/amelia.png +0 -0
- package/shared/agent-avatars/andy.png +0 -0
- package/shared/agent-avatars/arc.png +0 -0
- package/shared/agent-avatars/bob.png +0 -0
- package/shared/agent-avatars/buzz.png +0 -0
- package/shared/agent-avatars/carl.png +0 -0
- package/shared/agent-avatars/catalog.json +171 -0
- package/shared/agent-avatars/corbu.png +0 -0
- package/shared/agent-avatars/diana.png +0 -0
- package/shared/agent-avatars/ella.png +0 -0
- package/shared/agent-avatars/elvis.png +0 -0
- package/shared/agent-avatars/f1.png +0 -0
- package/shared/agent-avatars/f2.png +0 -0
- package/shared/agent-avatars/f3.png +0 -0
- package/shared/agent-avatars/f4.png +0 -0
- package/shared/agent-avatars/f5.png +0 -0
- package/shared/agent-avatars/f6.png +0 -0
- package/shared/agent-avatars/frida.png +0 -0
- package/shared/agent-avatars/george.png +0 -0
- package/shared/agent-avatars/grace.png +0 -0
- package/shared/agent-avatars/hedy.png +0 -0
- package/shared/agent-avatars/hermes.png +0 -0
- package/shared/agent-avatars/isaac.png +0 -0
- package/shared/agent-avatars/jes.png +0 -0
- package/shared/agent-avatars/john.png +0 -0
- package/shared/agent-avatars/joni.png +0 -0
- package/shared/agent-avatars/leo.png +0 -0
- package/shared/agent-avatars/louis.png +0 -0
- package/shared/agent-avatars/ludwig.png +0 -0
- package/shared/agent-avatars/m1.png +0 -0
- package/shared/agent-avatars/m2.png +0 -0
- package/shared/agent-avatars/m3.png +0 -0
- package/shared/agent-avatars/m4.png +0 -0
- package/shared/agent-avatars/m5.png +0 -0
- package/shared/agent-avatars/m6.png +0 -0
- package/shared/agent-avatars/marie.png +0 -0
- package/shared/agent-avatars/marilyn.png +0 -0
- package/shared/agent-avatars/neil.png +0 -0
- package/shared/agent-avatars/nikola.png +0 -0
- package/shared/agent-avatars/nina.png +0 -0
- package/shared/agent-avatars/paul.png +0 -0
- package/shared/agent-avatars/ringo.png +0 -0
- package/shared/agent-avatars/rosie.png +0 -0
- package/shared/agent-avatars/ste.png +0 -0
- package/shared/agent-avatars/steve.png +0 -0
- package/shared/agent-avatars/sun.png +0 -0
- package/shared/agent-avatars/tom.png +0 -0
- package/shared/agent-avatars/warren.png +0 -0
- package/shared/agent-avatars/woz.png +0 -0
- package/shared/agent-avatars/zaha.png +0 -0
- package/workframe-api/Dockerfile +14 -0
- package/workframe-api/README.md +28 -0
- package/workframe-api/action_proxy.py +131 -0
- package/workframe-api/auth_rate_limit.py +49 -0
- package/workframe-api/catalog/avatar-catalog.json +171 -0
- package/workframe-api/catalog/logo-catalog.json +86 -0
- package/workframe-api/catalog/user-avatar-catalog.json +171 -0
- package/workframe-api/credential_vault.py +445 -0
- package/workframe-api/data/.gitkeep +0 -0
- package/workframe-api/data/avatar-catalog.json +41 -0
- package/workframe-api/data/logo-catalog.json +14 -0
- package/workframe-api/data/user-avatar-catalog.json +18 -0
- package/workframe-api/email_sender.py +220 -0
- package/workframe-api/google_auth.py +90 -0
- package/workframe-api/install_api.py +359 -0
- package/workframe-api/internal_proxy_auth.py +150 -0
- package/workframe-api/llm_proxy.py +277 -0
- package/workframe-api/oidc_jwt.py +108 -0
- package/workframe-api/package.json +13 -0
- package/workframe-api/platform_auth.py +194 -0
- package/workframe-api/profile_secret_policy.py +86 -0
- package/workframe-api/public/assets/index-DPXu_lGn.css +1 -0
- package/workframe-api/public/assets/index-DYnLrCZZ.js +9 -0
- package/workframe-api/public/assets/index-DglUqFB_.js +9 -0
- package/workframe-api/public/index.html +12 -0
- package/workframe-api/requirements.txt +2 -0
- package/workframe-api/server.py +19646 -0
- package/workframe-api/site_meta.py +271 -0
- package/workframe-api/stack_config.py +427 -0
- package/workframe-api/tests/__init__.py +0 -0
- package/workframe-api/tests/db_setup.py +13 -0
- package/workframe-api/tests/test_admin_updates_gated.py +30 -0
- package/workframe-api/tests/test_agent_dm_bootstrap.py +196 -0
- package/workframe-api/tests/test_agent_profile_sync.py +76 -0
- package/workframe-api/tests/test_auth_email.py +222 -0
- package/workframe-api/tests/test_auth_hole_fix_selfcheck.py +99 -0
- package/workframe-api/tests/test_auth_rate_limit.py +19 -0
- package/workframe-api/tests/test_avatar_resolve.py +77 -0
- package/workframe-api/tests/test_child_soul_template.py +71 -0
- package/workframe-api/tests/test_credential_canary.py +135 -0
- package/workframe-api/tests/test_credential_isolation.py +448 -0
- package/workframe-api/tests/test_credential_resolution.py +206 -0
- package/workframe-api/tests/test_device_oauth.py +108 -0
- package/workframe-api/tests/test_doctor_repair.py +103 -0
- package/workframe-api/tests/test_ensure_profile_api.py +77 -0
- package/workframe-api/tests/test_gateway_compose_security.py +136 -0
- package/workframe-api/tests/test_install_secure_host.py +39 -0
- package/workframe-api/tests/test_internal_proxy_auth.py +125 -0
- package/workframe-api/tests/test_invite_runtime_bootstrap.py +72 -0
- package/workframe-api/tests/test_kanban_delegation.py +185 -0
- package/workframe-api/tests/test_llm_proxy.py +155 -0
- package/workframe-api/tests/test_login_access_policy.py +183 -0
- package/workframe-api/tests/test_mvp_model_bootstrap.py +75 -0
- package/workframe-api/tests/test_onboarding_bootstrap.py +248 -0
- package/workframe-api/tests/test_platform_auth.py +47 -0
- package/workframe-api/tests/test_profile_config_path.py +56 -0
- package/workframe-api/tests/test_profile_config_yaml_repair.py +63 -0
- package/workframe-api/tests/test_profile_create.py +72 -0
- package/workframe-api/tests/test_profile_identity_overlay.py +61 -0
- package/workframe-api/tests/test_profile_install_health.py +45 -0
- package/workframe-api/tests/test_profile_secret_policy.py +57 -0
- package/workframe-api/tests/test_profile_workspace_cwd.py +34 -0
- package/workframe-api/tests/test_provider_bootstrap.py +75 -0
- package/workframe-api/tests/test_provider_connect.py +54 -0
- package/workframe-api/tests/test_room_crud.py +192 -0
- package/workframe-api/tests/test_room_tenancy.py +701 -0
- package/workframe-api/tests/test_runtime_identity_backfill.py +34 -0
- package/workframe-api/tests/test_site_meta.py +81 -0
- package/workframe-api/tests/test_soul_stub.py +42 -0
- package/workframe-api/tests/test_space_member_sync.py +99 -0
- package/workframe-api/tests/test_stripe_stack_config.py +37 -0
- package/workframe-api/tests/test_supervisor_lifecycle.py +52 -0
- package/workframe-api/tests/test_turn_credential_vault.py +125 -0
- package/workframe-api/tests/test_updates.py +176 -0
- package/workframe-api/tests/test_user_cohort.py +113 -0
- package/workframe-api/tests/test_vault_envelope.py +110 -0
- package/workframe-api/tests/test_workspace_members.py +183 -0
- package/workframe-api/tests/test_workspace_messaging_sync.py +125 -0
- package/workframe-api/tests/test_workspace_provider_list.py +57 -0
- package/workframe-api/time-bind-chat.py +99 -0
- package/workframe-api/turn_credentials.py +226 -0
- package/workframe-api/updates.py +417 -0
- package/workframe-api/vault_kek.py +159 -0
- package/workframe-api/zk_auth.py +633 -0
- package/workframe-supervisor/Dockerfile +11 -0
- package/workframe-supervisor/profile_secret_policy.py +76 -0
- package/workframe-supervisor/server.py +787 -0
- package/workframe-supervisor/tests/test_exec_guard.py +42 -0
- package/workframe-supervisor/tests/test_server_import.py +21 -0
- package/workframe-ui/docker/nginx.conf +85 -0
- package/workframe-ui/public/assets/1-DLJbBkOb.png +0 -0
- package/workframe-ui/public/assets/10-uwRwj5ce.png +0 -0
- package/workframe-ui/public/assets/11-5OuV9F_e.png +0 -0
- package/workframe-ui/public/assets/12-u_axjxW-.png +0 -0
- package/workframe-ui/public/assets/13-ldSvcMsH.png +0 -0
- package/workframe-ui/public/assets/14-xdcALEYD.png +0 -0
- package/workframe-ui/public/assets/15-aZ4snEFB.png +0 -0
- package/workframe-ui/public/assets/16-L_5-DttY.png +0 -0
- package/workframe-ui/public/assets/2-zOPZTppD.png +0 -0
- package/workframe-ui/public/assets/3-Dc3WoVu5.png +0 -0
- package/workframe-ui/public/assets/4-C50hk7_m.png +0 -0
- package/workframe-ui/public/assets/5-Eweetkq4.png +0 -0
- package/workframe-ui/public/assets/6-5sOXgfkw.png +0 -0
- package/workframe-ui/public/assets/7-BqRBCbiC.png +0 -0
- package/workframe-ui/public/assets/8-DEDKS94h.png +0 -0
- package/workframe-ui/public/assets/9-DNj34GW-.png +0 -0
- package/workframe-ui/public/assets/ada-DsvuOc9n.png +0 -0
- package/workframe-ui/public/assets/aibert-BCz8Lo8H.png +0 -0
- package/workframe-ui/public/assets/amelia-DUf3EBGu.png +0 -0
- package/workframe-ui/public/assets/andy-Cpymuhhx.png +0 -0
- package/workframe-ui/public/assets/arc-CBDYvkAF.js +1 -0
- package/workframe-ui/public/assets/architecture-7EHR7CIX-CtbQKTuT.js +1 -0
- package/workframe-ui/public/assets/architectureDiagram-3BPJPVTR-XnBRKeW0.js +36 -0
- package/workframe-ui/public/assets/array-BifhSqXX.js +1 -0
- package/workframe-ui/public/assets/avatars/ada.png +0 -0
- package/workframe-ui/public/assets/avatars/aibert.png +0 -0
- package/workframe-ui/public/assets/avatars/amelia.png +0 -0
- package/workframe-ui/public/assets/avatars/andy.png +0 -0
- package/workframe-ui/public/assets/avatars/bob.png +0 -0
- package/workframe-ui/public/assets/avatars/buzz.png +0 -0
- package/workframe-ui/public/assets/avatars/carl.png +0 -0
- package/workframe-ui/public/assets/avatars/catalog.json +171 -0
- package/workframe-ui/public/assets/avatars/corbu.png +0 -0
- package/workframe-ui/public/assets/avatars/diana.png +0 -0
- package/workframe-ui/public/assets/avatars/elvis.png +0 -0
- package/workframe-ui/public/assets/avatars/frida.png +0 -0
- package/workframe-ui/public/assets/avatars/george.png +0 -0
- package/workframe-ui/public/assets/avatars/grace.png +0 -0
- package/workframe-ui/public/assets/avatars/hedy.png +0 -0
- package/workframe-ui/public/assets/avatars/hermes.png +0 -0
- package/workframe-ui/public/assets/avatars/isaac.png +0 -0
- package/workframe-ui/public/assets/avatars/john.png +0 -0
- package/workframe-ui/public/assets/avatars/joni.png +0 -0
- package/workframe-ui/public/assets/avatars/leo.png +0 -0
- package/workframe-ui/public/assets/avatars/louis.png +0 -0
- package/workframe-ui/public/assets/avatars/ludwig.png +0 -0
- package/workframe-ui/public/assets/avatars/marie.png +0 -0
- package/workframe-ui/public/assets/avatars/marilyn.png +0 -0
- package/workframe-ui/public/assets/avatars/nikola.png +0 -0
- package/workframe-ui/public/assets/avatars/nina.png +0 -0
- package/workframe-ui/public/assets/avatars/paul.png +0 -0
- package/workframe-ui/public/assets/avatars/ringo.png +0 -0
- package/workframe-ui/public/assets/avatars/rosie.png +0 -0
- package/workframe-ui/public/assets/avatars/steve.png +0 -0
- package/workframe-ui/public/assets/avatars/sun.png +0 -0
- package/workframe-ui/public/assets/avatars/warren.png +0 -0
- package/workframe-ui/public/assets/avatars/woz.png +0 -0
- package/workframe-ui/public/assets/avatars/zaha.png +0 -0
- package/workframe-ui/public/assets/blockDiagram-GPEHLZMM-VYHUfVhd.js +132 -0
- package/workframe-ui/public/assets/bob-DRz-48Id.png +0 -0
- package/workframe-ui/public/assets/branding/banner.png +0 -0
- package/workframe-ui/public/assets/branding/og-default.png +0 -0
- package/workframe-ui/public/assets/branding/workframe'white.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-1.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-2.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-3.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-4.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-5.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-banner.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-logo-horizontal-mini.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-logo-horizontal-nano.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-logo-horizontal.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-logo-vertical-alt.png +0 -0
- package/workframe-ui/public/assets/branding/workframe-logo-vertical.png +0 -0
- package/workframe-ui/public/assets/branding/workframe.png +0 -0
- package/workframe-ui/public/assets/buzz-mC4PtMvC.png +0 -0
- package/workframe-ui/public/assets/c4Diagram-AAUBKEIU-BTjUcJpm.js +10 -0
- package/workframe-ui/public/assets/carl-CtE74db_.png +0 -0
- package/workframe-ui/public/assets/channel-Dy4Z4-jn.js +1 -0
- package/workframe-ui/public/assets/chunk-2J33WTMH-w7uu7R-b.js +1 -0
- package/workframe-ui/public/assets/chunk-3OPIFGDE-Cb9LtnDX.js +62 -0
- package/workframe-ui/public/assets/chunk-4BX2VUAB-DiQ-qCwH.js +1 -0
- package/workframe-ui/public/assets/chunk-55IACEB6-C-mLFr7z.js +1 -0
- package/workframe-ui/public/assets/chunk-5ZQYHXKU-DOesfiCI.js +2 -0
- package/workframe-ui/public/assets/chunk-727SXJPM-BJ3oBZuz.js +206 -0
- package/workframe-ui/public/assets/chunk-AQP2D5EJ-CCA6xpGs.js +231 -0
- package/workframe-ui/public/assets/chunk-BSJP7CBP-a0cMNFb2.js +1 -0
- package/workframe-ui/public/assets/chunk-CSCIHK7Q-kuqN8EIY.js +122 -0
- package/workframe-ui/public/assets/chunk-FMBD7UC4-DyPgYHCg.js +15 -0
- package/workframe-ui/public/assets/chunk-KSCS5N6A-CdUuvR0V.js +10 -0
- package/workframe-ui/public/assets/chunk-L5ZTLDWV-Dq9NoWmK.js +1 -0
- package/workframe-ui/public/assets/chunk-LZXEDZCA-p74rddlO.js +2 -0
- package/workframe-ui/public/assets/chunk-ND2GUHAM-DBD2u1Gz.js +1 -0
- package/workframe-ui/public/assets/chunk-NNHCCRGN-DlpIbxXb.js +159 -0
- package/workframe-ui/public/assets/chunk-NZK2D7GU-BeIeYFnd.js +1 -0
- package/workframe-ui/public/assets/chunk-O5CBEL6O-ClHc56ib.js +70 -0
- package/workframe-ui/public/assets/chunk-QZHKN3VN-CtBEchFK.js +1 -0
- package/workframe-ui/public/assets/chunk-WU5MYG2G-B9pBtriN.js +1 -0
- package/workframe-ui/public/assets/chunk-XPW4576I-EFr8R_1p.js +32 -0
- package/workframe-ui/public/assets/classDiagram-4FO5ZUOK-BMAEA8jI.js +1 -0
- package/workframe-ui/public/assets/classDiagram-v2-Q7XG4LA2-BMAEA8jI.js +1 -0
- package/workframe-ui/public/assets/corbu-KiaMXzXQ.png +0 -0
- package/workframe-ui/public/assets/cose-bilkent-S5V4N54A-C7aPBODd.js +1 -0
- package/workframe-ui/public/assets/cytoscape.esm-h6BdjjI9.js +321 -0
- package/workframe-ui/public/assets/dagre-BM42HDAG-BdU1Rv-H.js +4 -0
- package/workframe-ui/public/assets/dagre-Bx709z4p.js +1 -0
- package/workframe-ui/public/assets/defaultLocale-C8Fc0cco.js +1 -0
- package/workframe-ui/public/assets/diagram-2AECGRRQ-DWowSo85.js +43 -0
- package/workframe-ui/public/assets/diagram-5GNKFQAL-MnxBbceO.js +10 -0
- package/workframe-ui/public/assets/diagram-KO2AKTUF-DQaLRXFf.js +3 -0
- package/workframe-ui/public/assets/diagram-LMA3HP47-CQaBud9k.js +24 -0
- package/workframe-ui/public/assets/diagram-OG6HWLK6-D8bAXbY9.js +24 -0
- package/workframe-ui/public/assets/diana-DW0MsL38.png +0 -0
- package/workframe-ui/public/assets/dist-DGpTLHr_.js +1 -0
- package/workframe-ui/public/assets/elvis-LCFaZIcT.png +0 -0
- package/workframe-ui/public/assets/erDiagram-TEJ5UH35-1E-xSvBK.js +85 -0
- package/workframe-ui/public/assets/eventmodeling-FCH6USID-D75cstNT.js +1 -0
- package/workframe-ui/public/assets/flowDiagram-I6XJVG4X-CgOVD5hu.js +162 -0
- package/workframe-ui/public/assets/frida-CXFA0w3F.png +0 -0
- package/workframe-ui/public/assets/ganttDiagram-6RSMTGT7-JFYAIauo.js +292 -0
- package/workframe-ui/public/assets/george-DBSH2Sm2.png +0 -0
- package/workframe-ui/public/assets/gitGraph-WXDBUCRP-B9REenIl.js +1 -0
- package/workframe-ui/public/assets/gitGraphDiagram-PVQCEYII-BQ7NcMSn.js +106 -0
- package/workframe-ui/public/assets/grace-BhV0UPc0.png +0 -0
- package/workframe-ui/public/assets/graphlib-B8gBHxth.js +1 -0
- package/workframe-ui/public/assets/hedy-BR2IHift.png +0 -0
- package/workframe-ui/public/assets/hermes-CqCzcE0y.png +0 -0
- package/workframe-ui/public/assets/index-Dnw6vjqb.js +133 -0
- package/workframe-ui/public/assets/index-DpAGxump.css +1 -0
- package/workframe-ui/public/assets/info-J43DQDTF-CL6-eTjH.js +1 -0
- package/workframe-ui/public/assets/infoDiagram-5YYISTIA-LJTODW4W.js +2 -0
- package/workframe-ui/public/assets/init-D6jRqBbL.js +1 -0
- package/workframe-ui/public/assets/isaac-D1nhJAuv.png +0 -0
- package/workframe-ui/public/assets/ishikawaDiagram-YF4QCWOH-bchrQVuo.js +70 -0
- package/workframe-ui/public/assets/john-zSPWwNi4.png +0 -0
- package/workframe-ui/public/assets/joni-BFLoyfJP.png +0 -0
- package/workframe-ui/public/assets/journeyDiagram-JHISSGLW-DkrvYuxP.js +139 -0
- package/workframe-ui/public/assets/kanban-definition-UN3LZRKU-DFRbj0IG.js +89 -0
- package/workframe-ui/public/assets/katex-Vhh-h91d.js +257 -0
- package/workframe-ui/public/assets/leo-C_3IOL11.png +0 -0
- package/workframe-ui/public/assets/line-Vd48P7-O.js +1 -0
- package/workframe-ui/public/assets/linear-Ckizh2G7.js +1 -0
- package/workframe-ui/public/assets/louis-DEEECFSX.png +0 -0
- package/workframe-ui/public/assets/ludwig-_hoKhhyK.png +0 -0
- package/workframe-ui/public/assets/marie-DET6MsfO.png +0 -0
- package/workframe-ui/public/assets/marilyn-DTqwt8Yh.png +0 -0
- package/workframe-ui/public/assets/mermaid-parser.core-Bkimsnqj.js +4 -0
- package/workframe-ui/public/assets/mermaid.core-x0TvVuPo.js +9 -0
- package/workframe-ui/public/assets/mindmap-definition-RKZ34NQL-6ykAFPEz.js +96 -0
- package/workframe-ui/public/assets/nikola-B4PtHrJv.png +0 -0
- package/workframe-ui/public/assets/nina-BYbrOn0d.png +0 -0
- package/workframe-ui/public/assets/ordinal-hYBb2elL.js +1 -0
- package/workframe-ui/public/assets/packet-YPE3B663-Dw3xgMDt.js +1 -0
- package/workframe-ui/public/assets/path-BWPyau1x.js +1 -0
- package/workframe-ui/public/assets/paul-CGURYQIn.png +0 -0
- package/workframe-ui/public/assets/pie-LRSECV5Y-DATysawG.js +1 -0
- package/workframe-ui/public/assets/pieDiagram-4H26LBE5-SJKD1S0S.js +30 -0
- package/workframe-ui/public/assets/project-logos/1.png +0 -0
- package/workframe-ui/public/assets/project-logos/10.png +0 -0
- package/workframe-ui/public/assets/project-logos/11.png +0 -0
- package/workframe-ui/public/assets/project-logos/12.png +0 -0
- package/workframe-ui/public/assets/project-logos/13.png +0 -0
- package/workframe-ui/public/assets/project-logos/14.png +0 -0
- package/workframe-ui/public/assets/project-logos/15.png +0 -0
- package/workframe-ui/public/assets/project-logos/16.png +0 -0
- package/workframe-ui/public/assets/project-logos/2.png +0 -0
- package/workframe-ui/public/assets/project-logos/3.png +0 -0
- package/workframe-ui/public/assets/project-logos/4.png +0 -0
- package/workframe-ui/public/assets/project-logos/5.png +0 -0
- package/workframe-ui/public/assets/project-logos/6.png +0 -0
- package/workframe-ui/public/assets/project-logos/7.png +0 -0
- package/workframe-ui/public/assets/project-logos/8.png +0 -0
- package/workframe-ui/public/assets/project-logos/9.png +0 -0
- package/workframe-ui/public/assets/project-logos/catalog.json +86 -0
- package/workframe-ui/public/assets/quadrantDiagram-W4KKPZXB-BrYDZX8q.js +7 -0
- package/workframe-ui/public/assets/radar-GUYGQ44K-BmWYPCds.js +1 -0
- package/workframe-ui/public/assets/requirementDiagram-4Y6WPE33-DwL9Mc8e.js +84 -0
- package/workframe-ui/public/assets/ringo-WhfUNOyY.png +0 -0
- package/workframe-ui/public/assets/rosie-CAtcIf87.png +0 -0
- package/workframe-ui/public/assets/rough.esm-CSKSodPl.js +1 -0
- package/workframe-ui/public/assets/sankeyDiagram-5OEKKPKP-DYIFsL8h.js +40 -0
- package/workframe-ui/public/assets/sequenceDiagram-3UESZ5HK-0-FPkFk8.js +162 -0
- package/workframe-ui/public/assets/src-B_od6b6h.js +1 -0
- package/workframe-ui/public/assets/stateDiagram-AJRCARHV-BQCiBk6u.js +1 -0
- package/workframe-ui/public/assets/stateDiagram-v2-BHNVJYJU-B89jAMFF.js +1 -0
- package/workframe-ui/public/assets/steve-CgXXJ9EZ.png +0 -0
- package/workframe-ui/public/assets/sun-BLNAhoZd.png +0 -0
- package/workframe-ui/public/assets/timeline-definition-PNZ67QCA-DS3tFcXj.js +120 -0
- package/workframe-ui/public/assets/treeView-BLDUP644-DSyUCKLY.js +1 -0
- package/workframe-ui/public/assets/treemap-LRROVOQU-CEZaNh5Y.js +1 -0
- package/workframe-ui/public/assets/vennDiagram-CIIHVFJN-CD-Vc9NF.js +34 -0
- package/workframe-ui/public/assets/wardley-L42UT6IY-Drq5w1Mc.js +1 -0
- package/workframe-ui/public/assets/wardleyDiagram-YWT4CUSO-DouXDJoF.js +78 -0
- package/workframe-ui/public/assets/warren-DIH7UKMY.png +0 -0
- package/workframe-ui/public/assets/woz-D2yleG-V.png +0 -0
- package/workframe-ui/public/assets/xychartDiagram-2RQKCTM6-DDf_Lol5.js +7 -0
- package/workframe-ui/public/assets/zaha-wersOEq9.png +0 -0
- package/workframe-ui/public/favicon.ico +0 -0
- package/workframe-ui/public/favicon.svg +7 -0
- package/workframe-ui/public/icons.svg +24 -0
- package/workframe-ui/public/index.html +50 -0
- package/workframe-ui/public/manifest.webmanifest +18 -0
- package/workframe-ui/public/workframe-config.json +4 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"""Invite-only login for multi-user modes post-install."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import hashlib
|
|
6
|
+
import tempfile
|
|
7
|
+
import time
|
|
8
|
+
import unittest
|
|
9
|
+
import uuid
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from unittest import mock
|
|
12
|
+
|
|
13
|
+
import server
|
|
14
|
+
import stack_config
|
|
15
|
+
from db_setup import ensure_workframe_schemas
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class LoginAccessPolicyTests(unittest.TestCase):
|
|
19
|
+
def setUp(self) -> None:
|
|
20
|
+
self._tmp = tempfile.TemporaryDirectory()
|
|
21
|
+
self.addCleanup(self._tmp.cleanup)
|
|
22
|
+
self._old_data_dir = server.DATA_DIR
|
|
23
|
+
self._old_auth_db_path = server.AUTH_DB_PATH
|
|
24
|
+
self._old_mode = server.DEPLOYMENT_MODE
|
|
25
|
+
self._old_dev = server.DEV_LOCAL_UNSAFE
|
|
26
|
+
server.DATA_DIR = Path(self._tmp.name)
|
|
27
|
+
server.AUTH_DB_PATH = Path(self._tmp.name) / "auth.db"
|
|
28
|
+
server.DEV_LOCAL_UNSAFE = False
|
|
29
|
+
ensure_workframe_schemas()
|
|
30
|
+
stack_config.patch_stack_config({"install_complete": True, "deployment_mode": "public_multi_user"})
|
|
31
|
+
server.DEPLOYMENT_MODE = "public_multi_user"
|
|
32
|
+
|
|
33
|
+
self.workspace_id = "ws-closed"
|
|
34
|
+
self.owner_id = "user-owner"
|
|
35
|
+
self.owner_email = "owner@biz.test"
|
|
36
|
+
conn = server._workframe_db()
|
|
37
|
+
try:
|
|
38
|
+
now = str(int(time.time()))
|
|
39
|
+
conn.execute(
|
|
40
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
41
|
+
(self.owner_id, self.owner_email, "Owner", "owner", "active", now, now),
|
|
42
|
+
)
|
|
43
|
+
conn.execute(
|
|
44
|
+
"""
|
|
45
|
+
INSERT INTO workspaces (id, slug, display_name, owner_id, status, created_at, updated_at)
|
|
46
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
47
|
+
""",
|
|
48
|
+
(self.workspace_id, "default", "Acme Corp", self.owner_id, "active", now, now),
|
|
49
|
+
)
|
|
50
|
+
conn.execute(
|
|
51
|
+
"""
|
|
52
|
+
INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at)
|
|
53
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
54
|
+
""",
|
|
55
|
+
("wm-owner", self.workspace_id, self.owner_id, "owner", "active", now, now),
|
|
56
|
+
)
|
|
57
|
+
conn.commit()
|
|
58
|
+
finally:
|
|
59
|
+
conn.close()
|
|
60
|
+
|
|
61
|
+
def tearDown(self) -> None:
|
|
62
|
+
server.DATA_DIR = self._old_data_dir
|
|
63
|
+
server.AUTH_DB_PATH = self._old_auth_db_path
|
|
64
|
+
server.DEPLOYMENT_MODE = self._old_mode
|
|
65
|
+
server.DEV_LOCAL_UNSAFE = self._old_dev
|
|
66
|
+
|
|
67
|
+
def test_stranger_denied_when_invite_only(self) -> None:
|
|
68
|
+
self.assertTrue(server._invite_only_login_enforced())
|
|
69
|
+
allowed, meta = server._email_allowed_to_authenticate("stranger@evil.test")
|
|
70
|
+
self.assertFalse(allowed)
|
|
71
|
+
self.assertEqual(meta["error"], "private_workspace")
|
|
72
|
+
self.assertIn("Acme Corp", meta["message"])
|
|
73
|
+
|
|
74
|
+
def test_owner_allowed(self) -> None:
|
|
75
|
+
allowed, _ = server._email_allowed_to_authenticate(self.owner_email)
|
|
76
|
+
self.assertTrue(allowed)
|
|
77
|
+
|
|
78
|
+
def test_pending_invitee_allowed(self) -> None:
|
|
79
|
+
invite_email = "invitee@partner.test"
|
|
80
|
+
token = "invite-token-secret"
|
|
81
|
+
conn = server._workframe_db()
|
|
82
|
+
try:
|
|
83
|
+
conn.execute(
|
|
84
|
+
"""
|
|
85
|
+
INSERT INTO workspace_invites
|
|
86
|
+
(id, workspace_id, email, role, token_hash, invited_by_user_id, expires_at, created_at)
|
|
87
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
88
|
+
""",
|
|
89
|
+
(
|
|
90
|
+
"inv-1",
|
|
91
|
+
self.workspace_id,
|
|
92
|
+
invite_email,
|
|
93
|
+
"member",
|
|
94
|
+
hashlib.sha256(token.encode()).hexdigest(),
|
|
95
|
+
self.owner_id,
|
|
96
|
+
str(int(time.time()) + 3600),
|
|
97
|
+
str(int(time.time())),
|
|
98
|
+
),
|
|
99
|
+
)
|
|
100
|
+
conn.commit()
|
|
101
|
+
finally:
|
|
102
|
+
conn.close()
|
|
103
|
+
allowed, _ = server._email_allowed_to_authenticate(invite_email)
|
|
104
|
+
self.assertTrue(allowed)
|
|
105
|
+
self.assertTrue(server._invite_token_allows_email(token, invite_email))
|
|
106
|
+
|
|
107
|
+
def test_trusted_team_denies_stranger_post_install(self) -> None:
|
|
108
|
+
server.DEPLOYMENT_MODE = "trusted_team"
|
|
109
|
+
allowed, meta = server._email_allowed_to_authenticate("stranger@evil.test")
|
|
110
|
+
self.assertFalse(allowed)
|
|
111
|
+
self.assertEqual(meta["error"], "private_workspace")
|
|
112
|
+
|
|
113
|
+
def test_owner_claim_blocked_after_install(self) -> None:
|
|
114
|
+
conn = server._workframe_db()
|
|
115
|
+
try:
|
|
116
|
+
now = str(int(time.time()))
|
|
117
|
+
conn.execute(
|
|
118
|
+
"INSERT INTO workspaces (id, slug, display_name, owner_id, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
119
|
+
("ws-unclaimed", "unclaimed", "Unclaimed", "", "active", now, now),
|
|
120
|
+
)
|
|
121
|
+
conn.commit()
|
|
122
|
+
promoted = server._promote_workspace_owner_if_unclaimed(conn, "ws-unclaimed", "user-attacker")
|
|
123
|
+
conn.commit()
|
|
124
|
+
row = conn.execute(
|
|
125
|
+
"SELECT owner_id FROM workspaces WHERE id = ?", ("ws-unclaimed",)
|
|
126
|
+
).fetchone()
|
|
127
|
+
finally:
|
|
128
|
+
conn.close()
|
|
129
|
+
self.assertFalse(promoted)
|
|
130
|
+
self.assertEqual(str(row["owner_id"] or ""), "")
|
|
131
|
+
|
|
132
|
+
def test_install_stack_get_denied_anonymous_post_install(self) -> None:
|
|
133
|
+
from http.server import BaseHTTPRequestHandler
|
|
134
|
+
|
|
135
|
+
handler = mock.Mock(spec=BaseHTTPRequestHandler)
|
|
136
|
+
handler.command = "GET"
|
|
137
|
+
handler.path = "/api/install/stack"
|
|
138
|
+
handler.headers = {}
|
|
139
|
+
with mock.patch.object(server, "_install_window_open", return_value=False), mock.patch.object(
|
|
140
|
+
server, "_session_id_from_request", return_value=""
|
|
141
|
+
):
|
|
142
|
+
self.assertFalse(server._auth_check(handler))
|
|
143
|
+
|
|
144
|
+
def _handler(self) -> server.Handler:
|
|
145
|
+
from io import BytesIO
|
|
146
|
+
from unittest.mock import MagicMock
|
|
147
|
+
|
|
148
|
+
sock = MagicMock()
|
|
149
|
+
sock.makefile.return_value = BytesIO()
|
|
150
|
+
return server.Handler(sock, ("127.0.0.1", 0), None)
|
|
151
|
+
|
|
152
|
+
def test_ensure_user_does_not_auto_join_when_invite_only(self) -> None:
|
|
153
|
+
stranger_id = str(uuid.uuid4())
|
|
154
|
+
stranger_email = "stranger@evil.test"
|
|
155
|
+
self._handler()._ensure_user(stranger_id, stranger_email, stranger_email)
|
|
156
|
+
conn = server._workframe_db()
|
|
157
|
+
try:
|
|
158
|
+
row = conn.execute(
|
|
159
|
+
"SELECT id FROM workspace_memberships WHERE workspace_id = ? AND user_id = ? AND deleted_at IS NULL",
|
|
160
|
+
(self.workspace_id, stranger_id),
|
|
161
|
+
).fetchone()
|
|
162
|
+
self.assertIsNone(row)
|
|
163
|
+
finally:
|
|
164
|
+
conn.close()
|
|
165
|
+
|
|
166
|
+
@mock.patch.object(server, "_invite_only_login_enforced", return_value=False)
|
|
167
|
+
def test_ensure_user_auto_joins_when_not_invite_only(self, _enforced: mock.MagicMock) -> None:
|
|
168
|
+
stranger_id = str(uuid.uuid4())
|
|
169
|
+
stranger_email = "open@dogfood.test"
|
|
170
|
+
self._handler()._ensure_user(stranger_id, stranger_email, stranger_email)
|
|
171
|
+
conn = server._workframe_db()
|
|
172
|
+
try:
|
|
173
|
+
row = conn.execute(
|
|
174
|
+
"SELECT id FROM workspace_memberships WHERE workspace_id = ? AND user_id = ? AND deleted_at IS NULL",
|
|
175
|
+
(self.workspace_id, stranger_id),
|
|
176
|
+
).fetchone()
|
|
177
|
+
self.assertIsNotNone(row)
|
|
178
|
+
finally:
|
|
179
|
+
conn.close()
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
if __name__ == "__main__":
|
|
183
|
+
unittest.main()
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import tempfile
|
|
3
|
+
import unittest
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from unittest.mock import patch
|
|
6
|
+
|
|
7
|
+
API = Path(__file__).resolve().parents[1] / "server.py"
|
|
8
|
+
spec = importlib.util.spec_from_file_location("server", API)
|
|
9
|
+
server = importlib.util.module_from_spec(spec)
|
|
10
|
+
assert spec and spec.loader
|
|
11
|
+
spec.loader.exec_module(server)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class MvpModelBootstrapTest(unittest.TestCase):
|
|
15
|
+
def test_apply_mvp_openrouter_writes_config_yaml(self) -> None:
|
|
16
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
17
|
+
root = Path(tmp)
|
|
18
|
+
prof_dir = root / "profiles" / "u-test-user-workframe-agent"
|
|
19
|
+
prof_dir.mkdir(parents=True)
|
|
20
|
+
(prof_dir / "profile.yaml").write_text(
|
|
21
|
+
"model:\n default: openrouter/owl-alpha\n provider: openrouter\n",
|
|
22
|
+
encoding="utf-8",
|
|
23
|
+
)
|
|
24
|
+
with patch.object(server, "HERMES_DATA", root):
|
|
25
|
+
ok = server._apply_mvp_model_for_provider("u-test-user-workframe-agent", "openrouter")
|
|
26
|
+
self.assertTrue(ok)
|
|
27
|
+
cfg = prof_dir / "config.yaml"
|
|
28
|
+
self.assertTrue(cfg.is_file())
|
|
29
|
+
text = cfg.read_text(encoding="utf-8")
|
|
30
|
+
self.assertIn("default: openrouter/owl-alpha", text)
|
|
31
|
+
self.assertIn("provider: openrouter", text)
|
|
32
|
+
self.assertIn("openrouter/nex-agi", text)
|
|
33
|
+
self.assertIn("nemotron-3-ultra", text)
|
|
34
|
+
|
|
35
|
+
def test_bootstrap_runtime_sets_model_when_missing(self) -> None:
|
|
36
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
37
|
+
root = Path(tmp)
|
|
38
|
+
runtime = "u-test-user-workframe-agent"
|
|
39
|
+
runtime_dir = root / "profiles" / runtime
|
|
40
|
+
runtime_dir.mkdir(parents=True)
|
|
41
|
+
(runtime_dir / ".env").write_text("OPENROUTER_API_KEY=sk-test\n", encoding="utf-8")
|
|
42
|
+
user_home = root / "profiles" / "user-test"
|
|
43
|
+
user_home.mkdir(parents=True)
|
|
44
|
+
(user_home / ".env").write_text("OPENROUTER_API_KEY=sk-test\n", encoding="utf-8")
|
|
45
|
+
with patch.object(server, "HERMES_DATA", root), patch.object(
|
|
46
|
+
server, "NATIVE_PROFILE", "workframe-agent"
|
|
47
|
+
), patch.object(server, "_primary_profile", return_value="workframe-agent"), patch.object(
|
|
48
|
+
server, "resolve_hermes_profile", side_effect=lambda p: p
|
|
49
|
+
), patch.object(server, "_prepare_runtime_profile_credentials", return_value=True), patch.object(
|
|
50
|
+
server, "_resolve_credential", return_value={"credential_ref": "env:OPENROUTER_API_KEY", "env_var": "OPENROUTER_API_KEY"}
|
|
51
|
+
):
|
|
52
|
+
server._bootstrap_profile_providers(runtime, "user-test", "ws-1")
|
|
53
|
+
cfg = runtime_dir / "config.yaml"
|
|
54
|
+
self.assertTrue(cfg.is_file())
|
|
55
|
+
self.assertIn("openrouter/owl-alpha", cfg.read_text(encoding="utf-8"))
|
|
56
|
+
|
|
57
|
+
def test_profile_model_reads_nested_default_without_crossing_lines(self) -> None:
|
|
58
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
59
|
+
root = Path(tmp)
|
|
60
|
+
runtime = "u-test-user-workframe-agent"
|
|
61
|
+
runtime_dir = root / "profiles" / runtime
|
|
62
|
+
runtime_dir.mkdir(parents=True)
|
|
63
|
+
(runtime_dir / "config.yaml").write_text(
|
|
64
|
+
"model:\n"
|
|
65
|
+
" provider: custom\n"
|
|
66
|
+
" default: openrouter/owl-alpha\n"
|
|
67
|
+
" base_url: http://workframe-api:8080/internal/llm/openrouter/v1\n",
|
|
68
|
+
encoding="utf-8",
|
|
69
|
+
)
|
|
70
|
+
with patch.object(server, "HERMES_DATA", root):
|
|
71
|
+
self.assertEqual(server._profile_model(runtime), "openrouter/owl-alpha")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
if __name__ == "__main__":
|
|
75
|
+
unittest.main()
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"""Auto-bootstrap default workspace on API startup."""
|
|
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 server
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class OnboardingBootstrapTests(unittest.TestCase):
|
|
13
|
+
def setUp(self) -> None:
|
|
14
|
+
self.tmp = tempfile.TemporaryDirectory()
|
|
15
|
+
self.addCleanup(self.tmp.cleanup)
|
|
16
|
+
data = Path(self.tmp.name) / "data"
|
|
17
|
+
data.mkdir()
|
|
18
|
+
self.patches = [
|
|
19
|
+
mock.patch.object(server, "DATA_DIR", data),
|
|
20
|
+
mock.patch.object(server, "WORKSPACE", Path(self.tmp.name) / "Files"),
|
|
21
|
+
mock.patch.object(server, "_workframe_db_path", return_value=data / "workframe.db"),
|
|
22
|
+
mock.patch.dict(os.environ, {"WORKFRAME_PROJECT": "Workframe", "WORKFRAME_NATIVE_PROFILE": "workframe-agent"}, clear=False),
|
|
23
|
+
]
|
|
24
|
+
for patch in self.patches:
|
|
25
|
+
patch.start()
|
|
26
|
+
self.addCleanup(patch.stop)
|
|
27
|
+
server._ensure_workframe_db_schema()
|
|
28
|
+
|
|
29
|
+
def test_ensure_default_workspace_idempotent(self) -> None:
|
|
30
|
+
server._ensure_default_workspace()
|
|
31
|
+
server._ensure_default_workspace()
|
|
32
|
+
conn = server._workframe_db()
|
|
33
|
+
ws = conn.execute("SELECT slug, display_name FROM workspaces WHERE slug='default'").fetchone()
|
|
34
|
+
agents = conn.execute("SELECT slug FROM agent_profiles WHERE deleted_at IS NULL ORDER BY slug").fetchall()
|
|
35
|
+
rooms = conn.execute("SELECT slug FROM rooms WHERE deleted_at IS NULL").fetchall()
|
|
36
|
+
conn.close()
|
|
37
|
+
self.assertEqual(ws["slug"], "default")
|
|
38
|
+
self.assertEqual(ws["display_name"], "Workframe")
|
|
39
|
+
self.assertEqual([r[0] for r in agents], ["workframe-agent"])
|
|
40
|
+
room_slugs = [r[0] for r in rooms]
|
|
41
|
+
self.assertIn("general", room_slugs)
|
|
42
|
+
|
|
43
|
+
def test_sync_workspace_home_room_mirrors_branding(self) -> None:
|
|
44
|
+
server._ensure_default_workspace()
|
|
45
|
+
conn = server._workframe_db()
|
|
46
|
+
ws = conn.execute("SELECT id FROM workspaces WHERE slug='default'").fetchone()
|
|
47
|
+
ws_id = str(ws["id"])
|
|
48
|
+
settings = json.dumps({"tagline": "Let's go!"}, sort_keys=True)
|
|
49
|
+
conn.execute(
|
|
50
|
+
"UPDATE workspaces SET display_name = ?, settings_json = ?, updated_at = ? WHERE id = ?",
|
|
51
|
+
("My Business", settings, "2", ws_id),
|
|
52
|
+
)
|
|
53
|
+
server._sync_workspace_home_room(conn, ws_id)
|
|
54
|
+
conn.commit()
|
|
55
|
+
room = conn.execute(
|
|
56
|
+
"SELECT name, topic FROM rooms WHERE workspace_id = ? AND slug = 'general'",
|
|
57
|
+
(ws_id,),
|
|
58
|
+
).fetchone()
|
|
59
|
+
conn.close()
|
|
60
|
+
self.assertEqual(room["name"], "My Business")
|
|
61
|
+
self.assertEqual(room["topic"], "Let's go!")
|
|
62
|
+
server._ensure_default_workspace()
|
|
63
|
+
owner = "owner-user-id"
|
|
64
|
+
conn = server._workframe_db()
|
|
65
|
+
now = str(int(__import__("time").time()))
|
|
66
|
+
ws = conn.execute("SELECT id FROM workspaces WHERE slug='default'").fetchone()
|
|
67
|
+
conn.execute(
|
|
68
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
69
|
+
(owner, "owner@test.com", "Owner", "user", "active", now, now),
|
|
70
|
+
)
|
|
71
|
+
conn.execute(
|
|
72
|
+
"INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
73
|
+
("m1", ws["id"], owner, "owner", "active", now, now),
|
|
74
|
+
)
|
|
75
|
+
conn.commit()
|
|
76
|
+
conn.close()
|
|
77
|
+
with mock.patch.object(server, "_install_complete", return_value=False):
|
|
78
|
+
payload = server._onboarding_payload(owner)
|
|
79
|
+
self.assertFalse(payload["complete"])
|
|
80
|
+
self.assertEqual(payload["step"], "admin_integrations")
|
|
81
|
+
self.assertEqual(payload["credential_mode"], "byok")
|
|
82
|
+
|
|
83
|
+
def test_onboarding_complete_when_install_finished(self) -> None:
|
|
84
|
+
server._ensure_default_workspace()
|
|
85
|
+
owner = "owner-install-done"
|
|
86
|
+
conn = server._workframe_db()
|
|
87
|
+
now = str(int(__import__("time").time()))
|
|
88
|
+
ws = conn.execute("SELECT id FROM workspaces WHERE slug='default'").fetchone()
|
|
89
|
+
conn.execute(
|
|
90
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
91
|
+
(owner, "done@test.com", "Owner", "user", "active", now, now),
|
|
92
|
+
)
|
|
93
|
+
conn.execute(
|
|
94
|
+
"INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
95
|
+
("m-done", ws["id"], owner, "owner", "active", now, now),
|
|
96
|
+
)
|
|
97
|
+
conn.commit()
|
|
98
|
+
conn.close()
|
|
99
|
+
with mock.patch.object(server, "_install_complete", return_value=True), mock.patch.object(
|
|
100
|
+
server, "_user_has_llm_provider", return_value=True
|
|
101
|
+
):
|
|
102
|
+
payload = server._onboarding_payload(owner)
|
|
103
|
+
self.assertTrue(payload["complete"])
|
|
104
|
+
self.assertEqual(payload["step"], "done")
|
|
105
|
+
|
|
106
|
+
def test_onboarding_workspace_provider_after_company_mode(self) -> None:
|
|
107
|
+
server._ensure_default_workspace()
|
|
108
|
+
owner = "owner-workspace-keys"
|
|
109
|
+
conn = server._workframe_db()
|
|
110
|
+
now = str(int(__import__("time").time()))
|
|
111
|
+
ws = conn.execute("SELECT id FROM workspaces WHERE slug='default'").fetchone()
|
|
112
|
+
conn.execute(
|
|
113
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
114
|
+
(owner, "owner2@test.com", "Owner", "user", "active", now, now),
|
|
115
|
+
)
|
|
116
|
+
conn.execute(
|
|
117
|
+
"INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
118
|
+
("m2", ws["id"], owner, "owner", "active", now, now),
|
|
119
|
+
)
|
|
120
|
+
settings = '{"credential_mode":"workspace","admin_integrations_done":true,"admin_onboarding_done":true}'
|
|
121
|
+
conn.execute(
|
|
122
|
+
"UPDATE workspaces SET settings_json = ? WHERE id = ?",
|
|
123
|
+
(settings, ws["id"]),
|
|
124
|
+
)
|
|
125
|
+
conn.commit()
|
|
126
|
+
conn.close()
|
|
127
|
+
payload = server._onboarding_payload(owner)
|
|
128
|
+
self.assertFalse(payload["complete"])
|
|
129
|
+
self.assertEqual(payload["step"], "workspace_provider")
|
|
130
|
+
|
|
131
|
+
def test_member_can_mark_integrations_done_during_install(self) -> None:
|
|
132
|
+
server._ensure_default_workspace()
|
|
133
|
+
user_id = "installer-member"
|
|
134
|
+
conn = server._workframe_db()
|
|
135
|
+
now = str(int(__import__("time").time()))
|
|
136
|
+
ws = conn.execute("SELECT id FROM workspaces WHERE slug='default'").fetchone()
|
|
137
|
+
conn.execute(
|
|
138
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
139
|
+
(user_id, "installer@test.com", "Installer", "user", "active", now, now),
|
|
140
|
+
)
|
|
141
|
+
conn.execute(
|
|
142
|
+
"INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
143
|
+
("m-install", ws["id"], user_id, "member", "active", now, now),
|
|
144
|
+
)
|
|
145
|
+
conn.commit()
|
|
146
|
+
conn.close()
|
|
147
|
+
with mock.patch.object(server, "_install_window_open", return_value=True):
|
|
148
|
+
status, payload = server._patch_workspace_integrations(
|
|
149
|
+
str(ws["id"]),
|
|
150
|
+
{"admin_integrations_done": True},
|
|
151
|
+
user_id,
|
|
152
|
+
)
|
|
153
|
+
self.assertEqual(status, 200)
|
|
154
|
+
self.assertTrue(payload.get("ok"))
|
|
155
|
+
conn = server._workframe_db()
|
|
156
|
+
settings = server._parse_workspace_settings(
|
|
157
|
+
conn.execute("SELECT * FROM workspaces WHERE id = ?", (ws["id"],)).fetchone()
|
|
158
|
+
)
|
|
159
|
+
conn.close()
|
|
160
|
+
self.assertTrue(settings.get("admin_integrations_done"))
|
|
161
|
+
|
|
162
|
+
def test_owner_id_repairs_stale_member_role(self) -> None:
|
|
163
|
+
server._ensure_default_workspace()
|
|
164
|
+
user_id = "stale-owner"
|
|
165
|
+
conn = server._workframe_db()
|
|
166
|
+
now = str(int(__import__("time").time()))
|
|
167
|
+
ws = conn.execute("SELECT id FROM workspaces WHERE slug='default'").fetchone()
|
|
168
|
+
conn.execute(
|
|
169
|
+
"UPDATE workspaces SET owner_id = ? WHERE id = ?",
|
|
170
|
+
(user_id, ws["id"]),
|
|
171
|
+
)
|
|
172
|
+
conn.execute(
|
|
173
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
174
|
+
(user_id, "stale@test.com", "Stale", "user", "active", now, now),
|
|
175
|
+
)
|
|
176
|
+
conn.execute(
|
|
177
|
+
"INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
178
|
+
("m-stale", ws["id"], user_id, "member", "active", now, now),
|
|
179
|
+
)
|
|
180
|
+
conn.commit()
|
|
181
|
+
conn.close()
|
|
182
|
+
status, payload = server._patch_workspace_integrations(
|
|
183
|
+
str(ws["id"]),
|
|
184
|
+
{"admin_integrations_done": True},
|
|
185
|
+
user_id,
|
|
186
|
+
)
|
|
187
|
+
self.assertEqual(status, 200)
|
|
188
|
+
self.assertTrue(payload.get("ok"))
|
|
189
|
+
conn = server._workframe_db()
|
|
190
|
+
role = conn.execute(
|
|
191
|
+
"SELECT role FROM workspace_memberships WHERE workspace_id = ? AND user_id = ?",
|
|
192
|
+
(ws["id"], user_id),
|
|
193
|
+
).fetchone()
|
|
194
|
+
conn.close()
|
|
195
|
+
self.assertEqual(role["role"], "owner")
|
|
196
|
+
|
|
197
|
+
def test_patch_workspace_tagline_uses_existing_row(self) -> None:
|
|
198
|
+
server._ensure_default_workspace()
|
|
199
|
+
owner = "owner-tagline"
|
|
200
|
+
conn = server._workframe_db()
|
|
201
|
+
now = str(int(__import__("time").time()))
|
|
202
|
+
ws = conn.execute("SELECT id FROM workspaces WHERE slug='default'").fetchone()
|
|
203
|
+
conn.execute(
|
|
204
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
205
|
+
(owner, "tagline@test.com", "Owner", "user", "active", now, now),
|
|
206
|
+
)
|
|
207
|
+
conn.execute(
|
|
208
|
+
"INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
209
|
+
("m-tagline", ws["id"], owner, "owner", "active", now, now),
|
|
210
|
+
)
|
|
211
|
+
conn.commit()
|
|
212
|
+
conn.close()
|
|
213
|
+
status, payload = server._patch_workspace(
|
|
214
|
+
str(ws["id"]),
|
|
215
|
+
{"display_name": "Acme", "tagline": "We ship", "description": "Mission"},
|
|
216
|
+
owner,
|
|
217
|
+
)
|
|
218
|
+
self.assertEqual(status, 200)
|
|
219
|
+
self.assertTrue(payload.get("ok"))
|
|
220
|
+
self.assertEqual(payload["workspace"]["tagline"], "We ship")
|
|
221
|
+
self.assertEqual(payload["workspace"]["display_name"], "Acme")
|
|
222
|
+
conn = server._workframe_db()
|
|
223
|
+
raw = conn.execute(
|
|
224
|
+
"SELECT settings_json FROM workspaces WHERE id = ?",
|
|
225
|
+
(ws["id"],),
|
|
226
|
+
).fetchone()
|
|
227
|
+
conn.close()
|
|
228
|
+
settings = __import__("json").loads(raw["settings_json"] or "{}")
|
|
229
|
+
self.assertEqual(settings.get("tagline"), "We ship")
|
|
230
|
+
|
|
231
|
+
def test_files_tree_root_uses_workspace_display_name(self) -> None:
|
|
232
|
+
server._ensure_default_workspace()
|
|
233
|
+
conn = server._workframe_db()
|
|
234
|
+
ws = conn.execute("SELECT id FROM workspaces WHERE slug='default'").fetchone()
|
|
235
|
+
conn.execute(
|
|
236
|
+
"UPDATE workspaces SET display_name = ?, updated_at = ? WHERE id = ?",
|
|
237
|
+
("Acme Corp", "3", ws["id"]),
|
|
238
|
+
)
|
|
239
|
+
conn.commit()
|
|
240
|
+
conn.close()
|
|
241
|
+
with mock.patch.dict(os.environ, {"WORKFRAME_PROJECT": "Shmorkframe"}, clear=False):
|
|
242
|
+
self.assertEqual(server._files_tree_root_name(), "Acme Corp")
|
|
243
|
+
tree = server.files_tree()
|
|
244
|
+
self.assertEqual(tree["name"], "Acme Corp")
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
if __name__ == "__main__":
|
|
248
|
+
unittest.main()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
import hmac
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
import platform_auth
|
|
6
|
+
import stack_config
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PlatformAuthTests(unittest.TestCase):
|
|
10
|
+
def test_verify_telegram_login_accepts_valid_hash(self) -> None:
|
|
11
|
+
bot_token = "123456:ABC-DEF"
|
|
12
|
+
payload = {
|
|
13
|
+
"id": "424242",
|
|
14
|
+
"first_name": "Test",
|
|
15
|
+
"username": "tester",
|
|
16
|
+
"auth_date": "1700000000",
|
|
17
|
+
}
|
|
18
|
+
check_line = "\n".join(f"{k}={payload[k]}" for k in sorted(payload))
|
|
19
|
+
secret = hashlib.sha256(bot_token.encode("utf-8")).digest()
|
|
20
|
+
payload["hash"] = hmac.new(secret, check_line.encode("utf-8"), hashlib.sha256).hexdigest()
|
|
21
|
+
|
|
22
|
+
old = stack_config._read_raw
|
|
23
|
+
stack_config._read_raw = lambda: {
|
|
24
|
+
"telegram_login": {"bot_username": "wfbot", "bot_token": bot_token},
|
|
25
|
+
}
|
|
26
|
+
try:
|
|
27
|
+
result = platform_auth.verify_telegram_login(payload)
|
|
28
|
+
finally:
|
|
29
|
+
stack_config._read_raw = old
|
|
30
|
+
|
|
31
|
+
self.assertTrue(result.get("ok"))
|
|
32
|
+
self.assertEqual(result.get("platform_ids", {}).get("telegram"), "424242")
|
|
33
|
+
|
|
34
|
+
def test_verify_telegram_login_rejects_bad_hash(self) -> None:
|
|
35
|
+
old = stack_config._read_raw
|
|
36
|
+
stack_config._read_raw = lambda: {
|
|
37
|
+
"telegram_login": {"bot_username": "wfbot", "bot_token": "1:2"},
|
|
38
|
+
}
|
|
39
|
+
try:
|
|
40
|
+
result = platform_auth.verify_telegram_login({"id": "1", "hash": "bad"})
|
|
41
|
+
finally:
|
|
42
|
+
stack_config._read_raw = old
|
|
43
|
+
self.assertFalse(result.get("ok"))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if __name__ == "__main__":
|
|
47
|
+
unittest.main()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Hermes:latest profiles use profile.yaml instead of config.yaml."""
|
|
2
|
+
import tempfile
|
|
3
|
+
import unittest
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from unittest import mock
|
|
6
|
+
|
|
7
|
+
import server
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProfileConfigPathTests(unittest.TestCase):
|
|
11
|
+
def setUp(self) -> None:
|
|
12
|
+
self.tmp = tempfile.TemporaryDirectory()
|
|
13
|
+
self.addCleanup(self.tmp.cleanup)
|
|
14
|
+
self.hermes = Path(self.tmp.name) / "Agents"
|
|
15
|
+
profiles = self.hermes / "profiles" / "workframe-agent"
|
|
16
|
+
profiles.mkdir(parents=True)
|
|
17
|
+
(profiles / "profile.yaml").write_text("description: test\n", encoding="utf-8")
|
|
18
|
+
self.patch = mock.patch.object(server, "HERMES_DATA", self.hermes)
|
|
19
|
+
self.patch.start()
|
|
20
|
+
self.addCleanup(self.patch.stop)
|
|
21
|
+
|
|
22
|
+
def test_profile_config_path_prefers_either_yaml(self) -> None:
|
|
23
|
+
path = server._profile_config_path("workframe-agent")
|
|
24
|
+
self.assertIsNotNone(path)
|
|
25
|
+
self.assertEqual(path.name, "profile.yaml")
|
|
26
|
+
|
|
27
|
+
def test_runtime_profile_on_disk_accepts_profile_yaml(self) -> None:
|
|
28
|
+
self.assertTrue(server._runtime_profile_on_disk("workframe-agent"))
|
|
29
|
+
|
|
30
|
+
def test_inherit_runtime_profile_config_copies_template_yaml(self) -> None:
|
|
31
|
+
runtime = "u-test-user-workframe-agent"
|
|
32
|
+
runtime_dir = self.hermes / "profiles" / runtime
|
|
33
|
+
runtime_dir.mkdir(parents=True)
|
|
34
|
+
(runtime_dir / ".env").write_text("X=1\n", encoding="utf-8")
|
|
35
|
+
server._inherit_runtime_profile_config(runtime, "workframe-agent")
|
|
36
|
+
inherited = runtime_dir / "profile.yaml"
|
|
37
|
+
self.assertTrue(inherited.is_file())
|
|
38
|
+
self.assertIn("description:", inherited.read_text(encoding="utf-8"))
|
|
39
|
+
|
|
40
|
+
def test_configure_profile_api_writes_config_yaml_on_disk(self) -> None:
|
|
41
|
+
runtime = "z-test-runtime-agent"
|
|
42
|
+
runtime_dir = self.hermes / "profiles" / runtime
|
|
43
|
+
runtime_dir.mkdir(parents=True)
|
|
44
|
+
(runtime_dir / "config.yaml").write_text("platforms: {}\n", encoding="utf-8")
|
|
45
|
+
with mock.patch.object(server, "NATIVE_PROFILE", "workframe-agent"):
|
|
46
|
+
ok, out, port = server._configure_profile_api(runtime)
|
|
47
|
+
self.assertTrue(ok)
|
|
48
|
+
self.assertEqual(out, "ok")
|
|
49
|
+
self.assertGreater(port, 18610)
|
|
50
|
+
text = (runtime_dir / "config.yaml").read_text(encoding="utf-8")
|
|
51
|
+
self.assertIn("api_server", text)
|
|
52
|
+
self.assertIn("enabled: true", text)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if __name__ == "__main__":
|
|
56
|
+
unittest.main()
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Repair invalid scalar model: headers in profile config.yaml."""
|
|
2
|
+
import tempfile
|
|
3
|
+
import unittest
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from unittest import mock
|
|
6
|
+
|
|
7
|
+
import server
|
|
8
|
+
import yaml
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ProfileConfigYamlRepairTests(unittest.TestCase):
|
|
12
|
+
def test_fix_invalid_model_header_scalar_empty(self) -> None:
|
|
13
|
+
raw = "model: ''\n base_url: http://example/v1\n provider: custom\n"
|
|
14
|
+
fixed = server._fix_invalid_model_header(raw)
|
|
15
|
+
data = yaml.safe_load(fixed)
|
|
16
|
+
self.assertIsInstance(data.get("model"), dict)
|
|
17
|
+
self.assertEqual(data["model"]["base_url"], "http://example/v1")
|
|
18
|
+
|
|
19
|
+
def test_normalize_writes_repaired_file(self) -> None:
|
|
20
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
21
|
+
prof = "u-test-user-dev"
|
|
22
|
+
prof_dir = Path(tmp) / "profiles" / prof
|
|
23
|
+
prof_dir.mkdir(parents=True)
|
|
24
|
+
cfg = prof_dir / "config.yaml"
|
|
25
|
+
cfg.write_text(
|
|
26
|
+
"model: ''\n base_url: http://workframe-api:8080/internal/llm/openrouter/v1\n"
|
|
27
|
+
" provider: custom\n",
|
|
28
|
+
encoding="utf-8",
|
|
29
|
+
)
|
|
30
|
+
with mock.patch.object(server, "_profile_gateway_config_path", return_value=cfg):
|
|
31
|
+
server._normalize_profile_config_yaml(prof)
|
|
32
|
+
yaml.safe_load(cfg.read_text(encoding="utf-8"))
|
|
33
|
+
|
|
34
|
+
def test_scrub_orphan_top_level_list_lines(self) -> None:
|
|
35
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
36
|
+
prof = "u-test-user-dev"
|
|
37
|
+
prof_dir = Path(tmp) / "profiles" / prof
|
|
38
|
+
prof_dir.mkdir(parents=True)
|
|
39
|
+
cfg = prof_dir / "config.yaml"
|
|
40
|
+
cfg.write_text(
|
|
41
|
+
"model:\n default: openrouter/owl-alpha\n"
|
|
42
|
+
"- provider: openrouter\n"
|
|
43
|
+
"model:\n default: openrouter/nex-agi\n",
|
|
44
|
+
encoding="utf-8",
|
|
45
|
+
)
|
|
46
|
+
with mock.patch.object(server, "_profile_gateway_config_path", return_value=cfg), mock.patch.object(
|
|
47
|
+
server,
|
|
48
|
+
"_read_model_block",
|
|
49
|
+
return_value={
|
|
50
|
+
"default": "openrouter/owl-alpha",
|
|
51
|
+
"provider": "custom",
|
|
52
|
+
"base_url": "",
|
|
53
|
+
"fallback_chain": [],
|
|
54
|
+
},
|
|
55
|
+
):
|
|
56
|
+
server._normalize_profile_config_yaml(prof)
|
|
57
|
+
text = cfg.read_text(encoding="utf-8")
|
|
58
|
+
self.assertNotIn("- provider: openrouter\n", text)
|
|
59
|
+
yaml.safe_load(text)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
unittest.main()
|