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,445 @@
|
|
|
1
|
+
"""API-only credential vault — envelope-encrypted secrets (KEK + per-secret DEK)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import base64
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import secrets
|
|
9
|
+
import sqlite3
|
|
10
|
+
import time
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
import vault_kek
|
|
15
|
+
import zk_auth
|
|
16
|
+
|
|
17
|
+
DATA_DIR = Path(os.environ.get("WORKFRAME_API_DATA_DIR", "/app/data"))
|
|
18
|
+
VAULT_DB = DATA_DIR / "credential_vault.db"
|
|
19
|
+
LEGACY_V1 = 1
|
|
20
|
+
ENVELOPE_V2 = 2
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _connect() -> sqlite3.Connection:
|
|
24
|
+
DATA_DIR.mkdir(parents=True, exist_ok=True)
|
|
25
|
+
conn = sqlite3.connect(str(VAULT_DB), timeout=5.0)
|
|
26
|
+
conn.execute("PRAGMA foreign_keys = ON")
|
|
27
|
+
conn.row_factory = sqlite3.Row
|
|
28
|
+
return conn
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _meta_row(conn: sqlite3.Connection) -> sqlite3.Row | None:
|
|
32
|
+
return conn.execute("SELECT * FROM vault_meta WHERE id = 1").fetchone()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# ponytail: ran on every read_secret/store (and again via turn_credentials) — ~11ms/call on
|
|
36
|
+
# bind-mounted sqlite. Guard by DB path: once per process, tests reassign VAULT_DB → re-run.
|
|
37
|
+
_SCHEMA_READY: set[str] = set()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def ensure_schema() -> None:
|
|
41
|
+
key = str(VAULT_DB)
|
|
42
|
+
if key in _SCHEMA_READY:
|
|
43
|
+
return
|
|
44
|
+
conn = _connect()
|
|
45
|
+
try:
|
|
46
|
+
conn.execute(
|
|
47
|
+
"""
|
|
48
|
+
CREATE TABLE IF NOT EXISTS credential_secrets (
|
|
49
|
+
binding_id TEXT PRIMARY KEY,
|
|
50
|
+
encrypted_secret TEXT NOT NULL,
|
|
51
|
+
env_var TEXT NOT NULL DEFAULT '',
|
|
52
|
+
provider TEXT NOT NULL DEFAULT '',
|
|
53
|
+
scope TEXT NOT NULL DEFAULT 'user',
|
|
54
|
+
user_id TEXT DEFAULT NULL,
|
|
55
|
+
workspace_id TEXT DEFAULT NULL,
|
|
56
|
+
created_at TEXT NOT NULL,
|
|
57
|
+
updated_at TEXT NOT NULL
|
|
58
|
+
)
|
|
59
|
+
"""
|
|
60
|
+
)
|
|
61
|
+
conn.execute(
|
|
62
|
+
"CREATE INDEX IF NOT EXISTS idx_credential_secrets_user "
|
|
63
|
+
"ON credential_secrets(user_id, provider)"
|
|
64
|
+
)
|
|
65
|
+
conn.execute(
|
|
66
|
+
"""
|
|
67
|
+
CREATE TABLE IF NOT EXISTS vault_meta (
|
|
68
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
69
|
+
initialized INTEGER NOT NULL DEFAULT 0,
|
|
70
|
+
passphrase_enabled INTEGER NOT NULL DEFAULT 0,
|
|
71
|
+
kdf_salt TEXT DEFAULT NULL,
|
|
72
|
+
wrapped_kek TEXT DEFAULT NULL,
|
|
73
|
+
created_at TEXT NOT NULL,
|
|
74
|
+
updated_at TEXT NOT NULL
|
|
75
|
+
)
|
|
76
|
+
"""
|
|
77
|
+
)
|
|
78
|
+
if not _meta_row(conn):
|
|
79
|
+
now = str(int(time.time()))
|
|
80
|
+
conn.execute(
|
|
81
|
+
"""
|
|
82
|
+
INSERT INTO vault_meta (id, initialized, passphrase_enabled, created_at, updated_at)
|
|
83
|
+
VALUES (1, 0, 0, ?, ?)
|
|
84
|
+
""",
|
|
85
|
+
(now, now),
|
|
86
|
+
)
|
|
87
|
+
conn.commit()
|
|
88
|
+
finally:
|
|
89
|
+
conn.close()
|
|
90
|
+
_SCHEMA_READY.add(key)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def vault_status() -> dict[str, Any]:
|
|
94
|
+
ensure_schema()
|
|
95
|
+
conn = _connect()
|
|
96
|
+
try:
|
|
97
|
+
meta = _meta_row(conn)
|
|
98
|
+
count = int(conn.execute("SELECT COUNT(*) FROM credential_secrets").fetchone()[0])
|
|
99
|
+
finally:
|
|
100
|
+
conn.close()
|
|
101
|
+
initialized = bool(meta and int(meta["initialized"] or 0))
|
|
102
|
+
return {
|
|
103
|
+
"sealed": not vault_kek.kek_in_memory(),
|
|
104
|
+
"initialized": initialized,
|
|
105
|
+
"passphrase_enabled": bool(meta and int(meta["passphrase_enabled"] or 0)),
|
|
106
|
+
"secret_count": count,
|
|
107
|
+
"kek_file_present": vault_kek.VAULT_KEK_FILE.is_file(),
|
|
108
|
+
"env_kek_configured": bool(os.environ.get("WORKFRAME_VAULT_KEK", "").strip()),
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _require_unsealed() -> None:
|
|
113
|
+
if not vault_kek.kek_in_memory():
|
|
114
|
+
raise RuntimeError("vault_sealed")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _encrypt_dek_with_kek(dek: bytes) -> dict[str, str]:
|
|
118
|
+
kek = vault_kek.get_kek()
|
|
119
|
+
iv = os.urandom(12)
|
|
120
|
+
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
|
121
|
+
|
|
122
|
+
ct = AESGCM(kek).encrypt(iv, dek, None)
|
|
123
|
+
return {
|
|
124
|
+
"iv": base64.b64encode(iv).decode("ascii"),
|
|
125
|
+
"tag": base64.b64encode(ct[-16:]).decode("ascii"),
|
|
126
|
+
"ciphertext": base64.b64encode(ct[:-16]).decode("ascii"),
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def _decrypt_dek_with_kek(wrapped: dict[str, Any]) -> bytes:
|
|
131
|
+
kek = vault_kek.get_kek()
|
|
132
|
+
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
|
133
|
+
|
|
134
|
+
iv = base64.b64decode(str(wrapped["iv"]))
|
|
135
|
+
tag = base64.b64decode(str(wrapped["tag"]))
|
|
136
|
+
ct = base64.b64decode(str(wrapped["ciphertext"]))
|
|
137
|
+
dek = AESGCM(kek).decrypt(iv, ct + tag, None)
|
|
138
|
+
if len(dek) != 32:
|
|
139
|
+
raise ValueError("invalid DEK length")
|
|
140
|
+
return dek
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def _encrypt_v2(secret: str) -> str:
|
|
144
|
+
dek = os.urandom(32)
|
|
145
|
+
dek_b64 = base64.b64encode(dek).decode("ascii")
|
|
146
|
+
payload = zk_auth.encrypt_string(str(secret or ""), dek_b64)
|
|
147
|
+
envelope = {
|
|
148
|
+
"v": ENVELOPE_V2,
|
|
149
|
+
"alg": "envelope-aes-gcm",
|
|
150
|
+
"wrapped_dek": _encrypt_dek_with_kek(dek),
|
|
151
|
+
"payload": payload,
|
|
152
|
+
}
|
|
153
|
+
return json.dumps(envelope)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def _decrypt_v2(blob: str) -> str:
|
|
157
|
+
envelope = json.loads(blob)
|
|
158
|
+
if int(envelope.get("v") or 0) != ENVELOPE_V2:
|
|
159
|
+
raise ValueError("not v2 envelope")
|
|
160
|
+
dek_b64 = base64.b64encode(_decrypt_dek_with_kek(envelope["wrapped_dek"])).decode("ascii")
|
|
161
|
+
return zk_auth.decrypt_string(envelope["payload"], dek_b64)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def _decrypt_legacy_v1(blob: str) -> str:
|
|
165
|
+
payload = json.loads(blob) if isinstance(blob, str) else blob
|
|
166
|
+
if not isinstance(payload, dict):
|
|
167
|
+
return ""
|
|
168
|
+
if int(payload.get("v") or 0) == ENVELOPE_V2:
|
|
169
|
+
return _decrypt_v2(blob)
|
|
170
|
+
return zk_auth.decrypt_string(payload, zk_auth.ZK_AUTH_ENCRYPTION_KEY)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _encrypt(secret: str) -> str:
|
|
174
|
+
_require_unsealed()
|
|
175
|
+
return _encrypt_v2(secret)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _decrypt(blob: str) -> str:
|
|
179
|
+
if not str(blob or "").strip():
|
|
180
|
+
return ""
|
|
181
|
+
try:
|
|
182
|
+
parsed = json.loads(blob)
|
|
183
|
+
except json.JSONDecodeError:
|
|
184
|
+
return ""
|
|
185
|
+
version = int(parsed.get("v") or LEGACY_V1) if isinstance(parsed, dict) else LEGACY_V1
|
|
186
|
+
if version == ENVELOPE_V2:
|
|
187
|
+
if not vault_kek.kek_in_memory():
|
|
188
|
+
return ""
|
|
189
|
+
return _decrypt_v2(blob)
|
|
190
|
+
return _decrypt_legacy_v1(blob)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _mark_initialized(passphrase_enabled: bool = False, salt_b64: str = "", wrapped: str = "") -> None:
|
|
194
|
+
now = str(int(time.time()))
|
|
195
|
+
conn = _connect()
|
|
196
|
+
try:
|
|
197
|
+
conn.execute(
|
|
198
|
+
"""
|
|
199
|
+
UPDATE vault_meta
|
|
200
|
+
SET initialized = 1,
|
|
201
|
+
passphrase_enabled = ?,
|
|
202
|
+
kdf_salt = ?,
|
|
203
|
+
wrapped_kek = ?,
|
|
204
|
+
updated_at = ?
|
|
205
|
+
WHERE id = 1
|
|
206
|
+
""",
|
|
207
|
+
(1 if passphrase_enabled else 0, salt_b64 or None, wrapped or None, now),
|
|
208
|
+
)
|
|
209
|
+
conn.commit()
|
|
210
|
+
finally:
|
|
211
|
+
conn.close()
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def bootstrap_vault(*, allow_generate_file: bool = True) -> dict[str, Any]:
|
|
215
|
+
"""Load KEK from env or .vault_kek; optionally generate file on first boot."""
|
|
216
|
+
ensure_schema()
|
|
217
|
+
if vault_kek.kek_in_memory():
|
|
218
|
+
return vault_status()
|
|
219
|
+
if vault_kek.load_kek_from_env():
|
|
220
|
+
_mark_initialized(passphrase_enabled=False)
|
|
221
|
+
return vault_status()
|
|
222
|
+
if vault_kek.load_kek_from_file():
|
|
223
|
+
_mark_initialized(passphrase_enabled=False)
|
|
224
|
+
return vault_status()
|
|
225
|
+
if allow_generate_file and not vault_status()["initialized"]:
|
|
226
|
+
vault_kek.generate_and_persist_kek()
|
|
227
|
+
_mark_initialized(passphrase_enabled=False)
|
|
228
|
+
return vault_status()
|
|
229
|
+
return vault_status()
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def init_vault_passphrase(passphrase: str) -> dict[str, Any]:
|
|
233
|
+
ensure_schema()
|
|
234
|
+
status = vault_status()
|
|
235
|
+
if status["passphrase_enabled"]:
|
|
236
|
+
raise ValueError("vault_passphrase_already_set")
|
|
237
|
+
if not vault_kek.kek_in_memory():
|
|
238
|
+
if not vault_kek.load_kek_from_env() and not vault_kek.load_kek_from_file():
|
|
239
|
+
vault_kek.generate_and_persist_kek()
|
|
240
|
+
salt, wrapped = vault_kek.wrap_kek_for_passphrase(passphrase)
|
|
241
|
+
_mark_initialized(passphrase_enabled=True, salt_b64=salt, wrapped=wrapped)
|
|
242
|
+
_reencrypt_all_secrets()
|
|
243
|
+
return vault_status()
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def unlock_vault(passphrase: str) -> dict[str, Any]:
|
|
247
|
+
ensure_schema()
|
|
248
|
+
conn = _connect()
|
|
249
|
+
try:
|
|
250
|
+
meta = _meta_row(conn)
|
|
251
|
+
finally:
|
|
252
|
+
conn.close()
|
|
253
|
+
if not meta or not int(meta["passphrase_enabled"] or 0):
|
|
254
|
+
raise ValueError("vault_passphrase_not_configured")
|
|
255
|
+
kek = vault_kek.unwrap_kek_from_passphrase(
|
|
256
|
+
passphrase,
|
|
257
|
+
str(meta["kdf_salt"] or ""),
|
|
258
|
+
str(meta["wrapped_kek"] or ""),
|
|
259
|
+
)
|
|
260
|
+
vault_kek.set_kek(kek)
|
|
261
|
+
return vault_status()
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def seal_vault() -> dict[str, Any]:
|
|
265
|
+
vault_kek.clear_kek()
|
|
266
|
+
return vault_status()
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def wipe_all_secrets() -> int:
|
|
270
|
+
"""Emergency delete — ciphertext only; bindings remain but secrets are gone."""
|
|
271
|
+
ensure_schema()
|
|
272
|
+
conn = _connect()
|
|
273
|
+
try:
|
|
274
|
+
cur = conn.execute("DELETE FROM credential_secrets")
|
|
275
|
+
conn.commit()
|
|
276
|
+
return int(cur.rowcount)
|
|
277
|
+
finally:
|
|
278
|
+
conn.close()
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def _reencrypt_all_secrets() -> int:
|
|
282
|
+
_require_unsealed()
|
|
283
|
+
conn = _connect()
|
|
284
|
+
migrated = 0
|
|
285
|
+
try:
|
|
286
|
+
rows = conn.execute(
|
|
287
|
+
"SELECT binding_id, encrypted_secret FROM credential_secrets"
|
|
288
|
+
).fetchall()
|
|
289
|
+
now = str(int(time.time()))
|
|
290
|
+
for row in rows:
|
|
291
|
+
plain = _decrypt(str(row["encrypted_secret"] or ""))
|
|
292
|
+
if not plain:
|
|
293
|
+
continue
|
|
294
|
+
enc = _encrypt_v2(plain)
|
|
295
|
+
conn.execute(
|
|
296
|
+
"UPDATE credential_secrets SET encrypted_secret = ?, updated_at = ? WHERE binding_id = ?",
|
|
297
|
+
(enc, now, str(row["binding_id"])),
|
|
298
|
+
)
|
|
299
|
+
migrated += 1
|
|
300
|
+
conn.commit()
|
|
301
|
+
finally:
|
|
302
|
+
conn.close()
|
|
303
|
+
return migrated
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def store_secret(
|
|
307
|
+
binding_id: str,
|
|
308
|
+
secret: str,
|
|
309
|
+
*,
|
|
310
|
+
env_var: str = "",
|
|
311
|
+
provider: str = "",
|
|
312
|
+
scope: str = "user",
|
|
313
|
+
user_id: str = "",
|
|
314
|
+
workspace_id: str = "",
|
|
315
|
+
) -> None:
|
|
316
|
+
binding_id = str(binding_id or "").strip()
|
|
317
|
+
if not binding_id:
|
|
318
|
+
raise ValueError("binding_id required")
|
|
319
|
+
if not str(secret or "").strip():
|
|
320
|
+
raise ValueError("secret required")
|
|
321
|
+
if not vault_kek.kek_in_memory():
|
|
322
|
+
status = vault_status()
|
|
323
|
+
if status["passphrase_enabled"]:
|
|
324
|
+
raise RuntimeError("vault_sealed")
|
|
325
|
+
bootstrap_vault(allow_generate_file=True)
|
|
326
|
+
_require_unsealed()
|
|
327
|
+
ensure_schema()
|
|
328
|
+
now = str(int(time.time()))
|
|
329
|
+
enc = _encrypt(secret)
|
|
330
|
+
conn = _connect()
|
|
331
|
+
try:
|
|
332
|
+
conn.execute(
|
|
333
|
+
"""
|
|
334
|
+
INSERT INTO credential_secrets (
|
|
335
|
+
binding_id, encrypted_secret, env_var, provider, scope,
|
|
336
|
+
user_id, workspace_id, created_at, updated_at
|
|
337
|
+
) VALUES (?,?,?,?,?,?,?,?,?)
|
|
338
|
+
ON CONFLICT(binding_id) DO UPDATE SET
|
|
339
|
+
encrypted_secret = excluded.encrypted_secret,
|
|
340
|
+
env_var = excluded.env_var,
|
|
341
|
+
provider = excluded.provider,
|
|
342
|
+
scope = excluded.scope,
|
|
343
|
+
user_id = excluded.user_id,
|
|
344
|
+
workspace_id = excluded.workspace_id,
|
|
345
|
+
updated_at = excluded.updated_at
|
|
346
|
+
""",
|
|
347
|
+
(
|
|
348
|
+
binding_id,
|
|
349
|
+
enc,
|
|
350
|
+
str(env_var or ""),
|
|
351
|
+
str(provider or ""),
|
|
352
|
+
str(scope or "user"),
|
|
353
|
+
str(user_id or "") or None,
|
|
354
|
+
str(workspace_id or "") or None,
|
|
355
|
+
now,
|
|
356
|
+
now,
|
|
357
|
+
),
|
|
358
|
+
)
|
|
359
|
+
conn.commit()
|
|
360
|
+
finally:
|
|
361
|
+
conn.close()
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def read_secret(binding_id: str) -> str:
|
|
365
|
+
binding_id = str(binding_id or "").strip()
|
|
366
|
+
if not binding_id:
|
|
367
|
+
return ""
|
|
368
|
+
ensure_schema()
|
|
369
|
+
if not vault_kek.kek_in_memory():
|
|
370
|
+
status = vault_status()
|
|
371
|
+
if status["passphrase_enabled"]:
|
|
372
|
+
return ""
|
|
373
|
+
bootstrap_vault(allow_generate_file=True)
|
|
374
|
+
conn = _connect()
|
|
375
|
+
try:
|
|
376
|
+
row = conn.execute(
|
|
377
|
+
"SELECT encrypted_secret FROM credential_secrets WHERE binding_id = ?",
|
|
378
|
+
(binding_id,),
|
|
379
|
+
).fetchone()
|
|
380
|
+
if not row:
|
|
381
|
+
return ""
|
|
382
|
+
blob = str(row["encrypted_secret"] or "")
|
|
383
|
+
plain = _decrypt(blob)
|
|
384
|
+
if not plain or not vault_kek.kek_in_memory():
|
|
385
|
+
return plain
|
|
386
|
+
try:
|
|
387
|
+
parsed = json.loads(blob)
|
|
388
|
+
if isinstance(parsed, dict) and int(parsed.get("v") or 0) != ENVELOPE_V2:
|
|
389
|
+
enc = _encrypt_v2(plain)
|
|
390
|
+
now = str(int(time.time()))
|
|
391
|
+
conn.execute(
|
|
392
|
+
"UPDATE credential_secrets SET encrypted_secret = ?, updated_at = ? WHERE binding_id = ?",
|
|
393
|
+
(enc, now, binding_id),
|
|
394
|
+
)
|
|
395
|
+
conn.commit()
|
|
396
|
+
except json.JSONDecodeError:
|
|
397
|
+
pass
|
|
398
|
+
return plain
|
|
399
|
+
finally:
|
|
400
|
+
conn.close()
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
def delete_secret(binding_id: str) -> None:
|
|
404
|
+
binding_id = str(binding_id or "").strip()
|
|
405
|
+
if not binding_id:
|
|
406
|
+
return
|
|
407
|
+
ensure_schema()
|
|
408
|
+
conn = _connect()
|
|
409
|
+
try:
|
|
410
|
+
conn.execute("DELETE FROM credential_secrets WHERE binding_id = ?", (binding_id,))
|
|
411
|
+
conn.commit()
|
|
412
|
+
finally:
|
|
413
|
+
conn.close()
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def vault_ref(binding_id: str) -> str:
|
|
417
|
+
return f"vault:{binding_id}"
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
def unseal_for_tests() -> None:
|
|
421
|
+
"""Deterministic KEK for unit tests."""
|
|
422
|
+
vault_kek.unseal_for_tests()
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
def parse_vault_ref(credential_ref: str) -> str:
|
|
426
|
+
ref = str(credential_ref or "").strip()
|
|
427
|
+
if ref.startswith("vault:"):
|
|
428
|
+
return ref[6:].strip()
|
|
429
|
+
return ""
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
if __name__ == "__main__":
|
|
433
|
+
vault_kek.unseal_for_tests()
|
|
434
|
+
ensure_schema()
|
|
435
|
+
bid = "__selfcheck__"
|
|
436
|
+
store_secret(bid, "sk-test", env_var="OPENROUTER_API_KEY", provider="openrouter")
|
|
437
|
+
assert read_secret(bid) == "sk-test"
|
|
438
|
+
blob = _connect().execute(
|
|
439
|
+
"SELECT encrypted_secret FROM credential_secrets WHERE binding_id = ?",
|
|
440
|
+
(bid,),
|
|
441
|
+
).fetchone()["encrypted_secret"]
|
|
442
|
+
assert '"v": 2' in blob or '"v":2' in blob.replace(" ", "")
|
|
443
|
+
delete_secret(bid)
|
|
444
|
+
assert read_secret(bid) == ""
|
|
445
|
+
print("credential_vault ok")
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"public_base": "/assets/agents",
|
|
4
|
+
"avatars": [
|
|
5
|
+
{ "id": "ada", "file": "ada.png", "label": "Ada" },
|
|
6
|
+
{ "id": "aibert", "file": "aibert.png", "label": "Aibert" },
|
|
7
|
+
{ "id": "amelia", "file": "amelia.png", "label": "Amelia" },
|
|
8
|
+
{ "id": "andy", "file": "andy.png", "label": "Andy" },
|
|
9
|
+
{ "id": "bob", "file": "bob.png", "label": "Bob" },
|
|
10
|
+
{ "id": "buzz", "file": "buzz.png", "label": "Buzz" },
|
|
11
|
+
{ "id": "carl", "file": "carl.png", "label": "Carl" },
|
|
12
|
+
{ "id": "corbu", "file": "corbu.png", "label": "Corbu" },
|
|
13
|
+
{ "id": "diana", "file": "diana.png", "label": "Diana" },
|
|
14
|
+
{ "id": "ella", "file": "ella.png", "label": "Ella" },
|
|
15
|
+
{ "id": "elvis", "file": "elvis.png", "label": "Elvis" },
|
|
16
|
+
{ "id": "frida", "file": "frida.png", "label": "Frida" },
|
|
17
|
+
{ "id": "george", "file": "george.png", "label": "George" },
|
|
18
|
+
{ "id": "grace", "file": "grace.png", "label": "Grace" },
|
|
19
|
+
{ "id": "hedy", "file": "hedy.png", "label": "Hedy" },
|
|
20
|
+
{ "id": "isaac", "file": "isaac.png", "label": "Isaac" },
|
|
21
|
+
{ "id": "john", "file": "john.png", "label": "John" },
|
|
22
|
+
{ "id": "joni", "file": "joni.png", "label": "Joni" },
|
|
23
|
+
{ "id": "leo", "file": "leo.png", "label": "Leo" },
|
|
24
|
+
{ "id": "louis", "file": "louis.png", "label": "Louis" },
|
|
25
|
+
{ "id": "ludwig", "file": "ludwig.png", "label": "Ludwig" },
|
|
26
|
+
{ "id": "marie", "file": "marie.png", "label": "Marie" },
|
|
27
|
+
{ "id": "marilyn", "file": "marilyn.png", "label": "Marilyn" },
|
|
28
|
+
{ "id": "neil", "file": "neil.png", "label": "Neil" },
|
|
29
|
+
{ "id": "nikola", "file": "nikola.png", "label": "Nikola" },
|
|
30
|
+
{ "id": "nina", "file": "nina.png", "label": "Nina" },
|
|
31
|
+
{ "id": "paul", "file": "paul.png", "label": "Paul" },
|
|
32
|
+
{ "id": "ringo", "file": "ringo.png", "label": "Ringo" },
|
|
33
|
+
{ "id": "rosie", "file": "rosie.png", "label": "Rosie" },
|
|
34
|
+
{ "id": "steve", "file": "steve.png", "label": "Steve" },
|
|
35
|
+
{ "id": "sun", "file": "sun.png", "label": "Sun" },
|
|
36
|
+
{ "id": "tom", "file": "tom.png", "label": "Tom" },
|
|
37
|
+
{ "id": "warren", "file": "warren.png", "label": "Warren" },
|
|
38
|
+
{ "id": "woz", "file": "woz.png", "label": "Woz" },
|
|
39
|
+
{ "id": "zaha", "file": "zaha.png", "label": "Zaha" }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"public_base": "/assets/project-logos",
|
|
4
|
+
"logos": [
|
|
5
|
+
{ "id": "1", "file": "1.png", "label": "Logo 1" },
|
|
6
|
+
{ "id": "2", "file": "2.png", "label": "Logo 2" },
|
|
7
|
+
{ "id": "3", "file": "3.png", "label": "Logo 3" },
|
|
8
|
+
{ "id": "4", "file": "4.png", "label": "Logo 4" },
|
|
9
|
+
{ "id": "5", "file": "5.png", "label": "Logo 5" },
|
|
10
|
+
{ "id": "6", "file": "6.png", "label": "Logo 6" },
|
|
11
|
+
{ "id": "7", "file": "7.png", "label": "Logo 7" },
|
|
12
|
+
{ "id": "8", "file": "8.png", "label": "Logo 8" }
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"public_base": "/assets/users",
|
|
4
|
+
"avatars": [
|
|
5
|
+
{ "id": "m1", "file": "m1.png", "label": "M1" },
|
|
6
|
+
{ "id": "m2", "file": "m2.png", "label": "M2" },
|
|
7
|
+
{ "id": "m3", "file": "m3.png", "label": "M3" },
|
|
8
|
+
{ "id": "m4", "file": "m4.png", "label": "M4" },
|
|
9
|
+
{ "id": "m5", "file": "m5.png", "label": "M5" },
|
|
10
|
+
{ "id": "m6", "file": "m6.png", "label": "M6" },
|
|
11
|
+
{ "id": "f1", "file": "f1.png", "label": "F1" },
|
|
12
|
+
{ "id": "f2", "file": "f2.png", "label": "F2" },
|
|
13
|
+
{ "id": "f3", "file": "f3.png", "label": "F3" },
|
|
14
|
+
{ "id": "f4", "file": "f4.png", "label": "F4" },
|
|
15
|
+
{ "id": "f5", "file": "f5.png", "label": "F5" },
|
|
16
|
+
{ "id": "f6", "file": "f6.png", "label": "F6" }
|
|
17
|
+
]
|
|
18
|
+
}
|