@clinebot/core 0.0.37 → 0.0.38

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 (617) hide show
  1. package/README.md +11 -1
  2. package/dist/ClineCore.d.ts +18 -214
  3. package/dist/account/cline-account-service.d.ts +0 -1
  4. package/dist/account/index.d.ts +0 -1
  5. package/dist/account/rpc.d.ts +0 -1
  6. package/dist/account/types.d.ts +0 -1
  7. package/dist/auth/bounded-ttl-cache.d.ts +0 -1
  8. package/dist/auth/client.d.ts +0 -1
  9. package/dist/auth/cline.d.ts +0 -5
  10. package/dist/auth/codex.d.ts +0 -1
  11. package/dist/auth/oca.d.ts +0 -1
  12. package/dist/auth/server.d.ts +0 -1
  13. package/dist/auth/types.d.ts +0 -1
  14. package/dist/auth/utils.d.ts +0 -1
  15. package/dist/cline-core/automation.d.ts +34 -0
  16. package/dist/cline-core/runtime-services.d.ts +5 -0
  17. package/dist/cline-core/start-input.d.ts +10 -0
  18. package/dist/cline-core/telemetry.d.ts +10 -0
  19. package/dist/cline-core/types.d.ts +221 -0
  20. package/dist/cron/{cron-event-ingress.d.ts → events/cron-event-ingress.d.ts} +1 -2
  21. package/dist/cron/{cron-report-writer.d.ts → reports/cron-report-writer.d.ts} +1 -2
  22. package/dist/cron/{cron-materializer.d.ts → runner/cron-materializer.d.ts} +1 -2
  23. package/dist/cron/{cron-runner.d.ts → runner/cron-runner.d.ts} +6 -4
  24. package/dist/cron/{resource-limiter.d.ts → runner/resource-limiter.d.ts} +0 -1
  25. package/dist/cron/schedule/scheduler.d.ts +12 -0
  26. package/dist/cron/{cron-service.d.ts → service/cron-service.d.ts} +4 -5
  27. package/dist/cron/{schedule-command-service.d.ts → service/schedule-command-service.d.ts} +0 -1
  28. package/dist/cron/{schedule-service.d.ts → service/schedule-service.d.ts} +20 -22
  29. package/dist/cron/{cron-reconciler.d.ts → specs/cron-reconciler.d.ts} +1 -2
  30. package/dist/cron/{cron-spec-parser.d.ts → specs/cron-spec-parser.d.ts} +0 -1
  31. package/dist/cron/{cron-watcher.d.ts → specs/cron-watcher.d.ts} +0 -1
  32. package/dist/cron/{cron-schema.d.ts → store/cron-schema.d.ts} +0 -1
  33. package/dist/cron/{sqlite-cron-store.d.ts → store/sqlite-cron-store.d.ts} +12 -2
  34. package/dist/extensions/config/index.d.ts +4 -7
  35. package/dist/extensions/config/runtime-commands.d.ts +0 -1
  36. package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
  37. package/dist/extensions/config/unified-config-file-watcher.d.ts +0 -1
  38. package/dist/extensions/config/user-instruction-config-loader.d.ts +0 -1
  39. package/dist/extensions/config/user-instruction-plugin.d.ts +25 -0
  40. package/dist/extensions/config/user-instruction-service.d.ts +23 -0
  41. package/dist/extensions/context/agentic-compaction.d.ts +0 -1
  42. package/dist/extensions/context/basic-compaction.d.ts +0 -1
  43. package/dist/extensions/context/compaction-shared.d.ts +0 -1
  44. package/dist/extensions/context/compaction.d.ts +0 -1
  45. package/dist/extensions/index.d.ts +0 -1
  46. package/dist/extensions/mcp/client.d.ts +0 -1
  47. package/dist/extensions/mcp/config-loader.d.ts +0 -1
  48. package/dist/extensions/mcp/index.d.ts +0 -1
  49. package/dist/extensions/mcp/manager.d.ts +0 -1
  50. package/dist/extensions/mcp/name-transform.d.ts +0 -1
  51. package/dist/extensions/mcp/policies.d.ts +0 -1
  52. package/dist/extensions/mcp/tools.d.ts +2 -3
  53. package/dist/extensions/mcp/types.d.ts +3 -4
  54. package/dist/extensions/plugin/plugin-config-loader.d.ts +0 -1
  55. package/dist/extensions/plugin/plugin-load-report.d.ts +0 -1
  56. package/dist/extensions/plugin/plugin-loader.d.ts +0 -1
  57. package/dist/extensions/plugin/plugin-module-import.d.ts +0 -1
  58. package/dist/extensions/plugin/plugin-sandbox.d.ts +0 -1
  59. package/dist/extensions/plugin/plugin-targeting.d.ts +0 -1
  60. package/dist/extensions/plugin-sandbox-bootstrap.js +1 -446
  61. package/dist/extensions/tools/constants.d.ts +0 -1
  62. package/dist/extensions/tools/definitions.d.ts +13 -14
  63. package/dist/extensions/tools/executors/apply-patch-parser.d.ts +0 -1
  64. package/dist/extensions/tools/executors/apply-patch.d.ts +0 -1
  65. package/dist/extensions/tools/executors/bash.d.ts +0 -1
  66. package/dist/extensions/tools/executors/editor.d.ts +0 -1
  67. package/dist/extensions/tools/executors/file-read.d.ts +0 -1
  68. package/dist/extensions/tools/executors/index.d.ts +0 -1
  69. package/dist/extensions/tools/executors/search.d.ts +0 -1
  70. package/dist/extensions/tools/executors/web-fetch.d.ts +0 -1
  71. package/dist/extensions/tools/helpers.d.ts +0 -1
  72. package/dist/extensions/tools/index.d.ts +2 -3
  73. package/dist/extensions/tools/model-tool-routing.d.ts +0 -1
  74. package/dist/extensions/tools/presets.d.ts +4 -5
  75. package/dist/extensions/tools/runtime.d.ts +0 -1
  76. package/dist/extensions/tools/schemas.d.ts +0 -1
  77. package/dist/extensions/tools/team/delegated-agent.d.ts +3 -4
  78. package/dist/extensions/tools/team/index.d.ts +0 -1
  79. package/dist/extensions/tools/team/multi-agent.d.ts +1 -2
  80. package/dist/extensions/tools/team/projections.d.ts +0 -1
  81. package/dist/extensions/tools/team/runtime.d.ts +0 -1
  82. package/dist/extensions/tools/team/spawn-agent-tool.d.ts +4 -5
  83. package/dist/extensions/tools/team/subagent-prompts.d.ts +0 -1
  84. package/dist/extensions/tools/team/team-tools.d.ts +7 -8
  85. package/dist/extensions/tools/types.d.ts +11 -12
  86. package/dist/hooks/checkpoint-hooks.d.ts +9 -2
  87. package/dist/hooks/hook-extension.d.ts +2 -0
  88. package/dist/{extensions/config/hooks-config-loader.d.ts → hooks/hook-file-config.d.ts} +1 -2
  89. package/dist/hooks/hook-file-hooks.d.ts +2 -2
  90. package/dist/hooks/index.d.ts +3 -1
  91. package/dist/hooks/subprocess-runner.d.ts +0 -1
  92. package/dist/hooks/subprocess.d.ts +0 -1
  93. package/dist/hub/{connect.d.ts → client/connect.d.ts} +1 -2
  94. package/dist/hub/{client.d.ts → client/index.d.ts} +41 -4
  95. package/dist/hub/{session-client.d.ts → client/session-client.d.ts} +41 -13
  96. package/dist/hub/{ui-client.d.ts → client/ui-client.d.ts} +1 -1
  97. package/dist/hub/daemon/entry.d.ts +1 -0
  98. package/dist/hub/daemon/entry.js +720 -0
  99. package/dist/hub/{daemon.d.ts → daemon/index.d.ts} +6 -3
  100. package/dist/hub/{runtime-handlers.d.ts → daemon/runtime-handlers.d.ts} +3 -2
  101. package/dist/hub/{start-shared-server.d.ts → daemon/start-shared-server.d.ts} +1 -2
  102. package/dist/hub/{defaults.d.ts → discovery/defaults.d.ts} +0 -1
  103. package/dist/hub/{discovery.d.ts → discovery/index.d.ts} +2 -1
  104. package/dist/hub/{workspace.d.ts → discovery/workspace.d.ts} +1 -2
  105. package/dist/hub/index.d.ts +28 -11
  106. package/dist/hub/index.js +484 -1061
  107. package/dist/hub/runtime-host/hub-runtime-host.d.ts +73 -0
  108. package/dist/{transports/remote.d.ts → hub/runtime-host/remote-runtime-host.d.ts} +1 -2
  109. package/dist/hub/{browser-websocket.d.ts → server/browser-websocket.d.ts} +1 -2
  110. package/dist/hub/{transport.d.ts → server/command-transport.d.ts} +0 -1
  111. package/dist/hub/server/handlers/approval-handlers.d.ts +17 -0
  112. package/dist/hub/server/handlers/capability-handlers.d.ts +12 -0
  113. package/dist/hub/server/handlers/client-handlers.d.ts +6 -0
  114. package/dist/hub/server/handlers/context.d.ts +56 -0
  115. package/dist/hub/server/handlers/run-handlers.d.ts +5 -0
  116. package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
  117. package/dist/hub/server/handlers/session-handlers.d.ts +20 -0
  118. package/dist/hub/server/hub-client-contributions.d.ts +19 -0
  119. package/dist/hub/server/hub-notifications.d.ts +7 -0
  120. package/dist/hub/server/hub-schedule-events.d.ts +2 -0
  121. package/dist/hub/server/hub-server-logging.d.ts +2 -0
  122. package/dist/hub/server/hub-server-options.d.ts +55 -0
  123. package/dist/hub/server/hub-server-transport.d.ts +34 -0
  124. package/dist/hub/server/hub-session-records.d.ts +8 -0
  125. package/dist/hub/server/hub-websocket-server.d.ts +6 -0
  126. package/dist/hub/server/index.d.ts +4 -0
  127. package/dist/hub/{native-transport.d.ts → server/native-transport.d.ts} +1 -2
  128. package/dist/index.d.ts +51 -41
  129. package/dist/index.js +214 -872
  130. package/dist/runtime/capabilities/index.d.ts +2 -0
  131. package/dist/runtime/capabilities/normalize-runtime-capabilities.d.ts +2 -0
  132. package/dist/runtime/capabilities/runtime-capabilities.d.ts +6 -0
  133. package/dist/runtime/config/agent-message-codec.d.ts +6 -0
  134. package/dist/runtime/{agent-runtime-config-builder.d.ts → config/agent-runtime-config-builder.d.ts} +12 -21
  135. package/dist/runtime/host/history.d.ts +18 -0
  136. package/dist/runtime/{host.d.ts → host/host.d.ts} +3 -4
  137. package/dist/runtime/host/local/agent-event-bridge.d.ts +29 -0
  138. package/dist/runtime/host/local/session-record.d.ts +6 -0
  139. package/dist/runtime/host/local/session-service-invoker.d.ts +4 -0
  140. package/dist/runtime/host/local/spawn-tool.d.ts +15 -0
  141. package/dist/runtime/host/local/user-files.d.ts +1 -0
  142. package/dist/runtime/host/local-runtime-host.d.ts +118 -0
  143. package/dist/{transports → runtime/host}/runtime-host-support.d.ts +3 -5
  144. package/dist/runtime/{runtime-host.d.ts → host/runtime-host.d.ts} +66 -31
  145. package/dist/runtime/{runtime-builder.d.ts → orchestration/runtime-builder.d.ts} +0 -1
  146. package/dist/runtime/{runtime-event-adapter.d.ts → orchestration/runtime-event-adapter.d.ts} +0 -1
  147. package/dist/runtime/{runtime-oauth-token-manager.d.ts → orchestration/runtime-oauth-token-manager.d.ts} +1 -2
  148. package/dist/runtime/{session-runtime-orchestrator.d.ts → orchestration/session-runtime-orchestrator.d.ts} +20 -63
  149. package/dist/runtime/{session-runtime.d.ts → orchestration/session-runtime.d.ts} +14 -12
  150. package/dist/runtime/{user-input-builder.d.ts → orchestration/user-input-builder.d.ts} +2 -11
  151. package/dist/runtime/{loop-detection.d.ts → safety/loop-detection.d.ts} +0 -1
  152. package/dist/runtime/{mistake-tracker.d.ts → safety/mistake-tracker.d.ts} +0 -1
  153. package/dist/runtime/{rules.d.ts → safety/rules.d.ts} +1 -2
  154. package/dist/runtime/{subprocess-sandbox.d.ts → tools/subprocess-sandbox.d.ts} +15 -1
  155. package/dist/runtime/{tool-approval.d.ts → tools/tool-approval.d.ts} +0 -1
  156. package/dist/runtime/turn-queue/pending-prompt-service.d.ts +64 -0
  157. package/dist/services/agent-events.d.ts +1 -2
  158. package/dist/services/config.d.ts +0 -1
  159. package/dist/services/global-settings.d.ts +27 -5
  160. package/dist/{llms → services/llms}/cline-recommended-models.d.ts +1 -2
  161. package/dist/{llms → services/llms}/configured-provider-registry.d.ts +0 -1
  162. package/dist/services/llms/handler-factory.d.ts +3 -0
  163. package/dist/{llms → services/llms}/provider-defaults.d.ts +2 -1
  164. package/dist/{llms → services/llms}/provider-settings.d.ts +5 -3
  165. package/dist/{llms → services/llms}/runtime-config.d.ts +0 -1
  166. package/dist/{llms → services/llms}/runtime-registry.d.ts +0 -1
  167. package/dist/{llms → services/llms}/runtime-types.d.ts +0 -1
  168. package/dist/services/local-runtime-bootstrap.d.ts +7 -9
  169. package/dist/services/plugin-tools.d.ts +0 -1
  170. package/dist/services/providers/local-provider-registry.d.ts +9 -10
  171. package/dist/services/providers/local-provider-service.d.ts +36 -3
  172. package/dist/services/providers/model-source.d.ts +3 -0
  173. package/dist/services/session-artifacts.d.ts +0 -1
  174. package/dist/services/session-data.d.ts +2 -3
  175. package/dist/services/session-telemetry.d.ts +0 -1
  176. package/dist/services/storage/file-team-store.d.ts +0 -1
  177. package/dist/services/storage/provider-settings-legacy-migration.d.ts +0 -1
  178. package/dist/services/storage/provider-settings-manager.d.ts +3 -4
  179. package/dist/services/storage/sqlite-session-store.d.ts +0 -1
  180. package/dist/services/storage/sqlite-team-store.d.ts +0 -1
  181. package/dist/services/storage/team-store.d.ts +0 -1
  182. package/dist/services/telemetry/ITelemetryAdapter.d.ts +0 -1
  183. package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +0 -1
  184. package/dist/services/telemetry/OpenTelemetryProvider.d.ts +32 -1
  185. package/dist/services/telemetry/TelemetryLoggerSink.d.ts +0 -1
  186. package/dist/services/telemetry/TelemetryService.d.ts +0 -1
  187. package/dist/services/telemetry/core-events.d.ts +46 -3
  188. package/dist/services/telemetry/distinct-id.d.ts +0 -1
  189. package/dist/services/telemetry/index.d.ts +1 -2
  190. package/dist/services/telemetry/index.js +1 -0
  191. package/dist/services/usage.d.ts +10 -2
  192. package/dist/services/workspace/file-indexer.d.ts +0 -1
  193. package/dist/services/workspace/index.d.ts +0 -1
  194. package/dist/services/workspace/mention-enricher.d.ts +0 -1
  195. package/dist/{session → services/workspace}/workspace-manager.d.ts +0 -1
  196. package/dist/services/{workspace-manifest.d.ts → workspace/workspace-manifest.d.ts} +20 -5
  197. package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
  198. package/dist/session/checkpoint-restore.d.ts +20 -0
  199. package/dist/session/{session-graph.d.ts → models/session-graph.d.ts} +2 -3
  200. package/dist/session/{session-manifest.d.ts → models/session-manifest.d.ts} +0 -1
  201. package/dist/session/{session-row.d.ts → models/session-row.d.ts} +2 -3
  202. package/dist/session/{file-session-service.d.ts → services/file-session-service.d.ts} +1 -2
  203. package/dist/session/{message-builder.d.ts → services/message-builder.d.ts} +7 -16
  204. package/dist/session/{persistence-service.d.ts → services/persistence-service.d.ts} +10 -11
  205. package/dist/session/{session-service.d.ts → services/session-service.d.ts} +4 -5
  206. package/dist/session/session-snapshot.d.ts +57 -0
  207. package/dist/session/session-versioning-service.d.ts +48 -0
  208. package/dist/session/{conversation-store.d.ts → stores/conversation-store.d.ts} +0 -1
  209. package/dist/session/{session-manifest-store.d.ts → stores/session-manifest-store.d.ts} +3 -4
  210. package/dist/session/{team-persistence-store.d.ts → stores/team-persistence-store.d.ts} +2 -3
  211. package/dist/session/team/index.d.ts +2 -0
  212. package/dist/session/{subagent-session-manager.d.ts → team/team-child-session-manager.d.ts} +7 -8
  213. package/dist/session/{session-team-coordination.d.ts → team/team-session-coordinator.d.ts} +3 -4
  214. package/dist/settings/index.d.ts +2 -0
  215. package/dist/settings/settings-service.d.ts +6 -0
  216. package/dist/settings/types.d.ts +42 -0
  217. package/dist/types/chat-schema.d.ts +24 -7
  218. package/dist/types/common.d.ts +0 -1
  219. package/dist/types/config.d.ts +2 -3
  220. package/dist/types/events.d.ts +8 -1
  221. package/dist/types/provider-settings.d.ts +2 -3
  222. package/dist/types/session.d.ts +22 -6
  223. package/dist/types/sessions.d.ts +0 -1
  224. package/dist/types/storage.d.ts +0 -1
  225. package/dist/types.d.ts +17 -14
  226. package/dist/version.d.ts +0 -1
  227. package/package.json +16 -12
  228. package/dist/ClineCore.d.ts.map +0 -1
  229. package/dist/account/cline-account-service.d.ts.map +0 -1
  230. package/dist/account/index.d.ts.map +0 -1
  231. package/dist/account/rpc.d.ts.map +0 -1
  232. package/dist/account/types.d.ts.map +0 -1
  233. package/dist/auth/bounded-ttl-cache.d.ts.map +0 -1
  234. package/dist/auth/client.d.ts.map +0 -1
  235. package/dist/auth/cline.d.ts.map +0 -1
  236. package/dist/auth/codex.d.ts.map +0 -1
  237. package/dist/auth/oca.d.ts.map +0 -1
  238. package/dist/auth/server.d.ts.map +0 -1
  239. package/dist/auth/types.d.ts.map +0 -1
  240. package/dist/auth/utils.d.ts.map +0 -1
  241. package/dist/cron/cron-event-ingress.d.ts.map +0 -1
  242. package/dist/cron/cron-materializer.d.ts.map +0 -1
  243. package/dist/cron/cron-reconciler.d.ts.map +0 -1
  244. package/dist/cron/cron-report-writer.d.ts.map +0 -1
  245. package/dist/cron/cron-runner.d.ts.map +0 -1
  246. package/dist/cron/cron-schema.d.ts.map +0 -1
  247. package/dist/cron/cron-service.d.ts.map +0 -1
  248. package/dist/cron/cron-spec-parser.d.ts.map +0 -1
  249. package/dist/cron/cron-watcher.d.ts.map +0 -1
  250. package/dist/cron/resource-limiter.d.ts.map +0 -1
  251. package/dist/cron/schedule-command-service.d.ts.map +0 -1
  252. package/dist/cron/schedule-service.d.ts.map +0 -1
  253. package/dist/cron/scheduler.d.ts +0 -68
  254. package/dist/cron/scheduler.d.ts.map +0 -1
  255. package/dist/cron/sqlite-cron-store.d.ts.map +0 -1
  256. package/dist/cron/sqlite-schedule-store.d.ts +0 -52
  257. package/dist/cron/sqlite-schedule-store.d.ts.map +0 -1
  258. package/dist/extensions/config/agent-config-loader.d.ts +0 -20
  259. package/dist/extensions/config/agent-config-loader.d.ts.map +0 -1
  260. package/dist/extensions/config/agent-config-parser.d.ts +0 -29
  261. package/dist/extensions/config/agent-config-parser.d.ts.map +0 -1
  262. package/dist/extensions/config/hooks-config-loader.d.ts.map +0 -1
  263. package/dist/extensions/config/index.d.ts.map +0 -1
  264. package/dist/extensions/config/runtime-commands.d.ts.map +0 -1
  265. package/dist/extensions/config/unified-config-file-watcher.d.ts.map +0 -1
  266. package/dist/extensions/config/user-instruction-config-loader.d.ts.map +0 -1
  267. package/dist/extensions/context/agentic-compaction.d.ts.map +0 -1
  268. package/dist/extensions/context/basic-compaction.d.ts.map +0 -1
  269. package/dist/extensions/context/compaction-shared.d.ts.map +0 -1
  270. package/dist/extensions/context/compaction.d.ts.map +0 -1
  271. package/dist/extensions/index.d.ts.map +0 -1
  272. package/dist/extensions/mcp/client.d.ts.map +0 -1
  273. package/dist/extensions/mcp/config-loader.d.ts.map +0 -1
  274. package/dist/extensions/mcp/index.d.ts.map +0 -1
  275. package/dist/extensions/mcp/manager.d.ts.map +0 -1
  276. package/dist/extensions/mcp/name-transform.d.ts.map +0 -1
  277. package/dist/extensions/mcp/policies.d.ts.map +0 -1
  278. package/dist/extensions/mcp/tools.d.ts.map +0 -1
  279. package/dist/extensions/mcp/types.d.ts.map +0 -1
  280. package/dist/extensions/plugin/plugin-config-loader.d.ts.map +0 -1
  281. package/dist/extensions/plugin/plugin-load-report.d.ts.map +0 -1
  282. package/dist/extensions/plugin/plugin-loader.d.ts.map +0 -1
  283. package/dist/extensions/plugin/plugin-module-import.d.ts.map +0 -1
  284. package/dist/extensions/plugin/plugin-sandbox.d.ts.map +0 -1
  285. package/dist/extensions/plugin/plugin-targeting.d.ts.map +0 -1
  286. package/dist/extensions/tools/constants.d.ts.map +0 -1
  287. package/dist/extensions/tools/definitions.d.ts.map +0 -1
  288. package/dist/extensions/tools/executors/apply-patch-parser.d.ts.map +0 -1
  289. package/dist/extensions/tools/executors/apply-patch.d.ts.map +0 -1
  290. package/dist/extensions/tools/executors/bash.d.ts.map +0 -1
  291. package/dist/extensions/tools/executors/editor.d.ts.map +0 -1
  292. package/dist/extensions/tools/executors/file-read.d.ts.map +0 -1
  293. package/dist/extensions/tools/executors/index.d.ts.map +0 -1
  294. package/dist/extensions/tools/executors/search.d.ts.map +0 -1
  295. package/dist/extensions/tools/executors/web-fetch.d.ts.map +0 -1
  296. package/dist/extensions/tools/helpers.d.ts.map +0 -1
  297. package/dist/extensions/tools/index.d.ts.map +0 -1
  298. package/dist/extensions/tools/model-tool-routing.d.ts.map +0 -1
  299. package/dist/extensions/tools/presets.d.ts.map +0 -1
  300. package/dist/extensions/tools/runtime.d.ts.map +0 -1
  301. package/dist/extensions/tools/schemas.d.ts.map +0 -1
  302. package/dist/extensions/tools/team/delegated-agent.d.ts.map +0 -1
  303. package/dist/extensions/tools/team/index.d.ts.map +0 -1
  304. package/dist/extensions/tools/team/multi-agent.d.ts.map +0 -1
  305. package/dist/extensions/tools/team/projections.d.ts.map +0 -1
  306. package/dist/extensions/tools/team/runtime.d.ts.map +0 -1
  307. package/dist/extensions/tools/team/spawn-agent-tool.d.ts.map +0 -1
  308. package/dist/extensions/tools/team/subagent-prompts.d.ts.map +0 -1
  309. package/dist/extensions/tools/team/team-tools.d.ts.map +0 -1
  310. package/dist/extensions/tools/types.d.ts.map +0 -1
  311. package/dist/hooks/checkpoint-hooks.d.ts.map +0 -1
  312. package/dist/hooks/hook-bridge.d.ts +0 -118
  313. package/dist/hooks/hook-bridge.d.ts.map +0 -1
  314. package/dist/hooks/hook-file-hooks.d.ts.map +0 -1
  315. package/dist/hooks/hook-registry.d.ts +0 -16
  316. package/dist/hooks/hook-registry.d.ts.map +0 -1
  317. package/dist/hooks/index.d.ts.map +0 -1
  318. package/dist/hooks/subprocess-runner.d.ts.map +0 -1
  319. package/dist/hooks/subprocess.d.ts.map +0 -1
  320. package/dist/hub/browser-websocket.d.ts.map +0 -1
  321. package/dist/hub/client.d.ts.map +0 -1
  322. package/dist/hub/connect.d.ts.map +0 -1
  323. package/dist/hub/daemon-entry.d.ts +0 -2
  324. package/dist/hub/daemon-entry.d.ts.map +0 -1
  325. package/dist/hub/daemon-entry.js +0 -1305
  326. package/dist/hub/daemon.d.ts.map +0 -1
  327. package/dist/hub/defaults.d.ts.map +0 -1
  328. package/dist/hub/discovery.d.ts.map +0 -1
  329. package/dist/hub/index.d.ts.map +0 -1
  330. package/dist/hub/native-transport.d.ts.map +0 -1
  331. package/dist/hub/runtime-handlers.d.ts.map +0 -1
  332. package/dist/hub/server.d.ts +0 -104
  333. package/dist/hub/server.d.ts.map +0 -1
  334. package/dist/hub/session-client.d.ts.map +0 -1
  335. package/dist/hub/start-shared-server.d.ts.map +0 -1
  336. package/dist/hub/transport.d.ts.map +0 -1
  337. package/dist/hub/ui-client.d.ts.map +0 -1
  338. package/dist/hub/workspace.d.ts.map +0 -1
  339. package/dist/index.d.ts.map +0 -1
  340. package/dist/llms/cline-recommended-models.d.ts.map +0 -1
  341. package/dist/llms/configured-provider-registry.d.ts.map +0 -1
  342. package/dist/llms/handler-factory.d.ts +0 -16
  343. package/dist/llms/handler-factory.d.ts.map +0 -1
  344. package/dist/llms/provider-defaults.d.ts.map +0 -1
  345. package/dist/llms/provider-settings.d.ts.map +0 -1
  346. package/dist/llms/runtime-config.d.ts.map +0 -1
  347. package/dist/llms/runtime-registry.d.ts.map +0 -1
  348. package/dist/llms/runtime-types.d.ts.map +0 -1
  349. package/dist/runtime/agent-config-adapter.d.ts +0 -148
  350. package/dist/runtime/agent-config-adapter.d.ts.map +0 -1
  351. package/dist/runtime/agent-runtime-config-builder.d.ts.map +0 -1
  352. package/dist/runtime/history.d.ts +0 -10
  353. package/dist/runtime/history.d.ts.map +0 -1
  354. package/dist/runtime/host.d.ts.map +0 -1
  355. package/dist/runtime/loop-detection.d.ts.map +0 -1
  356. package/dist/runtime/mistake-tracker.d.ts.map +0 -1
  357. package/dist/runtime/rules.d.ts.map +0 -1
  358. package/dist/runtime/runtime-builder.d.ts.map +0 -1
  359. package/dist/runtime/runtime-event-adapter.d.ts.map +0 -1
  360. package/dist/runtime/runtime-host.d.ts.map +0 -1
  361. package/dist/runtime/runtime-oauth-token-manager.d.ts.map +0 -1
  362. package/dist/runtime/session-runtime-orchestrator.d.ts.map +0 -1
  363. package/dist/runtime/session-runtime.d.ts.map +0 -1
  364. package/dist/runtime/subprocess-sandbox.d.ts.map +0 -1
  365. package/dist/runtime/tool-approval.d.ts.map +0 -1
  366. package/dist/runtime/user-input-builder.d.ts.map +0 -1
  367. package/dist/services/agent-events.d.ts.map +0 -1
  368. package/dist/services/config.d.ts.map +0 -1
  369. package/dist/services/global-settings.d.ts.map +0 -1
  370. package/dist/services/index.js +0 -28
  371. package/dist/services/local-runtime-bootstrap.d.ts.map +0 -1
  372. package/dist/services/plugin-tools.d.ts.map +0 -1
  373. package/dist/services/providers/local-provider-registry.d.ts.map +0 -1
  374. package/dist/services/providers/local-provider-service.d.ts.map +0 -1
  375. package/dist/services/session-artifacts.d.ts.map +0 -1
  376. package/dist/services/session-data.d.ts.map +0 -1
  377. package/dist/services/session-telemetry.d.ts.map +0 -1
  378. package/dist/services/storage/file-team-store.d.ts.map +0 -1
  379. package/dist/services/storage/provider-settings-legacy-migration.d.ts.map +0 -1
  380. package/dist/services/storage/provider-settings-manager.d.ts.map +0 -1
  381. package/dist/services/storage/sqlite-session-store.d.ts.map +0 -1
  382. package/dist/services/storage/sqlite-team-store.d.ts.map +0 -1
  383. package/dist/services/storage/team-store.d.ts.map +0 -1
  384. package/dist/services/telemetry/ITelemetryAdapter.d.ts.map +0 -1
  385. package/dist/services/telemetry/OpenTelemetryAdapter.d.ts.map +0 -1
  386. package/dist/services/telemetry/OpenTelemetryProvider.d.ts.map +0 -1
  387. package/dist/services/telemetry/TelemetryLoggerSink.d.ts.map +0 -1
  388. package/dist/services/telemetry/TelemetryService.d.ts.map +0 -1
  389. package/dist/services/telemetry/core-events.d.ts.map +0 -1
  390. package/dist/services/telemetry/distinct-id.d.ts.map +0 -1
  391. package/dist/services/telemetry/index.d.ts.map +0 -1
  392. package/dist/services/usage.d.ts.map +0 -1
  393. package/dist/services/workspace/file-indexer.d.ts.map +0 -1
  394. package/dist/services/workspace/index.d.ts.map +0 -1
  395. package/dist/services/workspace/mention-enricher.d.ts.map +0 -1
  396. package/dist/services/workspace-manifest.d.ts.map +0 -1
  397. package/dist/session/conversation-store.d.ts.map +0 -1
  398. package/dist/session/file-session-service.d.ts.map +0 -1
  399. package/dist/session/message-builder.d.ts.map +0 -1
  400. package/dist/session/persistence-service.d.ts.map +0 -1
  401. package/dist/session/session-graph.d.ts.map +0 -1
  402. package/dist/session/session-manifest-store.d.ts.map +0 -1
  403. package/dist/session/session-manifest.d.ts.map +0 -1
  404. package/dist/session/session-row.d.ts.map +0 -1
  405. package/dist/session/session-service.d.ts.map +0 -1
  406. package/dist/session/session-team-coordination.d.ts.map +0 -1
  407. package/dist/session/subagent-session-manager.d.ts.map +0 -1
  408. package/dist/session/team-persistence-store.d.ts.map +0 -1
  409. package/dist/session/workspace-manager.d.ts.map +0 -1
  410. package/dist/transports/hub.d.ts +0 -58
  411. package/dist/transports/hub.d.ts.map +0 -1
  412. package/dist/transports/local.d.ts +0 -119
  413. package/dist/transports/local.d.ts.map +0 -1
  414. package/dist/transports/remote.d.ts.map +0 -1
  415. package/dist/transports/runtime-host-support.d.ts.map +0 -1
  416. package/dist/types/chat-schema.d.ts.map +0 -1
  417. package/dist/types/common.d.ts.map +0 -1
  418. package/dist/types/config.d.ts.map +0 -1
  419. package/dist/types/events.d.ts.map +0 -1
  420. package/dist/types/provider-settings.d.ts.map +0 -1
  421. package/dist/types/session.d.ts.map +0 -1
  422. package/dist/types/sessions.d.ts.map +0 -1
  423. package/dist/types/storage.d.ts.map +0 -1
  424. package/dist/types.d.ts.map +0 -1
  425. package/dist/version.d.ts.map +0 -1
  426. package/src/ClineCore.ts +0 -1026
  427. package/src/account/cline-account-service.ts +0 -338
  428. package/src/account/index.ts +0 -24
  429. package/src/account/rpc.ts +0 -185
  430. package/src/account/types.ts +0 -108
  431. package/src/auth/bounded-ttl-cache.ts +0 -53
  432. package/src/auth/client.ts +0 -46
  433. package/src/auth/cline.ts +0 -724
  434. package/src/auth/codex.ts +0 -491
  435. package/src/auth/oca.ts +0 -588
  436. package/src/auth/server.ts +0 -265
  437. package/src/auth/types.ts +0 -110
  438. package/src/auth/utils.ts +0 -247
  439. package/src/cron/cron-event-ingress.ts +0 -357
  440. package/src/cron/cron-materializer.ts +0 -97
  441. package/src/cron/cron-reconciler.ts +0 -241
  442. package/src/cron/cron-report-writer.ts +0 -153
  443. package/src/cron/cron-runner.ts +0 -495
  444. package/src/cron/cron-schema.ts +0 -127
  445. package/src/cron/cron-service.ts +0 -163
  446. package/src/cron/cron-spec-parser.ts +0 -489
  447. package/src/cron/cron-watcher.ts +0 -102
  448. package/src/cron/index.ts +0 -15
  449. package/src/cron/resource-limiter.ts +0 -46
  450. package/src/cron/schedule-command-service.ts +0 -193
  451. package/src/cron/schedule-service.ts +0 -703
  452. package/src/cron/scheduler.ts +0 -772
  453. package/src/cron/sqlite-cron-store.ts +0 -1286
  454. package/src/cron/sqlite-schedule-store.ts +0 -708
  455. package/src/extensions/config/agent-config-loader.ts +0 -114
  456. package/src/extensions/config/agent-config-parser.ts +0 -198
  457. package/src/extensions/config/hooks-config-loader.ts +0 -117
  458. package/src/extensions/config/index.ts +0 -77
  459. package/src/extensions/config/runtime-commands.ts +0 -82
  460. package/src/extensions/config/unified-config-file-watcher.ts +0 -496
  461. package/src/extensions/config/user-instruction-config-loader.ts +0 -549
  462. package/src/extensions/context/agentic-compaction.ts +0 -131
  463. package/src/extensions/context/basic-compaction.ts +0 -300
  464. package/src/extensions/context/compaction-shared.ts +0 -459
  465. package/src/extensions/context/compaction.ts +0 -226
  466. package/src/extensions/index.ts +0 -18
  467. package/src/extensions/mcp/client.ts +0 -420
  468. package/src/extensions/mcp/config-loader.ts +0 -219
  469. package/src/extensions/mcp/index.ts +0 -42
  470. package/src/extensions/mcp/manager.ts +0 -260
  471. package/src/extensions/mcp/name-transform.ts +0 -33
  472. package/src/extensions/mcp/policies.ts +0 -47
  473. package/src/extensions/mcp/tools.ts +0 -47
  474. package/src/extensions/mcp/types.ts +0 -116
  475. package/src/extensions/plugin/plugin-config-loader.ts +0 -140
  476. package/src/extensions/plugin/plugin-load-report.ts +0 -20
  477. package/src/extensions/plugin/plugin-loader.ts +0 -220
  478. package/src/extensions/plugin/plugin-module-import.ts +0 -276
  479. package/src/extensions/plugin/plugin-sandbox-bootstrap.ts +0 -662
  480. package/src/extensions/plugin/plugin-sandbox.ts +0 -586
  481. package/src/extensions/plugin/plugin-targeting.ts +0 -32
  482. package/src/extensions/tools/constants.ts +0 -37
  483. package/src/extensions/tools/definitions.ts +0 -738
  484. package/src/extensions/tools/executors/apply-patch-parser.ts +0 -520
  485. package/src/extensions/tools/executors/apply-patch.ts +0 -348
  486. package/src/extensions/tools/executors/bash.ts +0 -207
  487. package/src/extensions/tools/executors/editor.ts +0 -220
  488. package/src/extensions/tools/executors/file-read.ts +0 -135
  489. package/src/extensions/tools/executors/index.ts +0 -87
  490. package/src/extensions/tools/executors/search.ts +0 -470
  491. package/src/extensions/tools/executors/web-fetch.ts +0 -259
  492. package/src/extensions/tools/helpers.ts +0 -154
  493. package/src/extensions/tools/index.ts +0 -183
  494. package/src/extensions/tools/model-tool-routing.ts +0 -134
  495. package/src/extensions/tools/presets.ts +0 -190
  496. package/src/extensions/tools/runtime.ts +0 -261
  497. package/src/extensions/tools/schemas.ts +0 -343
  498. package/src/extensions/tools/team/delegated-agent.ts +0 -136
  499. package/src/extensions/tools/team/index.ts +0 -5
  500. package/src/extensions/tools/team/multi-agent.ts +0 -1845
  501. package/src/extensions/tools/team/projections.ts +0 -283
  502. package/src/extensions/tools/team/runtime.ts +0 -54
  503. package/src/extensions/tools/team/spawn-agent-tool.ts +0 -201
  504. package/src/extensions/tools/team/subagent-prompts.ts +0 -41
  505. package/src/extensions/tools/team/team-tools.ts +0 -902
  506. package/src/extensions/tools/types.ts +0 -354
  507. package/src/hooks/checkpoint-hooks.ts +0 -238
  508. package/src/hooks/hook-bridge.ts +0 -489
  509. package/src/hooks/hook-file-hooks.ts +0 -934
  510. package/src/hooks/hook-registry.ts +0 -257
  511. package/src/hooks/index.ts +0 -18
  512. package/src/hooks/subprocess-runner.ts +0 -196
  513. package/src/hooks/subprocess.ts +0 -469
  514. package/src/hub/browser-websocket.ts +0 -159
  515. package/src/hub/client.ts +0 -633
  516. package/src/hub/connect.ts +0 -156
  517. package/src/hub/daemon-entry.ts +0 -122
  518. package/src/hub/daemon.ts +0 -284
  519. package/src/hub/defaults.ts +0 -70
  520. package/src/hub/discovery.ts +0 -247
  521. package/src/hub/index.ts +0 -14
  522. package/src/hub/native-transport.ts +0 -31
  523. package/src/hub/runtime-handlers.ts +0 -141
  524. package/src/hub/server.ts +0 -2317
  525. package/src/hub/session-client.ts +0 -502
  526. package/src/hub/start-shared-server.ts +0 -61
  527. package/src/hub/transport.ts +0 -14
  528. package/src/hub/ui-client.ts +0 -126
  529. package/src/hub/workspace.ts +0 -19
  530. package/src/index.ts +0 -688
  531. package/src/llms/cline-recommended-models.ts +0 -167
  532. package/src/llms/configured-provider-registry.ts +0 -193
  533. package/src/llms/handler-factory.ts +0 -56
  534. package/src/llms/provider-defaults.ts +0 -653
  535. package/src/llms/provider-settings.ts +0 -310
  536. package/src/llms/runtime-config.ts +0 -43
  537. package/src/llms/runtime-registry.ts +0 -172
  538. package/src/llms/runtime-types.ts +0 -121
  539. package/src/runtime/agent-config-adapter.ts +0 -636
  540. package/src/runtime/agent-runtime-config-builder.ts +0 -205
  541. package/src/runtime/error-feedback.ts +0 -142
  542. package/src/runtime/history.ts +0 -374
  543. package/src/runtime/host.ts +0 -222
  544. package/src/runtime/index.ts +0 -23
  545. package/src/runtime/loop-detection.ts +0 -162
  546. package/src/runtime/mistake-tracker.ts +0 -221
  547. package/src/runtime/rules.ts +0 -49
  548. package/src/runtime/runtime-builder.ts +0 -814
  549. package/src/runtime/runtime-event-adapter.ts +0 -412
  550. package/src/runtime/runtime-host.ts +0 -250
  551. package/src/runtime/runtime-oauth-token-manager.ts +0 -268
  552. package/src/runtime/session-runtime-orchestrator.ts +0 -1253
  553. package/src/runtime/session-runtime.ts +0 -69
  554. package/src/runtime/subprocess-sandbox.ts +0 -255
  555. package/src/runtime/tool-approval.ts +0 -102
  556. package/src/runtime/user-input-builder.ts +0 -167
  557. package/src/services/agent-events.ts +0 -256
  558. package/src/services/config.ts +0 -5
  559. package/src/services/global-settings.ts +0 -122
  560. package/src/services/local-runtime-bootstrap.ts +0 -424
  561. package/src/services/plugin-tools.ts +0 -86
  562. package/src/services/providers/local-provider-registry.ts +0 -456
  563. package/src/services/providers/local-provider-service.ts +0 -772
  564. package/src/services/session-artifacts.ts +0 -138
  565. package/src/services/session-data.ts +0 -398
  566. package/src/services/session-telemetry.ts +0 -89
  567. package/src/services/storage/artifact-store.ts +0 -1
  568. package/src/services/storage/file-team-store.ts +0 -250
  569. package/src/services/storage/index.ts +0 -11
  570. package/src/services/storage/provider-settings-legacy-migration.ts +0 -789
  571. package/src/services/storage/provider-settings-manager.ts +0 -167
  572. package/src/services/storage/session-store.ts +0 -1
  573. package/src/services/storage/sqlite-session-store.ts +0 -270
  574. package/src/services/storage/sqlite-team-store.ts +0 -537
  575. package/src/services/storage/team-store.ts +0 -36
  576. package/src/services/telemetry/ITelemetryAdapter.ts +0 -94
  577. package/src/services/telemetry/OpenTelemetryAdapter.ts +0 -348
  578. package/src/services/telemetry/OpenTelemetryProvider.ts +0 -415
  579. package/src/services/telemetry/TelemetryLoggerSink.ts +0 -121
  580. package/src/services/telemetry/TelemetryService.ts +0 -139
  581. package/src/services/telemetry/core-events.ts +0 -400
  582. package/src/services/telemetry/distinct-id.ts +0 -58
  583. package/src/services/telemetry/index.ts +0 -20
  584. package/src/services/usage.ts +0 -32
  585. package/src/services/workspace/file-indexer.ts +0 -351
  586. package/src/services/workspace/index.ts +0 -7
  587. package/src/services/workspace/mention-enricher.ts +0 -122
  588. package/src/services/workspace-manifest.ts +0 -72
  589. package/src/session/conversation-store.ts +0 -77
  590. package/src/session/file-session-service.ts +0 -282
  591. package/src/session/index.ts +0 -32
  592. package/src/session/message-builder.ts +0 -941
  593. package/src/session/persistence-service.ts +0 -559
  594. package/src/session/session-graph.ts +0 -92
  595. package/src/session/session-manifest-store.ts +0 -158
  596. package/src/session/session-manifest.ts +0 -29
  597. package/src/session/session-row.ts +0 -199
  598. package/src/session/session-service.ts +0 -324
  599. package/src/session/session-team-coordination.ts +0 -240
  600. package/src/session/subagent-session-manager.ts +0 -397
  601. package/src/session/team-persistence-store.ts +0 -176
  602. package/src/session/workspace-manager.ts +0 -100
  603. package/src/transports/hub.ts +0 -1081
  604. package/src/transports/local.ts +0 -1826
  605. package/src/transports/remote.ts +0 -27
  606. package/src/transports/runtime-host-support.ts +0 -140
  607. package/src/types/chat-schema.ts +0 -81
  608. package/src/types/common.ts +0 -26
  609. package/src/types/config.ts +0 -220
  610. package/src/types/events.ts +0 -80
  611. package/src/types/index.ts +0 -26
  612. package/src/types/provider-settings.ts +0 -54
  613. package/src/types/session.ts +0 -111
  614. package/src/types/sessions.ts +0 -37
  615. package/src/types/storage.ts +0 -56
  616. package/src/types.ts +0 -167
  617. package/src/version.ts +0 -3
