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,1108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file knowledge.ts
|
|
3
|
+
* @description Knowledge package routes — import, CRUD, links, sharing, cloning,
|
|
4
|
+
* export, organism contribution, reputation, and operator review endpoints.
|
|
5
|
+
* All routes are under /v1/knowledge/*.
|
|
6
|
+
* @structure
|
|
7
|
+
* - knowledgeRouter() — main router factory
|
|
8
|
+
* - POST /v1/knowledge/import — import a knowledge package
|
|
9
|
+
* - GET /v1/knowledge/:id — get package manifest
|
|
10
|
+
* - POST /v1/knowledge/:id/link — create memory link
|
|
11
|
+
* - GET /v1/knowledge/:id/links — list links
|
|
12
|
+
* - DELETE /v1/knowledge/:id/link — delete link
|
|
13
|
+
* - GET /v1/knowledge/:id/broken-links — find broken links
|
|
14
|
+
* - PATCH /v1/knowledge/:id/sharing — update sharing settings
|
|
15
|
+
* - PATCH /v1/knowledge/:id/entries/:entryKey/visibility — update entry visibility
|
|
16
|
+
* - POST /v1/knowledge/:id/clone — clone a package
|
|
17
|
+
* - GET /v1/knowledge/:id/export — export package as JSON
|
|
18
|
+
* - POST /v1/knowledge/:id/contribute — contribute to organism
|
|
19
|
+
* - GET /v1/knowledge/organism/:id — list organism packages
|
|
20
|
+
* - GET /v1/knowledge/:id/reputation — get quality signals
|
|
21
|
+
* - GET /v1/knowledge/:id/reviews — list operator reviews
|
|
22
|
+
* @usage
|
|
23
|
+
* import { knowledgeRouter } from '../routes/knowledge.js';
|
|
24
|
+
* app.use(knowledgeRouter(config, storage));
|
|
25
|
+
* @version-history
|
|
26
|
+
* v1.0.0 — 2026-03-07 — initial knowledge package system
|
|
27
|
+
* v1.1.0 — 2026-03-18 — rename routes from /v1/packages/* to /v1/knowledge/*
|
|
28
|
+
*/
|
|
29
|
+
import { Router } from 'express';
|
|
30
|
+
import { randomUUID } from 'node:crypto';
|
|
31
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
32
|
+
import { requireAuth, requireRole } from '../auth/middleware.js';
|
|
33
|
+
import { success, error } from '../middleware/envelope.js';
|
|
34
|
+
import { emitChange } from '../services/event-bus.js';
|
|
35
|
+
import { substituteVariables, resolvePromptContent } from '../services/prompt-variables.js';
|
|
36
|
+
import { resolveIdentity } from '../utils/gaii.js';
|
|
37
|
+
import { ManifestSchema } from '../schemas/knowledge-package.js';
|
|
38
|
+
import { createRequire } from 'node:module';
|
|
39
|
+
const require = createRequire(import.meta.url);
|
|
40
|
+
const ajvPkg = require('ajv');
|
|
41
|
+
const formatsPkg = require('ajv-formats');
|
|
42
|
+
const AjvClass = ajvPkg.default ?? ajvPkg;
|
|
43
|
+
const addFormats = formatsPkg.default ?? formatsPkg;
|
|
44
|
+
const ajv = new AjvClass({ allErrors: true });
|
|
45
|
+
addFormats(ajv);
|
|
46
|
+
const validateManifest = ajv.compile(ManifestSchema);
|
|
47
|
+
export function knowledgeRouter(config, storage) {
|
|
48
|
+
const router = Router();
|
|
49
|
+
const resolve = (req) => resolveIdentity(req.auth, config.nodeId);
|
|
50
|
+
/* ── POST /v1/knowledge/import — Import a knowledge package from AI Chat output ── */
|
|
51
|
+
router.post('/v1/knowledge/import', requireAuth(), async (req, res) => {
|
|
52
|
+
const ownerGaii = resolve(req);
|
|
53
|
+
const ghii = req.auth.owner;
|
|
54
|
+
const { package: pkg, overrides } = req.body;
|
|
55
|
+
if (!pkg || typeof pkg !== 'object') {
|
|
56
|
+
res.status(400).json(error(config.nodeId, 'INVALID_PACKAGE', 'Request body must include a "package" object'));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// Normalize AI chat output format → strict manifest format
|
|
60
|
+
if (!pkg.type && pkg.aimeat_knowledge_package)
|
|
61
|
+
pkg.type = 'knowledge-package';
|
|
62
|
+
if (!pkg.type)
|
|
63
|
+
pkg.type = 'knowledge-package';
|
|
64
|
+
if (!pkg.name && pkg.title)
|
|
65
|
+
pkg.name = pkg.title;
|
|
66
|
+
if (!pkg.name && pkg.id)
|
|
67
|
+
pkg.name = pkg.id;
|
|
68
|
+
if (!pkg.version)
|
|
69
|
+
pkg.version = '1.0.0';
|
|
70
|
+
if (!pkg.author)
|
|
71
|
+
pkg.author = ghii;
|
|
72
|
+
if (!pkg.synthesis) {
|
|
73
|
+
pkg.synthesis = { level: 'original', description: 'Imported from AI chat' };
|
|
74
|
+
}
|
|
75
|
+
if (!pkg.sharing) {
|
|
76
|
+
const catalogListed = overrides?.catalog_listed ?? false;
|
|
77
|
+
pkg.sharing = {
|
|
78
|
+
catalog_listed: catalogListed,
|
|
79
|
+
allow_clone: catalogListed,
|
|
80
|
+
morsel_price: 0,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (!pkg.tags)
|
|
84
|
+
pkg.tags = [];
|
|
85
|
+
if (!pkg.language)
|
|
86
|
+
pkg.language = 'en';
|
|
87
|
+
// Normalize entries: ensure each has title, default visibility
|
|
88
|
+
if (Array.isArray(pkg.entries)) {
|
|
89
|
+
for (const entry of pkg.entries) {
|
|
90
|
+
if (!entry.title)
|
|
91
|
+
entry.title = entry.key || 'Untitled';
|
|
92
|
+
if (!entry.visibility)
|
|
93
|
+
entry.visibility = 'private';
|
|
94
|
+
// Normalize 'shared' → 'owner' (memory layer doesn't have shared; prompt may produce it)
|
|
95
|
+
if (entry.visibility === 'shared')
|
|
96
|
+
entry.visibility = 'owner';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Validate manifest structure
|
|
100
|
+
const manifest = pkg;
|
|
101
|
+
if (!validateManifest(manifest)) {
|
|
102
|
+
res.status(400).json(error(config.nodeId, 'SCHEMA_VALIDATION', 'Package manifest validation failed', validateManifest.errors));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const packageId = uuidv4();
|
|
106
|
+
const now = new Date().toISOString();
|
|
107
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
108
|
+
// Apply overrides to entries if provided
|
|
109
|
+
if (overrides?.entries) {
|
|
110
|
+
for (const entry of manifest.entries) {
|
|
111
|
+
const entryName = entry.key.split('/').pop() ?? entry.key;
|
|
112
|
+
const entryOverride = overrides.entries[entryName];
|
|
113
|
+
if (entryOverride?.visibility) {
|
|
114
|
+
entry.visibility = entryOverride.visibility;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (overrides?.catalog_listed !== undefined) {
|
|
119
|
+
manifest.sharing.catalog_listed = overrides.catalog_listed;
|
|
120
|
+
// If catalog_listed is enabled and allow_clone wasn't explicitly set, enable cloning
|
|
121
|
+
if (overrides.catalog_listed && !manifest.sharing.allow_clone) {
|
|
122
|
+
manifest.sharing.allow_clone = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Resolve entry data — can be in req.body.entry_data, pkg.entry_data,
|
|
126
|
+
// or directly on each entry's .value field (AI chat output format)
|
|
127
|
+
const entryData = req.body.entry_data ?? pkg.entry_data ?? {};
|
|
128
|
+
// Extract inline values from entries into entryData
|
|
129
|
+
for (const entry of manifest.entries) {
|
|
130
|
+
if (entry.value !== undefined) {
|
|
131
|
+
const entryName = entry.key.split('/').pop() ?? entry.key;
|
|
132
|
+
if (!entryData[entry.key] && !entryData[entryName]) {
|
|
133
|
+
entryData[entryName] = entry.value;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Normalize entry keys to full path BEFORE storing manifest
|
|
138
|
+
for (const entry of manifest.entries) {
|
|
139
|
+
if (!entry.key.startsWith('packages/')) {
|
|
140
|
+
entry.key = `packages/${packageId}/${entry.key}`;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Store manifest (with normalized entry keys)
|
|
144
|
+
manifest.created = now;
|
|
145
|
+
manifest.updated = now;
|
|
146
|
+
await storage.setMemory({
|
|
147
|
+
key: manifestKey,
|
|
148
|
+
ownerGaii,
|
|
149
|
+
value: manifest,
|
|
150
|
+
visibility: manifest.sharing.catalog_listed ? 'public' : 'owner',
|
|
151
|
+
tags: ['knowledge-package', manifest.content_type, ...manifest.tags],
|
|
152
|
+
ttlHours: null,
|
|
153
|
+
version: 1,
|
|
154
|
+
createdAt: now,
|
|
155
|
+
updatedAt: now,
|
|
156
|
+
});
|
|
157
|
+
// Store entries with their content
|
|
158
|
+
const createdEntries = [];
|
|
159
|
+
for (const entry of manifest.entries) {
|
|
160
|
+
const shortKey = entry.key.split('/').pop() ?? '';
|
|
161
|
+
const data = entryData[entry.key] ?? entryData[shortKey] ?? {};
|
|
162
|
+
await storage.setMemory({
|
|
163
|
+
key: entry.key,
|
|
164
|
+
ownerGaii,
|
|
165
|
+
value: data,
|
|
166
|
+
visibility: entry.visibility,
|
|
167
|
+
tags: ['knowledge-entry', manifest.content_type, ...manifest.tags],
|
|
168
|
+
ttlHours: null,
|
|
169
|
+
version: 1,
|
|
170
|
+
createdAt: now,
|
|
171
|
+
updatedAt: now,
|
|
172
|
+
});
|
|
173
|
+
createdEntries.push(entry.key);
|
|
174
|
+
}
|
|
175
|
+
// Create memory links if specified
|
|
176
|
+
for (const link of manifest.links ?? []) {
|
|
177
|
+
await storage.createLink({
|
|
178
|
+
source: manifestKey,
|
|
179
|
+
target: link.target,
|
|
180
|
+
relation: link.relation,
|
|
181
|
+
description: link.description,
|
|
182
|
+
linked_at: link.linked_at || now,
|
|
183
|
+
linked_by: ghii,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
// Create organism consent grant if requested
|
|
187
|
+
if (overrides?.organism_share) {
|
|
188
|
+
await storage.createConsent({
|
|
189
|
+
id: uuidv4(),
|
|
190
|
+
ownerGaii,
|
|
191
|
+
dataPattern: `packages/${packageId}/*`,
|
|
192
|
+
recipient: `organism.${overrides.organism_share}`,
|
|
193
|
+
purpose: 'Knowledge package shared with organism',
|
|
194
|
+
scope: 'private',
|
|
195
|
+
expires: null,
|
|
196
|
+
status: 'active',
|
|
197
|
+
grantedAt: now,
|
|
198
|
+
revokedAt: null,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
res.status(201).json(success(config.nodeId, {
|
|
202
|
+
package_id: packageId,
|
|
203
|
+
manifest_key: manifestKey,
|
|
204
|
+
entries_created: createdEntries.length,
|
|
205
|
+
catalog_listed: manifest.sharing.catalog_listed,
|
|
206
|
+
}, [
|
|
207
|
+
{ description: 'View package manifest', method: 'GET', url: `/v1/memory/${encodeURIComponent(manifestKey)}` },
|
|
208
|
+
{ description: 'List your packages', method: 'GET', url: '/v1/memory?prefix=packages/&tags=knowledge-package' },
|
|
209
|
+
]));
|
|
210
|
+
emitChange('knowledge');
|
|
211
|
+
});
|
|
212
|
+
/* ── GET /v1/knowledge/:id — Get package manifest ── */
|
|
213
|
+
router.get('/v1/knowledge/:id', async (req, res) => {
|
|
214
|
+
const packageId = req.params.id;
|
|
215
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
216
|
+
// Try public read: scan all agents for a public manifest with this key
|
|
217
|
+
let manifest;
|
|
218
|
+
const allAgents = await storage.listAgents();
|
|
219
|
+
for (const agent of allAgents) {
|
|
220
|
+
const hits = await storage.listMemory(agent.gaii, { prefix: manifestKey, visibility: 'public' });
|
|
221
|
+
if (hits.length > 0) {
|
|
222
|
+
manifest = hits[0];
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// If authenticated, also check the caller's own packages (any visibility)
|
|
227
|
+
if (!manifest && req.auth?.sub) {
|
|
228
|
+
const hits = await storage.listMemory(req.auth.sub, { prefix: manifestKey });
|
|
229
|
+
if (hits.length > 0)
|
|
230
|
+
manifest = hits[0];
|
|
231
|
+
}
|
|
232
|
+
if (!manifest) {
|
|
233
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found or not public'));
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
res.json(success(config.nodeId, {
|
|
237
|
+
package_id: packageId,
|
|
238
|
+
manifest: manifest.value,
|
|
239
|
+
tags: manifest.tags,
|
|
240
|
+
created_at: manifest.createdAt,
|
|
241
|
+
updated_at: manifest.updatedAt,
|
|
242
|
+
}));
|
|
243
|
+
});
|
|
244
|
+
/* ── POST /v1/knowledge/:id/link — Create a link from this package to another memory ── */
|
|
245
|
+
router.post('/v1/knowledge/:id/link', requireAuth(), requireRole('agent'), async (req, res) => {
|
|
246
|
+
const ownerGaii = resolve(req);
|
|
247
|
+
const ghii = req.auth.owner;
|
|
248
|
+
const packageId = req.params.id;
|
|
249
|
+
const { target, relation, description } = req.body;
|
|
250
|
+
if (!target || !relation || !description) {
|
|
251
|
+
res.status(400).json(error(config.nodeId, 'MISSING_FIELDS', 'target, relation, and description are required'));
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const validRelations = ['related-to', 'extends', 'derived-from', 'contradicts', 'supersedes', 'references'];
|
|
255
|
+
if (!validRelations.includes(relation)) {
|
|
256
|
+
res.status(400).json(error(config.nodeId, 'INVALID_RELATION', `relation must be one of: ${validRelations.join(', ')}`));
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
260
|
+
const existing = await storage.getMemory(ownerGaii, manifestKey);
|
|
261
|
+
if (!existing) {
|
|
262
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found'));
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const now = new Date().toISOString();
|
|
266
|
+
const link = {
|
|
267
|
+
source: manifestKey,
|
|
268
|
+
target,
|
|
269
|
+
relation,
|
|
270
|
+
description,
|
|
271
|
+
linked_at: now,
|
|
272
|
+
linked_by: ghii,
|
|
273
|
+
};
|
|
274
|
+
await storage.createLink(link);
|
|
275
|
+
// Also update the manifest's links array
|
|
276
|
+
const manifestValue = existing.value;
|
|
277
|
+
manifestValue.links = manifestValue.links ?? [];
|
|
278
|
+
manifestValue.links.push({ target, relation, description, linked_at: now });
|
|
279
|
+
manifestValue.updated = now;
|
|
280
|
+
existing.value = manifestValue;
|
|
281
|
+
existing.updatedAt = now;
|
|
282
|
+
existing.version += 1;
|
|
283
|
+
await storage.setMemory(existing);
|
|
284
|
+
res.status(201).json(success(config.nodeId, { link }, [
|
|
285
|
+
{ description: 'List package links', method: 'GET', url: `/v1/knowledge/${packageId}/links` },
|
|
286
|
+
]));
|
|
287
|
+
emitChange('knowledge');
|
|
288
|
+
});
|
|
289
|
+
/* ── GET /v1/knowledge/:id/links — List links for a package ── */
|
|
290
|
+
router.get('/v1/knowledge/:id/links', async (req, res) => {
|
|
291
|
+
const packageId = req.params.id;
|
|
292
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
293
|
+
const direction = req.query.direction ?? 'both';
|
|
294
|
+
const relation = req.query.relation;
|
|
295
|
+
const links = await storage.listLinks(manifestKey, {
|
|
296
|
+
direction: direction,
|
|
297
|
+
relation,
|
|
298
|
+
});
|
|
299
|
+
res.json(success(config.nodeId, { links, count: links.length }));
|
|
300
|
+
});
|
|
301
|
+
/* ── DELETE /v1/knowledge/:id/link — Delete a link ── */
|
|
302
|
+
router.delete('/v1/knowledge/:id/link', requireAuth(), requireRole('agent'), async (req, res) => {
|
|
303
|
+
const packageId = req.params.id;
|
|
304
|
+
const { target } = req.body;
|
|
305
|
+
if (!target) {
|
|
306
|
+
res.status(400).json(error(config.nodeId, 'MISSING_FIELDS', 'target is required'));
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
310
|
+
const deleted = await storage.deleteLink(manifestKey, target);
|
|
311
|
+
if (!deleted) {
|
|
312
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Link not found'));
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
res.json(success(config.nodeId, { deleted: true }));
|
|
316
|
+
emitChange('knowledge');
|
|
317
|
+
});
|
|
318
|
+
/* ── GET /v1/knowledge/:id/broken-links — Find broken links ── */
|
|
319
|
+
router.get('/v1/knowledge/:id/broken-links', requireAuth(), requireRole('agent'), async (req, res) => {
|
|
320
|
+
const ownerGaii = resolve(req);
|
|
321
|
+
const broken = await storage.findBrokenLinks(ownerGaii);
|
|
322
|
+
res.json(success(config.nodeId, { broken_links: broken, count: broken.length }));
|
|
323
|
+
});
|
|
324
|
+
/* ── GET /v1/templates/knowledge-packager-human — Get human prompt template ── */
|
|
325
|
+
router.get('/v1/templates/knowledge-packager-human', requireAuth(), async (req, res) => {
|
|
326
|
+
const ghii = req.auth.owner;
|
|
327
|
+
const nodeUrl = config.baseUrl || `http://localhost:${config.port}`;
|
|
328
|
+
const record = await storage.getSystemPrompt('knowledge-packager-human');
|
|
329
|
+
if (!record || !record.active) {
|
|
330
|
+
return res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Prompt not available'));
|
|
331
|
+
}
|
|
332
|
+
const content = resolvePromptContent(record, req.headers['accept-language']);
|
|
333
|
+
const text = substituteVariables(content, {
|
|
334
|
+
owner_name: ghii,
|
|
335
|
+
node_url: nodeUrl,
|
|
336
|
+
node_id: config.nodeId,
|
|
337
|
+
gaii: resolve(req),
|
|
338
|
+
});
|
|
339
|
+
res.json(success(config.nodeId, { prompt: text, ghii, node_url: nodeUrl, node_id: config.nodeId }));
|
|
340
|
+
});
|
|
341
|
+
/* ── GET /v1/templates/knowledge-packager-agent — Get agent prompt template ── */
|
|
342
|
+
router.get('/v1/templates/knowledge-packager-agent', requireAuth(), async (req, res) => {
|
|
343
|
+
const ghii = req.auth.owner;
|
|
344
|
+
const gaii = resolve(req);
|
|
345
|
+
const nodeUrl = config.baseUrl || `http://localhost:${config.port}`;
|
|
346
|
+
const record = await storage.getSystemPrompt('knowledge-packager-agent');
|
|
347
|
+
if (!record || !record.active) {
|
|
348
|
+
return res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Prompt not available'));
|
|
349
|
+
}
|
|
350
|
+
const content = resolvePromptContent(record, req.headers['accept-language']);
|
|
351
|
+
const text = substituteVariables(content, {
|
|
352
|
+
owner_name: ghii,
|
|
353
|
+
node_url: nodeUrl,
|
|
354
|
+
node_id: config.nodeId,
|
|
355
|
+
gaii,
|
|
356
|
+
});
|
|
357
|
+
res.json(success(config.nodeId, { prompt: text, ghii, gaii, node_url: nodeUrl, node_id: config.nodeId }));
|
|
358
|
+
});
|
|
359
|
+
/* ── GET /v1/templates/chat-session-human — Get chat session human prompt ── */
|
|
360
|
+
router.get('/v1/templates/chat-session-human', requireAuth(), async (req, res) => {
|
|
361
|
+
const ghii = req.auth.owner;
|
|
362
|
+
const nodeUrl = config.baseUrl || `http://localhost:${config.port}`;
|
|
363
|
+
const record = await storage.getSystemPrompt('chat-session-human');
|
|
364
|
+
if (!record || !record.active) {
|
|
365
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Prompt not available'));
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const promptContent = resolvePromptContent(record, req.headers['accept-language']);
|
|
369
|
+
const text = substituteVariables(promptContent, { node_url: nodeUrl, node_id: config.nodeId, owner_name: ghii });
|
|
370
|
+
res.json(success(config.nodeId, { prompt: text, ghii, node_url: nodeUrl, node_id: config.nodeId }));
|
|
371
|
+
});
|
|
372
|
+
/* ── GET /v1/templates/chat-session-quick — Get quick session prompt (paste into any AI) ── */
|
|
373
|
+
router.get('/v1/templates/chat-session-quick', requireAuth(), async (req, res) => {
|
|
374
|
+
const ghii = req.auth.owner;
|
|
375
|
+
const nodeUrl = config.baseUrl || `http://localhost:${config.port}`;
|
|
376
|
+
const record = await storage.getSystemPrompt('chat-session-quick');
|
|
377
|
+
if (!record || !record.active) {
|
|
378
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Prompt not available'));
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const promptContent = resolvePromptContent(record, req.headers['accept-language']);
|
|
382
|
+
const text = substituteVariables(promptContent, { node_url: nodeUrl, node_id: config.nodeId, owner_name: ghii });
|
|
383
|
+
res.json(success(config.nodeId, { prompt: text, ghii, node_url: nodeUrl, node_id: config.nodeId }));
|
|
384
|
+
});
|
|
385
|
+
/* ── PATCH /v1/knowledge/:id/sharing — Update package sharing settings ── */
|
|
386
|
+
router.patch('/v1/knowledge/:id/sharing', requireAuth(), requireRole('agent'), async (req, res) => {
|
|
387
|
+
const ownerGaii = resolve(req);
|
|
388
|
+
const packageId = req.params.id;
|
|
389
|
+
const { catalog_listed, allow_clone } = req.body ?? {};
|
|
390
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
391
|
+
const existing = await storage.getMemory(ownerGaii, manifestKey);
|
|
392
|
+
if (!existing) {
|
|
393
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found'));
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const manifest = typeof existing.value === 'string'
|
|
397
|
+
? JSON.parse(existing.value)
|
|
398
|
+
: Object.assign({}, existing.value);
|
|
399
|
+
if (!manifest.sharing)
|
|
400
|
+
manifest.sharing = { catalog_listed: false, allow_clone: false, morsel_price: 0 };
|
|
401
|
+
if (catalog_listed !== undefined)
|
|
402
|
+
manifest.sharing.catalog_listed = !!catalog_listed;
|
|
403
|
+
if (allow_clone !== undefined)
|
|
404
|
+
manifest.sharing.allow_clone = !!allow_clone;
|
|
405
|
+
// If catalog_listed enabled, ensure allow_clone is also enabled
|
|
406
|
+
if (manifest.sharing.catalog_listed && !manifest.sharing.allow_clone && allow_clone === undefined) {
|
|
407
|
+
manifest.sharing.allow_clone = true;
|
|
408
|
+
}
|
|
409
|
+
manifest.updated = new Date().toISOString();
|
|
410
|
+
const now = new Date().toISOString();
|
|
411
|
+
await storage.setMemory({
|
|
412
|
+
key: manifestKey,
|
|
413
|
+
ownerGaii,
|
|
414
|
+
value: manifest,
|
|
415
|
+
visibility: manifest.sharing.catalog_listed ? 'public' : 'owner',
|
|
416
|
+
tags: existing.tags || ['knowledge-package'],
|
|
417
|
+
ttlHours: null,
|
|
418
|
+
version: (existing.version || 0) + 1,
|
|
419
|
+
createdAt: existing.createdAt || now,
|
|
420
|
+
updatedAt: now,
|
|
421
|
+
});
|
|
422
|
+
res.json(success(config.nodeId, {
|
|
423
|
+
package_id: packageId,
|
|
424
|
+
sharing: manifest.sharing,
|
|
425
|
+
}));
|
|
426
|
+
emitChange('knowledge');
|
|
427
|
+
});
|
|
428
|
+
/* ── PATCH /v1/knowledge/:id/entries/:entryKey/visibility — Change entry visibility ── */
|
|
429
|
+
router.patch('/v1/knowledge/:id/entries/:entryKey/visibility', requireAuth(), requireRole('agent'), async (req, res) => {
|
|
430
|
+
const ownerGaii = resolve(req);
|
|
431
|
+
const packageId = req.params.id;
|
|
432
|
+
const entryKey = req.params.entryKey;
|
|
433
|
+
const { visibility } = req.body ?? {};
|
|
434
|
+
if (!['private', 'owner', 'public'].includes(visibility)) {
|
|
435
|
+
res.status(400).json(error(config.nodeId, 'INVALID_INPUT', 'Visibility must be private, owner, or public'));
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
439
|
+
const existing = await storage.getMemory(ownerGaii, manifestKey);
|
|
440
|
+
if (!existing) {
|
|
441
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found'));
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
const manifest = typeof existing.value === 'string'
|
|
445
|
+
? JSON.parse(existing.value)
|
|
446
|
+
: Object.assign({}, existing.value);
|
|
447
|
+
// Find and update the entry in the manifest
|
|
448
|
+
const entries = manifest.entries || [];
|
|
449
|
+
const entry = entries.find((e) => e.key === entryKey || e.key.endsWith('/' + entryKey));
|
|
450
|
+
if (!entry) {
|
|
451
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Entry not found in package'));
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
entry.visibility = visibility;
|
|
455
|
+
manifest.updated = new Date().toISOString();
|
|
456
|
+
const now = new Date().toISOString();
|
|
457
|
+
await storage.setMemory({
|
|
458
|
+
key: manifestKey,
|
|
459
|
+
ownerGaii,
|
|
460
|
+
value: manifest,
|
|
461
|
+
visibility: manifest.sharing?.catalog_listed ? 'public' : 'owner',
|
|
462
|
+
tags: existing.tags || ['knowledge-package'],
|
|
463
|
+
ttlHours: null,
|
|
464
|
+
version: (existing.version || 0) + 1,
|
|
465
|
+
createdAt: existing.createdAt || now,
|
|
466
|
+
updatedAt: now,
|
|
467
|
+
});
|
|
468
|
+
// Also update the individual entry's memory record visibility
|
|
469
|
+
const fullEntryKey = entry.key.startsWith('packages/')
|
|
470
|
+
? entry.key
|
|
471
|
+
: `packages/${packageId}/${entry.key}`;
|
|
472
|
+
const entryRecord = await storage.getMemory(ownerGaii, fullEntryKey);
|
|
473
|
+
if (entryRecord) {
|
|
474
|
+
await storage.setMemory({
|
|
475
|
+
...entryRecord,
|
|
476
|
+
visibility,
|
|
477
|
+
updatedAt: now,
|
|
478
|
+
version: (entryRecord.version || 0) + 1,
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
res.json(success(config.nodeId, {
|
|
482
|
+
package_id: packageId,
|
|
483
|
+
entry_key: entryKey,
|
|
484
|
+
visibility,
|
|
485
|
+
}));
|
|
486
|
+
emitChange('knowledge');
|
|
487
|
+
});
|
|
488
|
+
/* ── POST /v1/knowledge/:id/clone — Clone public entries to your own namespace ── */
|
|
489
|
+
router.post('/v1/knowledge/:id/clone', requireAuth(), async (req, res) => {
|
|
490
|
+
const requesterGaii = resolve(req);
|
|
491
|
+
const requesterGhii = req.auth.owner;
|
|
492
|
+
const sourcePackageId = req.params.id;
|
|
493
|
+
const { target_prefix, entries: requestedEntries } = req.body;
|
|
494
|
+
const sourceManifestKey = `packages/${sourcePackageId}/manifest`;
|
|
495
|
+
// Find the source manifest (search across all agents for public memory)
|
|
496
|
+
const allAgents = await storage.listAgents();
|
|
497
|
+
let sourceManifest = null;
|
|
498
|
+
let sourceOwnerGaii = '';
|
|
499
|
+
for (const agent of allAgents) {
|
|
500
|
+
const mem = await storage.getMemory(agent.gaii, sourceManifestKey);
|
|
501
|
+
if (mem && mem.visibility === 'public') {
|
|
502
|
+
sourceManifest = mem;
|
|
503
|
+
sourceOwnerGaii = agent.gaii;
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
if (!sourceManifest || !sourceManifest.value) {
|
|
508
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Source package not found or not public'));
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const manifest = sourceManifest.value;
|
|
512
|
+
if (!manifest.sharing?.allow_clone) {
|
|
513
|
+
res.status(403).json(error(config.nodeId, 'CLONE_DISABLED', 'This package does not allow cloning'));
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
// Clone requested entries (only public ones)
|
|
517
|
+
const publicEntries = manifest.entries.filter(e => e.visibility === 'public');
|
|
518
|
+
const toClone = requestedEntries
|
|
519
|
+
? publicEntries.filter(e => requestedEntries.includes(e.key.split('/').pop()))
|
|
520
|
+
: publicEntries;
|
|
521
|
+
const now = new Date().toISOString();
|
|
522
|
+
const newPackageId = randomUUID();
|
|
523
|
+
const clonedEntries = [];
|
|
524
|
+
for (const entry of toClone) {
|
|
525
|
+
const sourceEntry = await storage.getMemory(sourceOwnerGaii, entry.key);
|
|
526
|
+
if (!sourceEntry)
|
|
527
|
+
continue;
|
|
528
|
+
const entryName = entry.key.split('/').pop() ?? entry.key;
|
|
529
|
+
const newKey = `packages/${newPackageId}/${entryName}`;
|
|
530
|
+
await storage.setMemory({
|
|
531
|
+
key: newKey,
|
|
532
|
+
ownerGaii: requesterGaii,
|
|
533
|
+
value: sourceEntry.value,
|
|
534
|
+
visibility: entry.visibility,
|
|
535
|
+
tags: [...sourceEntry.tags, 'cloned'],
|
|
536
|
+
ttlHours: null,
|
|
537
|
+
version: 1,
|
|
538
|
+
createdAt: now,
|
|
539
|
+
updatedAt: now,
|
|
540
|
+
});
|
|
541
|
+
clonedEntries.push(newKey);
|
|
542
|
+
}
|
|
543
|
+
// Create cloned manifest
|
|
544
|
+
const clonedManifest = {
|
|
545
|
+
...manifest,
|
|
546
|
+
version: '1.0.0',
|
|
547
|
+
author: requesterGhii,
|
|
548
|
+
created: now,
|
|
549
|
+
updated: now,
|
|
550
|
+
entries: toClone.map(e => ({
|
|
551
|
+
...e,
|
|
552
|
+
key: `packages/${newPackageId}/${e.key.split('/').pop()}`,
|
|
553
|
+
})),
|
|
554
|
+
links: [{
|
|
555
|
+
target: sourceManifestKey,
|
|
556
|
+
relation: 'derived-from',
|
|
557
|
+
description: `Cloned from ${manifest.name} by ${manifest.author}`,
|
|
558
|
+
linked_at: now,
|
|
559
|
+
}],
|
|
560
|
+
sharing: {
|
|
561
|
+
catalog_listed: false,
|
|
562
|
+
allow_clone: manifest.sharing.allow_clone,
|
|
563
|
+
license: manifest.sharing.license,
|
|
564
|
+
morsel_price: 0,
|
|
565
|
+
},
|
|
566
|
+
};
|
|
567
|
+
await storage.setMemory({
|
|
568
|
+
key: `packages/${newPackageId}/manifest`,
|
|
569
|
+
ownerGaii: requesterGaii,
|
|
570
|
+
value: clonedManifest,
|
|
571
|
+
visibility: 'owner',
|
|
572
|
+
tags: ['knowledge-package', manifest.content_type, ...manifest.tags, 'cloned'],
|
|
573
|
+
ttlHours: null,
|
|
574
|
+
version: 1,
|
|
575
|
+
createdAt: now,
|
|
576
|
+
updatedAt: now,
|
|
577
|
+
});
|
|
578
|
+
// Create derived-from link
|
|
579
|
+
await storage.createLink({
|
|
580
|
+
source: `packages/${newPackageId}/manifest`,
|
|
581
|
+
target: sourceManifestKey,
|
|
582
|
+
relation: 'derived-from',
|
|
583
|
+
description: `Cloned from ${manifest.name}`,
|
|
584
|
+
linked_at: now,
|
|
585
|
+
linked_by: requesterGhii,
|
|
586
|
+
});
|
|
587
|
+
res.status(201).json(success(config.nodeId, {
|
|
588
|
+
cloned_package_id: newPackageId,
|
|
589
|
+
entries_cloned: clonedEntries.length,
|
|
590
|
+
source_package_id: sourcePackageId,
|
|
591
|
+
}, [
|
|
592
|
+
{ description: 'View cloned package', method: 'GET', url: `/v1/knowledge/${newPackageId}` },
|
|
593
|
+
]));
|
|
594
|
+
emitChange('knowledge');
|
|
595
|
+
});
|
|
596
|
+
/* ── GET /v1/knowledge/:id/export — Export package as portable JSON ── */
|
|
597
|
+
router.get('/v1/knowledge/:id/export', async (req, res) => {
|
|
598
|
+
const packageId = req.params.id;
|
|
599
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
600
|
+
const requestedEntries = req.query.entries
|
|
601
|
+
? req.query.entries.split(',').map(e => e.trim())
|
|
602
|
+
: null;
|
|
603
|
+
// Find public manifest
|
|
604
|
+
const allAgents = await storage.listAgents();
|
|
605
|
+
let sourceManifest = null;
|
|
606
|
+
let sourceOwnerGaii = '';
|
|
607
|
+
for (const agent of allAgents) {
|
|
608
|
+
const mem = await storage.getMemory(agent.gaii, manifestKey);
|
|
609
|
+
if (mem && mem.visibility === 'public') {
|
|
610
|
+
sourceManifest = mem;
|
|
611
|
+
sourceOwnerGaii = agent.gaii;
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (!sourceManifest) {
|
|
616
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found or not public'));
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const manifest = sourceManifest.value;
|
|
620
|
+
const nodeUrl = config.baseUrl || `http://localhost:${config.port}`;
|
|
621
|
+
// Collect public entry data
|
|
622
|
+
const entryData = {};
|
|
623
|
+
const publicEntries = manifest.entries.filter(e => e.visibility === 'public');
|
|
624
|
+
const entriesToExport = requestedEntries
|
|
625
|
+
? publicEntries.filter(e => requestedEntries.includes(e.key.split('/').pop() ?? ''))
|
|
626
|
+
: publicEntries;
|
|
627
|
+
for (const entry of entriesToExport) {
|
|
628
|
+
const mem = await storage.getMemory(sourceOwnerGaii, entry.key);
|
|
629
|
+
if (mem) {
|
|
630
|
+
const entryName = entry.key.split('/').pop() ?? entry.key;
|
|
631
|
+
entryData[entryName] = mem.value;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
const exportData = {
|
|
635
|
+
aimeat_knowledge_package: true,
|
|
636
|
+
exported_from: {
|
|
637
|
+
node_url: nodeUrl,
|
|
638
|
+
node_id: config.nodeId,
|
|
639
|
+
package_id: packageId,
|
|
640
|
+
author_ghii: manifest.author,
|
|
641
|
+
api_spec: `${nodeUrl}/v1/openapi.yaml`,
|
|
642
|
+
auth_endpoint: `${nodeUrl}/v1/auth/token`,
|
|
643
|
+
},
|
|
644
|
+
package: {
|
|
645
|
+
...manifest,
|
|
646
|
+
entries: entriesToExport,
|
|
647
|
+
},
|
|
648
|
+
entry_data: entryData,
|
|
649
|
+
trust_advisory: 'This knowledge was shared by another user. Verify critical information independently before relying on it.',
|
|
650
|
+
};
|
|
651
|
+
const safeName = manifest.name.replace(/[^a-z0-9]/gi, '-');
|
|
652
|
+
res.setHeader('Content-Type', 'application/json');
|
|
653
|
+
res.setHeader('Content-Disposition', `attachment; filename="${safeName}.json"`);
|
|
654
|
+
res.json(exportData);
|
|
655
|
+
});
|
|
656
|
+
/* ── POST /v1/knowledge/:id/contribute — Contribute a package to an organism ── */
|
|
657
|
+
router.post('/v1/knowledge/:id/contribute', requireAuth(), requireRole('agent'), async (req, res) => {
|
|
658
|
+
const ownerGaii = resolve(req);
|
|
659
|
+
const ghii = req.auth.owner;
|
|
660
|
+
const packageId = req.params.id;
|
|
661
|
+
const { organism_id } = req.body;
|
|
662
|
+
if (!organism_id) {
|
|
663
|
+
res.status(400).json(error(config.nodeId, 'MISSING_FIELDS', 'organism_id is required'));
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
// Verify organism exists and user is a member
|
|
667
|
+
const organism = await storage.getOrganism(organism_id);
|
|
668
|
+
if (!organism) {
|
|
669
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Organism not found'));
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
const membership = await storage.getMembership(organism_id, ghii);
|
|
673
|
+
if (!membership) {
|
|
674
|
+
res.status(403).json(error(config.nodeId, 'NOT_MEMBER', 'You are not a member of this organism'));
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
// Verify the package exists and belongs to the requester
|
|
678
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
679
|
+
const manifest = await storage.getMemory(ownerGaii, manifestKey);
|
|
680
|
+
if (!manifest) {
|
|
681
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found'));
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
const now = new Date().toISOString();
|
|
685
|
+
// Create consent grant for the organism
|
|
686
|
+
await storage.createConsent({
|
|
687
|
+
id: uuidv4(),
|
|
688
|
+
ownerGaii,
|
|
689
|
+
dataPattern: `packages/${packageId}/*`,
|
|
690
|
+
recipient: `organism.${organism_id}`,
|
|
691
|
+
purpose: `Knowledge package contributed to organism: ${organism.name || organism_id}`,
|
|
692
|
+
scope: 'private',
|
|
693
|
+
expires: null,
|
|
694
|
+
status: 'active',
|
|
695
|
+
grantedAt: now,
|
|
696
|
+
revokedAt: null,
|
|
697
|
+
});
|
|
698
|
+
// Tag the manifest with the organism
|
|
699
|
+
const existingTags = manifest.tags || [];
|
|
700
|
+
if (!existingTags.includes(`organism:${organism_id}`)) {
|
|
701
|
+
manifest.tags = [...existingTags, `organism:${organism_id}`];
|
|
702
|
+
manifest.updatedAt = now;
|
|
703
|
+
manifest.version += 1;
|
|
704
|
+
await storage.setMemory(manifest);
|
|
705
|
+
}
|
|
706
|
+
res.status(201).json(success(config.nodeId, {
|
|
707
|
+
package_id: packageId,
|
|
708
|
+
organism_id,
|
|
709
|
+
contributed: true,
|
|
710
|
+
}));
|
|
711
|
+
emitChange('knowledge');
|
|
712
|
+
});
|
|
713
|
+
/* ── GET /v1/knowledge/organism/:id — List packages shared with an organism ── */
|
|
714
|
+
router.get('/v1/knowledge/organism/:id', requireAuth(), async (req, res) => {
|
|
715
|
+
const ghii = req.auth.owner;
|
|
716
|
+
const organismId = req.params.id;
|
|
717
|
+
// Verify membership
|
|
718
|
+
const membership = await storage.getMembership(organismId, ghii);
|
|
719
|
+
if (!membership) {
|
|
720
|
+
res.status(403).json(error(config.nodeId, 'NOT_MEMBER', 'You are not a member of this organism'));
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
// Find consents granted to this organism for package data
|
|
724
|
+
const allAgents = await storage.listAgents();
|
|
725
|
+
const packages = [];
|
|
726
|
+
for (const agent of allAgents) {
|
|
727
|
+
const consents = await storage.listConsents(agent.gaii, { recipient: `organism.${organismId}`, status: 'active' });
|
|
728
|
+
for (const consent of consents) {
|
|
729
|
+
if (consent.dataPattern.startsWith('packages/') && consent.dataPattern.endsWith('/*')) {
|
|
730
|
+
const prefix = consent.dataPattern.replace('/*', '/manifest');
|
|
731
|
+
const manifest = await storage.getMemory(agent.gaii, prefix);
|
|
732
|
+
if (manifest && manifest.value?.type === 'knowledge-package') {
|
|
733
|
+
packages.push({
|
|
734
|
+
key: prefix,
|
|
735
|
+
manifest: manifest.value,
|
|
736
|
+
ownerGaii: agent.gaii,
|
|
737
|
+
contributed_at: consent.grantedAt,
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
res.json(success(config.nodeId, { packages, count: packages.length }));
|
|
744
|
+
});
|
|
745
|
+
/* ── GET /v1/knowledge/:id/reputation — Get quality signals for a package ── */
|
|
746
|
+
router.get('/v1/knowledge/:id/reputation', async (req, res) => {
|
|
747
|
+
const packageId = req.params.id;
|
|
748
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
749
|
+
// Find the manifest
|
|
750
|
+
const allAgents = await storage.listAgents();
|
|
751
|
+
let manifest = null;
|
|
752
|
+
for (const agent of allAgents) {
|
|
753
|
+
const mem = await storage.getMemory(agent.gaii, manifestKey);
|
|
754
|
+
if (mem) {
|
|
755
|
+
manifest = mem;
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if (!manifest) {
|
|
760
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found'));
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
const value = manifest.value;
|
|
764
|
+
// Count clones (derived-from links pointing to this package)
|
|
765
|
+
const incomingLinks = await storage.listLinks(manifestKey, { direction: 'incoming', relation: 'derived-from' });
|
|
766
|
+
const cloneCount = incomingLinks.length;
|
|
767
|
+
// Citation quality
|
|
768
|
+
const refs = value.references || [];
|
|
769
|
+
const verifiedCount = refs.filter(r => r.verified).length;
|
|
770
|
+
const citationQuality = refs.length > 0 ? Math.round((verifiedCount / refs.length) * 100) : null;
|
|
771
|
+
// Flag count (from memory record)
|
|
772
|
+
const flagCount = manifest.flagCount ?? 0;
|
|
773
|
+
// Reviews
|
|
774
|
+
const reviews = await storage.listReviews(manifestKey);
|
|
775
|
+
const lastReview = reviews.length > 0 ? reviews[reviews.length - 1] : null;
|
|
776
|
+
res.json(success(config.nodeId, {
|
|
777
|
+
package_id: packageId,
|
|
778
|
+
clone_count: cloneCount,
|
|
779
|
+
flag_count: flagCount,
|
|
780
|
+
citation_quality_percent: citationQuality,
|
|
781
|
+
references_total: refs.length,
|
|
782
|
+
references_verified: verifiedCount,
|
|
783
|
+
synthesis_level: value.synthesis?.level,
|
|
784
|
+
maturity: value.maturity,
|
|
785
|
+
last_updated: value.updated || manifest.updatedAt,
|
|
786
|
+
last_review: lastReview ? {
|
|
787
|
+
action: lastReview.action,
|
|
788
|
+
reason: lastReview.reason,
|
|
789
|
+
timestamp: lastReview.timestamp,
|
|
790
|
+
} : null,
|
|
791
|
+
}));
|
|
792
|
+
});
|
|
793
|
+
/* ── GET /v1/admin/knowledge — List all packages for operator review ── */
|
|
794
|
+
router.get('/v1/admin/knowledge', requireAuth(), requireRole('operator'), async (req, res) => {
|
|
795
|
+
const page = Math.max(1, parseInt(req.query.page || '1'));
|
|
796
|
+
const perPage = Math.min(50, Math.max(1, parseInt(req.query.limit || '20')));
|
|
797
|
+
const filterFlagged = req.query.flagged === 'true';
|
|
798
|
+
const filterAuthor = req.query.author;
|
|
799
|
+
const filterType = req.query.content_type;
|
|
800
|
+
const allAgents = await storage.listAgents();
|
|
801
|
+
const seenKeys = new Set();
|
|
802
|
+
let manifests = [];
|
|
803
|
+
// Collect from all agents
|
|
804
|
+
for (const agent of allAgents) {
|
|
805
|
+
const agentManifests = await storage.listMemory(agent.gaii, {
|
|
806
|
+
prefix: 'packages/',
|
|
807
|
+
tags: ['knowledge-package'],
|
|
808
|
+
});
|
|
809
|
+
for (const m of agentManifests) {
|
|
810
|
+
if (m.key.endsWith('/manifest') && m.value?.type === 'knowledge-package' && !seenKeys.has(m.key)) {
|
|
811
|
+
seenKeys.add(m.key);
|
|
812
|
+
manifests.push({
|
|
813
|
+
key: m.key,
|
|
814
|
+
value: m.value,
|
|
815
|
+
ownerGaii: m.ownerGaii,
|
|
816
|
+
visibility: m.visibility,
|
|
817
|
+
flagCount: m.flagCount ?? 0,
|
|
818
|
+
createdAt: m.createdAt,
|
|
819
|
+
updatedAt: m.updatedAt,
|
|
820
|
+
isSystem: (m.tags || []).includes('system-knowledge'),
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
// Also collect system packages stored under operator GAII
|
|
826
|
+
const operatorGaii = resolve(req);
|
|
827
|
+
const operatorManifests = await storage.listMemory(operatorGaii, {
|
|
828
|
+
prefix: 'packages/',
|
|
829
|
+
tags: ['knowledge-package'],
|
|
830
|
+
});
|
|
831
|
+
for (const m of operatorManifests) {
|
|
832
|
+
if (m.key.endsWith('/manifest') && m.value?.type === 'knowledge-package' && !seenKeys.has(m.key)) {
|
|
833
|
+
seenKeys.add(m.key);
|
|
834
|
+
manifests.push({
|
|
835
|
+
key: m.key,
|
|
836
|
+
value: m.value,
|
|
837
|
+
ownerGaii: m.ownerGaii,
|
|
838
|
+
visibility: m.visibility,
|
|
839
|
+
flagCount: m.flagCount ?? 0,
|
|
840
|
+
createdAt: m.createdAt,
|
|
841
|
+
updatedAt: m.updatedAt,
|
|
842
|
+
isSystem: true,
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
// Apply filters
|
|
847
|
+
if (filterFlagged)
|
|
848
|
+
manifests = manifests.filter(m => m.flagCount > 0);
|
|
849
|
+
if (filterAuthor)
|
|
850
|
+
manifests = manifests.filter(m => m.value.author === filterAuthor);
|
|
851
|
+
if (filterType)
|
|
852
|
+
manifests = manifests.filter(m => m.value.content_type === filterType);
|
|
853
|
+
// Sort: flagged first, then newest
|
|
854
|
+
manifests.sort((a, b) => {
|
|
855
|
+
if (a.flagCount !== b.flagCount)
|
|
856
|
+
return b.flagCount - a.flagCount;
|
|
857
|
+
return (b.updatedAt || b.createdAt).localeCompare(a.updatedAt || a.createdAt);
|
|
858
|
+
});
|
|
859
|
+
const total = manifests.length;
|
|
860
|
+
const paged = manifests.slice((page - 1) * perPage, page * perPage);
|
|
861
|
+
res.json(success(config.nodeId, {
|
|
862
|
+
packages: paged.map(m => ({
|
|
863
|
+
key: m.key,
|
|
864
|
+
package_id: m.key.replace('packages/', '').replace('/manifest', ''),
|
|
865
|
+
name: m.value.name,
|
|
866
|
+
author: m.value.author,
|
|
867
|
+
content_type: m.value.content_type,
|
|
868
|
+
tags: m.value.tags || [],
|
|
869
|
+
visibility: m.visibility,
|
|
870
|
+
flag_count: m.flagCount,
|
|
871
|
+
maturity: m.value.maturity,
|
|
872
|
+
entries_count: (m.value.entries || []).length,
|
|
873
|
+
is_system: m.isSystem || false,
|
|
874
|
+
created: m.value.created || m.createdAt,
|
|
875
|
+
})),
|
|
876
|
+
total,
|
|
877
|
+
page,
|
|
878
|
+
per_page: perPage,
|
|
879
|
+
}));
|
|
880
|
+
});
|
|
881
|
+
/* ── POST /v1/admin/knowledge/import — Operator creates system knowledge ── */
|
|
882
|
+
router.post('/v1/admin/knowledge/import', requireAuth(), requireRole('operator'), async (req, res) => {
|
|
883
|
+
const operatorGaii = resolve(req);
|
|
884
|
+
const ownerName = req.auth.owner;
|
|
885
|
+
const { name, content_type, tags, maturity, visibility, catalog_listed, entries } = req.body;
|
|
886
|
+
if (!name || typeof name !== 'string') {
|
|
887
|
+
res.status(400).json(error(config.nodeId, 'INVALID_NAME', 'Package name is required'));
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
const validTypes = ['idea', 'research', 'plan', 'dataset', 'document', 'tutorial', 'collection', 'article', 'story', 'fiction'];
|
|
891
|
+
if (!content_type || !validTypes.includes(content_type)) {
|
|
892
|
+
res.status(400).json(error(config.nodeId, 'INVALID_TYPE', `content_type must be one of: ${validTypes.join(', ')}`));
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
if (!entries || !Array.isArray(entries) || entries.length === 0) {
|
|
896
|
+
res.status(400).json(error(config.nodeId, 'NO_ENTRIES', 'At least one entry is required'));
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
const packageId = uuidv4();
|
|
900
|
+
const now = new Date().toISOString();
|
|
901
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
902
|
+
const parsedTags = (typeof tags === 'string' ? tags.split(',').map((t) => t.trim()).filter(Boolean) : (tags || []));
|
|
903
|
+
const entryVisibility = visibility === 'operator' ? 'private' : 'public';
|
|
904
|
+
const manifest = {
|
|
905
|
+
type: 'knowledge-package',
|
|
906
|
+
name,
|
|
907
|
+
version: '1.0.0',
|
|
908
|
+
author: ownerName,
|
|
909
|
+
content_type: content_type,
|
|
910
|
+
tags: parsedTags,
|
|
911
|
+
language: 'en',
|
|
912
|
+
maturity: maturity || 'published',
|
|
913
|
+
synthesis: { level: 'original', description: 'System knowledge created by operator' },
|
|
914
|
+
references: [],
|
|
915
|
+
entries: entries.map((e, i) => ({
|
|
916
|
+
key: `packages/${packageId}/entry-${i}`,
|
|
917
|
+
title: e.title || `Entry ${i + 1}`,
|
|
918
|
+
visibility: entryVisibility,
|
|
919
|
+
})),
|
|
920
|
+
links: [],
|
|
921
|
+
sharing: {
|
|
922
|
+
catalog_listed: catalog_listed ?? (visibility !== 'operator'),
|
|
923
|
+
allow_clone: visibility !== 'operator',
|
|
924
|
+
morsel_price: 0,
|
|
925
|
+
},
|
|
926
|
+
created: now,
|
|
927
|
+
updated: now,
|
|
928
|
+
};
|
|
929
|
+
// Store manifest
|
|
930
|
+
await storage.setMemory({
|
|
931
|
+
key: manifestKey,
|
|
932
|
+
ownerGaii: operatorGaii,
|
|
933
|
+
value: manifest,
|
|
934
|
+
visibility: entryVisibility,
|
|
935
|
+
tags: ['knowledge-package', 'system-knowledge', content_type, ...parsedTags],
|
|
936
|
+
ttlHours: null,
|
|
937
|
+
version: 1,
|
|
938
|
+
createdAt: now,
|
|
939
|
+
updatedAt: now,
|
|
940
|
+
});
|
|
941
|
+
// Store entries
|
|
942
|
+
const createdEntries = [];
|
|
943
|
+
for (let i = 0; i < entries.length; i++) {
|
|
944
|
+
const entryKey = `packages/${packageId}/entry-${i}`;
|
|
945
|
+
await storage.setMemory({
|
|
946
|
+
key: entryKey,
|
|
947
|
+
ownerGaii: operatorGaii,
|
|
948
|
+
value: { title: entries[i].title || `Entry ${i + 1}`, body: entries[i].content || '' },
|
|
949
|
+
visibility: entryVisibility,
|
|
950
|
+
tags: ['knowledge-entry', 'system-knowledge', content_type, ...parsedTags],
|
|
951
|
+
ttlHours: null,
|
|
952
|
+
version: 1,
|
|
953
|
+
createdAt: now,
|
|
954
|
+
updatedAt: now,
|
|
955
|
+
});
|
|
956
|
+
createdEntries.push(entryKey);
|
|
957
|
+
}
|
|
958
|
+
res.status(201).json(success(config.nodeId, {
|
|
959
|
+
package_id: packageId,
|
|
960
|
+
manifest_key: manifestKey,
|
|
961
|
+
entries_created: createdEntries.length,
|
|
962
|
+
visibility,
|
|
963
|
+
catalog_listed: manifest.sharing.catalog_listed,
|
|
964
|
+
}));
|
|
965
|
+
emitChange('knowledge');
|
|
966
|
+
});
|
|
967
|
+
/* ── DELETE /v1/admin/knowledge/:id — Operator deletes a package ── */
|
|
968
|
+
router.delete('/v1/admin/knowledge/:id', requireAuth(), requireRole('operator'), async (req, res) => {
|
|
969
|
+
const packageId = req.params.id;
|
|
970
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
971
|
+
// Find the package across all agents
|
|
972
|
+
const allAgents = await storage.listAgents();
|
|
973
|
+
let found = false;
|
|
974
|
+
for (const agent of allAgents) {
|
|
975
|
+
const mem = await storage.getMemory(agent.gaii, manifestKey);
|
|
976
|
+
if (mem) {
|
|
977
|
+
// Delete manifest and all entries
|
|
978
|
+
const allEntries = await storage.listMemory(agent.gaii, { prefix: `packages/${packageId}/` });
|
|
979
|
+
for (const entry of allEntries) {
|
|
980
|
+
await storage.deleteMemory(agent.gaii, entry.key);
|
|
981
|
+
}
|
|
982
|
+
found = true;
|
|
983
|
+
break;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
// Also try operator's own GAII for system packages
|
|
987
|
+
if (!found) {
|
|
988
|
+
const operatorGaii = resolve(req);
|
|
989
|
+
const mem = await storage.getMemory(operatorGaii, manifestKey);
|
|
990
|
+
if (mem) {
|
|
991
|
+
const allEntries = await storage.listMemory(operatorGaii, { prefix: `packages/${packageId}/` });
|
|
992
|
+
for (const entry of allEntries) {
|
|
993
|
+
await storage.deleteMemory(operatorGaii, entry.key);
|
|
994
|
+
}
|
|
995
|
+
found = true;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
if (!found) {
|
|
999
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found'));
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
res.json(success(config.nodeId, { deleted: packageId }));
|
|
1003
|
+
emitChange('knowledge');
|
|
1004
|
+
});
|
|
1005
|
+
/* ── POST /v1/admin/knowledge/:id/review — Operator reviews a package ── */
|
|
1006
|
+
router.post('/v1/admin/knowledge/:id/review', requireAuth(), requireRole('operator'), async (req, res) => {
|
|
1007
|
+
const operatorGaii = resolve(req);
|
|
1008
|
+
const packageId = req.params.id;
|
|
1009
|
+
const { reason, custom_text, action: reviewAction } = req.body;
|
|
1010
|
+
const validReasons = ['routine_review', 'legal_compliance', 'community_report', 'content_quality', 'storage_issue', 'custom'];
|
|
1011
|
+
const validActions = ['approve', 'flag', 'delist', 'restrict', 'note'];
|
|
1012
|
+
if (!reason || !validReasons.includes(reason)) {
|
|
1013
|
+
res.status(400).json(error(config.nodeId, 'INVALID_REASON', `reason must be one of: ${validReasons.join(', ')}`));
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
if (!reviewAction || !validActions.includes(reviewAction)) {
|
|
1017
|
+
res.status(400).json(error(config.nodeId, 'INVALID_ACTION', `action must be one of: ${validActions.join(', ')}`));
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
1021
|
+
// Find the package (search all agents)
|
|
1022
|
+
const allAgents = await storage.listAgents();
|
|
1023
|
+
let manifest = null;
|
|
1024
|
+
for (const agent of allAgents) {
|
|
1025
|
+
const mem = await storage.getMemory(agent.gaii, manifestKey);
|
|
1026
|
+
if (mem) {
|
|
1027
|
+
manifest = mem;
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
if (!manifest) {
|
|
1032
|
+
res.status(404).json(error(config.nodeId, 'NOT_FOUND', 'Package not found'));
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
const now = new Date().toISOString();
|
|
1036
|
+
// Create review record
|
|
1037
|
+
const review = {
|
|
1038
|
+
id: uuidv4(),
|
|
1039
|
+
packageId: manifestKey,
|
|
1040
|
+
operatorGaii,
|
|
1041
|
+
reason: reason,
|
|
1042
|
+
customText: custom_text,
|
|
1043
|
+
action: reviewAction,
|
|
1044
|
+
timestamp: now,
|
|
1045
|
+
};
|
|
1046
|
+
await storage.createReview(review);
|
|
1047
|
+
// Create audit entry (transparent to package owner)
|
|
1048
|
+
await storage.addConsentAuditEntry({
|
|
1049
|
+
id: uuidv4(),
|
|
1050
|
+
consentId: 'operator-review',
|
|
1051
|
+
ownerGaii: manifest.ownerGaii,
|
|
1052
|
+
accessorGaii: operatorGaii,
|
|
1053
|
+
memoryKey: manifestKey,
|
|
1054
|
+
action: 'read',
|
|
1055
|
+
timestamp: now,
|
|
1056
|
+
allowed: true,
|
|
1057
|
+
});
|
|
1058
|
+
// Apply action to the package
|
|
1059
|
+
const manifestValue = manifest.value;
|
|
1060
|
+
switch (reviewAction) {
|
|
1061
|
+
case 'approve':
|
|
1062
|
+
manifest.flagCount = 0;
|
|
1063
|
+
break;
|
|
1064
|
+
case 'flag':
|
|
1065
|
+
manifest.flagCount = (manifest.flagCount ?? 0) + 5;
|
|
1066
|
+
break;
|
|
1067
|
+
case 'delist':
|
|
1068
|
+
manifestValue.sharing.catalog_listed = false;
|
|
1069
|
+
manifest.value = manifestValue;
|
|
1070
|
+
break;
|
|
1071
|
+
case 'restrict':
|
|
1072
|
+
manifest.visibility = 'private';
|
|
1073
|
+
manifestValue.sharing.catalog_listed = false;
|
|
1074
|
+
manifest.value = manifestValue;
|
|
1075
|
+
break;
|
|
1076
|
+
case 'note':
|
|
1077
|
+
break;
|
|
1078
|
+
}
|
|
1079
|
+
manifest.updatedAt = now;
|
|
1080
|
+
manifest.version += 1;
|
|
1081
|
+
await storage.setMemory(manifest);
|
|
1082
|
+
res.json(success(config.nodeId, {
|
|
1083
|
+
review_id: review.id,
|
|
1084
|
+
action: reviewAction,
|
|
1085
|
+
reason,
|
|
1086
|
+
package_id: packageId,
|
|
1087
|
+
}));
|
|
1088
|
+
emitChange('knowledge');
|
|
1089
|
+
});
|
|
1090
|
+
/* ── GET /v1/knowledge/:id/reviews — List operator reviews for a package ── */
|
|
1091
|
+
router.get('/v1/knowledge/:id/reviews', requireAuth(), async (req, res) => {
|
|
1092
|
+
const packageId = req.params.id;
|
|
1093
|
+
const manifestKey = `packages/${packageId}/manifest`;
|
|
1094
|
+
const reviews = await storage.listReviews(manifestKey);
|
|
1095
|
+
res.json(success(config.nodeId, {
|
|
1096
|
+
reviews: reviews.map(r => ({
|
|
1097
|
+
id: r.id,
|
|
1098
|
+
reason: r.reason,
|
|
1099
|
+
action: r.action,
|
|
1100
|
+
custom_text: r.customText,
|
|
1101
|
+
timestamp: r.timestamp,
|
|
1102
|
+
})),
|
|
1103
|
+
count: reviews.length,
|
|
1104
|
+
}));
|
|
1105
|
+
});
|
|
1106
|
+
return router;
|
|
1107
|
+
}
|
|
1108
|
+
//# sourceMappingURL=knowledge.js.map
|