akanjs 3.0.1 → 3.0.2

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/base/base.ts +1 -1
  3. package/client/cookie.ts +4 -6
  4. package/common/Logger.ts +10 -0
  5. package/dictionary/base.dictionary.ts +7 -0
  6. package/dictionary/trans.ts +7 -1
  7. package/document/documentQuery.ts +6 -1
  8. package/document/index.ts +1 -0
  9. package/document/into.ts +15 -7
  10. package/document/liveRowScope.ts +79 -0
  11. package/fetch/client/fetchClient.ts +64 -12
  12. package/fetch/client/httpClient.ts +13 -4
  13. package/index.ts +22 -0
  14. package/package.json +1 -1
  15. package/server/akanOption.ts +20 -1
  16. package/server/akanServer.ts +5 -0
  17. package/server/mcp/McpAuth.ts +3 -2
  18. package/server/mcp/McpExecutionContext.ts +15 -14
  19. package/server/mcp/McpRateLimiter.ts +18 -67
  20. package/server/proxy/webProxyRunner.ts +2 -0
  21. package/server/resolver/database.resolver.ts +28 -13
  22. package/server/resolver/signal.resolver.ts +75 -35
  23. package/server/rscWorkerHost.ts +16 -7
  24. package/server/webRouter.ts +3 -0
  25. package/service/index.ts +1 -0
  26. package/service/predefinedAdaptor/index.ts +1 -0
  27. package/service/predefinedAdaptor/rateLimit.adaptor.ts +15 -0
  28. package/service/predefinedAdaptor/sql/SqlDocumentStore.ts +119 -27
  29. package/service/predefinedAdaptor/sql/types.ts +14 -12
  30. package/service/rateLimiter.ts +80 -0
  31. package/signal/base.signal.ts +7 -6
  32. package/signal/endpointRateLimit.ts +159 -0
  33. package/signal/index.ts +1 -0
  34. package/signal/middleware.ts +6 -5
  35. package/signal/serializer/fetch.serializer.ts +15 -4
  36. package/signal/signalContext.ts +148 -67
  37. package/signal/slice.ts +30 -9
  38. package/signal/types.ts +8 -0
  39. package/store/agent/AgentCursor.ts +2 -1
  40. package/test/signalTestRuntime.ts +2 -1
  41. package/types/base/base.d.ts +1 -1
  42. package/types/client/cookie.d.ts +1 -1
  43. package/types/common/Logger.d.ts +2 -0
  44. package/types/dictionary/base.dictionary.d.ts +1 -1
  45. package/types/dictionary/dictionary.d.ts +8 -8
  46. package/types/document/documentQuery.d.ts +5 -1
  47. package/types/document/index.d.ts +1 -0
  48. package/types/document/into.d.ts +7 -7
  49. package/types/document/liveRowScope.d.ts +9 -0
  50. package/types/fetch/client/fetchClient.d.ts +9 -1
  51. package/types/index.d.ts +32 -0
  52. package/types/server/akanOption.d.ts +7 -1
  53. package/types/server/mcp/McpExecutionContext.d.ts +4 -1
  54. package/types/server/mcp/McpRateLimiter.d.ts +2 -6
  55. package/types/server/rscWorkerHost.d.ts +3 -0
  56. package/types/service/index.d.ts +1 -0
  57. package/types/service/predefinedAdaptor/index.d.ts +1 -0
  58. package/types/service/predefinedAdaptor/rateLimit.adaptor.d.ts +10 -0
  59. package/types/service/predefinedAdaptor/sql/SqlDocumentStore.d.ts +6 -10
  60. package/types/service/predefinedAdaptor/sql/types.d.ts +13 -17
  61. package/types/service/rateLimiter.d.ts +24 -0
  62. package/types/signal/endpointRateLimit.d.ts +37 -0
  63. package/types/signal/index.d.ts +1 -0
  64. package/types/signal/signalContext.d.ts +33 -15
  65. package/types/signal/slice.d.ts +17 -5
  66. package/types/signal/types.d.ts +8 -0
  67. package/types/test/signalTestRuntime.d.ts +1 -1
  68. package/types/ui/recipe/buttonRecipe.d.ts +2 -2
  69. package/types/ui/recipe/inputRecipe.d.ts +3 -3
  70. package/types/vendor/@akanjs/native/packages/cli/src/config.d.ts +33 -0
  71. package/types/vendor/@akanjs/native/packages/cli/src/lib/bplist.d.ts +11 -0
  72. package/types/vendor/@akanjs/native/packages/cli/src/lib/dmg.d.ts +59 -0
  73. package/types/vendor/@akanjs/native/packages/cli/src/lib/dsStore.d.ts +26 -0
  74. package/types/vendor/@akanjs/native/packages/cli/src/lib/macAlias.d.ts +24 -0
  75. package/types/vendor/@akanjs/native/packages/cli/src/lib/macossigning.d.ts +0 -1
  76. package/types/vendor/@akanjs/native/packages/cli/src/lib/project.d.ts +3 -1
  77. package/types/vendor/@akanjs/native/packages/cli/src/platforms/linux-appimage.d.ts +6 -1
  78. package/types/vendor/@akanjs/native/packages/desktop/src/deeplinks.d.ts +9 -2
  79. package/types/webkit/RenderFailure.d.ts +6 -0
  80. package/ui/Input.tsx +7 -1
  81. package/ui/recipe/buttonRecipe.ts +1 -0
  82. package/ui/recipe/inputRecipe.ts +13 -7
  83. package/ui/styles.css +1 -0
  84. package/vendor/@akanjs/native/native/desktop/src/lib.rs +8 -1
  85. package/vendor/@akanjs/native/native/macos/dmg/background.html +18 -0
  86. package/vendor/@akanjs/native/native/macos/dmg/background.png +0 -0
  87. package/vendor/@akanjs/native/native/macos/dmg/background@2x.png +0 -0
  88. package/vendor/@akanjs/native/packages/cli/src/config.ts +23 -0
  89. package/vendor/@akanjs/native/packages/cli/src/lib/bplist.ts +91 -0
  90. package/vendor/@akanjs/native/packages/cli/src/lib/configkeys.ts +9 -0
  91. package/vendor/@akanjs/native/packages/cli/src/lib/dmg.ts +331 -0
  92. package/vendor/@akanjs/native/packages/cli/src/lib/dsStore.ts +191 -0
  93. package/vendor/@akanjs/native/packages/cli/src/lib/macAlias.ts +101 -0
  94. package/vendor/@akanjs/native/packages/cli/src/lib/macossigning.ts +1 -28
  95. package/vendor/@akanjs/native/packages/cli/src/lib/project.ts +6 -1
  96. package/vendor/@akanjs/native/packages/cli/src/platforms/linux-appimage.ts +17 -7
  97. package/vendor/@akanjs/native/packages/cli/src/platforms/linux.ts +6 -1
  98. package/vendor/@akanjs/native/packages/cli/src/platforms/macos.ts +5 -2
  99. package/vendor/@akanjs/native/packages/desktop/src/deeplinks.ts +33 -10
  100. package/vendor/@akanjs/native/packages/desktop/src/host.ts +1 -1
  101. package/webkit/RenderFailure.tsx +32 -0
  102. package/webkit/RenderLayer.tsx +22 -2
