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,125 @@
|
|
|
1
|
+
"""Internal proxy auth + Google OIDC verification."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import tempfile
|
|
8
|
+
import unittest
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from unittest.mock import patch
|
|
11
|
+
|
|
12
|
+
import google_auth
|
|
13
|
+
import internal_proxy_auth
|
|
14
|
+
import llm_proxy
|
|
15
|
+
import oidc_jwt
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class InternalProxyAuthTests(unittest.TestCase):
|
|
19
|
+
def setUp(self) -> None:
|
|
20
|
+
internal_proxy_auth.reset_proxy_token_for_tests()
|
|
21
|
+
os.environ.pop("WORKFRAME_PROXY_TOKEN", None)
|
|
22
|
+
|
|
23
|
+
def tearDown(self) -> None:
|
|
24
|
+
internal_proxy_auth.reset_proxy_token_for_tests()
|
|
25
|
+
os.environ.pop("WORKFRAME_PROXY_TOKEN", None)
|
|
26
|
+
|
|
27
|
+
def test_private_ip_allows_without_token_when_unconfigured(self) -> None:
|
|
28
|
+
self.assertTrue(internal_proxy_auth.is_internal_client("172.19.0.2"))
|
|
29
|
+
self.assertFalse(internal_proxy_auth.is_internal_client("8.8.8.8"))
|
|
30
|
+
|
|
31
|
+
class _H:
|
|
32
|
+
client_address = ("172.19.0.2", 1)
|
|
33
|
+
headers = {}
|
|
34
|
+
|
|
35
|
+
ok, err = internal_proxy_auth.authorize_internal_proxy(_H()) # type: ignore[arg-type]
|
|
36
|
+
self.assertTrue(ok)
|
|
37
|
+
self.assertEqual(err, "")
|
|
38
|
+
|
|
39
|
+
def test_configured_token_requires_header(self) -> None:
|
|
40
|
+
os.environ["WORKFRAME_PROXY_TOKEN"] = "secret-proxy"
|
|
41
|
+
|
|
42
|
+
class _H:
|
|
43
|
+
client_address = ("172.19.0.2", 1)
|
|
44
|
+
headers = {"X-Workframe-Proxy-Token": "secret-proxy"}
|
|
45
|
+
|
|
46
|
+
ok, err = internal_proxy_auth.authorize_internal_proxy(_H()) # type: ignore[arg-type]
|
|
47
|
+
self.assertTrue(ok)
|
|
48
|
+
|
|
49
|
+
_H.headers = {}
|
|
50
|
+
ok, err = internal_proxy_auth.authorize_internal_proxy(_H()) # type: ignore[arg-type]
|
|
51
|
+
self.assertFalse(ok)
|
|
52
|
+
self.assertEqual(err, "proxy token required")
|
|
53
|
+
|
|
54
|
+
def test_llm_proxy_rejects_missing_token(self) -> None:
|
|
55
|
+
os.environ["WORKFRAME_PROXY_TOKEN"] = "secret-proxy"
|
|
56
|
+
|
|
57
|
+
class FakeWriter:
|
|
58
|
+
def __init__(self) -> None:
|
|
59
|
+
self.data = b""
|
|
60
|
+
|
|
61
|
+
def write(self, chunk: bytes) -> None:
|
|
62
|
+
self.data += chunk
|
|
63
|
+
|
|
64
|
+
def flush(self) -> None:
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
class FakeHandler:
|
|
68
|
+
client_address = ("172.19.0.2", 1)
|
|
69
|
+
headers = {"Authorization": "Bearer wf_rt_test"}
|
|
70
|
+
|
|
71
|
+
def __init__(self) -> None:
|
|
72
|
+
self.wfile = FakeWriter()
|
|
73
|
+
self.status = 0
|
|
74
|
+
|
|
75
|
+
def send_response(self, status: int) -> None:
|
|
76
|
+
self.status = status
|
|
77
|
+
|
|
78
|
+
def send_header(self, _key: str, _value: str) -> None:
|
|
79
|
+
pass
|
|
80
|
+
|
|
81
|
+
def end_headers(self) -> None:
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
handler = FakeHandler()
|
|
85
|
+
handled = llm_proxy.handle_proxy_request(
|
|
86
|
+
handler,
|
|
87
|
+
"/internal/llm/openrouter/v1/chat/completions",
|
|
88
|
+
"POST",
|
|
89
|
+
b"{}",
|
|
90
|
+
resolve_secret=lambda *_args: ("OPENROUTER_API_KEY", "sk-test"),
|
|
91
|
+
)
|
|
92
|
+
self.assertTrue(handled)
|
|
93
|
+
self.assertEqual(handler.status, 403)
|
|
94
|
+
self.assertIn(b"proxy token required", handler.wfile.data)
|
|
95
|
+
|
|
96
|
+
def test_bootstrap_writes_shared_and_data_files(self) -> None:
|
|
97
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
98
|
+
os.environ["WORKFRAME_API_DATA_DIR"] = tmp
|
|
99
|
+
internal_proxy_auth.reset_proxy_token_for_tests()
|
|
100
|
+
token = internal_proxy_auth.bootstrap_proxy_token(allow_generate_file=True)
|
|
101
|
+
self.assertTrue(token)
|
|
102
|
+
self.assertTrue((Path(tmp) / ".proxy_token").is_file())
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class GoogleOidcTests(unittest.TestCase):
|
|
106
|
+
def test_verify_google_id_token_checks_signature(self) -> None:
|
|
107
|
+
with patch.object(oidc_jwt, "verify_rs256_id_token") as verify:
|
|
108
|
+
verify.return_value = {
|
|
109
|
+
"email": "user@example.com",
|
|
110
|
+
"name": "User",
|
|
111
|
+
"email_verified": True,
|
|
112
|
+
}
|
|
113
|
+
with patch.object(google_auth, "_google_creds", return_value=("client-id", "secret")):
|
|
114
|
+
google_auth._PENDING["state-1"] = {"invite_email": "", "invite_token": ""}
|
|
115
|
+
with patch.object(google_auth.urllib.request, "urlopen") as urlopen:
|
|
116
|
+
urlopen.return_value.__enter__.return_value.read.return_value = json.dumps(
|
|
117
|
+
{"id_token": "header.payload.sig"}
|
|
118
|
+
).encode()
|
|
119
|
+
profile = google_auth.exchange_google_code("code", "state-1")
|
|
120
|
+
verify.assert_called_once()
|
|
121
|
+
self.assertEqual(profile["email"], "user@example.com")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if __name__ == "__main__":
|
|
125
|
+
unittest.main()
|
|
@@ -0,0 +1,72 @@
|
|
|
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 InviteRuntimeBootstrapTests(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
|
+
self._old_hermes_data = server.HERMES_DATA
|
|
17
|
+
server.DATA_DIR = Path(self._tmp.name)
|
|
18
|
+
server.AUTH_DB_PATH = Path(self._tmp.name) / "auth.db"
|
|
19
|
+
server.HERMES_DATA = Path(self._tmp.name) / "hermes"
|
|
20
|
+
(server.HERMES_DATA / "profiles").mkdir(parents=True)
|
|
21
|
+
ensure_workframe_schemas()
|
|
22
|
+
self.workspace_id = "ws-invite"
|
|
23
|
+
self.user_id = "user-invited"
|
|
24
|
+
self.agent_one_id = "a1111111-1111-4111-8111-111111111111"
|
|
25
|
+
self.agent_two_id = "b2222222-2222-4222-8222-222222222222"
|
|
26
|
+
conn = server._workframe_db()
|
|
27
|
+
try:
|
|
28
|
+
now = "1"
|
|
29
|
+
conn.execute(
|
|
30
|
+
"INSERT INTO workspaces (id, slug, display_name, owner_id, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
31
|
+
(self.workspace_id, "invite", "Invite", "owner-1", "active", now, now),
|
|
32
|
+
)
|
|
33
|
+
conn.execute(
|
|
34
|
+
"INSERT INTO users (id, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?)",
|
|
35
|
+
(self.user_id, "Invited", "member", "active", now, now),
|
|
36
|
+
)
|
|
37
|
+
for ap_id, slug in (
|
|
38
|
+
(self.agent_one_id, "agent-one"),
|
|
39
|
+
(self.agent_two_id, "agent-two"),
|
|
40
|
+
):
|
|
41
|
+
conn.execute(
|
|
42
|
+
"""
|
|
43
|
+
INSERT INTO agent_profiles (
|
|
44
|
+
id, workspace_id, slug, display_name, is_native, status, created_at, updated_at
|
|
45
|
+
) VALUES (?, ?, ?, ?, 0, 'available', ?, ?)
|
|
46
|
+
""",
|
|
47
|
+
(ap_id, self.workspace_id, slug, slug, now, now),
|
|
48
|
+
)
|
|
49
|
+
conn.commit()
|
|
50
|
+
finally:
|
|
51
|
+
conn.close()
|
|
52
|
+
|
|
53
|
+
def tearDown(self) -> None:
|
|
54
|
+
server.DATA_DIR = self._old_data_dir
|
|
55
|
+
server.AUTH_DB_PATH = self._old_auth_db_path
|
|
56
|
+
server.HERMES_DATA = self._old_hermes_data
|
|
57
|
+
|
|
58
|
+
@patch.object(server, "resolve_validated_profile", side_effect=lambda slug: slug)
|
|
59
|
+
@patch.object(server, "_runtime_profile_on_disk", return_value=False)
|
|
60
|
+
@patch.object(server, "ensure_runtime_profile")
|
|
61
|
+
def test_provision_invited_member_agent_runtimes(
|
|
62
|
+
self,
|
|
63
|
+
mock_ensure,
|
|
64
|
+
_on_disk,
|
|
65
|
+
_validate,
|
|
66
|
+
) -> None:
|
|
67
|
+
server._provision_invited_member_agent_runtimes(self.workspace_id, self.user_id)
|
|
68
|
+
self.assertEqual(mock_ensure.call_count, 2)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if __name__ == "__main__":
|
|
72
|
+
unittest.main()
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"""Kanban assignee validation with delegation grants and workspace board mapping."""
|
|
2
|
+
|
|
3
|
+
import tempfile
|
|
4
|
+
import unittest
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from unittest.mock import patch
|
|
7
|
+
|
|
8
|
+
import server
|
|
9
|
+
import credential_vault
|
|
10
|
+
import vault_kek
|
|
11
|
+
from db_setup import ensure_workframe_schemas
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class KanbanDelegationTests(unittest.TestCase):
|
|
15
|
+
def setUp(self) -> None:
|
|
16
|
+
self._tmp = tempfile.TemporaryDirectory()
|
|
17
|
+
self.addCleanup(self._tmp.cleanup)
|
|
18
|
+
self._old_data_dir = server.DATA_DIR
|
|
19
|
+
self._old_auth_db_path = server.AUTH_DB_PATH
|
|
20
|
+
self._old_hermes_data = server.HERMES_DATA
|
|
21
|
+
server.DATA_DIR = Path(self._tmp.name)
|
|
22
|
+
server.AUTH_DB_PATH = Path(self._tmp.name) / "auth.db"
|
|
23
|
+
server.HERMES_DATA = Path(self._tmp.name) / "hermes"
|
|
24
|
+
(server.HERMES_DATA / "profiles").mkdir(parents=True)
|
|
25
|
+
credential_vault.DATA_DIR = server.DATA_DIR
|
|
26
|
+
credential_vault.VAULT_DB = server.DATA_DIR / "credential_vault.db"
|
|
27
|
+
vault_kek.DATA_DIR = server.DATA_DIR
|
|
28
|
+
vault_kek.VAULT_KEK_FILE = server.DATA_DIR / ".vault_kek"
|
|
29
|
+
credential_vault.ensure_schema()
|
|
30
|
+
credential_vault.unseal_for_tests()
|
|
31
|
+
ensure_workframe_schemas()
|
|
32
|
+
self.workspace_id = "ws-kanban"
|
|
33
|
+
self.user_a = "cb6a2db4-ac86-4c49-8247-14a1d68aca72"
|
|
34
|
+
self.user_b = "44fb344c-0954-47b6-a19a-ebbcf20e9680"
|
|
35
|
+
conn = server._workframe_db()
|
|
36
|
+
try:
|
|
37
|
+
now = "1"
|
|
38
|
+
conn.execute(
|
|
39
|
+
"INSERT INTO workspaces (id, slug, display_name, owner_id, status, created_at, updated_at) VALUES (?,?,?,?,?,?,?)",
|
|
40
|
+
(self.workspace_id, "dogfood", "Dogfood", self.user_a, "active", now, now),
|
|
41
|
+
)
|
|
42
|
+
for uid, name in ((self.user_a, "Fab"), (self.user_b, "Alan")):
|
|
43
|
+
conn.execute(
|
|
44
|
+
"INSERT INTO users (id, display_name, role, status, created_at, updated_at) VALUES (?,?,?,?,?,?)",
|
|
45
|
+
(uid, name, "member", "active", now, now),
|
|
46
|
+
)
|
|
47
|
+
conn.execute(
|
|
48
|
+
"""
|
|
49
|
+
INSERT INTO workspace_memberships (id, workspace_id, user_id, role, status, created_at, updated_at)
|
|
50
|
+
VALUES (?, ?, ?, 'member', 'active', ?, ?)
|
|
51
|
+
""",
|
|
52
|
+
(f"wm-{uid}", self.workspace_id, uid, now, now),
|
|
53
|
+
)
|
|
54
|
+
for slug, name in (("workframe-agent", "Workframe Agent"), ("architect", "Architect")):
|
|
55
|
+
conn.execute(
|
|
56
|
+
"""
|
|
57
|
+
INSERT INTO agent_profiles (id, workspace_id, slug, display_name, is_native, status, created_at, updated_at)
|
|
58
|
+
VALUES (?, ?, ?, ?, ?, 'available', ?, ?)
|
|
59
|
+
""",
|
|
60
|
+
(f"ap-{slug}", self.workspace_id, slug, name, slug == "workframe-agent", now, now),
|
|
61
|
+
)
|
|
62
|
+
conn.commit()
|
|
63
|
+
finally:
|
|
64
|
+
conn.close()
|
|
65
|
+
self.runtime_a_arch = server._runtime_profile_slug(self.user_a, "architect")
|
|
66
|
+
self.runtime_b_arch = server._runtime_profile_slug(self.user_b, "architect")
|
|
67
|
+
|
|
68
|
+
def tearDown(self) -> None:
|
|
69
|
+
server.DATA_DIR = self._old_data_dir
|
|
70
|
+
server.AUTH_DB_PATH = self._old_auth_db_path
|
|
71
|
+
server.HERMES_DATA = self._old_hermes_data
|
|
72
|
+
|
|
73
|
+
def test_cross_user_assignee_blocked_without_grant(self) -> None:
|
|
74
|
+
ok, reason = server.validate_kanban_assignee(
|
|
75
|
+
self.runtime_a_arch,
|
|
76
|
+
self.user_b,
|
|
77
|
+
self.workspace_id,
|
|
78
|
+
)
|
|
79
|
+
self.assertFalse(ok)
|
|
80
|
+
self.assertEqual(reason, "assignee_owner_forbidden")
|
|
81
|
+
|
|
82
|
+
def test_delegate_grant_allows_cross_user_assignee(self) -> None:
|
|
83
|
+
server.create_delegation_grant(self.workspace_id, self.user_a, self.user_b)
|
|
84
|
+
ok, reason = server.validate_kanban_assignee(
|
|
85
|
+
self.runtime_a_arch,
|
|
86
|
+
self.user_b,
|
|
87
|
+
self.workspace_id,
|
|
88
|
+
)
|
|
89
|
+
self.assertTrue(ok)
|
|
90
|
+
self.assertEqual(reason, self.user_a)
|
|
91
|
+
|
|
92
|
+
def test_template_assignee_forbidden_by_default(self) -> None:
|
|
93
|
+
ok, reason = server.validate_kanban_assignee("architect", self.user_a, self.workspace_id)
|
|
94
|
+
self.assertFalse(ok)
|
|
95
|
+
self.assertEqual(reason, "template_assignee_forbidden")
|
|
96
|
+
|
|
97
|
+
@patch.object(server, "_gateway_exec", return_value=(0, "created t_test"))
|
|
98
|
+
@patch.object(server, "resolve_runtime_assignee", side_effect=lambda t, u, w: server._runtime_profile_slug(u, t))
|
|
99
|
+
def test_kanban_proxy_create_rejects_cross_user(self, _resolve, _exec) -> None:
|
|
100
|
+
with self.assertRaises(PermissionError):
|
|
101
|
+
server.kanban_proxy_create_task(
|
|
102
|
+
self.workspace_id,
|
|
103
|
+
self.user_b,
|
|
104
|
+
{"title": "nope", "template_slug": "architect", "assignee_user_id": self.user_a},
|
|
105
|
+
)
|
|
106
|
+
_exec.assert_not_called()
|
|
107
|
+
|
|
108
|
+
@patch.object(server, "_gateway_exec", return_value=(0, "created t_ok"))
|
|
109
|
+
@patch.object(server, "resolve_runtime_assignee", side_effect=lambda t, u, w: server._runtime_profile_slug(u, t))
|
|
110
|
+
def test_kanban_proxy_create_with_grant(self, _resolve, _exec) -> None:
|
|
111
|
+
server.create_delegation_grant(self.workspace_id, self.user_a, self.user_b)
|
|
112
|
+
result = server.kanban_proxy_create_task(
|
|
113
|
+
self.workspace_id,
|
|
114
|
+
self.user_b,
|
|
115
|
+
{"title": "ok", "template_slug": "architect", "assignee_user_id": self.user_a},
|
|
116
|
+
)
|
|
117
|
+
self.assertTrue(result["ok"])
|
|
118
|
+
_exec.assert_called_once()
|
|
119
|
+
args = _exec.call_args[0][1]
|
|
120
|
+
self.assertIn("--board", args)
|
|
121
|
+
self.assertIn(self.runtime_a_arch, args)
|
|
122
|
+
|
|
123
|
+
def test_ensure_workspace_kanban_board_persists_slug(self) -> None:
|
|
124
|
+
with patch.object(server, "_gateway_exec", return_value=(0, "ok")):
|
|
125
|
+
slug = server.ensure_workspace_kanban_board(self.workspace_id)
|
|
126
|
+
self.assertEqual(slug, "dogfood")
|
|
127
|
+
row = server._workspace_kanban_board_row(self.workspace_id)
|
|
128
|
+
self.assertIsNotNone(row)
|
|
129
|
+
self.assertEqual(str(row["hermes_board_slug"]), "dogfood")
|
|
130
|
+
|
|
131
|
+
@patch.object(server, "ensure_workspace_kanban_board", return_value="dogfood")
|
|
132
|
+
@patch.object(server, "_gateway_exec", return_value=(0, "created t_cred"))
|
|
133
|
+
@patch.object(server, "resolve_runtime_assignee", side_effect=lambda t, u, w: server._runtime_profile_slug(u, t))
|
|
134
|
+
def test_delegated_kanban_uses_assignee_owner_credentials(
|
|
135
|
+
self,
|
|
136
|
+
_resolve: object,
|
|
137
|
+
_exec: object,
|
|
138
|
+
_board: object,
|
|
139
|
+
) -> None:
|
|
140
|
+
"""Bob delegates to Alice's runtime; credentials must be Alice's, not Bob's."""
|
|
141
|
+
server.create_delegation_grant(self.workspace_id, self.user_a, self.user_b)
|
|
142
|
+
prof_dir = server._profile_dir(self.runtime_a_arch)
|
|
143
|
+
prof_dir.mkdir(parents=True, exist_ok=True)
|
|
144
|
+
(prof_dir / "config.yaml").write_text(
|
|
145
|
+
"model:\n default: openrouter/test\n provider: openrouter\n",
|
|
146
|
+
encoding="utf-8",
|
|
147
|
+
)
|
|
148
|
+
server._user_hermes_home(self.user_a).mkdir(parents=True, exist_ok=True)
|
|
149
|
+
server._user_hermes_home(self.user_b).mkdir(parents=True, exist_ok=True)
|
|
150
|
+
credential_vault.store_secret(
|
|
151
|
+
"alice-or", "sk-alice-owner", env_var="OPENROUTER_API_KEY", provider="openrouter", user_id=self.user_a,
|
|
152
|
+
)
|
|
153
|
+
conn = server._workframe_db()
|
|
154
|
+
try:
|
|
155
|
+
now = "1"
|
|
156
|
+
conn.execute(
|
|
157
|
+
"""
|
|
158
|
+
INSERT INTO credential_bindings (
|
|
159
|
+
id, workspace_id, user_id, agent_profile_id, provider,
|
|
160
|
+
credential_type, credential_ref, label, is_active,
|
|
161
|
+
expires_at, created_by, created_at, updated_at, deleted_at
|
|
162
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
163
|
+
""",
|
|
164
|
+
(
|
|
165
|
+
"alice-or", None, self.user_a, None, "openrouter",
|
|
166
|
+
"api_key", credential_vault.vault_ref("alice-or"), "Alice OR", 1, None, self.user_a,
|
|
167
|
+
now, now, None,
|
|
168
|
+
),
|
|
169
|
+
)
|
|
170
|
+
conn.commit()
|
|
171
|
+
finally:
|
|
172
|
+
conn.close()
|
|
173
|
+
server.kanban_proxy_create_task(
|
|
174
|
+
self.workspace_id,
|
|
175
|
+
self.user_b,
|
|
176
|
+
{"title": "delegated", "template_slug": "architect", "assignee_user_id": self.user_a},
|
|
177
|
+
)
|
|
178
|
+
env_text = (prof_dir / ".env").read_text(encoding="utf-8") if (prof_dir / ".env").is_file() else ""
|
|
179
|
+
self.assertNotIn("sk-alice-owner", env_text)
|
|
180
|
+
self.assertNotIn("sk-bob-initiator", env_text)
|
|
181
|
+
self.assertTrue(server._user_can_use_llm(self.user_a, self.workspace_id))
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
if __name__ == "__main__":
|
|
185
|
+
unittest.main()
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""LLM proxy path normalization."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import unittest
|
|
5
|
+
from unittest.mock import patch
|
|
6
|
+
|
|
7
|
+
import internal_proxy_auth
|
|
8
|
+
import llm_proxy
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LlmProxyPathTests(unittest.TestCase):
|
|
12
|
+
def setUp(self) -> None:
|
|
13
|
+
internal_proxy_auth.reset_proxy_token_for_tests()
|
|
14
|
+
os.environ.pop("WORKFRAME_PROXY_TOKEN", None)
|
|
15
|
+
|
|
16
|
+
def tearDown(self) -> None:
|
|
17
|
+
internal_proxy_auth.reset_proxy_token_for_tests()
|
|
18
|
+
os.environ.pop("WORKFRAME_PROXY_TOKEN", None)
|
|
19
|
+
def test_normalize_dedup_v1_prefix(self) -> None:
|
|
20
|
+
base = "https://openrouter.ai/api/v1"
|
|
21
|
+
self.assertEqual(
|
|
22
|
+
llm_proxy.normalize_upstream_path(base, "/v1/chat/completions"),
|
|
23
|
+
"/chat/completions",
|
|
24
|
+
)
|
|
25
|
+
self.assertEqual(llm_proxy.normalize_upstream_path(base, "/v1"), "")
|
|
26
|
+
|
|
27
|
+
def test_normalize_keeps_other_paths(self) -> None:
|
|
28
|
+
base = "https://api.anthropic.com"
|
|
29
|
+
self.assertEqual(
|
|
30
|
+
llm_proxy.normalize_upstream_path(base, "/v1/messages"),
|
|
31
|
+
"/v1/messages",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def test_handler_streams_success_response_chunks(self) -> None:
|
|
35
|
+
class FakeResponse:
|
|
36
|
+
status = 200
|
|
37
|
+
headers = {"Content-Type": "text/event-stream"}
|
|
38
|
+
|
|
39
|
+
def __init__(self) -> None:
|
|
40
|
+
self._chunks = [b"data: one\n\n", b"data: two\n\n", b""]
|
|
41
|
+
|
|
42
|
+
def __enter__(self):
|
|
43
|
+
return self
|
|
44
|
+
|
|
45
|
+
def __exit__(self, *_args):
|
|
46
|
+
return False
|
|
47
|
+
|
|
48
|
+
def read(self, _size: int = -1) -> bytes:
|
|
49
|
+
return self._chunks.pop(0)
|
|
50
|
+
|
|
51
|
+
def readline(self) -> bytes:
|
|
52
|
+
return self._chunks.pop(0)
|
|
53
|
+
|
|
54
|
+
class FakeWriter:
|
|
55
|
+
def __init__(self) -> None:
|
|
56
|
+
self.writes: list[bytes] = []
|
|
57
|
+
self.flushes = 0
|
|
58
|
+
|
|
59
|
+
def write(self, data: bytes) -> None:
|
|
60
|
+
self.writes.append(data)
|
|
61
|
+
|
|
62
|
+
def flush(self) -> None:
|
|
63
|
+
self.flushes += 1
|
|
64
|
+
|
|
65
|
+
class FakeHandler:
|
|
66
|
+
client_address = ("172.19.0.2", 1234)
|
|
67
|
+
headers = {
|
|
68
|
+
"Authorization": "Bearer wf_rt_test",
|
|
69
|
+
"X-Workframe-Profile": "u-alice-architect",
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def __init__(self) -> None:
|
|
73
|
+
self.wfile = FakeWriter()
|
|
74
|
+
self.status = 0
|
|
75
|
+
self.headers_sent: list[tuple[str, str]] = []
|
|
76
|
+
|
|
77
|
+
def send_response(self, status: int) -> None:
|
|
78
|
+
self.status = status
|
|
79
|
+
|
|
80
|
+
def send_header(self, key: str, value: str) -> None:
|
|
81
|
+
self.headers_sent.append((key, value))
|
|
82
|
+
|
|
83
|
+
def end_headers(self) -> None:
|
|
84
|
+
pass
|
|
85
|
+
|
|
86
|
+
handler = FakeHandler()
|
|
87
|
+
with patch.object(
|
|
88
|
+
llm_proxy.turn_credentials,
|
|
89
|
+
"validate_lease",
|
|
90
|
+
return_value={
|
|
91
|
+
"provider": "openrouter",
|
|
92
|
+
"profile_slug": "u-alice-architect",
|
|
93
|
+
},
|
|
94
|
+
), patch.object(
|
|
95
|
+
llm_proxy.turn_credentials,
|
|
96
|
+
"resolve_lease_secret",
|
|
97
|
+
return_value=("OPENROUTER_API_KEY", "sk-test"),
|
|
98
|
+
), patch.object(llm_proxy.urllib.request, "urlopen", return_value=FakeResponse()):
|
|
99
|
+
handled = llm_proxy.handle_proxy_request(
|
|
100
|
+
handler,
|
|
101
|
+
"/internal/llm/openrouter/v1/chat/completions",
|
|
102
|
+
"POST",
|
|
103
|
+
b'{"stream":true}',
|
|
104
|
+
resolve_secret=lambda *_args: ("OPENROUTER_API_KEY", "sk-test"),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
self.assertTrue(handled)
|
|
108
|
+
self.assertEqual(handler.status, 200)
|
|
109
|
+
self.assertEqual(handler.wfile.writes, [b"data: one\n\n", b"data: two\n\n"])
|
|
110
|
+
self.assertEqual(handler.wfile.flushes, 2)
|
|
111
|
+
|
|
112
|
+
def test_lease_rejects_profile_mismatch(self) -> None:
|
|
113
|
+
class FakeHandler:
|
|
114
|
+
client_address = ("172.19.0.2", 1234)
|
|
115
|
+
headers = {
|
|
116
|
+
"Authorization": "Bearer wf_rt_test",
|
|
117
|
+
"X-Workframe-Profile": "u-bob-architect",
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
def __init__(self) -> None:
|
|
121
|
+
self.wfile = type("W", (), {"write": lambda *_a, **_k: None})()
|
|
122
|
+
self.status = 0
|
|
123
|
+
self.body = b""
|
|
124
|
+
|
|
125
|
+
def send_response(self, status: int) -> None:
|
|
126
|
+
self.status = status
|
|
127
|
+
|
|
128
|
+
def send_header(self, _key: str, _value: str) -> None:
|
|
129
|
+
pass
|
|
130
|
+
|
|
131
|
+
def end_headers(self) -> None:
|
|
132
|
+
pass
|
|
133
|
+
|
|
134
|
+
handler = FakeHandler()
|
|
135
|
+
with patch.object(
|
|
136
|
+
llm_proxy.turn_credentials,
|
|
137
|
+
"validate_lease",
|
|
138
|
+
return_value={
|
|
139
|
+
"provider": "openrouter",
|
|
140
|
+
"profile_slug": "u-alice-architect",
|
|
141
|
+
},
|
|
142
|
+
):
|
|
143
|
+
handled = llm_proxy.handle_proxy_request(
|
|
144
|
+
handler,
|
|
145
|
+
"/internal/llm/openrouter/v1/models",
|
|
146
|
+
"GET",
|
|
147
|
+
None,
|
|
148
|
+
resolve_secret=lambda *_args: ("OPENROUTER_API_KEY", "sk-test"),
|
|
149
|
+
)
|
|
150
|
+
self.assertTrue(handled)
|
|
151
|
+
self.assertEqual(handler.status, 403)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
if __name__ == "__main__":
|
|
155
|
+
unittest.main()
|