@vybestack/llxprt-code 0.1.12 → 0.1.13-nightly.250727.2261021c

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 (246) hide show
  1. package/dist/index.js +0 -0
  2. package/dist/package.json +5 -5
  3. package/dist/src/acp/acp.d.ts +208 -0
  4. package/dist/src/acp/acp.js +193 -0
  5. package/dist/src/acp/acp.js.map +1 -0
  6. package/dist/src/acp/acpPeer.d.ts +8 -0
  7. package/dist/src/acp/acpPeer.js +537 -0
  8. package/dist/src/acp/acpPeer.js.map +1 -0
  9. package/dist/src/config/config.d.ts +2 -0
  10. package/dist/src/config/config.js +73 -19
  11. package/dist/src/config/config.js.map +1 -1
  12. package/dist/src/config/extension.d.ts +2 -2
  13. package/dist/src/config/extension.js +21 -16
  14. package/dist/src/config/extension.js.map +1 -1
  15. package/dist/src/config/settings.d.ts +7 -0
  16. package/dist/src/config/settings.js +15 -0
  17. package/dist/src/config/settings.js.map +1 -1
  18. package/dist/src/gemini.js +33 -34
  19. package/dist/src/gemini.js.map +1 -1
  20. package/dist/src/generated/git-commit.d.ts +1 -1
  21. package/dist/src/generated/git-commit.js +1 -1
  22. package/dist/src/nonInteractiveCli.js +36 -3
  23. package/dist/src/nonInteractiveCli.js.map +1 -1
  24. package/dist/src/providers/index.d.ts +1 -7
  25. package/dist/src/providers/index.js +2 -10
  26. package/dist/src/providers/index.js.map +1 -1
  27. package/dist/src/providers/providerConfigUtils.d.ts +1 -2
  28. package/dist/src/providers/providerConfigUtils.js +1 -1
  29. package/dist/src/providers/providerConfigUtils.js.map +1 -1
  30. package/dist/src/providers/providerManagerInstance.d.ts +2 -2
  31. package/dist/src/providers/providerManagerInstance.js +21 -19
  32. package/dist/src/providers/providerManagerInstance.js.map +1 -1
  33. package/dist/src/providers/types.d.ts +1 -9
  34. package/dist/src/providers/types.js +2 -10
  35. package/dist/src/providers/types.js.map +1 -1
  36. package/dist/src/services/CommandService.d.ts +3 -1
  37. package/dist/src/services/CommandService.js +50 -11
  38. package/dist/src/services/CommandService.js.map +1 -1
  39. package/dist/src/ui/App.js +24 -25
  40. package/dist/src/ui/App.js.map +1 -1
  41. package/dist/src/ui/commands/aboutCommand.js +21 -0
  42. package/dist/src/ui/commands/aboutCommand.js.map +1 -1
  43. package/dist/src/ui/commands/baseurlCommand.d.ts +7 -0
  44. package/dist/src/ui/commands/baseurlCommand.js +22 -0
  45. package/dist/src/ui/commands/baseurlCommand.js.map +1 -0
  46. package/dist/src/ui/commands/bugCommand.d.ts +7 -0
  47. package/dist/src/ui/commands/bugCommand.js +61 -0
  48. package/dist/src/ui/commands/bugCommand.js.map +1 -0
  49. package/dist/src/ui/commands/chatCommand.d.ts +7 -0
  50. package/dist/src/ui/commands/chatCommand.js +170 -0
  51. package/dist/src/ui/commands/chatCommand.js.map +1 -0
  52. package/dist/src/ui/commands/clearCommand.js +12 -2
  53. package/dist/src/ui/commands/clearCommand.js.map +1 -1
  54. package/dist/src/ui/commands/compressCommand.d.ts +7 -0
  55. package/dist/src/ui/commands/compressCommand.js +62 -0
  56. package/dist/src/ui/commands/compressCommand.js.map +1 -0
  57. package/dist/src/ui/commands/docsCommand.d.ts +7 -0
  58. package/dist/src/ui/commands/docsCommand.js +29 -0
  59. package/dist/src/ui/commands/docsCommand.js.map +1 -0
  60. package/dist/src/ui/commands/editorCommand.d.ts +7 -0
  61. package/dist/src/ui/commands/editorCommand.js +14 -0
  62. package/dist/src/ui/commands/editorCommand.js.map +1 -0
  63. package/dist/src/ui/commands/extensionsCommand.d.ts +7 -0
  64. package/dist/src/ui/commands/extensionsCommand.js +29 -0
  65. package/dist/src/ui/commands/extensionsCommand.js.map +1 -0
  66. package/dist/src/ui/commands/ideCommand.d.ts +8 -0
  67. package/dist/src/ui/commands/ideCommand.js +123 -0
  68. package/dist/src/ui/commands/ideCommand.js.map +1 -0
  69. package/dist/src/{providers/ProviderAwareContentGenerator.d.ts → ui/commands/keyCommand.d.ts} +2 -1
  70. package/dist/src/ui/commands/keyCommand.js +29 -0
  71. package/dist/src/ui/commands/keyCommand.js.map +1 -0
  72. package/dist/src/ui/commands/keyfileCommand.d.ts +7 -0
  73. package/dist/src/ui/commands/keyfileCommand.js +104 -0
  74. package/dist/src/ui/commands/keyfileCommand.js.map +1 -0
  75. package/dist/src/ui/commands/mcpCommand.d.ts +7 -0
  76. package/dist/src/ui/commands/mcpCommand.js +204 -0
  77. package/dist/src/ui/commands/mcpCommand.js.map +1 -0
  78. package/dist/src/ui/commands/modelCommand.d.ts +7 -0
  79. package/dist/src/ui/commands/modelCommand.js +60 -0
  80. package/dist/src/ui/commands/modelCommand.js.map +1 -0
  81. package/dist/src/ui/commands/providerCommand.d.ts +7 -0
  82. package/dist/src/ui/commands/providerCommand.js +86 -0
  83. package/dist/src/ui/commands/providerCommand.js.map +1 -0
  84. package/dist/src/ui/commands/quitCommand.d.ts +7 -0
  85. package/dist/src/ui/commands/quitCommand.js +32 -0
  86. package/dist/src/ui/commands/quitCommand.js.map +1 -0
  87. package/dist/src/ui/commands/restoreCommand.d.ts +8 -0
  88. package/dist/src/ui/commands/restoreCommand.js +126 -0
  89. package/dist/src/ui/commands/restoreCommand.js.map +1 -0
  90. package/dist/src/ui/commands/statsCommand.d.ts +7 -0
  91. package/dist/src/ui/commands/statsCommand.js +50 -0
  92. package/dist/src/ui/commands/statsCommand.js.map +1 -0
  93. package/dist/src/ui/commands/toolsCommand.d.ts +7 -0
  94. package/dist/src/ui/commands/toolsCommand.js +54 -0
  95. package/dist/src/ui/commands/toolsCommand.js.map +1 -0
  96. package/dist/src/ui/commands/types.d.ts +34 -2
  97. package/dist/src/ui/components/ContextSummaryDisplay.d.ts +6 -1
  98. package/dist/src/ui/components/ContextSummaryDisplay.js +46 -19
  99. package/dist/src/ui/components/ContextSummaryDisplay.js.map +1 -1
  100. package/dist/src/ui/components/Footer.d.ts +0 -1
  101. package/dist/src/ui/components/Footer.js +3 -21
  102. package/dist/src/ui/components/Footer.js.map +1 -1
  103. package/dist/src/ui/components/InputPrompt.js +110 -61
  104. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  105. package/dist/src/ui/components/ProviderModelDialog.d.ts +1 -1
  106. package/dist/src/ui/components/ThemeDialog.js +25 -24
  107. package/dist/src/ui/components/ThemeDialog.js.map +1 -1
  108. package/dist/src/ui/components/messages/ToolGroupMessage.js +3 -1
  109. package/dist/src/ui/components/messages/ToolGroupMessage.js.map +1 -1
  110. package/dist/src/ui/components/shared/MaxSizedBox.js +69 -2
  111. package/dist/src/ui/components/shared/MaxSizedBox.js.map +1 -1
  112. package/dist/src/ui/components/shared/RadioButtonSelect.d.ts +3 -1
  113. package/dist/src/ui/components/shared/RadioButtonSelect.js +60 -10
  114. package/dist/src/ui/components/shared/RadioButtonSelect.js.map +1 -1
  115. package/dist/src/ui/components/shared/text-buffer.js +1 -1
  116. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  117. package/dist/src/ui/constants.d.ts +1 -0
  118. package/dist/src/ui/constants.js +1 -0
  119. package/dist/src/ui/constants.js.map +1 -1
  120. package/dist/src/ui/containers/SessionController.js +1 -1
  121. package/dist/src/ui/containers/SessionController.js.map +1 -1
  122. package/dist/src/ui/contexts/OpenAIProviderContext.d.ts +1 -2
  123. package/dist/src/ui/contexts/OpenAIProviderContext.js.map +1 -1
  124. package/dist/src/ui/hooks/shellCommandProcessor.d.ts +1 -1
  125. package/dist/src/ui/hooks/shellCommandProcessor.js +35 -11
  126. package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
  127. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +2 -9
  128. package/dist/src/ui/hooks/slashCommandProcessor.js +83 -622
  129. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  130. package/dist/src/ui/hooks/useAuthCommand.js +16 -2
  131. package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
  132. package/dist/src/ui/hooks/useCompletion.d.ts +1 -0
  133. package/dist/src/ui/hooks/useCompletion.js +21 -2
  134. package/dist/src/ui/hooks/useCompletion.js.map +1 -1
  135. package/dist/src/ui/hooks/useFocus.d.ts +6 -0
  136. package/dist/src/ui/hooks/useFocus.js +41 -0
  137. package/dist/src/ui/hooks/useFocus.js.map +1 -0
  138. package/dist/src/ui/hooks/useGeminiStream.js +34 -2
  139. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  140. package/dist/src/ui/hooks/useOpenAIProviderInfo.d.ts +3 -2
  141. package/dist/src/ui/hooks/useOpenAIProviderInfo.js +5 -4
  142. package/dist/src/ui/hooks/useOpenAIProviderInfo.js.map +1 -1
  143. package/dist/src/ui/hooks/usePrivacySettings.js +5 -5
  144. package/dist/src/ui/hooks/usePrivacySettings.js.map +1 -1
  145. package/dist/src/ui/hooks/useProviderDialog.d.ts +5 -2
  146. package/dist/src/ui/hooks/useProviderDialog.js +55 -3
  147. package/dist/src/ui/hooks/useProviderDialog.js.map +1 -1
  148. package/dist/src/ui/hooks/useProviderModelDialog.d.ts +1 -1
  149. package/dist/src/ui/themes/ansi-light.js +1 -1
  150. package/dist/src/ui/themes/ansi-light.js.map +1 -1
  151. package/dist/src/ui/themes/googlecode.js +1 -1
  152. package/dist/src/ui/themes/googlecode.js.map +1 -1
  153. package/dist/src/ui/themes/xcode.js +1 -1
  154. package/dist/src/ui/themes/xcode.js.map +1 -1
  155. package/dist/src/ui/types.d.ts +10 -0
  156. package/dist/src/ui/types.js.map +1 -1
  157. package/dist/src/ui/utils/updateCheck.js +10 -6
  158. package/dist/src/ui/utils/updateCheck.js.map +1 -1
  159. package/dist/src/utils/userStartupWarnings.js +1 -16
  160. package/dist/src/utils/userStartupWarnings.js.map +1 -1
  161. package/dist/tsconfig.tsbuildinfo +1 -1
  162. package/package.json +5 -5
  163. package/dist/src/providers/IMessage.d.ts +0 -38
  164. package/dist/src/providers/IMessage.js +0 -17
  165. package/dist/src/providers/IMessage.js.map +0 -1
  166. package/dist/src/providers/IModel.d.ts +0 -23
  167. package/dist/src/providers/IModel.js +0 -17
  168. package/dist/src/providers/IModel.js.map +0 -1
  169. package/dist/src/providers/IProvider.d.ts +0 -32
  170. package/dist/src/providers/IProvider.js +0 -17
  171. package/dist/src/providers/IProvider.js.map +0 -1
  172. package/dist/src/providers/ITool.d.ts +0 -23
  173. package/dist/src/providers/ITool.js +0 -17
  174. package/dist/src/providers/ITool.js.map +0 -1
  175. package/dist/src/providers/ProviderAwareContentGenerator.js +0 -9
  176. package/dist/src/providers/ProviderAwareContentGenerator.js.map +0 -1
  177. package/dist/src/providers/ProviderManager.d.ts +0 -19
  178. package/dist/src/providers/ProviderManager.js +0 -63
  179. package/dist/src/providers/ProviderManager.js.map +0 -1
  180. package/dist/src/providers/ProviderManagerAdapter.d.ts +0 -17
  181. package/dist/src/providers/ProviderManagerAdapter.js +0 -113
  182. package/dist/src/providers/ProviderManagerAdapter.js.map +0 -1
  183. package/dist/src/providers/README-qwen3.md +0 -60
  184. package/dist/src/providers/adapters/IStreamAdapter.d.ts +0 -18
  185. package/dist/src/providers/adapters/IStreamAdapter.js +0 -7
  186. package/dist/src/providers/adapters/IStreamAdapter.js.map +0 -1
  187. package/dist/src/providers/anthropic/AnthropicProvider.d.ts +0 -46
  188. package/dist/src/providers/anthropic/AnthropicProvider.js +0 -478
  189. package/dist/src/providers/anthropic/AnthropicProvider.js.map +0 -1
  190. package/dist/src/providers/contentGeneratorProvider.d.ts +0 -13
  191. package/dist/src/providers/contentGeneratorProvider.js +0 -17
  192. package/dist/src/providers/contentGeneratorProvider.js.map +0 -1
  193. package/dist/src/providers/gemini/GeminiProvider.d.ts +0 -72
  194. package/dist/src/providers/gemini/GeminiProvider.js +0 -454
  195. package/dist/src/providers/gemini/GeminiProvider.js.map +0 -1
  196. package/dist/src/providers/integration/TEST_INSTRUCTIONS.md +0 -197
  197. package/dist/src/providers/openai/ConversationCache.d.ts +0 -20
  198. package/dist/src/providers/openai/ConversationCache.js +0 -109
  199. package/dist/src/providers/openai/ConversationCache.js.map +0 -1
  200. package/dist/src/providers/openai/IChatGenerateParams.d.ts +0 -11
  201. package/dist/src/providers/openai/IChatGenerateParams.js +0 -2
  202. package/dist/src/providers/openai/IChatGenerateParams.js.map +0 -1
  203. package/dist/src/providers/openai/OpenAIProvider.d.ts +0 -71
  204. package/dist/src/providers/openai/OpenAIProvider.js +0 -486
  205. package/dist/src/providers/openai/OpenAIProvider.js.map +0 -1
  206. package/dist/src/providers/openai/Qwen3FireworksProvider.d.ts +0 -39
  207. package/dist/src/providers/openai/Qwen3FireworksProvider.js +0 -209
  208. package/dist/src/providers/openai/Qwen3FireworksProvider.js.map +0 -1
  209. package/dist/src/providers/openai/RESPONSES_API_MODELS.d.ts +0 -2
  210. package/dist/src/providers/openai/RESPONSES_API_MODELS.js +0 -14
  211. package/dist/src/providers/openai/RESPONSES_API_MODELS.js.map +0 -1
  212. package/dist/src/providers/openai/buildResponsesRequest.d.ts +0 -67
  213. package/dist/src/providers/openai/buildResponsesRequest.js +0 -144
  214. package/dist/src/providers/openai/buildResponsesRequest.js.map +0 -1
  215. package/dist/src/providers/openai/docs/accessing-provider-info.md +0 -172
  216. package/dist/src/providers/openai/docs/params-mapping.md +0 -91
  217. package/dist/src/providers/openai/docs/qwen3-fireworks.md +0 -47
  218. package/dist/src/providers/openai/docs/responses-api-tool-calls.md +0 -96
  219. package/dist/src/providers/openai/estimateRemoteTokens.d.ts +0 -26
  220. package/dist/src/providers/openai/estimateRemoteTokens.js +0 -75
  221. package/dist/src/providers/openai/estimateRemoteTokens.js.map +0 -1
  222. package/dist/src/providers/openai/getOpenAIProviderInfo.d.ts +0 -46
  223. package/dist/src/providers/openai/getOpenAIProviderInfo.js +0 -74
  224. package/dist/src/providers/openai/getOpenAIProviderInfo.js.map +0 -1
  225. package/dist/src/providers/openai/parseResponsesStream.d.ts +0 -3
  226. package/dist/src/providers/openai/parseResponsesStream.js +0 -444
  227. package/dist/src/providers/openai/parseResponsesStream.js.map +0 -1
  228. package/dist/src/providers/parsers/TextToolCallParser.d.ts +0 -35
  229. package/dist/src/providers/parsers/TextToolCallParser.js +0 -248
  230. package/dist/src/providers/parsers/TextToolCallParser.js.map +0 -1
  231. package/dist/src/providers/tokenizers/AnthropicTokenizer.d.ts +0 -19
  232. package/dist/src/providers/tokenizers/AnthropicTokenizer.js +0 -37
  233. package/dist/src/providers/tokenizers/AnthropicTokenizer.js.map +0 -1
  234. package/dist/src/providers/tokenizers/ITokenizer.d.ts +0 -18
  235. package/dist/src/providers/tokenizers/ITokenizer.js +0 -17
  236. package/dist/src/providers/tokenizers/ITokenizer.js.map +0 -1
  237. package/dist/src/providers/tokenizers/OpenAITokenizer.d.ts +0 -24
  238. package/dist/src/providers/tokenizers/OpenAITokenizer.js +0 -56
  239. package/dist/src/providers/tokenizers/OpenAITokenizer.js.map +0 -1
  240. package/dist/src/tools/IToolFormatter.d.ts +0 -40
  241. package/dist/src/tools/IToolFormatter.js +0 -17
  242. package/dist/src/tools/IToolFormatter.js.map +0 -1
  243. package/dist/src/tools/ToolFormatter.d.ts +0 -45
  244. package/dist/src/tools/ToolFormatter.js +0 -216
  245. package/dist/src/tools/ToolFormatter.js.map +0 -1
  246. package/dist/vybestack-llxprt-code-0.1.12.tgz +0 -0