@@ -1,13 +1,13 @@
1
1
  import type { AgentEndpoint, AgentTurn, BaseEndpoint } from "akanjs/signal";
2
2
  export declare const dictionary: {
3
- base: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view">, "base.error.gatewayTimeout" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse">;
3
+ base: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "retry" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "pageLoadFailed" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view">, "base.error.gatewayTimeout" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse" | "base.error.immutableField">;
4
4
  agentTurn: import("./locale.d.ts").DictModule<import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc`, never>;
5
5
  agent: import("./locale.d.ts").DictModule<import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.contextOverflow" | "agent.error.quotaExceeded">;
6
6
  };
7
- export declare const Err: import("./trans.d.ts").ErrConstructor<"base.error.gatewayTimeout" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse" | "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.contextOverflow" | "agent.error.quotaExceeded">, translate: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja", key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, data?: import("./trans.d.ts").TranslationData) => string, msg: {
8
- error: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
9
- info: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
10
- warning: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
11
- success: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
12
- loading: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
13
- }, getDictionary: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja") => object, getAllDictionary: () => import("./trans.d.ts").RootDictionary, __Dict_Key__: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, __Error_Key__: "base.error.gatewayTimeout" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse" | "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.contextOverflow" | "agent.error.quotaExceeded";
7
+ export declare const Err: import("./trans.d.ts").ErrConstructor<"base.error.gatewayTimeout" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse" | "base.error.immutableField" | "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.contextOverflow" | "agent.error.quotaExceeded">, translate: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja", key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "retry" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "pageLoadFailed" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, data?: import("./trans.d.ts").TranslationData) => string, msg: {
8
+ error: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "retry" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "pageLoadFailed" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
9
+ info: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "retry" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "pageLoadFailed" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
10
+ warning: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "retry" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "pageLoadFailed" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
11
+ success: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "retry" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "pageLoadFailed" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
12
+ loading: (key: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "retry" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "pageLoadFailed" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, option?: import("./trans.d.ts").TransMessageOption) => void;
13
+ }, getDictionary: (lang: "en" | "ko" | (string & {}) | "zhChs" | "zhCht" | "ja") => object, getAllDictionary: () => import("./trans.d.ts").RootDictionary, __Dict_Key__: import("./locale.d.ts").ServiceTranslatorKey<"base", BaseEndpoint, "edit" | "error" | "ok" | "retry" | "approve" | "remove" | "unauthorized" | "save" | "refresh" | "password" | "agent" | "skip" | "stop" | "send" | "success" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "cameraPromptHeader" | "cameraPromptPhoto" | "cameraPromptPicture" | "cameraPromptCancel" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "pageLoadFailed" | "agentIntro" | "agentPlaceholder" | "agentClear" | "agentQuestion" | "agentToolCard" | "agentAnswer" | "agentListen" | "agentVoiceFailed" | "agentAttach" | "agentAttachRemove" | "agentAttachReading" | "agentReferenceRemove" | "agentReferenceFailed" | "agentAttachTooLarge" | "agentAttachUnsupported" | "agentAttachDuplicate" | "agentAttachTooMany" | "agentAttachTooMuch" | "agentAnswerNeeded" | "agentQueue" | "agentQueuePlaceholder" | "agentQueued" | "agentQueueEdit" | "agentQueueCancel" | "agentToolDone" | "agentToolFailed" | "agentToolRunning" | "agentToolResult" | "agentTokens" | "agentTokensOf" | "agentCompactsAt" | "agentSummarizing" | "agentContinue" | "agentKeepGoing" | "agentCmdNew" | "agentCmdRetry" | "agentCmdCompact" | "agentCmdCopy" | "agentCmdHelp" | "agentCmdTools" | "agentHelpIntro" | "agentHelpNote" | "agentNothingToRetry" | "agentNothingToCompact" | "agentCompacted" | "agentSummary" | "agentBusy" | "agentCopied" | "agentCopyFailed" | "agentToolsHead" | "agentToolsState" | "decline" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "noSelection" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "cardView" | "tableView" | "exportCsv" | "exportJson" | "actions" | "draftConflict" | "draftApplied" | "draftRestore" | "draftDiscard" | "draftStartOver" | "new" | "view"> | import("./locale.d.ts").ScalarTranslatorKey<"agentTurn", AgentTurn, never> | `agentStop.${string}` | `agentStop.${string}.desc` | import("./locale.d.ts").ServiceTranslatorKey<"agent", AgentEndpoint, never>, __Error_Key__: "base.error.gatewayTimeout" | "base.error.tooManyRequests" | "base.error.serverUnavailable" | "base.error.serverUnreachable" | "base.error.unexpectedResponse" | "base.error.immutableField" | "agent.error.llmUnavailable" | "agent.error.llmRequestFailed" | "agent.error.contextOverflow" | "agent.error.quotaExceeded";
@@ -51,7 +51,11 @@ export type DocumentUpdateValue = DocumentUpdateNode | DocumentPrimitive | Docum
51
51
  export type DocumentUpdate<T = any> = {
52
52
  [K in DocumentPath<T>]?: DocumentUpdateValue;
53
53
  };
54
- export interface DocumentUpdateOptions {
54
+ /** Server-only: no endpoint or slice builds it from a request, so a caller can never widen a read to removed rows. */
55
+ export interface DocumentScopeOptions {
56
+ withRemoved?: boolean;
57
+ }
58
+ export interface DocumentUpdateOptions extends DocumentScopeOptions {
55
59
  upsert?: boolean;
56
60
  }
57
61
  export declare const createDocumentUpdateHelper: () => {
@@ -6,6 +6,7 @@ export * from "./documentQuery.d.ts";
6
6
  export * from "./documentSchema.d.ts";
7
7
  export * from "./filterMeta.d.ts";
8
8
  export * from "./into.d.ts";
9
+ export * from "./liveRowScope.d.ts";
9
10
  export * from "./loaderInfo.d.ts";
10
11
  export * from "./noDocumentError.d.ts";
11
12
  export * from "./queryEvaluator.d.ts";
@@ -3,7 +3,7 @@ import type { DocumentModel, QueryOf } from "akanjs/constant";
3
3
  import type { FilterCls, FilterQueryOf, FilterSortOf } from ".";
4
4
  import type { CacheDatabase, QueryMethodPart } from "./database.d.ts";
5
5
  import type { DataLoader } from "./dataLoader.d.ts";
6
- import type { DocumentQuery, DocumentUpdateInput, DocumentUpdateOptions } from "./documentQuery.d.ts";
6
+ import type { DocumentQuery, DocumentScopeOptions, DocumentUpdateInput, DocumentUpdateOptions } from "./documentQuery.d.ts";
7
7
  import { type LoaderBuilder, type ModelCls } from "./loaderInfo.d.ts";
8
8
  import type { DocumentProjection } from "./types.d.ts";
9
9
  export type CRUDEventType = "create" | "update" | "remove";
@@ -46,13 +46,13 @@ type FindOneChain<Doc> = Promise<Doc | null> & {
46
46
  export type Mdl<Doc, Raw, _RawDoc = DocumentModel<Raw>, _RawQuery extends DocumentQuery<_RawDoc> = DocumentQuery<_RawDoc>, _Projection extends DocumentProjection<Raw> = DocumentProjection<Raw>> = DefaultMdlStats<Doc, _RawDoc, Partial<_RawDoc>, _RawQuery, _Projection> & {
47
47
  refName: string;
48
48
  new (data: Partial<_RawDoc> | Partial<Doc>): Doc;
49
- find(query: _RawQuery, projection?: _Projection): FindManyChain<Doc>;
50
- findOne(query: _RawQuery, projection?: _Projection): FindOneChain<Doc>;
51
- findById(id: string | undefined, projection?: _Projection): Promise<Doc | null>;
52
- count(query: _RawQuery): Promise<number>;
53
- exists(query: _RawQuery): Promise<string | null>;
49
+ find(query: _RawQuery, projection?: _Projection | null, options?: DocumentScopeOptions): FindManyChain<Doc>;
50
+ findOne(query: _RawQuery, projection?: _Projection | null, options?: DocumentScopeOptions): FindOneChain<Doc>;
51
+ findById(id: string | undefined, projection?: _Projection | null, options?: DocumentScopeOptions): Promise<Doc | null>;
52
+ count(query: _RawQuery, options?: DocumentScopeOptions): Promise<number>;
53
+ exists(query: _RawQuery, options?: DocumentScopeOptions): Promise<string | null>;
54
54
  updateOne(query: _RawQuery, update: DocumentUpdateInput<_RawDoc>, options?: DocumentUpdateOptions): Promise<UpdateResult>;
55
- updateMany(query: _RawQuery, update: DocumentUpdateInput<_RawDoc>): Promise<UpdateResult>;
55
+ updateMany(query: _RawQuery, update: DocumentUpdateInput<_RawDoc>, options?: DocumentScopeOptions): Promise<UpdateResult>;
56
56
  removeOne(query: _RawQuery): Promise<UpdateResult>;
57
57
  removeMany(query: _RawQuery): Promise<UpdateResult>;
58
58
  updateById(id: string, update: DocumentUpdateInput<_RawDoc>, options?: DocumentUpdateOptions): Promise<UpdateResult>;
@@ -0,0 +1,9 @@
1
+ import { type DocumentQuery } from "./documentQuery.d.ts";
2
+ /**
3
+ * Why a query can never match a live row, or null: without `withRemoved` every read and write is scoped to
4
+ * `removedAt IS NULL`. `q.raw()` is SQL this walk cannot read, so it goes unchecked.
5
+ */
6
+ export declare class LiveRowScope {
7
+ #private;
8
+ static conflictOf(query: DocumentQuery | undefined, negated?: boolean): string | null;
9
+ }
@@ -48,6 +48,12 @@ export declare class FetchClient {
48
48
  };
49
49
  static resetSharedRegistry(): void;
50
50
  static resetSharedClient(): void;
51
+ /**
52
+ * In a signal test every agent reaches the test server from loopback, so an IP rate limit would count them all as
53
+ * one caller: from here on each clone names its own address (RFC 2544's benchmarking range), which loopback is
54
+ * trusted to report.
55
+ */
56
+ static useTestClientIps(enabled?: boolean): void;
51
57
  /** For calls neither the caller nor the endpoint budgets; `false` waits as long as the runtime will (minutes). */
52
58
  setTimeout(timeout?: number | false): void;
53
59
  setErrorConstructor(ErrorCls?: ErrorConstructor): void;
@@ -58,10 +64,12 @@ export declare class FetchClient {
58
64
  }): this;
59
65
  connect(): void;
60
66
  disconnect(): void;
61
- clone({ origin, connect, jwt }?: {
67
+ clone({ origin, connect, jwt, clientIp, }?: {
62
68
  origin?: string;
63
69
  connect?: boolean;
64
70
  jwt?: string;
71
+ /** Sent as `x-real-ip`, which a server believes only from a trusted proxy — a test's loopback is one. */
72
+ clientIp?: string | null;
65
73
  }): FetchProxy<unknown, Record<never, never>>;
66
74
  setJwt(jwt: string | null): void;
67
75
  static paginationArgs: SerializedArg[];
package/types/index.d.ts CHANGED
@@ -198,6 +198,38 @@ export interface AkanNativeDesktopConfig {
198
198
  * for a native addon signed by another team. Read when the app is signed with a team (a Developer ID).
199
199
  */
200
200
  entitlements?: Record<string, AkanNativeValue>;
201
+ /**
202
+ * macOS: the Finder window `build-desktop --installer` opens its dmg in — no toolbar or sidebar, the app's and the
203
+ * Applications link's icons on a background, the app's icon on the mounted disk. Without it the window is 660×400 pt
204
+ * on the framework's background, an arrow from the app at (180, 170) to Applications at (480, 170). A position is an
205
+ * icon's center in points from the window's top left; the default background lines up with the default positions.
206
+ */
207
+ dmg?: AkanNativeDmgConfig;
208
+ }
209
+ export interface AkanNativeDmgConfig {
210
+ /** A PNG (or TIFF) the size of the window in points, relative to the app folder; `false` for a plain window. */
211
+ background?: string | false;
212
+ /** The same picture at twice the pixels, for a Retina display. */
213
+ background2x?: string;
214
+ /** The area under the title bar, in points. Default the background's size, at 200, 120 on the screen. */
215
+ window?: {
216
+ x?: number;
217
+ y?: number;
218
+ width?: number;
219
+ height?: number;
220
+ };
221
+ /** Default 128. */
222
+ iconSize?: number;
223
+ /** Default 13. */
224
+ textSize?: number;
225
+ app?: {
226
+ x: number;
227
+ y: number;
228
+ };
229
+ applications?: {
230
+ x: number;
231
+ y: number;
232
+ };
201
233
  }
202
234
  /**
203
235
  * What a native app (iOS, Android, desktop) is: the app's `native` section and each of its targets have this shape. A
@@ -1,6 +1,6 @@
1
1
  import type { BackendEnv, PromiseOrObject } from "akanjs/base";
2
2
  import type { Adaptor, AdaptorCls, LlmOption } from "akanjs/service";
3
- import type { AgentQuotaHook, AgentUsageHook, CrossSiteOption, GuardCls, MiddlewareCls } from "akanjs/signal";
3
+ import type { AgentQuotaHook, AgentUsageHook, CrossSiteOption, GuardCls, MiddlewareCls, RateLimitSetting } from "akanjs/signal";
4
4
  import type { McpServerOption } from "./akanServer.d.ts";
5
5
  import type { WebProxyRegistration } from "./proxy.d.ts";
6
6
  export interface AdaptorOverride {
@@ -24,6 +24,11 @@ export declare class AkanOption<Env extends BackendEnv = BackendEnv> {
24
24
  setAgentQuota(hook: AgentQuotaHook | null): this;
25
25
  /** Extra origins that may drive a mutation beyond the serving one and native shells; the gate is on by default. */
26
26
  setCrossSite(crossSite: CrossSiteOption): this;
27
+ /**
28
+ * Endpoint budgets: a default for endpoints that declare none, overrides by endpoint key, and who `by: "account"`
29
+ * counts. Merged in mount order, the app's last; `AKAN_RATE_LIMIT=off` still turns them all off.
30
+ */
31
+ setRateLimit(settingOrFn: RateLimitSetting | false | ((env: Env) => RateLimitSetting | false)): this;
27
32
  /** Injected into the `LlmAdaptorRole` adaptor as the `llmOption` use; merged in mount order, the app's last. */
28
33
  setLlm<Option extends LlmOption>(llmOrFn: Option | ((env: Env) => Option)): this;
29
34
  /** Every entry in declaration order, duplicates kept: the boot stage rejects a key claimed twice. */
@@ -36,6 +41,7 @@ export declare class AkanOption<Env extends BackendEnv = BackendEnv> {
36
41
  getAgentUsage(): AgentUsageHook | null | undefined;
37
42
  getAgentQuota(): AgentQuotaHook | null | undefined;
38
43
  getCrossSite(): CrossSiteOption | undefined;
44
+ getRateLimit(env: Env): RateLimitSetting | false | undefined;
39
45
  getLlm(env: Env): LlmOption;
40
46
  }
41
47
  export declare function createDefaultAkanOption(): AkanOption<BackendEnv>;
@@ -1,11 +1,14 @@
1
1
  import type { EndpointInfo } from "../../signal/endpointInfo.d.ts";
2
2
  import { HttpExecutionContext } from "../../signal/signalContext.d.ts";
3
+ type McpArg = EndpointInfo["args"][number];
3
4
  export declare class McpArgumentError extends Error {
4
5
  readonly statusCode = 400;
5
6
  }
6
7
  export declare class McpExecutionContext extends HttpExecutionContext {
7
8
  #private;
8
9
  constructor(req: Request, args: Record<string, unknown>);
9
- getArgs(endpointInfo: EndpointInfo): Promise<unknown[]>;
10
+ readArgs(endpointInfo: EndpointInfo): Promise<unknown[]>;
11
+ parseArg(arg: McpArg, value: unknown): unknown;
10
12
  makeResponse(result: unknown, endpointInfo: EndpointInfo): Response;
11
13
  }
14
+ export {};
@@ -1,9 +1,5 @@
1
- import { type Dayjs } from "akanjs/base";
2
- export interface McpSharedCounter {
3
- incr(topic: string, key: string, by?: number, option?: {
4
- expireAt?: Dayjs;
5
- }): Promise<number>;
6
- }
1
+ import { type RateCounter } from "akanjs/service";
2
+ export type McpSharedCounter = RateCounter;
7
3
  export interface McpRateLimitOption {
8
4
  /** Per caller per window; `0` turns the counter off. */
9
5
  calls?: number;
@@ -89,6 +89,7 @@ export declare class RscWorker {
89
89
  renderWithMeta(req: Request, options?: {
90
90
  clientManifest?: ClientManifest;
91
91
  signal?: AbortSignal;
92
+ clientIp?: string | null;
92
93
  }): Promise<RscRenderResult>;
93
94
  listPagePrompts(): Promise<PagePromptEntry[]>;
94
95
  runPagePrompt(input: PagePromptRunInput): Promise<PagePromptRun>;
@@ -100,4 +101,6 @@ export declare class RscWorker {
100
101
  updateCssAssets(cssAssets: Record<string, CssAsset>): void;
101
102
  /** Resolves with the pages bundle the worker runs once it has taken this reload, or a later one. */
102
103
  reload(input: RscWorkerReloadInput): Promise<RscAdoptedBundle>;
104
+ /** The page request's headers as the worker sees them, `x-real-ip` being only the address the host resolved. */
105
+ static workerHeaders(req: Request, clientIp: string | null | undefined): Record<string, string>;
103
106
  }
@@ -5,6 +5,7 @@ export * from "./injectInfo.d.ts";
5
5
  export * from "./ipcTypes.d.ts";
6
6
  export * from "./liveSyncHub.d.ts";
7
7
  export * from "./predefinedAdaptor.d.ts";
8
+ export * from "./rateLimiter.d.ts";
8
9
  export * from "./serve.d.ts";
9
10
  export * from "./serviceModule.d.ts";
10
11
  export * from "./serviceRegistry.d.ts";
@@ -10,6 +10,7 @@ export * from "./logging.adaptor";
10
10
  export * from "./openaiDialect.d.ts";
11
11
  export * from "./openaiLlm.d.ts";
12
12
  export * from "./queue.adaptor";
13
+ export * from "./rateLimit.adaptor";
13
14
  export * from "./role.adaptor";
14
15
  export * from "./schedule.adaptor";
15
16
  export * from "./searchIndex.d.ts";
@@ -0,0 +1,10 @@
1
+ import { type RateBudget, type RateVerdict } from "../rateLimiter.d.ts";
2
+ declare const RateLimit_base: import("..").AdaptorCls<{}, {
3
+ cache: import("..").InjectInfo<"plug", import("./cache.adaptor").CacheAdaptor, never, never>;
4
+ }>;
5
+ /** Counts a business key (a phone number, an email) across instances; unlike an endpoint's budget, no env turns it off. */
6
+ export declare class RateLimit extends RateLimit_base {
7
+ #private;
8
+ consume(key: string, budget: RateBudget): Promise<RateVerdict>;
9
+ }
10
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { type ConstantModel } from "akanjs/constant";
2
- import { type DatabaseModel, type DocumentQuery, type DocumentSchema, type DocumentUpdateInput, type DocumentUpdateOptions } from "akanjs/document";
2
+ import { type DatabaseModel, type DocumentQuery, type DocumentSchema, type DocumentScopeOptions, type DocumentUpdateInput, type DocumentUpdateOptions } from "akanjs/document";
3
3
  import { QueryCompiler } from "./QueryCompiler.d.ts";
4
- import { type DocumentDatabaseOwner, type DocumentRecord, type FindManyOptions, type FindOneOptions, type SortOption, type SqlDialect, type TransferRow, type WriteHookOptions } from "./types.d.ts";
4
+ import { type DocumentDatabaseOwner, type DocumentRecord, type FindIdOptions, type FindManyOptions, type FindOneOptions, type SqlDialect, type TransferRow, type WriteHookOptions } from "./types.d.ts";
5
5
  import { UpdateCompiler } from "./UpdateCompiler.d.ts";
6
6
  export declare class SqlDocumentStore {
7
7
  #private;
@@ -31,7 +31,7 @@ export declare class SqlDocumentStore {
31
31
  modifiedCount: number;
32
32
  upsertedId: any;
33
33
  }>;
34
- updateManyByQuery(query: DocumentQuery, update: DocumentUpdateInput): Promise<{
34
+ updateManyByQuery(query: DocumentQuery, update: DocumentUpdateInput, options?: DocumentScopeOptions): Promise<{
35
35
  acknowledged: boolean;
36
36
  matchedCount: number;
37
37
  modifiedCount: number;
@@ -64,15 +64,11 @@ export declare class SqlDocumentStore {
64
64
  findIds(query?: DocumentQuery, options?: Omit<FindManyOptions, "select">): Promise<string[]>;
65
65
  private listQuery;
66
66
  findOne(query?: DocumentQuery, options?: FindOneOptions): Promise<any>;
67
- findId(query?: DocumentQuery, options?: {
68
- sort?: SortOption;
69
- skip?: number | null;
70
- sample?: boolean;
71
- }): Promise<string | null>;
67
+ findId(query?: DocumentQuery, options?: FindIdOptions): Promise<string | null>;
72
68
  pickOne(query?: DocumentQuery, options?: FindOneOptions): Promise<any>;
73
69
  pickById(id: string): Promise<any>;
74
- exists(query?: DocumentQuery): Promise<string | null>;
75
- count(query?: DocumentQuery): Promise<number>;
70
+ exists(query?: DocumentQuery, options?: DocumentScopeOptions): Promise<string | null>;
71
+ count(query?: DocumentQuery, options?: DocumentScopeOptions): Promise<number>;
76
72
  insight(query?: DocumentQuery): Promise<DocumentRecord>;
77
73
  private safeQuery;
78
74
  private writeQuery;
@@ -1,6 +1,6 @@
1
1
  import type { PromiseOrObject } from "akanjs/base";
2
2
  import type { ConstantModel } from "akanjs/constant";
3
- import type { DatabaseModel, DocumentQuery, DocumentQueryNode, DocumentSchema, DocumentUpdateInput, DocumentUpdateOperator, DocumentUpdateOptions } from "akanjs/document";
3
+ import type { DatabaseModel, DocumentQuery, DocumentQueryNode, DocumentSchema, DocumentScopeOptions, DocumentUpdateInput, DocumentUpdateOperator, DocumentUpdateOptions } from "akanjs/document";
4
4
  import type { SearchIndex } from "../searchIndex.d.ts";
5
5
  import type { SqlDocumentStore } from "./SqlDocumentStore.d.ts";
6
6
  export interface SqliteDatabaseConfig {
@@ -50,7 +50,7 @@ export interface DocumentStore {
50
50
  modifiedCount: number;
51
51
  upsertedId: string | null;
52
52
  }>;
53
- updateManyByQuery(query: DocumentQuery, update: DocumentUpdateInput): Promise<{
53
+ updateManyByQuery(query: DocumentQuery, update: DocumentUpdateInput, options?: DocumentScopeOptions): Promise<{
54
54
  acknowledged: boolean;
55
55
  matchedCount: number;
56
56
  modifiedCount: number;
@@ -79,22 +79,13 @@ export interface DocumentStore {
79
79
  upsertedId: string | null;
80
80
  }>;
81
81
  find(query?: DocumentQuery, options?: FindManyOptions): Promise<any[]>;
82
- findIds(query?: DocumentQuery, options?: {
83
- sort?: SortOption;
84
- skip?: number | null;
85
- limit?: number | null;
86
- sample?: number;
87
- }): Promise<string[]>;
82
+ findIds(query?: DocumentQuery, options?: Omit<FindManyOptions, "select">): Promise<string[]>;
88
83
  findOne(query?: DocumentQuery, options?: FindOneOptions): Promise<any | null>;
89
- findId(query?: DocumentQuery, options?: {
90
- sort?: SortOption;
91
- skip?: number | null;
92
- sample?: boolean;
93
- }): Promise<string | null>;
84
+ findId(query?: DocumentQuery, options?: FindIdOptions): Promise<string | null>;
94
85
  pickOne(query?: DocumentQuery, options?: FindOneOptions): Promise<any>;
95
86
  pickById(id: string): Promise<any>;
96
- exists(query?: DocumentQuery): Promise<string | null>;
97
- count(query?: DocumentQuery): Promise<number>;
87
+ exists(query?: DocumentQuery, options?: DocumentScopeOptions): Promise<string | null>;
88
+ count(query?: DocumentQuery, options?: DocumentScopeOptions): Promise<number>;
98
89
  insight(query?: DocumentQuery): Promise<any>;
99
90
  hydrate(data: DocumentRecord, originalData?: DocumentRecord, options?: {
100
91
  track?: boolean;
@@ -157,19 +148,24 @@ export type FieldMap = Record<string, {
157
148
  }>;
158
149
  export type SortOption = Record<string, 1 | -1> | null | undefined;
159
150
  export type ProjectionOption = Partial<Record<string, boolean>> | null | undefined;
160
- export type FindManyOptions = {
151
+ export type FindManyOptions = DocumentScopeOptions & {
161
152
  sort?: SortOption;
162
153
  skip?: number | null;
163
154
  limit?: number | null;
164
155
  sample?: number;
165
156
  select?: ProjectionOption;
166
157
  };
167
- export type FindOneOptions = {
158
+ export type FindOneOptions = DocumentScopeOptions & {
168
159
  sort?: SortOption;
169
160
  skip?: number | null;
170
161
  sample?: boolean;
171
162
  select?: ProjectionOption;
172
163
  };
164
+ export type FindIdOptions = DocumentScopeOptions & {
165
+ sort?: SortOption;
166
+ skip?: number | null;
167
+ sample?: boolean;
168
+ };
173
169
  export type WriteHookOptions = {
174
170
  runSaveHooks?: boolean;
175
171
  crudType?: "update" | "remove";
@@ -0,0 +1,24 @@
1
+ import { type Dayjs } from "akanjs/base";
2
+ export interface RateCounter {
3
+ incr(topic: string, key: string, by?: number, option?: {
4
+ expireAt?: Dayjs;
5
+ }): Promise<number>;
6
+ }
7
+ export interface RateBudget {
8
+ calls: number;
9
+ windowMs: number;
10
+ }
11
+ export type RateVerdict = {
12
+ ok: true;
13
+ } | {
14
+ ok: false;
15
+ retryAfterMs: number;
16
+ };
17
+ export declare class RateLimiter {
18
+ #private;
19
+ constructor(shared?: RateCounter | null, { topic }?: {
20
+ topic?: string;
21
+ });
22
+ get isShared(): boolean;
23
+ consume(key: string, budget: RateBudget, now?: number): Promise<RateVerdict>;
24
+ }
@@ -0,0 +1,37 @@
1
+ import type { EndpointInfo } from "./endpointInfo.d.ts";
2
+ import type { SignalContext } from "./signalContext.d.ts";
3
+ export interface RateLimitBudget {
4
+ calls: number;
5
+ /** 60_000 when unset. */
6
+ windowMs?: number;
7
+ /** `ip` (default) counts the caller's address; `account` counts `accountKey(account)`, else the address. */
8
+ by?: "ip" | "account";
9
+ }
10
+ export interface RateLimitSetting {
11
+ /** `false` lets every budget stand aside, as for a deployment rate-limited at its edge. */
12
+ enabled?: boolean;
13
+ /** The budget of every endpoint that declares none; unset leaves those unlimited. */
14
+ budget?: RateLimitBudget;
15
+ /** By endpoint key, over what the endpoint declares (a lib's included); `false` exempts it. */
16
+ endpoints?: {
17
+ [key: string]: Partial<RateLimitBudget> | false;
18
+ };
19
+ /** Who `by: "account"` counts; nothing returned counts the caller's address instead. */
20
+ accountKey?: (account: unknown) => string | null | undefined;
21
+ }
22
+ type ResolvedBudget = Required<RateLimitBudget>;
23
+ export declare class EndpointRateLimit {
24
+ #private;
25
+ /** Merges over what an earlier call set, so libs configure in mount order and the app's `option.ts` goes last. */
26
+ static configure(setting: RateLimitSetting | false): void;
27
+ /**
28
+ * `off` wins over the code, `on` turns budgets on in a local environment, and `<calls>[/<seconds>]` is the default
29
+ * budget wherever the code names none. Unset, budgets apply everywhere but `local`.
30
+ */
31
+ static applyEnv(value: string | undefined, environment: string): void;
32
+ static reset(): void;
33
+ static budgetOf(key: string, endpointInfo: EndpointInfo): ResolvedBudget | null;
34
+ /** `ip` runs before the request body is read; `account` after the middlewares resolved the caller. */
35
+ static admit(context: SignalContext, phase: "ip" | "account"): Promise<void>;
36
+ }
37
+ export {};
@@ -7,6 +7,7 @@ export * from "./base.signal";
7
7
  export { CrossSiteGuard, type CrossSiteOption } from "./CrossSiteGuard.d.ts";
8
8
  export * from "./endpoint.d.ts";
9
9
  export * from "./endpointInfo.d.ts";
10
+ export * from "./endpointRateLimit.d.ts";
10
11
  export * from "./exception.d.ts";
11
12
  export * from "./guard.d.ts";
12
13
  export * from "./guards.d.ts";