@hotmeshio/long-tail 0.23.2 → 0.24.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/build/adapters/express.d.ts +9 -1
- package/build/adapters/express.js +32 -41
- package/build/api/auth-sso.d.ts +1 -1
- package/build/api/bot-accounts.d.ts +2 -0
- package/build/api/bot-accounts.js +4 -0
- package/build/api/capabilities.d.ts +7 -2
- package/build/api/capabilities.js +13 -2
- package/build/api/escalations/analytics.js +5 -0
- package/build/api/escalations/bulk.d.ts +2 -0
- package/build/api/escalations/bulk.js +9 -4
- package/build/api/escalations/helpers.d.ts +5 -0
- package/build/api/escalations/helpers.js +7 -0
- package/build/api/escalations/metadata.js +3 -0
- package/build/api/escalations/single.d.ts +3 -2
- package/build/api/escalations/single.js +8 -3
- package/build/api/mcp/tools.d.ts +12 -0
- package/build/api/mcp/tools.js +113 -9
- package/build/api/scan-codes/choice.js +31 -7
- package/build/api/settings.js +9 -0
- package/build/api/tasks.d.ts +3 -3
- package/build/api/tasks.js +30 -7
- package/build/api/workflows/input-lookups.js +1 -1
- package/build/api/workflows/invocable.js +2 -2
- package/build/api/workflows/invocation.js +1 -1
- package/build/api/yaml-workflows/deploy.d.ts +10 -2
- package/build/api/yaml-workflows/deploy.js +42 -2
- package/build/lib/db/schemas/038_oauth_server.sql +46 -0
- package/build/lib/events/browser-view.d.ts +15 -0
- package/build/lib/events/browser-view.js +101 -0
- package/build/lib/events/nats-ws-filter.d.ts +29 -0
- package/build/lib/events/nats-ws-filter.js +94 -0
- package/build/lib/events/nats-ws-proxy.d.ts +2 -0
- package/build/lib/events/nats-ws-proxy.js +39 -5
- package/build/lib/events/nats-ws-server-filter.d.ts +16 -0
- package/build/lib/events/nats-ws-server-filter.js +56 -0
- package/build/lib/events/nats-ws-ticket.d.ts +10 -0
- package/build/lib/events/nats-ws-ticket.js +42 -0
- package/build/lib/events/socketio.d.ts +10 -1
- package/build/lib/events/socketio.js +10 -3
- package/build/lib/http/index.d.ts +27 -0
- package/build/lib/http/index.js +55 -0
- package/build/modules/auth.d.ts +15 -24
- package/build/modules/auth.js +43 -126
- package/build/modules/capabilities.d.ts +62 -0
- package/build/modules/capabilities.js +188 -0
- package/build/modules/config.d.ts +14 -0
- package/build/modules/config.js +20 -0
- package/build/modules/defaults.d.ts +10 -0
- package/build/modules/defaults.js +12 -1
- package/build/modules/mcp-auth.d.ts +11 -0
- package/build/modules/mcp-auth.js +56 -0
- package/build/modules/oauth-server.d.ts +18 -0
- package/build/modules/oauth-server.js +40 -0
- package/build/routes/agents.js +46 -14
- package/build/routes/announcements.js +2 -2
- package/build/routes/auth-sso.js +2 -2
- package/build/routes/auth.js +2 -2
- package/build/routes/bot-accounts.js +26 -3
- package/build/routes/capabilities.js +4 -4
- package/build/routes/controlplane.js +2 -2
- package/build/routes/dba.js +2 -2
- package/build/routes/delegation.js +2 -2
- package/build/routes/diagnostics.js +2 -2
- package/build/routes/docs.js +2 -2
- package/build/routes/domain.js +2 -2
- package/build/routes/escalations/accumulate.d.ts +1 -1
- package/build/routes/escalations/acting.d.ts +1 -1
- package/build/routes/escalations/analytics.d.ts +1 -1
- package/build/routes/escalations/bulk.d.ts +1 -1
- package/build/routes/escalations/facets.d.ts +1 -1
- package/build/routes/escalations/index.js +2 -2
- package/build/routes/escalations/list.d.ts +1 -1
- package/build/routes/escalations/metadata.d.ts +1 -1
- package/build/routes/escalations/related.d.ts +1 -1
- package/build/routes/escalations/resolve.d.ts +1 -1
- package/build/routes/escalations/single.d.ts +1 -1
- package/build/routes/escalations/single.js +1 -1
- package/build/routes/exports.js +14 -13
- package/build/routes/file-browser.js +9 -8
- package/build/routes/files.js +2 -2
- package/build/routes/index.js +4 -2
- package/build/routes/insight.js +5 -4
- package/build/routes/knowledge.js +2 -2
- package/build/routes/maintenance.js +2 -2
- package/build/routes/mcp-endpoint.d.ts +3 -1
- package/build/routes/mcp-endpoint.js +18 -8
- package/build/routes/mcp.js +35 -15
- package/build/routes/me.js +2 -2
- package/build/routes/namespaces.js +4 -3
- package/build/routes/nats-credentials.js +27 -3
- package/build/routes/oauth-server/authorize.d.ts +2 -0
- package/build/routes/oauth-server/authorize.js +108 -0
- package/build/routes/oauth-server/grants.d.ts +2 -0
- package/build/routes/oauth-server/grants.js +35 -0
- package/build/routes/oauth-server/index.d.ts +8 -0
- package/build/routes/oauth-server/index.js +52 -0
- package/build/routes/oauth-server/registration.d.ts +2 -0
- package/build/routes/oauth-server/registration.js +38 -0
- package/build/routes/oauth-server/token.d.ts +2 -0
- package/build/routes/oauth-server/token.js +100 -0
- package/build/routes/oauth-well-known.d.ts +8 -0
- package/build/routes/oauth-well-known.js +31 -0
- package/build/routes/oauth.js +2 -2
- package/build/routes/overview.js +2 -2
- package/build/routes/personas.js +2 -2
- package/build/routes/pipelines.js +6 -5
- package/build/routes/roles.js +2 -2
- package/build/routes/scan-codes.js +2 -2
- package/build/routes/settings.js +2 -2
- package/build/routes/tasks.js +5 -5
- package/build/routes/topics.js +21 -9
- package/build/routes/users.js +25 -22
- package/build/routes/workflow-sets.js +13 -12
- package/build/routes/workflows/config.js +15 -2
- package/build/routes/workflows/discovery.js +2 -2
- package/build/routes/workflows/index.js +2 -2
- package/build/routes/workflows/invocation.js +11 -10
- package/build/routes/yaml-workflows/cron.js +19 -6
- package/build/routes/yaml-workflows/crud.js +13 -12
- package/build/routes/yaml-workflows/deployment.js +11 -10
- package/build/routes/yaml-workflows/index.js +2 -2
- package/build/routes/yaml-workflows/versions.js +2 -2
- package/build/services/agent/authority.d.ts +14 -0
- package/build/services/agent/authority.js +53 -0
- package/build/services/auth/bot-api-key.d.ts +2 -0
- package/build/services/auth/bot-api-key.js +10 -0
- package/build/services/auth/oauth-server/access-token.d.ts +36 -0
- package/build/services/auth/oauth-server/access-token.js +80 -0
- package/build/services/auth/oauth-server/authorization.d.ts +47 -0
- package/build/services/auth/oauth-server/authorization.js +54 -0
- package/build/services/auth/oauth-server/constants.d.ts +11 -0
- package/build/services/auth/oauth-server/constants.js +16 -0
- package/build/services/auth/oauth-server/index.d.ts +3 -0
- package/build/services/auth/oauth-server/index.js +26 -0
- package/build/services/auth/oauth-server/metadata.d.ts +21 -0
- package/build/services/auth/oauth-server/metadata.js +53 -0
- package/build/services/auth/oauth-server/registration.d.ts +42 -0
- package/build/services/auth/oauth-server/registration.js +134 -0
- package/build/services/auth/oauth-server/sql.d.ts +34 -0
- package/build/services/auth/oauth-server/sql.js +123 -0
- package/build/services/auth/oauth-server/store.d.ts +74 -0
- package/build/services/auth/oauth-server/store.js +151 -0
- package/build/services/auth/sql.d.ts +1 -0
- package/build/services/auth/sql.js +3 -1
- package/build/services/escalation/queries.js +7 -2
- package/build/services/export/index.d.ts +10 -0
- package/build/services/export/index.js +27 -0
- package/build/services/invocation-access.d.ts +25 -4
- package/build/services/invocation-access.js +39 -7
- package/build/services/mcp/client/connection-dispatch.d.ts +6 -1
- package/build/services/mcp/client/connection-dispatch.js +3 -2
- package/build/services/mcp/client/connection-lifecycle.d.ts +10 -2
- package/build/services/mcp/client/connection-lifecycle.js +45 -7
- package/build/services/mcp/client/connection-test.js +2 -6
- package/build/services/mcp/client/connection.d.ts +1 -1
- package/build/services/mcp/client/connection.js +3 -1
- package/build/services/mcp/client/index.d.ts +2 -2
- package/build/services/mcp/client/index.js +4 -1
- package/build/services/mcp/client/network-transport.d.ts +12 -0
- package/build/services/mcp/client/network-transport.js +20 -0
- package/build/services/mcp/client/tools.d.ts +13 -0
- package/build/services/mcp/client/tools.js +18 -0
- package/build/services/mcp/db-server/index.js +2 -1
- package/build/services/mcp/external-server.d.ts +9 -4
- package/build/services/mcp/external-server.js +34 -11
- package/build/services/mcp/playwright-server/index.js +2 -1
- package/build/services/mcp/registered-tools.d.ts +3 -0
- package/build/services/mcp/registered-tools.js +7 -0
- package/build/services/mcp/server-lifecycle.js +2 -1
- package/build/services/workflow-invocation.d.ts +16 -3
- package/build/services/workflow-invocation.js +42 -10
- package/build/services/yaml-workflow/deployer.d.ts +10 -2
- package/build/services/yaml-workflow/deployer.js +17 -5
- package/build/services/yaml-workflow/invoke.js +27 -26
- package/build/start/config.js +7 -0
- package/build/start/index.js +4 -22
- package/build/start/server.d.ts +6 -4
- package/build/start/server.js +11 -35
- package/build/start/socket-auth.js +2 -1
- package/build/start/workers.js +1 -1
- package/build/system/mcp-servers/admin/agent-subscriptions.js +24 -1
- package/build/system/mcp-servers/admin/agents.js +25 -2
- package/build/system/mcp-servers/admin/announcements.js +3 -2
- package/build/system/mcp-servers/admin/bot-accounts.js +37 -5
- package/build/system/mcp-servers/admin/escalations.d.ts +3 -5
- package/build/system/mcp-servers/admin/escalations.js +74 -70
- package/build/system/mcp-servers/admin/exports.js +7 -1
- package/build/system/mcp-servers/admin/index.js +24 -25
- package/build/system/mcp-servers/admin/overview.d.ts +2 -2
- package/build/system/mcp-servers/admin/run-read.d.ts +2 -0
- package/build/system/mcp-servers/admin/run-read.js +5 -0
- package/build/system/mcp-servers/admin/scan-codes.d.ts +2 -2
- package/build/system/mcp-servers/admin/scan-codes.js +5 -11
- package/build/system/mcp-servers/admin/schemas.d.ts +20 -20
- package/build/system/mcp-servers/admin/tasks.js +7 -2
- package/build/system/mcp-servers/admin/users.js +31 -4
- package/build/system/mcp-servers/admin/workflow-config.js +12 -1
- package/build/system/mcp-servers/admin/workflows.js +27 -5
- package/build/system/mcp-servers/admin/yaml-workflows.js +7 -1
- package/build/system/mcp-servers/caller-auth.d.ts +18 -0
- package/build/system/mcp-servers/caller-auth.js +29 -0
- package/build/system/mcp-servers/claude-code.js +2 -1
- package/build/system/mcp-servers/db-query/index.js +2 -1
- package/build/system/mcp-servers/file-storage.js +2 -1
- package/build/system/mcp-servers/http-fetch.js +2 -1
- package/build/system/mcp-servers/human-queue.js +7 -3
- package/build/system/mcp-servers/oauth.js +31 -4
- package/build/system/mcp-servers/schema-exchange.js +2 -1
- package/build/system/mcp-servers/vision.d.ts +1 -0
- package/build/system/mcp-servers/vision.js +17 -7
- package/build/system/seed/tool-manifests-admin.d.ts +2 -17985
- package/build/system/seed/tool-manifests-admin.js +121 -121
- package/build/system/seed/tool-manifests-data.d.ts +8 -374
- package/build/system/seed/tool-manifests-data.js +22 -4
- package/build/system/seed/tool-manifests-escalation.d.ts +2 -352
- package/build/system/seed/tool-manifests-escalation.js +11 -1
- package/build/system/seed/tool-manifests-events.d.ts +2 -116
- package/build/system/seed/tool-manifests-events.js +6 -2
- package/build/system/seed/tool-manifests-knowledge.d.ts +2 -221
- package/build/system/seed/tool-manifests-knowledge.js +41 -1
- package/build/system/seed/tool-manifests-workflows.d.ts +2 -71
- package/build/system/seed/tool-manifests-workflows.js +3 -1
- package/build/system/workflows/shared/principal-tools.d.ts +20 -0
- package/build/system/workflows/shared/principal-tools.js +64 -0
- package/build/system/workflows/shared/tool-executor.js +21 -11
- package/build/system/workflows/shared/tool-loader.js +8 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/auth.d.ts +1 -1
- package/build/types/capability.d.ts +14 -0
- package/build/types/capability.js +2 -0
- package/build/types/events.d.ts +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/mcp.d.ts +3 -1
- package/build/types/oauth-server.d.ts +52 -0
- package/build/types/oauth-server.js +2 -0
- package/build/types/startup.d.ts +15 -7
- package/build/vitest.config.js +2 -1
- package/build/vitest.fast.config.d.ts +2 -0
- package/build/vitest.fast.config.js +20 -0
- package/build/vitest.llm.config.d.ts +2 -0
- package/build/vitest.llm.config.js +16 -0
- package/dashboard/dist/assets/{AdminDashboard-BPWsgMfZ.js → AdminDashboard-B3mkMIOT.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-BPWsgMfZ.js.map → AdminDashboard-B3mkMIOT.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-De9imyo5.js → AgentConfigPage-CQj2B678.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-De9imyo5.js.map → AgentConfigPage-CQj2B678.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-B6o96Y5G.js → AgentDetailPage-CzrD8JJI.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-B6o96Y5G.js.map → AgentDetailPage-CzrD8JJI.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-DMEmiK_W.js → AgentsPage-jg2OFwyW.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-DMEmiK_W.js.map → AgentsPage-jg2OFwyW.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-DeYMngwE.js → AvailableEscalationsPage-IS28XBRe.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-DeYMngwE.js.map → AvailableEscalationsPage-IS28XBRe.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-DDmpgGHZ.js → BotPicker-DvEJFpwS.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-DDmpgGHZ.js.map → BotPicker-DvEJFpwS.js.map} +1 -1
- package/dashboard/dist/assets/{BulkAssignModal-BqlklomG.js → BulkAssignModal-BoQCi-YC.js} +2 -2
- package/dashboard/dist/assets/{BulkAssignModal-BqlklomG.js.map → BulkAssignModal-BoQCi-YC.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-DOtjDTbK.js → CapabilitiesPage-kwlrcb_t.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-DOtjDTbK.js.map → CapabilitiesPage-kwlrcb_t.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-CLr8LP0V.js → CollapsibleSection-UMIV4KIj.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-CLr8LP0V.js.map → CollapsibleSection-UMIV4KIj.js.map} +1 -1
- package/dashboard/dist/assets/ConfirmDeleteModal-C5puwMg7.js +2 -0
- package/dashboard/dist/assets/ConfirmDeleteModal-C5puwMg7.js.map +1 -0
- package/dashboard/dist/assets/ConnectedAppsPage-drZa65kP.js +2 -0
- package/dashboard/dist/assets/ConnectedAppsPage-drZa65kP.js.map +1 -0
- package/dashboard/dist/assets/{CountdownTimer-DxX72PwV.js → CountdownTimer-LG03dVgR.js} +2 -2
- package/dashboard/dist/assets/{CountdownTimer-DxX72PwV.js.map → CountdownTimer-LG03dVgR.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-CObc9Rs5.js → CredentialsPage-CaFQ6vLb.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-CObc9Rs5.js.map → CredentialsPage-CaFQ6vLb.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-Bb8GoNY5.js → CronLabel-Co5j7tzW.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-Bb8GoNY5.js.map → CronLabel-Co5j7tzW.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-CmGhVlYl.js → ElapsedCell-WJyE9G0T.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-CmGhVlYl.js.map → ElapsedCell-WJyE9G0T.js.map} +1 -1
- package/dashboard/dist/assets/{EntityTimelinePanel-B4Jwy1w3.js → EntityTimelinePanel-CDFFfX9d.js} +2 -2
- package/dashboard/dist/assets/{EntityTimelinePanel-B4Jwy1w3.js.map → EntityTimelinePanel-CDFFfX9d.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-CZZbZ4Aa.js → EscalationListSchemaPage-CMrUlaKI.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-CZZbZ4Aa.js.map → EscalationListSchemaPage-CMrUlaKI.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-D0ko59_S.js → EscalationSchemaPage-Dx2Lyfrz.js} +2 -2
- package/dashboard/dist/assets/{EscalationSchemaPage-D0ko59_S.js.map → EscalationSchemaPage-Dx2Lyfrz.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationTimeline-BcnJEKFD.js → EscalationTimeline-d3nvshOk.js} +2 -2
- package/dashboard/dist/assets/{EscalationTimeline-BcnJEKFD.js.map → EscalationTimeline-d3nvshOk.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationTitleSelect-P0q5sck4.js → EscalationTitleSelect-DWQieOM9.js} +2 -2
- package/dashboard/dist/assets/{EscalationTitleSelect-P0q5sck4.js.map → EscalationTitleSelect-DWQieOM9.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-BLPmh4AF.js → EscalationsOverview-BX8Cpi0X.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-BLPmh4AF.js.map → EscalationsOverview-BX8Cpi0X.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-gBzi5tIS.js → EventTable-D1-ITVXS.js} +2 -2
- package/dashboard/dist/assets/{EventTable-gBzi5tIS.js.map → EventTable-D1-ITVXS.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-BulSsWb2.js → FilterBar-ABC9ctin.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-BulSsWb2.js.map → FilterBar-ABC9ctin.js.map} +1 -1
- package/dashboard/dist/assets/{FormattedValue-BMHRrvrL.js → FormattedValue-k27T4bG7.js} +2 -2
- package/dashboard/dist/assets/{FormattedValue-BMHRrvrL.js.map → FormattedValue-k27T4bG7.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage--997yNRr.js → GraphInvokePage-DKUErxWc.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage--997yNRr.js.map → GraphInvokePage-DKUErxWc.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-CwXFz--v.js → HomePage-C6u9dIpR.js} +2 -2
- package/dashboard/dist/assets/{HomePage-CwXFz--v.js.map → HomePage-C6u9dIpR.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-Df4qZryJ.js → ListToolbar-gA5rFzkz.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-Df4qZryJ.js.map → ListToolbar-gA5rFzkz.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-DrogIAKJ.js → McpOverview-BOPo3J_i.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-DrogIAKJ.js.map → McpOverview-BOPo3J_i.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-CJmvCAE6.js → McpQueryDetailPage-BRVVi0Zh.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-CJmvCAE6.js.map → McpQueryDetailPage-BRVVi0Zh.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-lygo4Yq0.js → McpQueryPage-Dmbb6SAc.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-lygo4Yq0.js.map → McpQueryPage-Dmbb6SAc.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-hvns2sCm.js → McpRunDetailPage-bMXNO-6V.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-hvns2sCm.js.map → McpRunDetailPage-bMXNO-6V.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-C2_7spTX.js → McpRunsPage-Bi9AMWja.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-C2_7spTX.js.map → McpRunsPage-Bi9AMWja.js.map} +1 -1
- package/dashboard/dist/assets/{OperationsPage-BlK8WlsY.js → OperationsPage-CvR74ZUJ.js} +3 -3
- package/dashboard/dist/assets/{OperationsPage-BlK8WlsY.js.map → OperationsPage-CvR74ZUJ.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-BeWBiMGX.js → OperatorDashboard-DctmZw10.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-BeWBiMGX.js.map → OperatorDashboard-DctmZw10.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-CNHpsX_i.js → PersonaDetailPage-Ubqm2rQH.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-CNHpsX_i.js.map → PersonaDetailPage-Ubqm2rQH.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-ChASEZRg.js → PersonasPage-BpFL2rpo.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-ChASEZRg.js.map → PersonasPage-BpFL2rpo.js.map} +1 -1
- package/dashboard/dist/assets/{PortalPage-D5Lk-PKF.js → PortalPage-Dfc_Q02R.js} +2 -2
- package/dashboard/dist/assets/{PortalPage-D5Lk-PKF.js.map → PortalPage-Dfc_Q02R.js.map} +1 -1
- package/dashboard/dist/assets/ProcessDetailPage-liJspvQh.js +2 -0
- package/dashboard/dist/assets/{ProcessDetailPage-DNgCIwRl.js.map → ProcessDetailPage-liJspvQh.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-pRjWuWlH.js → ProcessesListPage-C3OM5ZUy.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-pRjWuWlH.js.map → ProcessesListPage-C3OM5ZUy.js.map} +1 -1
- package/dashboard/dist/assets/ResolverForm-B1_x8Blv.js +8 -0
- package/dashboard/dist/assets/ResolverForm-B1_x8Blv.js.map +1 -0
- package/dashboard/dist/assets/{RoleDetailPage-Bh_UcfYY.js → RoleDetailPage-CrlYCh-R.js} +2 -2
- package/dashboard/dist/assets/{RoleDetailPage-Bh_UcfYY.js.map → RoleDetailPage-CrlYCh-R.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-CK17N7zz.js → RolesPage-BaazL_pt.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-CK17N7zz.js.map → RolesPage-BaazL_pt.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-BEKUP0p2.js → RunAsSelector-DxuV0fa1.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-BEKUP0p2.js.map → RunAsSelector-DxuV0fa1.js.map} +1 -1
- package/dashboard/dist/assets/{ScanCodesPage-Bd0Pflqx.js → ScanCodesPage-C0mvmYTq.js} +2 -2
- package/dashboard/dist/assets/{ScanCodesPage-Bd0Pflqx.js.map → ScanCodesPage-C0mvmYTq.js.map} +1 -1
- package/dashboard/dist/assets/{ScanSchemeDetailPage-CnuhozmJ.js → ScanSchemeDetailPage-CiJgt5dZ.js} +2 -2
- package/dashboard/dist/assets/{ScanSchemeDetailPage-CnuhozmJ.js.map → ScanSchemeDetailPage-CiJgt5dZ.js.map} +1 -1
- package/dashboard/dist/assets/{ScanStationPage-CoLc-q3h.js → ScanStationPage-DzGaXc40.js} +2 -2
- package/dashboard/dist/assets/{ScanStationPage-CoLc-q3h.js.map → ScanStationPage-DzGaXc40.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-COrfvkBi.js → StickyPagination-CqbjVY6T.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-COrfvkBi.js.map → StickyPagination-CqbjVY6T.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-Cif2egLy.js → StreamMessageDetail-wX3i0aqs.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-Cif2egLy.js.map → StreamMessageDetail-wX3i0aqs.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-BnZYTrAh.js → SwimlaneTimeline-C50PsFoV.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-BnZYTrAh.js.map → SwimlaneTimeline-C50PsFoV.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-DEz_dqyR.js → TaskDetailPage-bbNSv4Ae.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-DEz_dqyR.js.map → TaskDetailPage-bbNSv4Ae.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-oEfEGj0_.js → TasksListPage-CDWnm_d9.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-oEfEGj0_.js.map → TasksListPage-CDWnm_d9.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-Dz5TgZZZ.js → TimeAgo-BLjqlfoX.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-Dz5TgZZZ.js.map → TimeAgo-BLjqlfoX.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BUTgE244.js → TimestampCell-CnW0ENb5.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BUTgE244.js.map → TimestampCell-CnW0ENb5.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-BS4g6vt-.js → ToolTestPanel-DkMgCB-k.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-BS4g6vt-.js.map → ToolTestPanel-DkMgCB-k.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-C_I6JIVD.js → TopicDetailPage-g3pljKKX.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-C_I6JIVD.js.map → TopicDetailPage-g3pljKKX.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-Cr6-wfhJ.js → TopicsPage-CVcCYdy-.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-Cr6-wfhJ.js.map → TopicsPage-CVcCYdy-.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-ZFpWMaFF.js → UserName-D6zGIK2i.js} +2 -2
- package/dashboard/dist/assets/{UserName-ZFpWMaFF.js.map → UserName-D6zGIK2i.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-ByPixDZW.js → WorkflowExecutionPage-B8g81FCJ.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-ByPixDZW.js.map → WorkflowExecutionPage-B8g81FCJ.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-CWsJdMdR.js → WorkflowsDashboard-nxT3bv6W.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-CWsJdMdR.js.map → WorkflowsDashboard-nxT3bv6W.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-Dk9gyqZN.js → WorkflowsOverview-grI-KAI2.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-Dk9gyqZN.js.map → WorkflowsOverview-grI-KAI2.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CHwcrsaT.js → YamlWorkflowDetailPage-BoZ-hfBE.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-CHwcrsaT.js.map → YamlWorkflowDetailPage-BoZ-hfBE.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-B5jRX2Ph.js → YamlWorkflowsPage-Bf04rwRv.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-B5jRX2Ph.js.map → YamlWorkflowsPage-Bf04rwRv.js.map} +1 -1
- package/dashboard/dist/assets/{agents-Dd7E-27d.js → agents-Dphpdi8l.js} +2 -2
- package/dashboard/dist/assets/{agents-Dd7E-27d.js.map → agents-Dphpdi8l.js.map} +1 -1
- package/dashboard/dist/assets/{bots-CpaYjZTk.js → bots-DIFE298x.js} +2 -2
- package/dashboard/dist/assets/{bots-CpaYjZTk.js.map → bots-DIFE298x.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-CNjg_qv1.js → capabilities-D7Y7LClY.js} +2 -2
- package/dashboard/dist/assets/{capabilities-CNjg_qv1.js.map → capabilities-D7Y7LClY.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-DgmvnAtU.js → controlplane-D1TGcYsS.js} +2 -2
- package/dashboard/dist/assets/{controlplane-DgmvnAtU.js.map → controlplane-D1TGcYsS.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-Uj4U9g5H.js → escalation-columns-cwZE6xyo.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-Uj4U9g5H.js.map → escalation-columns-cwZE6xyo.js.map} +1 -1
- package/dashboard/dist/assets/{index-x5z73M9N.js → index-BzYcUPdD.js} +2 -2
- package/dashboard/dist/assets/{index-x5z73M9N.js.map → index-BzYcUPdD.js.map} +1 -1
- package/dashboard/dist/assets/index-CeCtqujG.js +67 -0
- package/dashboard/dist/assets/index-CeCtqujG.js.map +1 -0
- package/dashboard/dist/assets/{index-RIFT3RlO.js → index-ChV7pBjM.js} +2 -2
- package/dashboard/dist/assets/{index-RIFT3RlO.js.map → index-ChV7pBjM.js.map} +1 -1
- package/dashboard/dist/assets/{index-OfO0173w.js → index-CniRa65p.js} +2 -2
- package/dashboard/dist/assets/{index-OfO0173w.js.map → index-CniRa65p.js.map} +1 -1
- package/dashboard/dist/assets/{index-ByBy9M3L.js → index-CxdjT1Yk.js} +2 -2
- package/dashboard/dist/assets/{index-ByBy9M3L.js.map → index-CxdjT1Yk.js.map} +1 -1
- package/dashboard/dist/assets/{index-C_K7OlzT.js → index-DAvi5_2T.js} +2 -2
- package/dashboard/dist/assets/{index-C_K7OlzT.js.map → index-DAvi5_2T.js.map} +1 -1
- package/dashboard/dist/assets/{index-BrwqtXRh.js → index-DN-kX7hL.js} +2 -2
- package/dashboard/dist/assets/{index-BrwqtXRh.js.map → index-DN-kX7hL.js.map} +1 -1
- package/dashboard/dist/assets/index-Dl_8hbYI.js +2 -0
- package/dashboard/dist/assets/index-Dl_8hbYI.js.map +1 -0
- package/dashboard/dist/assets/{index-D4Dlznn9.js → index-DpKOr311.js} +2 -2
- package/dashboard/dist/assets/{index-D4Dlznn9.js.map → index-DpKOr311.js.map} +1 -1
- package/dashboard/dist/assets/{index-CnOvJz6U.js → index-Dy1wWu2e.js} +2 -2
- package/dashboard/dist/assets/{index-CnOvJz6U.js.map → index-Dy1wWu2e.js.map} +1 -1
- package/dashboard/dist/assets/{index-BT1Ms5Q5.js → index-HLu98Sqh.js} +2 -2
- package/dashboard/dist/assets/{index-BT1Ms5Q5.js.map → index-HLu98Sqh.js.map} +1 -1
- package/dashboard/dist/assets/{index-BFASQ7_X.js → index-ag2pCAPu.js} +2 -2
- package/dashboard/dist/assets/{index-BFASQ7_X.js.map → index-ag2pCAPu.js.map} +1 -1
- package/dashboard/dist/assets/{index-BsHVgWH6.js → index-gkxPN7Vx.js} +2 -2
- package/dashboard/dist/assets/{index-BsHVgWH6.js.map → index-gkxPN7Vx.js.map} +1 -1
- package/dashboard/dist/assets/index-m9A3UYst.css +1 -0
- package/dashboard/dist/assets/{knowledge-Cci_r6Kl.js → knowledge-DnMs-SOJ.js} +2 -2
- package/dashboard/dist/assets/{knowledge-Cci_r6Kl.js.map → knowledge-DnMs-SOJ.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-NY4iL0L-.js → mcp-CwW-K3r4.js} +2 -2
- package/dashboard/dist/assets/{mcp-NY4iL0L-.js.map → mcp-CwW-K3r4.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-CbvZo_I_.js → mcp-query-BZt5e8_Q.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-CbvZo_I_.js.map → mcp-query-BZt5e8_Q.js.map} +1 -1
- package/dashboard/dist/assets/{personas-Fy-f7QQd.js → personas-UA-Xn60f.js} +2 -2
- package/dashboard/dist/assets/{personas-Fy-f7QQd.js.map → personas-UA-Xn60f.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-DKiuozxV.js → pipelines-Cu3PARum.js} +2 -2
- package/dashboard/dist/assets/{pipelines-DKiuozxV.js.map → pipelines-Cu3PARum.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-CdM1Rkk9.js → tasks-BO6h8GJE.js} +2 -2
- package/dashboard/dist/assets/{tasks-CdM1Rkk9.js.map → tasks-BO6h8GJE.js.map} +1 -1
- package/dashboard/dist/assets/{topics-XNy2mf3n.js → topics-CWjCR-17.js} +2 -2
- package/dashboard/dist/assets/{topics-XNy2mf3n.js.map → topics-CWjCR-17.js.map} +1 -1
- package/dashboard/dist/assets/{useDebouncedValue-CyGcU3_S.js → useDebouncedValue-6t0jx1RB.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-CyGcU3_S.js.map → useDebouncedValue-6t0jx1RB.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-C2RIh_IN.js → useNamespace-CqpoQx6D.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-C2RIh_IN.js.map → useNamespace-CqpoQx6D.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-CDiV5fjf.js → useYamlActivityEvents-hmCQQwzB.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-CDiV5fjf.js.map → useYamlActivityEvents-hmCQQwzB.js.map} +1 -1
- package/dashboard/dist/assets/{validate-DcGWN82Y.js → validate-BIRn4a6d.js} +2 -2
- package/dashboard/dist/assets/{validate-DcGWN82Y.js.map → validate-BIRn4a6d.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-CH8UrouH.js → yaml-workflows-ziUdZhKY.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-CH8UrouH.js.map → yaml-workflows-ziUdZhKY.js.map} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/docs/agents.md +3 -1
- package/docs/api/http/agents.md +15 -1
- package/docs/api/http/escalations.md +3 -3
- package/docs/api/http/exports.md +3 -1
- package/docs/api/http/file-browser.md +3 -1
- package/docs/api/http/mcp-endpoint.md +5 -2
- package/docs/api/http/mcp-servers.md +34 -4
- package/docs/api/http/namespaces.md +2 -0
- package/docs/api/http/pipelines.md +2 -0
- package/docs/api/http/roles.md +11 -8
- package/docs/api/http/service-accounts.md +8 -2
- package/docs/api/http/settings.md +29 -2
- package/docs/api/http/tasks.md +3 -1
- package/docs/api/http/topics.md +7 -1
- package/docs/api/http/users.md +8 -2
- package/docs/api/http/workflows.md +25 -10
- package/docs/api/http/yaml-workflows.md +21 -0
- package/docs/api/mcp/admin.md +409 -49
- package/docs/api/mcp/file-storage.md +4 -0
- package/docs/api/mcp/http-fetch.md +6 -2
- package/docs/api/mcp/human-queue.md +53 -0
- package/docs/api/mcp/index.md +13 -10
- package/docs/api/mcp/knowledge.md +34 -0
- package/docs/api/mcp/oauth.md +1 -1
- package/docs/api/mcp/ortho.md +113 -0
- package/docs/api/mcp/vision.md +1 -1
- package/docs/api/sdk/bot-accounts.md +1 -0
- package/docs/api/sdk/escalations.md +2 -2
- package/docs/api/sdk/mcp.md +2 -2
- package/docs/api/sdk/settings.md +1 -1
- package/docs/api/sdk/tasks.md +2 -2
- package/docs/api/sdk/workflows.md +2 -2
- package/docs/api/sdk/yaml-workflows.md +1 -1
- package/docs/architecture.md +3 -1
- package/docs/auth.md +3 -2
- package/docs/cloud.md +7 -2
- package/docs/dashboard.md +16 -7
- package/docs/data.md +1 -1
- package/docs/escalation-strategies.md +9 -20
- package/docs/events.md +6 -0
- package/docs/iam.md +7 -5
- package/docs/mcp.md +159 -210
- package/docs/oauth-and-delegation.md +32 -21
- package/docs/topics.md +2 -0
- package/docs/workflows.md +14 -112
- package/package.json +5 -3
- package/dashboard/dist/assets/ConfirmDeleteModal-DW4DrPur.js +0 -2
- package/dashboard/dist/assets/ConfirmDeleteModal-DW4DrPur.js.map +0 -1
- package/dashboard/dist/assets/ProcessDetailPage-DNgCIwRl.js +0 -2
- package/dashboard/dist/assets/ResolverForm-CKIOAGtY.js +0 -8
- package/dashboard/dist/assets/ResolverForm-CKIOAGtY.js.map +0 -1
- package/dashboard/dist/assets/index-CtlBjl8o.js +0 -2
- package/dashboard/dist/assets/index-CtlBjl8o.js.map +0 -1
- package/dashboard/dist/assets/index-LRYC__mE.js +0 -67
- package/dashboard/dist/assets/index-LRYC__mE.js.map +0 -1
- package/dashboard/dist/assets/index-MYI2_Xb3.css +0 -1
package/build/routes/mcp.js
CHANGED
|
@@ -33,9 +33,28 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const
|
|
36
|
+
const http_1 = require("../lib/http");
|
|
37
37
|
const api = __importStar(require("../api/mcp"));
|
|
38
|
-
const
|
|
38
|
+
const capabilities_1 = require("../modules/capabilities");
|
|
39
|
+
const auth_1 = require("../modules/auth");
|
|
40
|
+
const router = (0, http_1.Router)();
|
|
41
|
+
/**
|
|
42
|
+
* A server's transport_config carries connection secrets (headers, env,
|
|
43
|
+
* commands). Only a builder, who may edit the server, reads it back.
|
|
44
|
+
*/
|
|
45
|
+
async function redactTransport(result, auth) {
|
|
46
|
+
if (!result.data || (await (0, capabilities_1.mayBuild)(auth ? { userId: auth.userId } : undefined)))
|
|
47
|
+
return result;
|
|
48
|
+
const strip = (server) => {
|
|
49
|
+
const { transport_config: _secret, ...rest } = server;
|
|
50
|
+
return rest;
|
|
51
|
+
};
|
|
52
|
+
const data = result.data;
|
|
53
|
+
return {
|
|
54
|
+
...result,
|
|
55
|
+
data: Array.isArray(data.servers) ? { ...data, servers: data.servers.map(strip) } : strip(data),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
39
58
|
// ── Server registration CRUD ──────────────────────────────────────────
|
|
40
59
|
/**
|
|
41
60
|
* GET /api/mcp/servers
|
|
@@ -52,13 +71,14 @@ router.get('/servers', async (req, res) => {
|
|
|
52
71
|
limit: req.query.limit ? parseInt(req.query.limit, 10) : undefined,
|
|
53
72
|
offset: req.query.offset ? parseInt(req.query.offset, 10) : undefined,
|
|
54
73
|
});
|
|
55
|
-
|
|
74
|
+
const shown = await redactTransport(result, req.auth);
|
|
75
|
+
res.status(shown.status).json(shown.data ?? { error: shown.error });
|
|
56
76
|
});
|
|
57
77
|
/**
|
|
58
78
|
* POST /api/mcp/servers
|
|
59
79
|
* Register a new MCP server.
|
|
60
80
|
*/
|
|
61
|
-
router.post('/servers', async (req, res) => {
|
|
81
|
+
router.post('/servers', auth_1.requireBuilder, async (req, res) => {
|
|
62
82
|
const { name, description, transport_type, transport_config, auto_connect, metadata, tags, compile_hints, credential_providers } = req.body;
|
|
63
83
|
const result = await api.createMcpServer({
|
|
64
84
|
name,
|
|
@@ -77,7 +97,7 @@ router.post('/servers', async (req, res) => {
|
|
|
77
97
|
* POST /api/mcp/servers/test-connection
|
|
78
98
|
* Test connectivity to an MCP server without persisting it.
|
|
79
99
|
*/
|
|
80
|
-
router.post('/servers/test-connection', async (req, res) => {
|
|
100
|
+
router.post('/servers/test-connection', auth_1.requireBuilder, async (req, res) => {
|
|
81
101
|
const { transport_type, transport_config } = req.body;
|
|
82
102
|
const result = await api.testConnection({ transport_type, transport_config });
|
|
83
103
|
res.status(result.status).json(result.data ?? { error: result.error });
|
|
@@ -88,23 +108,23 @@ router.post('/servers/test-connection', async (req, res) => {
|
|
|
88
108
|
* Get a specific MCP server.
|
|
89
109
|
*/
|
|
90
110
|
router.get('/servers/:id', async (req, res) => {
|
|
91
|
-
const result = await api.getMcpServer({ id: req.params.id });
|
|
111
|
+
const result = await redactTransport(await api.getMcpServer({ id: req.params.id }), req.auth);
|
|
92
112
|
res.status(result.status).json(result.data ?? { error: result.error });
|
|
93
113
|
});
|
|
94
114
|
/**
|
|
95
115
|
* PUT /api/mcp/servers/:id
|
|
96
116
|
* Update an MCP server registration.
|
|
97
117
|
*/
|
|
98
|
-
router.put('/servers/:id', async (req, res) => {
|
|
99
|
-
const result = await api.updateMcpServer({ id: req.params.id
|
|
118
|
+
router.put('/servers/:id', auth_1.requireBuilder, async (req, res) => {
|
|
119
|
+
const result = await api.updateMcpServer({ ...req.body, id: String(req.params.id) });
|
|
100
120
|
res.status(result.status).json(result.data ?? { error: result.error });
|
|
101
121
|
});
|
|
102
122
|
/**
|
|
103
123
|
* DELETE /api/mcp/servers/:id
|
|
104
124
|
* Delete an MCP server registration.
|
|
105
125
|
*/
|
|
106
|
-
router.delete('/servers/:id', async (req, res) => {
|
|
107
|
-
const result = await api.deleteMcpServer({ id: req.params.id });
|
|
126
|
+
router.delete('/servers/:id', auth_1.requireBuilder, async (req, res) => {
|
|
127
|
+
const result = await api.deleteMcpServer({ id: String(req.params.id) });
|
|
108
128
|
res.status(result.status).json(result.data ?? { error: result.error });
|
|
109
129
|
});
|
|
110
130
|
// ── Connection management ─────────────────────────────────────────────
|
|
@@ -112,16 +132,16 @@ router.delete('/servers/:id', async (req, res) => {
|
|
|
112
132
|
* POST /api/mcp/servers/:id/connect
|
|
113
133
|
* Connect to a registered MCP server.
|
|
114
134
|
*/
|
|
115
|
-
router.post('/servers/:id/connect', async (req, res) => {
|
|
116
|
-
const result = await api.connectMcpServer({ id: req.params.id });
|
|
135
|
+
router.post('/servers/:id/connect', auth_1.requireBuilder, async (req, res) => {
|
|
136
|
+
const result = await api.connectMcpServer({ id: String(req.params.id) });
|
|
117
137
|
res.status(result.status).json(result.data ?? { error: result.error });
|
|
118
138
|
});
|
|
119
139
|
/**
|
|
120
140
|
* POST /api/mcp/servers/:id/disconnect
|
|
121
141
|
* Disconnect from a specific MCP server.
|
|
122
142
|
*/
|
|
123
|
-
router.post('/servers/:id/disconnect', async (req, res) => {
|
|
124
|
-
const result = await api.disconnectMcpServer({ id: req.params.id });
|
|
143
|
+
router.post('/servers/:id/disconnect', auth_1.requireBuilder, async (req, res) => {
|
|
144
|
+
const result = await api.disconnectMcpServer({ id: String(req.params.id) });
|
|
125
145
|
res.status(result.status).json(result.data ?? { error: result.error });
|
|
126
146
|
});
|
|
127
147
|
// ── Credential status ────────────────────────────────────────────────
|
|
@@ -153,7 +173,7 @@ router.post('/servers/:id/tools/:toolName/call', async (req, res) => {
|
|
|
153
173
|
toolName: req.params.toolName,
|
|
154
174
|
arguments: req.body.arguments,
|
|
155
175
|
execute_as: req.body.execute_as,
|
|
156
|
-
}, req.auth ? { userId: req.auth.userId } : undefined);
|
|
176
|
+
}, req.auth ? { userId: req.auth.userId, role: req.auth.role } : undefined);
|
|
157
177
|
res.status(result.status).json(result.data ?? { error: result.error });
|
|
158
178
|
});
|
|
159
179
|
exports.default = router;
|
package/build/routes/me.js
CHANGED
|
@@ -33,9 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const
|
|
36
|
+
const http_1 = require("../lib/http");
|
|
37
37
|
const api = __importStar(require("../api/me"));
|
|
38
|
-
const router = (0,
|
|
38
|
+
const router = (0, http_1.Router)();
|
|
39
39
|
// ── Self-service (/api/me) — the authenticated user, no admin gates ─────────
|
|
40
40
|
/**
|
|
41
41
|
* GET /api/me/preferences
|
|
@@ -33,9 +33,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const
|
|
36
|
+
const http_1 = require("../lib/http");
|
|
37
|
+
const auth_1 = require("../modules/auth");
|
|
37
38
|
const api = __importStar(require("../api/namespaces"));
|
|
38
|
-
const router = (0,
|
|
39
|
+
const router = (0, http_1.Router)();
|
|
39
40
|
/**
|
|
40
41
|
* GET /api/namespaces
|
|
41
42
|
* List all registered MCP YAML namespaces.
|
|
@@ -49,7 +50,7 @@ router.get('/', async (_req, res) => {
|
|
|
49
50
|
* Register a new namespace.
|
|
50
51
|
* Body: { name: string, description?: string, metadata?: object }
|
|
51
52
|
*/
|
|
52
|
-
router.post('/', async (req, res) => {
|
|
53
|
+
router.post('/', auth_1.requireBuilder, async (req, res) => {
|
|
53
54
|
const result = await api.registerNamespace({
|
|
54
55
|
name: req.body?.name,
|
|
55
56
|
description: req.body?.description,
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const http_1 = require("../lib/http");
|
|
4
4
|
const events_1 = require("../lib/events");
|
|
5
5
|
const nats_1 = require("../lib/events/nats");
|
|
6
6
|
const nats_ws_proxy_1 = require("../lib/events/nats-ws-proxy");
|
|
7
|
-
const
|
|
7
|
+
const nats_ws_ticket_1 = require("../lib/events/nats-ws-ticket");
|
|
8
|
+
const logger_1 = require("../lib/logger");
|
|
9
|
+
const config_1 = require("../modules/config");
|
|
10
|
+
let warnedServerToken = false;
|
|
11
|
+
/** The WebSocket URL with a ticket for this person; the proxy holds the NATS credential. */
|
|
12
|
+
function withTicket(wsUrl, userId) {
|
|
13
|
+
const ticket = (0, nats_ws_ticket_1.signNatsWsTicket)(userId);
|
|
14
|
+
if (!ticket)
|
|
15
|
+
return null;
|
|
16
|
+
const url = new URL(wsUrl);
|
|
17
|
+
url.searchParams.set(nats_ws_ticket_1.NATS_WS_TICKET_PARAM, ticket);
|
|
18
|
+
return url.toString();
|
|
19
|
+
}
|
|
20
|
+
const router = (0, http_1.Router)();
|
|
8
21
|
/**
|
|
9
22
|
* GET /api/nats-credentials
|
|
10
23
|
* Returns NATS WebSocket URL and auth token.
|
|
@@ -21,9 +34,20 @@ router.get('/', async (req, res) => {
|
|
|
21
34
|
wsUrl = (0, nats_ws_proxy_1.deriveWsUrlFromRequest)(req, natsAdapter.wsProxyBasePath);
|
|
22
35
|
natsAdapter.setWsUrl(wsUrl);
|
|
23
36
|
}
|
|
37
|
+
// Behind the proxy the browser gets a ticket, never the NATS credential, and
|
|
38
|
+
// the proxy lets it subscribe only.
|
|
39
|
+
if (natsAdapter.wsProxyTarget && wsUrl) {
|
|
40
|
+
return res.json({ natsWsUrl: withTicket(wsUrl, req.auth.userId), natsToken: null });
|
|
41
|
+
}
|
|
42
|
+
// A direct connection needs a credential: a subscribe-only one when the
|
|
43
|
+
// deployment provides it.
|
|
44
|
+
if (!config_1.config.NATS_DASHBOARD_TOKEN && natsAdapter.authToken && !warnedServerToken) {
|
|
45
|
+
warnedServerToken = true;
|
|
46
|
+
logger_1.loggerRegistry.warn('[lt-nats] browsers receive the NATS server token; set NATS_DASHBOARD_TOKEN to a subscribe-only credential, or use the WebSocket proxy');
|
|
47
|
+
}
|
|
24
48
|
res.json({
|
|
25
49
|
natsWsUrl: wsUrl,
|
|
26
|
-
natsToken: natsAdapter.authToken,
|
|
50
|
+
natsToken: config_1.config.NATS_DASHBOARD_TOKEN || natsAdapter.authToken,
|
|
27
51
|
});
|
|
28
52
|
});
|
|
29
53
|
exports.default = router;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const http_1 = require("../../lib/http");
|
|
4
|
+
const auth_1 = require("../../modules/auth");
|
|
5
|
+
const oauth_server_1 = require("../../modules/oauth-server");
|
|
6
|
+
const defaults_1 = require("../../modules/defaults");
|
|
7
|
+
const oauth_server_2 = require("../../services/auth/oauth-server");
|
|
8
|
+
const authorization_1 = require("../../services/auth/oauth-server/authorization");
|
|
9
|
+
const user_1 = require("../../services/user");
|
|
10
|
+
const router = (0, http_1.Router)();
|
|
11
|
+
const CONSENT_PAGE_PATH = '/oauth/consent';
|
|
12
|
+
const BOT_PRINCIPAL_TYPE = 'bot';
|
|
13
|
+
/** Send a failed authorization check: here when the client is untrusted, else back to the client. */
|
|
14
|
+
function sendAuthorizationError(res, check, issuer, asJson) {
|
|
15
|
+
if (!check.redirect) {
|
|
16
|
+
res.status(400).json({ error: check.error, error_description: check.description });
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const redirect = (0, authorization_1.withQuery)(check.redirectUri, {
|
|
20
|
+
error: check.error, error_description: check.description, state: check.state, iss: issuer,
|
|
21
|
+
});
|
|
22
|
+
if (asJson)
|
|
23
|
+
res.json({ redirect });
|
|
24
|
+
else
|
|
25
|
+
res.redirect(302, redirect);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* GET /api/oauth/authorize
|
|
29
|
+
* The authorization request (RFC 6749 §4.1.1, PKCE S256 required). Redirects
|
|
30
|
+
* to the dashboard consent page with the validated request.
|
|
31
|
+
*/
|
|
32
|
+
router.get('/authorize', async (req, res) => {
|
|
33
|
+
const settings = (0, oauth_server_1.getOAuthServerSettings)();
|
|
34
|
+
const check = await (0, authorization_1.checkAuthorizationRequest)(req.query, settings);
|
|
35
|
+
if (!check.ok)
|
|
36
|
+
return sendAuthorizationError(res, check, settings.issuer, false);
|
|
37
|
+
const { client, redirectUri, codeChallenge, state, scope, resource } = check.request;
|
|
38
|
+
res.redirect(302, (0, authorization_1.withQuery)(`${settings.issuer}${CONSENT_PAGE_PATH}`, {
|
|
39
|
+
client_id: client.client_id, redirect_uri: redirectUri, code_challenge: codeChallenge,
|
|
40
|
+
code_challenge_method: 'S256', response_type: 'code', state, scope, resource,
|
|
41
|
+
}));
|
|
42
|
+
});
|
|
43
|
+
/** Consent is a person's decision: a bot key may not grant access. */
|
|
44
|
+
function refuseBots(req, res) {
|
|
45
|
+
if (req.auth?.principalType !== BOT_PRINCIPAL_TYPE)
|
|
46
|
+
return false;
|
|
47
|
+
res.status(403).json({ error: 'access_denied', error_description: 'a service account cannot grant access' });
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* POST /api/oauth/authorize
|
|
52
|
+
* The person approves. Body: the authorization request plus
|
|
53
|
+
* { preset: 'read_only' | 'just_me' }. Returns { redirect } for the consent
|
|
54
|
+
* page to navigate to, carrying the code.
|
|
55
|
+
*/
|
|
56
|
+
router.post('/authorize', auth_1.requireAuth, async (req, res) => {
|
|
57
|
+
if (refuseBots(req, res))
|
|
58
|
+
return;
|
|
59
|
+
const settings = (0, oauth_server_1.getOAuthServerSettings)();
|
|
60
|
+
const check = await (0, authorization_1.checkAuthorizationRequest)(req.body ?? {}, settings);
|
|
61
|
+
if (!check.ok)
|
|
62
|
+
return sendAuthorizationError(res, check, settings.issuer, true);
|
|
63
|
+
const preset = req.body?.preset;
|
|
64
|
+
if (!(0, authorization_1.isGrantPreset)(preset)) {
|
|
65
|
+
res.status(400).json({ error: 'invalid_request', error_description: 'preset must be read_only or just_me' });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!(0, authorization_1.grantablePresets)(await (0, user_1.getUserRoles)(req.auth.userId)).includes(preset)) {
|
|
69
|
+
res.status(403).json({ error: 'access_denied', error_description: `you may not grant ${preset}` });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const { client, redirectUri, codeChallenge, state, resource } = check.request;
|
|
73
|
+
const { code } = await (0, oauth_server_2.issueAuthorizationCode)({
|
|
74
|
+
userId: req.auth.userId, clientId: client.client_id, policy: { preset }, scope: oauth_server_2.PRESET_SCOPE[preset],
|
|
75
|
+
redirectUri, codeChallenge, resource, ttlSeconds: defaults_1.OAUTH_CODE_TTL_SECONDS,
|
|
76
|
+
});
|
|
77
|
+
res.json({ redirect: (0, authorization_1.withQuery)(redirectUri, { code, state, iss: settings.issuer }) });
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* POST /api/oauth/deny
|
|
81
|
+
* The person declines. Body: { client_id, redirect_uri, state? }. Returns
|
|
82
|
+
* { redirect } carrying error=access_denied.
|
|
83
|
+
*/
|
|
84
|
+
router.post('/deny', auth_1.requireAuth, async (req, res) => {
|
|
85
|
+
const settings = (0, oauth_server_1.getOAuthServerSettings)();
|
|
86
|
+
const clientId = typeof req.body?.client_id === 'string' ? req.body.client_id : '';
|
|
87
|
+
const client = clientId ? await (0, oauth_server_2.getClient)(clientId) : null;
|
|
88
|
+
const redirectUri = req.body?.redirect_uri;
|
|
89
|
+
if (!client || typeof redirectUri !== 'string' || !client.redirect_uris.includes(redirectUri)) {
|
|
90
|
+
res.status(400).json({ error: 'invalid_request', error_description: 'unknown client or redirect_uri' });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const state = typeof req.body?.state === 'string' ? req.body.state : undefined;
|
|
94
|
+
res.json({ redirect: (0, authorization_1.withQuery)(redirectUri, { error: 'access_denied', state, iss: settings.issuer }) });
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* GET /api/oauth/clients/:id
|
|
98
|
+
* The client the consent page is asking about.
|
|
99
|
+
*/
|
|
100
|
+
router.get('/clients/:id', auth_1.requireAuth, async (req, res) => {
|
|
101
|
+
const client = await (0, oauth_server_2.getClient)(String(req.params.id));
|
|
102
|
+
if (!client) {
|
|
103
|
+
res.status(404).json({ error: 'not_found' });
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
res.json({ client_id: client.client_id, client_name: client.client_name, redirect_uris: client.redirect_uris });
|
|
107
|
+
});
|
|
108
|
+
exports.default = router;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const http_1 = require("../../lib/http");
|
|
4
|
+
const auth_1 = require("../../modules/auth");
|
|
5
|
+
const roles_1 = require("../../services/user/roles");
|
|
6
|
+
const oauth_server_1 = require("../../services/auth/oauth-server");
|
|
7
|
+
const authorization_1 = require("../../services/auth/oauth-server/authorization");
|
|
8
|
+
const router = (0, http_1.Router)();
|
|
9
|
+
/**
|
|
10
|
+
* GET /api/oauth/presets
|
|
11
|
+
* The presets the signed-in person may grant at consent.
|
|
12
|
+
*/
|
|
13
|
+
router.get('/presets', auth_1.requireAuth, async (req, res) => {
|
|
14
|
+
res.json({ presets: (0, authorization_1.grantablePresets)(await (0, roles_1.getUserRoles)(req.auth.userId)) });
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* GET /api/oauth/grants
|
|
18
|
+
* The signed-in person's connected apps.
|
|
19
|
+
*/
|
|
20
|
+
router.get('/grants', auth_1.requireAuth, async (req, res) => {
|
|
21
|
+
res.json({ grants: await (0, oauth_server_1.listGrants)(req.auth.userId) });
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* DELETE /api/oauth/grants/:id
|
|
25
|
+
* Disconnect one of the signed-in person's apps. Its tokens stop working at once.
|
|
26
|
+
*/
|
|
27
|
+
router.delete('/grants/:id', auth_1.requireAuth, async (req, res) => {
|
|
28
|
+
const revoked = await (0, oauth_server_1.revokeGrant)(String(req.params.id), req.auth.userId);
|
|
29
|
+
if (!revoked) {
|
|
30
|
+
res.status(404).json({ error: 'not_found' });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
res.json({ disconnected: true });
|
|
34
|
+
});
|
|
35
|
+
exports.default = router;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth authorization server endpoints under /api/oauth. The public ones
|
|
3
|
+
* (metadata, register, token, revoke) take no Long Tail session and allow
|
|
4
|
+
* any origin. The consent endpoints take the person's dashboard session.
|
|
5
|
+
* Every endpoint answers 404 until the server is configured.
|
|
6
|
+
*/
|
|
7
|
+
declare const router: import("express-serve-static-core").Router;
|
|
8
|
+
export default router;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const http_1 = require("../../lib/http");
|
|
7
|
+
const oauth_server_1 = require("../../modules/oauth-server");
|
|
8
|
+
const metadata_1 = require("../../services/auth/oauth-server/metadata");
|
|
9
|
+
const registration_1 = __importDefault(require("./registration"));
|
|
10
|
+
const authorize_1 = __importDefault(require("./authorize"));
|
|
11
|
+
const token_1 = __importDefault(require("./token"));
|
|
12
|
+
const grants_1 = __importDefault(require("./grants"));
|
|
13
|
+
/**
|
|
14
|
+
* OAuth authorization server endpoints under /api/oauth. The public ones
|
|
15
|
+
* (metadata, register, token, revoke) take no Long Tail session and allow
|
|
16
|
+
* any origin. The consent endpoints take the person's dashboard session.
|
|
17
|
+
* Every endpoint answers 404 until the server is configured.
|
|
18
|
+
*/
|
|
19
|
+
const router = (0, http_1.Router)();
|
|
20
|
+
router.use((_req, res, next) => {
|
|
21
|
+
if (!(0, oauth_server_1.getOAuthServerSettings)()) {
|
|
22
|
+
res.status(404).json({ error: 'not_found' });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
next();
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* GET /api/oauth/metadata
|
|
29
|
+
* The authorization server metadata, for clients that do not use the
|
|
30
|
+
* well-known document.
|
|
31
|
+
*/
|
|
32
|
+
router.get('/metadata', (0, http_1.allowAnyOrigin)(['GET']), (_req, res) => {
|
|
33
|
+
res.json((0, metadata_1.authorizationServerMetadata)((0, oauth_server_1.getOAuthServerSettings)()));
|
|
34
|
+
});
|
|
35
|
+
router.use(registration_1.default);
|
|
36
|
+
router.use(authorize_1.default);
|
|
37
|
+
router.use(token_1.default);
|
|
38
|
+
router.use(grants_1.default);
|
|
39
|
+
/**
|
|
40
|
+
* Anything an endpoint did not answer itself answers in the RFC 6749 error
|
|
41
|
+
* shape: a body that does not parse is the client's error, anything else the
|
|
42
|
+
* server's. No message or stack reaches the client.
|
|
43
|
+
*/
|
|
44
|
+
router.use((err, _req, res, _next) => {
|
|
45
|
+
if (res.headersSent)
|
|
46
|
+
return;
|
|
47
|
+
const malformed = err?.type === 'entity.parse.failed' || err?.status === 400;
|
|
48
|
+
res.status(malformed ? 400 : 500).json(malformed
|
|
49
|
+
? { error: 'invalid_request', error_description: 'the request body is malformed' }
|
|
50
|
+
: { error: 'server_error', error_description: 'the request could not be completed' });
|
|
51
|
+
});
|
|
52
|
+
exports.default = router;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const http_1 = require("../../lib/http");
|
|
4
|
+
const oauth_server_1 = require("../../modules/oauth-server");
|
|
5
|
+
const defaults_1 = require("../../modules/defaults");
|
|
6
|
+
const oauth_server_2 = require("../../services/auth/oauth-server");
|
|
7
|
+
const registration_1 = require("../../services/auth/oauth-server/registration");
|
|
8
|
+
const router = (0, http_1.Router)();
|
|
9
|
+
const limiter = new registration_1.RegistrationLimiter(defaults_1.OAUTH_REGISTRATIONS_PER_WINDOW, defaults_1.OAUTH_REGISTRATION_WINDOW_SECONDS * 1000);
|
|
10
|
+
/**
|
|
11
|
+
* POST /api/oauth/register
|
|
12
|
+
* Dynamic client registration (RFC 7591) for public clients.
|
|
13
|
+
* Body: { redirect_uris, client_name?, grant_types?, response_types?, token_endpoint_auth_method? }
|
|
14
|
+
*/
|
|
15
|
+
router.options('/register', (0, http_1.allowAnyOrigin)(['POST']));
|
|
16
|
+
router.post('/register', (0, http_1.allowAnyOrigin)(['POST']), async (req, res) => {
|
|
17
|
+
if (!limiter.allow((0, registration_1.registrationAddressKey)(req.ip ?? 'unknown'))) {
|
|
18
|
+
res.status(429).json({ error: 'rate_limited', error_description: 'too many client registrations; try again later' });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const settings = (0, oauth_server_1.getOAuthServerSettings)();
|
|
22
|
+
const checked = (0, registration_1.validateClientMetadata)(req.body, settings.allowedRedirectUris);
|
|
23
|
+
if (!checked.ok) {
|
|
24
|
+
res.status(400).json({ error: checked.error, error_description: checked.description });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const client = await (0, oauth_server_2.registerClient)({ clientName: checked.clientName, redirectUris: checked.redirectUris });
|
|
28
|
+
res.status(201).json({
|
|
29
|
+
client_id: client.client_id,
|
|
30
|
+
client_id_issued_at: Math.floor(new Date(client.created_at).getTime() / 1000),
|
|
31
|
+
client_name: client.client_name ?? undefined,
|
|
32
|
+
redirect_uris: client.redirect_uris,
|
|
33
|
+
grant_types: ['authorization_code', 'refresh_token'],
|
|
34
|
+
response_types: ['code'],
|
|
35
|
+
token_endpoint_auth_method: 'none',
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
exports.default = router;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const http_1 = require("../../lib/http");
|
|
4
|
+
const oauth_server_1 = require("../../modules/oauth-server");
|
|
5
|
+
const defaults_1 = require("../../modules/defaults");
|
|
6
|
+
const oauth_server_2 = require("../../services/auth/oauth-server");
|
|
7
|
+
const registration_1 = require("../../services/auth/oauth-server/registration");
|
|
8
|
+
const router = (0, http_1.Router)();
|
|
9
|
+
/**
|
|
10
|
+
* A form field, taking the first value when the host parsed repeats into an
|
|
11
|
+
* array. A value carrying a control character is treated as absent: no
|
|
12
|
+
* token, id or URI contains one.
|
|
13
|
+
*/
|
|
14
|
+
function field(body, name) {
|
|
15
|
+
const value = body?.[name];
|
|
16
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
17
|
+
return typeof first === 'string' && first !== '' && !(0, registration_1.hasControlCharacters)(first) ? first : undefined;
|
|
18
|
+
}
|
|
19
|
+
/** RFC 7636 §4.1: 43 to 128 unreserved characters. */
|
|
20
|
+
const CODE_VERIFIER = /^[A-Za-z0-9._~-]{43,128}$/;
|
|
21
|
+
function tokenError(res, error, description) {
|
|
22
|
+
res.status(400).json({ error, error_description: description });
|
|
23
|
+
}
|
|
24
|
+
function sendTokens(res, snapshot, refreshToken) {
|
|
25
|
+
const settings = (0, oauth_server_1.getOAuthServerSettings)();
|
|
26
|
+
const { token, expiresIn } = (0, oauth_server_2.signAccessToken)(snapshot, { issuer: settings.issuer, audience: settings.resource });
|
|
27
|
+
res.json({ access_token: token, token_type: 'Bearer', expires_in: expiresIn, refresh_token: refreshToken, scope: snapshot.scope });
|
|
28
|
+
}
|
|
29
|
+
const tokenEndpoint = [(0, http_1.allowAnyOrigin)(['POST']), (0, http_1.formBody)()];
|
|
30
|
+
/**
|
|
31
|
+
* POST /api/oauth/token
|
|
32
|
+
* grant_type=authorization_code: code, redirect_uri, client_id, code_verifier
|
|
33
|
+
* grant_type=refresh_token: refresh_token, client_id
|
|
34
|
+
* Returns { access_token, token_type, expires_in, refresh_token, scope }.
|
|
35
|
+
*/
|
|
36
|
+
router.options('/token', (0, http_1.allowAnyOrigin)(['POST']));
|
|
37
|
+
router.post('/token', ...tokenEndpoint, async (req, res) => {
|
|
38
|
+
res.setHeader('Cache-Control', 'no-store');
|
|
39
|
+
res.setHeader('Pragma', 'no-cache');
|
|
40
|
+
const settings = (0, oauth_server_1.getOAuthServerSettings)();
|
|
41
|
+
const grantType = field(req.body, 'grant_type');
|
|
42
|
+
const clientId = field(req.body, 'client_id');
|
|
43
|
+
if (!clientId)
|
|
44
|
+
return tokenError(res, 'invalid_request', 'client_id is required');
|
|
45
|
+
if (grantType === 'authorization_code') {
|
|
46
|
+
const code = field(req.body, 'code');
|
|
47
|
+
const redirectUri = field(req.body, 'redirect_uri');
|
|
48
|
+
const codeVerifier = field(req.body, 'code_verifier');
|
|
49
|
+
if (!code || !redirectUri || !codeVerifier) {
|
|
50
|
+
return tokenError(res, 'invalid_request', 'code, redirect_uri and code_verifier are required');
|
|
51
|
+
}
|
|
52
|
+
if (!CODE_VERIFIER.test(codeVerifier)) {
|
|
53
|
+
return tokenError(res, 'invalid_request', 'code_verifier must be 43 to 128 unreserved characters');
|
|
54
|
+
}
|
|
55
|
+
const resource = field(req.body, 'resource');
|
|
56
|
+
if (resource !== undefined && resource !== settings.resource) {
|
|
57
|
+
return tokenError(res, 'invalid_target', `resource must be ${settings.resource}`);
|
|
58
|
+
}
|
|
59
|
+
const exchanged = await (0, oauth_server_2.exchangeAuthorizationCode)({
|
|
60
|
+
code, clientId, redirectUri, codeVerifier, refreshTtlSeconds: defaults_1.OAUTH_REFRESH_TOKEN_TTL_SECONDS,
|
|
61
|
+
});
|
|
62
|
+
if (!exchanged)
|
|
63
|
+
return tokenError(res, 'invalid_grant', 'the authorization code is invalid, expired or already used');
|
|
64
|
+
return sendTokens(res, exchanged.snapshot, exchanged.refreshToken);
|
|
65
|
+
}
|
|
66
|
+
if (grantType === 'refresh_token') {
|
|
67
|
+
const refreshToken = field(req.body, 'refresh_token');
|
|
68
|
+
if (!refreshToken)
|
|
69
|
+
return tokenError(res, 'invalid_request', 'refresh_token is required');
|
|
70
|
+
const rotated = await (0, oauth_server_2.rotateRefreshToken)({ refreshToken, clientId, refreshTtlSeconds: defaults_1.OAUTH_REFRESH_TOKEN_TTL_SECONDS });
|
|
71
|
+
if (rotated.snapshot === null) {
|
|
72
|
+
return tokenError(res, 'invalid_grant', 'the refresh token is invalid, expired or revoked');
|
|
73
|
+
}
|
|
74
|
+
return sendTokens(res, rotated.snapshot, rotated.refreshToken);
|
|
75
|
+
}
|
|
76
|
+
return tokenError(res, 'unsupported_grant_type', 'grant_type must be authorization_code or refresh_token');
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* POST /api/oauth/revoke
|
|
80
|
+
* Token revocation (RFC 7009): a refresh token or an access token, with the
|
|
81
|
+
* client_id that holds it. Revokes the whole grant. Always answers 200.
|
|
82
|
+
*/
|
|
83
|
+
router.options('/revoke', (0, http_1.allowAnyOrigin)(['POST']));
|
|
84
|
+
router.post('/revoke', ...tokenEndpoint, async (req, res) => {
|
|
85
|
+
const settings = (0, oauth_server_1.getOAuthServerSettings)();
|
|
86
|
+
const token = field(req.body, 'token');
|
|
87
|
+
const clientId = field(req.body, 'client_id');
|
|
88
|
+
if (token && clientId) {
|
|
89
|
+
const claims = (0, oauth_server_2.verifyAccessToken)(token, { issuer: settings.issuer, audience: settings.resource });
|
|
90
|
+
if (claims) {
|
|
91
|
+
if (claims.client_id === clientId)
|
|
92
|
+
await (0, oauth_server_2.revokeGrant)(claims.gid);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
await (0, oauth_server_2.revokeByRefreshToken)(token, clientId);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
res.status(200).end();
|
|
99
|
+
});
|
|
100
|
+
exports.default = router;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Router } from '../lib/http';
|
|
2
|
+
/**
|
|
3
|
+
* The two OAuth well-known documents, mounted at the host's root. Answers
|
|
4
|
+
* exactly those paths and passes every other request on, so it never shadows
|
|
5
|
+
* the host's routes. Paths are computed per request because the issuer is
|
|
6
|
+
* configured after the router is mounted.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createWellKnownRouter(): Router;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWellKnownRouter = createWellKnownRouter;
|
|
4
|
+
const http_1 = require("../lib/http");
|
|
5
|
+
const oauth_server_1 = require("../modules/oauth-server");
|
|
6
|
+
const metadata_1 = require("../services/auth/oauth-server/metadata");
|
|
7
|
+
/**
|
|
8
|
+
* The two OAuth well-known documents, mounted at the host's root. Answers
|
|
9
|
+
* exactly those paths and passes every other request on, so it never shadows
|
|
10
|
+
* the host's routes. Paths are computed per request because the issuer is
|
|
11
|
+
* configured after the router is mounted.
|
|
12
|
+
*/
|
|
13
|
+
function createWellKnownRouter() {
|
|
14
|
+
const router = (0, http_1.Router)();
|
|
15
|
+
const cors = (0, http_1.allowAnyOrigin)(['GET']);
|
|
16
|
+
router.use((req, res, next) => {
|
|
17
|
+
const settings = (0, oauth_server_1.getOAuthServerSettings)();
|
|
18
|
+
if (!settings || (req.method !== 'GET' && req.method !== 'OPTIONS'))
|
|
19
|
+
return next();
|
|
20
|
+
const paths = (0, metadata_1.wellKnownPaths)(settings);
|
|
21
|
+
const document = req.path === paths.authorizationServer
|
|
22
|
+
? (0, metadata_1.authorizationServerMetadata)(settings)
|
|
23
|
+
: req.path === paths.protectedResource
|
|
24
|
+
? (0, metadata_1.protectedResourceMetadata)(settings)
|
|
25
|
+
: null;
|
|
26
|
+
if (!document)
|
|
27
|
+
return next();
|
|
28
|
+
cors(req, res, () => res.json(document));
|
|
29
|
+
});
|
|
30
|
+
return router;
|
|
31
|
+
}
|
package/build/routes/oauth.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setOAuthConfig = setOAuthConfig;
|
|
4
|
-
const
|
|
4
|
+
const http_1 = require("../lib/http");
|
|
5
5
|
const auth_1 = require("../modules/auth");
|
|
6
6
|
const logger_1 = require("../lib/logger");
|
|
7
7
|
const oauth_1 = require("../services/oauth");
|
|
8
8
|
const user_1 = require("../services/user");
|
|
9
|
-
const router = (0,
|
|
9
|
+
const router = (0, http_1.Router)();
|
|
10
10
|
// ── OAuth startup config (set by initializeOAuth) ────────────────────────────
|
|
11
11
|
let _oauthConfig = {
|
|
12
12
|
autoProvision: true,
|
package/build/routes/overview.js
CHANGED
|
@@ -33,9 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const
|
|
36
|
+
const http_1 = require("../lib/http");
|
|
37
37
|
const api = __importStar(require("../api/overview"));
|
|
38
|
-
const router = (0,
|
|
38
|
+
const router = (0, http_1.Router)();
|
|
39
39
|
/**
|
|
40
40
|
* GET /api/overview?period=24h
|
|
41
41
|
* System overview — triage, throughput, trends, infrastructure, processes.
|
package/build/routes/personas.js
CHANGED
|
@@ -33,10 +33,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const
|
|
36
|
+
const http_1 = require("../lib/http");
|
|
37
37
|
const auth_1 = require("../modules/auth");
|
|
38
38
|
const api = __importStar(require("../api/personas"));
|
|
39
|
-
const router = (0,
|
|
39
|
+
const router = (0, http_1.Router)();
|
|
40
40
|
// Personas are role bundles — a management surface. Reads and writes share the
|
|
41
41
|
// role-management gate (admin type, superadmin, engineer), the same audience
|
|
42
42
|
// that manages roles and users.
|