akanjs 3.0.0-alpha.7 → 3.0.0-alpha.71
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/CHANGELOG.md +103 -0
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/base/baseEnv.ts +7 -4
- package/base/primitiveRegistry.ts +59 -12
- package/base/symbols.ts +4 -0
- package/client/capacitor.ts +34 -0
- package/client/clientRuntime.ts +5 -0
- package/client/csrTypes.ts +4 -3
- package/client/index.ts +1 -0
- package/client/locale.ts +2 -2
- package/client/router.ts +7 -7
- package/client/sharedContext.ts +31 -0
- package/client/translator.ts +2 -2
- package/client/types.ts +3 -3
- package/common/Logger.ts +280 -67
- package/common/clientAddress.ts +40 -0
- package/common/deepObjectify.ts +24 -9
- package/common/index.ts +42 -1
- package/common/logContext.ts +27 -0
- package/common/mcpExposure.ts +114 -0
- package/common/pathGetLoose.ts +31 -0
- package/common/pathSet.ts +17 -5
- package/common/plainFieldsOf.ts +13 -0
- package/common/routeConvention.ts +22 -12
- package/common/websocketBinaryFrame.ts +46 -0
- package/constant/crystalize.ts +94 -28
- package/constant/dateSlot.ts +62 -0
- package/constant/deserialize.ts +3 -2
- package/constant/fieldInfo.ts +43 -3
- package/constant/fieldQueryMeta.ts +35 -0
- package/constant/getDefault.ts +16 -11
- package/constant/hydrationPlan.ts +72 -0
- package/constant/immerify.ts +4 -6
- package/constant/index.ts +5 -0
- package/constant/labelOf.ts +26 -0
- package/constant/mask.ts +67 -0
- package/constant/purify.ts +17 -11
- package/constant/textFieldPaths.ts +13 -7
- package/constant/types.ts +19 -13
- package/constant/via.ts +24 -17
- package/dictionary/DictionaryLookup.ts +30 -0
- package/dictionary/agent.dictionary.ts +31 -0
- package/dictionary/agentTurn.dictionary.ts +29 -0
- package/dictionary/base.dictionary.ts +81 -0
- package/dictionary/dictInfo.ts +11 -2
- package/dictionary/dictionary.ts +9 -3
- package/dictionary/index.ts +1 -0
- package/dictionary/trans.ts +2 -2
- package/document/documentQuery.ts +1 -0
- package/document/filterMeta.ts +77 -12
- package/document/index.ts +1 -0
- package/document/noDocumentError.ts +12 -0
- package/document/types.ts +0 -1
- package/fetch/agentTurn.ts +19 -0
- package/fetch/client/fetchClient.ts +137 -37
- package/fetch/client/httpClient.ts +95 -20
- package/fetch/client/wsClient.ts +27 -12
- package/fetch/fetchType/appliedReturn.type.ts +65 -44
- package/fetch/fetchType/endpointFetch.type.ts +17 -8
- package/fetch/fetchType/sliceFetch.type.ts +27 -50
- package/fetch/index.ts +1 -0
- package/index.ts +80 -6
- package/local/apps/akan/akan-local.db +0 -0
- package/local/apps/akan/akan-local.db-shm +0 -0
- package/local/apps/akan/akan-local.db-wal +0 -0
- package/local/apps/akan/akan-local_solid.db +0 -0
- package/local/apps/akan/akan-local_solid.db-shm +0 -0
- package/local/apps/akan/akan-local_solid.db-wal +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local.db +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local.db-wal +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local_solid.db +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-shm +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-wal +0 -0
- package/package.json +27 -18
- package/server/akanApp.ts +278 -138
- package/server/akanAppHeaders.ts +16 -2
- package/server/akanOption.ts +63 -8
- package/server/akanServer.ts +387 -32
- package/server/animatedImage.ts +83 -0
- package/server/assetEncoding.ts +4 -24
- package/server/binaryPubsub.ts +55 -0
- package/server/console.ts +110 -101
- package/server/consoleEvaluator.ts +51 -0
- package/server/consolePasteFilter.ts +91 -0
- package/server/consoleSession.ts +242 -0
- package/server/contentEncoding.ts +83 -0
- package/server/devtools/signalSerializer.ts +2 -2
- package/server/devtools/types.ts +4 -4
- package/server/di/diLifecycle.ts +123 -13
- package/server/di/predefinedAdaptor.ts +6 -0
- package/server/di/utils.ts +40 -0
- package/server/imageOptimizer.ts +154 -57
- package/server/lifecycle/runtimeDir.ts +14 -0
- package/server/lifecycle/shutdownManager.ts +1 -1
- package/server/logging/childOutputReader.ts +137 -0
- package/server/logging/hubFileSink.ts +39 -0
- package/server/logging/logControlSocket.ts +173 -0
- package/server/logging/logForwarder.ts +131 -0
- package/server/logging/logHub.ts +0 -0
- package/server/logging/logQuery.ts +130 -0
- package/server/logging/logStdoutWriter.ts +39 -0
- package/server/logging/logStreamRoute.ts +87 -0
- package/server/logging/logTailClient.ts +161 -0
- package/server/mcp/McpAuth.ts +177 -0
- package/server/mcp/McpDispatcher.ts +289 -0
- package/server/mcp/McpEventStream.ts +24 -0
- package/server/mcp/McpExecutionContext.ts +105 -0
- package/server/mcp/McpRouter.ts +621 -0
- package/server/mcp/index.ts +5 -0
- package/server/processMetricsCollector.ts +1 -1
- package/server/resolver/database.resolver.ts +5 -4
- package/server/resolver/signal.resolver.ts +208 -86
- package/server/routeTreeBuilder.ts +10 -8
- package/server/routing/apiRouter.ts +44 -14
- package/server/routing/appWsData.ts +24 -2
- package/server/routing/eventStream.ts +93 -0
- package/server/routing/soloAppRoutes.ts +50 -0
- package/server/rscWorker.tsx +36 -22
- package/server/rscWorkerHost.ts +59 -8
- package/server/semaphore.ts +22 -0
- package/server/subRouteIndexDocument.tsx +61 -0
- package/server/systemPageDocument.tsx +3 -3
- package/server/systemPages.tsx +49 -16
- package/server/types.tsx +28 -0
- package/server/vendor/akanjs-fetch.ts +1 -0
- package/server/webRouter.ts +96 -39
- package/service/adapt.ts +4 -4
- package/service/agent.service.ts +81 -0
- package/service/base.service.ts +2 -1
- package/service/index.ts +1 -0
- package/service/injectInfo.ts +8 -3
- package/service/ipcTypes.ts +6 -0
- package/service/predefinedAdaptor/compress.adaptor.ts +5 -1
- package/service/predefinedAdaptor/database.adaptor.ts +68 -37
- package/service/predefinedAdaptor/deepseekLlm.ts +271 -0
- package/service/predefinedAdaptor/index.ts +3 -0
- package/service/predefinedAdaptor/insightQuery.ts +183 -0
- package/service/predefinedAdaptor/llm.adaptor.ts +115 -0
- package/service/predefinedAdaptor/logging.adaptor.ts +1 -1
- package/service/predefinedAdaptor/queue.adaptor.ts +5 -2
- package/service/predefinedAdaptor/role.adaptor.ts +2 -0
- package/service/predefinedAdaptor/schedule.adaptor.ts +12 -5
- package/service/predefinedAdaptor/solidPubsub.adaptor.ts +10 -6
- package/service/predefinedAdaptor/solidQueue.adaptor.ts +6 -2
- package/service/predefinedAdaptor/solidSqlite.ts +11 -9
- package/service/predefinedAdaptor/websocket.adaptor.ts +6 -1
- package/service/serve.ts +16 -9
- package/service/toolNames.ts +119 -0
- package/signal/agent/AgentCatalogue.ts +165 -0
- package/signal/agent/index.ts +1 -0
- package/signal/agent.signal.ts +38 -0
- package/signal/agentTurn.ts +8 -0
- package/signal/agentTurnStream.ts +60 -0
- package/signal/base.signal.ts +2 -1
- package/signal/endpointInfo.ts +38 -2
- package/signal/guard.ts +28 -1
- package/signal/guards.ts +49 -1
- package/signal/index.ts +6 -0
- package/signal/intercept.ts +4 -4
- package/signal/internalArg.ts +21 -4
- package/signal/mcp/McpDocument.ts +326 -0
- package/signal/mcp/McpProgress.ts +106 -0
- package/signal/mcp/McpUriTemplate.ts +80 -0
- package/signal/mcp/Msg.ts +368 -0
- package/signal/mcp/index.ts +5 -0
- package/signal/mcp/mcpProtocol.ts +120 -0
- package/signal/middleware.ts +3 -3
- package/signal/openapi/openapi.ts +36 -173
- package/signal/schema/JsonSchemaBuilder.ts +221 -0
- package/signal/schema/index.ts +1 -0
- package/signal/serializer/fetch.serializer.ts +51 -0
- package/signal/signalContext.ts +324 -76
- package/signal/slice.ts +62 -27
- package/signal/trace.ts +268 -9
- package/signal/types.ts +55 -4
- package/store/action.ts +34 -41
- package/store/actionTag.ts +33 -0
- package/store/agent/AgentBridge.ts +87 -0
- package/store/agent/AgentContext.ts +71 -0
- package/store/agent/AgentPrompts.ts +111 -0
- package/store/agent/ScreenReader.ts +349 -0
- package/store/agent/ScreenSettle.ts +45 -0
- package/store/agent/ScreenTarget.ts +135 -0
- package/store/agent/StoreCatalogue.ts +116 -0
- package/store/agent/StoreSurfaceSource.ts +225 -0
- package/store/agent/index.ts +13 -0
- package/store/agent/storeSurface.ts +28 -0
- package/store/agent/types.ts +16 -0
- package/store/agentic/AgentValue.ts +119 -0
- package/store/agentic/StExposeBuilder.ts +47 -0
- package/store/agentic/StExposeDraft.ts +24 -0
- package/store/agentic/StStateBuilder.ts +85 -0
- package/store/agentic/StStateDraft.ts +23 -0
- package/store/agentic/StToolBuilder.ts +279 -0
- package/store/agentic/StToolDraft.ts +22 -0
- package/store/agentic/attachAgentic.ts +33 -0
- package/store/agentic/formFields.ts +194 -0
- package/store/agentic/index.ts +12 -0
- package/store/agentic/useFieldTool.ts +183 -0
- package/store/agentic/useFormTools.ts +77 -0
- package/store/agentic/useRelationFieldTool.ts +113 -0
- package/store/baseSt.ts +1 -1
- package/store/databaseStateNames.ts +31 -0
- package/store/formSetterNames.ts +35 -0
- package/store/index.ts +8 -0
- package/store/rootStore.ts +3 -1
- package/store/sliceRole.ts +36 -0
- package/store/state.ts +2 -12
- package/store/store.ts +9 -0
- package/store/storeInstance.ts +185 -20
- package/store/storeRegistry.ts +39 -1
- package/store/types.ts +5 -0
- package/store/withSelector.ts +5 -4
- package/test/index.ts +1 -1
- package/test/registerDom.ts +4 -0
- package/test/sampleOf.ts +2 -0
- package/test/signalTestRuntime.ts +5 -5
- package/test/testServer.ts +14 -11
- package/types/base/baseEnv.d.ts +1 -1
- package/types/base/primitiveRegistry.d.ts +20 -8
- package/types/base/symbols.d.ts +4 -0
- package/types/client/capacitor.d.ts +39 -0
- package/types/client/clientRuntime.d.ts +7 -0
- package/types/client/index.d.ts +1 -0
- package/types/client/sharedContext.d.ts +21 -0
- package/types/client/types.d.ts +5 -3
- package/types/common/Logger.d.ts +88 -6
- package/types/common/clientAddress.d.ts +19 -0
- package/types/common/deepObjectify.d.ts +4 -2
- package/types/common/index.d.ts +8 -2
- package/types/common/logContext.d.ts +17 -0
- package/types/common/mcpExposure.d.ts +64 -0
- package/types/common/pathGetLoose.d.ts +8 -0
- package/types/common/plainFieldsOf.d.ts +6 -0
- package/types/common/routeConvention.d.ts +6 -0
- package/types/common/websocketBinaryFrame.d.ts +17 -0
- package/types/constant/constantRegistry.d.ts +2 -10
- package/types/constant/crystalize.d.ts +5 -0
- package/types/constant/dateSlot.d.ts +14 -0
- package/types/constant/fieldInfo.d.ts +20 -3
- package/types/constant/fieldQueryMeta.d.ts +17 -0
- package/types/constant/getDefault.d.ts +8 -0
- package/types/constant/hydrationPlan.d.ts +24 -0
- package/types/constant/index.d.ts +5 -0
- package/types/constant/labelOf.d.ts +7 -0
- package/types/constant/mask.d.ts +41 -0
- package/types/constant/purify.d.ts +2 -2
- package/types/constant/types.d.ts +5 -5
- package/types/dictionary/DictionaryLookup.d.ts +14 -0
- package/types/dictionary/agent.dictionary.d.ts +1 -0
- package/types/dictionary/agentTurn.dictionary.d.ts +1 -0
- package/types/dictionary/base.dictionary.d.ts +1 -1
- package/types/dictionary/dictInfo.d.ts +7 -1
- package/types/dictionary/dictionary.d.ts +11 -9
- package/types/dictionary/index.d.ts +1 -0
- package/types/document/filterMeta.d.ts +24 -4
- package/types/document/index.d.ts +1 -0
- package/types/document/noDocumentError.d.ts +12 -0
- package/types/document/types.d.ts +0 -1
- package/types/fetch/agentTurn.d.ts +475 -0
- package/types/fetch/client/fetchClient.d.ts +12 -0
- package/types/fetch/client/httpClient.d.ts +2 -1
- package/types/fetch/fetchType/appliedReturn.type.d.ts +37 -18
- package/types/fetch/fetchType/endpointFetch.type.d.ts +8 -5
- package/types/fetch/fetchType/sliceFetch.type.d.ts +11 -15
- package/types/fetch/index.d.ts +1 -0
- package/types/index.d.ts +74 -10
- package/types/server/akanApp.d.ts +12 -0
- package/types/server/akanAppHeaders.d.ts +7 -1
- package/types/server/akanOption.d.ts +36 -6
- package/types/server/akanServer.d.ts +67 -9
- package/types/server/animatedImage.d.ts +7 -0
- package/types/server/assetEncoding.d.ts +1 -1
- package/types/server/binaryPubsub.d.ts +18 -0
- package/types/server/console.d.ts +11 -1
- package/types/server/consoleEvaluator.d.ts +2 -0
- package/types/server/consolePasteFilter.d.ts +11 -0
- package/types/server/consoleSession.d.ts +22 -0
- package/types/server/contentEncoding.d.ts +28 -0
- package/types/server/devtools/types.d.ts +4 -4
- package/types/server/di/diLifecycle.d.ts +10 -2
- package/types/server/di/predefinedAdaptor.d.ts +4 -1
- package/types/server/di/utils.d.ts +16 -0
- package/types/server/lifecycle/runtimeDir.d.ts +5 -0
- package/types/server/logging/childOutputReader.d.ts +40 -0
- package/types/server/logging/hubFileSink.d.ts +18 -0
- package/types/server/logging/logControlSocket.d.ts +60 -0
- package/types/server/logging/logForwarder.d.ts +37 -0
- package/types/server/logging/logHub.d.ts +70 -0
- package/types/server/logging/logQuery.d.ts +31 -0
- package/types/server/logging/logStdoutWriter.d.ts +35 -0
- package/types/server/logging/logStreamRoute.d.ts +20 -0
- package/types/server/logging/logTailClient.d.ts +42 -0
- package/types/server/mcp/McpAuth.d.ts +62 -0
- package/types/server/mcp/McpDispatcher.d.ts +61 -0
- package/types/server/mcp/McpEventStream.d.ts +17 -0
- package/types/server/mcp/McpExecutionContext.d.ts +44 -0
- package/types/server/mcp/McpRouter.d.ts +65 -0
- package/types/server/mcp/index.d.ts +5 -0
- package/types/server/mcp.d.ts +1 -0
- package/types/server/resolver/signal.resolver.d.ts +7 -4
- package/types/server/routing/apiRouter.d.ts +2 -1
- package/types/server/routing/appWsData.d.ts +13 -1
- package/types/server/routing/eventStream.d.ts +23 -0
- package/types/server/routing/soloAppRoutes.d.ts +17 -0
- package/types/server/rscWorkerHost.d.ts +4 -1
- package/types/server/semaphore.d.ts +5 -0
- package/types/server/subRouteIndexDocument.d.ts +8 -0
- package/types/server/systemPageDocument.d.ts +1 -0
- package/types/server/systemPages.d.ts +5 -0
- package/types/server/types.d.ts +16 -0
- package/types/server/vendor/akanjs-fetch.d.ts +1 -0
- package/types/server/webRouter.d.ts +15 -4
- package/types/service/adapt.d.ts +2 -2
- package/types/service/agent.service.d.ts +32 -0
- package/types/service/base.service.d.ts +4 -0
- package/types/service/index.d.ts +1 -0
- package/types/service/injectInfo.d.ts +2 -2
- package/types/service/ipcTypes.d.ts +12 -0
- package/types/service/predefinedAdaptor/compress.adaptor.d.ts +1 -1
- package/types/service/predefinedAdaptor/database.adaptor.d.ts +9 -3
- package/types/service/predefinedAdaptor/deepseekLlm.d.ts +76 -0
- package/types/service/predefinedAdaptor/index.d.ts +3 -0
- package/types/service/predefinedAdaptor/insightQuery.d.ts +50 -0
- package/types/service/predefinedAdaptor/llm.adaptor.d.ts +105 -0
- package/types/service/predefinedAdaptor/queue.adaptor.d.ts +3 -2
- package/types/service/predefinedAdaptor/role.adaptor.d.ts +2 -0
- package/types/service/predefinedAdaptor/schedule.adaptor.d.ts +10 -6
- package/types/service/predefinedAdaptor/solidQueue.adaptor.d.ts +6 -2
- package/types/service/predefinedAdaptor/solidSqlite.d.ts +2 -2
- package/types/service/serve.d.ts +3 -3
- package/types/service/toolNames.d.ts +35 -0
- package/types/signal/agent/AgentCatalogue.d.ts +100 -0
- package/types/signal/agent/index.d.ts +1 -0
- package/types/signal/agent.d.ts +1 -0
- package/types/signal/agent.signal.d.ts +24 -0
- package/types/signal/agentTurn.d.ts +9 -0
- package/types/signal/agentTurnStream.d.ts +24 -0
- package/types/signal/base.signal.d.ts +1 -1
- package/types/signal/endpointInfo.d.ts +21 -3
- package/types/signal/guard.d.ts +12 -0
- package/types/signal/guards.d.ts +23 -1
- package/types/signal/index.d.ts +6 -0
- package/types/signal/intercept.d.ts +2 -2
- package/types/signal/internalArg.d.ts +22 -6
- package/types/signal/mcp/McpDocument.d.ts +84 -0
- package/types/signal/mcp/McpProgress.d.ts +40 -0
- package/types/signal/mcp/McpUriTemplate.d.ts +25 -0
- package/types/signal/mcp/Msg.d.ts +143 -0
- package/types/signal/mcp/index.d.ts +5 -0
- package/types/signal/mcp/mcpProtocol.d.ts +107 -0
- package/types/signal/mcp.d.ts +1 -0
- package/types/signal/middleware.d.ts +7 -7
- package/types/signal/openapi/openapi.d.ts +3 -3
- package/types/signal/schema/JsonSchemaBuilder.d.ts +51 -0
- package/types/signal/schema/index.d.ts +1 -0
- package/types/signal/schema.d.ts +1 -0
- package/types/signal/signalContext.d.ts +67 -8
- package/types/signal/slice.d.ts +42 -15
- package/types/signal/trace.d.ts +52 -2
- package/types/signal/types.d.ts +53 -4
- package/types/store/action.d.ts +7 -5
- package/types/store/actionTag.d.ts +21 -0
- package/types/store/agent/AgentBridge.d.ts +37 -0
- package/types/store/agent/AgentContext.d.ts +16 -0
- package/types/store/agent/AgentPrompts.d.ts +31 -0
- package/types/store/agent/ScreenReader.d.ts +29 -0
- package/types/store/agent/ScreenSettle.d.ts +22 -0
- package/types/store/agent/ScreenTarget.d.ts +34 -0
- package/types/store/agent/StoreCatalogue.d.ts +26 -0
- package/types/store/agent/StoreSurfaceSource.d.ts +30 -0
- package/types/store/agent/index.d.ts +11 -0
- package/types/store/agent/storeSurface.d.ts +14 -0
- package/types/store/agent/types.d.ts +15 -0
- package/types/store/agent.d.ts +1 -0
- package/types/store/agentic/AgentValue.d.ts +43 -0
- package/types/store/agentic/StExposeBuilder.d.ts +21 -0
- package/types/store/agentic/StExposeDraft.d.ts +13 -0
- package/types/store/agentic/StStateBuilder.d.ts +21 -0
- package/types/store/agentic/StStateDraft.d.ts +12 -0
- package/types/store/agentic/StToolBuilder.d.ts +56 -0
- package/types/store/agentic/StToolDraft.d.ts +13 -0
- package/types/store/agentic/attachAgentic.d.ts +25 -0
- package/types/store/agentic/formFields.d.ts +53 -0
- package/types/store/agentic/index.d.ts +12 -0
- package/types/store/agentic/useFieldTool.d.ts +22 -0
- package/types/store/agentic/useFormTools.d.ts +19 -0
- package/types/store/agentic/useRelationFieldTool.d.ts +27 -0
- package/types/store/agentic.d.ts +1 -0
- package/types/store/baseSt.d.ts +35 -39
- package/types/store/databaseStateNames.d.ts +25 -0
- package/types/store/formSetterNames.d.ts +30 -0
- package/types/store/index.d.ts +7 -0
- package/types/store/rootStore.d.ts +5 -1
- package/types/store/sliceRole.d.ts +25 -0
- package/types/store/store.d.ts +5 -1
- package/types/store/storeInstance.d.ts +33 -1
- package/types/store/storeRegistry.d.ts +5 -0
- package/types/store/types.d.ts +4 -0
- package/types/store/withSelector.d.ts +5 -4
- package/types/test/index.d.ts +1 -1
- package/types/test/registerDom.d.ts +1 -0
- package/types/test/signalTestRuntime.d.ts +2 -3
- package/types/test/testServer.d.ts +6 -4
- package/types/ui/Agent/Approval.d.ts +8 -0
- package/types/ui/Agent/Attach.d.ts +16 -0
- package/types/ui/Agent/Bubble.d.ts +26 -0
- package/types/ui/Agent/Chat.d.ts +91 -0
- package/types/ui/Agent/ChatCommands.d.ts +34 -0
- package/types/ui/Agent/Composer.d.ts +23 -0
- package/types/ui/Agent/Context.d.ts +13 -0
- package/types/ui/Agent/Dock.d.ts +17 -0
- package/types/ui/Agent/Guide.d.ts +9 -0
- package/types/ui/Agent/History.d.ts +26 -0
- package/types/ui/Agent/Launcher.d.ts +16 -0
- package/types/ui/Agent/Markdown.d.ts +19 -0
- package/types/ui/Agent/Menu.d.ts +18 -0
- package/types/ui/Agent/Mic.d.ts +8 -0
- package/types/ui/Agent/Question.d.ts +14 -0
- package/types/ui/Agent/Section.d.ts +10 -0
- package/types/ui/Agent/Skip.d.ts +22 -0
- package/types/ui/Agent/StateKey.d.ts +16 -0
- package/types/ui/Agent/Tool.d.ts +15 -0
- package/types/ui/Agent/Transcript.d.ts +13 -0
- package/types/ui/Agent/Zone.d.ts +48 -0
- package/types/ui/Agent/agentSessionOf.d.ts +27 -0
- package/types/ui/Agent/attachment.d.ts +34 -0
- package/types/ui/Agent/fetchRunner.d.ts +12 -0
- package/types/ui/Agent/index.d.ts +19 -0
- package/types/ui/Agent/index_.d.ts +1 -0
- package/types/ui/Agent/markdownBlocks.d.ts +35 -0
- package/types/ui/Agent/markdownSpans.d.ts +2 -0
- package/types/ui/Agent/markdownTable.d.ts +16 -0
- package/types/ui/Agent/sessionHistory.d.ts +14 -0
- package/types/ui/Agent/sessionView.d.ts +15 -0
- package/types/ui/Agent/tokenCount.d.ts +6 -0
- package/types/ui/Agent/useChatAttachments.d.ts +24 -0
- package/types/ui/Agent/useChatVoice.d.ts +30 -0
- package/types/ui/Agent/useDraftRecall.d.ts +14 -0
- package/types/ui/Agent/useKeyboardInset.d.ts +8 -0
- package/types/ui/Agent/useSlashMenu.d.ts +24 -0
- package/types/ui/Agent/voice.d.ts +71 -0
- package/types/ui/Agent.d.ts +1 -0
- package/types/ui/Badge.d.ts +1 -1
- package/types/ui/Button.d.ts +1 -1
- package/types/ui/Constant/Graph.d.ts +10 -0
- package/types/ui/Constant/index.d.ts +2 -1
- package/types/ui/Constant/schemaGraph.d.ts +39 -0
- package/types/ui/Data/Dashboard.d.ts +16 -3
- package/types/ui/Data/Insight.d.ts +1 -1
- package/types/ui/Data/ListContainer.d.ts +15 -7
- package/types/ui/Data/QueryMaker.d.ts +45 -3
- package/types/ui/Data/RefPicker.d.ts +16 -0
- package/types/ui/Data/dataExport.d.ts +5 -0
- package/types/ui/Data/dataText.d.ts +6 -0
- package/types/ui/Data/index.d.ts +2 -0
- package/types/ui/Data/index_.d.ts +1 -0
- package/types/ui/DatePicker.d.ts +15 -11
- package/types/ui/Dialog/LegacyModal.d.ts +13 -0
- package/types/ui/Dialog/Provider.d.ts +3 -1
- package/types/ui/Dialog/context.d.ts +9 -1
- package/types/ui/Dialog/index.d.ts +1 -0
- package/types/ui/DraggableList.d.ts +1 -1
- package/types/ui/Dropdown.d.ts +5 -1
- package/types/ui/Field.d.ts +13 -12
- package/types/ui/Layout/BottomTab.d.ts +3 -2
- package/types/ui/LegacyModal.d.ts +24 -0
- package/types/ui/Loading/ProgressBar.d.ts +4 -0
- package/types/ui/Loading/Spin.d.ts +2 -1
- package/types/ui/Model/AdminPanel.d.ts +15 -3
- package/types/ui/Model/EditModal.d.ts +1 -1
- package/types/ui/Model/New.d.ts +3 -1
- package/types/ui/Model/NewWrapper.d.ts +2 -0
- package/types/ui/Model/NewWrapper_Client.d.ts +2 -1
- package/types/ui/Pagination.d.ts +2 -2
- package/types/ui/Radio.d.ts +1 -1
- package/types/ui/RecentTime.d.ts +18 -1
- package/types/ui/Reference/Collapse.d.ts +11 -0
- package/types/ui/Reference/Panel.d.ts +29 -0
- package/types/ui/Reference/Segmented.d.ts +17 -0
- package/types/ui/Reference/Summary.d.ts +13 -0
- package/types/ui/Reference/Toolbar.d.ts +21 -0
- package/types/ui/Reference/dictText.d.ts +6 -0
- package/types/ui/Reference/index.d.ts +7 -0
- package/types/ui/Reference/style.d.ts +20 -0
- package/types/ui/Reference.d.ts +1 -0
- package/types/ui/ScreenNavigator.d.ts +3 -1
- package/types/ui/Signal/Arg.d.ts +7 -3
- package/types/ui/Signal/Doc.d.ts +4 -6
- package/types/ui/Signal/Object.d.ts +2 -1
- package/types/ui/Signal/RestApi.d.ts +2 -1
- package/types/ui/Signal/WebSocket.d.ts +2 -1
- package/types/ui/Signal/endpointEntries.d.ts +20 -0
- package/types/ui/Signal/style.d.ts +9 -8
- package/types/ui/System/Client.d.ts +1 -2
- package/types/ui/System/Common.d.ts +3 -4
- package/types/ui/System/Messages.d.ts +1 -1
- package/types/ui/Tab/Provider.d.ts +3 -1
- package/types/ui/Tab/context.d.ts +4 -2
- package/types/ui/ToggleSelect.d.ts +1 -0
- package/types/ui/UiOverride/context.d.ts +18 -1
- package/types/ui/agentAttrs.d.ts +14 -0
- package/types/ui/index.d.ts +22 -1
- package/types/ui/overlayLayer.d.ts +13 -0
- package/types/ui/overlayPosition.d.ts +28 -0
- package/types/ui/recipe/badgeRecipe.d.ts +2 -2
- package/types/ui/recipe/buttonRecipe.d.ts +2 -2
- package/types/vendor/use-agentic/AgentAbort.d.ts +17 -0
- package/types/vendor/use-agentic/AgentProgress.d.ts +27 -0
- package/types/vendor/use-agentic/AgentProvider.d.ts +17 -0
- package/types/vendor/use-agentic/AgentScope.d.ts +9 -0
- package/types/vendor/use-agentic/AgentSession.d.ts +163 -0
- package/types/vendor/use-agentic/Agentic.d.ts +21 -0
- package/types/vendor/use-agentic/AgenticSurface.d.ts +58 -0
- package/types/vendor/use-agentic/Compaction.d.ts +48 -0
- package/types/vendor/use-agentic/ToolOutput.d.ts +21 -0
- package/types/vendor/use-agentic/Transcript.d.ts +18 -0
- package/types/vendor/use-agentic/httpRunner.d.ts +15 -0
- package/types/vendor/use-agentic/index.d.ts +19 -0
- package/types/vendor/use-agentic/sharedContext.d.ts +15 -0
- package/types/vendor/use-agentic/surfaceContext.d.ts +5 -0
- package/types/vendor/use-agentic/types.d.ts +182 -0
- package/types/vendor/use-agentic/useAgent.d.ts +4 -0
- package/types/vendor/use-agentic/useAgentGuide.d.ts +6 -0
- package/types/vendor/use-agentic/useAgentResource.d.ts +12 -0
- package/types/vendor/use-agentic/useAgentState.d.ts +16 -0
- package/types/vendor/use-agentic/useAgentTool.d.ts +16 -0
- package/types/vendor/use-agentic.d.ts +1 -0
- package/types/webkit/index.d.ts +4 -0
- package/types/webkit/useBodyScrollLock.d.ts +2 -0
- package/types/webkit/usePageTool.d.ts +19 -0
- package/types/webkit/useScreenScope.d.ts +25 -0
- package/ui/Agent/Approval.tsx +32 -0
- package/ui/Agent/Attach.tsx +77 -0
- package/ui/Agent/Bubble.tsx +192 -0
- package/ui/Agent/Chat.tsx +525 -0
- package/ui/Agent/ChatCommands.ts +141 -0
- package/ui/Agent/Composer.tsx +94 -0
- package/ui/Agent/Context.tsx +49 -0
- package/ui/Agent/Dock.tsx +77 -0
- package/ui/Agent/Guide.tsx +16 -0
- package/ui/Agent/History.tsx +49 -0
- package/ui/Agent/Launcher.tsx +60 -0
- package/ui/Agent/Markdown.tsx +142 -0
- package/ui/Agent/Menu.tsx +55 -0
- package/ui/Agent/Mic.tsx +27 -0
- package/ui/Agent/Question.tsx +63 -0
- package/ui/Agent/Section.tsx +24 -0
- package/ui/Agent/Skip.tsx +30 -0
- package/ui/Agent/StateKey.tsx +46 -0
- package/ui/Agent/Tool.tsx +59 -0
- package/ui/Agent/Transcript.tsx +33 -0
- package/ui/Agent/Zone.tsx +116 -0
- package/ui/Agent/agentSessionOf.ts +60 -0
- package/ui/Agent/attachment.ts +73 -0
- package/ui/Agent/fetchRunner.ts +44 -0
- package/ui/Agent/index.ts +27 -0
- package/ui/Agent/index_.tsx +4 -0
- package/ui/Agent/markdownBlocks.ts +137 -0
- package/ui/Agent/markdownSpans.tsx +49 -0
- package/ui/Agent/markdownTable.ts +54 -0
- package/ui/Agent/sessionHistory.ts +62 -0
- package/ui/Agent/sessionView.ts +38 -0
- package/ui/Agent/tokenCount.ts +10 -0
- package/ui/Agent/useChatAttachments.ts +84 -0
- package/ui/Agent/useChatVoice.ts +129 -0
- package/ui/Agent/useDraftRecall.ts +42 -0
- package/ui/Agent/useKeyboardInset.ts +26 -0
- package/ui/Agent/useSlashMenu.ts +58 -0
- package/ui/Agent/voice.ts +177 -0
- package/ui/Badge.tsx +1 -1
- package/ui/BottomSheet.tsx +32 -36
- package/ui/Button.tsx +3 -1
- package/ui/Clipboard.tsx +3 -6
- package/ui/Constant/Doc.tsx +265 -254
- package/ui/Constant/Graph.tsx +151 -0
- package/ui/Constant/index.ts +3 -2
- package/ui/Constant/schemaGraph.ts +232 -0
- package/ui/Data/CardList.tsx +14 -3
- package/ui/Data/Dashboard.tsx +70 -52
- package/ui/Data/Insight.tsx +18 -12
- package/ui/Data/Item.tsx +42 -56
- package/ui/Data/ListContainer.tsx +246 -132
- package/ui/Data/Pagination.tsx +10 -3
- package/ui/Data/QueryMaker.tsx +160 -11
- package/ui/Data/RefPicker.tsx +202 -0
- package/ui/Data/TableList.tsx +22 -13
- package/ui/Data/dataExport.ts +54 -0
- package/ui/Data/dataText.ts +22 -0
- package/ui/Data/index.ts +13 -1
- package/ui/Data/index_.tsx +1 -0
- package/ui/DatePicker.tsx +110 -128
- package/ui/Dialog/Close.tsx +3 -7
- package/ui/Dialog/LegacyModal.tsx +241 -0
- package/ui/Dialog/Modal.tsx +62 -195
- package/ui/Dialog/Provider.tsx +47 -3
- package/ui/Dialog/Trigger.tsx +3 -7
- package/ui/Dialog/context.ts +14 -2
- package/ui/Dialog/index.tsx +2 -0
- package/ui/DragAction.tsx +3 -2
- package/ui/DraggableList.tsx +9 -4
- package/ui/Dropdown.tsx +89 -27
- package/ui/Empty.tsx +6 -4
- package/ui/Field.tsx +128 -58
- package/ui/Input.tsx +27 -5
- package/ui/KeyboardAvoiding.tsx +2 -2
- package/ui/Layout/BottomTab.tsx +32 -37
- package/ui/Layout/Sider.tsx +37 -14
- package/ui/LegacyModal.tsx +53 -0
- package/ui/Link/CsrLink.tsx +1 -1
- package/ui/Load/Pagination.tsx +15 -8
- package/ui/Load/Units.tsx +30 -7
- package/ui/Load/View.tsx +10 -3
- package/ui/Loading/Area.tsx +7 -6
- package/ui/Loading/Button.tsx +7 -9
- package/ui/Loading/Input.tsx +7 -9
- package/ui/Loading/ProgressBar.tsx +16 -7
- package/ui/Loading/Skeleton.tsx +8 -13
- package/ui/Loading/Spin.tsx +20 -14
- package/ui/Menu.tsx +1 -1
- package/ui/Model/AdminPanel.tsx +52 -12
- package/ui/Model/EditModal.tsx +28 -6
- package/ui/Model/EditWrapper.tsx +16 -4
- package/ui/Model/New.tsx +4 -0
- package/ui/Model/NewWrapper.tsx +2 -0
- package/ui/Model/NewWrapper_Client.tsx +20 -6
- package/ui/Model/Remove.tsx +18 -6
- package/ui/Model/RemoveWrapper.tsx +12 -2
- package/ui/Model/SureToRemove.tsx +18 -6
- package/ui/Model/ViewEditModal.tsx +64 -15
- package/ui/Model/ViewModal.tsx +25 -11
- package/ui/Model/ViewWrapper.tsx +15 -4
- package/ui/Model/index_.tsx +1 -1
- package/ui/Pagination.tsx +51 -66
- package/ui/Popconfirm.tsx +88 -78
- package/ui/Radio.tsx +53 -24
- package/ui/RecentTime.tsx +83 -35
- package/ui/Reference/Collapse.tsx +26 -0
- package/ui/Reference/Panel.tsx +79 -0
- package/ui/Reference/Segmented.tsx +41 -0
- package/ui/Reference/Summary.tsx +25 -0
- package/ui/Reference/Toolbar.tsx +44 -0
- package/ui/Reference/dictText.ts +9 -0
- package/ui/Reference/index.ts +7 -0
- package/ui/Reference/style.ts +45 -0
- package/ui/ScreenNavigator.tsx +17 -2
- package/ui/Select.tsx +96 -57
- package/ui/Signal/Arg.tsx +83 -68
- package/ui/Signal/Doc.tsx +163 -129
- package/ui/Signal/Listener.tsx +40 -29
- package/ui/Signal/Message.tsx +87 -135
- package/ui/Signal/Object.tsx +79 -57
- package/ui/Signal/PubSub.tsx +72 -113
- package/ui/Signal/Request.tsx +2 -22
- package/ui/Signal/Response.tsx +19 -45
- package/ui/Signal/RestApi.tsx +170 -200
- package/ui/Signal/WebSocket.tsx +29 -26
- package/ui/Signal/endpointEntries.ts +59 -0
- package/ui/Signal/makeExample.ts +10 -3
- package/ui/Signal/style.ts +34 -29
- package/ui/Switch.tsx +4 -0
- package/ui/System/CSR.tsx +1 -1
- package/ui/System/Client.tsx +31 -15
- package/ui/System/Common.tsx +3 -4
- package/ui/System/DevModeToggle.tsx +1 -1
- package/ui/System/Gtag.tsx +2 -2
- package/ui/System/Messages.tsx +52 -31
- package/ui/System/Reconnect.tsx +22 -56
- package/ui/System/SelectLanguage.tsx +24 -15
- package/ui/System/ThemeToggle.tsx +25 -13
- package/ui/Tab/Menu.tsx +24 -12
- package/ui/Tab/Menus.tsx +6 -3
- package/ui/Tab/Provider.tsx +30 -3
- package/ui/Tab/context.ts +8 -4
- package/ui/Table.tsx +66 -60
- package/ui/ToggleSelect.tsx +8 -7
- package/ui/Tooltip.tsx +15 -1
- package/ui/UiOverride/context.ts +21 -2
- package/ui/Unauthorized.tsx +6 -4
- package/ui/agentAttrs.ts +19 -0
- package/ui/index.ts +49 -1
- package/ui/overlayLayer.ts +12 -2
- package/ui/overlayPosition.ts +104 -0
- package/ui/recipe/buttonRecipe.ts +2 -2
- package/ui/styles.css +31 -0
- package/vendor/use-agentic/AgentAbort.ts +29 -0
- package/vendor/use-agentic/AgentProgress.ts +40 -0
- package/vendor/use-agentic/AgentProvider.tsx +39 -0
- package/vendor/use-agentic/AgentScope.tsx +20 -0
- package/vendor/use-agentic/AgentSession.ts +750 -0
- package/vendor/use-agentic/Agentic.tsx +44 -0
- package/vendor/use-agentic/AgenticSurface.ts +333 -0
- package/vendor/use-agentic/Compaction.ts +120 -0
- package/vendor/use-agentic/ToolOutput.ts +60 -0
- package/vendor/use-agentic/Transcript.ts +50 -0
- package/vendor/use-agentic/WIRE.md +86 -0
- package/vendor/use-agentic/httpRunner.ts +131 -0
- package/vendor/use-agentic/index.ts +20 -0
- package/vendor/use-agentic/sharedContext.ts +25 -0
- package/vendor/use-agentic/surfaceContext.ts +10 -0
- package/vendor/use-agentic/types.ts +192 -0
- package/vendor/use-agentic/useAgent.ts +18 -0
- package/vendor/use-agentic/useAgentGuide.ts +16 -0
- package/vendor/use-agentic/useAgentResource.ts +36 -0
- package/vendor/use-agentic/useAgentState.ts +64 -0
- package/vendor/use-agentic/useAgentTool.ts +55 -0
- package/webkit/bootCsr.tsx +10 -8
- package/webkit/index.ts +4 -0
- package/webkit/lazy.tsx +5 -1
- package/webkit/useBodyScrollLock.tsx +29 -0
- package/webkit/useFrameRuntime.ts +1 -1
- package/webkit/usePageTool.tsx +37 -0
- package/webkit/useScreenScope.tsx +60 -0
- package/types/ui/Constant/Mermaid.d.ts +0 -8
- package/types/ui/Signal/Collapse.d.ts +0 -12
- package/ui/Constant/Mermaid.tsx +0 -149
- package/ui/Signal/Collapse.tsx +0 -29
|
@@ -15,6 +15,22 @@ export declare const normalizeServiceRefName: (refName: string) => string;
|
|
|
15
15
|
export declare const normalizeSignalRefName: (refName: string) => string;
|
|
16
16
|
export declare const normalizeAdaptorRefName: (refName: string) => string;
|
|
17
17
|
export declare const getModuleDependencyRefNames: (mod: DatabaseModule | ServiceModule) => Set<string>;
|
|
18
|
+
/**
|
|
19
|
+
* The modules a cascade edge forces this one to be mounted with: a `removeRef` target and a monomorphic
|
|
20
|
+
* `removeWith` owner both fail `CascadeRunner.seal` when they are absent, so they are boot dependencies the
|
|
21
|
+
* inject graph cannot see. A polymorphic owner list is exempt — it spans optional modules by design.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getModuleCascadeRefNames: (mod: DatabaseModule | ServiceModule) => Set<string>;
|
|
24
|
+
export interface Registration {
|
|
25
|
+
key: string;
|
|
26
|
+
/** What claimed the key, phrased for a boot error: `predefined adaptor "storage"`, `lib "shared"`. */
|
|
27
|
+
owner: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A key registered twice is silently last-write-wins everywhere downstream — an app that meant to add a second
|
|
31
|
+
* adaptor gets one, and the other's `onInit` never runs. Refuse the boot instead, naming both claimants.
|
|
32
|
+
*/
|
|
33
|
+
export declare const assertUniqueRegistrations: (kind: string, registrations: Registration[]) => void;
|
|
18
34
|
/**
|
|
19
35
|
* Run every task in parallel and, if any rejects, throw a single
|
|
20
36
|
* `AggregateError` that enumerates every failing label + cause. This replaces
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a replica keeps its child sockets and rotating logs. Both the gateway and a solo server resolve it,
|
|
3
|
+
* and they must land on the same directory: switching between the two modes must not move the log file.
|
|
4
|
+
*/
|
|
5
|
+
export declare const resolveRuntimeDir: (runtimeDir?: string) => string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type LogRecord } from "akanjs/common";
|
|
2
|
+
export type ChildOutputType = "stdout" | "stderr";
|
|
3
|
+
export interface ChildOutputReaderOptions {
|
|
4
|
+
/** A complete stdout line, newline included. */
|
|
5
|
+
onLine: (line: string) => void;
|
|
6
|
+
/** A stderr block of newline-terminated lines; one stack trace arrives as one block. */
|
|
7
|
+
onBlock: (lines: string[]) => void;
|
|
8
|
+
blockMaxLines?: number;
|
|
9
|
+
blockIdleMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ChildRecordInput {
|
|
12
|
+
type: ChildOutputType;
|
|
13
|
+
text: string;
|
|
14
|
+
name: string;
|
|
15
|
+
role: string | null;
|
|
16
|
+
replicaIdx: number | null;
|
|
17
|
+
pid: number | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Splits a child process's stdout and stderr into lines. stderr is block-buffered — a runtime writes a stack
|
|
21
|
+
* trace in many small writes and a reader wants it whole — and a block closes on a blank line, at
|
|
22
|
+
* `blockMaxLines`, after `blockIdleMs` of silence, or when the stream ends.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ChildOutputReader {
|
|
25
|
+
#private;
|
|
26
|
+
static readonly defaultBlockMaxLines = 64;
|
|
27
|
+
static readonly defaultBlockIdleMs = 50;
|
|
28
|
+
constructor({ onLine, onBlock, blockMaxLines, blockIdleMs }: ChildOutputReaderOptions);
|
|
29
|
+
/**
|
|
30
|
+
* Wraps what a child wrote past its Logger — a `console.*` call, a runtime error, a crash — as a record of the
|
|
31
|
+
* process that read it, so an ndjson stdout stays one JSON line per event even for the line that killed a child.
|
|
32
|
+
*/
|
|
33
|
+
static toRecord({ type, text, name, role, replicaIdx, pid }: ChildRecordInput): LogRecord;
|
|
34
|
+
pipe(stream: ReadableStream<Uint8Array> | null | undefined, type: ChildOutputType): Promise<void>;
|
|
35
|
+
write(type: ChildOutputType, text: string): void;
|
|
36
|
+
/** Ends the stream's partial line and, for stderr, the block it belongs to. */
|
|
37
|
+
flush(type: ChildOutputType): void;
|
|
38
|
+
flushBlock(): void;
|
|
39
|
+
close(): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LogHub, LogHubEntry } from "./logHub.d.ts";
|
|
2
|
+
import type { RotatingLogWriter } from "./rotatingLogWriter.d.ts";
|
|
3
|
+
export interface HubFileSinkOptions {
|
|
4
|
+
minSev: number;
|
|
5
|
+
/** `ndjson-only` writes the file as JSON lines too; plain `ndjson` keeps the text file a human reads. */
|
|
6
|
+
json: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The rotating log file fed from the hub instead of from this process's own Logger. In an ndjson deployment a
|
|
10
|
+
* child writes no text line the owner could relay, so the file is written from the records that reached the
|
|
11
|
+
* hub — every process in one place, keyed the way the text-mode files were.
|
|
12
|
+
*/
|
|
13
|
+
export declare class HubFileSink {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(hub: LogHub, writer: RotatingLogWriter, { minSev, json }: HubFileSinkOptions);
|
|
16
|
+
static processKey({ record }: LogHubEntry): string;
|
|
17
|
+
close(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { LogHub, LogHubCoverage, LogHubEntry } from "./logHub.d.ts";
|
|
2
|
+
import { type LogQuery } from "./logQuery.d.ts";
|
|
3
|
+
export type LogControlRequest = {
|
|
4
|
+
cmd: "subscribe";
|
|
5
|
+
query?: Record<string, unknown>;
|
|
6
|
+
replay?: number;
|
|
7
|
+
} | {
|
|
8
|
+
cmd: "unsubscribe";
|
|
9
|
+
id: string;
|
|
10
|
+
} | {
|
|
11
|
+
cmd: "history";
|
|
12
|
+
query?: Record<string, unknown>;
|
|
13
|
+
} | {
|
|
14
|
+
cmd: "coverage";
|
|
15
|
+
};
|
|
16
|
+
export type LogControlResponse = {
|
|
17
|
+
type: "subscribed";
|
|
18
|
+
id: string;
|
|
19
|
+
query: LogQuery;
|
|
20
|
+
coverage: LogHubCoverage;
|
|
21
|
+
} | {
|
|
22
|
+
type: "unsubscribed";
|
|
23
|
+
id: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: "record";
|
|
26
|
+
id?: string;
|
|
27
|
+
seq: number;
|
|
28
|
+
record: LogHubEntry["record"];
|
|
29
|
+
} | {
|
|
30
|
+
type: "history";
|
|
31
|
+
entries: LogHubEntry[];
|
|
32
|
+
coverage: LogHubCoverage;
|
|
33
|
+
} | {
|
|
34
|
+
type: "coverage";
|
|
35
|
+
coverage: LogHubCoverage;
|
|
36
|
+
} | {
|
|
37
|
+
type: "dropped";
|
|
38
|
+
count: number;
|
|
39
|
+
} | {
|
|
40
|
+
type: "error";
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A unix domain socket in the runtime directory, `0600`, speaking NDJSON both ways. Filesystem permission is
|
|
45
|
+
* the whole authentication: no TCP port is opened. `akan logs` and the console's `.tail` are its clients.
|
|
46
|
+
*
|
|
47
|
+
* Nothing in here logs per delivered record — a subscriber asking for everything would otherwise receive the
|
|
48
|
+
* line about its own delivery, forever.
|
|
49
|
+
*/
|
|
50
|
+
export declare class LogControlSocket {
|
|
51
|
+
#private;
|
|
52
|
+
static readonly fileName = "akan-control.sock";
|
|
53
|
+
static readonly maxPendingBytes: number;
|
|
54
|
+
static readonly maxInboxBytes: number;
|
|
55
|
+
static pathIn(runtimeDir: string): string;
|
|
56
|
+
readonly path: string;
|
|
57
|
+
constructor(hub: LogHub, runtimeDir: string);
|
|
58
|
+
start(): Promise<void>;
|
|
59
|
+
stop(): Promise<void>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type LogRecord } from "akanjs/common";
|
|
2
|
+
import type { AkanIpcMessage } from "akanjs/service";
|
|
3
|
+
export interface LogForwarderOptions {
|
|
4
|
+
flushMs?: number;
|
|
5
|
+
maxRecords?: number;
|
|
6
|
+
maxBytes?: number;
|
|
7
|
+
maxQueue?: number;
|
|
8
|
+
maxMessageChars?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The child side of the log channel: a Logger sink that batches records over IPC to whoever owns the hub.
|
|
12
|
+
* Installed only while the owner has asked for a level (`log.level`), so a process nobody is watching sends
|
|
13
|
+
* nothing; `AKAN_LOG_STREAM=1` keeps it on regardless.
|
|
14
|
+
*/
|
|
15
|
+
export declare class LogForwarder {
|
|
16
|
+
#private;
|
|
17
|
+
static readonly defaultFlushMs = 20;
|
|
18
|
+
static readonly defaultMaxRecords = 64;
|
|
19
|
+
/**
|
|
20
|
+
* Bun IPC loses a message outright when the sender exits soon after and the payload is large — measured from
|
|
21
|
+
* 16KB for one long string — and a small message queued behind it dies with it. Batches stay well under that.
|
|
22
|
+
*/
|
|
23
|
+
static readonly defaultMaxBytes: number;
|
|
24
|
+
static readonly defaultMaxQueue = 1000;
|
|
25
|
+
static readonly defaultMaxMessageChars: number;
|
|
26
|
+
constructor(send: (message: AkanIpcMessage) => void, options?: LogForwarderOptions);
|
|
27
|
+
/** The severity floor in force, or `null` when nothing is forwarded. */
|
|
28
|
+
get minSev(): number | null;
|
|
29
|
+
get active(): boolean;
|
|
30
|
+
get dropped(): number;
|
|
31
|
+
setMinSev(minSev: number | null): void;
|
|
32
|
+
/** Enqueues a record this process produced or relays for one below it; dropped when nobody is listening. */
|
|
33
|
+
push(record: LogRecord): void;
|
|
34
|
+
pushMany(records: LogRecord[]): void;
|
|
35
|
+
flush(): void;
|
|
36
|
+
close(): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type LogRecord } from "akanjs/common";
|
|
2
|
+
import { type LogQuery } from "./logQuery.d.ts";
|
|
3
|
+
export interface LogHubEntry {
|
|
4
|
+
/** Assigned here, in arrival order. `record.at` comes from several clocks and is not monotonic across children. */
|
|
5
|
+
seq: number;
|
|
6
|
+
record: LogRecord;
|
|
7
|
+
}
|
|
8
|
+
export interface LogHubCoverage {
|
|
9
|
+
count: number;
|
|
10
|
+
oldestSeq: number | null;
|
|
11
|
+
newestSeq: number | null;
|
|
12
|
+
from: number | null;
|
|
13
|
+
to: number | null;
|
|
14
|
+
}
|
|
15
|
+
export interface LogHubOptions {
|
|
16
|
+
maxRecords?: number;
|
|
17
|
+
maxBytes?: number;
|
|
18
|
+
/** Identical `(name, level, message)` lines allowed per second before the rest collapse into one count. */
|
|
19
|
+
suppressPerSecond?: number;
|
|
20
|
+
now?: () => number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The process-wide journal: every record of every process this one fronts, in one sequence, with a bounded
|
|
24
|
+
* ring behind it and live subscribers in front. Owned by the gateway, or by the solo replica when nothing is
|
|
25
|
+
* in front of it.
|
|
26
|
+
*/
|
|
27
|
+
export declare class LogHub {
|
|
28
|
+
#private;
|
|
29
|
+
static readonly defaultMaxRecords = 2000;
|
|
30
|
+
static readonly defaultMaxBytes: number;
|
|
31
|
+
static readonly defaultSuppressPerSecond = 20;
|
|
32
|
+
static readonly suppressWindowMs = 1000;
|
|
33
|
+
constructor({ maxRecords, maxBytes, suppressPerSecond, now }?: LogHubOptions);
|
|
34
|
+
static fromEnv(): LogHub;
|
|
35
|
+
/**
|
|
36
|
+
* The process's one hub, fed by this process's Logger from the moment it is asked for — at construction of the
|
|
37
|
+
* entrypoint rather than at listen, so a boot line is neither lost nor, in ndjson mode, written as text. In
|
|
38
|
+
* ndjson mode it also turns this process's console off and owns the stdout writer, the stream's only author.
|
|
39
|
+
*/
|
|
40
|
+
static attach(): LogHub;
|
|
41
|
+
get closed(): boolean;
|
|
42
|
+
/** The lowest severity any subscriber wants, or `null` with no subscriber — what a child's forwarder is told. */
|
|
43
|
+
get floor(): number | null;
|
|
44
|
+
get size(): number;
|
|
45
|
+
get seq(): number;
|
|
46
|
+
ingest(record: LogRecord): LogHubEntry | null;
|
|
47
|
+
ingestMany(records: LogRecord[]): void;
|
|
48
|
+
subscribe(query: LogQuery, sink: (entry: LogHubEntry) => void): {
|
|
49
|
+
id: string;
|
|
50
|
+
unsubscribe: () => void;
|
|
51
|
+
};
|
|
52
|
+
unsubscribe(id: string): void;
|
|
53
|
+
onFloorChange(listener: (minSev: number | null) => void): () => void;
|
|
54
|
+
coverage(): LogHubCoverage;
|
|
55
|
+
history(query: LogQuery): {
|
|
56
|
+
entries: LogHubEntry[];
|
|
57
|
+
coverage: LogHubCoverage;
|
|
58
|
+
};
|
|
59
|
+
/** Everything after `seq`, and the gap when the ring has already evicted part of that range. */
|
|
60
|
+
since(seq: number): {
|
|
61
|
+
entries: LogHubEntry[];
|
|
62
|
+
gap: {
|
|
63
|
+
from: number;
|
|
64
|
+
to: number;
|
|
65
|
+
missed: number;
|
|
66
|
+
} | null;
|
|
67
|
+
};
|
|
68
|
+
close(): void;
|
|
69
|
+
static estimateBytes(record: LogRecord): number;
|
|
70
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type LogRecord } from "akanjs/common";
|
|
2
|
+
/** Fields AND together; a list inside a field is an OR. One shape serves live tail, history and the SSE query string. */
|
|
3
|
+
export interface LogQuery {
|
|
4
|
+
minSev?: number;
|
|
5
|
+
text?: string;
|
|
6
|
+
name?: string[];
|
|
7
|
+
endpoint?: string[];
|
|
8
|
+
origin?: string[];
|
|
9
|
+
traceId?: string;
|
|
10
|
+
child?: number[];
|
|
11
|
+
role?: string[];
|
|
12
|
+
stream?: ("stdout" | "stderr")[];
|
|
13
|
+
since?: number;
|
|
14
|
+
limit?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class LogQueryMatcher {
|
|
17
|
+
#private;
|
|
18
|
+
readonly query: LogQuery;
|
|
19
|
+
constructor(query: LogQuery);
|
|
20
|
+
matches(record: LogRecord): boolean;
|
|
21
|
+
/** `*` is the only wildcard: `mutation:*`, `*:userList`. Everything else is literal. */
|
|
22
|
+
static compileGlob(pattern: string): RegExp;
|
|
23
|
+
/** A duration such as `5m` / `30s` / `2h` / `1d`, or an absolute epoch-ms number. */
|
|
24
|
+
static parseSince(value: string, now?: number): number | undefined;
|
|
25
|
+
static parseMinSev(value: string | undefined): number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Reads a query off `URLSearchParams` or a parsed JSON object. Lists accept repeated keys and comma-separated
|
|
28
|
+
* values; `level=warn` is sugar for `minSev`; `since` accepts a duration.
|
|
29
|
+
*/
|
|
30
|
+
static parse(input: URLSearchParams | Record<string, unknown>, now?: number): LogQuery;
|
|
31
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LogHub, LogHubEntry } from "./logHub.d.ts";
|
|
2
|
+
export interface LogStdoutWriterOptions {
|
|
3
|
+
minSev: number;
|
|
4
|
+
write?: (line: string) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The container's stdout in an ndjson deployment: one JSON record per line for everything the hub sees at or
|
|
8
|
+
* above the stdout level, from this process and every one it fronts. It is the only writer — `Logger.consoleOutput`
|
|
9
|
+
* is off in every server process — so a collector's parser is `json` and nothing else.
|
|
10
|
+
*/
|
|
11
|
+
export declare class LogStdoutWriter {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(hub: LogHub, { minSev, write }: LogStdoutWriterOptions);
|
|
14
|
+
/** `seq` rides along: `at` comes from several clocks, so it is what orders records from different processes. */
|
|
15
|
+
static json(entry: LogHubEntry): {
|
|
16
|
+
at: number;
|
|
17
|
+
elapsedMs: number;
|
|
18
|
+
level: import("../../common.d.ts").LogLevel | null;
|
|
19
|
+
sev: number;
|
|
20
|
+
name: string;
|
|
21
|
+
context: string;
|
|
22
|
+
message: string;
|
|
23
|
+
stream: "stdout" | "stderr";
|
|
24
|
+
pid: number | null;
|
|
25
|
+
replicaIdx: number | null;
|
|
26
|
+
role: string | null;
|
|
27
|
+
origin: string | null;
|
|
28
|
+
traceId: string | null;
|
|
29
|
+
endpoint: string | null;
|
|
30
|
+
attrs?: import("../../common.d.ts").LogAttrs;
|
|
31
|
+
seq: number;
|
|
32
|
+
};
|
|
33
|
+
static line(entry: LogHubEntry): string;
|
|
34
|
+
close(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LogHub } from "./logHub.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* `GET /_akan/app/logs?level=warn&endpoint=mutation:*` — the hub as a `text/event-stream`, for a monitor watching
|
|
4
|
+
* one process from outside the pod. Every event carries the hub `seq` as its `id:`, so a client that reconnects
|
|
5
|
+
* with `Last-Event-ID` gets what it missed while the ring still holds it, and an explicit gap event when it does
|
|
6
|
+
* not — never a silent skip a monitor would read as a quiet interval.
|
|
7
|
+
*
|
|
8
|
+
* The route exists only when `AKAN_LOG_STREAM_TOKEN` is set, and answers only a matching bearer token. It logs
|
|
9
|
+
* nothing itself: a stream that logged its own subscriptions at the level it delivers would feed on itself.
|
|
10
|
+
*/
|
|
11
|
+
export declare class LogStreamRoute {
|
|
12
|
+
#private;
|
|
13
|
+
static readonly path = "/_akan/app/logs";
|
|
14
|
+
static readonly retryMs = 2000;
|
|
15
|
+
static readonly heartbeatMs = 15000;
|
|
16
|
+
constructor(hub: () => LogHub | null, token: string);
|
|
17
|
+
/** Without a token the route is not registered at all, rather than mounted to answer "forbidden". */
|
|
18
|
+
static fromEnv(hub: () => LogHub | null): LogStreamRoute | null;
|
|
19
|
+
handle(req: Request): Response;
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type LogControlResponse } from "./logControlSocket.d.ts";
|
|
2
|
+
import type { LogHubCoverage, LogHubEntry } from "./logHub.d.ts";
|
|
3
|
+
export interface LogTailHandlers {
|
|
4
|
+
onRecord: (entry: LogHubEntry) => void;
|
|
5
|
+
onEvent?: (response: LogControlResponse) => void;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/** Says the app is not running at all, as opposed to a request that failed once connected. */
|
|
9
|
+
export declare class LogControlUnavailableError extends Error {
|
|
10
|
+
readonly socketPath: string;
|
|
11
|
+
constructor(socketPath: string, cause: unknown);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The client half of `LogControlSocket`: `akan logs` and the console's `.tail` both speak through it. Records
|
|
15
|
+
* stream to `onRecord`; every other line answers the oldest request still waiting, in order, because the
|
|
16
|
+
* socket answers in order.
|
|
17
|
+
*/
|
|
18
|
+
export declare class LogTailClient {
|
|
19
|
+
#private;
|
|
20
|
+
static socketPath(runtimeDir: string): string;
|
|
21
|
+
static connect(socketPath: string, handlers: LogTailHandlers): Promise<LogTailClient>;
|
|
22
|
+
static describeCoverage(coverage: LogHubCoverage, now?: number): string;
|
|
23
|
+
static formatDuration(ms: number): string;
|
|
24
|
+
private constructor();
|
|
25
|
+
get closed(): boolean;
|
|
26
|
+
subscribe(query: Record<string, unknown>, { replay }?: {
|
|
27
|
+
replay?: number;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
type: "subscribed";
|
|
30
|
+
id: string;
|
|
31
|
+
query: import("./logQuery.d.ts").LogQuery;
|
|
32
|
+
coverage: LogHubCoverage;
|
|
33
|
+
}>;
|
|
34
|
+
unsubscribe(id: string): Promise<void>;
|
|
35
|
+
history(query: Record<string, unknown>): Promise<{
|
|
36
|
+
type: "history";
|
|
37
|
+
entries: LogHubEntry[];
|
|
38
|
+
coverage: LogHubCoverage;
|
|
39
|
+
}>;
|
|
40
|
+
coverage(): Promise<LogHubCoverage>;
|
|
41
|
+
close(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { HttpRoutes } from "../types.d.ts";
|
|
2
|
+
export interface McpAuthOption {
|
|
3
|
+
/** Where a client may obtain a token, published in the metadata document for it to discover. */
|
|
4
|
+
authorizationServers?: string[];
|
|
5
|
+
/** Scopes every call must carry. Declaring any turns `insufficient_scope` enforcement on. */
|
|
6
|
+
scopes?: string[];
|
|
7
|
+
/** Overrides the resource identifier when the public URL differs from what the request reports. */
|
|
8
|
+
resource?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface McpAuthProps extends McpAuthOption {
|
|
11
|
+
/** Path the MCP endpoint is mounted at. Its absolute URL is this server's OAuth resource identifier. */
|
|
12
|
+
path: string;
|
|
13
|
+
}
|
|
14
|
+
interface McpAuthFailure {
|
|
15
|
+
status: 401 | 403;
|
|
16
|
+
error: "invalid_token" | "insufficient_scope";
|
|
17
|
+
description: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The OAuth 2.1 protected-resource half of the MCP authorization spec: the RFC 9728 metadata document, the
|
|
21
|
+
* `WWW-Authenticate` challenge that points at it, and the token checks that can be made without an issuer.
|
|
22
|
+
*
|
|
23
|
+
* The authorization server itself is a separate project. What lives here is what a resource server owes a
|
|
24
|
+
* client regardless of who mints the tokens, so wiring one up later needs no change on this side.
|
|
25
|
+
*/
|
|
26
|
+
export declare class McpAuth {
|
|
27
|
+
#private;
|
|
28
|
+
static readonly wellKnownPath = "/.well-known/oauth-protected-resource";
|
|
29
|
+
constructor(props: McpAuthProps);
|
|
30
|
+
/**
|
|
31
|
+
* Both spellings of the metadata path. RFC 9728 inserts the resource's path into the well-known URL, and MCP
|
|
32
|
+
* clients try that form first and the bare one second; serving only one leaves half the clients at a 404.
|
|
33
|
+
*/
|
|
34
|
+
createRoutes(): HttpRoutes;
|
|
35
|
+
unauthorized(req: Request, failure?: McpAuthFailure): Response;
|
|
36
|
+
/**
|
|
37
|
+
* Refuses a bearer token that is already provably unusable, before the signal pipeline sees it.
|
|
38
|
+
*
|
|
39
|
+
* The claims are read **without verifying the signature**, which is sound only because every branch below can
|
|
40
|
+
* deny and none can grant: a forged token still has to pass the app's own middleware afterwards, so the worst
|
|
41
|
+
* a crafted payload achieves is refusing itself. What this buys is the failure mode it removes — an expired or
|
|
42
|
+
* foreign token otherwise degrades to an anonymous caller, and the agent is told a tool does not exist rather
|
|
43
|
+
* than that it needs to authenticate.
|
|
44
|
+
*/
|
|
45
|
+
reject(req: Request): Response | null;
|
|
46
|
+
/**
|
|
47
|
+
* The public origin, not the one the request arrived on. Behind a proxy `req.url` names the internal host the
|
|
48
|
+
* proxy dialed, and publishing that as the resource identifier is not cosmetic: an authorization server issues
|
|
49
|
+
* `aud` for the URL the *client* used, so every correctly-issued token would then fail the audience check.
|
|
50
|
+
*
|
|
51
|
+
* `McpRouter` compares an `Origin` header against this too — the same proxy that makes `req.url` wrong for the
|
|
52
|
+
* metadata document makes it wrong for a same-origin check, and there the cost is a flat 403.
|
|
53
|
+
*
|
|
54
|
+
* `x-forwarded-host` is a request header, so this is exactly as trustworthy as the edge that overwrites it, and
|
|
55
|
+
* a deployment whose edge merely appends leaves both the same-origin comparison and the audience a token is
|
|
56
|
+
* checked against to the caller. A browser cannot reach it — a custom header is not on a preflight, and the
|
|
57
|
+
* `OPTIONS` is judged on the real host — but a direct caller can. `AKAN_MCP_RESOURCE` pins the identifier for a
|
|
58
|
+
* deployment that cannot make the guarantee.
|
|
59
|
+
*/
|
|
60
|
+
static origin(req: Request): string;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type BackendEnv } from "akanjs/base";
|
|
2
|
+
import { Logger } from "akanjs/common";
|
|
3
|
+
import type { InjectRegistry, LiveRegistry } from "akanjs/service";
|
|
4
|
+
import { type McpExposedEndpoint, type McpToolResult, type PromptMessage } from "../../signal/mcp.d.ts";
|
|
5
|
+
import type { MiddlewareCls } from "../../signal/middleware.d.ts";
|
|
6
|
+
/** Raised when the caller presented no credential at all, so the client should be told to authenticate. */
|
|
7
|
+
export declare class McpAuthRequiredError extends Error {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A prompt failure whose message has already been through `#message` and is safe to put on the wire.
|
|
11
|
+
*
|
|
12
|
+
* It carries its JSON-RPC code because a prompt has no `isError` result to put a refusal in, so the code is the
|
|
13
|
+
* only place left to say whose fault it was. Without it a mistyped argument reads as `-32603 internal error`,
|
|
14
|
+
* while the *missing*-argument check `prompts/get` does itself answers `-32602` — the same mistake, two codes.
|
|
15
|
+
*/
|
|
16
|
+
export declare class McpPromptError extends Error {
|
|
17
|
+
readonly code: number;
|
|
18
|
+
constructor(message: string, code: number);
|
|
19
|
+
}
|
|
20
|
+
interface McpDispatcherProps {
|
|
21
|
+
registry: InjectRegistry;
|
|
22
|
+
env: BackendEnv;
|
|
23
|
+
live: LiveRegistry;
|
|
24
|
+
middleware: Map<string, MiddlewareCls>;
|
|
25
|
+
/** The one language error text is resolved in, matching the catalogue the client was handed. */
|
|
26
|
+
language?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a structured result also ships as serialized JSON in the text block. `true` by default, which is what
|
|
29
|
+
* the spec asks for; `false` halves what every model-returning tool costs.
|
|
30
|
+
*/
|
|
31
|
+
legacyTextBlock?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Executes one MCP tool call or resource read through the ordinary signal pipeline. */
|
|
34
|
+
export declare class McpDispatcher {
|
|
35
|
+
#private;
|
|
36
|
+
static readonly logger: Logger;
|
|
37
|
+
/** What the text block says when the serialized duplicate is off. Read by a model, so English. */
|
|
38
|
+
static readonly structuredNote = "The result is in this call's structuredContent.";
|
|
39
|
+
constructor(props: McpDispatcherProps);
|
|
40
|
+
call(exposed: McpExposedEndpoint, args: Record<string, unknown>, req: Request): Promise<McpToolResult>;
|
|
41
|
+
/**
|
|
42
|
+
* A prompt is user-chosen, not model-chosen, so a failure has nowhere to go but the JSON-RPC error — there is
|
|
43
|
+
* no `isError` result the model could read and recover from. Errors propagate to the router unchanged.
|
|
44
|
+
*
|
|
45
|
+
* The messages arrive already normalized: `SignalContext` does that for every `prompt`, so this route and the
|
|
46
|
+
* plain HTTP one return the same shape.
|
|
47
|
+
*/
|
|
48
|
+
prompt(exposed: McpExposedEndpoint, args: Record<string, unknown>, req: Request): Promise<PromptMessage[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Drops catalogue entries whose account-scoped guards refuse this caller — an anonymous agent should not be
|
|
51
|
+
* offered a shelf of admin tools it can only fail at. Entries with no such guard are kept and stopped at call
|
|
52
|
+
* time instead, so the listing is a UX filter and never the access decision.
|
|
53
|
+
*
|
|
54
|
+
* The context is deliberately not `init()`-ed: parsing arguments that a listing does not have would throw,
|
|
55
|
+
* and a resource guard reached here reads `undefined` and fails closed, which is the behaviour we want.
|
|
56
|
+
*/
|
|
57
|
+
filterForAccount<T extends {
|
|
58
|
+
name: string;
|
|
59
|
+
}>(items: T[], req: Request): Promise<T[]>;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EventStream } from "../routing/eventStream.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* One `text/event-stream` response carrying the notifications a single request produced, ending with that
|
|
4
|
+
* request's own result.
|
|
5
|
+
*
|
|
6
|
+
* This is the only channel a server has for pushing anything: `2026-07-28` removed the GET stream, session
|
|
7
|
+
* resumption and server-initiated requests, so nothing may be sent that is not related to a request in flight.
|
|
8
|
+
* Closing the stream is also how the client cancels — `notifications/cancelled` is stdio-only — which is why
|
|
9
|
+
* `cancel` is a constructor argument rather than something a caller could forget to wire. No event carries an
|
|
10
|
+
* `id:`, since there is nothing a reconnecting client could resume.
|
|
11
|
+
*/
|
|
12
|
+
export declare class McpEventStream extends EventStream {
|
|
13
|
+
/** Below any common proxy idle timeout, so a slow tool does not have its connection reaped mid-work. */
|
|
14
|
+
static readonly keepAliveMs = 15000;
|
|
15
|
+
constructor(onCancel: () => void);
|
|
16
|
+
write(message: object): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { EndpointInfo } from "../../signal/endpointInfo.d.ts";
|
|
2
|
+
import { HttpExecutionContext } from "../../signal/signalContext.d.ts";
|
|
3
|
+
/**
|
|
4
|
+
* An argument the caller can fix, carrying a 400 so the dispatcher reports it as a tool error rather than as a
|
|
5
|
+
* server failure. Everything that rejects an argument — the nullable check, `ID._parse`, a scalar's own
|
|
6
|
+
* validator — throws a bare `Error`, and a bare `Error` is indistinguishable from a crash.
|
|
7
|
+
*/
|
|
8
|
+
export declare class McpArgumentError extends Error {
|
|
9
|
+
readonly statusCode = 400;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Runs an endpoint for an MCP call while staying an HTTP context.
|
|
13
|
+
*
|
|
14
|
+
* MCP arrives over HTTP and the whole authorization stack reads the request through this context —
|
|
15
|
+
* `AccountMiddleware` resolves the bearer token off `getHttpContext().req`, and `Self`/`Me` and every guard read
|
|
16
|
+
* what it left there. A transport of its own would not adapt that stack, it would bypass it.
|
|
17
|
+
*/
|
|
18
|
+
export declare class McpExecutionContext extends HttpExecutionContext {
|
|
19
|
+
#private;
|
|
20
|
+
constructor(req: Request, args: Record<string, unknown>);
|
|
21
|
+
/**
|
|
22
|
+
* MCP passes one flat named object, so `param`/`search`/`body` all resolve by name from the same place. An
|
|
23
|
+
* absent value becomes `null` to match what a missing query string yields, letting `deserialize` apply the
|
|
24
|
+
* same nullability rules an HTTP call gets.
|
|
25
|
+
*
|
|
26
|
+
* A name nobody declared is the caller's mistake and is reported as one. `additionalProperties: false` travels
|
|
27
|
+
* in the published schema, but this server does not validate against it and plenty of clients do not either —
|
|
28
|
+
* so reading only the declared names dropped the rest in silence: `{ category, status }` on a slice that takes
|
|
29
|
+
* only `category` came back as a successful, unfiltered list, which a model reads as the filter having applied.
|
|
30
|
+
*
|
|
31
|
+
* "Declared" means what the *published schema* declares, which is why an `Any` argument counts as absent here.
|
|
32
|
+
* It is deliberately left out of that schema — the empty schema tells a model nothing — and the root list's raw
|
|
33
|
+
* `query` descriptor is the one that matters: read as sent, an agent could hand any model exposed through
|
|
34
|
+
* `mcp: { list: true }` an arbitrary query, which is precisely the narrowing a named filter slice exists to make
|
|
35
|
+
* deliberate. `additionalProperties: false` was never going to stop that on its own.
|
|
36
|
+
*/
|
|
37
|
+
getArgs(endpointInfo: EndpointInfo): Promise<unknown[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the serialized value rather than a `Response`, so the router can put it straight into a JSON-RPC
|
|
40
|
+
* result. The `Response` in the signature is the base class's; `WebSocketExecutionContext` widens it the same
|
|
41
|
+
* way, and `SignalContext` only ever hands this value back to its caller.
|
|
42
|
+
*/
|
|
43
|
+
makeResponse(result: unknown, endpointInfo: EndpointInfo): Response;
|
|
44
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type BackendEnv } from "akanjs/base";
|
|
2
|
+
import { Logger } from "akanjs/common";
|
|
3
|
+
import type { InjectRegistry, LiveRegistry } from "akanjs/service";
|
|
4
|
+
import type { MiddlewareCls } from "../../signal/middleware.d.ts";
|
|
5
|
+
import type { HttpRoutes } from "../types.d.ts";
|
|
6
|
+
import { type McpAuthOption } from "./McpAuth.d.ts";
|
|
7
|
+
export interface McpRouterProps {
|
|
8
|
+
registry: InjectRegistry;
|
|
9
|
+
/** Spread into every `SignalContext` this router's dispatcher builds; middleware reads it. */
|
|
10
|
+
env: BackendEnv;
|
|
11
|
+
live: LiveRegistry;
|
|
12
|
+
middleware: Map<string, MiddlewareCls>;
|
|
13
|
+
path?: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
/** Free-text usage guidance handed to the model alongside the tool list. */
|
|
16
|
+
instructions?: string;
|
|
17
|
+
/** Extra origins allowed past the DNS-rebinding check, beyond the server's own host. */
|
|
18
|
+
allowedOrigins?: string[];
|
|
19
|
+
readOnly?: boolean;
|
|
20
|
+
/** Entries per catalogue page. A client that wants the whole list follows `nextCursor` until it stops. */
|
|
21
|
+
pageSize?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The one language every title, description and domain error text is resolved in. The catalogue is built once
|
|
24
|
+
* at boot and cached by clients, so it is a server-wide choice rather than a per-request one: `Accept-Language`
|
|
25
|
+
* would mean a document per language, re-deriving every tool schema, for a surface a model reads and a human
|
|
26
|
+
* rarely sees. Defaults to `en`, falling back to the first registered language when the app has no `en`.
|
|
27
|
+
*/
|
|
28
|
+
language?: string;
|
|
29
|
+
/** Whether a structured result also ships as serialized JSON in the text block. Default `true`. */
|
|
30
|
+
legacyTextBlock?: boolean;
|
|
31
|
+
auth?: McpAuthOption;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Serves the app's signals as one MCP endpoint.
|
|
35
|
+
*
|
|
36
|
+
* Answers both protocol eras from the same stateless handler. `2026-07-28` is stateless by design; the legacy
|
|
37
|
+
* revisions only *offer* sessions — a server may decline to issue `Mcp-Session-Id`, and a client that never
|
|
38
|
+
* receives one neither sends one back nor asks to resume a stream. So the legacy era costs an `initialize` reply
|
|
39
|
+
* and a laxer `_meta` check, not a session store. (Measured against Claude Code 2.1.226, which speaks it.)
|
|
40
|
+
*/
|
|
41
|
+
export declare class McpRouter {
|
|
42
|
+
#private;
|
|
43
|
+
static readonly logger: Logger;
|
|
44
|
+
/** Past this a listing is a meaningful slice of a model's window, which is where it becomes worth saying so. */
|
|
45
|
+
static readonly listingWarnBytes: number;
|
|
46
|
+
constructor(props: McpRouterProps);
|
|
47
|
+
createRoutes(): HttpRoutes;
|
|
48
|
+
/**
|
|
49
|
+
* Says once, at boot, what this build actually published — and names every endpoint that was kept out.
|
|
50
|
+
*
|
|
51
|
+
* The rejections are fail-closed by design: an endpoint MCP cannot carry, or whose guards do not admit it, is
|
|
52
|
+
* simply not in the catalogue. That is the right default and the wrong silence, and it matters more now that
|
|
53
|
+
* exposure follows the guards — nobody wrote an opt-in whose absence would explain a missing tool, so this log
|
|
54
|
+
* is the only place the answer exists. A refusal turns on a resolved return type and a resolved guard list, so
|
|
55
|
+
* it reads only from here.
|
|
56
|
+
*
|
|
57
|
+
* An entry published with no description rides here for the same reason: the text every generated entry borrows
|
|
58
|
+
* is a *model* `.desc()`, which no source rule would read as that entry's description. This holds the resolved
|
|
59
|
+
* catalogue, so it can simply look.
|
|
60
|
+
*
|
|
61
|
+
* Called by whatever mounts the router rather than from `createRoutes`, so building a router to answer one
|
|
62
|
+
* request — which tests and tooling do — does not narrate a catalogue nobody asked about.
|
|
63
|
+
*/
|
|
64
|
+
report(): void;
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./mcp/index.d.ts";
|