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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type BackendEnv } from "akanjs/base";
|
|
2
2
|
import { Logger } from "akanjs/common";
|
|
3
3
|
import { type InjectRegistry, type LiveRegistry, type WebsocketAdaptor } from "akanjs/service";
|
|
4
4
|
import { type Endpoint, type EndpointCls } from "../../signal/endpoint.d.ts";
|
|
@@ -7,12 +7,13 @@ import type { InternalInfo } from "../../signal/internalInfo.d.ts";
|
|
|
7
7
|
import type { MiddlewareCls } from "../../signal/middleware.d.ts";
|
|
8
8
|
import type { ServerSignalCls } from "../../signal/serverSignal.d.ts";
|
|
9
9
|
import type { SliceCls } from "../../signal/slice.d.ts";
|
|
10
|
-
import type { SignalRoutes } from "../types.d.ts";
|
|
10
|
+
import type { HttpRoutes, LocalPublish, SignalRoutes } from "../types.d.ts";
|
|
11
11
|
export declare class SignalResolver {
|
|
12
12
|
#private;
|
|
13
13
|
static logger: Logger;
|
|
14
14
|
static makeRoomId(key: string, args: unknown[]): string;
|
|
15
|
-
static
|
|
15
|
+
static coalescesRoom(roomId: string): boolean;
|
|
16
|
+
static setLocalPublish(localPublish: LocalPublish, websocket: WebsocketAdaptor): void;
|
|
16
17
|
static resolveServerSignal(serverSignalCls: ServerSignalCls, { registry, live }: {
|
|
17
18
|
registry: InjectRegistry;
|
|
18
19
|
live: LiveRegistry;
|
|
@@ -24,9 +25,11 @@ export declare class SignalResolver {
|
|
|
24
25
|
placement: boolean;
|
|
25
26
|
} | null;
|
|
26
27
|
static resolveSlice(sliceCls: SliceCls): EndpointCls;
|
|
28
|
+
/** Same rule across endpoint classes, which are resolved one at a time and then folded into one table. */
|
|
29
|
+
static mergeHttpRoutes(target: HttpRoutes, source: HttpRoutes): void;
|
|
27
30
|
static resolveEndpoint(endpointCls: EndpointCls, endpoint: Endpoint, { registry, env, live, middleware, }: {
|
|
28
31
|
registry: InjectRegistry;
|
|
29
|
-
env:
|
|
32
|
+
env: BackendEnv;
|
|
30
33
|
live: LiveRegistry;
|
|
31
34
|
middleware: Map<string, MiddlewareCls>;
|
|
32
35
|
}): SignalRoutes;
|
|
@@ -37,6 +37,7 @@ export interface WebsocketHandlersInputs {
|
|
|
37
37
|
hmrHub: HmrWsHub | null;
|
|
38
38
|
hmrState: HmrStateSource | null;
|
|
39
39
|
logger: Logger;
|
|
40
|
+
onDrain?: () => void;
|
|
40
41
|
}
|
|
41
42
|
type WsTaggedData = {
|
|
42
43
|
kind?: string;
|
|
@@ -56,6 +57,6 @@ export declare class ApiRouter {
|
|
|
56
57
|
* - `kind === "akan-hmr"` — dev HMR, delegated to `HmrWsHub`.
|
|
57
58
|
* - everything else — app signal channel, dispatched via `wsRoutes`.
|
|
58
59
|
*/
|
|
59
|
-
static buildWebsocketHandlers({ wsRoutes, registry, hmrHub, hmrState, logger, }: WebsocketHandlersInputs): Bun.WebSocketHandler<WsTaggedData>;
|
|
60
|
+
static buildWebsocketHandlers({ wsRoutes, registry, hmrHub, hmrState, logger, onDrain, }: WebsocketHandlersInputs): Bun.WebSocketHandler<WsTaggedData>;
|
|
60
61
|
}
|
|
61
62
|
export {};
|
|
@@ -19,6 +19,18 @@ export declare class AppWsData {
|
|
|
19
19
|
account?: unknown;
|
|
20
20
|
/** The `authorization` value `account` was resolved from, so each frame need not re-verify it. */
|
|
21
21
|
resolvedAuthorization?: string;
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Identity of this connection, minted here so every app socket carries one from its first frame and
|
|
24
|
+
* adaptors and endpoints only ever read it. Per-connection and process-local — a reconnect gets a new
|
|
25
|
+
* one, and the federation gateway's own socket is a different one — so it is never a caller identity.
|
|
26
|
+
* It outlives a credential swap on purpose: the socket is still the same socket.
|
|
27
|
+
*/
|
|
28
|
+
socketId: string;
|
|
29
|
+
/** The caller's address as the nearest proxy recorded it, or null when nothing did. */
|
|
30
|
+
get ip(): string | null;
|
|
31
|
+
/** The caller's source port as the nearest proxy recorded it, or null when nothing did. */
|
|
32
|
+
get port(): number | null;
|
|
33
|
+
/** The address to answer on: what a proxy recorded, else this socket's own peer. */
|
|
34
|
+
ipOf(ws: Bun.ServerWebSocket<unknown>): string | null;
|
|
23
35
|
constructor(headers: Headers);
|
|
24
36
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface EventStreamOptions {
|
|
2
|
+
keepAliveMs?: number;
|
|
3
|
+
/** What the keep-alive sends; a line starting with `:` is a comment every SSE client discards. */
|
|
4
|
+
keepAliveChunk?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* One `text/event-stream` response. `write` frames a JSON `data:` event, with an `id:` when the caller has one
|
|
8
|
+
* so a client can resume with `Last-Event-ID`; `retry` tells it how long to wait before doing so. A keep-alive
|
|
9
|
+
* comment goes out on an interval below common proxy idle timeouts, so a quiet stream is not reaped mid-life.
|
|
10
|
+
*/
|
|
11
|
+
export declare class EventStream {
|
|
12
|
+
#private;
|
|
13
|
+
static readonly defaultKeepAliveMs = 15000;
|
|
14
|
+
constructor(onCancel: () => void, { keepAliveMs, keepAliveChunk }?: EventStreamOptions);
|
|
15
|
+
get open(): boolean;
|
|
16
|
+
response(headers?: {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
}): Response;
|
|
19
|
+
write(message: object, id?: string | number): void;
|
|
20
|
+
comment(text: string): void;
|
|
21
|
+
retry(ms: number): void;
|
|
22
|
+
close(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AkanChildRole, AkanMetricsReport } from "akanjs/service";
|
|
2
|
+
import type { HttpRoutes } from "../types.d.ts";
|
|
3
|
+
export interface SoloAppStatus {
|
|
4
|
+
role: AkanChildRole;
|
|
5
|
+
running: boolean;
|
|
6
|
+
status: string;
|
|
7
|
+
port: number | null;
|
|
8
|
+
metrics: AkanMetricsReport;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The gateway's `/_akan/app/*` surface, answered by a process nothing is proxying. The payload keeps the
|
|
12
|
+
* gateway's own shape — a `children` array with this process as its only entry — so a probe, a k8s check and
|
|
13
|
+
* `akan` tooling read one contract whether or not a gateway is in front.
|
|
14
|
+
*/
|
|
15
|
+
export declare const createSoloAppRoutes: (read: () => SoloAppStatus, logStream?: {
|
|
16
|
+
handle(req: Request): Response;
|
|
17
|
+
} | null) => HttpRoutes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AkanI18nConfig } from "akanjs/common";
|
|
1
|
+
import { type AkanI18nConfig, type LogRecord } from "akanjs/common";
|
|
2
2
|
import type { AkanTheme } from "akanjs/fetch";
|
|
3
3
|
import type { AkanMetricsReport } from "akanjs/service";
|
|
4
4
|
import type { ClientManifest } from "./artifact.d.ts";
|
|
@@ -113,6 +113,8 @@ export interface RscWorkerOptions {
|
|
|
113
113
|
export declare class RscWorker {
|
|
114
114
|
#private;
|
|
115
115
|
readonly ready: Promise<void>;
|
|
116
|
+
/** Set by the replica: where the worker's forwarded log records go (its hub, or up to the gateway). */
|
|
117
|
+
onLogRecords: ((records: LogRecord[], dropped: number) => void) | null;
|
|
116
118
|
constructor(artifact: BaseBuildArtifact);
|
|
117
119
|
render(req: Request): ReadableStream<Uint8Array>;
|
|
118
120
|
renderWithMeta(req: Request, options?: {
|
|
@@ -121,6 +123,7 @@ export declare class RscWorker {
|
|
|
121
123
|
}): Promise<RscRenderResult>;
|
|
122
124
|
invalidateRouteResultCache(invalidation?: string | RouteCacheInvalidation): void;
|
|
123
125
|
kill(): void;
|
|
126
|
+
setLogLevel(minSev: number | null): void;
|
|
124
127
|
getMetrics(): AkanMetricsReport;
|
|
125
128
|
restartWhenIdle(reason: string): boolean;
|
|
126
129
|
/**
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface SubRouteIndexOptions {
|
|
3
|
+
locale: string;
|
|
4
|
+
basePaths: string[];
|
|
5
|
+
subRoutes?: Record<string, string[]>;
|
|
6
|
+
}
|
|
7
|
+
export declare const getSubRouteIndexHref: (locale: string, basePath: string) => string;
|
|
8
|
+
export declare function createSubRouteIndexDocument({ locale, basePaths, subRoutes }: SubRouteIndexOptions): ReactNode;
|
|
@@ -32,6 +32,7 @@ export declare const SYSTEM_PAGE_STATUS_COPY: {
|
|
|
32
32
|
readonly actionLabel: "Back to safety";
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
+
export declare const SYSTEM_PAGE_STYLE = "\n:root { color-scheme: dark; --akan-primary: #ff493b; --akan-secondary: #2b2e33; --akan-accent: #d1a23b; --akan-foreground: #ffffff; --akan-background: #1a1a1a; --akan-error: #f02020; }\nbody { margin: 0; min-height: 100vh; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; background: var(--akan-background); color: var(--akan-foreground); }\na { color: inherit; }\n.akan-system-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; box-sizing: border-box; background: radial-gradient(circle at top left, rgba(255, 73, 59, 0.16), transparent 34%), linear-gradient(135deg, var(--akan-background), #111); }\n.akan-system-card { width: min(720px, 100%); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 32px; background: linear-gradient(145deg, rgba(42, 42, 42, 0.96), rgba(43, 46, 51, 0.78)); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36); padding: clamp(28px, 6vw, 56px); }\n.akan-system-status { margin: 0 0 18px; font-weight: 800; font-size: clamp(4rem, 18vw, 8rem); line-height: 0.85; letter-spacing: -0.08em; color: var(--akan-primary); }\n.akan-system-eyebrow { margin: 0 0 10px; color: var(--akan-accent); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }\n.akan-system-title { margin: 0; max-width: 12ch; font-size: clamp(2rem, 7vw, 4rem); line-height: 0.95; letter-spacing: -0.055em; color: var(--akan-foreground); }\n.akan-system-description { margin: 22px 0 0; max-width: 56ch; color: rgba(255, 255, 255, 0.76); font-size: 1.05rem; line-height: 1.75; }\n.akan-system-path { margin: 22px 0 0; overflow-wrap: anywhere; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; background: rgba(26, 26, 26, 0.72); padding: 12px 14px; color: rgba(255, 255, 255, 0.72); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.88rem; }\n.akan-system-actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }\n.akan-system-action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--akan-primary); border-radius: 999px; background: var(--akan-primary); box-shadow: 0 12px 34px rgba(255, 73, 59, 0.26); color: var(--akan-foreground); padding: 0 18px; font-weight: 800; text-decoration: none; }\n.akan-system-secondary { border: 1px solid rgba(255, 255, 255, 0.12); background: var(--akan-secondary); color: var(--akan-foreground); }\n.akan-system-details { margin-top: 28px; max-height: 260px; overflow: auto; border-radius: 18px; background: rgba(26, 26, 26, 0.82); border: 1px solid rgba(240, 32, 32, 0.22); padding: 16px; color: rgba(255, 255, 255, 0.78); font-size: 0.82rem; line-height: 1.55; white-space: pre-wrap; }\n";
|
|
35
36
|
export declare function createSystemPageDocument(options: SystemPageOptions): ReactNode;
|
|
36
37
|
export declare function getSystemPageErrorDetails(error: unknown): string;
|
|
37
38
|
export declare function getSystemPageHomeHref({ pathname, i18n, basePaths, headerBasePath, }: SystemPageHomeHrefOptions): string;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { type SubRouteIndexOptions } from "./subRouteIndexDocument.d.ts";
|
|
1
2
|
import { type SystemPageKind, type SystemPageOptions } from "./systemPageDocument.d.ts";
|
|
2
3
|
export interface SystemPageResponseOptions extends SystemPageOptions {
|
|
3
4
|
method?: string;
|
|
4
5
|
}
|
|
6
|
+
export interface SubRouteIndexResponseOptions extends SubRouteIndexOptions {
|
|
7
|
+
method?: string;
|
|
8
|
+
}
|
|
5
9
|
export { createSystemPageDocument, getSystemPageHomeHref } from "./systemPageDocument.d.ts";
|
|
6
10
|
export declare function createSystemPageResponse(options: SystemPageResponseOptions): Promise<Response>;
|
|
11
|
+
export declare function createSubRouteIndexResponse(options: SubRouteIndexResponseOptions): Promise<Response>;
|
|
7
12
|
export declare function createSystemPageHeaders(): Headers;
|
|
8
13
|
export declare function createSystemPageFallbackText(kind: SystemPageKind): string;
|
package/types/server/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AkanWebConfig } from "akanjs";
|
|
1
2
|
import type { PromiseOrObject } from "akanjs/base";
|
|
2
3
|
import type { AkanI18nConfig } from "akanjs/common";
|
|
3
4
|
import type { ClientManifest } from "./artifact.d.ts";
|
|
@@ -5,6 +6,7 @@ import type { SsrManifest } from "./ssrTypes.d.ts";
|
|
|
5
6
|
export type WebsocketRoute = (ws: Bun.ServerWebSocket<unknown>, data: unknown[], event?: "message" | "subscribe" | "unsubscribe") => PromiseOrObject<unknown>;
|
|
6
7
|
export type WebsocketRoutes = Record<string, WebsocketRoute>;
|
|
7
8
|
export type HttpRoutes = Bun.Serve.Options<unknown>["routes"];
|
|
9
|
+
export type LocalPublish = (roomId: string, data: object | object[] | Uint8Array) => void;
|
|
8
10
|
export interface SignalRouteOptions {
|
|
9
11
|
globalPrefix?: false;
|
|
10
12
|
}
|
|
@@ -39,6 +41,8 @@ export interface AkanImageConfig {
|
|
|
39
41
|
maximumRedirects: number;
|
|
40
42
|
fetchTimeoutMs: number;
|
|
41
43
|
maxRemoteBytes: number;
|
|
44
|
+
/** Concurrent encodes; `0` sizes it from the CPUs the serving process sees, which the build machine's count is not. */
|
|
45
|
+
maxConcurrency: number;
|
|
42
46
|
}
|
|
43
47
|
export declare const defaultAkanImageConfig: AkanImageConfig;
|
|
44
48
|
export declare function mergeAkanImageConfig(config?: Partial<AkanImageConfig>): AkanImageConfig;
|
|
@@ -60,7 +64,19 @@ export type BaseBuildArtifact = {
|
|
|
60
64
|
i18n: AkanI18nConfig;
|
|
61
65
|
imageConfig: AkanImageConfig;
|
|
62
66
|
deepLinkAssociations?: MobileDeepLinkAssociation[];
|
|
67
|
+
/**
|
|
68
|
+
* Which surfaces this artifact was built for. Absent on an artifact written before the option existed,
|
|
69
|
+
* which is read as both on — the shape every such build actually has.
|
|
70
|
+
*/
|
|
71
|
+
web?: AkanWebConfig;
|
|
63
72
|
};
|
|
73
|
+
export declare const resolveWebConfig: (web: Partial<AkanWebConfig> | undefined) => AkanWebConfig;
|
|
74
|
+
/**
|
|
75
|
+
* `AKAN_SSR` / `AKAN_CSR`, both on unless the env says otherwise — the same shape `AKAN_MCP` uses, because a
|
|
76
|
+
* switch a deployment has to find before anything works is a switch most deployments never find. Read by the
|
|
77
|
+
* gateway and by every replica, so both agree on what the pod serves.
|
|
78
|
+
*/
|
|
79
|
+
export declare const getWebConfigFromEnv: () => AkanWebConfig;
|
|
64
80
|
export interface MobileDeepLinkAssociation {
|
|
65
81
|
targetName: string;
|
|
66
82
|
appId: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "akanjs/fetch";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AkanWebConfig } from "akanjs";
|
|
2
|
+
import { type AkanI18nConfig, type LogRecord } from "akanjs/common";
|
|
2
3
|
import { type AkanRequestStore } from "akanjs/fetch";
|
|
3
4
|
import type { AkanMetricsReport } from "akanjs/service";
|
|
4
5
|
import { type BuilderRpc, type RouteSeedIndex } from "./artifact.d.ts";
|
|
5
6
|
import { type RouteCacheInvalidation, type RouteCacheRenderState } from "./cachePolicy.d.ts";
|
|
6
7
|
import type { HmrWsData, HmrWsHub } from "./hmr/wsHub.d.ts";
|
|
7
8
|
import { type RscRedirectMethod, type RscRedirectStatus, type RscRenderResult, RscWorker } from "./rscWorkerHost.d.ts";
|
|
8
|
-
import type
|
|
9
|
+
import { type BaseBuildArtifact, type HttpRoutes, type RenderState } from "./types.d.ts";
|
|
9
10
|
export declare const DEFAULT_HTML_RESULT_CACHE_MAX_BODY_BYTES: number;
|
|
10
11
|
export declare function createRscRedirectResponse(location: string, method: RscRedirectMethod, status?: RscRedirectStatus): Response;
|
|
11
12
|
export declare function createRscStreamResponse(stream: BodyInit, status?: number): Response;
|
|
@@ -49,10 +50,12 @@ export interface SsrRoutesResult {
|
|
|
49
50
|
builderRpc: BuilderRpc | null;
|
|
50
51
|
}
|
|
51
52
|
export interface SsrRoutesInputs {
|
|
53
|
+
web: AkanWebConfig;
|
|
52
54
|
upgradeHmrWs: (req: Request, data: HmrWsData) => boolean;
|
|
53
55
|
}
|
|
54
56
|
interface WebRouterOptions {
|
|
55
57
|
artifact: BaseBuildArtifact;
|
|
58
|
+
web: AkanWebConfig;
|
|
56
59
|
cssBytesByUrl: Record<string, Uint8Array>;
|
|
57
60
|
rsc: RscWorker;
|
|
58
61
|
seedIndex: RouteSeedIndex;
|
|
@@ -61,16 +64,24 @@ interface WebRouterOptions {
|
|
|
61
64
|
export declare class WebRouter {
|
|
62
65
|
#private;
|
|
63
66
|
renderState: RenderState;
|
|
64
|
-
|
|
67
|
+
/** What this router actually mounts, already intersected with what the artifact carries. */
|
|
68
|
+
readonly web: AkanWebConfig;
|
|
69
|
+
constructor({ artifact, web, cssBytesByUrl, rsc, seedIndex, upgradeHmrWs }: WebRouterOptions);
|
|
65
70
|
initializeRoute(): Promise<{
|
|
66
71
|
renderEnvRoutes: Bun.Serve.Routes<unknown, string> | Bun.Serve.RoutesWithUpgrade<unknown, string>;
|
|
67
72
|
hmrHub: HmrWsHub | null;
|
|
68
73
|
builderRpc: BuilderRpc | null;
|
|
69
74
|
}>;
|
|
70
75
|
dispose(): void;
|
|
76
|
+
setLogLevel(minSev: number | null): void;
|
|
77
|
+
onLogRecords(listener: (records: LogRecord[], dropped: number) => void): void;
|
|
71
78
|
getMetrics(): AkanMetricsReport;
|
|
72
79
|
/** @internal Clears or scopes invalidation for local route result caches owned by the host and RSC worker. */
|
|
73
80
|
invalidateRouteCaches(invalidation?: string | RouteCacheInvalidation): void;
|
|
74
|
-
|
|
81
|
+
/**
|
|
82
|
+
* `null` when the build produced no web artifact — an api-only build, or a workspace with no `page/` at all.
|
|
83
|
+
* The caller boots without a web surface instead of failing on the missing file.
|
|
84
|
+
*/
|
|
85
|
+
static create({ web, upgradeHmrWs }: SsrRoutesInputs): Promise<WebRouter | null>;
|
|
75
86
|
}
|
|
76
87
|
export {};
|
package/types/service/adapt.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Logger } from "akanjs/common";
|
|
|
3
3
|
import { type ExtractInjectInfoObject, type InjectBuilder, type InjectInfo } from "./injectInfo.d.ts";
|
|
4
4
|
export interface Adaptor {
|
|
5
5
|
readonly logger: Logger;
|
|
6
|
-
onInit(): Promise<void
|
|
7
|
-
onDestroy(): Promise<void
|
|
6
|
+
onInit(): Promise<void> | void;
|
|
7
|
+
onDestroy(): Promise<void> | void;
|
|
8
8
|
}
|
|
9
9
|
export type AdaptorCls<Methods = any, InjectMap extends Record<string, InjectInfo> = {}> = Cls<Methods & ExtractInjectInfoObject<InjectMap> & Adaptor, {
|
|
10
10
|
readonly [INJECT_META]: InjectMap;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LlmAccepts, LlmTurnRequest } from "./predefinedAdaptor/llm.adaptor";
|
|
2
|
+
declare const AgentService_base: import("./serve.d.ts").ServiceCls<"agent", {}, {
|
|
3
|
+
llm: import("./injectInfo.d.ts").InjectInfo<"plug", import("./predefinedAdaptor.d.ts").LlmAdaptor, never, never>;
|
|
4
|
+
}>;
|
|
5
|
+
export declare class AgentService extends AgentService_base {
|
|
6
|
+
runTurn(request: LlmTurnRequest, onDelta?: (delta: string) => void): Promise<{
|
|
7
|
+
text: string;
|
|
8
|
+
toolCalls: import("./predefinedAdaptor.d.ts").AgentWireToolCall[];
|
|
9
|
+
stop: "end" | "toolUse";
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Folds a failed turn into the message text. `error` is a field only this wire has, so a provider mapping reads
|
|
13
|
+
* `text` and drops it — leaving the model an assistant turn that says nothing, with no hint that the attempt
|
|
14
|
+
* failed, and every reason to make the same one again. Done here rather than per adaptor because every adaptor
|
|
15
|
+
* would otherwise have to remember, and forgetting is silent.
|
|
16
|
+
*/
|
|
17
|
+
static explained(request: LlmTurnRequest): LlmTurnRequest;
|
|
18
|
+
private static explainedMessage;
|
|
19
|
+
/**
|
|
20
|
+
* Replaces every attachment the provider cannot read with a note naming it, so no adaptor has to think about
|
|
21
|
+
* attachments it does not support and none can lose one quietly. The model has to be *told*, not merely spared:
|
|
22
|
+
* a file that vanishes on the way in is one it answers about from the filename, confidently and wrongly.
|
|
23
|
+
*
|
|
24
|
+
* The note rides in the message text because that is the one field every provider mapping already reads.
|
|
25
|
+
*/
|
|
26
|
+
static readable(request: LlmTurnRequest, accepts: LlmAccepts | undefined): LlmTurnRequest;
|
|
27
|
+
private static readableMessage;
|
|
28
|
+
/** Extracted text is readable by every model there is; bytes and links need the provider to say so. */
|
|
29
|
+
private static isReadable;
|
|
30
|
+
private static note;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Base } from "akanjs/signal";
|
|
2
|
+
import { AgentService } from "./agent.service";
|
|
2
3
|
import { ServiceModel } from "./serviceModule.d.ts";
|
|
3
4
|
declare const BaseService_base: import("./serve.d.ts").ServiceCls<"base", {}, {
|
|
4
5
|
onCleanup: import("./injectInfo.d.ts").InjectInfo<"env", (() => Promise<void>) | undefined, {
|
|
@@ -13,5 +14,8 @@ export declare const srv: {
|
|
|
13
14
|
base: ServiceModel<typeof BaseService, any, any, {
|
|
14
15
|
baseService: BaseService;
|
|
15
16
|
}>;
|
|
17
|
+
agent: ServiceModel<typeof AgentService, any, any, {
|
|
18
|
+
agentService: AgentService;
|
|
19
|
+
}>;
|
|
16
20
|
};
|
|
17
21
|
export {};
|
package/types/service/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type BackendEnv } from "akanjs/base";
|
|
2
2
|
import { type ConstantFieldTypeInput, type FieldToValue, type PlainTypeToFieldType } from "akanjs/constant";
|
|
3
3
|
import type { DatabaseModel } from "akanjs/document";
|
|
4
4
|
import type { Endpoint, EndpointCls, Internal, InternalCls, ServerSignal, ServerSignalCls, SliceCls } from "akanjs/signal";
|
|
@@ -60,7 +60,7 @@ export declare class InjectInfo<Type extends InjectType = any, ReturnType = any,
|
|
|
60
60
|
readonly cacheOption?: CacheSetOptions;
|
|
61
61
|
readonly parentRefName: string;
|
|
62
62
|
constructor(type: Type, options: InjectBuilderOptions<ReturnType>);
|
|
63
|
-
static resolveInjection(instance: Adaptor | Service, applyCls: AdaptorCls | ServiceCls, registry: InjectRegistry, env:
|
|
63
|
+
static resolveInjection(instance: Adaptor | Service, applyCls: AdaptorCls | ServiceCls, registry: InjectRegistry, env: BackendEnv): Promise<void>;
|
|
64
64
|
}
|
|
65
65
|
type GetFieldValue<ValueRef, ExplicitType, MapValue = never> = unknown extends ExplicitType ? FieldToValue<ValueRef, MapValue> : ExplicitType;
|
|
66
66
|
export declare const injectionBuilder: (parentRefName: string) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LogRecord } from "akanjs/common";
|
|
1
2
|
export type AkanChildRole = "all" | "federation" | "batch";
|
|
2
3
|
export type AkanChildStatus = "starting" | "ready" | "healthy" | "draining" | "unhealthy" | "exited" | "crashed";
|
|
3
4
|
export type AkanUpstream = {
|
|
@@ -41,6 +42,7 @@ export interface AkanMetricsReport {
|
|
|
41
42
|
queueWakeCount?: number;
|
|
42
43
|
pubsubDeliverCount?: number;
|
|
43
44
|
pubsubDropCount?: number;
|
|
45
|
+
pubsubCoalesceCount?: number;
|
|
44
46
|
rssBytes?: number;
|
|
45
47
|
heapTotalBytes?: number;
|
|
46
48
|
heapUsedBytes?: number;
|
|
@@ -212,6 +214,16 @@ export type AkanIpcMessage = {
|
|
|
212
214
|
type: "metrics.report";
|
|
213
215
|
metrics: AkanMetricsReport;
|
|
214
216
|
pid?: number;
|
|
217
|
+
} | {
|
|
218
|
+
type: "log.records";
|
|
219
|
+
records: LogRecord[];
|
|
220
|
+
dropped?: number;
|
|
221
|
+
pid?: number;
|
|
222
|
+
}
|
|
223
|
+
/** Hub → child: the lowest severity any subscriber wants; `null` tells the child to stop forwarding. */
|
|
224
|
+
| {
|
|
225
|
+
type: "log.level";
|
|
226
|
+
minSev: number | null;
|
|
215
227
|
} | {
|
|
216
228
|
type: "shutdown";
|
|
217
229
|
signal?: string;
|
|
@@ -5,7 +5,7 @@ export interface CompressAdaptor {
|
|
|
5
5
|
}
|
|
6
6
|
declare const JsonCompressor_base: import("..").AdaptorCls<{}, {}>;
|
|
7
7
|
export declare class JsonCompressor extends JsonCompressor_base implements CompressAdaptor {
|
|
8
|
-
encode(
|
|
8
|
+
encode(ref: Cls, arrDepth: number, value: unknown): Buffer | null;
|
|
9
9
|
decode<T = unknown>(ref: Cls, arrDepth: number, buffer: Buffer, { raw }?: {
|
|
10
10
|
raw?: boolean;
|
|
11
11
|
}): T;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Database } from "bun:sqlite";
|
|
2
2
|
import type { Client as LibsqlClient } from "@libsql/client";
|
|
3
|
-
import { type
|
|
3
|
+
import { type PromiseOrObject } from "akanjs/base";
|
|
4
4
|
import { type ConstantModel } from "akanjs/constant";
|
|
5
5
|
import { type DatabaseModel, type DocumentQuery, type DocumentSchema, type DocumentUpdate, type DocumentUpdateInput, type DocumentUpdateOperator, type DocumentUpdateOptions, type SchemaOf } from "akanjs/document";
|
|
6
6
|
import type { Sql } from "postgres";
|
|
@@ -120,7 +120,7 @@ export interface DatabaseAdaptor {
|
|
|
120
120
|
transaction<T>(fn: () => PromiseOrObject<T>): Promise<T>;
|
|
121
121
|
getSearchIndex(): SearchIndex | null;
|
|
122
122
|
}
|
|
123
|
-
interface SqliteEnv
|
|
123
|
+
interface SqliteEnv {
|
|
124
124
|
workspaceRoot?: string;
|
|
125
125
|
database?: DatabaseConfig;
|
|
126
126
|
}
|
|
@@ -201,6 +201,8 @@ interface SqlDialect {
|
|
|
201
201
|
docColumn(): string;
|
|
202
202
|
docValuePlaceholder(): string;
|
|
203
203
|
extract(path: string): string;
|
|
204
|
+
projectExpr(path: string): string;
|
|
205
|
+
decodeProjected(value: unknown): unknown;
|
|
204
206
|
eq(path: string, value: unknown): SqlFrag;
|
|
205
207
|
ne(path: string, value: unknown): SqlFrag;
|
|
206
208
|
compare(path: string, op: "gt" | "gte" | "lt" | "lte", value: unknown): SqlFrag;
|
|
@@ -224,6 +226,8 @@ export declare class SqliteDialect implements SqlDialect {
|
|
|
224
226
|
docColumn(): string;
|
|
225
227
|
docValuePlaceholder(): string;
|
|
226
228
|
extract(path: string): string;
|
|
229
|
+
projectExpr(path: string): string;
|
|
230
|
+
decodeProjected(value: unknown): any;
|
|
227
231
|
eq(path: string, value: unknown): SqlFrag;
|
|
228
232
|
ne(path: string, value: unknown): SqlFrag;
|
|
229
233
|
compare(path: string, op: "gt" | "gte" | "lt" | "lte", value: unknown): SqlFrag;
|
|
@@ -247,6 +251,8 @@ export declare class PostgresDialect implements SqlDialect {
|
|
|
247
251
|
docColumn(): string;
|
|
248
252
|
docValuePlaceholder(): string;
|
|
249
253
|
extract(path: string): string;
|
|
254
|
+
projectExpr(path: string): string;
|
|
255
|
+
decodeProjected(value: unknown): unknown;
|
|
250
256
|
eq(path: string, value: unknown): SqlFrag;
|
|
251
257
|
ne(path: string, value: unknown): SqlFrag;
|
|
252
258
|
compare(path: string, op: "gt" | "gte" | "lt" | "lte", value: unknown): SqlFrag;
|
|
@@ -272,6 +278,7 @@ declare class QueryCompiler {
|
|
|
272
278
|
compile(query?: DocumentQuery): CompiledQuery;
|
|
273
279
|
orderBy(sort?: Record<string, 1 | -1>): string;
|
|
274
280
|
fieldExpr(path: string): string;
|
|
281
|
+
projectExpr(path: string): string;
|
|
275
282
|
private compileNode;
|
|
276
283
|
private compileField;
|
|
277
284
|
private assertPath;
|
|
@@ -379,7 +386,6 @@ export declare class SqlDocumentStore {
|
|
|
379
386
|
private findOneForWrite;
|
|
380
387
|
private pickByIdForWrite;
|
|
381
388
|
private writeUpdatedDocument;
|
|
382
|
-
private parseProjectedValue;
|
|
383
389
|
private decodeDocumentPayload;
|
|
384
390
|
private decodeFieldValue;
|
|
385
391
|
private decodeMapValue;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { AgentWireMessage, LlmAdaptor, LlmOption, LlmTurnAnswer, LlmTurnRequest } from "./llm.adaptor";
|
|
2
|
+
interface DeepseekToolCall {
|
|
3
|
+
id?: string;
|
|
4
|
+
function?: {
|
|
5
|
+
name?: string;
|
|
6
|
+
arguments?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
interface DeepseekAnswer {
|
|
10
|
+
choices?: {
|
|
11
|
+
message?: {
|
|
12
|
+
content?: string | null;
|
|
13
|
+
tool_calls?: DeepseekToolCall[];
|
|
14
|
+
};
|
|
15
|
+
finish_reason?: string;
|
|
16
|
+
}[];
|
|
17
|
+
}
|
|
18
|
+
interface DeepseekMessage {
|
|
19
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
20
|
+
content: string;
|
|
21
|
+
tool_calls?: {
|
|
22
|
+
id: string;
|
|
23
|
+
type: "function";
|
|
24
|
+
function: {
|
|
25
|
+
name: string;
|
|
26
|
+
arguments: string;
|
|
27
|
+
};
|
|
28
|
+
}[];
|
|
29
|
+
tool_call_id?: string;
|
|
30
|
+
}
|
|
31
|
+
declare const DeepseekLlm_base: import("..").AdaptorCls<{}, {
|
|
32
|
+
llmOption: import("..").InjectInfo<"use", LlmOption, never, never>;
|
|
33
|
+
}>;
|
|
34
|
+
export declare class DeepseekLlm extends DeepseekLlm_base implements LlmAdaptor {
|
|
35
|
+
#private;
|
|
36
|
+
chat(request: LlmTurnRequest, onDelta?: (delta: string) => void): Promise<LlmTurnAnswer | null>;
|
|
37
|
+
/**
|
|
38
|
+
* The dialect answers a refusal as `{ error: { message } }`, and that sentence is the useful half — a request
|
|
39
|
+
* past the context window says exactly which limit it passed. Carried on the `Err` so the chat can print it.
|
|
40
|
+
*/
|
|
41
|
+
static refusal(response: Response): Promise<Error>;
|
|
42
|
+
static reasonOf(response: Response): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* The dialect streams `data: {chunk}` SSE lines ending with `data: [DONE]`. Tool calls arrive fragmented — the
|
|
45
|
+
* first fragment of an index carries id/name, later ones append to the arguments string — so they are assembled
|
|
46
|
+
* by index and parsed once at the end; only assistant text is worth reporting as it arrives.
|
|
47
|
+
*/
|
|
48
|
+
static consumeStream(body: ReadableStream<Uint8Array>, onDelta: (delta: string) => void): Promise<LlmTurnAnswer>;
|
|
49
|
+
/** DeepSeek speaks the OpenAI chat-completions dialect, so the wire→provider mapping lives here in one place. */
|
|
50
|
+
static requestBody(model: string, request: LlmTurnRequest, stream?: boolean): {
|
|
51
|
+
tools?: {
|
|
52
|
+
type: "function";
|
|
53
|
+
function: {
|
|
54
|
+
parameters: Record<string, unknown>;
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
58
|
+
}[] | undefined;
|
|
59
|
+
messages: DeepseekMessage[];
|
|
60
|
+
stream?: boolean | undefined;
|
|
61
|
+
model: string;
|
|
62
|
+
};
|
|
63
|
+
/** Context rides below the instructions framed as data — screen state must never read as directives. */
|
|
64
|
+
static systemPrompt({ instructions, context }: LlmTurnRequest): string;
|
|
65
|
+
static providerMessages(message: AgentWireMessage): DeepseekMessage[];
|
|
66
|
+
/**
|
|
67
|
+
* `accepts` is left undeclared, so by the time an attachment reaches here `AgentService.readable` has reduced it
|
|
68
|
+
* to its text and turned everything else into a note. Each block is labelled because a model handed two
|
|
69
|
+
* unlabelled documents can no longer cite either one.
|
|
70
|
+
*/
|
|
71
|
+
static userContent(message: AgentWireMessage): string;
|
|
72
|
+
static turnAnswer(answer: DeepseekAnswer): LlmTurnAnswer;
|
|
73
|
+
/** The provider sends arguments as a JSON string; an unparsable one becomes an empty call rather than a crash. */
|
|
74
|
+
static parsedArgs(raw: string | undefined): Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from "./cache.adaptor";
|
|
2
2
|
export * from "./compress.adaptor";
|
|
3
3
|
export * from "./database.adaptor";
|
|
4
|
+
export * from "./deepseekLlm.d.ts";
|
|
5
|
+
export * from "./insightQuery.d.ts";
|
|
6
|
+
export * from "./llm.adaptor";
|
|
4
7
|
export * from "./logging.adaptor";
|
|
5
8
|
export * from "./queue.adaptor";
|
|
6
9
|
export * from "./role.adaptor";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AkanSqlClient } from "./database.adaptor";
|
|
2
|
+
export interface InsightQueryOptions {
|
|
3
|
+
/** Rows to return at most. Clamped to `InsightQuery.maxRows`, which no caller can raise. */
|
|
4
|
+
limit?: number;
|
|
5
|
+
/** How long to wait for the driver, in ms. See the note on `#raced` for which dialects this can actually stop. */
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface InsightQueryResult {
|
|
9
|
+
columns: string[];
|
|
10
|
+
rows: Record<string, unknown>[];
|
|
11
|
+
/** The ceiling cut the answer short, so the caller knows not to read it as complete. */
|
|
12
|
+
truncated: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One read-only SQL statement, for an agent or an operator asking a question the domain endpoints cannot express.
|
|
16
|
+
*
|
|
17
|
+
* This is the layer-bypassing read, and every safeguard the framework has is bypassed with it — guards, soft delete,
|
|
18
|
+
* cascade, `_postRemove`, and the `hidden`/`secret` masking every other response path performs. So it is read-only
|
|
19
|
+
* by construction rather than by convention, and it is deliberately *not* wired to an endpoint here: the framework
|
|
20
|
+
* owns no guard strong enough to sit in front of it. An app that wants it writes the endpoint with its own
|
|
21
|
+
* `SuperAdmin`, the same way guards ship with the library that owns the model.
|
|
22
|
+
*
|
|
23
|
+
* Three things enforce read-only, and only the third is ours:
|
|
24
|
+
*
|
|
25
|
+
* 1. The statement is wrapped as a derived table — `SELECT * FROM (<sql>) AS "akanInsight" LIMIT ?`. Nothing but a
|
|
26
|
+
* query is legal in that position, in either dialect, so a write is a syntax error from the engine rather than a
|
|
27
|
+
* pattern this code had to recognise. A second statement smuggled behind `;` is a syntax error for the same
|
|
28
|
+
* reason, and the row ceiling rides along on the same wrapper.
|
|
29
|
+
* 2. A rejection before execution, so the caller reads why rather than a syntax error. It runs on the statement with
|
|
30
|
+
* comments and string literals removed, because that is what makes `-- ` and `'…'` unable to hide anything.
|
|
31
|
+
* 3. **`_doc` never crosses the boundary.** Every non-base field lives in that one JSON column, which is where the
|
|
32
|
+
* plan's "re-apply schema-based masking" runs into the fact that an arbitrary SELECT has no model to mask by. So
|
|
33
|
+
* the enforceable rule is the column itself: unnameable in the statement, dropped from the rows, and any cell
|
|
34
|
+
* that still arrives holding a JSON object or array is refused. An insight is made of scalars; a value that is
|
|
35
|
+
* not one is either a document or indistinguishable from it.
|
|
36
|
+
*
|
|
37
|
+
* What that costs is real and worth saying: this answers "how many, since when, grouped how" over base columns and
|
|
38
|
+
* the search mirror, and it cannot read a domain field. Field-level reads go through the domain tools, which mask.
|
|
39
|
+
*/
|
|
40
|
+
export declare class InsightQuery {
|
|
41
|
+
#private;
|
|
42
|
+
/** Not an option. A caller asking for more gets this, because the point is that no caller sets the ceiling. */
|
|
43
|
+
static readonly maxRows = 1000;
|
|
44
|
+
constructor(client: AkanSqlClient);
|
|
45
|
+
run(sql: string, { limit, timeoutMs }?: InsightQueryOptions): Promise<{
|
|
46
|
+
columns: string[];
|
|
47
|
+
rows: Record<string, unknown>[];
|
|
48
|
+
truncated: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
}
|