aimeat 1.2.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/dist/.env.example +300 -0
- package/dist/bin/aimeat.d.ts +3 -0
- package/dist/bin/aimeat.d.ts.map +1 -0
- package/dist/bin/aimeat.js +22 -0
- package/dist/bin/aimeat.js.map +1 -0
- package/dist/locales/en.json +4566 -0
- package/dist/locales/fi.json +4566 -0
- package/dist/public/BingSiteAuth.xml +4 -0
- package/dist/public/agent-consent.html +521 -0
- package/dist/public/aimeat-developers.html +679 -0
- package/dist/public/assets/mcp_1_add_custom_connector.png +0 -0
- package/dist/public/assets/mcp_2_connect_disconnect_connector.png +0 -0
- package/dist/public/components/Alert.js +18 -0
- package/dist/public/components/Card.js +19 -0
- package/dist/public/components/CopyButton.js +24 -0
- package/dist/public/components/FormField.js +16 -0
- package/dist/public/components/Modal.js +121 -0
- package/dist/public/components/Spinner.js +11 -0
- package/dist/public/components/Toast.js +26 -0
- package/dist/public/components/index.js +8 -0
- package/dist/public/components/useViewCSS.js +12 -0
- package/dist/public/cortex-bundled/aimeat-canvas.js +1408 -0
- package/dist/public/cortex-bundled/aimeat-canvas.yaml +241 -0
- package/dist/public/cortex-bundled/aimeat-charts.js +455 -0
- package/dist/public/cortex-bundled/aimeat-charts.yaml +178 -0
- package/dist/public/cortex-bundled/aimeat-ui-dialogs.js +667 -0
- package/dist/public/cortex-bundled/aimeat-ui-dialogs.yaml +66 -0
- package/dist/public/cortex-bundled/aimeat-ui-forms.js +1106 -0
- package/dist/public/cortex-bundled/aimeat-ui-forms.yaml +90 -0
- package/dist/public/cortex-bundled/aimeat-ui-layout.js +436 -0
- package/dist/public/cortex-bundled/aimeat-ui-layout.yaml +87 -0
- package/dist/public/cortex-bundled/aimeat-ui-nav.js +722 -0
- package/dist/public/cortex-bundled/aimeat-ui-nav.yaml +73 -0
- package/dist/public/cortex-bundled/aimeat-ui-viewers.js +602 -0
- package/dist/public/cortex-bundled/aimeat-ui-viewers.yaml +73 -0
- package/dist/public/css/components/tags.css +67 -0
- package/dist/public/css/theme.css +716 -0
- package/dist/public/css/views/admin.css +576 -0
- package/dist/public/css/views/aimeat-os.css +153 -0
- package/dist/public/css/views/calibrator.css +480 -0
- package/dist/public/css/views/foundry.css +1334 -0
- package/dist/public/css/views/help.css +136 -0
- package/dist/public/css/views/hobbies.css +73 -0
- package/dist/public/css/views/marketplace.css +134 -0
- package/dist/public/css/views/openclaw.css +33 -0
- package/dist/public/css/views/portal-classic.css +484 -0
- package/dist/public/css/views/portal-dev.css +139 -0
- package/dist/public/css/views/portal.css +365 -0
- package/dist/public/css/views/portfolio.css +322 -0
- package/dist/public/css/views/profile.css +1799 -0
- package/dist/public/echat.html +442 -0
- package/dist/public/img/genesis-001-badge.png +0 -0
- package/dist/public/img/platforms/chatgpt.png +0 -0
- package/dist/public/img/platforms/claude.png +0 -0
- package/dist/public/img/platforms/copilot.png +0 -0
- package/dist/public/img/platforms/deepseek.png +0 -0
- package/dist/public/img/platforms/gemini.png +0 -0
- package/dist/public/img/platforms/grok.png +0 -0
- package/dist/public/img/platforms/lmstudio.png +0 -0
- package/dist/public/img/platforms/m365copilot.png +0 -0
- package/dist/public/img/platforms/openclaw.png +0 -0
- package/dist/public/img/platforms/other.png +0 -0
- package/dist/public/js/api.js +123 -0
- package/dist/public/js/components/auth-image.js +59 -0
- package/dist/public/js/components/tag-cloud.js +31 -0
- package/dist/public/js/components/tag-editor.js +46 -0
- package/dist/public/js/hooks.js +63 -0
- package/dist/public/js/i18n.js +76 -0
- package/dist/public/js/services/admin.js +239 -0
- package/dist/public/js/services/agents.js +57 -0
- package/dist/public/js/services/apps.js +35 -0
- package/dist/public/js/services/auth.js +40 -0
- package/dist/public/js/services/boards.js +79 -0
- package/dist/public/js/services/calibrator.js +97 -0
- package/dist/public/js/services/catalogue.js +39 -0
- package/dist/public/js/services/consent.js +57 -0
- package/dist/public/js/services/cortex.js +95 -0
- package/dist/public/js/services/extensions.js +61 -0
- package/dist/public/js/services/federation.js +11 -0
- package/dist/public/js/services/foundry-context-bundle.js +128 -0
- package/dist/public/js/services/foundry-contract.js +117 -0
- package/dist/public/js/services/foundry-packaging.js +762 -0
- package/dist/public/js/services/foundry-probe-reconcile.js +52 -0
- package/dist/public/js/services/foundry-prompts-base.js +1886 -0
- package/dist/public/js/services/foundry-prompts-build.js +2187 -0
- package/dist/public/js/services/foundry-prompts-cortex-app.js +154 -0
- package/dist/public/js/services/foundry-prompts-cortex-data.js +241 -0
- package/dist/public/js/services/foundry-prompts-cortex-feature.js +281 -0
- package/dist/public/js/services/foundry-prompts-fix.js +408 -0
- package/dist/public/js/services/foundry-prompts-test.js +520 -0
- package/dist/public/js/services/foundry-prompts.js +31 -0
- package/dist/public/js/services/foundry-smoke.js +65 -0
- package/dist/public/js/services/foundry-testing.js +64 -0
- package/dist/public/js/services/foundry-validate.js +1082 -0
- package/dist/public/js/services/foundry.js +1194 -0
- package/dist/public/js/services/generator-context-bundle.js +134 -0
- package/dist/public/js/services/generator-contract.js +117 -0
- package/dist/public/js/services/generator-packaging.js +762 -0
- package/dist/public/js/services/generator-probe-reconcile.js +52 -0
- package/dist/public/js/services/generator-prompts-base.js +1890 -0
- package/dist/public/js/services/generator-prompts-build.js +1126 -0
- package/dist/public/js/services/generator-prompts-cortex-app.js +155 -0
- package/dist/public/js/services/generator-prompts-cortex-data.js +199 -0
- package/dist/public/js/services/generator-prompts-cortex-feature.js +276 -0
- package/dist/public/js/services/generator-prompts-fix.js +316 -0
- package/dist/public/js/services/generator-prompts-test.js +402 -0
- package/dist/public/js/services/generator-prompts.js +31 -0
- package/dist/public/js/services/generator-smoke.js +65 -0
- package/dist/public/js/services/generator-spec-tests.js +280 -0
- package/dist/public/js/services/generator-spec-validate.js +192 -0
- package/dist/public/js/services/generator-specs.js +369 -0
- package/dist/public/js/services/generator-testing.js +64 -0
- package/dist/public/js/services/generator-validate.js +916 -0
- package/dist/public/js/services/generator.js +952 -0
- package/dist/public/js/services/knowledge.js +120 -0
- package/dist/public/js/services/memory.js +112 -0
- package/dist/public/js/services/nodes.js +55 -0
- package/dist/public/js/services/organisms.js +74 -0
- package/dist/public/js/services/packages.js +97 -0
- package/dist/public/js/services/security.js +67 -0
- package/dist/public/js/services/stats.js +11 -0
- package/dist/public/js/services/wallet.js +24 -0
- package/dist/public/js/services/work.js +51 -0
- package/dist/public/js/utils.js +184 -0
- package/dist/public/lib/htm.mjs +4 -0
- package/dist/public/lib/live-updates.js +89 -0
- package/dist/public/lib/minidenticons.min.js +1 -0
- package/dist/public/lib/preact-hooks.mjs +3 -0
- package/dist/public/lib/preact.mjs +3 -0
- package/dist/public/lib/realtime.js +549 -0
- package/dist/public/lib/three.min.js +6 -0
- package/dist/public/lib/yaml.mjs +141 -0
- package/dist/public/llms-template.txt +1043 -0
- package/dist/public/oauth-consent.html +388 -0
- package/dist/public/og-image.png +0 -0
- package/dist/public/robots.txt +52 -0
- package/dist/public/spa.html +533 -0
- package/dist/public/sw.js +34 -0
- package/dist/public/tmp-paste.txt +223 -0
- package/dist/public/views/_template.js +85 -0
- package/dist/public/views/admin/actions-tab.js +41 -0
- package/dist/public/views/admin/agents-tab.js +84 -0
- package/dist/public/views/admin/boards-tab.js +154 -0
- package/dist/public/views/admin/chat-instances-tab.js +207 -0
- package/dist/public/views/admin/config-tab.js +151 -0
- package/dist/public/views/admin/consul-tab.js +77 -0
- package/dist/public/views/admin/cors-tab.js +240 -0
- package/dist/public/views/admin/cortex-tab.js +171 -0
- package/dist/public/views/admin/csm-tab.js +261 -0
- package/dist/public/views/admin/directory-tab.js +44 -0
- package/dist/public/views/admin/economy-tab.js +80 -0
- package/dist/public/views/admin/email-tab.js +460 -0
- package/dist/public/views/admin/federation-tab.js +412 -0
- package/dist/public/views/admin/generator-debug-tab.js +238 -0
- package/dist/public/views/admin/genesis-tab.js +70 -0
- package/dist/public/views/admin/ghii-tab.js +101 -0
- package/dist/public/views/admin/hooks-tab.js +69 -0
- package/dist/public/views/admin/knowledge-tab.js +297 -0
- package/dist/public/views/admin/maintenance-tab.js +98 -0
- package/dist/public/views/admin/matching-tab.js +44 -0
- package/dist/public/views/admin/memory-tab.js +222 -0
- package/dist/public/views/admin/msm-tab.js +342 -0
- package/dist/public/views/admin/overview-tab.js +90 -0
- package/dist/public/views/admin/owners-tab.js +55 -0
- package/dist/public/views/admin/packages-tab.js +510 -0
- package/dist/public/views/admin/portal-tab.js +211 -0
- package/dist/public/views/admin/prompts-tab.js +287 -0
- package/dist/public/views/admin/push-tab.js +291 -0
- package/dist/public/views/admin/realtime-tab.js +68 -0
- package/dist/public/views/admin/scheduler-tab.js +156 -0
- package/dist/public/views/admin/services-tab.js +981 -0
- package/dist/public/views/admin/shared.js +148 -0
- package/dist/public/views/admin/stats-tab.js +187 -0
- package/dist/public/views/admin/work-tab.js +45 -0
- package/dist/public/views/admin.js +400 -0
- package/dist/public/views/aimeat-os.js +259 -0
- package/dist/public/views/guides.js +402 -0
- package/dist/public/views/help.js +79 -0
- package/dist/public/views/hobbies.js +697 -0
- package/dist/public/views/marketplace.js +647 -0
- package/dist/public/views/openclaw.js +223 -0
- package/dist/public/views/portal-classic.js +519 -0
- package/dist/public/views/portal-dev.js +816 -0
- package/dist/public/views/portal.js +1354 -0
- package/dist/public/views/portfolio.js +795 -0
- package/dist/public/views/profile/access-tab.js +58 -0
- package/dist/public/views/profile/agents-tab.js +689 -0
- package/dist/public/views/profile/apps-tab.js +197 -0
- package/dist/public/views/profile/boards-tab.js +323 -0
- package/dist/public/views/profile/calibrator-batch.js +926 -0
- package/dist/public/views/profile/calibrator-chart.js +135 -0
- package/dist/public/views/profile/calibrator-llm-editor.js +205 -0
- package/dist/public/views/profile/calibrator-tab.js +535 -0
- package/dist/public/views/profile/chat-sessions-tab.js +184 -0
- package/dist/public/views/profile/data-wallet-tab.js +313 -0
- package/dist/public/views/profile/email-tab.js +157 -0
- package/dist/public/views/profile/extensions-tab.js +711 -0
- package/dist/public/views/profile/federation-tab.js +63 -0
- package/dist/public/views/profile/foundry-dashboard/DebugPanel.js +193 -0
- package/dist/public/views/profile/foundry-dashboard/DiagnosticsPanel.js +69 -0
- package/dist/public/views/profile/foundry-dashboard/EditModePanel.js +141 -0
- package/dist/public/views/profile/foundry-dashboard/PackageDialog.js +96 -0
- package/dist/public/views/profile/foundry-dashboard/RemovePanel.js +53 -0
- package/dist/public/views/profile/foundry-dashboard/use-autopilot-state.js +53 -0
- package/dist/public/views/profile/foundry-dashboard/use-autopilot.js +1016 -0
- package/dist/public/views/profile/foundry-dashboard/use-dashboard-core.js +154 -0
- package/dist/public/views/profile/foundry-dashboard/use-edit-mode.js +294 -0
- package/dist/public/views/profile/foundry-dashboard/use-lifecycle.js +101 -0
- package/dist/public/views/profile/foundry-dashboard/use-packaging.js +97 -0
- package/dist/public/views/profile/foundry-dashboard/use-test-execution.js +275 -0
- package/dist/public/views/profile/foundry-dashboard.js +395 -0
- package/dist/public/views/profile/foundry-detail.js +1178 -0
- package/dist/public/views/profile/foundry-settings.js +377 -0
- package/dist/public/views/profile/foundry-tab.js +546 -0
- package/dist/public/views/profile/generator-dashboard/DebugPanel.js +193 -0
- package/dist/public/views/profile/generator-dashboard/DiagnosticsPanel.js +69 -0
- package/dist/public/views/profile/generator-dashboard/EditModePanel.js +141 -0
- package/dist/public/views/profile/generator-dashboard/PackageDialog.js +96 -0
- package/dist/public/views/profile/generator-dashboard/RemovePanel.js +53 -0
- package/dist/public/views/profile/generator-dashboard/use-autopilot-state.js +53 -0
- package/dist/public/views/profile/generator-dashboard/use-autopilot.js +136 -0
- package/dist/public/views/profile/generator-dashboard/use-dashboard-core.js +143 -0
- package/dist/public/views/profile/generator-dashboard/use-edit-mode.js +296 -0
- package/dist/public/views/profile/generator-dashboard/use-lifecycle.js +101 -0
- package/dist/public/views/profile/generator-dashboard/use-packaging.js +97 -0
- package/dist/public/views/profile/generator-dashboard/use-test-execution.js +275 -0
- package/dist/public/views/profile/generator-dashboard.js +377 -0
- package/dist/public/views/profile/generator-detail.js +1007 -0
- package/dist/public/views/profile/generator-settings.js +417 -0
- package/dist/public/views/profile/generator-tab.js +544 -0
- package/dist/public/views/profile/inline-panels.js +277 -0
- package/dist/public/views/profile/knowledge-tab.js +735 -0
- package/dist/public/views/profile/landing-page.js +539 -0
- package/dist/public/views/profile/mcp-tab.js +140 -0
- package/dist/public/views/profile/memory-tab.js +599 -0
- package/dist/public/views/profile/node-stats-tab.js +132 -0
- package/dist/public/views/profile/nodes-tab.js +195 -0
- package/dist/public/views/profile/notifications-tab.js +274 -0
- package/dist/public/views/profile/organisms-tab.js +402 -0
- package/dist/public/views/profile/packages-tab.js +393 -0
- package/dist/public/views/profile/portfolio-tab.js +31 -0
- package/dist/public/views/profile/security-tab.js +219 -0
- package/dist/public/views/profile/services-tab.js +281 -0
- package/dist/public/views/profile/shared.js +58 -0
- package/dist/public/views/profile/wallet-tab.js +272 -0
- package/dist/public/views/profile/work-tab.js +220 -0
- package/dist/public/views/profile.js +271 -0
- package/dist/public/wizard.html +1320 -0
- package/dist/scripts/db-init.d.ts +19 -0
- package/dist/scripts/db-init.d.ts.map +1 -0
- package/dist/scripts/db-init.js +168 -0
- package/dist/scripts/db-init.js.map +1 -0
- package/dist/scripts/db-reset.d.ts +15 -0
- package/dist/scripts/db-reset.d.ts.map +1 -0
- package/dist/scripts/db-reset.js +162 -0
- package/dist/scripts/db-reset.js.map +1 -0
- package/dist/scripts/indexnow.d.ts +18 -0
- package/dist/scripts/indexnow.d.ts.map +1 -0
- package/dist/scripts/indexnow.js +104 -0
- package/dist/scripts/indexnow.js.map +1 -0
- package/dist/scripts/kill-port.d.ts +3 -0
- package/dist/scripts/kill-port.d.ts.map +1 -0
- package/dist/scripts/kill-port.js +89 -0
- package/dist/scripts/kill-port.js.map +1 -0
- package/dist/scripts/seed-digital-signage.d.ts +13 -0
- package/dist/scripts/seed-digital-signage.d.ts.map +1 -0
- package/dist/scripts/seed-digital-signage.js +85 -0
- package/dist/scripts/seed-digital-signage.js.map +1 -0
- package/dist/src/auth/jwt.d.ts +40 -0
- package/dist/src/auth/jwt.d.ts.map +1 -0
- package/dist/src/auth/jwt.js +139 -0
- package/dist/src/auth/jwt.js.map +1 -0
- package/dist/src/auth/keypair.d.ts +8 -0
- package/dist/src/auth/keypair.d.ts.map +1 -0
- package/dist/src/auth/keypair.js +35 -0
- package/dist/src/auth/keypair.js.map +1 -0
- package/dist/src/auth/middleware.d.ts +50 -0
- package/dist/src/auth/middleware.d.ts.map +1 -0
- package/dist/src/auth/middleware.js +241 -0
- package/dist/src/auth/middleware.js.map +1 -0
- package/dist/src/auth/node-keys.d.ts +7 -0
- package/dist/src/auth/node-keys.d.ts.map +1 -0
- package/dist/src/auth/node-keys.js +116 -0
- package/dist/src/auth/node-keys.js.map +1 -0
- package/dist/src/cli/config-export.d.ts +9 -0
- package/dist/src/cli/config-export.d.ts.map +1 -0
- package/dist/src/cli/config-export.js +90 -0
- package/dist/src/cli/config-export.js.map +1 -0
- package/dist/src/cli/config-import.d.ts +10 -0
- package/dist/src/cli/config-import.d.ts.map +1 -0
- package/dist/src/cli/config-import.js +124 -0
- package/dist/src/cli/config-import.js.map +1 -0
- package/dist/src/cli/federation-join.d.ts +13 -0
- package/dist/src/cli/federation-join.d.ts.map +1 -0
- package/dist/src/cli/federation-join.js +395 -0
- package/dist/src/cli/federation-join.js.map +1 -0
- package/dist/src/cli/init-wizard.d.ts +8 -0
- package/dist/src/cli/init-wizard.d.ts.map +1 -0
- package/dist/src/cli/init-wizard.js +1489 -0
- package/dist/src/cli/init-wizard.js.map +1 -0
- package/dist/src/cli/scaffold.d.ts +33 -0
- package/dist/src/cli/scaffold.d.ts.map +1 -0
- package/dist/src/cli/scaffold.js +142 -0
- package/dist/src/cli/scaffold.js.map +1 -0
- package/dist/src/config.d.ts +272 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +362 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/data/example-packages.d.ts +49 -0
- package/dist/src/data/example-packages.d.ts.map +1 -0
- package/dist/src/data/example-packages.js +814 -0
- package/dist/src/data/example-packages.js.map +1 -0
- package/dist/src/i18n.d.ts +19 -0
- package/dist/src/i18n.d.ts.map +1 -0
- package/dist/src/i18n.js +126 -0
- package/dist/src/i18n.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +608 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/mcp/boards.d.ts +18 -0
- package/dist/src/mcp/boards.d.ts.map +1 -0
- package/dist/src/mcp/boards.js +279 -0
- package/dist/src/mcp/boards.js.map +1 -0
- package/dist/src/mcp/catalogue.d.ts +17 -0
- package/dist/src/mcp/catalogue.d.ts.map +1 -0
- package/dist/src/mcp/catalogue.js +114 -0
- package/dist/src/mcp/catalogue.js.map +1 -0
- package/dist/src/mcp/chat-instances.d.ts +18 -0
- package/dist/src/mcp/chat-instances.d.ts.map +1 -0
- package/dist/src/mcp/chat-instances.js +161 -0
- package/dist/src/mcp/chat-instances.js.map +1 -0
- package/dist/src/mcp/consent.d.ts +18 -0
- package/dist/src/mcp/consent.d.ts.map +1 -0
- package/dist/src/mcp/consent.js +158 -0
- package/dist/src/mcp/consent.js.map +1 -0
- package/dist/src/mcp/core.d.ts +18 -0
- package/dist/src/mcp/core.d.ts.map +1 -0
- package/dist/src/mcp/core.js +489 -0
- package/dist/src/mcp/core.js.map +1 -0
- package/dist/src/mcp/extensions.d.ts +18 -0
- package/dist/src/mcp/extensions.d.ts.map +1 -0
- package/dist/src/mcp/extensions.js +299 -0
- package/dist/src/mcp/extensions.js.map +1 -0
- package/dist/src/mcp/flags.d.ts +18 -0
- package/dist/src/mcp/flags.d.ts.map +1 -0
- package/dist/src/mcp/flags.js +59 -0
- package/dist/src/mcp/flags.js.map +1 -0
- package/dist/src/mcp/index.d.ts +31 -0
- package/dist/src/mcp/index.d.ts.map +1 -0
- package/dist/src/mcp/index.js +694 -0
- package/dist/src/mcp/index.js.map +1 -0
- package/dist/src/mcp/knowledge.d.ts +18 -0
- package/dist/src/mcp/knowledge.d.ts.map +1 -0
- package/dist/src/mcp/knowledge.js +214 -0
- package/dist/src/mcp/knowledge.js.map +1 -0
- package/dist/src/mcp/memory-extended.d.ts +18 -0
- package/dist/src/mcp/memory-extended.d.ts.map +1 -0
- package/dist/src/mcp/memory-extended.js +73 -0
- package/dist/src/mcp/memory-extended.js.map +1 -0
- package/dist/src/mcp/organisms.d.ts +18 -0
- package/dist/src/mcp/organisms.d.ts.map +1 -0
- package/dist/src/mcp/organisms.js +291 -0
- package/dist/src/mcp/organisms.js.map +1 -0
- package/dist/src/mcp/prompts.d.ts +17 -0
- package/dist/src/mcp/prompts.d.ts.map +1 -0
- package/dist/src/mcp/prompts.js +65 -0
- package/dist/src/mcp/prompts.js.map +1 -0
- package/dist/src/mcp/wallet-extended.d.ts +17 -0
- package/dist/src/mcp/wallet-extended.d.ts.map +1 -0
- package/dist/src/mcp/wallet-extended.js +42 -0
- package/dist/src/mcp/wallet-extended.js.map +1 -0
- package/dist/src/middleware/__tests__/cookie-consent.test.d.ts +2 -0
- package/dist/src/middleware/__tests__/cookie-consent.test.d.ts.map +1 -0
- package/dist/src/middleware/__tests__/cookie-consent.test.js +432 -0
- package/dist/src/middleware/__tests__/cookie-consent.test.js.map +1 -0
- package/dist/src/middleware/cookie-consent.d.ts +19 -0
- package/dist/src/middleware/cookie-consent.d.ts.map +1 -0
- package/dist/src/middleware/cookie-consent.js +127 -0
- package/dist/src/middleware/cookie-consent.js.map +1 -0
- package/dist/src/middleware/cors.d.ts +12 -0
- package/dist/src/middleware/cors.d.ts.map +1 -0
- package/dist/src/middleware/cors.js +112 -0
- package/dist/src/middleware/cors.js.map +1 -0
- package/dist/src/middleware/envelope.d.ts +33 -0
- package/dist/src/middleware/envelope.d.ts.map +1 -0
- package/dist/src/middleware/envelope.js +32 -0
- package/dist/src/middleware/envelope.js.map +1 -0
- package/dist/src/middleware/idempotency.d.ts +3 -0
- package/dist/src/middleware/idempotency.d.ts.map +1 -0
- package/dist/src/middleware/idempotency.js +64 -0
- package/dist/src/middleware/idempotency.js.map +1 -0
- package/dist/src/middleware/metrics.d.ts +8 -0
- package/dist/src/middleware/metrics.d.ts.map +1 -0
- package/dist/src/middleware/metrics.js +25 -0
- package/dist/src/middleware/metrics.js.map +1 -0
- package/dist/src/middleware/rate-limit.d.ts +4 -0
- package/dist/src/middleware/rate-limit.d.ts.map +1 -0
- package/dist/src/middleware/rate-limit.js +73 -0
- package/dist/src/middleware/rate-limit.js.map +1 -0
- package/dist/src/middleware/request-id.d.ts +18 -0
- package/dist/src/middleware/request-id.d.ts.map +1 -0
- package/dist/src/middleware/request-id.js +23 -0
- package/dist/src/middleware/request-id.js.map +1 -0
- package/dist/src/middleware/stats.d.ts +4 -0
- package/dist/src/middleware/stats.d.ts.map +1 -0
- package/dist/src/middleware/stats.js +11 -0
- package/dist/src/middleware/stats.js.map +1 -0
- package/dist/src/middleware/workspace-access.d.ts +16 -0
- package/dist/src/middleware/workspace-access.d.ts.map +1 -0
- package/dist/src/middleware/workspace-access.js +115 -0
- package/dist/src/middleware/workspace-access.js.map +1 -0
- package/dist/src/models/schemas.d.ts +311 -0
- package/dist/src/models/schemas.d.ts.map +1 -0
- package/dist/src/models/schemas.js +281 -0
- package/dist/src/models/schemas.js.map +1 -0
- package/dist/src/routes/actions.d.ts +5 -0
- package/dist/src/routes/actions.d.ts.map +1 -0
- package/dist/src/routes/actions.js +199 -0
- package/dist/src/routes/actions.js.map +1 -0
- package/dist/src/routes/admin-agents.d.ts +5 -0
- package/dist/src/routes/admin-agents.d.ts.map +1 -0
- package/dist/src/routes/admin-agents.js +60 -0
- package/dist/src/routes/admin-agents.js.map +1 -0
- package/dist/src/routes/admin-config.d.ts +7 -0
- package/dist/src/routes/admin-config.d.ts.map +1 -0
- package/dist/src/routes/admin-config.js +209 -0
- package/dist/src/routes/admin-config.js.map +1 -0
- package/dist/src/routes/admin-economy.d.ts +5 -0
- package/dist/src/routes/admin-economy.d.ts.map +1 -0
- package/dist/src/routes/admin-economy.js +57 -0
- package/dist/src/routes/admin-economy.js.map +1 -0
- package/dist/src/routes/admin-extensions.d.ts +6 -0
- package/dist/src/routes/admin-extensions.d.ts.map +1 -0
- package/dist/src/routes/admin-extensions.js +619 -0
- package/dist/src/routes/admin-extensions.js.map +1 -0
- package/dist/src/routes/admin-features.d.ts +16 -0
- package/dist/src/routes/admin-features.d.ts.map +1 -0
- package/dist/src/routes/admin-features.js +672 -0
- package/dist/src/routes/admin-features.js.map +1 -0
- package/dist/src/routes/admin-maintenance.d.ts +8 -0
- package/dist/src/routes/admin-maintenance.d.ts.map +1 -0
- package/dist/src/routes/admin-maintenance.js +86 -0
- package/dist/src/routes/admin-maintenance.js.map +1 -0
- package/dist/src/routes/admin-memory.d.ts +12 -0
- package/dist/src/routes/admin-memory.d.ts.map +1 -0
- package/dist/src/routes/admin-memory.js +64 -0
- package/dist/src/routes/admin-memory.js.map +1 -0
- package/dist/src/routes/admin-monitoring.d.ts +5 -0
- package/dist/src/routes/admin-monitoring.d.ts.map +1 -0
- package/dist/src/routes/admin-monitoring.js +343 -0
- package/dist/src/routes/admin-monitoring.js.map +1 -0
- package/dist/src/routes/admin-prompts.d.ts +5 -0
- package/dist/src/routes/admin-prompts.d.ts.map +1 -0
- package/dist/src/routes/admin-prompts.js +198 -0
- package/dist/src/routes/admin-prompts.js.map +1 -0
- package/dist/src/routes/admin-scheduler.d.ts +6 -0
- package/dist/src/routes/admin-scheduler.d.ts.map +1 -0
- package/dist/src/routes/admin-scheduler.js +153 -0
- package/dist/src/routes/admin-scheduler.js.map +1 -0
- package/dist/src/routes/admin.d.ts +10 -0
- package/dist/src/routes/admin.d.ts.map +1 -0
- package/dist/src/routes/admin.js +847 -0
- package/dist/src/routes/admin.js.map +1 -0
- package/dist/src/routes/agents.d.ts +5 -0
- package/dist/src/routes/agents.d.ts.map +1 -0
- package/dist/src/routes/agents.js +946 -0
- package/dist/src/routes/agents.js.map +1 -0
- package/dist/src/routes/app-store.d.ts +25 -0
- package/dist/src/routes/app-store.d.ts.map +1 -0
- package/dist/src/routes/app-store.js +269 -0
- package/dist/src/routes/app-store.js.map +1 -0
- package/dist/src/routes/appeals.d.ts +5 -0
- package/dist/src/routes/appeals.d.ts.map +1 -0
- package/dist/src/routes/appeals.js +241 -0
- package/dist/src/routes/appeals.js.map +1 -0
- package/dist/src/routes/apps.d.ts +14 -0
- package/dist/src/routes/apps.d.ts.map +1 -0
- package/dist/src/routes/apps.js +395 -0
- package/dist/src/routes/apps.js.map +1 -0
- package/dist/src/routes/auth.d.ts +13 -0
- package/dist/src/routes/auth.d.ts.map +1 -0
- package/dist/src/routes/auth.js +517 -0
- package/dist/src/routes/auth.js.map +1 -0
- package/dist/src/routes/boards.d.ts +5 -0
- package/dist/src/routes/boards.d.ts.map +1 -0
- package/dist/src/routes/boards.js +614 -0
- package/dist/src/routes/boards.js.map +1 -0
- package/dist/src/routes/bootstrap.d.ts +6 -0
- package/dist/src/routes/bootstrap.d.ts.map +1 -0
- package/dist/src/routes/bootstrap.js +360 -0
- package/dist/src/routes/bootstrap.js.map +1 -0
- package/dist/src/routes/calibrator.d.ts +28 -0
- package/dist/src/routes/calibrator.d.ts.map +1 -0
- package/dist/src/routes/calibrator.js +556 -0
- package/dist/src/routes/calibrator.js.map +1 -0
- package/dist/src/routes/catalogue.d.ts +7 -0
- package/dist/src/routes/catalogue.d.ts.map +1 -0
- package/dist/src/routes/catalogue.js +377 -0
- package/dist/src/routes/catalogue.js.map +1 -0
- package/dist/src/routes/chat-instances.d.ts +5 -0
- package/dist/src/routes/chat-instances.d.ts.map +1 -0
- package/dist/src/routes/chat-instances.js +131 -0
- package/dist/src/routes/chat-instances.js.map +1 -0
- package/dist/src/routes/consent.d.ts +6 -0
- package/dist/src/routes/consent.d.ts.map +1 -0
- package/dist/src/routes/consent.js +188 -0
- package/dist/src/routes/consent.js.map +1 -0
- package/dist/src/routes/cortex.d.ts +5 -0
- package/dist/src/routes/cortex.d.ts.map +1 -0
- package/dist/src/routes/cortex.js +617 -0
- package/dist/src/routes/cortex.js.map +1 -0
- package/dist/src/routes/csm.d.ts +5 -0
- package/dist/src/routes/csm.d.ts.map +1 -0
- package/dist/src/routes/csm.js +258 -0
- package/dist/src/routes/csm.js.map +1 -0
- package/dist/src/routes/disputes.d.ts +5 -0
- package/dist/src/routes/disputes.d.ts.map +1 -0
- package/dist/src/routes/disputes.js +528 -0
- package/dist/src/routes/disputes.js.map +1 -0
- package/dist/src/routes/extensions.d.ts +6 -0
- package/dist/src/routes/extensions.d.ts.map +1 -0
- package/dist/src/routes/extensions.js +1149 -0
- package/dist/src/routes/extensions.js.map +1 -0
- package/dist/src/routes/federation-genesis.d.ts +11 -0
- package/dist/src/routes/federation-genesis.d.ts.map +1 -0
- package/dist/src/routes/federation-genesis.js +638 -0
- package/dist/src/routes/federation-genesis.js.map +1 -0
- package/dist/src/routes/federation-peer.d.ts +10 -0
- package/dist/src/routes/federation-peer.d.ts.map +1 -0
- package/dist/src/routes/federation-peer.js +613 -0
- package/dist/src/routes/federation-peer.js.map +1 -0
- package/dist/src/routes/federation-settlements.d.ts +10 -0
- package/dist/src/routes/federation-settlements.d.ts.map +1 -0
- package/dist/src/routes/federation-settlements.js +231 -0
- package/dist/src/routes/federation-settlements.js.map +1 -0
- package/dist/src/routes/federation-sync.d.ts +15 -0
- package/dist/src/routes/federation-sync.d.ts.map +1 -0
- package/dist/src/routes/federation-sync.js +629 -0
- package/dist/src/routes/federation-sync.js.map +1 -0
- package/dist/src/routes/federation.d.ts +15 -0
- package/dist/src/routes/federation.d.ts.map +1 -0
- package/dist/src/routes/federation.js +23 -0
- package/dist/src/routes/federation.js.map +1 -0
- package/dist/src/routes/flags.d.ts +5 -0
- package/dist/src/routes/flags.d.ts.map +1 -0
- package/dist/src/routes/flags.js +194 -0
- package/dist/src/routes/flags.js.map +1 -0
- package/dist/src/routes/foundry.d.ts +5 -0
- package/dist/src/routes/foundry.d.ts.map +1 -0
- package/dist/src/routes/foundry.js +955 -0
- package/dist/src/routes/foundry.js.map +1 -0
- package/dist/src/routes/generator-autopilot.d.ts +12 -0
- package/dist/src/routes/generator-autopilot.d.ts.map +1 -0
- package/dist/src/routes/generator-autopilot.js +71 -0
- package/dist/src/routes/generator-autopilot.js.map +1 -0
- package/dist/src/routes/generator.d.ts +5 -0
- package/dist/src/routes/generator.d.ts.map +1 -0
- package/dist/src/routes/generator.js +1313 -0
- package/dist/src/routes/generator.js.map +1 -0
- package/dist/src/routes/ghii.d.ts +16 -0
- package/dist/src/routes/ghii.d.ts.map +1 -0
- package/dist/src/routes/ghii.js +1115 -0
- package/dist/src/routes/ghii.js.map +1 -0
- package/dist/src/routes/instances.d.ts +31 -0
- package/dist/src/routes/instances.d.ts.map +1 -0
- package/dist/src/routes/instances.js +722 -0
- package/dist/src/routes/instances.js.map +1 -0
- package/dist/src/routes/knowledge.d.ts +33 -0
- package/dist/src/routes/knowledge.d.ts.map +1 -0
- package/dist/src/routes/knowledge.js +1108 -0
- package/dist/src/routes/knowledge.js.map +1 -0
- package/dist/src/routes/lib-data.d.ts +7 -0
- package/dist/src/routes/lib-data.d.ts.map +1 -0
- package/dist/src/routes/lib-data.js +189 -0
- package/dist/src/routes/lib-data.js.map +1 -0
- package/dist/src/routes/lib-social.d.ts +7 -0
- package/dist/src/routes/lib-social.d.ts.map +1 -0
- package/dist/src/routes/lib-social.js +159 -0
- package/dist/src/routes/lib-social.js.map +1 -0
- package/dist/src/routes/lib-storage.d.ts +7 -0
- package/dist/src/routes/lib-storage.d.ts.map +1 -0
- package/dist/src/routes/lib-storage.js +202 -0
- package/dist/src/routes/lib-storage.js.map +1 -0
- package/dist/src/routes/lib-tunnel.d.ts +8 -0
- package/dist/src/routes/lib-tunnel.d.ts.map +1 -0
- package/dist/src/routes/lib-tunnel.js +442 -0
- package/dist/src/routes/lib-tunnel.js.map +1 -0
- package/dist/src/routes/lib-wallet.d.ts +7 -0
- package/dist/src/routes/lib-wallet.d.ts.map +1 -0
- package/dist/src/routes/lib-wallet.js +129 -0
- package/dist/src/routes/lib-wallet.js.map +1 -0
- package/dist/src/routes/lib-work.d.ts +7 -0
- package/dist/src/routes/lib-work.d.ts.map +1 -0
- package/dist/src/routes/lib-work.js +210 -0
- package/dist/src/routes/lib-work.js.map +1 -0
- package/dist/src/routes/libs.d.ts +10 -0
- package/dist/src/routes/libs.d.ts.map +1 -0
- package/dist/src/routes/libs.js +989 -0
- package/dist/src/routes/libs.js.map +1 -0
- package/dist/src/routes/matches.d.ts +10 -0
- package/dist/src/routes/matches.d.ts.map +1 -0
- package/dist/src/routes/matches.js +218 -0
- package/dist/src/routes/matches.js.map +1 -0
- package/dist/src/routes/memory.d.ts +6 -0
- package/dist/src/routes/memory.d.ts.map +1 -0
- package/dist/src/routes/memory.js +796 -0
- package/dist/src/routes/memory.js.map +1 -0
- package/dist/src/routes/micro-memory.d.ts +5 -0
- package/dist/src/routes/micro-memory.d.ts.map +1 -0
- package/dist/src/routes/micro-memory.js +488 -0
- package/dist/src/routes/micro-memory.js.map +1 -0
- package/dist/src/routes/msm.d.ts +5 -0
- package/dist/src/routes/msm.d.ts.map +1 -0
- package/dist/src/routes/msm.js +242 -0
- package/dist/src/routes/msm.js.map +1 -0
- package/dist/src/routes/openrouter.d.ts +23 -0
- package/dist/src/routes/openrouter.d.ts.map +1 -0
- package/dist/src/routes/openrouter.js +337 -0
- package/dist/src/routes/openrouter.js.map +1 -0
- package/dist/src/routes/organisms.d.ts +5 -0
- package/dist/src/routes/organisms.d.ts.map +1 -0
- package/dist/src/routes/organisms.js +415 -0
- package/dist/src/routes/organisms.js.map +1 -0
- package/dist/src/routes/owners.d.ts +5 -0
- package/dist/src/routes/owners.d.ts.map +1 -0
- package/dist/src/routes/owners.js +637 -0
- package/dist/src/routes/owners.js.map +1 -0
- package/dist/src/routes/packages.d.ts +35 -0
- package/dist/src/routes/packages.d.ts.map +1 -0
- package/dist/src/routes/packages.js +600 -0
- package/dist/src/routes/packages.js.map +1 -0
- package/dist/src/routes/permissions.d.ts +5 -0
- package/dist/src/routes/permissions.d.ts.map +1 -0
- package/dist/src/routes/permissions.js +85 -0
- package/dist/src/routes/permissions.js.map +1 -0
- package/dist/src/routes/personal.d.ts +7 -0
- package/dist/src/routes/personal.d.ts.map +1 -0
- package/dist/src/routes/personal.js +594 -0
- package/dist/src/routes/personal.js.map +1 -0
- package/dist/src/routes/portal-api.d.ts +9 -0
- package/dist/src/routes/portal-api.d.ts.map +1 -0
- package/dist/src/routes/portal-api.js +49 -0
- package/dist/src/routes/portal-api.js.map +1 -0
- package/dist/src/routes/portal-human.d.ts +12 -0
- package/dist/src/routes/portal-human.d.ts.map +1 -0
- package/dist/src/routes/portal-human.js +2652 -0
- package/dist/src/routes/portal-human.js.map +1 -0
- package/dist/src/routes/portal.d.ts +24 -0
- package/dist/src/routes/portal.d.ts.map +1 -0
- package/dist/src/routes/portal.js +372 -0
- package/dist/src/routes/portal.js.map +1 -0
- package/dist/src/routes/portfolio.d.ts +5 -0
- package/dist/src/routes/portfolio.d.ts.map +1 -0
- package/dist/src/routes/portfolio.js +231 -0
- package/dist/src/routes/portfolio.js.map +1 -0
- package/dist/src/routes/profile.d.ts +5 -0
- package/dist/src/routes/profile.d.ts.map +1 -0
- package/dist/src/routes/profile.js +2042 -0
- package/dist/src/routes/profile.js.map +1 -0
- package/dist/src/routes/prompts.d.ts +5 -0
- package/dist/src/routes/prompts.d.ts.map +1 -0
- package/dist/src/routes/prompts.js +318 -0
- package/dist/src/routes/prompts.js.map +1 -0
- package/dist/src/routes/push.d.ts +6 -0
- package/dist/src/routes/push.d.ts.map +1 -0
- package/dist/src/routes/push.js +75 -0
- package/dist/src/routes/push.js.map +1 -0
- package/dist/src/routes/realtime.d.ts +7 -0
- package/dist/src/routes/realtime.d.ts.map +1 -0
- package/dist/src/routes/realtime.js +289 -0
- package/dist/src/routes/realtime.js.map +1 -0
- package/dist/src/routes/schemas.d.ts +5 -0
- package/dist/src/routes/schemas.d.ts.map +1 -0
- package/dist/src/routes/schemas.js +130 -0
- package/dist/src/routes/schemas.js.map +1 -0
- package/dist/src/routes/setup.d.ts +7 -0
- package/dist/src/routes/setup.d.ts.map +1 -0
- package/dist/src/routes/setup.js +243 -0
- package/dist/src/routes/setup.js.map +1 -0
- package/dist/src/routes/site.d.ts +6 -0
- package/dist/src/routes/site.d.ts.map +1 -0
- package/dist/src/routes/site.js +201 -0
- package/dist/src/routes/site.js.map +1 -0
- package/dist/src/routes/spec.d.ts +3 -0
- package/dist/src/routes/spec.d.ts.map +1 -0
- package/dist/src/routes/spec.js +47 -0
- package/dist/src/routes/spec.js.map +1 -0
- package/dist/src/routes/sse.d.ts +5 -0
- package/dist/src/routes/sse.d.ts.map +1 -0
- package/dist/src/routes/sse.js +66 -0
- package/dist/src/routes/sse.js.map +1 -0
- package/dist/src/routes/stats.d.ts +7 -0
- package/dist/src/routes/stats.d.ts.map +1 -0
- package/dist/src/routes/stats.js +98 -0
- package/dist/src/routes/stats.js.map +1 -0
- package/dist/src/routes/storage-files.d.ts +5 -0
- package/dist/src/routes/storage-files.d.ts.map +1 -0
- package/dist/src/routes/storage-files.js +460 -0
- package/dist/src/routes/storage-files.js.map +1 -0
- package/dist/src/routes/templates.d.ts +30 -0
- package/dist/src/routes/templates.d.ts.map +1 -0
- package/dist/src/routes/templates.js +511 -0
- package/dist/src/routes/templates.js.map +1 -0
- package/dist/src/routes/totp.d.ts +5 -0
- package/dist/src/routes/totp.d.ts.map +1 -0
- package/dist/src/routes/totp.js +166 -0
- package/dist/src/routes/totp.js.map +1 -0
- package/dist/src/routes/validate.d.ts +4 -0
- package/dist/src/routes/validate.d.ts.map +1 -0
- package/dist/src/routes/validate.js +71 -0
- package/dist/src/routes/validate.js.map +1 -0
- package/dist/src/routes/verification.d.ts +8 -0
- package/dist/src/routes/verification.d.ts.map +1 -0
- package/dist/src/routes/verification.js +259 -0
- package/dist/src/routes/verification.js.map +1 -0
- package/dist/src/routes/wallet.d.ts +18 -0
- package/dist/src/routes/wallet.d.ts.map +1 -0
- package/dist/src/routes/wallet.js +164 -0
- package/dist/src/routes/wallet.js.map +1 -0
- package/dist/src/routes/wellknown.d.ts +5 -0
- package/dist/src/routes/wellknown.d.ts.map +1 -0
- package/dist/src/routes/wellknown.js +57 -0
- package/dist/src/routes/wellknown.js.map +1 -0
- package/dist/src/routes/work.d.ts +21 -0
- package/dist/src/routes/work.d.ts.map +1 -0
- package/dist/src/routes/work.js +654 -0
- package/dist/src/routes/work.js.map +1 -0
- package/dist/src/schemas/knowledge-package.d.ts +203 -0
- package/dist/src/schemas/knowledge-package.d.ts.map +1 -0
- package/dist/src/schemas/knowledge-package.js +233 -0
- package/dist/src/schemas/knowledge-package.js.map +1 -0
- package/dist/src/server-bootstrap/config-init.d.ts +16 -0
- package/dist/src/server-bootstrap/config-init.d.ts.map +1 -0
- package/dist/src/server-bootstrap/config-init.js +113 -0
- package/dist/src/server-bootstrap/config-init.js.map +1 -0
- package/dist/src/server-bootstrap/middleware-guards.d.ts +15 -0
- package/dist/src/server-bootstrap/middleware-guards.d.ts.map +1 -0
- package/dist/src/server-bootstrap/middleware-guards.js +244 -0
- package/dist/src/server-bootstrap/middleware-guards.js.map +1 -0
- package/dist/src/server-bootstrap/routes-loader.d.ts +35 -0
- package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -0
- package/dist/src/server-bootstrap/routes-loader.js +290 -0
- package/dist/src/server-bootstrap/routes-loader.js.map +1 -0
- package/dist/src/server-bootstrap/service-init.d.ts +24 -0
- package/dist/src/server-bootstrap/service-init.d.ts.map +1 -0
- package/dist/src/server-bootstrap/service-init.js +195 -0
- package/dist/src/server-bootstrap/service-init.js.map +1 -0
- package/dist/src/server-bootstrap/static-files.d.ts +7 -0
- package/dist/src/server-bootstrap/static-files.d.ts.map +1 -0
- package/dist/src/server-bootstrap/static-files.js +119 -0
- package/dist/src/server-bootstrap/static-files.js.map +1 -0
- package/dist/src/server.d.ts +22 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +133 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/services/cache-cleanup.d.ts +31 -0
- package/dist/src/services/cache-cleanup.d.ts.map +1 -0
- package/dist/src/services/cache-cleanup.js +123 -0
- package/dist/src/services/cache-cleanup.js.map +1 -0
- package/dist/src/services/catalogue-sync.d.ts +45 -0
- package/dist/src/services/catalogue-sync.d.ts.map +1 -0
- package/dist/src/services/catalogue-sync.js +196 -0
- package/dist/src/services/catalogue-sync.js.map +1 -0
- package/dist/src/services/component-registrar.d.ts +46 -0
- package/dist/src/services/component-registrar.d.ts.map +1 -0
- package/dist/src/services/component-registrar.js +389 -0
- package/dist/src/services/component-registrar.js.map +1 -0
- package/dist/src/services/config-loader.d.ts +42 -0
- package/dist/src/services/config-loader.d.ts.map +1 -0
- package/dist/src/services/config-loader.js +187 -0
- package/dist/src/services/config-loader.js.map +1 -0
- package/dist/src/services/config-provenance.d.ts +32 -0
- package/dist/src/services/config-provenance.d.ts.map +1 -0
- package/dist/src/services/config-provenance.js +59 -0
- package/dist/src/services/config-provenance.js.map +1 -0
- package/dist/src/services/config-schema.d.ts +52 -0
- package/dist/src/services/config-schema.d.ts.map +1 -0
- package/dist/src/services/config-schema.js +288 -0
- package/dist/src/services/config-schema.js.map +1 -0
- package/dist/src/services/consent.d.ts +43 -0
- package/dist/src/services/consent.d.ts.map +1 -0
- package/dist/src/services/consent.js +137 -0
- package/dist/src/services/consent.js.map +1 -0
- package/dist/src/services/consul-config.d.ts +30 -0
- package/dist/src/services/consul-config.d.ts.map +1 -0
- package/dist/src/services/consul-config.js +110 -0
- package/dist/src/services/consul-config.js.map +1 -0
- package/dist/src/services/core-jobs.d.ts +8 -0
- package/dist/src/services/core-jobs.d.ts.map +1 -0
- package/dist/src/services/core-jobs.js +161 -0
- package/dist/src/services/core-jobs.js.map +1 -0
- package/dist/src/services/cortex-manifest.d.ts +17 -0
- package/dist/src/services/cortex-manifest.d.ts.map +1 -0
- package/dist/src/services/cortex-manifest.js +343 -0
- package/dist/src/services/cortex-manifest.js.map +1 -0
- package/dist/src/services/cortex-seeder.d.ts +18 -0
- package/dist/src/services/cortex-seeder.d.ts.map +1 -0
- package/dist/src/services/cortex-seeder.js +86 -0
- package/dist/src/services/cortex-seeder.js.map +1 -0
- package/dist/src/services/cross-node-matching.d.ts +23 -0
- package/dist/src/services/cross-node-matching.d.ts.map +1 -0
- package/dist/src/services/cross-node-matching.js +62 -0
- package/dist/src/services/cross-node-matching.js.map +1 -0
- package/dist/src/services/csm-parser.d.ts +57 -0
- package/dist/src/services/csm-parser.d.ts.map +1 -0
- package/dist/src/services/csm-parser.js +161 -0
- package/dist/src/services/csm-parser.js.map +1 -0
- package/dist/src/services/csm-seed.d.ts +15 -0
- package/dist/src/services/csm-seed.d.ts.map +1 -0
- package/dist/src/services/csm-seed.js +89 -0
- package/dist/src/services/csm-seed.js.map +1 -0
- package/dist/src/services/directory.d.ts +86 -0
- package/dist/src/services/directory.d.ts.map +1 -0
- package/dist/src/services/directory.js +307 -0
- package/dist/src/services/directory.js.map +1 -0
- package/dist/src/services/email-templates.d.ts +29 -0
- package/dist/src/services/email-templates.d.ts.map +1 -0
- package/dist/src/services/email-templates.js +204 -0
- package/dist/src/services/email-templates.js.map +1 -0
- package/dist/src/services/email.d.ts +18 -0
- package/dist/src/services/email.d.ts.map +1 -0
- package/dist/src/services/email.js +102 -0
- package/dist/src/services/email.js.map +1 -0
- package/dist/src/services/encryption.d.ts +31 -0
- package/dist/src/services/encryption.d.ts.map +1 -0
- package/dist/src/services/encryption.js +51 -0
- package/dist/src/services/encryption.js.map +1 -0
- package/dist/src/services/eudiw.d.ts +15 -0
- package/dist/src/services/eudiw.d.ts.map +1 -0
- package/dist/src/services/eudiw.js +89 -0
- package/dist/src/services/eudiw.js.map +1 -0
- package/dist/src/services/event-bus.d.ts +8 -0
- package/dist/src/services/event-bus.d.ts.map +1 -0
- package/dist/src/services/event-bus.js +13 -0
- package/dist/src/services/event-bus.js.map +1 -0
- package/dist/src/services/extension-runtime.d.ts +72 -0
- package/dist/src/services/extension-runtime.d.ts.map +1 -0
- package/dist/src/services/extension-runtime.js +282 -0
- package/dist/src/services/extension-runtime.js.map +1 -0
- package/dist/src/services/federation-helpers.d.ts +37 -0
- package/dist/src/services/federation-helpers.d.ts.map +1 -0
- package/dist/src/services/federation-helpers.js +100 -0
- package/dist/src/services/federation-helpers.js.map +1 -0
- package/dist/src/services/federation.d.ts +32 -0
- package/dist/src/services/federation.d.ts.map +1 -0
- package/dist/src/services/federation.js +201 -0
- package/dist/src/services/federation.js.map +1 -0
- package/dist/src/services/foundry-debug.d.ts +77 -0
- package/dist/src/services/foundry-debug.d.ts.map +1 -0
- package/dist/src/services/foundry-debug.js +214 -0
- package/dist/src/services/foundry-debug.js.map +1 -0
- package/dist/src/services/foundry-registration.d.ts +42 -0
- package/dist/src/services/foundry-registration.d.ts.map +1 -0
- package/dist/src/services/foundry-registration.js +330 -0
- package/dist/src/services/foundry-registration.js.map +1 -0
- package/dist/src/services/foundry-testing.d.ts +90 -0
- package/dist/src/services/foundry-testing.d.ts.map +1 -0
- package/dist/src/services/foundry-testing.js +253 -0
- package/dist/src/services/foundry-testing.js.map +1 -0
- package/dist/src/services/foundry-validate.d.ts +115 -0
- package/dist/src/services/foundry-validate.d.ts.map +1 -0
- package/dist/src/services/foundry-validate.js +781 -0
- package/dist/src/services/foundry-validate.js.map +1 -0
- package/dist/src/services/generator-autopilot.d.ts +37 -0
- package/dist/src/services/generator-autopilot.d.ts.map +1 -0
- package/dist/src/services/generator-autopilot.js +1076 -0
- package/dist/src/services/generator-autopilot.js.map +1 -0
- package/dist/src/services/generator-debug.d.ts +79 -0
- package/dist/src/services/generator-debug.d.ts.map +1 -0
- package/dist/src/services/generator-debug.js +218 -0
- package/dist/src/services/generator-debug.js.map +1 -0
- package/dist/src/services/generator-prompt-seeds.d.ts +13 -0
- package/dist/src/services/generator-prompt-seeds.d.ts.map +1 -0
- package/dist/src/services/generator-prompt-seeds.js +2694 -0
- package/dist/src/services/generator-prompt-seeds.js.map +1 -0
- package/dist/src/services/generator-prompts/bundle.d.ts +17 -0
- package/dist/src/services/generator-prompts/bundle.d.ts.map +1 -0
- package/dist/src/services/generator-prompts/bundle.js +95 -0
- package/dist/src/services/generator-prompts/bundle.js.map +1 -0
- package/dist/src/services/generator-prompts/index.d.ts +48 -0
- package/dist/src/services/generator-prompts/index.d.ts.map +1 -0
- package/dist/src/services/generator-prompts/index.js +97 -0
- package/dist/src/services/generator-prompts/index.js.map +1 -0
- package/dist/src/services/generator-prompts/resolvers.d.ts +21 -0
- package/dist/src/services/generator-prompts/resolvers.d.ts.map +1 -0
- package/dist/src/services/generator-prompts/resolvers.js +1553 -0
- package/dist/src/services/generator-prompts/resolvers.js.map +1 -0
- package/dist/src/services/generator-prompts/spec-validate.d.ts +29 -0
- package/dist/src/services/generator-prompts/spec-validate.d.ts.map +1 -0
- package/dist/src/services/generator-prompts/spec-validate.js +190 -0
- package/dist/src/services/generator-prompts/spec-validate.js.map +1 -0
- package/dist/src/services/generator-prompts/strip.d.ts +13 -0
- package/dist/src/services/generator-prompts/strip.d.ts.map +1 -0
- package/dist/src/services/generator-prompts/strip.js +60 -0
- package/dist/src/services/generator-prompts/strip.js.map +1 -0
- package/dist/src/services/generator-prompts/types.d.ts +229 -0
- package/dist/src/services/generator-prompts/types.d.ts.map +1 -0
- package/dist/src/services/generator-prompts/types.js +8 -0
- package/dist/src/services/generator-prompts/types.js.map +1 -0
- package/dist/src/services/generator-prompts/validate.d.ts +48 -0
- package/dist/src/services/generator-prompts/validate.d.ts.map +1 -0
- package/dist/src/services/generator-prompts/validate.js +927 -0
- package/dist/src/services/generator-prompts/validate.js.map +1 -0
- package/dist/src/services/generator-registration.d.ts +43 -0
- package/dist/src/services/generator-registration.d.ts.map +1 -0
- package/dist/src/services/generator-registration.js +343 -0
- package/dist/src/services/generator-registration.js.map +1 -0
- package/dist/src/services/generator-testing.d.ts +93 -0
- package/dist/src/services/generator-testing.d.ts.map +1 -0
- package/dist/src/services/generator-testing.js +300 -0
- package/dist/src/services/generator-testing.js.map +1 -0
- package/dist/src/services/generator-validate.d.ts +117 -0
- package/dist/src/services/generator-validate.d.ts.map +1 -0
- package/dist/src/services/generator-validate.js +790 -0
- package/dist/src/services/generator-validate.js.map +1 -0
- package/dist/src/services/genesis-peering.d.ts +12 -0
- package/dist/src/services/genesis-peering.d.ts.map +1 -0
- package/dist/src/services/genesis-peering.js +91 -0
- package/dist/src/services/genesis-peering.js.map +1 -0
- package/dist/src/services/genesis-sync.d.ts +29 -0
- package/dist/src/services/genesis-sync.d.ts.map +1 -0
- package/dist/src/services/genesis-sync.js +370 -0
- package/dist/src/services/genesis-sync.js.map +1 -0
- package/dist/src/services/hooks.d.ts +21 -0
- package/dist/src/services/hooks.d.ts.map +1 -0
- package/dist/src/services/hooks.js +85 -0
- package/dist/src/services/hooks.js.map +1 -0
- package/dist/src/services/job-seeding.d.ts +7 -0
- package/dist/src/services/job-seeding.d.ts.map +1 -0
- package/dist/src/services/job-seeding.js +39 -0
- package/dist/src/services/job-seeding.js.map +1 -0
- package/dist/src/services/knowledge.d.ts +13 -0
- package/dist/src/services/knowledge.d.ts.map +1 -0
- package/dist/src/services/knowledge.js +15 -0
- package/dist/src/services/knowledge.js.map +1 -0
- package/dist/src/services/mailbox-notification.d.ts +37 -0
- package/dist/src/services/mailbox-notification.d.ts.map +1 -0
- package/dist/src/services/mailbox-notification.js +249 -0
- package/dist/src/services/mailbox-notification.js.map +1 -0
- package/dist/src/services/mailbox.d.ts +16 -0
- package/dist/src/services/mailbox.d.ts.map +1 -0
- package/dist/src/services/mailbox.js +77 -0
- package/dist/src/services/mailbox.js.map +1 -0
- package/dist/src/services/match-notification.d.ts +12 -0
- package/dist/src/services/match-notification.d.ts.map +1 -0
- package/dist/src/services/match-notification.js +121 -0
- package/dist/src/services/match-notification.js.map +1 -0
- package/dist/src/services/matching.d.ts +54 -0
- package/dist/src/services/matching.d.ts.map +1 -0
- package/dist/src/services/matching.js +293 -0
- package/dist/src/services/matching.js.map +1 -0
- package/dist/src/services/memory-replication.d.ts +43 -0
- package/dist/src/services/memory-replication.d.ts.map +1 -0
- package/dist/src/services/memory-replication.js +213 -0
- package/dist/src/services/memory-replication.js.map +1 -0
- package/dist/src/services/morsel.d.ts +49 -0
- package/dist/src/services/morsel.d.ts.map +1 -0
- package/dist/src/services/morsel.js +174 -0
- package/dist/src/services/morsel.js.map +1 -0
- package/dist/src/services/msm-parser.d.ts +55 -0
- package/dist/src/services/msm-parser.d.ts.map +1 -0
- package/dist/src/services/msm-parser.js +186 -0
- package/dist/src/services/msm-parser.js.map +1 -0
- package/dist/src/services/mydata-receipt.d.ts +29 -0
- package/dist/src/services/mydata-receipt.d.ts.map +1 -0
- package/dist/src/services/mydata-receipt.js +31 -0
- package/dist/src/services/mydata-receipt.js.map +1 -0
- package/dist/src/services/notification-templates.d.ts +40 -0
- package/dist/src/services/notification-templates.d.ts.map +1 -0
- package/dist/src/services/notification-templates.js +109 -0
- package/dist/src/services/notification-templates.js.map +1 -0
- package/dist/src/services/openrouter.d.ts +30 -0
- package/dist/src/services/openrouter.d.ts.map +1 -0
- package/dist/src/services/openrouter.js +95 -0
- package/dist/src/services/openrouter.js.map +1 -0
- package/dist/src/services/organism-reputation.d.ts +7 -0
- package/dist/src/services/organism-reputation.d.ts.map +1 -0
- package/dist/src/services/organism-reputation.js +107 -0
- package/dist/src/services/organism-reputation.js.map +1 -0
- package/dist/src/services/package-hash.d.ts +19 -0
- package/dist/src/services/package-hash.d.ts.map +1 -0
- package/dist/src/services/package-hash.js +22 -0
- package/dist/src/services/package-hash.js.map +1 -0
- package/dist/src/services/package-zip.d.ts +60 -0
- package/dist/src/services/package-zip.d.ts.map +1 -0
- package/dist/src/services/package-zip.js +267 -0
- package/dist/src/services/package-zip.js.map +1 -0
- package/dist/src/services/password.d.ts +9 -0
- package/dist/src/services/password.d.ts.map +1 -0
- package/dist/src/services/password.js +32 -0
- package/dist/src/services/password.js.map +1 -0
- package/dist/src/services/personal-routing.d.ts +21 -0
- package/dist/src/services/personal-routing.d.ts.map +1 -0
- package/dist/src/services/personal-routing.js +77 -0
- package/dist/src/services/personal-routing.js.map +1 -0
- package/dist/src/services/personal-tunnel.d.ts +39 -0
- package/dist/src/services/personal-tunnel.d.ts.map +1 -0
- package/dist/src/services/personal-tunnel.js +371 -0
- package/dist/src/services/personal-tunnel.js.map +1 -0
- package/dist/src/services/profile-schemas.d.ts +12 -0
- package/dist/src/services/profile-schemas.d.ts.map +1 -0
- package/dist/src/services/profile-schemas.js +100 -0
- package/dist/src/services/profile-schemas.js.map +1 -0
- package/dist/src/services/prometheus.d.ts +32 -0
- package/dist/src/services/prometheus.d.ts.map +1 -0
- package/dist/src/services/prometheus.js +162 -0
- package/dist/src/services/prometheus.js.map +1 -0
- package/dist/src/services/prompt-defaults.d.ts +33 -0
- package/dist/src/services/prompt-defaults.d.ts.map +1 -0
- package/dist/src/services/prompt-defaults.js +1675 -0
- package/dist/src/services/prompt-defaults.js.map +1 -0
- package/dist/src/services/prompt-seeder.d.ts +8 -0
- package/dist/src/services/prompt-seeder.d.ts.map +1 -0
- package/dist/src/services/prompt-seeder.js +65 -0
- package/dist/src/services/prompt-seeder.js.map +1 -0
- package/dist/src/services/prompt-variables.d.ts +15 -0
- package/dist/src/services/prompt-variables.d.ts.map +1 -0
- package/dist/src/services/prompt-variables.js +34 -0
- package/dist/src/services/prompt-variables.js.map +1 -0
- package/dist/src/services/push.d.ts +26 -0
- package/dist/src/services/push.d.ts.map +1 -0
- package/dist/src/services/push.js +70 -0
- package/dist/src/services/push.js.map +1 -0
- package/dist/src/services/quota.d.ts +45 -0
- package/dist/src/services/quota.d.ts.map +1 -0
- package/dist/src/services/quota.js +129 -0
- package/dist/src/services/quota.js.map +1 -0
- package/dist/src/services/realtime-manager.d.ts +144 -0
- package/dist/src/services/realtime-manager.d.ts.map +1 -0
- package/dist/src/services/realtime-manager.js +640 -0
- package/dist/src/services/realtime-manager.js.map +1 -0
- package/dist/src/services/scheduler.d.ts +55 -0
- package/dist/src/services/scheduler.d.ts.map +1 -0
- package/dist/src/services/scheduler.js +420 -0
- package/dist/src/services/scheduler.js.map +1 -0
- package/dist/src/services/schema-validator.d.ts +20 -0
- package/dist/src/services/schema-validator.d.ts.map +1 -0
- package/dist/src/services/schema-validator.js +68 -0
- package/dist/src/services/schema-validator.js.map +1 -0
- package/dist/src/services/site-sync.d.ts +15 -0
- package/dist/src/services/site-sync.d.ts.map +1 -0
- package/dist/src/services/site-sync.js +99 -0
- package/dist/src/services/site-sync.js.map +1 -0
- package/dist/src/services/site.d.ts +65 -0
- package/dist/src/services/site.d.ts.map +1 -0
- package/dist/src/services/site.js +378 -0
- package/dist/src/services/site.js.map +1 -0
- package/dist/src/services/stats.d.ts +75 -0
- package/dist/src/services/stats.d.ts.map +1 -0
- package/dist/src/services/stats.js +124 -0
- package/dist/src/services/stats.js.map +1 -0
- package/dist/src/services/sync-health.d.ts +53 -0
- package/dist/src/services/sync-health.d.ts.map +1 -0
- package/dist/src/services/sync-health.js +122 -0
- package/dist/src/services/sync-health.js.map +1 -0
- package/dist/src/services/sync-scheduler.d.ts +25 -0
- package/dist/src/services/sync-scheduler.d.ts.map +1 -0
- package/dist/src/services/sync-scheduler.js +211 -0
- package/dist/src/services/sync-scheduler.js.map +1 -0
- package/dist/src/services/totp.d.ts +31 -0
- package/dist/src/services/totp.d.ts.map +1 -0
- package/dist/src/services/totp.js +96 -0
- package/dist/src/services/totp.js.map +1 -0
- package/dist/src/services/trust-broadcast.d.ts +37 -0
- package/dist/src/services/trust-broadcast.d.ts.map +1 -0
- package/dist/src/services/trust-broadcast.js +107 -0
- package/dist/src/services/trust-broadcast.js.map +1 -0
- package/dist/src/services/trust.d.ts +16 -0
- package/dist/src/services/trust.d.ts.map +1 -0
- package/dist/src/services/trust.js +109 -0
- package/dist/src/services/trust.js.map +1 -0
- package/dist/src/services/vc-issuer.d.ts +14 -0
- package/dist/src/services/vc-issuer.d.ts.map +1 -0
- package/dist/src/services/vc-issuer.js +24 -0
- package/dist/src/services/vc-issuer.js.map +1 -0
- package/dist/src/storage/interface.d.ts +1161 -0
- package/dist/src/storage/interface.d.ts.map +1 -0
- package/dist/src/storage/interface.js +2 -0
- package/dist/src/storage/interface.js.map +1 -0
- package/dist/src/storage/pattern-utils.d.ts +20 -0
- package/dist/src/storage/pattern-utils.d.ts.map +1 -0
- package/dist/src/storage/pattern-utils.js +57 -0
- package/dist/src/storage/pattern-utils.js.map +1 -0
- package/dist/src/storage/providers/mongodb/index.d.ts +608 -0
- package/dist/src/storage/providers/mongodb/index.d.ts.map +1 -0
- package/dist/src/storage/providers/mongodb/index.js +4931 -0
- package/dist/src/storage/providers/mongodb/index.js.map +1 -0
- package/dist/src/storage/providers/sqlite/index.d.ts +602 -0
- package/dist/src/storage/providers/sqlite/index.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/index.js +4156 -0
- package/dist/src/storage/providers/sqlite/index.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/action.d.ts +13 -0
- package/dist/src/storage/providers/sqlite/repos/action.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/action.js +79 -0
- package/dist/src/storage/providers/sqlite/repos/action.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/agent.d.ts +13 -0
- package/dist/src/storage/providers/sqlite/repos/agent.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/agent.js +103 -0
- package/dist/src/storage/providers/sqlite/repos/agent.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/auth.d.ts +56 -0
- package/dist/src/storage/providers/sqlite/repos/auth.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/auth.js +282 -0
- package/dist/src/storage/providers/sqlite/repos/auth.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/board.d.ts +24 -0
- package/dist/src/storage/providers/sqlite/repos/board.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/board.js +154 -0
- package/dist/src/storage/providers/sqlite/repos/board.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/community.d.ts +33 -0
- package/dist/src/storage/providers/sqlite/repos/community.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/community.js +202 -0
- package/dist/src/storage/providers/sqlite/repos/community.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/consent.d.ts +23 -0
- package/dist/src/storage/providers/sqlite/repos/consent.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/consent.js +187 -0
- package/dist/src/storage/providers/sqlite/repos/consent.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/dispute.d.ts +20 -0
- package/dist/src/storage/providers/sqlite/repos/dispute.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/dispute.js +118 -0
- package/dist/src/storage/providers/sqlite/repos/dispute.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/flag.d.ts +26 -0
- package/dist/src/storage/providers/sqlite/repos/flag.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/flag.js +147 -0
- package/dist/src/storage/providers/sqlite/repos/flag.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/identity.d.ts +36 -0
- package/dist/src/storage/providers/sqlite/repos/identity.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/identity.js +297 -0
- package/dist/src/storage/providers/sqlite/repos/identity.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/mailbox.d.ts +18 -0
- package/dist/src/storage/providers/sqlite/repos/mailbox.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/mailbox.js +91 -0
- package/dist/src/storage/providers/sqlite/repos/mailbox.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/memory.d.ts +28 -0
- package/dist/src/storage/providers/sqlite/repos/memory.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/memory.js +152 -0
- package/dist/src/storage/providers/sqlite/repos/memory.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/owner.d.ts +14 -0
- package/dist/src/storage/providers/sqlite/repos/owner.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/owner.js +124 -0
- package/dist/src/storage/providers/sqlite/repos/owner.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/service-manifest.d.ts +17 -0
- package/dist/src/storage/providers/sqlite/repos/service-manifest.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/service-manifest.js +114 -0
- package/dist/src/storage/providers/sqlite/repos/service-manifest.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/storage-file.d.ts +19 -0
- package/dist/src/storage/providers/sqlite/repos/storage-file.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/storage-file.js +128 -0
- package/dist/src/storage/providers/sqlite/repos/storage-file.js.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/work.d.ts +13 -0
- package/dist/src/storage/providers/sqlite/repos/work.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/repos/work.js +86 -0
- package/dist/src/storage/providers/sqlite/repos/work.js.map +1 -0
- package/dist/src/storage/providers/sqlite/schema.d.ts +7 -0
- package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -0
- package/dist/src/storage/providers/sqlite/schema.js +1090 -0
- package/dist/src/storage/providers/sqlite/schema.js.map +1 -0
- package/dist/src/storage/repositories/action.repository.d.ts +14 -0
- package/dist/src/storage/repositories/action.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/action.repository.js +2 -0
- package/dist/src/storage/repositories/action.repository.js.map +1 -0
- package/dist/src/storage/repositories/agent.repository.d.ts +18 -0
- package/dist/src/storage/repositories/agent.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/agent.repository.js +2 -0
- package/dist/src/storage/repositories/agent.repository.js.map +1 -0
- package/dist/src/storage/repositories/app-marketplace.repository.d.ts +9 -0
- package/dist/src/storage/repositories/app-marketplace.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/app-marketplace.repository.js +2 -0
- package/dist/src/storage/repositories/app-marketplace.repository.js.map +1 -0
- package/dist/src/storage/repositories/app.repository.d.ts +17 -0
- package/dist/src/storage/repositories/app.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/app.repository.js +2 -0
- package/dist/src/storage/repositories/app.repository.js.map +1 -0
- package/dist/src/storage/repositories/auth.repository.d.ts +6 -0
- package/dist/src/storage/repositories/auth.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/auth.repository.js +2 -0
- package/dist/src/storage/repositories/auth.repository.js.map +1 -0
- package/dist/src/storage/repositories/board.repository.d.ts +27 -0
- package/dist/src/storage/repositories/board.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/board.repository.js +2 -0
- package/dist/src/storage/repositories/board.repository.js.map +1 -0
- package/dist/src/storage/repositories/catalogue.repository.d.ts +18 -0
- package/dist/src/storage/repositories/catalogue.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/catalogue.repository.js +2 -0
- package/dist/src/storage/repositories/catalogue.repository.js.map +1 -0
- package/dist/src/storage/repositories/config.repository.d.ts +17 -0
- package/dist/src/storage/repositories/config.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/config.repository.js +2 -0
- package/dist/src/storage/repositories/config.repository.js.map +1 -0
- package/dist/src/storage/repositories/consent.repository.d.ts +19 -0
- package/dist/src/storage/repositories/consent.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/consent.repository.js +2 -0
- package/dist/src/storage/repositories/consent.repository.js.map +1 -0
- package/dist/src/storage/repositories/device-auth.repository.d.ts +11 -0
- package/dist/src/storage/repositories/device-auth.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/device-auth.repository.js +2 -0
- package/dist/src/storage/repositories/device-auth.repository.js.map +1 -0
- package/dist/src/storage/repositories/dispute.repository.d.ts +12 -0
- package/dist/src/storage/repositories/dispute.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/dispute.repository.js +2 -0
- package/dist/src/storage/repositories/dispute.repository.js.map +1 -0
- package/dist/src/storage/repositories/extension-instance.repository.d.ts +9 -0
- package/dist/src/storage/repositories/extension-instance.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/extension-instance.repository.js +2 -0
- package/dist/src/storage/repositories/extension-instance.repository.js.map +1 -0
- package/dist/src/storage/repositories/federation.repository.d.ts +37 -0
- package/dist/src/storage/repositories/federation.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/federation.repository.js +2 -0
- package/dist/src/storage/repositories/federation.repository.js.map +1 -0
- package/dist/src/storage/repositories/file.repository.d.ts +14 -0
- package/dist/src/storage/repositories/file.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/file.repository.js +2 -0
- package/dist/src/storage/repositories/file.repository.js.map +1 -0
- package/dist/src/storage/repositories/identity.repository.d.ts +29 -0
- package/dist/src/storage/repositories/identity.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/identity.repository.js +2 -0
- package/dist/src/storage/repositories/identity.repository.js.map +1 -0
- package/dist/src/storage/repositories/index.d.ts +34 -0
- package/dist/src/storage/repositories/index.d.ts.map +1 -0
- package/dist/src/storage/repositories/index.js +2 -0
- package/dist/src/storage/repositories/index.js.map +1 -0
- package/dist/src/storage/repositories/knowledge.repository.d.ts +18 -0
- package/dist/src/storage/repositories/knowledge.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/knowledge.repository.js +2 -0
- package/dist/src/storage/repositories/knowledge.repository.js.map +1 -0
- package/dist/src/storage/repositories/marketplace.repository.d.ts +23 -0
- package/dist/src/storage/repositories/marketplace.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/marketplace.repository.js +2 -0
- package/dist/src/storage/repositories/marketplace.repository.js.map +1 -0
- package/dist/src/storage/repositories/memory.repository.d.ts +32 -0
- package/dist/src/storage/repositories/memory.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/memory.repository.js +2 -0
- package/dist/src/storage/repositories/memory.repository.js.map +1 -0
- package/dist/src/storage/repositories/micro-memory.repository.d.ts +10 -0
- package/dist/src/storage/repositories/micro-memory.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/micro-memory.repository.js +2 -0
- package/dist/src/storage/repositories/micro-memory.repository.js.map +1 -0
- package/dist/src/storage/repositories/moderation.repository.d.ts +36 -0
- package/dist/src/storage/repositories/moderation.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/moderation.repository.js +2 -0
- package/dist/src/storage/repositories/moderation.repository.js.map +1 -0
- package/dist/src/storage/repositories/node.repository.d.ts +59 -0
- package/dist/src/storage/repositories/node.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/node.repository.js +2 -0
- package/dist/src/storage/repositories/node.repository.js.map +1 -0
- package/dist/src/storage/repositories/notification-template.repository.d.ts +8 -0
- package/dist/src/storage/repositories/notification-template.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/notification-template.repository.js +2 -0
- package/dist/src/storage/repositories/notification-template.repository.js.map +1 -0
- package/dist/src/storage/repositories/notification.repository.d.ts +14 -0
- package/dist/src/storage/repositories/notification.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/notification.repository.js +2 -0
- package/dist/src/storage/repositories/notification.repository.js.map +1 -0
- package/dist/src/storage/repositories/oauth.repository.d.ts +19 -0
- package/dist/src/storage/repositories/oauth.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/oauth.repository.js +2 -0
- package/dist/src/storage/repositories/oauth.repository.js.map +1 -0
- package/dist/src/storage/repositories/organism.repository.d.ts +34 -0
- package/dist/src/storage/repositories/organism.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/organism.repository.js +2 -0
- package/dist/src/storage/repositories/organism.repository.js.map +1 -0
- package/dist/src/storage/repositories/otk.repository.d.ts +9 -0
- package/dist/src/storage/repositories/otk.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/otk.repository.js +2 -0
- package/dist/src/storage/repositories/otk.repository.js.map +1 -0
- package/dist/src/storage/repositories/owner.repository.d.ts +9 -0
- package/dist/src/storage/repositories/owner.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/owner.repository.js +2 -0
- package/dist/src/storage/repositories/owner.repository.js.map +1 -0
- package/dist/src/storage/repositories/package-instance.repository.d.ts +26 -0
- package/dist/src/storage/repositories/package-instance.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/package-instance.repository.js +12 -0
- package/dist/src/storage/repositories/package-instance.repository.js.map +1 -0
- package/dist/src/storage/repositories/package.repository.d.ts +28 -0
- package/dist/src/storage/repositories/package.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/package.repository.js +12 -0
- package/dist/src/storage/repositories/package.repository.js.map +1 -0
- package/dist/src/storage/repositories/replication-queue.repository.d.ts +10 -0
- package/dist/src/storage/repositories/replication-queue.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/replication-queue.repository.js +2 -0
- package/dist/src/storage/repositories/replication-queue.repository.js.map +1 -0
- package/dist/src/storage/repositories/scheduler.repository.d.ts +30 -0
- package/dist/src/storage/repositories/scheduler.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/scheduler.repository.js +2 -0
- package/dist/src/storage/repositories/scheduler.repository.js.map +1 -0
- package/dist/src/storage/repositories/schema.repository.d.ts +9 -0
- package/dist/src/storage/repositories/schema.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/schema.repository.js +2 -0
- package/dist/src/storage/repositories/schema.repository.js.map +1 -0
- package/dist/src/storage/repositories/session.repository.d.ts +22 -0
- package/dist/src/storage/repositories/session.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/session.repository.js +2 -0
- package/dist/src/storage/repositories/session.repository.js.map +1 -0
- package/dist/src/storage/repositories/system-prompt.repository.d.ts +14 -0
- package/dist/src/storage/repositories/system-prompt.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/system-prompt.repository.js +2 -0
- package/dist/src/storage/repositories/system-prompt.repository.js.map +1 -0
- package/dist/src/storage/repositories/template-listing.repository.d.ts +44 -0
- package/dist/src/storage/repositories/template-listing.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/template-listing.repository.js +13 -0
- package/dist/src/storage/repositories/template-listing.repository.js.map +1 -0
- package/dist/src/storage/repositories/wallet.repository.d.ts +8 -0
- package/dist/src/storage/repositories/wallet.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/wallet.repository.js +2 -0
- package/dist/src/storage/repositories/wallet.repository.js.map +1 -0
- package/dist/src/storage/repositories/work.repository.d.ts +10 -0
- package/dist/src/storage/repositories/work.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/work.repository.js +2 -0
- package/dist/src/storage/repositories/work.repository.js.map +1 -0
- package/dist/src/storage/storage-factory.d.ts +9 -0
- package/dist/src/storage/storage-factory.d.ts.map +1 -0
- package/dist/src/storage/storage-factory.js +20 -0
- package/dist/src/storage/storage-factory.js.map +1 -0
- package/dist/src/types/route-manifest.d.ts +53 -0
- package/dist/src/types/route-manifest.d.ts.map +1 -0
- package/dist/src/types/route-manifest.js +44 -0
- package/dist/src/types/route-manifest.js.map +1 -0
- package/dist/src/utils/catalogue-hash.d.ts +10 -0
- package/dist/src/utils/catalogue-hash.d.ts.map +1 -0
- package/dist/src/utils/catalogue-hash.js +23 -0
- package/dist/src/utils/catalogue-hash.js.map +1 -0
- package/dist/src/utils/env-config.d.ts +8 -0
- package/dist/src/utils/env-config.d.ts.map +1 -0
- package/dist/src/utils/env-config.js +1264 -0
- package/dist/src/utils/env-config.js.map +1 -0
- package/dist/src/utils/env-validator.d.ts +14 -0
- package/dist/src/utils/env-validator.d.ts.map +1 -0
- package/dist/src/utils/env-validator.js +338 -0
- package/dist/src/utils/env-validator.js.map +1 -0
- package/dist/src/utils/fire-hook.d.ts +9 -0
- package/dist/src/utils/fire-hook.d.ts.map +1 -0
- package/dist/src/utils/fire-hook.js +12 -0
- package/dist/src/utils/fire-hook.js.map +1 -0
- package/dist/src/utils/gaii.d.ts +57 -0
- package/dist/src/utils/gaii.d.ts.map +1 -0
- package/dist/src/utils/gaii.js +148 -0
- package/dist/src/utils/gaii.js.map +1 -0
- package/dist/src/utils/ghii-resolver.d.ts +14 -0
- package/dist/src/utils/ghii-resolver.d.ts.map +1 -0
- package/dist/src/utils/ghii-resolver.js +21 -0
- package/dist/src/utils/ghii-resolver.js.map +1 -0
- package/dist/src/utils/logger.d.ts +9 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +36 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/otk.d.ts +2 -0
- package/dist/src/utils/otk.d.ts.map +1 -0
- package/dist/src/utils/otk.js +5 -0
- package/dist/src/utils/otk.js.map +1 -0
- package/dist/src/utils/tracking-code.d.ts +9 -0
- package/dist/src/utils/tracking-code.d.ts.map +1 -0
- package/dist/src/utils/tracking-code.js +16 -0
- package/dist/src/utils/tracking-code.js.map +1 -0
- package/dist/src/utils/url-validator.d.ts +5 -0
- package/dist/src/utils/url-validator.d.ts.map +1 -0
- package/dist/src/utils/url-validator.js +56 -0
- package/dist/src/utils/url-validator.js.map +1 -0
- package/dist/static/app-catalog.html +4401 -0
- package/dist/static/cookieconsent.css +1 -0
- package/dist/static/cookieconsent.umd.js +7 -0
- package/dist/static/icons/icon-maskable.svg +27 -0
- package/dist/static/icons/icon.svg +27 -0
- package/dist/static/manifest.json +17 -0
- package/dist/static/offline.html +167 -0
- package/dist/static/sw.js +260 -0
- package/package.json +182 -0
- package/prisma/schema.prisma +1086 -0
|
@@ -0,0 +1,1115 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { generateKeyPair } from '../auth/keypair.js';
|
|
3
|
+
import { requireAuth } from '../auth/middleware.js';
|
|
4
|
+
import { success, error } from '../middleware/envelope.js';
|
|
5
|
+
import { emitChange } from '../services/event-bus.js';
|
|
6
|
+
import { validateOwnerName, buildGAII } from '../utils/gaii.js';
|
|
7
|
+
import { issueJWT } from '../auth/jwt.js';
|
|
8
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
9
|
+
import { validateTotpCode, validateBackupCode } from '../services/totp.js';
|
|
10
|
+
import { hashPassword, verifyPassword } from '../services/password.js';
|
|
11
|
+
import { rateLimit } from '../middleware/rate-limit.js';
|
|
12
|
+
// SECURITY: Password strength validation
|
|
13
|
+
const WEAK_PASSWORDS = [
|
|
14
|
+
'password', 'admin', 'testadminpw123', '123456', '12345678', 'letmein', 'qwerty',
|
|
15
|
+
'abc123', 'TestAdminPw123!', 'secret', 'test', 'demo', 'welcome', 'login',
|
|
16
|
+
'master', 'dragon', 'monkey', 'shadow', 'sunshine', 'trustno1',
|
|
17
|
+
];
|
|
18
|
+
function validatePasswordStrength(password) {
|
|
19
|
+
if (password.length < 8)
|
|
20
|
+
return 'Password must be at least 8 characters';
|
|
21
|
+
if (!/[A-Z]/.test(password))
|
|
22
|
+
return 'Password must contain an uppercase letter';
|
|
23
|
+
if (!/[a-z]/.test(password))
|
|
24
|
+
return 'Password must contain a lowercase letter';
|
|
25
|
+
if (!/[0-9]/.test(password))
|
|
26
|
+
return 'Password must contain a number';
|
|
27
|
+
if (WEAK_PASSWORDS.includes(password.toLowerCase()))
|
|
28
|
+
return 'Password is too common';
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* GHII — Global Human Intelligence Identifier
|
|
33
|
+
*
|
|
34
|
+
* Human identity layer on top of AIMEAT's owner system.
|
|
35
|
+
* GHII format: username@nodeId (e.g. alice@aimeat-finland-001)
|
|
36
|
+
*
|
|
37
|
+
* Key distinction:
|
|
38
|
+
* - Operators/admins are owners with role=['owner','operator'] — they manage the node
|
|
39
|
+
* - GHII users are owners with role=['owner'] + a GHII profile — they use apps
|
|
40
|
+
*/
|
|
41
|
+
export function ghiiRouter(config, storage, emailService, onDirectoryChange) {
|
|
42
|
+
const router = Router();
|
|
43
|
+
// POST /v1/ghii — Register a new human identity (no auth required)
|
|
44
|
+
// Creates an owner account + GHII profile in one step
|
|
45
|
+
router.post('/v1/ghii', async (req, res) => {
|
|
46
|
+
const { username, display_name, bio, avatar, locale, password } = req.body ?? {};
|
|
47
|
+
if (!username || typeof username !== 'string') {
|
|
48
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'username is required'));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const nameError = validateOwnerName(username);
|
|
52
|
+
if (nameError) {
|
|
53
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', nameError));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (!display_name || typeof display_name !== 'string') {
|
|
57
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'display_name is required'));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// SECURITY: Validate password strength if provided
|
|
61
|
+
if (password !== undefined && password !== null) {
|
|
62
|
+
if (typeof password !== 'string') {
|
|
63
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'Password must be a string'));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const pwErr = validatePasswordStrength(password);
|
|
67
|
+
if (pwErr) {
|
|
68
|
+
res.status(400).json(error(config.nodeId, 'WEAK_PASSWORD', pwErr));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Hash password if provided (validation already done above)
|
|
73
|
+
const passwordHash = (typeof password === 'string' && password.length >= 8)
|
|
74
|
+
? await hashPassword(password)
|
|
75
|
+
: undefined;
|
|
76
|
+
// Check if owner name is already taken
|
|
77
|
+
const existingOwner = await storage.getOwner(username);
|
|
78
|
+
const ghii = `${username}@${config.nodeId}`;
|
|
79
|
+
// Preserve old roles before dev-mode wipe (so operator isn't lost)
|
|
80
|
+
let preservedRoles = null;
|
|
81
|
+
if (existingOwner) {
|
|
82
|
+
if (config.devMode) {
|
|
83
|
+
// Dev mode: wipe old account and re-create (lost credentials recovery)
|
|
84
|
+
preservedRoles = existingOwner.roles;
|
|
85
|
+
const oldAgents = await storage.getAgentsByOwner(username);
|
|
86
|
+
for (const agent of oldAgents) {
|
|
87
|
+
await storage.deleteAgent(agent.gaii);
|
|
88
|
+
}
|
|
89
|
+
const oldGhii = await storage.getGHII(ghii);
|
|
90
|
+
if (oldGhii)
|
|
91
|
+
await storage.deleteGHII(ghii);
|
|
92
|
+
await storage.deleteOwner(username);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
res.status(409).json(error(config.nodeId, 'NAME_TAKEN', `Username "${username}" is already registered`));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Generate keypair for the owner account
|
|
100
|
+
const keyPair = await generateKeyPair();
|
|
101
|
+
// First real owner gets operator role (same logic as /v1/owners)
|
|
102
|
+
// Also restore operator if the account previously had it (dev-mode re-create)
|
|
103
|
+
// Self-heal: if no operator exists anywhere, promote this user
|
|
104
|
+
const allOwners = await storage.listOwners();
|
|
105
|
+
const realOwners = allOwners.filter(o => o.name !== 'anonymous');
|
|
106
|
+
const hasOperator = allOwners.some(o => o.roles.includes('operator'));
|
|
107
|
+
const roles = ['owner'];
|
|
108
|
+
if (realOwners.length === 0 || !hasOperator || preservedRoles?.includes('operator')) {
|
|
109
|
+
roles.push('operator');
|
|
110
|
+
}
|
|
111
|
+
const owner = await storage.createOwner({
|
|
112
|
+
name: username,
|
|
113
|
+
displayName: display_name,
|
|
114
|
+
publicKey: keyPair.publicKey,
|
|
115
|
+
roles,
|
|
116
|
+
createdAt: new Date().toISOString(),
|
|
117
|
+
});
|
|
118
|
+
// Create GHII profile with welcome bonus
|
|
119
|
+
const now = new Date().toISOString();
|
|
120
|
+
const ghiiRecord = await storage.createGHII({
|
|
121
|
+
username,
|
|
122
|
+
nodeId: config.nodeId,
|
|
123
|
+
ghii,
|
|
124
|
+
displayName: display_name,
|
|
125
|
+
bio: typeof bio === 'string' ? bio : undefined,
|
|
126
|
+
avatar: typeof avatar === 'string' ? avatar : undefined,
|
|
127
|
+
locale: typeof locale === 'string' ? locale : undefined,
|
|
128
|
+
passwordHash,
|
|
129
|
+
verificationLevel: 0,
|
|
130
|
+
ownerName: owner.name,
|
|
131
|
+
totpEnabled: false,
|
|
132
|
+
morselBalance: config.welcomeBonus,
|
|
133
|
+
createdAt: now,
|
|
134
|
+
updatedAt: now,
|
|
135
|
+
});
|
|
136
|
+
// Record welcome bonus transaction
|
|
137
|
+
if (config.welcomeBonus > 0) {
|
|
138
|
+
await storage.addTransaction({
|
|
139
|
+
id: `tx-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
|
140
|
+
gaii: ghii,
|
|
141
|
+
type: 'welcome_bonus',
|
|
142
|
+
amount: config.welcomeBonus,
|
|
143
|
+
timestamp: now,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// SECURITY: Prevent caching of response containing private key
|
|
147
|
+
res.set('Cache-Control', 'no-store');
|
|
148
|
+
res.set('Pragma', 'no-cache');
|
|
149
|
+
res.status(201).json(success(config.nodeId, {
|
|
150
|
+
ghii: {
|
|
151
|
+
ghii: ghiiRecord.ghii,
|
|
152
|
+
username: ghiiRecord.username,
|
|
153
|
+
display_name: ghiiRecord.displayName,
|
|
154
|
+
bio: ghiiRecord.bio,
|
|
155
|
+
avatar: ghiiRecord.avatar,
|
|
156
|
+
locale: ghiiRecord.locale,
|
|
157
|
+
verification_level: ghiiRecord.verificationLevel,
|
|
158
|
+
created_at: ghiiRecord.createdAt,
|
|
159
|
+
},
|
|
160
|
+
owner: {
|
|
161
|
+
name: owner.name,
|
|
162
|
+
roles: owner.roles,
|
|
163
|
+
},
|
|
164
|
+
private_key: keyPair.privateKey,
|
|
165
|
+
public_key: keyPair.publicKey,
|
|
166
|
+
has_password: !!passwordHash,
|
|
167
|
+
note: 'SECURITY: Store the private key securely. It cannot be retrieved again. Consider client-side key generation for enhanced security.',
|
|
168
|
+
}, [
|
|
169
|
+
{ description: 'Create an agent for your identity', method: 'POST', url: '/v1/agents' },
|
|
170
|
+
{ description: 'Update your GHII profile', method: 'PUT', url: '/v1/ghii' },
|
|
171
|
+
{ description: 'View your public profile', method: 'GET', url: `/v1/ghii/${encodeURIComponent(ghii)}` },
|
|
172
|
+
]));
|
|
173
|
+
emitChange('ghii');
|
|
174
|
+
});
|
|
175
|
+
// TOTP config for login 2FA verification (Phase 0.5)
|
|
176
|
+
const totpConfig = {
|
|
177
|
+
issuer: config.totpIssuer,
|
|
178
|
+
algorithm: 'SHA1',
|
|
179
|
+
digits: 6,
|
|
180
|
+
period: config.totpPeriod,
|
|
181
|
+
window: config.totpWindow,
|
|
182
|
+
backupCodeCount: config.totpBackupCodeCount,
|
|
183
|
+
encryptionKey: config.totpSecretEncryptionKey
|
|
184
|
+
? Buffer.from(config.totpSecretEncryptionKey, 'hex')
|
|
185
|
+
: undefined,
|
|
186
|
+
};
|
|
187
|
+
// POST /v1/ghii/login — Login with username + password from any device
|
|
188
|
+
// Regenerates keys, creates agent if missing, returns full session
|
|
189
|
+
router.post('/v1/ghii/login', async (req, res) => {
|
|
190
|
+
const { username, password, totp_code, backup_code } = req.body ?? {};
|
|
191
|
+
if (!username || typeof username !== 'string') {
|
|
192
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'username is required'));
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (!password || typeof password !== 'string') {
|
|
196
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'password is required'));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const ghii = `${username}@${config.nodeId}`;
|
|
200
|
+
const ghiiRecord = await storage.getGHII(ghii);
|
|
201
|
+
if (!ghiiRecord) {
|
|
202
|
+
res.status(401).json(error(config.nodeId, 'AUTH_REQUIRED', 'Invalid username or password'));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (!ghiiRecord.passwordHash) {
|
|
206
|
+
res.status(400).json(error(config.nodeId, 'NO_PASSWORD', 'This account has no password set. Password login is not available.'));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const valid = await verifyPassword(password, ghiiRecord.passwordHash);
|
|
210
|
+
if (!valid) {
|
|
211
|
+
res.status(401).json(error(config.nodeId, 'AUTH_REQUIRED', 'Invalid username or password'));
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
// Email confirmation check — if operator requires it, block unverified users
|
|
215
|
+
if (config.emailConfirmationRequired && ghiiRecord.verificationLevel < 1) {
|
|
216
|
+
res.status(403).json(error(config.nodeId, 'EMAIL_NOT_VERIFIED', 'Email verification is required before you can log in. Check your email for the verification code.'));
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
// TOTP 2FA check (Phase 0.5) — if TOTP is enabled, require a valid code
|
|
220
|
+
if (ghiiRecord.totpEnabled && ghiiRecord.totpSecret) {
|
|
221
|
+
// Check lockout
|
|
222
|
+
if (ghiiRecord.totpLockedUntil) {
|
|
223
|
+
const lockExpires = new Date(ghiiRecord.totpLockedUntil).getTime();
|
|
224
|
+
if (Date.now() < lockExpires) {
|
|
225
|
+
res.status(429).json(error(config.nodeId, 'TOTP_LOCKED', `Account temporarily locked due to too many failed TOTP attempts. Try again after ${ghiiRecord.totpLockedUntil}`));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
// Lock expired — reset counters
|
|
229
|
+
await storage.updateGHII(ghiiRecord.ghii, {
|
|
230
|
+
totpFailedAttempts: 0,
|
|
231
|
+
totpLockedUntil: undefined,
|
|
232
|
+
});
|
|
233
|
+
ghiiRecord.totpFailedAttempts = 0;
|
|
234
|
+
ghiiRecord.totpLockedUntil = undefined;
|
|
235
|
+
}
|
|
236
|
+
let totpVerified = false;
|
|
237
|
+
// Try TOTP code
|
|
238
|
+
if (totp_code && typeof totp_code === 'string') {
|
|
239
|
+
// Replay protection: reject if same code was just used
|
|
240
|
+
if (ghiiRecord.totpLastUsedCode === totp_code) {
|
|
241
|
+
res.status(401).json(error(config.nodeId, 'TOTP_REPLAY', 'This TOTP code has already been used. Wait for the next code.'));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const totpResult = validateTotpCode(ghiiRecord.totpSecret, totp_code, totpConfig);
|
|
245
|
+
if (totpResult.valid) {
|
|
246
|
+
totpVerified = true;
|
|
247
|
+
await storage.updateGHII(ghiiRecord.ghii, {
|
|
248
|
+
totpLastUsedAt: new Date().toISOString(),
|
|
249
|
+
totpLastUsedCode: totp_code,
|
|
250
|
+
totpFailedAttempts: 0,
|
|
251
|
+
totpLockedUntil: undefined,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Try backup code
|
|
256
|
+
if (!totpVerified && backup_code && typeof backup_code === 'string' && ghiiRecord.totpBackupCodes) {
|
|
257
|
+
const backupResult = validateBackupCode(backup_code, ghiiRecord.totpBackupCodes);
|
|
258
|
+
if (backupResult.valid) {
|
|
259
|
+
totpVerified = true;
|
|
260
|
+
// Remove used backup code
|
|
261
|
+
const updatedCodes = [...ghiiRecord.totpBackupCodes];
|
|
262
|
+
updatedCodes.splice(backupResult.index, 1);
|
|
263
|
+
await storage.updateGHII(ghiiRecord.ghii, {
|
|
264
|
+
totpBackupCodes: updatedCodes,
|
|
265
|
+
totpFailedAttempts: 0,
|
|
266
|
+
totpLockedUntil: undefined,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (!totpVerified) {
|
|
271
|
+
// If neither code was provided at all, tell the client TOTP is required
|
|
272
|
+
if (!totp_code && !backup_code) {
|
|
273
|
+
res.status(401).json(error(config.nodeId, 'TOTP_REQUIRED', 'This account has two-factor authentication enabled. Provide totp_code or backup_code.'));
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
// Increment failed attempts
|
|
277
|
+
const attempts = (ghiiRecord.totpFailedAttempts ?? 0) + 1;
|
|
278
|
+
const lockUntil = attempts >= config.totpMaxFailedAttempts
|
|
279
|
+
? new Date(Date.now() + config.totpLockoutSeconds * 1000).toISOString()
|
|
280
|
+
: undefined;
|
|
281
|
+
await storage.updateGHII(ghiiRecord.ghii, {
|
|
282
|
+
totpFailedAttempts: attempts,
|
|
283
|
+
totpLockedUntil: lockUntil,
|
|
284
|
+
});
|
|
285
|
+
if (lockUntil) {
|
|
286
|
+
res.status(429).json(error(config.nodeId, 'TOTP_LOCKED', `Too many failed TOTP attempts. Account locked until ${lockUntil}`));
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
res.status(401).json(error(config.nodeId, 'INVALID_TOTP', 'Invalid TOTP code or backup code.'));
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// Password (+ TOTP if enabled) verified — regenerate owner keys
|
|
294
|
+
const ownerKeyPair = await generateKeyPair();
|
|
295
|
+
await storage.updateOwner(username, { publicKey: ownerKeyPair.publicKey });
|
|
296
|
+
// Issue OWNER JWT (human users authenticate as owners, not agents)
|
|
297
|
+
const ownerRecord = await storage.getOwner(username);
|
|
298
|
+
const roles = [];
|
|
299
|
+
if (ownerRecord?.roles.includes('owner'))
|
|
300
|
+
roles.push('owner');
|
|
301
|
+
if (ownerRecord?.roles.includes('operator'))
|
|
302
|
+
roles.push('operator');
|
|
303
|
+
// Self-heal: if no operator exists anywhere, promote this user
|
|
304
|
+
if (ownerRecord && !roles.includes('operator')) {
|
|
305
|
+
const allOwners = await storage.listOwners();
|
|
306
|
+
const hasOperator = allOwners.some(o => o.roles.includes('operator'));
|
|
307
|
+
if (!hasOperator) {
|
|
308
|
+
roles.push('operator');
|
|
309
|
+
await storage.updateOwner(username, { roles: [...ownerRecord.roles, 'operator'] });
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const token = await issueJWT({
|
|
313
|
+
sub: username,
|
|
314
|
+
owner: username,
|
|
315
|
+
node: config.nodeId,
|
|
316
|
+
roles,
|
|
317
|
+
}, config.jwtTtlSeconds);
|
|
318
|
+
// SECURITY: Prevent caching of response containing private keys
|
|
319
|
+
res.set('Cache-Control', 'no-store');
|
|
320
|
+
res.set('Pragma', 'no-cache');
|
|
321
|
+
res.json(success(config.nodeId, {
|
|
322
|
+
ghii: {
|
|
323
|
+
ghii: ghiiRecord.ghii,
|
|
324
|
+
username: ghiiRecord.username,
|
|
325
|
+
display_name: ghiiRecord.displayName,
|
|
326
|
+
},
|
|
327
|
+
owner: { name: username },
|
|
328
|
+
token,
|
|
329
|
+
expires_at: new Date(Date.now() + config.jwtTtlSeconds * 1000).toISOString(),
|
|
330
|
+
owner_private_key: ownerKeyPair.privateKey,
|
|
331
|
+
owner_public_key: ownerKeyPair.publicKey,
|
|
332
|
+
}, [
|
|
333
|
+
{ description: 'Store data in memory', method: 'POST', url: '/v1/memory' },
|
|
334
|
+
{ description: 'Upload an app', method: 'POST', url: '/v1/apps' },
|
|
335
|
+
]));
|
|
336
|
+
emitChange('ghii');
|
|
337
|
+
});
|
|
338
|
+
// ── Phase 1.3 — Web Registration, Email Verification, Magic Link ──
|
|
339
|
+
// POST /v1/ghii/register-web — Web registration (no auth required)
|
|
340
|
+
// Creates owner + GHII profile with optional email verification
|
|
341
|
+
router.post('/v1/ghii/register-web', async (req, res) => {
|
|
342
|
+
const { username, display_name, email, locale, city, area, interests } = req.body ?? {};
|
|
343
|
+
if (!username || typeof username !== 'string') {
|
|
344
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'username is required'));
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
const nameError = validateOwnerName(username);
|
|
348
|
+
if (nameError) {
|
|
349
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', nameError));
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
if (!display_name || typeof display_name !== 'string') {
|
|
353
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'display_name is required'));
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
// Check if owner name is already taken
|
|
357
|
+
const existingOwner = await storage.getOwner(username);
|
|
358
|
+
if (existingOwner) {
|
|
359
|
+
res.status(409).json(error(config.nodeId, 'NAME_TAKEN', `Username "${username}" is already registered`));
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
// Hash email if provided
|
|
363
|
+
const emailHash = (typeof email === 'string' && email.length > 0)
|
|
364
|
+
? createHash('sha256').update(email.toLowerCase().trim()).digest('hex')
|
|
365
|
+
: undefined;
|
|
366
|
+
// Generate keypair for the owner account
|
|
367
|
+
const keyPair = await generateKeyPair();
|
|
368
|
+
// First real owner gets operator role (same logic as /v1/owners)
|
|
369
|
+
const allOwners = await storage.listOwners();
|
|
370
|
+
const realOwners = allOwners.filter(o => o.name !== 'anonymous');
|
|
371
|
+
const roles = ['owner'];
|
|
372
|
+
if (realOwners.length === 0) {
|
|
373
|
+
roles.push('operator');
|
|
374
|
+
}
|
|
375
|
+
// Create owner with role=['owner'] (+ 'operator' if first)
|
|
376
|
+
const owner = await storage.createOwner({
|
|
377
|
+
name: username,
|
|
378
|
+
displayName: display_name,
|
|
379
|
+
publicKey: keyPair.publicKey,
|
|
380
|
+
roles,
|
|
381
|
+
createdAt: new Date().toISOString(),
|
|
382
|
+
});
|
|
383
|
+
// Create GHII profile with verificationLevel: 0 and welcome bonus
|
|
384
|
+
const now = new Date().toISOString();
|
|
385
|
+
const ghii = `${username}@${config.nodeId}`;
|
|
386
|
+
const ghiiRecord = await storage.createGHII({
|
|
387
|
+
username,
|
|
388
|
+
nodeId: config.nodeId,
|
|
389
|
+
ghii,
|
|
390
|
+
displayName: display_name,
|
|
391
|
+
locale: typeof locale === 'string' ? locale : undefined,
|
|
392
|
+
verificationLevel: 0,
|
|
393
|
+
ownerName: owner.name,
|
|
394
|
+
totpEnabled: false,
|
|
395
|
+
emailHash,
|
|
396
|
+
magicLinkEnabled: !!emailHash,
|
|
397
|
+
notificationEmail: (typeof email === 'string' && email.length > 0) ? email.toLowerCase().trim() : undefined,
|
|
398
|
+
morselBalance: config.welcomeBonus,
|
|
399
|
+
loginCount: 0,
|
|
400
|
+
createdAt: now,
|
|
401
|
+
updatedAt: now,
|
|
402
|
+
});
|
|
403
|
+
// Record welcome bonus transaction
|
|
404
|
+
if (config.welcomeBonus > 0) {
|
|
405
|
+
await storage.addTransaction({
|
|
406
|
+
id: `tx-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
|
407
|
+
gaii: ghii,
|
|
408
|
+
type: 'welcome_bonus',
|
|
409
|
+
amount: config.welcomeBonus,
|
|
410
|
+
timestamp: now,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
// Store interest profile in memory if interests provided
|
|
414
|
+
if (Array.isArray(interests) && interests.length > 0) {
|
|
415
|
+
const agentGaii = `app#${username}@${config.nodeId}`;
|
|
416
|
+
await storage.setMemory({
|
|
417
|
+
key: `profile.${username}.interests`,
|
|
418
|
+
ownerGaii: agentGaii,
|
|
419
|
+
value: interests,
|
|
420
|
+
visibility: 'public',
|
|
421
|
+
tags: ['profile', 'interests'],
|
|
422
|
+
ttlHours: null,
|
|
423
|
+
version: 1,
|
|
424
|
+
createdAt: now,
|
|
425
|
+
updatedAt: now,
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
// Send verification email if email is provided and email service is enabled
|
|
429
|
+
let verificationId;
|
|
430
|
+
if (typeof email === 'string' && email.length > 0 && emailService?.enabled) {
|
|
431
|
+
const code = String(Math.floor(100000 + Math.random() * 900000));
|
|
432
|
+
const codeHash = createHash('sha256').update(code).digest('hex');
|
|
433
|
+
const verId = randomBytes(16).toString('hex');
|
|
434
|
+
await storage.createEmailVerification({
|
|
435
|
+
id: verId,
|
|
436
|
+
ownerName: username,
|
|
437
|
+
emailHash: emailHash,
|
|
438
|
+
code: codeHash,
|
|
439
|
+
purpose: 'registration',
|
|
440
|
+
status: 'pending',
|
|
441
|
+
attempts: 0,
|
|
442
|
+
expiresAt: new Date(Date.now() + 15 * 60 * 1000).toISOString(), // 15 min
|
|
443
|
+
createdAt: now,
|
|
444
|
+
verifiedAt: null,
|
|
445
|
+
});
|
|
446
|
+
await emailService.sendVerificationCode(email, code, typeof locale === 'string' ? locale : undefined);
|
|
447
|
+
verificationId = verId;
|
|
448
|
+
}
|
|
449
|
+
// Notify directory of new profile (Phase 1.4 — event-driven refresh)
|
|
450
|
+
if (onDirectoryChange)
|
|
451
|
+
onDirectoryChange();
|
|
452
|
+
// SECURITY: Prevent caching of response containing private key
|
|
453
|
+
res.set('Cache-Control', 'no-store');
|
|
454
|
+
res.set('Pragma', 'no-cache');
|
|
455
|
+
res.status(201).json(success(config.nodeId, {
|
|
456
|
+
ghii: {
|
|
457
|
+
ghii: ghiiRecord.ghii,
|
|
458
|
+
username: ghiiRecord.username,
|
|
459
|
+
display_name: ghiiRecord.displayName,
|
|
460
|
+
locale: ghiiRecord.locale,
|
|
461
|
+
verification_level: ghiiRecord.verificationLevel,
|
|
462
|
+
magic_link_enabled: ghiiRecord.magicLinkEnabled,
|
|
463
|
+
created_at: ghiiRecord.createdAt,
|
|
464
|
+
},
|
|
465
|
+
owner: {
|
|
466
|
+
name: owner.name,
|
|
467
|
+
roles: owner.roles,
|
|
468
|
+
},
|
|
469
|
+
private_key: keyPair.privateKey,
|
|
470
|
+
public_key: keyPair.publicKey,
|
|
471
|
+
verification_id: verificationId ?? null,
|
|
472
|
+
note: 'Store the private key securely. It cannot be retrieved again.',
|
|
473
|
+
}, [
|
|
474
|
+
...(verificationId
|
|
475
|
+
? [{ description: 'Verify your email', method: 'POST', url: '/v1/ghii/verify-email' }]
|
|
476
|
+
: []),
|
|
477
|
+
{ description: 'Create an agent', method: 'POST', url: '/v1/agents' },
|
|
478
|
+
{ description: 'View your profile', method: 'GET', url: `/v1/ghii/${encodeURIComponent(ghii)}` },
|
|
479
|
+
]));
|
|
480
|
+
emitChange('ghii');
|
|
481
|
+
});
|
|
482
|
+
// POST /v1/ghii/verify-email — Verify email code (no auth)
|
|
483
|
+
router.post('/v1/ghii/verify-email', async (req, res) => {
|
|
484
|
+
const { verification_id, code } = req.body ?? {};
|
|
485
|
+
if (!verification_id || typeof verification_id !== 'string') {
|
|
486
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'verification_id is required'));
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
if (!code || typeof code !== 'string') {
|
|
490
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'code is required'));
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const record = await storage.getEmailVerification(verification_id);
|
|
494
|
+
if (!record) {
|
|
495
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Verification record not found'));
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
if (record.status !== 'pending') {
|
|
499
|
+
res.status(400).json(error(config.nodeId, 'ALREADY_VERIFIED', 'This verification has already been completed'));
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
if (new Date(record.expiresAt).getTime() < Date.now()) {
|
|
503
|
+
await storage.updateEmailVerification(verification_id, { status: 'expired' });
|
|
504
|
+
res.status(400).json(error(config.nodeId, 'EXPIRED', 'Verification code has expired'));
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
if (record.attempts >= 5) {
|
|
508
|
+
res.status(429).json(error(config.nodeId, 'TOO_MANY_ATTEMPTS', 'Too many failed attempts'));
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
// Hash the provided code and compare
|
|
512
|
+
const codeHash = createHash('sha256').update(code).digest('hex');
|
|
513
|
+
if (codeHash !== record.code) {
|
|
514
|
+
await storage.updateEmailVerification(verification_id, { attempts: record.attempts + 1 });
|
|
515
|
+
res.status(400).json(error(config.nodeId, 'INVALID_CODE', 'Invalid verification code'));
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
// Mark as verified
|
|
519
|
+
const now = new Date().toISOString();
|
|
520
|
+
await storage.updateEmailVerification(verification_id, {
|
|
521
|
+
status: 'verified',
|
|
522
|
+
verifiedAt: now,
|
|
523
|
+
});
|
|
524
|
+
// Update GHII with verified email info
|
|
525
|
+
const ghii = `${record.ownerName}@${config.nodeId}`;
|
|
526
|
+
await storage.updateGHII(ghii, {
|
|
527
|
+
emailHash: record.emailHash,
|
|
528
|
+
emailVerifiedAt: now,
|
|
529
|
+
verificationLevel: 1,
|
|
530
|
+
verificationMethod: 'email',
|
|
531
|
+
magicLinkEnabled: true,
|
|
532
|
+
});
|
|
533
|
+
// Create an agent if not exists, then issue JWT
|
|
534
|
+
const agents = await storage.getAgentsByOwner(record.ownerName);
|
|
535
|
+
let agent = agents.find(a => a.name === 'app');
|
|
536
|
+
let agentPrivKey;
|
|
537
|
+
if (!agent) {
|
|
538
|
+
const agentKeyPair = await generateKeyPair();
|
|
539
|
+
const gaii = buildGAII('app', record.ownerName, config.nodeId);
|
|
540
|
+
agent = await storage.createAgent({
|
|
541
|
+
name: 'app',
|
|
542
|
+
owner: record.ownerName,
|
|
543
|
+
gaii,
|
|
544
|
+
displayName: `${record.ownerName}'s App Agent`,
|
|
545
|
+
description: 'Default agent for AIMEAT apps',
|
|
546
|
+
capabilities: [],
|
|
547
|
+
publicKey: agentKeyPair.publicKey,
|
|
548
|
+
trustScore: 50,
|
|
549
|
+
morselBalance: 0,
|
|
550
|
+
createdAt: now,
|
|
551
|
+
lastSeen: now,
|
|
552
|
+
});
|
|
553
|
+
agentPrivKey = agentKeyPair.privateKey;
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
const agentKeyPair = await generateKeyPair();
|
|
557
|
+
await storage.updateAgent(agent.gaii, { publicKey: agentKeyPair.publicKey });
|
|
558
|
+
agentPrivKey = agentKeyPair.privateKey;
|
|
559
|
+
}
|
|
560
|
+
// Issue JWT
|
|
561
|
+
const ownerRecord = await storage.getOwner(record.ownerName);
|
|
562
|
+
const roles = ['agent'];
|
|
563
|
+
if (ownerRecord?.roles.includes('owner'))
|
|
564
|
+
roles.push('owner');
|
|
565
|
+
if (ownerRecord?.roles.includes('operator'))
|
|
566
|
+
roles.push('operator');
|
|
567
|
+
const token = await issueJWT({
|
|
568
|
+
sub: agent.gaii,
|
|
569
|
+
owner: record.ownerName,
|
|
570
|
+
node: config.nodeId,
|
|
571
|
+
roles,
|
|
572
|
+
}, config.jwtTtlSeconds);
|
|
573
|
+
// SECURITY: Prevent caching of response containing private key
|
|
574
|
+
res.set('Cache-Control', 'no-store');
|
|
575
|
+
res.set('Pragma', 'no-cache');
|
|
576
|
+
res.json(success(config.nodeId, {
|
|
577
|
+
verified: true,
|
|
578
|
+
ghii,
|
|
579
|
+
verification_level: 1,
|
|
580
|
+
token,
|
|
581
|
+
expires_at: new Date(Date.now() + config.jwtTtlSeconds * 1000).toISOString(),
|
|
582
|
+
agent: { gaii: agent.gaii },
|
|
583
|
+
agent_private_key: agentPrivKey,
|
|
584
|
+
}, [
|
|
585
|
+
{ description: 'Store data in memory', method: 'POST', url: '/v1/memory' },
|
|
586
|
+
{ description: 'View your profile', method: 'GET', url: `/v1/ghii/${encodeURIComponent(ghii)}` },
|
|
587
|
+
]));
|
|
588
|
+
emitChange('ghii');
|
|
589
|
+
});
|
|
590
|
+
// POST /v1/ghii/magic-link — Request magic link login (no auth)
|
|
591
|
+
router.post('/v1/ghii/magic-link', async (req, res) => {
|
|
592
|
+
const { email } = req.body ?? {};
|
|
593
|
+
if (!email || typeof email !== 'string') {
|
|
594
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'email is required'));
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
// Hash email to find user
|
|
598
|
+
const emailHash = createHash('sha256').update(email.toLowerCase().trim()).digest('hex');
|
|
599
|
+
const ghiiRecord = await storage.getGHIIByEmailHash(emailHash);
|
|
600
|
+
// Always return 200 to not reveal if user exists
|
|
601
|
+
if (ghiiRecord && ghiiRecord.magicLinkEnabled && emailService?.enabled) {
|
|
602
|
+
const token = randomBytes(32).toString('hex');
|
|
603
|
+
const codeHash = createHash('sha256').update(token).digest('hex');
|
|
604
|
+
const now = new Date().toISOString();
|
|
605
|
+
await storage.createEmailVerification({
|
|
606
|
+
id: token,
|
|
607
|
+
ownerName: ghiiRecord.ownerName,
|
|
608
|
+
emailHash,
|
|
609
|
+
code: codeHash,
|
|
610
|
+
purpose: 'login',
|
|
611
|
+
status: 'pending',
|
|
612
|
+
attempts: 0,
|
|
613
|
+
expiresAt: new Date(Date.now() + 15 * 60 * 1000).toISOString(), // 15 min
|
|
614
|
+
createdAt: now,
|
|
615
|
+
verifiedAt: null,
|
|
616
|
+
});
|
|
617
|
+
const loginUrl = `${config.baseUrl}/v1/ghii/magic-link/verify?token=${token}`;
|
|
618
|
+
await emailService.sendMagicLink(email, loginUrl, ghiiRecord.locale);
|
|
619
|
+
}
|
|
620
|
+
res.json(success(config.nodeId, {
|
|
621
|
+
sent: true,
|
|
622
|
+
note: 'If an account with that email exists, a magic link has been sent.',
|
|
623
|
+
}));
|
|
624
|
+
emitChange('ghii');
|
|
625
|
+
});
|
|
626
|
+
// GET /v1/ghii/magic-link/verify — Verify magic link (query param: token)
|
|
627
|
+
router.get('/v1/ghii/magic-link/verify', async (req, res) => {
|
|
628
|
+
const token = typeof req.query.token === 'string' ? req.query.token : undefined;
|
|
629
|
+
if (!token) {
|
|
630
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'token query parameter is required'));
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
const record = await storage.getEmailVerification(token);
|
|
634
|
+
if (!record || record.status !== 'pending' || record.purpose !== 'login') {
|
|
635
|
+
res.status(401).json(error(config.nodeId, 'INVALID_TOKEN', 'Invalid or expired magic link'));
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
if (new Date(record.expiresAt).getTime() < Date.now()) {
|
|
639
|
+
await storage.updateEmailVerification(token, { status: 'expired' });
|
|
640
|
+
res.status(401).json(error(config.nodeId, 'EXPIRED', 'Magic link has expired'));
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
// Mark verification as used
|
|
644
|
+
const now = new Date().toISOString();
|
|
645
|
+
await storage.updateEmailVerification(token, {
|
|
646
|
+
status: 'verified',
|
|
647
|
+
verifiedAt: now,
|
|
648
|
+
});
|
|
649
|
+
// Update GHII last login + auto-verify email (clicking magic link IS email verification)
|
|
650
|
+
const ghii = `${record.ownerName}@${config.nodeId}`;
|
|
651
|
+
const ghiiRecord = await storage.getGHII(ghii);
|
|
652
|
+
if (ghiiRecord) {
|
|
653
|
+
await storage.updateGHII(ghii, {
|
|
654
|
+
lastLoginAt: now,
|
|
655
|
+
loginCount: (ghiiRecord.loginCount ?? 0) + 1,
|
|
656
|
+
verificationLevel: Math.max(ghiiRecord.verificationLevel ?? 0, 1),
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
// Re-key owner
|
|
660
|
+
const ownerKeyPair = await generateKeyPair();
|
|
661
|
+
await storage.updateOwner(record.ownerName, { publicKey: ownerKeyPair.publicKey });
|
|
662
|
+
// Find or create a default agent
|
|
663
|
+
const agents = await storage.getAgentsByOwner(record.ownerName);
|
|
664
|
+
let agent = agents.find(a => a.name === 'app');
|
|
665
|
+
let agentPrivKey;
|
|
666
|
+
if (agent) {
|
|
667
|
+
const agentKeyPair = await generateKeyPair();
|
|
668
|
+
await storage.updateAgent(agent.gaii, { publicKey: agentKeyPair.publicKey });
|
|
669
|
+
agentPrivKey = agentKeyPair.privateKey;
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
const agentKeyPair = await generateKeyPair();
|
|
673
|
+
const gaii = buildGAII('app', record.ownerName, config.nodeId);
|
|
674
|
+
agent = await storage.createAgent({
|
|
675
|
+
name: 'app',
|
|
676
|
+
owner: record.ownerName,
|
|
677
|
+
gaii,
|
|
678
|
+
displayName: `${record.ownerName}'s App Agent`,
|
|
679
|
+
description: 'Default agent for AIMEAT apps',
|
|
680
|
+
capabilities: [],
|
|
681
|
+
publicKey: agentKeyPair.publicKey,
|
|
682
|
+
trustScore: 50,
|
|
683
|
+
morselBalance: 0,
|
|
684
|
+
createdAt: now,
|
|
685
|
+
lastSeen: now,
|
|
686
|
+
});
|
|
687
|
+
agentPrivKey = agentKeyPair.privateKey;
|
|
688
|
+
}
|
|
689
|
+
// Issue JWT
|
|
690
|
+
const ownerRecord = await storage.getOwner(record.ownerName);
|
|
691
|
+
const roles = ['agent'];
|
|
692
|
+
if (ownerRecord?.roles.includes('owner'))
|
|
693
|
+
roles.push('owner');
|
|
694
|
+
if (ownerRecord?.roles.includes('operator'))
|
|
695
|
+
roles.push('operator');
|
|
696
|
+
const jwtToken = await issueJWT({
|
|
697
|
+
sub: agent.gaii,
|
|
698
|
+
owner: record.ownerName,
|
|
699
|
+
node: config.nodeId,
|
|
700
|
+
roles,
|
|
701
|
+
}, config.jwtTtlSeconds);
|
|
702
|
+
// SECURITY: Prevent caching of response containing private keys
|
|
703
|
+
res.set('Cache-Control', 'no-store');
|
|
704
|
+
res.set('Pragma', 'no-cache');
|
|
705
|
+
res.json(success(config.nodeId, {
|
|
706
|
+
ghii,
|
|
707
|
+
token: jwtToken,
|
|
708
|
+
expires_at: new Date(Date.now() + config.jwtTtlSeconds * 1000).toISOString(),
|
|
709
|
+
owner_private_key: ownerKeyPair.privateKey,
|
|
710
|
+
agent: { gaii: agent.gaii },
|
|
711
|
+
agent_private_key: agentPrivKey,
|
|
712
|
+
}, [
|
|
713
|
+
{ description: 'Store data in memory', method: 'POST', url: '/v1/memory' },
|
|
714
|
+
{ description: 'View your profile', method: 'GET', url: `/v1/ghii/${encodeURIComponent(ghii)}` },
|
|
715
|
+
]));
|
|
716
|
+
});
|
|
717
|
+
// ── Phase 1.4 — Email Verification, Password Reset, Account Recovery ──
|
|
718
|
+
// POST /v1/ghii/email/verify — Send verification code to verify email (auth required)
|
|
719
|
+
router.post('/v1/ghii/email/verify', requireAuth(), rateLimit({ max: 3, windowMs: 10 * 60 * 1000 }), async (req, res) => {
|
|
720
|
+
const ownerName = req.auth.owner;
|
|
721
|
+
const { email } = req.body ?? {};
|
|
722
|
+
if (!email || typeof email !== 'string') {
|
|
723
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'email is required'));
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
// Basic email format validation
|
|
727
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim())) {
|
|
728
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'Invalid email format'));
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
const ghiiRecord = await storage.getGHIIByOwner(ownerName);
|
|
732
|
+
if (!ghiiRecord) {
|
|
733
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'No GHII profile found'));
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
const normalizedEmail = email.toLowerCase().trim();
|
|
737
|
+
const emailHash = createHash('sha256').update(normalizedEmail).digest('hex');
|
|
738
|
+
const code = String(Math.floor(100000 + Math.random() * 900000));
|
|
739
|
+
const codeHash = createHash('sha256').update(code).digest('hex');
|
|
740
|
+
const now = new Date().toISOString();
|
|
741
|
+
const verId = randomBytes(16).toString('hex');
|
|
742
|
+
await storage.createEmailVerification({
|
|
743
|
+
id: verId,
|
|
744
|
+
ownerName,
|
|
745
|
+
emailHash,
|
|
746
|
+
code: codeHash,
|
|
747
|
+
purpose: 'email_verification',
|
|
748
|
+
status: 'pending',
|
|
749
|
+
attempts: 0,
|
|
750
|
+
expiresAt: new Date(Date.now() + 10 * 60 * 1000).toISOString(), // 10 min
|
|
751
|
+
createdAt: now,
|
|
752
|
+
verifiedAt: null,
|
|
753
|
+
});
|
|
754
|
+
// Store notificationEmail on GHII so we know what email to associate after confirmation
|
|
755
|
+
const ghii = `${ownerName}@${config.nodeId}`;
|
|
756
|
+
await storage.updateGHII(ghii, { notificationEmail: normalizedEmail });
|
|
757
|
+
// Send verification email if service is available
|
|
758
|
+
if (emailService?.enabled) {
|
|
759
|
+
const locale = ghiiRecord.locale;
|
|
760
|
+
await emailService.sendVerificationCode(normalizedEmail, code, locale);
|
|
761
|
+
}
|
|
762
|
+
res.json(success(config.nodeId, {
|
|
763
|
+
ok: true,
|
|
764
|
+
message: 'Verification code sent',
|
|
765
|
+
verification_id: verId,
|
|
766
|
+
}));
|
|
767
|
+
});
|
|
768
|
+
// POST /v1/ghii/email/confirm — Confirm email verification code (auth required)
|
|
769
|
+
router.post('/v1/ghii/email/confirm', requireAuth(), async (req, res) => {
|
|
770
|
+
const ownerName = req.auth.owner;
|
|
771
|
+
const { code, verification_id } = req.body ?? {};
|
|
772
|
+
if (!code || typeof code !== 'string') {
|
|
773
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'code is required'));
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
// Find the most recent pending email_verification for this owner
|
|
777
|
+
let record;
|
|
778
|
+
if (verification_id && typeof verification_id === 'string') {
|
|
779
|
+
record = await storage.getEmailVerification(verification_id);
|
|
780
|
+
if (record && record.ownerName !== ownerName)
|
|
781
|
+
record = null;
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
record = await storage.getActiveEmailVerification(ownerName, 'email_verification');
|
|
785
|
+
}
|
|
786
|
+
if (!record || record.status !== 'pending') {
|
|
787
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'No pending verification found'));
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
if (new Date(record.expiresAt).getTime() < Date.now()) {
|
|
791
|
+
await storage.updateEmailVerification(record.id, { status: 'expired' });
|
|
792
|
+
res.status(400).json(error(config.nodeId, 'EXPIRED', 'Verification code has expired'));
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
if (record.attempts >= 5) {
|
|
796
|
+
res.status(429).json(error(config.nodeId, 'TOO_MANY_ATTEMPTS', 'Too many failed attempts'));
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const codeHash = createHash('sha256').update(code).digest('hex');
|
|
800
|
+
if (codeHash !== record.code) {
|
|
801
|
+
await storage.updateEmailVerification(record.id, { attempts: record.attempts + 1 });
|
|
802
|
+
res.status(400).json(error(config.nodeId, 'INVALID_CODE', 'Invalid verification code'));
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
// Mark as verified
|
|
806
|
+
const now = new Date().toISOString();
|
|
807
|
+
await storage.updateEmailVerification(record.id, {
|
|
808
|
+
status: 'verified',
|
|
809
|
+
verifiedAt: now,
|
|
810
|
+
});
|
|
811
|
+
// Update GHII with verified email info
|
|
812
|
+
const ghii = `${ownerName}@${config.nodeId}`;
|
|
813
|
+
// Find the email from the verification record's emailHash
|
|
814
|
+
// We store the notificationEmail separately to keep it accessible
|
|
815
|
+
await storage.updateGHII(ghii, {
|
|
816
|
+
emailHash: record.emailHash,
|
|
817
|
+
emailVerifiedAt: now,
|
|
818
|
+
verificationLevel: 1,
|
|
819
|
+
verificationMethod: 'email',
|
|
820
|
+
});
|
|
821
|
+
res.json(success(config.nodeId, {
|
|
822
|
+
ok: true,
|
|
823
|
+
verified: true,
|
|
824
|
+
}));
|
|
825
|
+
emitChange('ghii');
|
|
826
|
+
});
|
|
827
|
+
// POST /v1/ghii/password/reset-request — Request password reset (NO auth)
|
|
828
|
+
router.post('/v1/ghii/password/reset-request', rateLimit({ max: 3, windowMs: 10 * 60 * 1000 }), async (req, res) => {
|
|
829
|
+
const { username } = req.body ?? {};
|
|
830
|
+
if (!username || typeof username !== 'string') {
|
|
831
|
+
// Always return same response to not reveal if account exists
|
|
832
|
+
res.json(success(config.nodeId, {
|
|
833
|
+
ok: true,
|
|
834
|
+
message: 'If account has verified email, code was sent',
|
|
835
|
+
}));
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
const ghii = `${username}@${config.nodeId}`;
|
|
839
|
+
const ghiiRecord = await storage.getGHII(ghii);
|
|
840
|
+
if (ghiiRecord && ghiiRecord.notificationEmail && ghiiRecord.emailVerifiedAt && emailService?.enabled) {
|
|
841
|
+
const code = String(Math.floor(100000 + Math.random() * 900000));
|
|
842
|
+
const codeHash = createHash('sha256').update(code).digest('hex');
|
|
843
|
+
const now = new Date().toISOString();
|
|
844
|
+
const verId = randomBytes(16).toString('hex');
|
|
845
|
+
await storage.createEmailVerification({
|
|
846
|
+
id: verId,
|
|
847
|
+
ownerName: username,
|
|
848
|
+
emailHash: ghiiRecord.emailHash ?? '',
|
|
849
|
+
code: codeHash,
|
|
850
|
+
purpose: 'password_reset',
|
|
851
|
+
status: 'pending',
|
|
852
|
+
attempts: 0,
|
|
853
|
+
expiresAt: new Date(Date.now() + 10 * 60 * 1000).toISOString(), // 10 min
|
|
854
|
+
createdAt: now,
|
|
855
|
+
verifiedAt: null,
|
|
856
|
+
});
|
|
857
|
+
// Send reset code via email
|
|
858
|
+
await emailService.sendVerificationCode(ghiiRecord.notificationEmail, code, ghiiRecord.locale);
|
|
859
|
+
}
|
|
860
|
+
// Always return same response to not reveal if account exists
|
|
861
|
+
res.json(success(config.nodeId, {
|
|
862
|
+
ok: true,
|
|
863
|
+
message: 'If account has verified email, code was sent',
|
|
864
|
+
}));
|
|
865
|
+
});
|
|
866
|
+
// POST /v1/ghii/password/reset — Reset password with code (NO auth)
|
|
867
|
+
router.post('/v1/ghii/password/reset', rateLimit({ max: 3, windowMs: 10 * 60 * 1000 }), async (req, res) => {
|
|
868
|
+
const { username, code, newPassword } = req.body ?? {};
|
|
869
|
+
if (!username || typeof username !== 'string') {
|
|
870
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'username is required'));
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
if (!code || typeof code !== 'string') {
|
|
874
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'code is required'));
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
if (!newPassword || typeof newPassword !== 'string') {
|
|
878
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'newPassword is required'));
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
// Validate password strength
|
|
882
|
+
const pwErr = validatePasswordStrength(newPassword);
|
|
883
|
+
if (pwErr) {
|
|
884
|
+
res.status(400).json(error(config.nodeId, 'WEAK_PASSWORD', pwErr));
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
// Find pending password_reset verification for this user
|
|
888
|
+
const record = await storage.getActiveEmailVerification(username, 'password_reset');
|
|
889
|
+
if (!record || record.status !== 'pending') {
|
|
890
|
+
res.status(400).json(error(config.nodeId, 'INVALID_CODE', 'Invalid or expired reset code'));
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
if (new Date(record.expiresAt).getTime() < Date.now()) {
|
|
894
|
+
await storage.updateEmailVerification(record.id, { status: 'expired' });
|
|
895
|
+
res.status(400).json(error(config.nodeId, 'EXPIRED', 'Reset code has expired'));
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
if (record.attempts >= 5) {
|
|
899
|
+
res.status(429).json(error(config.nodeId, 'TOO_MANY_ATTEMPTS', 'Too many failed attempts'));
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
const codeHash = createHash('sha256').update(code).digest('hex');
|
|
903
|
+
if (codeHash !== record.code) {
|
|
904
|
+
await storage.updateEmailVerification(record.id, { attempts: record.attempts + 1 });
|
|
905
|
+
res.status(400).json(error(config.nodeId, 'INVALID_CODE', 'Invalid reset code'));
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
// Code valid — update password
|
|
909
|
+
const newHash = await hashPassword(newPassword);
|
|
910
|
+
const ghii = `${username}@${config.nodeId}`;
|
|
911
|
+
await storage.updateGHII(ghii, { passwordHash: newHash });
|
|
912
|
+
// Mark verification as used
|
|
913
|
+
await storage.updateEmailVerification(record.id, {
|
|
914
|
+
status: 'verified',
|
|
915
|
+
verifiedAt: new Date().toISOString(),
|
|
916
|
+
});
|
|
917
|
+
res.json(success(config.nodeId, {
|
|
918
|
+
ok: true,
|
|
919
|
+
message: 'Password reset successful',
|
|
920
|
+
}));
|
|
921
|
+
emitChange('ghii');
|
|
922
|
+
});
|
|
923
|
+
// POST /v1/ghii/account/recover — Send username to verified email (NO auth)
|
|
924
|
+
router.post('/v1/ghii/account/recover', rateLimit({ max: 3, windowMs: 10 * 60 * 1000 }), async (req, res) => {
|
|
925
|
+
const { email } = req.body ?? {};
|
|
926
|
+
if (email && typeof email === 'string') {
|
|
927
|
+
const normalizedEmail = email.toLowerCase().trim();
|
|
928
|
+
const emailHash = createHash('sha256').update(normalizedEmail).digest('hex');
|
|
929
|
+
const ghiiRecord = await storage.getGHIIByEmailHash(emailHash);
|
|
930
|
+
if (ghiiRecord && ghiiRecord.notificationEmail && emailService?.enabled) {
|
|
931
|
+
const locale = ghiiRecord.locale;
|
|
932
|
+
const subject = locale === 'fi' ? 'AIMEAT-tilisi käyttäjätunnus' : 'Your AIMEAT Username';
|
|
933
|
+
const body = locale === 'fi'
|
|
934
|
+
? `Käyttäjätunnuksesi on: ${ghiiRecord.username}\n\nJos et pyytänyt tätä, voit ohittaa tämän viestin.`
|
|
935
|
+
: `Your username is: ${ghiiRecord.username}\n\nIf you did not request this, you can safely ignore this email.`;
|
|
936
|
+
await emailService.sendNotification(ghiiRecord.notificationEmail, subject, body);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
// Always return same response to not reveal if account exists
|
|
940
|
+
res.json(success(config.nodeId, {
|
|
941
|
+
ok: true,
|
|
942
|
+
}));
|
|
943
|
+
});
|
|
944
|
+
// GET /v1/ghii/list — Search/list human identities (Tier 0, no auth)
|
|
945
|
+
// Note: renamed from /v1/ghii/directory to avoid confusion with /v1/catalogue/directory
|
|
946
|
+
// Must be registered BEFORE the /:ghii param route
|
|
947
|
+
router.get('/v1/ghii/list', async (req, res) => {
|
|
948
|
+
const q = typeof req.query.q === 'string' ? req.query.q : undefined;
|
|
949
|
+
const level = typeof req.query.level === 'string' ? parseInt(req.query.level, 10) : undefined;
|
|
950
|
+
const results = await storage.listGHIIs({
|
|
951
|
+
q,
|
|
952
|
+
level: level !== undefined && !isNaN(level) ? level : undefined,
|
|
953
|
+
});
|
|
954
|
+
res.json(success(config.nodeId, {
|
|
955
|
+
humans: results.map(r => ({
|
|
956
|
+
ghii: r.ghii,
|
|
957
|
+
display_name: r.displayName,
|
|
958
|
+
bio: r.bio,
|
|
959
|
+
avatar: r.avatar,
|
|
960
|
+
locale: r.locale,
|
|
961
|
+
verification_level: r.verificationLevel,
|
|
962
|
+
created_at: r.createdAt,
|
|
963
|
+
})),
|
|
964
|
+
total: results.length,
|
|
965
|
+
}));
|
|
966
|
+
});
|
|
967
|
+
// Backward-compatible redirect: /v1/ghii/directory → /v1/ghii/list
|
|
968
|
+
router.get('/v1/ghii/directory', (req, res) => {
|
|
969
|
+
const qs = Object.keys(req.query).length > 0
|
|
970
|
+
? '?' + new URLSearchParams(req.query).toString()
|
|
971
|
+
: '';
|
|
972
|
+
res.redirect(301, `/v1/ghii/list${qs}`);
|
|
973
|
+
});
|
|
974
|
+
// ── CORS per-GHII management ──
|
|
975
|
+
// GET /v1/ghii/cors — Get your CORS allowed origins
|
|
976
|
+
router.get('/v1/ghii/cors', requireAuth(), async (req, res) => {
|
|
977
|
+
const ownerName = req.auth.owner;
|
|
978
|
+
const ghiiRecord = await storage.getGHIIByOwner(ownerName);
|
|
979
|
+
if (!ghiiRecord) {
|
|
980
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'No GHII profile found'));
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
res.json(success(config.nodeId, {
|
|
984
|
+
ghii: ghiiRecord.ghii,
|
|
985
|
+
allowed_origins: ghiiRecord.allowedOrigins ?? null,
|
|
986
|
+
effective: ghiiRecord.allowedOrigins ?? config.corsAllowedOrigins,
|
|
987
|
+
inherited: !ghiiRecord.allowedOrigins,
|
|
988
|
+
}));
|
|
989
|
+
});
|
|
990
|
+
// PUT /v1/ghii/cors — Set your CORS allowed origins
|
|
991
|
+
router.put('/v1/ghii/cors', requireAuth(), async (req, res) => {
|
|
992
|
+
const ownerName = req.auth.owner;
|
|
993
|
+
const ghiiRecord = await storage.getGHIIByOwner(ownerName);
|
|
994
|
+
if (!ghiiRecord) {
|
|
995
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'No GHII profile found'));
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
const { allowed_origins } = req.body ?? {};
|
|
999
|
+
// null = inherit from node default, array = explicit origins
|
|
1000
|
+
if (allowed_origins !== null && !Array.isArray(allowed_origins)) {
|
|
1001
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'allowed_origins must be an array of origin URLs or null to inherit'));
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
if (Array.isArray(allowed_origins)) {
|
|
1005
|
+
for (const origin of allowed_origins) {
|
|
1006
|
+
if (typeof origin !== 'string' || (origin !== '*' && !/^https?:\/\//.test(origin))) {
|
|
1007
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', `Invalid origin: ${origin}. Must be an http(s) URL or '*'`));
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
const updates = {
|
|
1013
|
+
allowedOrigins: allowed_origins === null ? undefined : allowed_origins,
|
|
1014
|
+
};
|
|
1015
|
+
const updated = await storage.updateGHII(ghiiRecord.ghii, updates);
|
|
1016
|
+
if (!updated) {
|
|
1017
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL', 'Failed to update CORS settings'));
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
res.json(success(config.nodeId, {
|
|
1021
|
+
ghii: updated.ghii,
|
|
1022
|
+
allowed_origins: updated.allowedOrigins ?? null,
|
|
1023
|
+
effective: updated.allowedOrigins ?? config.corsAllowedOrigins,
|
|
1024
|
+
inherited: !updated.allowedOrigins,
|
|
1025
|
+
}));
|
|
1026
|
+
emitChange('ghii');
|
|
1027
|
+
});
|
|
1028
|
+
// GET /v1/ghii/:ghii — Public profile (Tier 0, no auth)
|
|
1029
|
+
router.get('/v1/ghii/:ghii', async (req, res) => {
|
|
1030
|
+
const ghii = req.params.ghii;
|
|
1031
|
+
const record = await storage.getGHII(ghii);
|
|
1032
|
+
if (!record) {
|
|
1033
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `GHII "${ghii}" not found`));
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
// Get agents owned by this human
|
|
1037
|
+
const agents = await storage.getAgentsByOwner(record.ownerName);
|
|
1038
|
+
res.json(success(config.nodeId, {
|
|
1039
|
+
ghii: record.ghii,
|
|
1040
|
+
display_name: record.displayName,
|
|
1041
|
+
bio: record.bio,
|
|
1042
|
+
avatar: record.avatar,
|
|
1043
|
+
locale: record.locale,
|
|
1044
|
+
verification_level: record.verificationLevel,
|
|
1045
|
+
semantic: record.semantic,
|
|
1046
|
+
created_at: record.createdAt,
|
|
1047
|
+
agents: agents.map(a => ({
|
|
1048
|
+
gaii: a.gaii,
|
|
1049
|
+
display_name: a.displayName,
|
|
1050
|
+
trust_score: a.trustScore,
|
|
1051
|
+
})),
|
|
1052
|
+
}));
|
|
1053
|
+
});
|
|
1054
|
+
// PUT /v1/ghii — Update own profile (requires JWT auth as owner)
|
|
1055
|
+
router.put('/v1/ghii', requireAuth(), async (req, res) => {
|
|
1056
|
+
const ownerName = req.auth.owner;
|
|
1057
|
+
const ghiiRecord = await storage.getGHIIByOwner(ownerName);
|
|
1058
|
+
if (!ghiiRecord) {
|
|
1059
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'No GHII profile found for your identity'));
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
const { display_name, bio, avatar, locale, notification_email } = req.body ?? {};
|
|
1063
|
+
const updates = {};
|
|
1064
|
+
if (typeof display_name === 'string')
|
|
1065
|
+
updates.displayName = display_name;
|
|
1066
|
+
if (typeof bio === 'string')
|
|
1067
|
+
updates.bio = bio;
|
|
1068
|
+
if (typeof avatar === 'string')
|
|
1069
|
+
updates.avatar = avatar;
|
|
1070
|
+
if (typeof locale === 'string')
|
|
1071
|
+
updates.locale = locale;
|
|
1072
|
+
if (typeof notification_email === 'string')
|
|
1073
|
+
updates.notificationEmail = notification_email;
|
|
1074
|
+
if (Object.keys(updates).length === 0) {
|
|
1075
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'No valid fields to update'));
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
const updated = await storage.updateGHII(ghiiRecord.ghii, updates);
|
|
1079
|
+
if (!updated) {
|
|
1080
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL', 'Failed to update profile'));
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
res.json(success(config.nodeId, {
|
|
1084
|
+
ghii: updated.ghii,
|
|
1085
|
+
display_name: updated.displayName,
|
|
1086
|
+
bio: updated.bio,
|
|
1087
|
+
avatar: updated.avatar,
|
|
1088
|
+
locale: updated.locale,
|
|
1089
|
+
verification_level: updated.verificationLevel,
|
|
1090
|
+
updated_at: updated.updatedAt,
|
|
1091
|
+
}));
|
|
1092
|
+
emitChange('ghii');
|
|
1093
|
+
// Notify directory of profile changes (Phase 1.4 — event-driven refresh)
|
|
1094
|
+
if (onDirectoryChange)
|
|
1095
|
+
onDirectoryChange();
|
|
1096
|
+
});
|
|
1097
|
+
// DELETE /v1/ghii — Delete own GHII profile (requires JWT auth as owner)
|
|
1098
|
+
router.delete('/v1/ghii', requireAuth(), async (req, res) => {
|
|
1099
|
+
const ownerName = req.auth.owner;
|
|
1100
|
+
const ghiiRecord = await storage.getGHIIByOwner(ownerName);
|
|
1101
|
+
if (!ghiiRecord) {
|
|
1102
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'No GHII profile found'));
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
await storage.deleteGHII(ghiiRecord.ghii);
|
|
1106
|
+
res.json(success(config.nodeId, {
|
|
1107
|
+
deleted: true,
|
|
1108
|
+
ghii: ghiiRecord.ghii,
|
|
1109
|
+
note: 'GHII profile deleted. Your owner account and agents are not affected.',
|
|
1110
|
+
}));
|
|
1111
|
+
emitChange('ghii');
|
|
1112
|
+
});
|
|
1113
|
+
return router;
|
|
1114
|
+
}
|
|
1115
|
+
//# sourceMappingURL=ghii.js.map
|