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,1149 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { requireAuth, requireRole } from '../auth/middleware.js';
|
|
4
|
+
import { success, error } from '../middleware/envelope.js';
|
|
5
|
+
import { emitChange } from '../services/event-bus.js';
|
|
6
|
+
import { executeExtensionAction } from '../services/extension-runtime.js';
|
|
7
|
+
import { parse as parseYaml } from 'yaml';
|
|
8
|
+
import { logger } from '../utils/logger.js';
|
|
9
|
+
import { resolveIdentity } from '../utils/gaii.js';
|
|
10
|
+
export function extensionsRouter(config, storage, scheduler, emailService) {
|
|
11
|
+
const router = Router();
|
|
12
|
+
// ── GET /v1/extensions — List installed extensions ────────────
|
|
13
|
+
router.get('/v1/extensions', async (_req, res) => {
|
|
14
|
+
try {
|
|
15
|
+
const extensions = await storage.listExtensions();
|
|
16
|
+
res.json(success(config.nodeId, {
|
|
17
|
+
extensions: extensions.map(ext => ({
|
|
18
|
+
name: ext.name,
|
|
19
|
+
version: ext.version,
|
|
20
|
+
description: ext.description,
|
|
21
|
+
author: ext.author,
|
|
22
|
+
status: ext.status,
|
|
23
|
+
actionCount: ext.actions.length,
|
|
24
|
+
actions: ext.actions.map(a => ({ id: a.id, method: a.method })),
|
|
25
|
+
requiredApis: ext.requiredApis,
|
|
26
|
+
federation: ext.federation,
|
|
27
|
+
instances: ext.instances ?? null,
|
|
28
|
+
installedAt: ext.installedAt,
|
|
29
|
+
activatedAt: ext.activatedAt,
|
|
30
|
+
})),
|
|
31
|
+
total: extensions.length,
|
|
32
|
+
}, [
|
|
33
|
+
{ description: 'Install a new extension', method: 'POST', url: '/v1/extensions' },
|
|
34
|
+
]));
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
logger.error('Failed to list extensions', { error: err.message });
|
|
38
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to list extensions'));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
// ── POST /v1/extensions — Install extension from YAML manifest + JS scripts ──
|
|
42
|
+
router.post('/v1/extensions', requireAuth(), async (req, res) => {
|
|
43
|
+
try {
|
|
44
|
+
const roles = req.auth.roles;
|
|
45
|
+
const allowOwner = config.extInstallRole === 'owner';
|
|
46
|
+
const isOperator = roles.includes('operator');
|
|
47
|
+
const isOwner = roles.includes('owner');
|
|
48
|
+
if (!isOperator && !(allowOwner && isOwner)) {
|
|
49
|
+
res.status(403).json(error(config.nodeId, 'INSUFFICIENT_ROLE', `Extension install requires ${config.extInstallRole} role`));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const { manifest: manifestYaml, scripts } = req.body;
|
|
53
|
+
if (!manifestYaml || typeof manifestYaml !== 'string') {
|
|
54
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'manifest (YAML string) is required'));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!scripts || typeof scripts !== 'object') {
|
|
58
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'scripts object is required'));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// Parse manifest YAML
|
|
62
|
+
let manifest;
|
|
63
|
+
try {
|
|
64
|
+
manifest = parseYaml(manifestYaml);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
res.status(400).json(error(config.nodeId, 'INVALID_MANIFEST', 'Failed to parse manifest YAML'));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Validate required metadata fields
|
|
71
|
+
const metadata = manifest.metadata;
|
|
72
|
+
if (!metadata?.name || !metadata?.version || !metadata?.description || !metadata?.author) {
|
|
73
|
+
res.status(400).json(error(config.nodeId, 'INVALID_MANIFEST', 'metadata.name, metadata.version, metadata.description, and metadata.author are required'));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// Validate actions array
|
|
77
|
+
const actions = manifest.actions;
|
|
78
|
+
if (!Array.isArray(actions) || actions.length === 0) {
|
|
79
|
+
res.status(400).json(error(config.nodeId, 'INVALID_MANIFEST', 'actions array is required and must not be empty'));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
for (const action of actions) {
|
|
83
|
+
if (!action.id || !action.method || !action.path || !action.script) {
|
|
84
|
+
res.status(400).json(error(config.nodeId, 'INVALID_MANIFEST', 'Each action must have id, method, path, and script fields'));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Validate that referenced script exists in scripts object
|
|
88
|
+
if (!scripts[action.script]) {
|
|
89
|
+
res.status(400).json(error(config.nodeId, 'MISSING_SCRIPT', `Script "${action.script}" referenced in action "${action.id}" not found in scripts object`));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Validate instances section if present
|
|
94
|
+
const manifestInstances = manifest.instances;
|
|
95
|
+
if (manifestInstances) {
|
|
96
|
+
if (typeof manifestInstances.supported !== 'boolean') {
|
|
97
|
+
res.status(400).json(error(config.nodeId, 'INVALID_MANIFEST', 'instances.supported must be a boolean'));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (manifestInstances.config_per_instance !== undefined
|
|
101
|
+
&& (typeof manifestInstances.config_per_instance !== 'object' || manifestInstances.config_per_instance === null)) {
|
|
102
|
+
res.status(400).json(error(config.nodeId, 'INVALID_MANIFEST', 'instances.config_per_instance must be an object (JSON Schema)'));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Enforce max installed limit
|
|
107
|
+
const existing = await storage.listExtensions();
|
|
108
|
+
if (existing.length >= config.extensionMaxInstalled) {
|
|
109
|
+
res.status(409).json(error(config.nodeId, 'LIMIT_EXCEEDED', `Maximum ${config.extensionMaxInstalled} extensions allowed`));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
// Owner-level limit check
|
|
113
|
+
if (!isOperator && isOwner) {
|
|
114
|
+
const ownerExts = existing.filter(e => e.installedBy === req.auth.owner);
|
|
115
|
+
if (ownerExts.length >= config.maxExtensionsPerOwner) {
|
|
116
|
+
res.status(429).json(error(config.nodeId, 'EXTENSION_LIMIT', `Maximum ${config.maxExtensionsPerOwner} extensions per owner`));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Reject if extension name already exists
|
|
121
|
+
const name = metadata.name;
|
|
122
|
+
const existingExt = await storage.getExtension(name);
|
|
123
|
+
if (existingExt) {
|
|
124
|
+
res.status(409).json(error(config.nodeId, 'ALREADY_EXISTS', `Extension "${name}" is already installed`));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// Enforce code size limit per script
|
|
128
|
+
for (const [scriptKey, scriptContent] of Object.entries(scripts)) {
|
|
129
|
+
const sizeKb = Buffer.byteLength(scriptContent, 'utf8') / 1024;
|
|
130
|
+
if (sizeKb > config.extensionMaxCodeSizeKb) {
|
|
131
|
+
res.status(400).json(error(config.nodeId, 'CODE_TOO_LARGE', `Script "${scriptKey}" is ${sizeKb.toFixed(1)}KB, max is ${config.extensionMaxCodeSizeKb}KB`));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Build ExtensionRecord
|
|
136
|
+
const manifestConfig = manifest.config;
|
|
137
|
+
const manifestLimits = manifest.limits;
|
|
138
|
+
const manifestFederation = manifest.federation;
|
|
139
|
+
const manifestSchedules = manifest.schedules;
|
|
140
|
+
const record = {
|
|
141
|
+
name,
|
|
142
|
+
version: metadata.version,
|
|
143
|
+
description: metadata.description,
|
|
144
|
+
author: metadata.author,
|
|
145
|
+
status: 'inactive',
|
|
146
|
+
requiredApis: manifest.required_apis ?? [],
|
|
147
|
+
actions: actions.map(a => ({
|
|
148
|
+
id: a.id,
|
|
149
|
+
method: a.method.toUpperCase(),
|
|
150
|
+
path: a.path,
|
|
151
|
+
inputSchema: a.input ?? {},
|
|
152
|
+
outputSchema: a.output ?? {},
|
|
153
|
+
scriptContent: scripts[a.script],
|
|
154
|
+
})),
|
|
155
|
+
config: {
|
|
156
|
+
...(manifestConfig
|
|
157
|
+
? Object.fromEntries(Object.entries(manifestConfig).map(([k, v]) => {
|
|
158
|
+
if (v && typeof v === 'object' && 'default' in v) {
|
|
159
|
+
return [k, v.default];
|
|
160
|
+
}
|
|
161
|
+
return [k, v];
|
|
162
|
+
}))
|
|
163
|
+
: {}),
|
|
164
|
+
...(manifestSchedules ? { __schedules: manifestSchedules } : {}),
|
|
165
|
+
},
|
|
166
|
+
limits: {
|
|
167
|
+
memoryMb: Math.min(manifestLimits?.memory_mb ?? config.extensionMaxMemoryMb, config.extensionMaxMemoryMb),
|
|
168
|
+
timeoutMs: Math.min(manifestLimits?.timeout_ms ?? config.extensionTimeoutMs, config.extensionTimeoutMs),
|
|
169
|
+
maxApiCalls: Math.min(manifestLimits?.max_api_calls ?? config.extensionMaxApiCalls, config.extensionMaxApiCalls),
|
|
170
|
+
},
|
|
171
|
+
federation: {
|
|
172
|
+
advertise: manifestFederation?.advertise ?? false,
|
|
173
|
+
capabilities: manifestFederation?.capabilities ?? [],
|
|
174
|
+
},
|
|
175
|
+
...(manifestInstances?.supported ? {
|
|
176
|
+
instances: {
|
|
177
|
+
supported: true,
|
|
178
|
+
configSchema: manifestInstances.config_per_instance ?? undefined,
|
|
179
|
+
},
|
|
180
|
+
} : {}),
|
|
181
|
+
installedBy: req.auth.owner,
|
|
182
|
+
installedAt: new Date().toISOString(),
|
|
183
|
+
};
|
|
184
|
+
const created = await storage.createExtension(record);
|
|
185
|
+
logger.info(`Extension installed: ${created.name}`, { version: created.version, by: req.auth.owner });
|
|
186
|
+
res.status(201).json(success(config.nodeId, { extension: created }, [
|
|
187
|
+
{ description: 'Activate extension', method: 'POST', url: `/v1/extensions/${created.name}/activate` },
|
|
188
|
+
{ description: 'View extension details', method: 'GET', url: `/v1/extensions/${created.name}` },
|
|
189
|
+
]));
|
|
190
|
+
emitChange('extensions');
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
logger.error('Failed to install extension', { error: err.message });
|
|
194
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to install extension'));
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
// ── GET /v1/extensions/:name — Get extension detail ────────────
|
|
198
|
+
router.get('/v1/extensions/:name', async (req, res) => {
|
|
199
|
+
try {
|
|
200
|
+
const name = req.params.name;
|
|
201
|
+
const ext = await storage.getExtension(name);
|
|
202
|
+
if (!ext) {
|
|
203
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
res.json(success(config.nodeId, {
|
|
207
|
+
extension: {
|
|
208
|
+
...ext,
|
|
209
|
+
// Omit script content from detail view for security
|
|
210
|
+
actions: ext.actions.map(a => ({
|
|
211
|
+
id: a.id,
|
|
212
|
+
method: a.method,
|
|
213
|
+
path: a.path,
|
|
214
|
+
inputSchema: a.inputSchema,
|
|
215
|
+
outputSchema: a.outputSchema,
|
|
216
|
+
})),
|
|
217
|
+
},
|
|
218
|
+
}, [
|
|
219
|
+
{ description: 'Activate extension', method: 'POST', url: `/v1/extensions/${name}/activate` },
|
|
220
|
+
{ description: 'Deactivate extension', method: 'POST', url: `/v1/extensions/${name}/deactivate` },
|
|
221
|
+
{ description: 'Uninstall extension', method: 'DELETE', url: `/v1/extensions/${name}` },
|
|
222
|
+
]));
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
logger.error('Failed to get extension', { error: err.message });
|
|
226
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to get extension'));
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
// ── GET /v1/extensions/:name/actions/:actionId — Get action script content ──
|
|
230
|
+
router.get('/v1/extensions/:name/actions/:actionId', requireAuth(), requireRole('owner'), async (req, res) => {
|
|
231
|
+
try {
|
|
232
|
+
const name = req.params.name;
|
|
233
|
+
const actionId = req.params.actionId;
|
|
234
|
+
const ext = await storage.getExtension(name);
|
|
235
|
+
if (!ext) {
|
|
236
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const action = ext.actions.find(a => a.id === actionId);
|
|
240
|
+
if (!action) {
|
|
241
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Action "${actionId}" not found in extension "${name}"`));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
res.json(success(config.nodeId, {
|
|
245
|
+
action: {
|
|
246
|
+
id: action.id,
|
|
247
|
+
method: action.method,
|
|
248
|
+
path: action.path,
|
|
249
|
+
inputSchema: action.inputSchema,
|
|
250
|
+
outputSchema: action.outputSchema,
|
|
251
|
+
scriptContent: action.scriptContent,
|
|
252
|
+
},
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
logger.error('Failed to get action script', { error: err.message });
|
|
257
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to get action script'));
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
// ── PATCH /v1/extensions/:name/actions/:actionId — Update action script ──
|
|
261
|
+
router.patch('/v1/extensions/:name/actions/:actionId', requireAuth(), async (req, res) => {
|
|
262
|
+
try {
|
|
263
|
+
const name = req.params.name;
|
|
264
|
+
const actionId = req.params.actionId;
|
|
265
|
+
const ext = await storage.getExtension(name);
|
|
266
|
+
if (!ext) {
|
|
267
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
// Allow operator always, owner only if they installed it
|
|
271
|
+
const roles = req.auth.roles;
|
|
272
|
+
if (!roles.includes('operator')) {
|
|
273
|
+
if (config.extInstallRole !== 'owner' || !roles.includes('owner') || ext.installedBy !== req.auth.owner) {
|
|
274
|
+
res.status(403).json(error(config.nodeId, 'INSUFFICIENT_ROLE', 'Not authorized'));
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const actionIdx = ext.actions.findIndex(a => a.id === actionId);
|
|
279
|
+
if (actionIdx === -1) {
|
|
280
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Action "${actionId}" not found in extension "${name}"`));
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const body = req.body;
|
|
284
|
+
const scriptContent = body.scriptContent;
|
|
285
|
+
if (!scriptContent || typeof scriptContent !== 'string') {
|
|
286
|
+
res.status(400).json(error(config.nodeId, 'VALIDATION_ERROR', 'scriptContent (string) is required'));
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
// Enforce size limit
|
|
290
|
+
const sizeKb = Buffer.byteLength(scriptContent, 'utf8') / 1024;
|
|
291
|
+
if (sizeKb > config.extensionMaxCodeSizeKb) {
|
|
292
|
+
res.status(400).json(error(config.nodeId, 'CODE_TOO_LARGE', `Script is ${sizeKb.toFixed(1)}KB, max is ${config.extensionMaxCodeSizeKb}KB`));
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
// Update the action's script
|
|
296
|
+
const updatedActions = [...ext.actions];
|
|
297
|
+
updatedActions[actionIdx] = { ...updatedActions[actionIdx], scriptContent };
|
|
298
|
+
await storage.updateExtension(name, { actions: updatedActions });
|
|
299
|
+
logger.info(`Action script updated: ${name}/${actionId}`, { by: req.auth.sub, sizeKb: sizeKb.toFixed(1) });
|
|
300
|
+
res.json(success(config.nodeId, {
|
|
301
|
+
action: {
|
|
302
|
+
id: actionId,
|
|
303
|
+
scriptContent,
|
|
304
|
+
},
|
|
305
|
+
}));
|
|
306
|
+
emitChange('extensions');
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
logger.error('Failed to update action script', { error: err.message });
|
|
310
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to update action script'));
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
// ── DELETE /v1/extensions/:name — Uninstall extension ──────────
|
|
314
|
+
router.delete('/v1/extensions/:name', requireAuth(), async (req, res) => {
|
|
315
|
+
try {
|
|
316
|
+
const name = req.params.name;
|
|
317
|
+
const ext = await storage.getExtension(name);
|
|
318
|
+
if (!ext) {
|
|
319
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
// Allow operator always, owner only if they installed it
|
|
323
|
+
const roles = req.auth.roles;
|
|
324
|
+
if (!roles.includes('operator')) {
|
|
325
|
+
if (config.extInstallRole !== 'owner' || !roles.includes('owner') || ext.installedBy !== req.auth.owner) {
|
|
326
|
+
res.status(403).json(error(config.nodeId, 'INSUFFICIENT_ROLE', 'Not authorized'));
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// Clean scheduled jobs before deletion (same as deactivate)
|
|
331
|
+
if (scheduler) {
|
|
332
|
+
const jobs = await storage.listScheduledJobs({ extensionName: name });
|
|
333
|
+
for (const job of jobs) {
|
|
334
|
+
scheduler.removeJob(job.id);
|
|
335
|
+
await storage.deleteScheduledJob(job.id);
|
|
336
|
+
}
|
|
337
|
+
if (jobs.length > 0) {
|
|
338
|
+
logger.info(`Removed ${jobs.length} scheduled jobs for extension: ${name}`);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// Clean ext:{name} namespace memory (data the extension stored)
|
|
342
|
+
const extNamespace = `ext:${name}`;
|
|
343
|
+
const extMemoryRecords = await storage.listMemory(extNamespace);
|
|
344
|
+
for (const record of extMemoryRecords) {
|
|
345
|
+
await storage.deleteMemory(extNamespace, record.key);
|
|
346
|
+
}
|
|
347
|
+
if (extMemoryRecords.length > 0) {
|
|
348
|
+
logger.info(`Cleaned ${extMemoryRecords.length} memory keys from namespace: ${extNamespace}`);
|
|
349
|
+
}
|
|
350
|
+
// Clean instance-scoped namespace memory (ext:{name}.{instanceId})
|
|
351
|
+
const instances = await storage.listExtensionInstances(name);
|
|
352
|
+
for (const inst of instances) {
|
|
353
|
+
const instNamespace = `ext:${name}.${inst.id}`;
|
|
354
|
+
const instMemory = await storage.listMemory(instNamespace);
|
|
355
|
+
for (const record of instMemory) {
|
|
356
|
+
await storage.deleteMemory(instNamespace, record.key);
|
|
357
|
+
}
|
|
358
|
+
if (instMemory.length > 0) {
|
|
359
|
+
logger.info(`Cleaned ${instMemory.length} memory keys from instance namespace: ${instNamespace}`);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
await storage.deleteExtension(name);
|
|
363
|
+
logger.info(`Extension uninstalled: ${name}`, { by: req.auth.sub });
|
|
364
|
+
res.json(success(config.nodeId, { deleted: name }, [
|
|
365
|
+
{ description: 'List extensions', method: 'GET', url: '/v1/extensions' },
|
|
366
|
+
]));
|
|
367
|
+
emitChange('extensions');
|
|
368
|
+
}
|
|
369
|
+
catch (err) {
|
|
370
|
+
logger.error('Failed to uninstall extension', { error: err.message });
|
|
371
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to uninstall extension'));
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
// ── POST /v1/extensions/:name/activate — Activate extension ────
|
|
375
|
+
router.post('/v1/extensions/:name/activate', requireAuth(), requireRole('owner'), async (req, res) => {
|
|
376
|
+
try {
|
|
377
|
+
const name = req.params.name;
|
|
378
|
+
const ext = await storage.getExtension(name);
|
|
379
|
+
if (!ext) {
|
|
380
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const updated = await storage.updateExtension(name, {
|
|
384
|
+
status: 'active',
|
|
385
|
+
activatedAt: new Date().toISOString(),
|
|
386
|
+
});
|
|
387
|
+
// Register scheduled jobs from manifest if scheduler is available
|
|
388
|
+
if (scheduler && ext.config.__schedules) {
|
|
389
|
+
const schedules = ext.config.__schedules;
|
|
390
|
+
for (const sched of schedules) {
|
|
391
|
+
const jobId = `ext:${name}:${sched.id}`;
|
|
392
|
+
const existing = await storage.getScheduledJob(jobId);
|
|
393
|
+
if (!existing) {
|
|
394
|
+
const jobRecord = {
|
|
395
|
+
id: jobId,
|
|
396
|
+
name: sched.description ?? `${name}/${sched.id}`,
|
|
397
|
+
type: 'extension',
|
|
398
|
+
extensionName: name,
|
|
399
|
+
actionId: sched.action,
|
|
400
|
+
cron: sched.cron,
|
|
401
|
+
enabled: true,
|
|
402
|
+
input: sched.input ?? undefined,
|
|
403
|
+
createdBy: req.auth.sub,
|
|
404
|
+
createdAt: new Date().toISOString(),
|
|
405
|
+
updatedAt: new Date().toISOString(),
|
|
406
|
+
};
|
|
407
|
+
await storage.createScheduledJob(jobRecord);
|
|
408
|
+
scheduler.addJob(jobRecord);
|
|
409
|
+
logger.info(`Registered scheduled job: ${jobId}`, { cron: sched.cron });
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
// Run @activate jobs immediately after activation
|
|
414
|
+
if (scheduler) {
|
|
415
|
+
scheduler.runActivateJobs(name).catch(err => logger.error(`Failed to run @activate jobs for ${name}`, { error: String(err) }));
|
|
416
|
+
}
|
|
417
|
+
logger.info(`Extension activated: ${name}`, { by: req.auth.sub });
|
|
418
|
+
res.json(success(config.nodeId, { extension: updated }, [
|
|
419
|
+
{ description: 'Execute an action', method: 'POST', url: `/v1/ext/${name}/<actionId>` },
|
|
420
|
+
{ description: 'Deactivate extension', method: 'POST', url: `/v1/extensions/${name}/deactivate` },
|
|
421
|
+
]));
|
|
422
|
+
emitChange('extensions');
|
|
423
|
+
}
|
|
424
|
+
catch (err) {
|
|
425
|
+
logger.error('Failed to activate extension', { error: err.message });
|
|
426
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to activate extension'));
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
// ── POST /v1/extensions/:name/deactivate — Deactivate extension ──
|
|
430
|
+
router.post('/v1/extensions/:name/deactivate', requireAuth(), requireRole('owner'), async (req, res) => {
|
|
431
|
+
try {
|
|
432
|
+
const name = req.params.name;
|
|
433
|
+
const ext = await storage.getExtension(name);
|
|
434
|
+
if (!ext) {
|
|
435
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const updated = await storage.updateExtension(name, {
|
|
439
|
+
status: 'inactive',
|
|
440
|
+
});
|
|
441
|
+
// Remove scheduled jobs for this extension
|
|
442
|
+
if (scheduler) {
|
|
443
|
+
const jobs = await storage.listScheduledJobs({ extensionName: name });
|
|
444
|
+
for (const job of jobs) {
|
|
445
|
+
scheduler.removeJob(job.id);
|
|
446
|
+
await storage.deleteScheduledJob(job.id);
|
|
447
|
+
}
|
|
448
|
+
if (jobs.length > 0) {
|
|
449
|
+
logger.info(`Removed ${jobs.length} scheduled jobs for extension: ${name}`);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
logger.info(`Extension deactivated: ${name}`, { by: req.auth.sub });
|
|
453
|
+
res.json(success(config.nodeId, { extension: updated }, [
|
|
454
|
+
{ description: 'Activate extension', method: 'POST', url: `/v1/extensions/${name}/activate` },
|
|
455
|
+
]));
|
|
456
|
+
emitChange('extensions');
|
|
457
|
+
}
|
|
458
|
+
catch (err) {
|
|
459
|
+
logger.error('Failed to deactivate extension', { error: err.message });
|
|
460
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to deactivate extension'));
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
// ── POST /v1/extensions/:name/instances — Create instance ──────────
|
|
464
|
+
router.post('/v1/extensions/:name/instances', requireAuth(), requireRole('owner'), async (req, res) => {
|
|
465
|
+
try {
|
|
466
|
+
const name = req.params.name;
|
|
467
|
+
const ext = await storage.getExtension(name);
|
|
468
|
+
if (!ext) {
|
|
469
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
// Allow operator always, owner only if they installed it
|
|
473
|
+
const roles = req.auth.roles;
|
|
474
|
+
if (!roles.includes('operator')) {
|
|
475
|
+
if (ext.installedBy !== req.auth.owner) {
|
|
476
|
+
res.status(403).json(error(config.nodeId, 'INSUFFICIENT_ROLE', 'Not authorized'));
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (ext.status !== 'active') {
|
|
481
|
+
res.status(409).json(error(config.nodeId, 'EXTENSION_INACTIVE', `Extension "${name}" is not active`));
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
if (!ext.instances?.supported) {
|
|
485
|
+
res.status(400).json(error(config.nodeId, 'INSTANCES_NOT_SUPPORTED', `Extension "${name}" does not support multi-instance mode`));
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const { id, config: instanceConfig } = req.body;
|
|
489
|
+
if (!id || typeof id !== 'string') {
|
|
490
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'id is required'));
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
if (!/^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/.test(id)) {
|
|
494
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'id must be 3-64 chars, lowercase alphanumeric and hyphens, must start and end with alphanumeric'));
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
if (instanceConfig !== undefined && (typeof instanceConfig !== 'object' || instanceConfig === null || Array.isArray(instanceConfig))) {
|
|
498
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'config must be an object'));
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
const existing = await storage.getExtensionInstance(name, id);
|
|
502
|
+
if (existing) {
|
|
503
|
+
res.status(409).json(error(config.nodeId, 'ALREADY_EXISTS', `Instance "${id}" already exists for extension "${name}"`));
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
const now = new Date().toISOString();
|
|
507
|
+
const record = {
|
|
508
|
+
id,
|
|
509
|
+
extensionName: name,
|
|
510
|
+
config: instanceConfig ?? {},
|
|
511
|
+
status: 'active',
|
|
512
|
+
createdBy: req.auth.sub,
|
|
513
|
+
createdAt: now,
|
|
514
|
+
updatedAt: now,
|
|
515
|
+
};
|
|
516
|
+
const created = await storage.createExtensionInstance(record);
|
|
517
|
+
logger.info(`Extension instance created: ${name}/${id}`, { by: req.auth.sub });
|
|
518
|
+
res.status(201).json(success(config.nodeId, { instance: created }, [
|
|
519
|
+
{ description: 'List instances', method: 'GET', url: `/v1/extensions/${name}/instances` },
|
|
520
|
+
{ description: 'Execute action on instance', method: 'POST', url: `/v1/ext/${name}/${id}/<actionId>` },
|
|
521
|
+
]));
|
|
522
|
+
emitChange('extensions');
|
|
523
|
+
}
|
|
524
|
+
catch (err) {
|
|
525
|
+
logger.error('Failed to create extension instance', { error: err.message });
|
|
526
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to create extension instance'));
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
// ── GET /v1/extensions/:name/instances — List instances ───────────
|
|
530
|
+
router.get('/v1/extensions/:name/instances', requireAuth(), async (req, res) => {
|
|
531
|
+
try {
|
|
532
|
+
const name = req.params.name;
|
|
533
|
+
const ext = await storage.getExtension(name);
|
|
534
|
+
if (!ext) {
|
|
535
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const instances = await storage.listExtensionInstances(name);
|
|
539
|
+
res.json(success(config.nodeId, {
|
|
540
|
+
instances,
|
|
541
|
+
total: instances.length,
|
|
542
|
+
}, [
|
|
543
|
+
{ description: 'Create instance', method: 'POST', url: `/v1/extensions/${name}/instances` },
|
|
544
|
+
{ description: 'View extension', method: 'GET', url: `/v1/extensions/${name}` },
|
|
545
|
+
]));
|
|
546
|
+
}
|
|
547
|
+
catch (err) {
|
|
548
|
+
logger.error('Failed to list extension instances', { error: err.message });
|
|
549
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to list extension instances'));
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
// ── GET /v1/extensions/:name/instances/:instanceId — Get instance detail ──
|
|
553
|
+
router.get('/v1/extensions/:name/instances/:instanceId', requireAuth(), async (req, res) => {
|
|
554
|
+
try {
|
|
555
|
+
const name = req.params.name;
|
|
556
|
+
const instanceId = req.params.instanceId;
|
|
557
|
+
const ext = await storage.getExtension(name);
|
|
558
|
+
if (!ext) {
|
|
559
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
const instance = await storage.getExtensionInstance(name, instanceId);
|
|
563
|
+
if (!instance) {
|
|
564
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Instance "${instanceId}" not found for extension "${name}"`));
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
res.json(success(config.nodeId, { instance }, [
|
|
568
|
+
{ description: 'Update instance', method: 'PATCH', url: `/v1/extensions/${name}/instances/${instanceId}` },
|
|
569
|
+
{ description: 'Delete instance', method: 'DELETE', url: `/v1/extensions/${name}/instances/${instanceId}` },
|
|
570
|
+
{ description: 'Execute action on instance', method: 'POST', url: `/v1/ext/${name}/${instanceId}/<actionId>` },
|
|
571
|
+
]));
|
|
572
|
+
}
|
|
573
|
+
catch (err) {
|
|
574
|
+
logger.error('Failed to get extension instance', { error: err.message });
|
|
575
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to get extension instance'));
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
// ── PATCH /v1/extensions/:name/instances/:instanceId — Update instance ──
|
|
579
|
+
router.patch('/v1/extensions/:name/instances/:instanceId', requireAuth(), requireRole('owner'), async (req, res) => {
|
|
580
|
+
try {
|
|
581
|
+
const name = req.params.name;
|
|
582
|
+
const instanceId = req.params.instanceId;
|
|
583
|
+
const ext = await storage.getExtension(name);
|
|
584
|
+
if (!ext) {
|
|
585
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
// Allow operator always, owner only if they installed it
|
|
589
|
+
const roles = req.auth.roles;
|
|
590
|
+
if (!roles.includes('operator')) {
|
|
591
|
+
if (ext.installedBy !== req.auth.owner) {
|
|
592
|
+
res.status(403).json(error(config.nodeId, 'INSUFFICIENT_ROLE', 'Not authorized'));
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
const instance = await storage.getExtensionInstance(name, instanceId);
|
|
597
|
+
if (!instance) {
|
|
598
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Instance "${instanceId}" not found for extension "${name}"`));
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const { config: newConfig, status, translations } = req.body;
|
|
602
|
+
if (newConfig !== undefined && (typeof newConfig !== 'object' || newConfig === null || Array.isArray(newConfig))) {
|
|
603
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'config must be an object'));
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
if (status !== undefined && status !== 'active' && status !== 'paused') {
|
|
607
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'status must be "active" or "paused"'));
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
const updates = {
|
|
611
|
+
updatedAt: new Date().toISOString(),
|
|
612
|
+
};
|
|
613
|
+
if (newConfig !== undefined)
|
|
614
|
+
updates.config = newConfig;
|
|
615
|
+
if (status !== undefined)
|
|
616
|
+
updates.status = status;
|
|
617
|
+
if (translations !== undefined)
|
|
618
|
+
updates.translations = translations;
|
|
619
|
+
const updated = await storage.updateExtensionInstance(name, instanceId, updates);
|
|
620
|
+
if (!updated) {
|
|
621
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to update instance'));
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
logger.info(`Extension instance updated: ${name}/${instanceId}`, { by: req.auth.sub });
|
|
625
|
+
res.json(success(config.nodeId, { instance: updated }, [
|
|
626
|
+
{ description: 'View instance', method: 'GET', url: `/v1/extensions/${name}/instances/${instanceId}` },
|
|
627
|
+
{ description: 'List instances', method: 'GET', url: `/v1/extensions/${name}/instances` },
|
|
628
|
+
]));
|
|
629
|
+
emitChange('extensions');
|
|
630
|
+
}
|
|
631
|
+
catch (err) {
|
|
632
|
+
logger.error('Failed to update extension instance', { error: err.message });
|
|
633
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to update extension instance'));
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
// ── DELETE /v1/extensions/:name/instances/:instanceId — Delete instance ──
|
|
637
|
+
router.delete('/v1/extensions/:name/instances/:instanceId', requireAuth(), requireRole('owner'), async (req, res) => {
|
|
638
|
+
try {
|
|
639
|
+
const name = req.params.name;
|
|
640
|
+
const instanceId = req.params.instanceId;
|
|
641
|
+
const ext = await storage.getExtension(name);
|
|
642
|
+
if (!ext) {
|
|
643
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${name}" not found`));
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
// Allow operator always, owner only if they installed it
|
|
647
|
+
const roles = req.auth.roles;
|
|
648
|
+
if (!roles.includes('operator')) {
|
|
649
|
+
if (ext.installedBy !== req.auth.owner) {
|
|
650
|
+
res.status(403).json(error(config.nodeId, 'INSUFFICIENT_ROLE', 'Not authorized'));
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
const instance = await storage.getExtensionInstance(name, instanceId);
|
|
655
|
+
if (!instance) {
|
|
656
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Instance "${instanceId}" not found for extension "${name}"`));
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
// Clean ext:{name}.{instanceId} namespace memory
|
|
660
|
+
const instanceNamespace = `ext:${name}.${instanceId}`;
|
|
661
|
+
const instanceMemory = await storage.listMemory(instanceNamespace);
|
|
662
|
+
for (const record of instanceMemory) {
|
|
663
|
+
await storage.deleteMemory(instanceNamespace, record.key);
|
|
664
|
+
}
|
|
665
|
+
if (instanceMemory.length > 0) {
|
|
666
|
+
logger.info(`Cleaned ${instanceMemory.length} memory keys from namespace: ${instanceNamespace}`);
|
|
667
|
+
}
|
|
668
|
+
await storage.deleteExtensionInstance(name, instanceId);
|
|
669
|
+
logger.info(`Extension instance deleted: ${name}/${instanceId}`, { by: req.auth.sub });
|
|
670
|
+
res.json(success(config.nodeId, { deleted: instanceId }, [
|
|
671
|
+
{ description: 'List instances', method: 'GET', url: `/v1/extensions/${name}/instances` },
|
|
672
|
+
{ description: 'View extension', method: 'GET', url: `/v1/extensions/${name}` },
|
|
673
|
+
]));
|
|
674
|
+
emitChange('extensions');
|
|
675
|
+
}
|
|
676
|
+
catch (err) {
|
|
677
|
+
logger.error('Failed to delete extension instance', { error: err.message });
|
|
678
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to delete extension instance'));
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
// ── GET /v1/extensions/:name/instances/:instanceId/translations — Public translations ──
|
|
682
|
+
router.get('/v1/extensions/:name/instances/:instanceId/translations', async (req, res) => {
|
|
683
|
+
try {
|
|
684
|
+
const name = req.params.name;
|
|
685
|
+
const instanceId = req.params.instanceId;
|
|
686
|
+
const locale = req.query.locale || 'en';
|
|
687
|
+
const instance = await storage.getExtensionInstance(name, instanceId);
|
|
688
|
+
if (!instance) {
|
|
689
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Instance "${instanceId}" not found for extension "${name}"`));
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
const translations = instance.translations?.[locale] || {};
|
|
693
|
+
res.json(success(config.nodeId, { locale, translations }));
|
|
694
|
+
}
|
|
695
|
+
catch (err) {
|
|
696
|
+
logger.error('Failed to get instance translations', { error: err.message });
|
|
697
|
+
res.status(500).json(error(config.nodeId, 'INTERNAL_ERROR', 'Failed to get instance translations'));
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
// ── POST /v1/ext/:extName/:instanceId/:actionId — Instance-scoped action execution ──
|
|
701
|
+
router.post('/v1/ext/:extName/:instanceId/:actionId', requireAuth(), async (req, res) => {
|
|
702
|
+
const extName = req.params.extName;
|
|
703
|
+
const instanceId = req.params.instanceId;
|
|
704
|
+
const actionId = req.params.actionId;
|
|
705
|
+
const callerGaii = resolveIdentity(req.auth, config.nodeId);
|
|
706
|
+
try {
|
|
707
|
+
// Look up the extension
|
|
708
|
+
const ext = await storage.getExtension(extName);
|
|
709
|
+
if (!ext) {
|
|
710
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${extName}" not found`));
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
// Extension must be active
|
|
714
|
+
if (ext.status !== 'active') {
|
|
715
|
+
res.status(503).json(error(config.nodeId, 'EXTENSION_INACTIVE', `Extension "${extName}" is not active`));
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
// Look up the instance
|
|
719
|
+
const instance = await storage.getExtensionInstance(extName, instanceId);
|
|
720
|
+
if (!instance) {
|
|
721
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Instance "${instanceId}" not found for extension "${extName}"`));
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
// Instance must be active
|
|
725
|
+
if (instance.status !== 'active') {
|
|
726
|
+
res.status(503).json(error(config.nodeId, 'INSTANCE_INACTIVE', `Instance "${instanceId}" of extension "${extName}" is not active`));
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
// Find the action
|
|
730
|
+
const action = ext.actions.find(a => a.id === actionId);
|
|
731
|
+
if (!action) {
|
|
732
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Action "${actionId}" not found in extension "${extName}"`));
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
// Validate HTTP method matches
|
|
736
|
+
if (action.method !== 'POST' && action.method !== req.method) {
|
|
737
|
+
res.status(405).json(error(config.nodeId, 'METHOD_NOT_ALLOWED', `Action "${actionId}" requires ${action.method}, got ${req.method}`));
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
// Build the ExtensionCtx with instance-scoped memory namespace
|
|
741
|
+
// Extension namespace is always ext:{name}.{instanceId} — no owner scoping,
|
|
742
|
+
// because ext:{name} is already unique and owner-scoping breaks client reads
|
|
743
|
+
// (apps call getPublic('ext:{name}', key) without knowing the owner suffix).
|
|
744
|
+
const extMemoryOwner = `ext:${ext.name}.${instanceId}`;
|
|
745
|
+
const ctx = {
|
|
746
|
+
memory: {
|
|
747
|
+
get: async (key) => {
|
|
748
|
+
const record = await storage.getMemory(extMemoryOwner, key);
|
|
749
|
+
return record ? record.value : null;
|
|
750
|
+
},
|
|
751
|
+
set: async (key, value) => {
|
|
752
|
+
const existing = await storage.getMemory(extMemoryOwner, key);
|
|
753
|
+
const now = new Date().toISOString();
|
|
754
|
+
await storage.setMemory({
|
|
755
|
+
key,
|
|
756
|
+
ownerGaii: extMemoryOwner,
|
|
757
|
+
value,
|
|
758
|
+
visibility: 'public',
|
|
759
|
+
tags: [],
|
|
760
|
+
ttlHours: null,
|
|
761
|
+
version: existing ? existing.version + 1 : 1,
|
|
762
|
+
createdAt: existing ? existing.createdAt : now,
|
|
763
|
+
updatedAt: now,
|
|
764
|
+
});
|
|
765
|
+
},
|
|
766
|
+
search: async (prefix) => {
|
|
767
|
+
const records = await storage.listMemory(extMemoryOwner, { prefix });
|
|
768
|
+
return records.map(r => ({ key: r.key, value: r.value }));
|
|
769
|
+
},
|
|
770
|
+
delete: async (key) => storage.deleteMemory(extMemoryOwner, key),
|
|
771
|
+
getPublic: async (namespace, key) => {
|
|
772
|
+
// Try direct namespace lookup first
|
|
773
|
+
let record = await storage.getMemory(namespace, key);
|
|
774
|
+
// If not found and namespace looks like an owner name (no @ or #),
|
|
775
|
+
// resolve to the owner's default agent GAII and retry
|
|
776
|
+
if (!record && !namespace.includes('@') && !namespace.includes('#') && !namespace.startsWith('ext:')) {
|
|
777
|
+
const agents = await storage.getAgentsByOwner(namespace);
|
|
778
|
+
for (const agent of agents) {
|
|
779
|
+
record = await storage.getMemory(agent.gaii, key);
|
|
780
|
+
if (record)
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
return (record && record.visibility === 'public') ? record.value : null;
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
fetch: async (url, opts) => {
|
|
788
|
+
const resp = await fetch(url, {
|
|
789
|
+
method: opts?.method || 'GET',
|
|
790
|
+
headers: opts?.headers,
|
|
791
|
+
body: opts?.body,
|
|
792
|
+
signal: AbortSignal.timeout(30_000),
|
|
793
|
+
});
|
|
794
|
+
// Always read raw bytes first so we can detect charset from multiple sources
|
|
795
|
+
const buf = await resp.arrayBuffer();
|
|
796
|
+
const ct = resp.headers.get('content-type') || '';
|
|
797
|
+
const ctCharsetMatch = /charset=([^\s;]+)/i.exec(ct);
|
|
798
|
+
let charset = ctCharsetMatch ? ctCharsetMatch[1].toLowerCase() : '';
|
|
799
|
+
// If Content-Type didn't specify charset, peek at XML/HTML prolog for encoding declaration
|
|
800
|
+
if (!charset) {
|
|
801
|
+
const peek = new TextDecoder('ascii').decode(buf.slice(0, 512));
|
|
802
|
+
const xmlMatch = /encoding=['"]([^'"]+)['"]/i.exec(peek);
|
|
803
|
+
const metaMatch = /<meta[^>]+charset=["']?([^\s"';>]+)/i.exec(peek);
|
|
804
|
+
charset = (xmlMatch?.[1] || metaMatch?.[1] || 'utf-8').toLowerCase();
|
|
805
|
+
}
|
|
806
|
+
// Guard against mislabeled encoding: if declared non-UTF-8 but bytes are valid
|
|
807
|
+
// UTF-8 multibyte (e.g. Cloudflare transcoding), trust the bytes over the label
|
|
808
|
+
if (charset && charset !== 'utf-8' && charset !== 'utf8') {
|
|
809
|
+
const bytes = new Uint8Array(buf);
|
|
810
|
+
let hasMultibyte = false;
|
|
811
|
+
for (let i = 0; i < bytes.length - 1; i++) {
|
|
812
|
+
if (bytes[i] >= 0xC2 && bytes[i] <= 0xDF && (bytes[i + 1] & 0xC0) === 0x80) {
|
|
813
|
+
hasMultibyte = true;
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
if (bytes[i] >= 0xE0 && bytes[i] <= 0xEF && i + 2 < bytes.length &&
|
|
817
|
+
(bytes[i + 1] & 0xC0) === 0x80 && (bytes[i + 2] & 0xC0) === 0x80) {
|
|
818
|
+
hasMultibyte = true;
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (hasMultibyte)
|
|
823
|
+
charset = 'utf-8';
|
|
824
|
+
}
|
|
825
|
+
const decoder = new TextDecoder(charset === 'utf8' ? 'utf-8' : charset);
|
|
826
|
+
const text = decoder.decode(buf);
|
|
827
|
+
const headers = {};
|
|
828
|
+
resp.headers.forEach((v, k) => { headers[k] = v; });
|
|
829
|
+
return { status: resp.status, ok: resp.ok, text, headers };
|
|
830
|
+
},
|
|
831
|
+
wallet: {
|
|
832
|
+
consume: async (amount, reason) => {
|
|
833
|
+
const debited = await storage.debitBalance(callerGaii, amount);
|
|
834
|
+
if (!debited)
|
|
835
|
+
return { success: false, error: 'Insufficient balance' };
|
|
836
|
+
await storage.addTransaction({
|
|
837
|
+
id: `ext-tx-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
838
|
+
gaii: callerGaii,
|
|
839
|
+
type: 'extension_consume',
|
|
840
|
+
amount: -amount,
|
|
841
|
+
trackingCode: `ext:${ext.name}:${instanceId}:${reason}`,
|
|
842
|
+
timestamp: new Date().toISOString(),
|
|
843
|
+
});
|
|
844
|
+
return { success: true };
|
|
845
|
+
},
|
|
846
|
+
getBalance: async () => {
|
|
847
|
+
const parsed = (await import('../utils/gaii.js')).parseGAII(callerGaii);
|
|
848
|
+
if (!parsed)
|
|
849
|
+
return 0;
|
|
850
|
+
const ghii = await storage.getGHIIByOwner(parsed.owner);
|
|
851
|
+
return ghii?.morselBalance ?? 0;
|
|
852
|
+
},
|
|
853
|
+
},
|
|
854
|
+
consent: {
|
|
855
|
+
check: async (gaii, scope) => {
|
|
856
|
+
const consents = await storage.listConsents(gaii, { status: 'active' });
|
|
857
|
+
return consents.some(c => c.purpose === scope);
|
|
858
|
+
},
|
|
859
|
+
require: async (gaii, scope) => {
|
|
860
|
+
const consents = await storage.listConsents(gaii, { status: 'active' });
|
|
861
|
+
if (!consents.some(c => c.purpose === scope)) {
|
|
862
|
+
throw new Error(`CONSENT_REQUIRED: ${scope}`);
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
},
|
|
866
|
+
trust: {
|
|
867
|
+
getScore: async (gaii) => {
|
|
868
|
+
const agent = await storage.getAgent(gaii);
|
|
869
|
+
return agent?.trustScore ?? 0;
|
|
870
|
+
},
|
|
871
|
+
},
|
|
872
|
+
caller: {
|
|
873
|
+
gaii: callerGaii,
|
|
874
|
+
owner: req.auth.owner,
|
|
875
|
+
roles: req.auth.roles,
|
|
876
|
+
},
|
|
877
|
+
config: ext.config,
|
|
878
|
+
instance: { id: instanceId, config: instance.config },
|
|
879
|
+
log: {
|
|
880
|
+
info: (msg, data) => logger.info(`[ext:${ext.name}:${instanceId}] ${msg}`, data),
|
|
881
|
+
warn: (msg, data) => logger.warn(`[ext:${ext.name}:${instanceId}] ${msg}`, data),
|
|
882
|
+
error: (msg, data) => logger.error(`[ext:${ext.name}:${instanceId}] ${msg}`, data),
|
|
883
|
+
},
|
|
884
|
+
notify: async (message, opts) => {
|
|
885
|
+
const key = `notifications.${req.auth.owner}`;
|
|
886
|
+
const existing = await storage.getMemory(req.auth.sub, key);
|
|
887
|
+
const list = Array.isArray(existing?.value) ? existing.value : [];
|
|
888
|
+
list.push({ id: randomUUID(), message, title: opts?.title || ext.name, priority: opts?.priority || 'normal', channel: opts?.channel || 'extension', source: ext.name, read: false, createdAt: new Date().toISOString() });
|
|
889
|
+
const trimmed = list.slice(-100);
|
|
890
|
+
await storage.setMemory({ key, ownerGaii: req.auth.sub, value: trimmed, visibility: 'private', tags: ['notifications'], ttlHours: null, version: (existing?.version || 0) + 1, createdAt: existing?.createdAt || new Date().toISOString(), updatedAt: new Date().toISOString() });
|
|
891
|
+
return true;
|
|
892
|
+
},
|
|
893
|
+
email: async (to, subject, body) => {
|
|
894
|
+
if (!emailService?.enabled) {
|
|
895
|
+
logger.warn(`[ext:${ext.name}] Email not available (SMTP not configured)`);
|
|
896
|
+
return false;
|
|
897
|
+
}
|
|
898
|
+
return emailService.sendNotification(to, subject, body);
|
|
899
|
+
},
|
|
900
|
+
};
|
|
901
|
+
// Execute the action in the sandbox
|
|
902
|
+
// Use the higher of stored vs config limits so admin can raise limits without reinstalling
|
|
903
|
+
const limits = {
|
|
904
|
+
memoryMb: Math.max(ext.limits.memoryMb, config.extensionMaxMemoryMb),
|
|
905
|
+
timeoutMs: Math.max(ext.limits.timeoutMs, config.extensionTimeoutMs),
|
|
906
|
+
maxApiCalls: Math.max(ext.limits.maxApiCalls, config.extensionMaxApiCalls),
|
|
907
|
+
};
|
|
908
|
+
const result = await executeExtensionAction(action.scriptContent, ctx, req.body, limits);
|
|
909
|
+
res.json(success(config.nodeId, result, [
|
|
910
|
+
{ description: 'View extension', method: 'GET', url: `/v1/extensions/${extName}` },
|
|
911
|
+
]));
|
|
912
|
+
emitChange('extensions');
|
|
913
|
+
}
|
|
914
|
+
catch (err) {
|
|
915
|
+
const message = err.message;
|
|
916
|
+
logger.error(`Extension action failed: ${extName}/${instanceId}/${actionId}`, { error: message, caller: callerGaii });
|
|
917
|
+
if (message.includes('Script execution timed out')) {
|
|
918
|
+
res.status(500).json(error(config.nodeId, 'EXTENSION_TIMEOUT', `Action "${actionId}" timed out`));
|
|
919
|
+
}
|
|
920
|
+
else if (message.includes('API call limit exceeded')) {
|
|
921
|
+
res.status(500).json(error(config.nodeId, 'API_LIMIT_EXCEEDED', `Action "${actionId}" exceeded API call limit`));
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
res.status(500).json(error(config.nodeId, 'EXTENSION_ERROR', `Action "${actionId}" failed: ${message}`));
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
// ── POST /v1/ext/:extName/:actionId — Dynamic action execution ──
|
|
929
|
+
router.post('/v1/ext/:extName/:actionId', requireAuth(), async (req, res) => {
|
|
930
|
+
const extName = req.params.extName;
|
|
931
|
+
const actionId = req.params.actionId;
|
|
932
|
+
const callerGaii = resolveIdentity(req.auth, config.nodeId);
|
|
933
|
+
try {
|
|
934
|
+
// Look up the extension
|
|
935
|
+
const ext = await storage.getExtension(extName);
|
|
936
|
+
if (!ext) {
|
|
937
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Extension "${extName}" not found`));
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
// Extension must be active
|
|
941
|
+
if (ext.status !== 'active') {
|
|
942
|
+
res.status(503).json(error(config.nodeId, 'EXTENSION_INACTIVE', `Extension "${extName}" is not active`));
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
// Find the action
|
|
946
|
+
const action = ext.actions.find(a => a.id === actionId);
|
|
947
|
+
if (!action) {
|
|
948
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', `Action "${actionId}" not found in extension "${extName}"`));
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
// Validate HTTP method matches
|
|
952
|
+
if (action.method !== 'POST' && action.method !== req.method) {
|
|
953
|
+
res.status(405).json(error(config.nodeId, 'METHOD_NOT_ALLOWED', `Action "${actionId}" requires ${action.method}, got ${req.method}`));
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
// Build the ExtensionCtx
|
|
957
|
+
// Extension memory uses a flat namespace (ext:{name}) so apps can
|
|
958
|
+
// read data via getPublic('ext:{name}', key) without knowing the owner.
|
|
959
|
+
const extMemoryOwner = `ext:${ext.name}`;
|
|
960
|
+
const ctx = {
|
|
961
|
+
memory: {
|
|
962
|
+
get: async (key) => {
|
|
963
|
+
const record = await storage.getMemory(extMemoryOwner, key);
|
|
964
|
+
return record ? record.value : null;
|
|
965
|
+
},
|
|
966
|
+
set: async (key, value) => {
|
|
967
|
+
const existing = await storage.getMemory(extMemoryOwner, key);
|
|
968
|
+
const now = new Date().toISOString();
|
|
969
|
+
await storage.setMemory({
|
|
970
|
+
key,
|
|
971
|
+
ownerGaii: extMemoryOwner,
|
|
972
|
+
value,
|
|
973
|
+
visibility: 'public',
|
|
974
|
+
tags: [],
|
|
975
|
+
ttlHours: null,
|
|
976
|
+
version: existing ? existing.version + 1 : 1,
|
|
977
|
+
createdAt: existing ? existing.createdAt : now,
|
|
978
|
+
updatedAt: now,
|
|
979
|
+
});
|
|
980
|
+
},
|
|
981
|
+
search: async (prefix) => {
|
|
982
|
+
const records = await storage.listMemory(extMemoryOwner, { prefix });
|
|
983
|
+
return records.map(r => ({ key: r.key, value: r.value }));
|
|
984
|
+
},
|
|
985
|
+
delete: async (key) => storage.deleteMemory(extMemoryOwner, key),
|
|
986
|
+
// Read public data from another extension's namespace (read-only cross-extension access)
|
|
987
|
+
getPublic: async (namespace, key) => {
|
|
988
|
+
// Try direct namespace lookup first
|
|
989
|
+
let record = await storage.getMemory(namespace, key);
|
|
990
|
+
// If not found and namespace looks like an owner name (no @ or #),
|
|
991
|
+
// resolve to the owner's default agent GAII and retry
|
|
992
|
+
if (!record && !namespace.includes('@') && !namespace.includes('#') && !namespace.startsWith('ext:')) {
|
|
993
|
+
const agents = await storage.getAgentsByOwner(namespace);
|
|
994
|
+
for (const agent of agents) {
|
|
995
|
+
record = await storage.getMemory(agent.gaii, key);
|
|
996
|
+
if (record)
|
|
997
|
+
break;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
return (record && record.visibility === 'public') ? record.value : null;
|
|
1001
|
+
},
|
|
1002
|
+
},
|
|
1003
|
+
fetch: async (url, opts) => {
|
|
1004
|
+
const resp = await fetch(url, {
|
|
1005
|
+
method: opts?.method || 'GET',
|
|
1006
|
+
headers: opts?.headers,
|
|
1007
|
+
body: opts?.body,
|
|
1008
|
+
signal: AbortSignal.timeout(30_000),
|
|
1009
|
+
});
|
|
1010
|
+
// Always read raw bytes first so we can detect charset from multiple sources
|
|
1011
|
+
const buf = await resp.arrayBuffer();
|
|
1012
|
+
const ct = resp.headers.get('content-type') || '';
|
|
1013
|
+
const ctCharsetMatch = /charset=([^\s;]+)/i.exec(ct);
|
|
1014
|
+
let charset = ctCharsetMatch ? ctCharsetMatch[1].toLowerCase() : '';
|
|
1015
|
+
// If Content-Type didn't specify charset, peek at XML/HTML prolog for encoding declaration
|
|
1016
|
+
if (!charset) {
|
|
1017
|
+
const peek = new TextDecoder('ascii').decode(buf.slice(0, 512));
|
|
1018
|
+
const xmlMatch = /encoding=['"]([^'"]+)['"]/i.exec(peek);
|
|
1019
|
+
const metaMatch = /<meta[^>]+charset=["']?([^\s"';>]+)/i.exec(peek);
|
|
1020
|
+
charset = (xmlMatch?.[1] || metaMatch?.[1] || 'utf-8').toLowerCase();
|
|
1021
|
+
}
|
|
1022
|
+
// Guard against mislabeled encoding: if declared non-UTF-8 but bytes are valid
|
|
1023
|
+
// UTF-8 multibyte (e.g. Cloudflare transcoding), trust the bytes over the label
|
|
1024
|
+
if (charset && charset !== 'utf-8' && charset !== 'utf8') {
|
|
1025
|
+
const bytes = new Uint8Array(buf);
|
|
1026
|
+
let hasMultibyte = false;
|
|
1027
|
+
for (let i = 0; i < bytes.length - 1; i++) {
|
|
1028
|
+
if (bytes[i] >= 0xC2 && bytes[i] <= 0xDF && (bytes[i + 1] & 0xC0) === 0x80) {
|
|
1029
|
+
hasMultibyte = true;
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
1032
|
+
if (bytes[i] >= 0xE0 && bytes[i] <= 0xEF && i + 2 < bytes.length &&
|
|
1033
|
+
(bytes[i + 1] & 0xC0) === 0x80 && (bytes[i + 2] & 0xC0) === 0x80) {
|
|
1034
|
+
hasMultibyte = true;
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
if (hasMultibyte)
|
|
1039
|
+
charset = 'utf-8';
|
|
1040
|
+
}
|
|
1041
|
+
const decoder = new TextDecoder(charset === 'utf8' ? 'utf-8' : charset);
|
|
1042
|
+
const text = decoder.decode(buf);
|
|
1043
|
+
const headers = {};
|
|
1044
|
+
resp.headers.forEach((v, k) => { headers[k] = v; });
|
|
1045
|
+
return { status: resp.status, ok: resp.ok, text, headers };
|
|
1046
|
+
},
|
|
1047
|
+
wallet: {
|
|
1048
|
+
// SECURITY: Extensions can only debit the calling agent's own balance
|
|
1049
|
+
consume: async (amount, reason) => {
|
|
1050
|
+
const debited = await storage.debitBalance(callerGaii, amount);
|
|
1051
|
+
if (!debited)
|
|
1052
|
+
return { success: false, error: 'Insufficient balance' };
|
|
1053
|
+
await storage.addTransaction({
|
|
1054
|
+
id: `ext-tx-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
1055
|
+
gaii: callerGaii,
|
|
1056
|
+
type: 'extension_consume',
|
|
1057
|
+
amount: -amount,
|
|
1058
|
+
trackingCode: `ext:${ext.name}:${reason}`,
|
|
1059
|
+
timestamp: new Date().toISOString(),
|
|
1060
|
+
});
|
|
1061
|
+
return { success: true };
|
|
1062
|
+
},
|
|
1063
|
+
// SECURITY: Extensions can only read the calling agent's own balance
|
|
1064
|
+
getBalance: async () => {
|
|
1065
|
+
const parsed = (await import('../utils/gaii.js')).parseGAII(callerGaii);
|
|
1066
|
+
if (!parsed)
|
|
1067
|
+
return 0;
|
|
1068
|
+
const ghii = await storage.getGHIIByOwner(parsed.owner);
|
|
1069
|
+
return ghii?.morselBalance ?? 0;
|
|
1070
|
+
},
|
|
1071
|
+
// hold, release, transfer REMOVED — extensions cannot move other agents' funds
|
|
1072
|
+
},
|
|
1073
|
+
consent: {
|
|
1074
|
+
check: async (gaii, scope) => {
|
|
1075
|
+
const consents = await storage.listConsents(gaii, { status: 'active' });
|
|
1076
|
+
return consents.some(c => c.purpose === scope);
|
|
1077
|
+
},
|
|
1078
|
+
require: async (gaii, scope) => {
|
|
1079
|
+
const consents = await storage.listConsents(gaii, { status: 'active' });
|
|
1080
|
+
if (!consents.some(c => c.purpose === scope)) {
|
|
1081
|
+
throw new Error(`CONSENT_REQUIRED: ${scope}`);
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
},
|
|
1085
|
+
trust: {
|
|
1086
|
+
getScore: async (gaii) => {
|
|
1087
|
+
const agent = await storage.getAgent(gaii);
|
|
1088
|
+
return agent?.trustScore ?? 0;
|
|
1089
|
+
},
|
|
1090
|
+
// trust.adjust removed — trust scores are system-computed only
|
|
1091
|
+
},
|
|
1092
|
+
caller: {
|
|
1093
|
+
gaii: callerGaii,
|
|
1094
|
+
owner: req.auth.owner,
|
|
1095
|
+
roles: req.auth.roles,
|
|
1096
|
+
},
|
|
1097
|
+
config: ext.config,
|
|
1098
|
+
log: {
|
|
1099
|
+
info: (msg, data) => logger.info(`[ext:${ext.name}] ${msg}`, data),
|
|
1100
|
+
warn: (msg, data) => logger.warn(`[ext:${ext.name}] ${msg}`, data),
|
|
1101
|
+
error: (msg, data) => logger.error(`[ext:${ext.name}] ${msg}`, data),
|
|
1102
|
+
},
|
|
1103
|
+
notify: async (message, opts) => {
|
|
1104
|
+
const key = `notifications.${req.auth.owner}`;
|
|
1105
|
+
const existing = await storage.getMemory(req.auth.sub, key);
|
|
1106
|
+
const list = Array.isArray(existing?.value) ? existing.value : [];
|
|
1107
|
+
list.push({ id: randomUUID(), message, title: opts?.title || ext.name, priority: opts?.priority || 'normal', channel: opts?.channel || 'extension', source: ext.name, read: false, createdAt: new Date().toISOString() });
|
|
1108
|
+
const trimmed = list.slice(-100);
|
|
1109
|
+
await storage.setMemory({ key, ownerGaii: req.auth.sub, value: trimmed, visibility: 'private', tags: ['notifications'], ttlHours: null, version: (existing?.version || 0) + 1, createdAt: existing?.createdAt || new Date().toISOString(), updatedAt: new Date().toISOString() });
|
|
1110
|
+
return true;
|
|
1111
|
+
},
|
|
1112
|
+
email: async (to, subject, body) => {
|
|
1113
|
+
if (!emailService?.enabled) {
|
|
1114
|
+
logger.warn(`[ext:${ext.name}] Email not available (SMTP not configured)`);
|
|
1115
|
+
return false;
|
|
1116
|
+
}
|
|
1117
|
+
return emailService.sendNotification(to, subject, body);
|
|
1118
|
+
},
|
|
1119
|
+
};
|
|
1120
|
+
// Execute the action in the sandbox
|
|
1121
|
+
// Use the higher of stored vs config limits so admin can raise limits without reinstalling
|
|
1122
|
+
const limits = {
|
|
1123
|
+
memoryMb: Math.max(ext.limits.memoryMb, config.extensionMaxMemoryMb),
|
|
1124
|
+
timeoutMs: Math.max(ext.limits.timeoutMs, config.extensionTimeoutMs),
|
|
1125
|
+
maxApiCalls: Math.max(ext.limits.maxApiCalls, config.extensionMaxApiCalls),
|
|
1126
|
+
};
|
|
1127
|
+
const result = await executeExtensionAction(action.scriptContent, ctx, req.body, limits);
|
|
1128
|
+
res.json(success(config.nodeId, result, [
|
|
1129
|
+
{ description: 'View extension', method: 'GET', url: `/v1/extensions/${extName}` },
|
|
1130
|
+
]));
|
|
1131
|
+
emitChange('extensions');
|
|
1132
|
+
}
|
|
1133
|
+
catch (err) {
|
|
1134
|
+
const message = err.message;
|
|
1135
|
+
logger.error(`Extension action failed: ${extName}/${actionId}`, { error: message, caller: callerGaii });
|
|
1136
|
+
if (message.includes('Script execution timed out')) {
|
|
1137
|
+
res.status(500).json(error(config.nodeId, 'EXTENSION_TIMEOUT', `Action "${actionId}" timed out`));
|
|
1138
|
+
}
|
|
1139
|
+
else if (message.includes('API call limit exceeded')) {
|
|
1140
|
+
res.status(500).json(error(config.nodeId, 'API_LIMIT_EXCEEDED', `Action "${actionId}" exceeded API call limit`));
|
|
1141
|
+
}
|
|
1142
|
+
else {
|
|
1143
|
+
res.status(500).json(error(config.nodeId, 'EXTENSION_ERROR', `Action "${actionId}" failed: ${message}`));
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
return router;
|
|
1148
|
+
}
|
|
1149
|
+
//# sourceMappingURL=extensions.js.map
|