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,76 @@
|
|
|
1
|
+
import tempfile
|
|
2
|
+
import unittest
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from unittest.mock import patch
|
|
5
|
+
|
|
6
|
+
import server
|
|
7
|
+
from db_setup import ensure_workframe_schemas
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AgentProfileSyncTests(unittest.TestCase):
|
|
11
|
+
def setUp(self) -> None:
|
|
12
|
+
self._tmp = tempfile.TemporaryDirectory()
|
|
13
|
+
self.addCleanup(self._tmp.cleanup)
|
|
14
|
+
self._old_data_dir = server.DATA_DIR
|
|
15
|
+
self._old_auth_db_path = server.AUTH_DB_PATH
|
|
16
|
+
server.DATA_DIR = Path(self._tmp.name)
|
|
17
|
+
server.AUTH_DB_PATH = Path(self._tmp.name) / "auth.db"
|
|
18
|
+
ensure_workframe_schemas()
|
|
19
|
+
conn = server._workframe_db()
|
|
20
|
+
try:
|
|
21
|
+
now = "1"
|
|
22
|
+
conn.execute(
|
|
23
|
+
"""
|
|
24
|
+
INSERT INTO workspaces (id, slug, display_name, owner_id, status, created_at, updated_at)
|
|
25
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
26
|
+
""",
|
|
27
|
+
("ws-1", "default", "Default", "user-1", "active", now, now),
|
|
28
|
+
)
|
|
29
|
+
conn.execute(
|
|
30
|
+
"""
|
|
31
|
+
INSERT INTO agent_profiles (
|
|
32
|
+
id, workspace_id, slug, display_name, status, created_at, updated_at
|
|
33
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
34
|
+
""",
|
|
35
|
+
("agent-1", "ws-1", "workframe-agent", "Workframe Agent", "available", now, now),
|
|
36
|
+
)
|
|
37
|
+
conn.commit()
|
|
38
|
+
finally:
|
|
39
|
+
conn.close()
|
|
40
|
+
|
|
41
|
+
def tearDown(self) -> None:
|
|
42
|
+
server.DATA_DIR = self._old_data_dir
|
|
43
|
+
server.AUTH_DB_PATH = self._old_auth_db_path
|
|
44
|
+
|
|
45
|
+
def test_sync_agent_profile_db_writes_avatar_url(self) -> None:
|
|
46
|
+
avatar = "data:image/png;base64,abc"
|
|
47
|
+
server._sync_agent_profile_db("workframe-agent", {"avatar_url": avatar, "display_name": "WF"})
|
|
48
|
+
conn = server._workframe_db()
|
|
49
|
+
try:
|
|
50
|
+
row = conn.execute(
|
|
51
|
+
"SELECT display_name, avatar_url FROM agent_profiles WHERE slug = ?",
|
|
52
|
+
("workframe-agent",),
|
|
53
|
+
).fetchone()
|
|
54
|
+
finally:
|
|
55
|
+
conn.close()
|
|
56
|
+
self.assertIsNotNone(row)
|
|
57
|
+
self.assertEqual(row["display_name"], "WF")
|
|
58
|
+
self.assertEqual(row["avatar_url"], avatar)
|
|
59
|
+
|
|
60
|
+
@patch.object(server, "route_status_for_profile", return_value="available")
|
|
61
|
+
@patch.object(server, "_gateway_platform", return_value="local")
|
|
62
|
+
def test_crew_data_reads_registry_by_full_profile_slug(self, *_mocks) -> None:
|
|
63
|
+
registry = {
|
|
64
|
+
"workframe-agent": {
|
|
65
|
+
"profile": "workframe-agent",
|
|
66
|
+
"avatar_url": "data:image/png;base64,crew",
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
with patch.object(server, "load_agent_registry", return_value=registry):
|
|
70
|
+
crew = server.crew_data(["workframe-agent"], "workframe-agent", {"ok": True, "state": "running"})
|
|
71
|
+
self.assertEqual(len(crew), 1)
|
|
72
|
+
self.assertEqual(crew[0]["avatar_url"], "data:image/png;base64,crew")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
unittest.main()
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"""Auth email / OTP start behavior."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import sqlite3
|
|
7
|
+
import tempfile
|
|
8
|
+
import unittest
|
|
9
|
+
import json
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from unittest import mock
|
|
12
|
+
|
|
13
|
+
import zk_auth as zk
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AuthEmailStartTests(unittest.TestCase):
|
|
17
|
+
def setUp(self) -> None:
|
|
18
|
+
self._tmpdir = tempfile.TemporaryDirectory()
|
|
19
|
+
self.addCleanup(self._tmpdir.cleanup)
|
|
20
|
+
os.environ["WORKFRAME_API_DATA_DIR"] = self._tmpdir.name
|
|
21
|
+
|
|
22
|
+
@mock.patch("email_sender.send_verification_email")
|
|
23
|
+
def test_dev_unsafe_returns_otp_when_smtp_missing(self, send_email: mock.MagicMock) -> None:
|
|
24
|
+
send_email.side_effect = RuntimeError("SMTP_HOST not configured")
|
|
25
|
+
|
|
26
|
+
result = zk.start_email_verification("user@example.com", dev_local_unsafe=True)
|
|
27
|
+
|
|
28
|
+
self.assertFalse(result["email_sent"])
|
|
29
|
+
self.assertIn("SMTP_HOST", result.get("email_error", ""))
|
|
30
|
+
self.assertEqual(len(result["otp_code"]), 6)
|
|
31
|
+
self.assertTrue(result["otp_code"].isdigit())
|
|
32
|
+
|
|
33
|
+
@mock.patch("email_sender.send_verification_email")
|
|
34
|
+
def test_secure_mode_does_not_return_otp_when_smtp_missing(self, send_email: mock.MagicMock) -> None:
|
|
35
|
+
send_email.side_effect = RuntimeError("SMTP_HOST not configured")
|
|
36
|
+
|
|
37
|
+
result = zk.start_email_verification("user@example.com", dev_local_unsafe=False)
|
|
38
|
+
|
|
39
|
+
self.assertFalse(result["email_sent"])
|
|
40
|
+
self.assertNotIn("otp_code", result)
|
|
41
|
+
|
|
42
|
+
@mock.patch("email_sender.send_verification_email")
|
|
43
|
+
def test_email_sent_does_not_return_otp_even_in_dev(self, send_email: mock.MagicMock) -> None:
|
|
44
|
+
send_email.return_value = None
|
|
45
|
+
|
|
46
|
+
result = zk.start_email_verification("user@example.com", dev_local_unsafe=True)
|
|
47
|
+
|
|
48
|
+
self.assertTrue(result["email_sent"])
|
|
49
|
+
self.assertNotIn("otp_code", result)
|
|
50
|
+
|
|
51
|
+
@mock.patch("email_sender.send_verification_email")
|
|
52
|
+
def test_expose_otp_returns_code_when_email_sent(self, send_email: mock.MagicMock) -> None:
|
|
53
|
+
send_email.return_value = None
|
|
54
|
+
|
|
55
|
+
result = zk.start_email_verification("user@example.com", expose_otp=True)
|
|
56
|
+
|
|
57
|
+
self.assertTrue(result["email_sent"])
|
|
58
|
+
self.assertEqual(len(result["otp_code"]), 6)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class StackConfigTests(unittest.TestCase):
|
|
62
|
+
def setUp(self) -> None:
|
|
63
|
+
self._tmpdir = tempfile.TemporaryDirectory()
|
|
64
|
+
self.addCleanup(self._tmpdir.cleanup)
|
|
65
|
+
os.environ["WORKFRAME_API_DATA_DIR"] = self._tmpdir.name
|
|
66
|
+
import importlib
|
|
67
|
+
|
|
68
|
+
import stack_config as sc
|
|
69
|
+
|
|
70
|
+
self.sc = importlib.reload(sc)
|
|
71
|
+
|
|
72
|
+
def test_patch_and_resolve_smtp(self) -> None:
|
|
73
|
+
self.sc.patch_stack_config(
|
|
74
|
+
{
|
|
75
|
+
"deployment_mode": "trusted_team",
|
|
76
|
+
"smtp": {
|
|
77
|
+
"provider": "gmail",
|
|
78
|
+
"host": "smtp.gmail.com",
|
|
79
|
+
"port": 587,
|
|
80
|
+
"user": "ops@example.com",
|
|
81
|
+
"password": "secret",
|
|
82
|
+
"from": "ops@example.com",
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
cfg = self.sc.get_stack_config()
|
|
87
|
+
self.assertEqual(cfg["deployment_mode"], "trusted_team")
|
|
88
|
+
self.assertTrue(self.sc.smtp_configured())
|
|
89
|
+
resolved = self.sc.resolved_smtp()
|
|
90
|
+
self.assertEqual(resolved["host"], "smtp.gmail.com")
|
|
91
|
+
self.assertEqual(resolved["user"], "ops@example.com")
|
|
92
|
+
|
|
93
|
+
def test_env_overrides_stack_file(self) -> None:
|
|
94
|
+
self.sc.patch_stack_config({"smtp": {"host": "smtp.file.test", "user": "a", "password": "b"}})
|
|
95
|
+
os.environ["SMTP_HOST"] = "smtp.env.test"
|
|
96
|
+
os.environ["SMTP_USER"] = "env-user"
|
|
97
|
+
resolved = self.sc.resolved_smtp()
|
|
98
|
+
self.assertEqual(resolved["source"], "env")
|
|
99
|
+
self.assertEqual(resolved["host"], "smtp.env.test")
|
|
100
|
+
os.environ.pop("SMTP_HOST", None)
|
|
101
|
+
os.environ.pop("SMTP_USER", None)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class OtpLockoutTests(unittest.TestCase):
|
|
105
|
+
def setUp(self) -> None:
|
|
106
|
+
self._tmpdir = tempfile.TemporaryDirectory()
|
|
107
|
+
self.addCleanup(self._tmpdir.cleanup)
|
|
108
|
+
os.environ["WORKFRAME_API_DATA_DIR"] = self._tmpdir.name
|
|
109
|
+
|
|
110
|
+
@mock.patch("email_sender.send_verification_email", return_value=None)
|
|
111
|
+
def test_lockout_before_correct_code_after_max_wrong(self, _send: mock.MagicMock) -> None:
|
|
112
|
+
started = zk.start_email_verification(
|
|
113
|
+
"lock@example.com", dev_local_unsafe=True, expose_otp=True,
|
|
114
|
+
)
|
|
115
|
+
good = started["otp_code"]
|
|
116
|
+
for wrong in ("000000", "111111", "222222", "333333", "444444"):
|
|
117
|
+
with self.assertRaises(ValueError) as ctx:
|
|
118
|
+
zk.verify_email_code("lock@example.com", wrong)
|
|
119
|
+
self.assertEqual(str(ctx.exception), "Invalid or expired verification code.")
|
|
120
|
+
with self.assertRaises(ValueError) as ctx:
|
|
121
|
+
zk.verify_email_code("lock@example.com", good)
|
|
122
|
+
self.assertEqual(str(ctx.exception), "Invalid or expired verification code.")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class InstallWindowTests(unittest.TestCase):
|
|
126
|
+
def setUp(self) -> None:
|
|
127
|
+
self._tmpdir = tempfile.TemporaryDirectory()
|
|
128
|
+
self.addCleanup(self._tmpdir.cleanup)
|
|
129
|
+
os.environ["WORKFRAME_API_DATA_DIR"] = self._tmpdir.name
|
|
130
|
+
import importlib
|
|
131
|
+
|
|
132
|
+
import stack_config as sc
|
|
133
|
+
import install_api as ia
|
|
134
|
+
|
|
135
|
+
self.sc = importlib.reload(sc)
|
|
136
|
+
self.ia = importlib.reload(ia)
|
|
137
|
+
self.db_path = str(Path(self._tmpdir.name) / "workframe.db")
|
|
138
|
+
|
|
139
|
+
def test_window_open_until_install_complete_even_with_users(self) -> None:
|
|
140
|
+
Path(self.db_path).write_text("", encoding="utf-8")
|
|
141
|
+
conn = sqlite3.connect(self.db_path)
|
|
142
|
+
conn.execute(
|
|
143
|
+
"CREATE TABLE users (id TEXT PRIMARY KEY, email TEXT, display_name TEXT, role TEXT, status TEXT, created_at TEXT, updated_at TEXT)"
|
|
144
|
+
)
|
|
145
|
+
conn.execute(
|
|
146
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
147
|
+
("u1", "a@b.com", "A", "owner", "active", "1", "1"),
|
|
148
|
+
)
|
|
149
|
+
conn.commit()
|
|
150
|
+
conn.close()
|
|
151
|
+
self.assertTrue(self.ia.install_window_open(self.db_path))
|
|
152
|
+
self.sc.patch_stack_config({"install_complete": True})
|
|
153
|
+
self.assertFalse(self.ia.install_window_open(self.db_path))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class SmtpSecureNormalizeTests(unittest.TestCase):
|
|
157
|
+
def test_port_465_uses_ssl_even_when_starttls(self) -> None:
|
|
158
|
+
import stack_config as sc
|
|
159
|
+
|
|
160
|
+
self.assertEqual(sc.normalize_smtp_secure(465, "starttls"), "ssl")
|
|
161
|
+
self.assertEqual(sc.normalize_smtp_secure(465, "true"), "ssl")
|
|
162
|
+
self.assertEqual(sc.normalize_smtp_secure(587, "true"), "ssl")
|
|
163
|
+
self.assertEqual(sc.normalize_smtp_secure(587, "starttls"), "starttls")
|
|
164
|
+
self.assertEqual(sc.normalize_smtp_secure(587, ""), "starttls")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class ResolvedSmtpTests(unittest.TestCase):
|
|
168
|
+
def setUp(self) -> None:
|
|
169
|
+
self._tmpdir = tempfile.TemporaryDirectory()
|
|
170
|
+
self.addCleanup(self._tmpdir.cleanup)
|
|
171
|
+
os.environ["WORKFRAME_API_DATA_DIR"] = self._tmpdir.name
|
|
172
|
+
import importlib
|
|
173
|
+
|
|
174
|
+
import stack_config as sc
|
|
175
|
+
|
|
176
|
+
self.sc = importlib.reload(sc)
|
|
177
|
+
|
|
178
|
+
def test_stack_password_not_redacted_from_public_get(self) -> None:
|
|
179
|
+
cfg_path = Path(self._tmpdir.name) / "stack_config.json"
|
|
180
|
+
cfg_path.write_text(
|
|
181
|
+
json.dumps(
|
|
182
|
+
{
|
|
183
|
+
"smtp": {
|
|
184
|
+
"host": "smtp.test",
|
|
185
|
+
"user": "login@test.com",
|
|
186
|
+
"password": "secret-pass",
|
|
187
|
+
"from": "alias@test.com",
|
|
188
|
+
"port": 465,
|
|
189
|
+
"secure": "ssl",
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
encoding="utf-8",
|
|
194
|
+
)
|
|
195
|
+
public = self.sc.get_stack_config()["smtp"]
|
|
196
|
+
self.assertTrue(public["has_password"])
|
|
197
|
+
self.assertNotIn("password", public)
|
|
198
|
+
resolved = self.sc.resolved_smtp()
|
|
199
|
+
self.assertEqual(resolved["password"], "secret-pass")
|
|
200
|
+
self.assertEqual(resolved["from"], "alias@test.com")
|
|
201
|
+
self.assertEqual(resolved["user"], "login@test.com")
|
|
202
|
+
|
|
203
|
+
def test_env_pass_falls_back_to_stack_password(self) -> None:
|
|
204
|
+
cfg_path = Path(self._tmpdir.name) / "stack_config.json"
|
|
205
|
+
cfg_path.write_text(
|
|
206
|
+
json.dumps({"smtp": {"password": "stack-secret"}}),
|
|
207
|
+
encoding="utf-8",
|
|
208
|
+
)
|
|
209
|
+
os.environ["SMTP_HOST"] = "smtp.env.test"
|
|
210
|
+
os.environ["SMTP_USER"] = "env-user@test.com"
|
|
211
|
+
os.environ["EMAIL_FROM"] = "alias@test.com"
|
|
212
|
+
self.addCleanup(os.environ.pop, "SMTP_HOST", None)
|
|
213
|
+
self.addCleanup(os.environ.pop, "SMTP_USER", None)
|
|
214
|
+
self.addCleanup(os.environ.pop, "EMAIL_FROM", None)
|
|
215
|
+
resolved = self.sc.resolved_smtp()
|
|
216
|
+
self.assertEqual(resolved["password"], "stack-secret")
|
|
217
|
+
self.assertEqual(resolved["from"], "alias@test.com")
|
|
218
|
+
self.assertEqual(resolved["user"], "env-user@test.com")
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
if __name__ == "__main__":
|
|
222
|
+
unittest.main()
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Runnable self-check for the four signup-hole fixes (no pytest fixtures)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import tempfile
|
|
7
|
+
import time
|
|
8
|
+
import unittest
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from unittest import mock
|
|
11
|
+
|
|
12
|
+
import stack_config
|
|
13
|
+
from db_setup import ensure_workframe_schemas
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AuthHoleFixSelfCheck(unittest.TestCase):
|
|
17
|
+
def setUp(self) -> None:
|
|
18
|
+
self._tmp = tempfile.TemporaryDirectory()
|
|
19
|
+
self.addCleanup(self._tmp.cleanup)
|
|
20
|
+
self._env = dict(os.environ)
|
|
21
|
+
self.addCleanup(lambda: os.environ.clear() or os.environ.update(self._env))
|
|
22
|
+
|
|
23
|
+
import server
|
|
24
|
+
|
|
25
|
+
self.server = server
|
|
26
|
+
self._old_data = server.DATA_DIR
|
|
27
|
+
self._old_auth = server.AUTH_DB_PATH
|
|
28
|
+
self._old_mode = server.DEPLOYMENT_MODE
|
|
29
|
+
server.DATA_DIR = Path(self._tmp.name) / "data"
|
|
30
|
+
server.DATA_DIR.mkdir(parents=True, exist_ok=True)
|
|
31
|
+
server.AUTH_DB_PATH = server.DATA_DIR / "auth.db"
|
|
32
|
+
stack_config.DATA_DIR = server.DATA_DIR
|
|
33
|
+
stack_config.CONFIG_PATH = server.DATA_DIR / "stack_config.json"
|
|
34
|
+
server.DEV_LOCAL_UNSAFE = False
|
|
35
|
+
ensure_workframe_schemas()
|
|
36
|
+
stack_config.patch_stack_config({"install_complete": True, "deployment_mode": "trusted_team"})
|
|
37
|
+
conn = server._workframe_db()
|
|
38
|
+
try:
|
|
39
|
+
now = str(int(time.time()))
|
|
40
|
+
conn.execute(
|
|
41
|
+
"INSERT INTO users (id, email, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
42
|
+
("owner-1", "owner@biz.test", "Owner", "owner", "active", now, now),
|
|
43
|
+
)
|
|
44
|
+
conn.execute(
|
|
45
|
+
"INSERT INTO workspaces (id, slug, display_name, owner_id, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
46
|
+
("ws-1", "default", "Acme", "owner-1", "active", now, now),
|
|
47
|
+
)
|
|
48
|
+
conn.execute(
|
|
49
|
+
"INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
50
|
+
("wm-1", "ws-1", "owner-1", "owner", "active", now, now),
|
|
51
|
+
)
|
|
52
|
+
conn.commit()
|
|
53
|
+
finally:
|
|
54
|
+
conn.close()
|
|
55
|
+
|
|
56
|
+
def tearDown(self) -> None:
|
|
57
|
+
self.server.DATA_DIR = self._old_data
|
|
58
|
+
self.server.AUTH_DB_PATH = self._old_auth
|
|
59
|
+
self.server.DEPLOYMENT_MODE = self._old_mode
|
|
60
|
+
|
|
61
|
+
def test_env_beats_stale_stack_config(self) -> None:
|
|
62
|
+
os.environ["WORKFRAME_DEPLOYMENT_MODE"] = "public_multi_user"
|
|
63
|
+
self.assertEqual(stack_config.resolve_deployment_mode("trusted_team"), "public_multi_user")
|
|
64
|
+
self.assertEqual(stack_config.effective_deployment_mode("trusted_team"), "public_multi_user")
|
|
65
|
+
self.assertEqual(self.server._resolve_deployment_mode(), "public_multi_user")
|
|
66
|
+
|
|
67
|
+
def test_invite_trust_not_public_post(self) -> None:
|
|
68
|
+
from http.server import BaseHTTPRequestHandler
|
|
69
|
+
|
|
70
|
+
handler = mock.Mock(spec=BaseHTTPRequestHandler)
|
|
71
|
+
handler.command = "POST"
|
|
72
|
+
handler.path = "/api/auth/invite-trust"
|
|
73
|
+
handler.headers = {}
|
|
74
|
+
with mock.patch.object(self.server, "_session_id_from_request", return_value=""):
|
|
75
|
+
self.assertFalse(self.server._auth_check(handler))
|
|
76
|
+
|
|
77
|
+
def test_trusted_team_stranger_denied_at_auth_start_policy(self) -> None:
|
|
78
|
+
self.server.DEPLOYMENT_MODE = "trusted_team"
|
|
79
|
+
with mock.patch.object(self.server, "_install_window_open", return_value=False):
|
|
80
|
+
self.assertTrue(self.server._invite_only_login_enforced())
|
|
81
|
+
allowed, meta = self.server._email_allowed_to_authenticate("stranger@evil.test")
|
|
82
|
+
self.assertFalse(allowed)
|
|
83
|
+
self.assertEqual(meta.get("error"), "private_workspace")
|
|
84
|
+
|
|
85
|
+
def test_install_url_test_get_allowed_without_session_during_install(self) -> None:
|
|
86
|
+
from http.server import BaseHTTPRequestHandler
|
|
87
|
+
|
|
88
|
+
stack_config.patch_stack_config({"install_complete": False})
|
|
89
|
+
handler = mock.Mock(spec=BaseHTTPRequestHandler)
|
|
90
|
+
handler.command = "GET"
|
|
91
|
+
handler.path = "/api/install/url/test?url=https://example.com"
|
|
92
|
+
handler.headers = {}
|
|
93
|
+
with mock.patch.object(self.server, "_install_window_open", return_value=True):
|
|
94
|
+
with mock.patch.object(self.server, "_session_id_from_request", return_value=""):
|
|
95
|
+
self.assertTrue(self.server._auth_check(handler))
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
if __name__ == "__main__":
|
|
99
|
+
unittest.main()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
import auth_rate_limit
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AuthRateLimitTests(unittest.TestCase):
|
|
7
|
+
def setUp(self) -> None:
|
|
8
|
+
auth_rate_limit.reset_for_tests()
|
|
9
|
+
|
|
10
|
+
def test_blocks_burst_auth_start(self) -> None:
|
|
11
|
+
ip = "198.51.100.9"
|
|
12
|
+
email = "user@example.com"
|
|
13
|
+
for _ in range(5):
|
|
14
|
+
self.assertTrue(auth_rate_limit.allow_auth_request("start", ip, email))
|
|
15
|
+
self.assertFalse(auth_rate_limit.allow_auth_request("start", ip, email))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
if __name__ == "__main__":
|
|
19
|
+
unittest.main()
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
import server
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AvatarResolveTests(unittest.TestCase):
|
|
7
|
+
def test_avatar_url_for_id_uses_catalog_file(self) -> None:
|
|
8
|
+
url = server._avatar_url_for_id("ada")
|
|
9
|
+
self.assertTrue(url.endswith("/ada.png"))
|
|
10
|
+
|
|
11
|
+
def test_resolve_avatar_fields_from_id(self) -> None:
|
|
12
|
+
row = {"avatar_id": "grace"}
|
|
13
|
+
server._resolve_avatar_fields(row)
|
|
14
|
+
self.assertIn("avatar_url", row)
|
|
15
|
+
self.assertTrue(str(row["avatar_url"]).endswith("/grace.png"))
|
|
16
|
+
|
|
17
|
+
def test_avatar_id_from_catalog_url(self) -> None:
|
|
18
|
+
catalog_id = str((server._load_avatar_catalog().get("avatars") or [{}])[0].get("id") or "")
|
|
19
|
+
self.assertTrue(catalog_id)
|
|
20
|
+
url = server._avatar_url_for_id(catalog_id)
|
|
21
|
+
self.assertEqual(server._avatar_id_from_url(url), catalog_id)
|
|
22
|
+
|
|
23
|
+
def test_avatar_id_from_custom_url_is_empty(self) -> None:
|
|
24
|
+
self.assertEqual(server._avatar_id_from_url("/files/uploads/my-face.png"), "")
|
|
25
|
+
|
|
26
|
+
def test_explicit_url_survives_resolve_after_reconcile(self) -> None:
|
|
27
|
+
# Reconciled catalog pick: id matches url, resolver reproduces the chosen url.
|
|
28
|
+
catalog_id = str((server._load_avatar_catalog().get("avatars") or [{}])[0].get("id") or "")
|
|
29
|
+
chosen = server._avatar_url_for_id(catalog_id)
|
|
30
|
+
row = {"avatar_url": chosen, "avatar_id": server._avatar_id_from_url(chosen)}
|
|
31
|
+
server._resolve_avatar_fields(row)
|
|
32
|
+
self.assertEqual(row["avatar_url"], chosen)
|
|
33
|
+
|
|
34
|
+
def test_custom_url_survives_resolve_when_id_cleared(self) -> None:
|
|
35
|
+
row = {"avatar_url": "/files/uploads/my-face.png", "avatar_id": ""}
|
|
36
|
+
server._resolve_avatar_fields(row)
|
|
37
|
+
self.assertEqual(row["avatar_url"], "/files/uploads/my-face.png")
|
|
38
|
+
|
|
39
|
+
def test_avatar_id_from_vite_hashed_url(self) -> None:
|
|
40
|
+
self.assertEqual(server._avatar_id_from_url("/assets/frida-DAkwYbrd.png"), "frida")
|
|
41
|
+
self.assertEqual(
|
|
42
|
+
server._avatar_id_from_url("http://127.0.0.1:18644/assets/steve-CvzbBEg_.png"),
|
|
43
|
+
"steve",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def test_normalize_agent_avatar_patch_stable(self) -> None:
|
|
47
|
+
out = server._normalize_agent_avatar_patch("/assets/frida-DAkwYbrd.png", "")
|
|
48
|
+
self.assertEqual(out["avatar_id"], "frida")
|
|
49
|
+
self.assertTrue(out["avatar_url"].endswith("/frida.png"))
|
|
50
|
+
|
|
51
|
+
def test_native_assign_uses_steve(self) -> None:
|
|
52
|
+
native = str(server.NATIVE_PROFILE or "workframe-agent")
|
|
53
|
+
picked = server._assign_agent_avatar(native)
|
|
54
|
+
self.assertEqual(picked["avatar_id"], "steve")
|
|
55
|
+
self.assertTrue(picked["avatar_url"].endswith("/steve.png"))
|
|
56
|
+
|
|
57
|
+
def test_normalize_user_avatar_vite_hash(self) -> None:
|
|
58
|
+
out = server._normalize_user_avatar_url("/assets/grace-CnKLjc4q.png")
|
|
59
|
+
self.assertTrue(out.endswith("/grace.png"))
|
|
60
|
+
|
|
61
|
+
def test_normalize_logo_vite_hash(self) -> None:
|
|
62
|
+
out = server._normalize_logo_url("/assets/4-DGVBPxhf.png")
|
|
63
|
+
self.assertTrue(out.endswith("/4.png"))
|
|
64
|
+
|
|
65
|
+
def test_pick_logo_url_from_catalog(self) -> None:
|
|
66
|
+
url = server._pick_logo_url()
|
|
67
|
+
self.assertTrue(url.startswith("/assets/project-logos/"))
|
|
68
|
+
self.assertTrue(url.endswith(".png"))
|
|
69
|
+
|
|
70
|
+
def test_pick_user_avatar_url_from_catalog(self) -> None:
|
|
71
|
+
url = server._pick_user_avatar_url()
|
|
72
|
+
self.assertTrue(url.startswith("/assets/avatars/"))
|
|
73
|
+
self.assertTrue(url.endswith(".png"))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if __name__ == "__main__":
|
|
77
|
+
unittest.main()
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Child agent SOUL templates and native overlay seeding."""
|
|
2
|
+
import tempfile
|
|
3
|
+
import unittest
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from unittest import mock
|
|
6
|
+
|
|
7
|
+
import server
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ChildSoulTemplateTests(unittest.TestCase):
|
|
11
|
+
def test_format_child_template_expands_native_agent_name(self) -> None:
|
|
12
|
+
body = server._format_child_template(
|
|
13
|
+
server._CHILD_SOUL_TEMPLATE,
|
|
14
|
+
display_name="Elvis",
|
|
15
|
+
role="Rock legend",
|
|
16
|
+
)
|
|
17
|
+
self.assertNotIn("{nativeAgentName}", body)
|
|
18
|
+
self.assertIn("Workframe Agent", body)
|
|
19
|
+
self.assertIn("Elvis", body)
|
|
20
|
+
|
|
21
|
+
def test_install_child_base_artifacts_no_placeholder_error(self) -> None:
|
|
22
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
23
|
+
root = Path(tmp)
|
|
24
|
+
prof = "elvis"
|
|
25
|
+
prof_dir = root / "profiles" / prof
|
|
26
|
+
prof_dir.mkdir(parents=True)
|
|
27
|
+
(prof_dir / "SOUL.md").write_text("test", encoding="utf-8")
|
|
28
|
+
with mock.patch.object(server, "_profile_dir", side_effect=lambda p: root / "profiles" / p), mock.patch.object(
|
|
29
|
+
server, "PROJECT_NAME", "Workframe"
|
|
30
|
+
), mock.patch.object(server, "_is_native_profile", return_value=False):
|
|
31
|
+
ok = server._install_child_base_artifacts(prof, display_name="Elvis", role="Rock legend")
|
|
32
|
+
self.assertTrue(ok)
|
|
33
|
+
agents = (prof_dir / "AGENTS.md").read_text(encoding="utf-8")
|
|
34
|
+
self.assertNotIn("{nativeAgentName}", agents)
|
|
35
|
+
|
|
36
|
+
def test_seed_native_user_overlay_keeps_base_soul(self) -> None:
|
|
37
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
38
|
+
root = Path(tmp)
|
|
39
|
+
template = root / "profiles" / "workframe-agent"
|
|
40
|
+
runtime = root / "profiles" / "u-user-workframe-agent"
|
|
41
|
+
template.mkdir(parents=True)
|
|
42
|
+
runtime.mkdir(parents=True)
|
|
43
|
+
(template / "SOUL.md").write_text(
|
|
44
|
+
"# Workframe Agent\n\nBase native system prompt.\n" + ("operate. " * 20),
|
|
45
|
+
encoding="utf-8",
|
|
46
|
+
)
|
|
47
|
+
(runtime / "SOUL.md").write_text("test", encoding="utf-8")
|
|
48
|
+
agents = root / "workframe" / "agents.json"
|
|
49
|
+
agents.parent.mkdir(parents=True)
|
|
50
|
+
agents.write_text('{"version":1,"agents":{}}', encoding="utf-8")
|
|
51
|
+
with mock.patch.object(server, "_profile_dir", side_effect=lambda p: root / "profiles" / p), mock.patch.object(
|
|
52
|
+
server, "AGENTS_JSON", agents
|
|
53
|
+
), mock.patch.object(server, "_is_runtime_profile_slug", return_value=True), mock.patch.object(
|
|
54
|
+
server, "_runtime_template_slug", return_value="workframe-agent"
|
|
55
|
+
):
|
|
56
|
+
server._seed_native_user_overlay(
|
|
57
|
+
"u-user-workframe-agent",
|
|
58
|
+
"workframe-agent",
|
|
59
|
+
display_name="Andy",
|
|
60
|
+
user_soul="Always be cheerful.",
|
|
61
|
+
)
|
|
62
|
+
base = (runtime / "SOUL.md").read_text(encoding="utf-8")
|
|
63
|
+
merged = server._profile_soul_text("u-user-workframe-agent")
|
|
64
|
+
self.assertIn("Base native system prompt", base)
|
|
65
|
+
self.assertIn("Base native system prompt", merged)
|
|
66
|
+
self.assertIn("## Additional instructions", merged)
|
|
67
|
+
self.assertIn("Always be cheerful.", merged)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
unittest.main()
|