package/dist/index.js CHANGED
File without changes
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vybestack/llxprt-code",
3
- "version": "0.1.12",
3
+ "version": "0.1.13-nightly.250727.2261021c",
4
4
  "description": "LLxprt Code",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
11
+ "types": "dist/index.d.ts",
11
12
  "bin": {
12
13
  "llxprt": "dist/index.js"
13
14
  },
@@ -32,19 +33,18 @@
32
33
  "dist"
33
34
  ],
34
35
  "config": {
35
- "sandboxImageUri": "ghcr.io/acoliver/llxprt-code/sandbox:0.1.12"
36
+ "sandboxImageUri": "ghcr.io/acoliver/llxprt-code/sandbox:0.1.13-nightly.250727.2261021c"
36
37
  },
37
38
  "dependencies": {
38
39
  "@anthropic-ai/sdk": "^0.55.1",
39
40
  "@dqbd/tiktoken": "^1.0.21",
40
41
  "@google/genai": "^1.8.0",
41
42
  "@types/update-notifier": "^6.0.8",
42
- "@vybestack/llxprt-code-core": "0.1.12",
43
+ "@vybestack/llxprt-code-core": "0.1.13-nightly.250727.2261021c",
43
44
  "chalk": "^5.3.0",
44
45
  "command-exists": "^1.2.9",
45
46
  "diff": "^7.0.0",
46
47
  "dotenv": "^17.1.0",
47
- "gaxios": "^7.1.1",
48
48
  "glob": "^10.4.1",
49
49
  "highlight.js": "^11.11.1",
50
50
  "ink": "^6.0.1",
@@ -64,7 +64,7 @@
64
64
  "strip-ansi": "^7.1.0",
65
65
  "strip-json-comments": "^3.1.1",
66
66
  "update-notifier": "^7.3.1",
67
- "yargs": "^18.0.0"
67
+ "yargs": "^17.7.2"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@babel/runtime": "^7.27.6",
@@ -0,0 +1,208 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Icon } from '@vybestack/llxprt-code-core';
7
+ import { WritableStream, ReadableStream } from 'node:stream/web';
8
+ export declare class ClientConnection implements Client {
9
+ #private;
10
+ constructor(agent: (client: Client) => Agent, input: WritableStream<Uint8Array>, output: ReadableStream<Uint8Array>);
11
+ /**
12
+ * Streams part of an assistant response to the client
13
+ */
14
+ streamAssistantMessageChunk(params: StreamAssistantMessageChunkParams): Promise<void>;
15
+ /**
16
+ * Request confirmation before running a tool
17
+ *
18
+ * When allowed, the client returns a [`ToolCallId`] which can be used
19
+ * to update the tool call's `status` and `content` as it runs.
20
+ */
21
+ requestToolCallConfirmation(params: RequestToolCallConfirmationParams): Promise<RequestToolCallConfirmationResponse>;
22
+ /**
23
+ * pushToolCall allows the agent to start a tool call
24
+ * when it does not need to request permission to do so.
25
+ *
26
+ * The returned id can be used to update the UI for the tool
27
+ * call as needed.
28
+ */
29
+ pushToolCall(params: PushToolCallParams): Promise<PushToolCallResponse>;
30
+ /**
31
+ * updateToolCall allows the agent to update the content and status of the tool call.
32
+ *
33
+ * The new content replaces what is currently displayed in the UI.
34
+ *
35
+ * The [`ToolCallId`] is included in the response of
36
+ * `pushToolCall` or `requestToolCallConfirmation` respectively.
37
+ */
38
+ updateToolCall(params: UpdateToolCallParams): Promise<void>;
39
+ }
40
+ type Result<T> = {
41
+ result: T;
42
+ } | {
43
+ error: ErrorResponse;
44
+ };
45
+ type ErrorResponse = {
46
+ code: number;
47
+ message: string;
48
+ data?: {
49
+ details?: string;
50
+ };
51
+ };
52
+ export declare class RequestError extends Error {
53
+ code: number;
54
+ data?: {
55
+ details?: string;
56
+ };
57
+ constructor(code: number, message: string, details?: string);
58
+ static parseError(details?: string): RequestError;
59
+ static invalidRequest(details?: string): RequestError;
60
+ static methodNotFound(details?: string): RequestError;
61
+ static invalidParams(details?: string): RequestError;
62
+ static internalError(details?: string): RequestError;
63
+ toResult<T>(): Result<T>;
64
+ }
65
+ export declare const LATEST_PROTOCOL_VERSION = "0.0.9";
66
+ export type AssistantMessageChunk = {
67
+ text: string;
68
+ } | {
69
+ thought: string;
70
+ };
71
+ export type ToolCallConfirmation = {
72
+ description?: string | null;
73
+ type: 'edit';
74
+ } | {
75
+ description?: string | null;
76
+ type: 'execute';
77
+ command: string;
78
+ rootCommand: string;
79
+ } | {
80
+ description?: string | null;
81
+ type: 'mcp';
82
+ serverName: string;
83
+ toolDisplayName: string;
84
+ toolName: string;
85
+ } | {
86
+ description?: string | null;
87
+ type: 'fetch';
88
+ urls: string[];
89
+ } | {
90
+ description: string;
91
+ type: 'other';
92
+ };
93
+ export type ToolCallContent = {
94
+ type: 'markdown';
95
+ markdown: string;
96
+ } | {
97
+ type: 'diff';
98
+ newText: string;
99
+ oldText: string | null;
100
+ path: string;
101
+ };
102
+ export type ToolCallStatus = 'running' | 'finished' | 'error';
103
+ export type ToolCallId = number;
104
+ export type ToolCallConfirmationOutcome = 'allow' | 'alwaysAllow' | 'alwaysAllowMcpServer' | 'alwaysAllowTool' | 'reject' | 'cancel';
105
+ /**
106
+ * A part in a user message
107
+ */
108
+ export type UserMessageChunk = {
109
+ text: string;
110
+ } | {
111
+ path: string;
112
+ };
113
+ export interface StreamAssistantMessageChunkParams {
114
+ chunk: AssistantMessageChunk;
115
+ }
116
+ export interface RequestToolCallConfirmationParams {
117
+ confirmation: ToolCallConfirmation;
118
+ content?: ToolCallContent | null;
119
+ icon: Icon;
120
+ label: string;
121
+ locations?: ToolCallLocation[];
122
+ }
123
+ export interface ToolCallLocation {
124
+ line?: number | null;
125
+ path: string;
126
+ }
127
+ export interface PushToolCallParams {
128
+ content?: ToolCallContent | null;
129
+ icon: Icon;
130
+ label: string;
131
+ locations?: ToolCallLocation[];
132
+ }
133
+ export interface UpdateToolCallParams {
134
+ content: ToolCallContent | null;
135
+ status: ToolCallStatus;
136
+ toolCallId: ToolCallId;
137
+ }
138
+ export interface RequestToolCallConfirmationResponse {
139
+ id: ToolCallId;
140
+ outcome: ToolCallConfirmationOutcome;
141
+ }
142
+ export interface PushToolCallResponse {
143
+ id: ToolCallId;
144
+ }
145
+ export interface InitializeParams {
146
+ /**
147
+ * The version of the protocol that the client supports.
148
+ * This should be the latest version supported by the client.
149
+ */
150
+ protocolVersion: string;
151
+ }
152
+ export interface SendUserMessageParams {
153
+ chunks: UserMessageChunk[];
154
+ }
155
+ export interface InitializeResponse {
156
+ /**
157
+ * Indicates whether the agent is authenticated and
158
+ * ready to handle requests.
159
+ */
160
+ isAuthenticated: boolean;
161
+ /**
162
+ * The version of the protocol that the agent supports.
163
+ * If the agent supports the requested version, it should respond with the same version.
164
+ * Otherwise, the agent should respond with the latest version it supports.
165
+ */
166
+ protocolVersion: string;
167
+ }
168
+ export interface Error {
169
+ code: number;
170
+ data?: unknown;
171
+ message: string;
172
+ }
173
+ export interface Client {
174
+ streamAssistantMessageChunk(params: StreamAssistantMessageChunkParams): Promise<void>;
175
+ requestToolCallConfirmation(params: RequestToolCallConfirmationParams): Promise<RequestToolCallConfirmationResponse>;
176
+ pushToolCall(params: PushToolCallParams): Promise<PushToolCallResponse>;
177
+ updateToolCall(params: UpdateToolCallParams): Promise<void>;
178
+ }
179
+ export interface Agent {
180
+ /**
181
+ * Initializes the agent's state. It should be called before any other method,
182
+ * and no other methods should be called until it has completed.
183
+ *
184
+ * If the agent is not authenticated, then the client should prompt the user to authenticate,
185
+ * and then call the `authenticate` method.
186
+ * Otherwise the client can send other messages to the agent.
187
+ */
188
+ initialize(params: InitializeParams): Promise<InitializeResponse>;
189
+ /**
190
+ * Begins the authentication process.
191
+ *
192
+ * This method should only be called if `initialize` indicates the user isn't already authenticated.
193
+ * The Promise MUST not resolve until authentication is complete.
194
+ */
195
+ authenticate(): Promise<void>;
196
+ /**
197
+ * Allows the user to send a message to the agent.
198
+ * This method should complete after the agent is finished, during
199
+ * which time the agent may update the client by calling
200
+ * streamAssistantMessageChunk and other methods.
201
+ */
202
+ sendUserMessage(params: SendUserMessageParams): Promise<void>;
203
+ /**
204
+ * Cancels the current generation.
205
+ */
206
+ cancelSendMessage(): Promise<void>;
207
+ }
208
+ export {};
@@ -0,0 +1,193 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export class ClientConnection {
7
+ #connection;
8
+ constructor(agent, input, output) {
9
+ this.#connection = new Connection(agent(this), input, output);
10
+ }
11
+ /**
12
+ * Streams part of an assistant response to the client
13
+ */
14
+ async streamAssistantMessageChunk(params) {
15
+ await this.#connection.sendRequest('streamAssistantMessageChunk', params);
16
+ }
17
+ /**
18
+ * Request confirmation before running a tool
19
+ *
20
+ * When allowed, the client returns a [`ToolCallId`] which can be used
21
+ * to update the tool call's `status` and `content` as it runs.
22
+ */
23
+ requestToolCallConfirmation(params) {
24
+ return this.#connection.sendRequest('requestToolCallConfirmation', params);
25
+ }
26
+ /**
27
+ * pushToolCall allows the agent to start a tool call
28
+ * when it does not need to request permission to do so.
29
+ *
30
+ * The returned id can be used to update the UI for the tool
31
+ * call as needed.
32
+ */
33
+ pushToolCall(params) {
34
+ return this.#connection.sendRequest('pushToolCall', params);
35
+ }
36
+ /**
37
+ * updateToolCall allows the agent to update the content and status of the tool call.
38
+ *
39
+ * The new content replaces what is currently displayed in the UI.
40
+ *
41
+ * The [`ToolCallId`] is included in the response of
42
+ * `pushToolCall` or `requestToolCallConfirmation` respectively.
43
+ */
44
+ async updateToolCall(params) {
45
+ await this.#connection.sendRequest('updateToolCall', params);
46
+ }
47
+ }
48
+ class Connection {
49
+ #pendingResponses = new Map();
50
+ #nextRequestId = 0;
51
+ #delegate;
52
+ #peerInput;
53
+ #writeQueue = Promise.resolve();
54
+ #textEncoder;
55
+ constructor(delegate, peerInput, peerOutput) {
56
+ this.#peerInput = peerInput;
57
+ this.#textEncoder = new TextEncoder();
58
+ this.#delegate = delegate;
59
+ this.#receive(peerOutput);
60
+ }
61
+ async #receive(output) {
62
+ let content = '';
63
+ const decoder = new TextDecoder();
64
+ for await (const chunk of output) {
65
+ content += decoder.decode(chunk, { stream: true });
66
+ const lines = content.split('\n');
67
+ content = lines.pop() || '';
68
+ for (const line of lines) {
69
+ const trimmedLine = line.trim();
70
+ if (trimmedLine) {
71
+ const message = JSON.parse(trimmedLine);
72
+ this.#processMessage(message);
73
+ }
74
+ }
75
+ }
76
+ }
77
+ async #processMessage(message) {
78
+ if ('method' in message) {
79
+ const response = await this.#tryCallDelegateMethod(message.method, message.params);
80
+ await this.#sendMessage({
81
+ jsonrpc: '2.0',
82
+ id: message.id,
83
+ ...response,
84
+ });
85
+ }
86
+ else {
87
+ this.#handleResponse(message);
88
+ }
89
+ }
90
+ async #tryCallDelegateMethod(method, params) {
91
+ const methodName = method;
92
+ if (typeof this.#delegate[methodName] !== 'function') {
93
+ return RequestError.methodNotFound(method).toResult();
94
+ }
95
+ try {
96
+ const result = await this.#delegate[methodName](params);
97
+ return { result: result ?? null };
98
+ }
99
+ catch (error) {
100
+ if (error instanceof RequestError) {
101
+ return error.toResult();
102
+ }
103
+ let details;
104
+ if (error instanceof Error) {
105
+ details = error.message;
106
+ }
107
+ else if (typeof error === 'object' &&
108
+ error != null &&
109
+ 'message' in error &&
110
+ typeof error.message === 'string') {
111
+ details = error.message;
112
+ }
113
+ return RequestError.internalError(details).toResult();
114
+ }
115
+ }
116
+ #handleResponse(response) {
117
+ const pendingResponse = this.#pendingResponses.get(response.id);
118
+ if (pendingResponse) {
119
+ if ('result' in response) {
120
+ pendingResponse.resolve(response.result);
121
+ }
122
+ else if ('error' in response) {
123
+ pendingResponse.reject(response.error);
124
+ }
125
+ this.#pendingResponses.delete(response.id);
126
+ }
127
+ }
128
+ async sendRequest(method, params) {
129
+ const id = this.#nextRequestId++;
130
+ const responsePromise = new Promise((resolve, reject) => {
131
+ this.#pendingResponses.set(id, { resolve, reject });
132
+ });
133
+ await this.#sendMessage({ jsonrpc: '2.0', id, method, params });
134
+ return responsePromise;
135
+ }
136
+ async #sendMessage(json) {
137
+ const content = JSON.stringify(json) + '\n';
138
+ this.#writeQueue = this.#writeQueue
139
+ .then(async () => {
140
+ const writer = this.#peerInput.getWriter();
141
+ try {
142
+ await writer.write(this.#textEncoder.encode(content));
143
+ }
144
+ finally {
145
+ writer.releaseLock();
146
+ }
147
+ })
148
+ .catch((error) => {
149
+ // Continue processing writes on error
150
+ console.error('ACP write error:', error);
151
+ });
152
+ return this.#writeQueue;
153
+ }
154
+ }
155
+ export class RequestError extends Error {
156
+ code;
157
+ data;
158
+ constructor(code, message, details) {
159
+ super(message);
160
+ this.code = code;
161
+ this.name = 'RequestError';
162
+ if (details) {
163
+ this.data = { details };
164
+ }
165
+ }
166
+ static parseError(details) {
167
+ return new RequestError(-32700, 'Parse error', details);
168
+ }
169
+ static invalidRequest(details) {
170
+ return new RequestError(-32600, 'Invalid request', details);
171
+ }
172
+ static methodNotFound(details) {
173
+ return new RequestError(-32601, 'Method not found', details);
174
+ }
175
+ static invalidParams(details) {
176
+ return new RequestError(-32602, 'Invalid params', details);
177
+ }
178
+ static internalError(details) {
179
+ return new RequestError(-32603, 'Internal error', details);
180
+ }
181
+ toResult() {
182
+ return {
183
+ error: {
184
+ code: this.code,
185
+ message: this.message,
186
+ data: this.data,
187
+ },
188
+ };
189
+ }
190
+ }
191
+ // Protocol types
192
+ export const LATEST_PROTOCOL_VERSION = '0.0.9';
193
+ //# sourceMappingURL=acp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp.js","sourceRoot":"","sources":["../../../src/acp/acp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,OAAO,gBAAgB;IAC3B,WAAW,CAAoB;IAE/B,YACE,KAAgC,EAChC,KAAiC,EACjC,MAAkC;QAElC,IAAI,CAAC,WAAW,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,2BAA2B,CAC/B,MAAyC;QAEzC,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,2BAA2B,CACzB,MAAyC;QAEzC,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;OAMG;IACH,YAAY,CAAC,MAA0B;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,cAAc,CAAC,MAA4B;QAC/C,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACF;AA+BD,MAAM,UAAU;IACd,iBAA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BAAgB,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,OAAgB;QACnC,OAAO,IAAI,YAAY,CAAC,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,QAAQ;QACN,OAAO;YACL,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB;SACF,CAAC;IACJ,CAAC;CACF;AAED,iBAAiB;AAEjB,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Config } from '@vybestack/llxprt-code-core';
7
+ import { LoadedSettings } from '../config/settings.js';
8
+ export declare function runAcpPeer(config: Config, settings: LoadedSettings): Promise<void>;