@@ -1,338 +0,0 @@
1
- import type {
2
- ClineAccountBalance,
3
- ClineAccountOrganization,
4
- ClineAccountOrganizationBalance,
5
- ClineAccountOrganizationUsageTransaction,
6
- ClineAccountPaymentTransaction,
7
- ClineAccountUsageTransaction,
8
- ClineAccountUser,
9
- ClineOrganization,
10
- FeaturebaseTokenResponse,
11
- UserRemoteConfigResponse,
12
- } from "./types";
13
-
14
- const DEFAULT_TIMEOUT_MS = 30_000;
15
-
16
- interface ClineApiEnvelope<T> {
17
- success?: boolean;
18
- error?: string;
19
- data?: T;
20
- }
21
-
22
- function getClineApiEnvelopeError(parsed: unknown): string | undefined {
23
- if (typeof parsed !== "object" || parsed === null || !("error" in parsed)) {
24
- return undefined;
25
- }
26
- const error = parsed.error;
27
- return typeof error === "string" && error.trim() ? error : undefined;
28
- }
29
-
30
- function formatClineAccountRequestFailure(
31
- status: number,
32
- bodyText: string,
33
- parsed: unknown,
34
- ): string {
35
- const envelopeError = getClineApiEnvelopeError(parsed);
36
- if (envelopeError) {
37
- return envelopeError;
38
- }
39
-
40
- const body = bodyText.trim();
41
- if (body) {
42
- const preview = body.length > 200 ? `${body.slice(0, 200)}...` : body;
43
- return `Cline account request failed with status ${status}: ${preview}`;
44
- }
45
-
46
- return `Cline account request failed with status ${status}`;
47
- }
48
-
49
- export interface ClineAccountServiceOptions {
50
- apiBaseUrl: string;
51
- getAuthToken: () => Promise<string | undefined | null>;
52
- getCurrentUserId?: () =>
53
- | Promise<string | undefined | null>
54
- | string
55
- | undefined
56
- | null;
57
- getOrganizationMemberId?: (
58
- organizationId: string,
59
- ) => Promise<string | undefined | null> | string | undefined | null;
60
- getHeaders?: () =>
61
- | Promise<Record<string, string> | undefined>
62
- | Record<string, string>
63
- | undefined;
64
- requestTimeoutMs?: number;
65
- fetchImpl?: typeof fetch;
66
- }
67
-
68
- export class ClineAccountService {
69
- private readonly apiBaseUrl: string;
70
- private readonly getAuthTokenFn: ClineAccountServiceOptions["getAuthToken"];
71
- private readonly getCurrentUserIdFn: ClineAccountServiceOptions["getCurrentUserId"];
72
- private readonly getOrganizationMemberIdFn: ClineAccountServiceOptions["getOrganizationMemberId"];
73
- private readonly getHeadersFn: ClineAccountServiceOptions["getHeaders"];
74
- private readonly requestTimeoutMs: number;
75
- private readonly fetchImpl: typeof fetch;
76
-
77
- constructor(options: ClineAccountServiceOptions) {
78
- const apiBaseUrl = options.apiBaseUrl.trim();
79
- if (!apiBaseUrl) {
80
- throw new Error("apiBaseUrl is required");
81
- }
82
-
83
- this.apiBaseUrl = apiBaseUrl;
84
- this.getAuthTokenFn = options.getAuthToken;
85
- this.getCurrentUserIdFn = options.getCurrentUserId;
86
- this.getOrganizationMemberIdFn = options.getOrganizationMemberId;
87
- this.getHeadersFn = options.getHeaders;
88
- this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_TIMEOUT_MS;
89
- this.fetchImpl = options.fetchImpl ?? fetch;
90
- }
91
-
92
- public async fetchMe(): Promise<ClineAccountUser> {
93
- return this.request<ClineAccountUser>("/api/v1/users/me");
94
- }
95
-
96
- public async fetchRemoteConfig(): Promise<UserRemoteConfigResponse | null> {
97
- return this.request<UserRemoteConfigResponse | null>(
98
- "/api/v1/users/me/remote-config",
99
- );
100
- }
101
-
102
- public async fetchFeaturebaseToken(): Promise<
103
- FeaturebaseTokenResponse | undefined
104
- > {
105
- try {
106
- return await this.request<FeaturebaseTokenResponse>(
107
- "/api/v1/users/me/featurebase-token",
108
- );
109
- } catch {
110
- return undefined;
111
- }
112
- }
113
-
114
- public async fetchBalance(userId?: string): Promise<ClineAccountBalance> {
115
- const resolvedUserId = await this.resolveUserId(userId);
116
- return this.request<ClineAccountBalance>(
117
- `/api/v1/users/${encodeURIComponent(resolvedUserId)}/balance`,
118
- );
119
- }
120
-
121
- public async fetchUsageTransactions(
122
- userId?: string,
123
- ): Promise<ClineAccountUsageTransaction[]> {
124
- const resolvedUserId = await this.resolveUserId(userId);
125
- const response = await this.request<{
126
- items: ClineAccountUsageTransaction[];
127
- }>(`/api/v1/users/${encodeURIComponent(resolvedUserId)}/usages`);
128
- return response.items ?? [];
129
- }
130
-
131
- public async fetchPaymentTransactions(
132
- userId?: string,
133
- ): Promise<ClineAccountPaymentTransaction[]> {
134
- const resolvedUserId = await this.resolveUserId(userId);
135
- const response = await this.request<{
136
- paymentTransactions: ClineAccountPaymentTransaction[];
137
- }>(`/api/v1/users/${encodeURIComponent(resolvedUserId)}/payments`);
138
- return response.paymentTransactions ?? [];
139
- }
140
-
141
- public async fetchUserOrganizations(): Promise<ClineAccountOrganization[]> {
142
- const me = await this.fetchMe();
143
- return me.organizations ?? [];
144
- }
145
-
146
- public async fetchOrganization(
147
- organizationId: string,
148
- ): Promise<ClineOrganization> {
149
- const orgId = organizationId.trim();
150
- if (!orgId) {
151
- throw new Error("organizationId is required");
152
- }
153
- return this.request<ClineOrganization>(
154
- `/api/v1/organizations/${encodeURIComponent(orgId)}`,
155
- );
156
- }
157
-
158
- public async fetchOrganizationBalance(
159
- organizationId: string,
160
- ): Promise<ClineAccountOrganizationBalance> {
161
- const orgId = organizationId.trim();
162
- if (!orgId) {
163
- throw new Error("organizationId is required");
164
- }
165
- return this.request<ClineAccountOrganizationBalance>(
166
- `/api/v1/organizations/${encodeURIComponent(orgId)}/balance`,
167
- );
168
- }
169
-
170
- public async fetchOrganizationUsageTransactions(input: {
171
- organizationId: string;
172
- memberId?: string;
173
- }): Promise<ClineAccountOrganizationUsageTransaction[]> {
174
- const organizationId = input.organizationId.trim();
175
- if (!organizationId) {
176
- throw new Error("organizationId is required");
177
- }
178
-
179
- const memberId = await this.resolveOrganizationMemberId(
180
- organizationId,
181
- input.memberId,
182
- );
183
- const response = await this.request<{
184
- items: ClineAccountOrganizationUsageTransaction[];
185
- }>(
186
- `/api/v1/organizations/${encodeURIComponent(organizationId)}/members/${encodeURIComponent(memberId)}/usages`,
187
- );
188
- return response.items ?? [];
189
- }
190
-
191
- public async switchAccount(organizationId?: string | null): Promise<void> {
192
- await this.request<void>("/api/v1/users/active-account", {
193
- method: "PUT",
194
- body: {
195
- organizationId: organizationId?.trim() || null,
196
- },
197
- expectNoContent: true,
198
- });
199
- }
200
-
201
- private async resolveUserId(userId?: string): Promise<string> {
202
- const explicit = userId?.trim();
203
- if (explicit) {
204
- return explicit;
205
- }
206
-
207
- const fromProvider = this.getCurrentUserIdFn
208
- ? await this.getCurrentUserIdFn()
209
- : undefined;
210
- const provided = fromProvider?.trim();
211
- if (provided) {
212
- return provided;
213
- }
214
-
215
- const me = await this.fetchMe();
216
- if (!me.id?.trim()) {
217
- throw new Error("Unable to resolve current user id");
218
- }
219
- return me.id;
220
- }
221
-
222
- private async resolveOrganizationMemberId(
223
- organizationId: string,
224
- memberId?: string,
225
- ): Promise<string> {
226
- const explicit = memberId?.trim();
227
- if (explicit) {
228
- return explicit;
229
- }
230
-
231
- const fromProvider = this.getOrganizationMemberIdFn
232
- ? await this.getOrganizationMemberIdFn(organizationId)
233
- : undefined;
234
- const provided = fromProvider?.trim();
235
- if (provided) {
236
- return provided;
237
- }
238
-
239
- const organizations = await this.fetchUserOrganizations();
240
- const resolved = organizations.find(
241
- (org) => org.organizationId === organizationId,
242
- )?.memberId;
243
- if (!resolved?.trim()) {
244
- throw new Error(
245
- `Unable to resolve memberId for organization ${organizationId}`,
246
- );
247
- }
248
- return resolved;
249
- }
250
-
251
- private async request<T>(
252
- endpoint: string,
253
- input?: {
254
- method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
255
- body?: unknown;
256
- expectNoContent?: boolean;
257
- },
258
- ): Promise<T> {
259
- const token = (await this.getAuthTokenFn())?.trim();
260
- if (!token) {
261
- throw new Error("No Cline account auth token found");
262
- }
263
-
264
- const extraHeaders = this.getHeadersFn ? await this.getHeadersFn() : {};
265
- const controller = new AbortController();
266
- const timeout = setTimeout(() => controller.abort(), this.requestTimeoutMs);
267
-
268
- try {
269
- const response = await this.fetchImpl(
270
- new URL(endpoint, this.apiBaseUrl),
271
- {
272
- method: input?.method ?? "GET",
273
- headers: {
274
- Authorization: `Bearer ${token}`,
275
- "Content-Type": "application/json",
276
- ...(extraHeaders ?? {}),
277
- },
278
- body:
279
- input?.body !== undefined ? JSON.stringify(input.body) : undefined,
280
- signal: controller.signal,
281
- },
282
- );
283
-
284
- if (response.status === 204 || input?.expectNoContent) {
285
- if (!response.ok) {
286
- throw new Error(
287
- `Cline account request failed with status ${response.status}`,
288
- );
289
- }
290
- return undefined as T;
291
- }
292
-
293
- const text = await response.text();
294
- let parsed: unknown;
295
- if (text.trim()) {
296
- try {
297
- parsed = JSON.parse(text);
298
- } catch {
299
- if (!response.ok) {
300
- throw new Error(
301
- formatClineAccountRequestFailure(
302
- response.status,
303
- text,
304
- undefined,
305
- ),
306
- );
307
- }
308
- throw new Error("Cline account response was not valid JSON");
309
- }
310
- }
311
-
312
- if (!response.ok) {
313
- throw new Error(
314
- formatClineAccountRequestFailure(response.status, text, parsed),
315
- );
316
- }
317
-
318
- if (typeof parsed === "object" && parsed !== null) {
319
- const envelope = parsed as ClineApiEnvelope<T>;
320
- if (typeof envelope.success === "boolean") {
321
- if (!envelope.success) {
322
- throw new Error(envelope.error || "Cline account request failed");
323
- }
324
- if (envelope.data !== undefined) {
325
- return envelope.data;
326
- }
327
- }
328
- }
329
-
330
- if (parsed === undefined || parsed === null) {
331
- throw new Error("Cline account response payload was empty");
332
- }
333
- return parsed as T;
334
- } finally {
335
- clearTimeout(timeout);
336
- }
337
- }
338
- }
@@ -1,24 +0,0 @@
1
- export {
2
- ClineAccountService,
3
- type ClineAccountServiceOptions,
4
- } from "./cline-account-service";
5
- export {
6
- type ClineAccountOperations,
7
- executeClineAccountAction,
8
- isClineAccountActionRequest,
9
- type ProviderActionExecutor,
10
- RpcClineAccountService,
11
- } from "./rpc";
12
- export type {
13
- ClineAccountBalance,
14
- ClineAccountOrganization,
15
- ClineAccountOrganizationBalance,
16
- ClineAccountOrganizationUsageTransaction,
17
- ClineAccountPaymentTransaction,
18
- ClineAccountUsageTransaction,
19
- ClineAccountUser,
20
- ClineOrganization,
21
- FeaturebaseTokenResponse,
22
- UserRemoteConfigOrganization,
23
- UserRemoteConfigResponse,
24
- } from "./types";
@@ -1,185 +0,0 @@
1
- import type {
2
- ClineAccountActionRequest,
3
- ProviderActionRequest,
4
- } from "@clinebot/shared";
5
- import type {
6
- ClineAccountBalance,
7
- ClineAccountOrganization,
8
- ClineAccountOrganizationBalance,
9
- ClineAccountOrganizationUsageTransaction,
10
- ClineAccountPaymentTransaction,
11
- ClineAccountUsageTransaction,
12
- ClineAccountUser,
13
- FeaturebaseTokenResponse,
14
- } from "./types";
15
-
16
- export interface ClineAccountOperations {
17
- fetchMe(): Promise<ClineAccountUser>;
18
- fetchBalance(userId?: string): Promise<ClineAccountBalance>;
19
- fetchUsageTransactions(
20
- userId?: string,
21
- ): Promise<ClineAccountUsageTransaction[]>;
22
- fetchPaymentTransactions(
23
- userId?: string,
24
- ): Promise<ClineAccountPaymentTransaction[]>;
25
- fetchUserOrganizations(): Promise<ClineAccountOrganization[]>;
26
- fetchOrganizationBalance(
27
- organizationId: string,
28
- ): Promise<ClineAccountOrganizationBalance>;
29
- fetchOrganizationUsageTransactions(input: {
30
- organizationId: string;
31
- memberId?: string;
32
- }): Promise<ClineAccountOrganizationUsageTransaction[]>;
33
- switchAccount(organizationId?: string | null): Promise<void>;
34
- fetchFeaturebaseToken?(): Promise<FeaturebaseTokenResponse | undefined>;
35
- }
36
-
37
- export function isClineAccountActionRequest(
38
- request: ProviderActionRequest,
39
- ): request is ClineAccountActionRequest {
40
- return request.action === "clineAccount";
41
- }
42
-
43
- export async function executeClineAccountAction(
44
- request: ClineAccountActionRequest,
45
- service: ClineAccountOperations,
46
- ): Promise<unknown> {
47
- switch (request.operation) {
48
- case "fetchMe":
49
- return service.fetchMe();
50
- case "fetchBalance":
51
- return service.fetchBalance(request.userId);
52
- case "fetchUsageTransactions":
53
- return service.fetchUsageTransactions(request.userId);
54
- case "fetchPaymentTransactions":
55
- return service.fetchPaymentTransactions(request.userId);
56
- case "fetchUserOrganizations":
57
- return service.fetchUserOrganizations();
58
- case "fetchOrganizationBalance":
59
- return service.fetchOrganizationBalance(request.organizationId);
60
- case "fetchOrganizationUsageTransactions":
61
- return service.fetchOrganizationUsageTransactions({
62
- organizationId: request.organizationId,
63
- memberId: request.memberId,
64
- });
65
- case "switchAccount":
66
- await service.switchAccount(request.organizationId);
67
- return { updated: true };
68
- case "fetchFeaturebaseToken":
69
- return service.fetchFeaturebaseToken?.();
70
- default: {
71
- const exhaustive: never = request;
72
- throw new Error(
73
- `Unsupported Cline account operation: ${String(exhaustive)}`,
74
- );
75
- }
76
- }
77
- }
78
-
79
- export interface ProviderActionExecutor {
80
- runProviderAction(request: ProviderActionRequest): Promise<{
81
- result: unknown;
82
- }>;
83
- }
84
-
85
- export class RpcClineAccountService implements ClineAccountOperations {
86
- private readonly executor: ProviderActionExecutor;
87
-
88
- constructor(executor: ProviderActionExecutor) {
89
- this.executor = executor;
90
- }
91
-
92
- public async fetchMe(): Promise<ClineAccountUser> {
93
- return this.request<ClineAccountUser>({
94
- action: "clineAccount",
95
- operation: "fetchMe",
96
- });
97
- }
98
-
99
- public async fetchBalance(userId?: string): Promise<ClineAccountBalance> {
100
- return this.request<ClineAccountBalance>({
101
- action: "clineAccount",
102
- operation: "fetchBalance",
103
- ...(userId?.trim() ? { userId: userId.trim() } : {}),
104
- });
105
- }
106
-
107
- public async fetchUsageTransactions(
108
- userId?: string,
109
- ): Promise<ClineAccountUsageTransaction[]> {
110
- return this.request<ClineAccountUsageTransaction[]>({
111
- action: "clineAccount",
112
- operation: "fetchUsageTransactions",
113
- ...(userId?.trim() ? { userId: userId.trim() } : {}),
114
- });
115
- }
116
-
117
- public async fetchPaymentTransactions(
118
- userId?: string,
119
- ): Promise<ClineAccountPaymentTransaction[]> {
120
- return this.request<ClineAccountPaymentTransaction[]>({
121
- action: "clineAccount",
122
- operation: "fetchPaymentTransactions",
123
- ...(userId?.trim() ? { userId: userId.trim() } : {}),
124
- });
125
- }
126
-
127
- public async fetchUserOrganizations(): Promise<ClineAccountOrganization[]> {
128
- return this.request<ClineAccountOrganization[]>({
129
- action: "clineAccount",
130
- operation: "fetchUserOrganizations",
131
- });
132
- }
133
-
134
- public async fetchOrganizationBalance(
135
- organizationId: string,
136
- ): Promise<ClineAccountOrganizationBalance> {
137
- const orgId = organizationId.trim();
138
- if (!orgId) {
139
- throw new Error("organizationId is required");
140
- }
141
- return this.request<ClineAccountOrganizationBalance>({
142
- action: "clineAccount",
143
- operation: "fetchOrganizationBalance",
144
- organizationId: orgId,
145
- });
146
- }
147
-
148
- public async fetchOrganizationUsageTransactions(input: {
149
- organizationId: string;
150
- memberId?: string;
151
- }): Promise<ClineAccountOrganizationUsageTransaction[]> {
152
- const orgId = input.organizationId.trim();
153
- if (!orgId) {
154
- throw new Error("organizationId is required");
155
- }
156
- return this.request<ClineAccountOrganizationUsageTransaction[]>({
157
- action: "clineAccount",
158
- operation: "fetchOrganizationUsageTransactions",
159
- organizationId: orgId,
160
- ...(input.memberId?.trim() ? { memberId: input.memberId.trim() } : {}),
161
- });
162
- }
163
-
164
- public async switchAccount(organizationId?: string | null): Promise<void> {
165
- await this.request<{ updated: boolean }>({
166
- action: "clineAccount",
167
- operation: "switchAccount",
168
- organizationId: organizationId?.trim() || null,
169
- });
170
- }
171
-
172
- public async fetchFeaturebaseToken(): Promise<
173
- FeaturebaseTokenResponse | undefined
174
- > {
175
- return this.request<FeaturebaseTokenResponse | undefined>({
176
- action: "clineAccount",
177
- operation: "fetchFeaturebaseToken",
178
- });
179
- }
180
-
181
- private async request<T>(request: ClineAccountActionRequest): Promise<T> {
182
- const response = await this.executor.runProviderAction(request);
183
- return response.result as T;
184
- }
185
- }
@@ -1,108 +0,0 @@
1
- export interface ClineAccountOrganization {
2
- active: boolean;
3
- memberId: string;
4
- name: string;
5
- organizationId: string;
6
- roles: Array<"admin" | "member" | "owner">;
7
- }
8
-
9
- export interface ClineAccountUser {
10
- id: string;
11
- email: string;
12
- displayName: string;
13
- photoUrl: string;
14
- createdAt: string;
15
- updatedAt: string;
16
- organizations: ClineAccountOrganization[];
17
- }
18
-
19
- export interface UserRemoteConfigOrganization {
20
- organizationId: string;
21
- name: string;
22
- }
23
-
24
- export interface UserRemoteConfigResponse {
25
- organizationId: string;
26
- value: string;
27
- enabled: boolean;
28
- organizations?: UserRemoteConfigOrganization[];
29
- }
30
-
31
- export interface ClineAccountBalance {
32
- balance: number;
33
- userId: string;
34
- }
35
-
36
- export interface ClineAccountUsageTransaction {
37
- aiInferenceProviderName: string;
38
- aiModelName: string;
39
- aiModelTypeName: string;
40
- completionTokens: number;
41
- costUsd: number;
42
- createdAt: string;
43
- creditsUsed: number;
44
- generationId: string;
45
- id: string;
46
- metadata: {
47
- additionalProp1: string;
48
- additionalProp2: string;
49
- additionalProp3: string;
50
- };
51
- operation?: string;
52
- organizationId: string;
53
- promptTokens: number;
54
- totalTokens: number;
55
- userId: string;
56
- }
57
-
58
- export interface ClineAccountPaymentTransaction {
59
- paidAt: string;
60
- creatorId: string;
61
- amountCents: number;
62
- credits: number;
63
- }
64
-
65
- export interface ClineOrganization {
66
- createdAt: string;
67
- defaultRemoteConfig?: string;
68
- deletedAt?: string;
69
- externalOrganizationId?: string;
70
- id: string;
71
- memberCount?: number;
72
- name: string;
73
- remoteConfigEnabled: boolean;
74
- updatedAt: string;
75
- }
76
-
77
- export interface ClineAccountOrganizationBalance {
78
- balance: number;
79
- organizationId: string;
80
- }
81
-
82
- export interface FeaturebaseTokenResponse {
83
- featurebaseJwt: string;
84
- }
85
-
86
- export interface ClineAccountOrganizationUsageTransaction {
87
- aiInferenceProviderName: string;
88
- aiModelName: string;
89
- aiModelTypeName: string;
90
- completionTokens: number;
91
- costUsd: number;
92
- createdAt: string;
93
- creditsUsed: number;
94
- generationId: string;
95
- id: string;
96
- memberDisplayName: string;
97
- memberEmail: string;
98
- metadata: {
99
- additionalProp1: string;
100
- additionalProp2: string;
101
- additionalProp3: string;
102
- };
103
- operation?: string;
104
- organizationId: string;
105
- promptTokens: number;
106
- totalTokens: number;
107
- userId: string;
108
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * Small process-local string cache with TTL expiry and a hard entry cap.
3
- * Used where unbounded Maps would grow without bound in long-running processes.
4
- */
5
- export class BoundedTtlCache {
6
- private readonly entries = new Map<
7
- string,
8
- { value: string; expiresAt: number }
9
- >();
10
-
11
- constructor(
12
- private readonly ttlMs: number,
13
- private readonly maxEntries: number,
14
- ) {}
15
-
16
- get(key: string, now = Date.now()): string | undefined {
17
- this.pruneExpired(now);
18
- const hit = this.entries.get(key);
19
- if (!hit) {
20
- return undefined;
21
- }
22
- // Bump recency for FIFO eviction under cap.
23
- this.entries.delete(key);
24
- this.entries.set(key, hit);
25
- return hit.value;
26
- }
27
-
28
- set(
29
- key: string,
30
- value: string,
31
- now = Date.now(),
32
- ttlMsOverride = this.ttlMs,
33
- ): void {
34
- this.pruneExpired(now);
35
- this.entries.delete(key);
36
- while (this.entries.size >= this.maxEntries) {
37
- const first = this.entries.keys().next().value as string | undefined;
38
- if (first === undefined) {
39
- break;
40
- }
41
- this.entries.delete(first);
42
- }
43
- this.entries.set(key, { value, expiresAt: now + ttlMsOverride });
44
- }
45
-
46
- private pruneExpired(now: number): void {
47
- for (const [k, v] of this.entries) {
48
- if (v.expiresAt <= now) {
49
- this.entries.delete(k);
50
- }
51
- }
52
- }
53
- }