@kortix/sdk 0.11.0 → 0.12.1

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 (214) hide show
  1. package/README.md +110 -73
  2. package/dist/browser/cache/idb-sync-cache-key.d.ts +2 -0
  3. package/dist/browser/cache/idb-sync-cache-key.d.ts.map +1 -0
  4. package/dist/browser/cache/idb-sync-cache-key.js +7 -0
  5. package/dist/browser/cache/idb-sync-cache-key.js.map +1 -0
  6. package/dist/browser/cache/idb-sync-cache.d.ts +3 -3
  7. package/dist/browser/cache/idb-sync-cache.d.ts.map +1 -1
  8. package/dist/browser/cache/idb-sync-cache.js +49 -26
  9. package/dist/browser/cache/idb-sync-cache.js.map +1 -1
  10. package/dist/browser/session-sync/session-cache-ownership.d.ts +36 -0
  11. package/dist/browser/session-sync/session-cache-ownership.d.ts.map +1 -0
  12. package/dist/browser/session-sync/session-cache-ownership.js +66 -0
  13. package/dist/browser/session-sync/session-cache-ownership.js.map +1 -0
  14. package/dist/browser/session-sync/session-sync-registry.d.ts +8 -6
  15. package/dist/browser/session-sync/session-sync-registry.d.ts.map +1 -1
  16. package/dist/browser/session-sync/session-sync-registry.js +86 -33
  17. package/dist/browser/session-sync/session-sync-registry.js.map +1 -1
  18. package/dist/browser/session-sync/session-transcript-cache.d.ts +55 -0
  19. package/dist/browser/session-sync/session-transcript-cache.d.ts.map +1 -0
  20. package/dist/browser/session-sync/session-transcript-cache.js +69 -0
  21. package/dist/browser/session-sync/session-transcript-cache.js.map +1 -0
  22. package/dist/core/client/kortix.d.ts +72 -25
  23. package/dist/core/client/kortix.d.ts.map +1 -1
  24. package/dist/core/client/kortix.js +76 -17
  25. package/dist/core/client/kortix.js.map +1 -1
  26. package/dist/core/rest/platform-client/host-boundary.d.ts +7 -0
  27. package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
  28. package/dist/core/rest/platform-client/host-boundary.js +14 -0
  29. package/dist/core/rest/platform-client/host-boundary.js.map +1 -1
  30. package/dist/core/rest/projects-client/access.d.ts +1 -2
  31. package/dist/core/rest/projects-client/access.d.ts.map +1 -1
  32. package/dist/core/rest/projects-client/access.js +9 -6
  33. package/dist/core/rest/projects-client/access.js.map +1 -1
  34. package/dist/core/rest/projects-client/agent-config.d.ts +15 -7
  35. package/dist/core/rest/projects-client/agent-config.d.ts.map +1 -1
  36. package/dist/core/rest/projects-client/agent-config.js +43 -2
  37. package/dist/core/rest/projects-client/agent-config.js.map +1 -1
  38. package/dist/core/rest/projects-client/agent-scope.d.ts +4 -0
  39. package/dist/core/rest/projects-client/agent-scope.d.ts.map +1 -1
  40. package/dist/core/rest/projects-client/agent-scope.js +34 -1
  41. package/dist/core/rest/projects-client/agent-scope.js.map +1 -1
  42. package/dist/core/rest/projects-client/audit.d.ts +34 -0
  43. package/dist/core/rest/projects-client/audit.d.ts.map +1 -1
  44. package/dist/core/rest/projects-client/audit.js +49 -4
  45. package/dist/core/rest/projects-client/audit.js.map +1 -1
  46. package/dist/core/rest/projects-client/billing.d.ts +26 -14
  47. package/dist/core/rest/projects-client/billing.d.ts.map +1 -1
  48. package/dist/core/rest/projects-client/billing.js +4 -5
  49. package/dist/core/rest/projects-client/billing.js.map +1 -1
  50. package/dist/core/rest/projects-client/connectors.d.ts +106 -45
  51. package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
  52. package/dist/core/rest/projects-client/connectors.js +95 -58
  53. package/dist/core/rest/projects-client/connectors.js.map +1 -1
  54. package/dist/core/rest/projects-client/github.d.ts +7 -1
  55. package/dist/core/rest/projects-client/github.d.ts.map +1 -1
  56. package/dist/core/rest/projects-client/github.js.map +1 -1
  57. package/dist/core/rest/projects-client/iam.d.ts +17 -0
  58. package/dist/core/rest/projects-client/iam.d.ts.map +1 -1
  59. package/dist/core/rest/projects-client/iam.js +14 -0
  60. package/dist/core/rest/projects-client/iam.js.map +1 -1
  61. package/dist/core/rest/projects-client/index.d.ts +2 -0
  62. package/dist/core/rest/projects-client/index.d.ts.map +1 -1
  63. package/dist/core/rest/projects-client/index.js +2 -0
  64. package/dist/core/rest/projects-client/index.js.map +1 -1
  65. package/dist/core/rest/projects-client/model-enablement.d.ts +9 -0
  66. package/dist/core/rest/projects-client/model-enablement.d.ts.map +1 -0
  67. package/dist/core/rest/projects-client/model-enablement.js +16 -0
  68. package/dist/core/rest/projects-client/model-enablement.js.map +1 -0
  69. package/dist/core/rest/projects-client/policies.d.ts +18 -0
  70. package/dist/core/rest/projects-client/policies.d.ts.map +1 -1
  71. package/dist/core/rest/projects-client/policies.js.map +1 -1
  72. package/dist/core/rest/projects-client/projects.d.ts +87 -1
  73. package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
  74. package/dist/core/rest/projects-client/projects.js +8 -0
  75. package/dist/core/rest/projects-client/projects.js.map +1 -1
  76. package/dist/core/rest/projects-client/sandbox.d.ts +50 -0
  77. package/dist/core/rest/projects-client/sandbox.d.ts.map +1 -1
  78. package/dist/core/rest/projects-client/sandbox.js.map +1 -1
  79. package/dist/core/rest/projects-client/session-costs.d.ts +102 -0
  80. package/dist/core/rest/projects-client/session-costs.d.ts.map +1 -0
  81. package/dist/core/rest/projects-client/session-costs.js +25 -0
  82. package/dist/core/rest/projects-client/session-costs.js.map +1 -0
  83. package/dist/core/rest/projects-client/session-sandbox.d.ts +0 -2
  84. package/dist/core/rest/projects-client/session-sandbox.d.ts.map +1 -1
  85. package/dist/core/rest/projects-client/session-sandbox.js +1 -10
  86. package/dist/core/rest/projects-client/session-sandbox.js.map +1 -1
  87. package/dist/core/rest/projects-client/sessions.d.ts +94 -44
  88. package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
  89. package/dist/core/rest/projects-client/sessions.js +9 -15
  90. package/dist/core/rest/projects-client/sessions.js.map +1 -1
  91. package/dist/core/rest/projects-client/setup-links.d.ts +37 -0
  92. package/dist/core/rest/projects-client/setup-links.d.ts.map +1 -1
  93. package/dist/core/rest/projects-client/setup-links.js +11 -0
  94. package/dist/core/rest/projects-client/setup-links.js.map +1 -1
  95. package/dist/core/session/index.d.ts +1 -1
  96. package/dist/core/session/index.d.ts.map +1 -1
  97. package/dist/core/session/index.js +1 -1
  98. package/dist/core/session/index.js.map +1 -1
  99. package/dist/core/session/preview-auth.d.ts +32 -0
  100. package/dist/core/session/preview-auth.d.ts.map +1 -0
  101. package/dist/core/session/preview-auth.js +53 -0
  102. package/dist/core/session/preview-auth.js.map +1 -0
  103. package/dist/core/session/server-store/url-helpers.d.ts.map +1 -1
  104. package/dist/core/session/server-store/url-helpers.js +5 -3
  105. package/dist/core/session/server-store/url-helpers.js.map +1 -1
  106. package/dist/core/session-sync/session-sync-controller.d.ts +12 -1
  107. package/dist/core/session-sync/session-sync-controller.d.ts.map +1 -1
  108. package/dist/core/session-sync/session-sync-controller.js +34 -2
  109. package/dist/core/session-sync/session-sync-controller.js.map +1 -1
  110. package/dist/index.d.ts +1 -2
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +0 -1
  113. package/dist/index.js.map +1 -1
  114. package/dist/kortix.esm.min.js +19 -24
  115. package/dist/kortix.global.js +19 -24
  116. package/dist/platform/auth-core.d.ts +5 -3
  117. package/dist/platform/auth-core.d.ts.map +1 -1
  118. package/dist/platform/auth-core.js +6 -4
  119. package/dist/platform/auth-core.js.map +1 -1
  120. package/dist/react/index.d.ts +1 -2
  121. package/dist/react/index.d.ts.map +1 -1
  122. package/dist/react/index.js +0 -1
  123. package/dist/react/index.js.map +1 -1
  124. package/dist/react/model-flatten.d.ts +20 -0
  125. package/dist/react/model-flatten.d.ts.map +1 -1
  126. package/dist/react/model-flatten.js +12 -0
  127. package/dist/react/model-flatten.js.map +1 -1
  128. package/dist/react/opencode.d.ts +4 -3
  129. package/dist/react/opencode.d.ts.map +1 -1
  130. package/dist/react/opencode.js +4 -3
  131. package/dist/react/opencode.js.map +1 -1
  132. package/dist/react/provider-selection.d.ts +9 -0
  133. package/dist/react/provider-selection.d.ts.map +1 -1
  134. package/dist/react/provider-selection.js +23 -0
  135. package/dist/react/provider-selection.js.map +1 -1
  136. package/dist/react/session-title-sync.d.ts +9 -5
  137. package/dist/react/session-title-sync.d.ts.map +1 -1
  138. package/dist/react/session-title-sync.js +14 -10
  139. package/dist/react/session-title-sync.js.map +1 -1
  140. package/dist/react/use-canonical-opencode-session.d.ts +2 -2
  141. package/dist/react/use-canonical-opencode-session.d.ts.map +1 -1
  142. package/dist/react/use-model-enablement.d.ts +25 -0
  143. package/dist/react/use-model-enablement.d.ts.map +1 -0
  144. package/dist/react/use-model-enablement.js +92 -0
  145. package/dist/react/use-model-enablement.js.map +1 -0
  146. package/dist/react/use-model-store.d.ts +6 -14
  147. package/dist/react/use-model-store.d.ts.map +1 -1
  148. package/dist/react/use-model-store.js +30 -52
  149. package/dist/react/use-model-store.js.map +1 -1
  150. package/dist/react/use-opencode-events/handle-event.d.ts.map +1 -1
  151. package/dist/react/use-opencode-events/handle-event.js +103 -41
  152. package/dist/react/use-opencode-events/handle-event.js.map +1 -1
  153. package/dist/react/use-opencode-local.d.ts +5 -4
  154. package/dist/react/use-opencode-local.d.ts.map +1 -1
  155. package/dist/react/use-opencode-local.js +20 -37
  156. package/dist/react/use-opencode-local.js.map +1 -1
  157. package/dist/react/use-opencode-sessions/keys.d.ts +3 -1
  158. package/dist/react/use-opencode-sessions/keys.d.ts.map +1 -1
  159. package/dist/react/use-opencode-sessions/keys.js +2 -0
  160. package/dist/react/use-opencode-sessions/keys.js.map +1 -1
  161. package/dist/react/use-opencode-sessions/sessions.d.ts.map +1 -1
  162. package/dist/react/use-opencode-sessions/sessions.js +16 -7
  163. package/dist/react/use-opencode-sessions/sessions.js.map +1 -1
  164. package/dist/react/use-opencode-sessions/shared.d.ts +3 -2
  165. package/dist/react/use-opencode-sessions/shared.d.ts.map +1 -1
  166. package/dist/react/use-opencode-sessions/shared.js +6 -3
  167. package/dist/react/use-opencode-sessions/shared.js.map +1 -1
  168. package/dist/react/use-opencode-sessions/sharing.js +2 -2
  169. package/dist/react/use-opencode-sessions/sharing.js.map +1 -1
  170. package/dist/react/use-session-sync.d.ts +13 -1
  171. package/dist/react/use-session-sync.d.ts.map +1 -1
  172. package/dist/react/use-session-sync.js +85 -17
  173. package/dist/react/use-session-sync.js.map +1 -1
  174. package/dist/react/use-session.d.ts +60 -40
  175. package/dist/react/use-session.d.ts.map +1 -1
  176. package/dist/react/use-session.js +160 -202
  177. package/dist/react/use-session.js.map +1 -1
  178. package/package.json +2 -2
  179. package/dist/core/acp/client.d.ts +0 -45
  180. package/dist/core/acp/client.d.ts.map +0 -1
  181. package/dist/core/acp/client.js +0 -277
  182. package/dist/core/acp/client.js.map +0 -1
  183. package/dist/core/acp/index.d.ts +0 -5
  184. package/dist/core/acp/index.d.ts.map +0 -1
  185. package/dist/core/acp/index.js +0 -5
  186. package/dist/core/acp/index.js.map +0 -1
  187. package/dist/core/acp/projection.d.ts +0 -23
  188. package/dist/core/acp/projection.d.ts.map +0 -1
  189. package/dist/core/acp/projection.js +0 -603
  190. package/dist/core/acp/projection.js.map +0 -1
  191. package/dist/core/acp/session-controller.d.ts +0 -90
  192. package/dist/core/acp/session-controller.d.ts.map +0 -1
  193. package/dist/core/acp/session-controller.js +0 -530
  194. package/dist/core/acp/session-controller.js.map +0 -1
  195. package/dist/core/acp/types.d.ts +0 -66
  196. package/dist/core/acp/types.d.ts.map +0 -1
  197. package/dist/core/acp/types.js +0 -21
  198. package/dist/core/acp/types.js.map +0 -1
  199. package/dist/core/session/runtime-transport.d.ts +0 -16
  200. package/dist/core/session/runtime-transport.d.ts.map +0 -1
  201. package/dist/core/session/runtime-transport.js +0 -30
  202. package/dist/core/session/runtime-transport.js.map +0 -1
  203. package/dist/react/session-busy.d.ts +0 -8
  204. package/dist/react/session-busy.d.ts.map +0 -1
  205. package/dist/react/session-busy.js +0 -4
  206. package/dist/react/session-busy.js.map +0 -1
  207. package/dist/react/use-acp-session-runtime.d.ts +0 -34
  208. package/dist/react/use-acp-session-runtime.d.ts.map +0 -1
  209. package/dist/react/use-acp-session-runtime.js +0 -84
  210. package/dist/react/use-acp-session-runtime.js.map +0 -1
  211. package/dist/react/use-admin-users.d.ts +0 -98
  212. package/dist/react/use-admin-users.d.ts.map +0 -1
  213. package/dist/react/use-admin-users.js +0 -121
  214. package/dist/react/use-admin-users.js.map +0 -1
@@ -1,90 +0,0 @@
1
- import { type AcpClient } from './client.js';
2
- import { type AcpProjection } from './projection.js';
3
- import type { AcpContentBlock, AcpJsonRpcId, AcpStreamEvent, AcpStreamHandle } from './types.js';
4
- export interface AcpSessionClient {
5
- connect(options: {
6
- onEvent(event: AcpStreamEvent): void;
7
- onError?(error: unknown): void;
8
- }): AcpStreamHandle;
9
- loadSession(input: {
10
- sessionId: string;
11
- cwd: string;
12
- mcpServers?: unknown[];
13
- }): Promise<Record<string, unknown>>;
14
- setSessionConfigOption(sessionId: string, configId: string, value: unknown): Promise<Record<string, unknown>>;
15
- prompt(sessionId: string, prompt: AcpContentBlock[]): Promise<{
16
- stopReason: string;
17
- usage?: Record<string, unknown>;
18
- }>;
19
- cancel(sessionId: string): Promise<void>;
20
- revertSession(sessionId: string, messageId: string): Promise<Record<string, unknown>>;
21
- unrevertSession(sessionId: string): Promise<Record<string, unknown>>;
22
- respond(id: AcpJsonRpcId, result?: unknown): Promise<void>;
23
- }
24
- export interface AcpSessionControllerSnapshot {
25
- ready: boolean;
26
- sending: boolean;
27
- connection: 'idle' | 'connecting' | 'open' | 'closed' | 'error';
28
- error: Error | null;
29
- projection: AcpProjection;
30
- configOptions: Array<Record<string, unknown>>;
31
- rewind: {
32
- messageId: string;
33
- } | null;
34
- }
35
- export interface AcpSessionControllerOptions {
36
- sessionId: string;
37
- runtimeUrl?: string;
38
- client?: AcpSessionClient;
39
- cwd?: string;
40
- }
41
- export declare class AcpSessionController {
42
- private readonly options;
43
- private readonly client;
44
- private readonly listeners;
45
- private readonly openRequests;
46
- private stream;
47
- private connecting;
48
- private runtimeReload;
49
- private runtimeGeneration;
50
- private readonly restartWaiters;
51
- private promptQueue;
52
- private promptSettlement;
53
- private snapshot;
54
- constructor(options: AcpSessionControllerOptions);
55
- subscribe: (listener: () => void) => (() => void);
56
- getSnapshot: () => AcpSessionControllerSnapshot;
57
- connect(): Promise<void>;
58
- private open;
59
- private resetCanonicalSessionState;
60
- private loadCanonicalSession;
61
- private reloadAfterRuntimeReady;
62
- private onRuntimeReady;
63
- private raceWithRuntimeRestart;
64
- send(prompt: AcpContentBlock[], options?: {
65
- model?: string | null;
66
- agent?: string | null;
67
- }): Promise<void>;
68
- private executeSend;
69
- cancel(): Promise<void>;
70
- rewind(messageId: string): Promise<void>;
71
- private resolveRewindMessageId;
72
- restoreRewind(): Promise<void>;
73
- runCommand(command: string, args: string, options?: {
74
- model?: string | null;
75
- agent?: string | null;
76
- }): Promise<void>;
77
- answerPermission(requestId: string, reply: 'once' | 'always' | 'reject'): Promise<void>;
78
- answerQuestion(requestId: string, answers: string[][]): Promise<void>;
79
- rejectQuestion(requestId: string): Promise<void>;
80
- close(): void;
81
- private onEnvelope;
82
- private settlePrompt;
83
- private schedulePromptSettlement;
84
- private applyPromptResult;
85
- private discardPromptSettlement;
86
- private patch;
87
- }
88
- export declare function createAcpSessionController(options: AcpSessionControllerOptions): AcpSessionController;
89
- export type AcpSessionClientInstance = AcpClient;
90
- //# sourceMappingURL=session-controller.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-controller.d.ts","sourceRoot":"","sources":["../../../src/core/acp/session-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAyC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,KAAK,EACV,eAAe,EAEf,YAAY,EACZ,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAC;AAajB,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,OAAO,EAAE;QACf,OAAO,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC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,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAO,GAC7D,OAAO,CAAC,IAAI,CAAC;YAiBF,WAAW;IA0FnB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAavB,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAWhC,sBAAsB;IAoC9B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAS9B,UAAU,CACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAO,GAC7D,OAAO,CAAC,IAAI,CAAC;IASV,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBvF,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrE,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOtD,KAAK,IAAI,IAAI;IAOb,OAAO,CAAC,UAAU;IA0BlB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,wBAAwB;IAmBhC,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,KAAK;CAId;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,2BAA2B,GACnC,oBAAoB,CAEtB;AAED,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAAC"}
@@ -1,530 +0,0 @@
1
- import { buildAcpBridgeEndpoint } from '../session/runtime-transport.js';
2
- import { messagesBeforeRewind } from '../session/rewind.js';
3
- import { createAcpClient } from './client.js';
4
- import { applyAcpEnvelope, createAcpProjection } from './projection.js';
5
- import { AcpTransportError } from './types.js';
6
- const MAX_CONFIG_RESTART_RETRIES = 3;
7
- const ACP_PROMPT_QUIET_PERIOD_MS = 500;
8
- class AcpRuntimeRestartError extends Error {
9
- constructor() {
10
- super('ACP runtime restarted');
11
- this.name = 'AcpRuntimeRestartError';
12
- }
13
- }
14
- function isObject(value) {
15
- return typeof value === 'object' && value !== null && !Array.isArray(value);
16
- }
17
- function asString(value) {
18
- return typeof value === 'string' && value.length > 0 ? value : null;
19
- }
20
- function selectedPermissionOption(params, reply) {
21
- const options = Array.isArray(params.options) ? params.options.filter(isObject) : [];
22
- const kinds = reply === 'once'
23
- ? ['allow_once', 'allow']
24
- : reply === 'always'
25
- ? ['allow_always', 'always']
26
- : ['reject_once', 'reject_always', 'reject'];
27
- for (const kind of kinds) {
28
- const option = options.find((candidate) => candidate.kind === kind);
29
- const id = option && asString(option.optionId);
30
- if (id)
31
- return id;
32
- }
33
- return null;
34
- }
35
- function questionContent(params, answers) {
36
- const schema = isObject(params.requestedSchema)
37
- ? params.requestedSchema
38
- : isObject(params.schema)
39
- ? params.schema
40
- : null;
41
- const properties = schema && isObject(schema.properties) ? Object.keys(schema.properties) : [];
42
- if (properties.length === 0)
43
- return { answers };
44
- return Object.fromEntries(properties.map((key, index) => {
45
- const answer = answers[index] ?? [];
46
- return [key, answer.length <= 1 ? (answer[0] ?? '') : answer];
47
- }));
48
- }
49
- function hasProjectionBlockers(projection) {
50
- return (projection.permissions.length > 0 ||
51
- projection.questions.length > 0 ||
52
- projection.messages.some((message) => message.parts.some((part) => part.type === 'tool' &&
53
- (part.state.status === 'pending' || part.state.status === 'running'))));
54
- }
55
- function isPromptResult(envelope) {
56
- return ('id' in envelope &&
57
- !('method' in envelope) &&
58
- isObject(envelope.result) &&
59
- (asString(envelope.result.stopReason) !== null || isObject(envelope.result.usage)));
60
- }
61
- function settleLoadedProjection(projection) {
62
- if (hasProjectionBlockers(projection))
63
- return projection;
64
- const completed = Date.now();
65
- return {
66
- ...projection,
67
- status: { type: 'idle' },
68
- messages: projection.messages.map((message) => message.info.role === 'assistant' && !message.info.time.completed
69
- ? {
70
- ...message,
71
- info: {
72
- ...message.info,
73
- time: { ...message.info.time, completed },
74
- },
75
- }
76
- : message),
77
- };
78
- }
79
- export class AcpSessionController {
80
- options;
81
- client;
82
- listeners = new Set();
83
- openRequests = new Map();
84
- stream = null;
85
- connecting = null;
86
- runtimeReload = null;
87
- runtimeGeneration = 0;
88
- restartWaiters = new Set();
89
- promptQueue = Promise.resolve();
90
- promptSettlement = null;
91
- snapshot;
92
- constructor(options) {
93
- this.options = options;
94
- if (!options.client && !options.runtimeUrl) {
95
- throw new Error('AcpSessionController requires a runtimeUrl or injected client');
96
- }
97
- this.client =
98
- options.client ??
99
- createAcpClient({
100
- endpoint: buildAcpBridgeEndpoint(options.runtimeUrl, options.sessionId),
101
- });
102
- this.snapshot = {
103
- ready: false,
104
- sending: false,
105
- connection: 'idle',
106
- error: null,
107
- projection: createAcpProjection(options.sessionId),
108
- configOptions: [],
109
- rewind: null,
110
- };
111
- }
112
- subscribe = (listener) => {
113
- this.listeners.add(listener);
114
- return () => this.listeners.delete(listener);
115
- };
116
- getSnapshot = () => this.snapshot;
117
- async connect() {
118
- if (this.runtimeReload)
119
- return this.runtimeReload;
120
- if (this.snapshot.ready)
121
- return;
122
- if (this.connecting)
123
- return this.connecting;
124
- this.connecting = this.open();
125
- try {
126
- await this.connecting;
127
- }
128
- finally {
129
- this.connecting = null;
130
- }
131
- }
132
- async open() {
133
- this.resetCanonicalSessionState();
134
- this.patch({ connection: 'connecting', error: null });
135
- if (!this.stream) {
136
- this.stream = this.client.connect({
137
- onEvent: (event) => this.onEnvelope(event.envelope),
138
- onError: (error) => {
139
- if (!(error instanceof AcpTransportError) || !error.terminal)
140
- return;
141
- this.patch({
142
- ready: false,
143
- connection: 'error',
144
- error: error instanceof Error ? error : new Error(String(error)),
145
- });
146
- },
147
- });
148
- }
149
- try {
150
- await this.stream.ready;
151
- await this.loadCanonicalSession();
152
- }
153
- catch (error) {
154
- this.patch({
155
- ready: false,
156
- connection: 'error',
157
- error: error instanceof Error ? error : new Error(String(error)),
158
- });
159
- throw error;
160
- }
161
- }
162
- resetCanonicalSessionState() {
163
- this.openRequests.clear();
164
- this.patch({
165
- projection: createAcpProjection(this.options.sessionId),
166
- });
167
- }
168
- async loadCanonicalSession() {
169
- const loaded = await this.client.loadSession({
170
- sessionId: this.options.sessionId,
171
- cwd: this.options.cwd ?? '/workspace',
172
- });
173
- const configOptions = Array.isArray(loaded.configOptions)
174
- ? loaded.configOptions.filter(isObject)
175
- : [];
176
- const loadedProjection = settleLoadedProjection(this.snapshot.projection);
177
- const projection = this.snapshot.rewind
178
- ? {
179
- ...loadedProjection,
180
- messages: messagesBeforeRewind(loadedProjection.messages, this.snapshot.rewind.messageId),
181
- }
182
- : loadedProjection;
183
- this.patch({
184
- ready: true,
185
- connection: 'open',
186
- error: null,
187
- configOptions,
188
- projection: {
189
- ...projection,
190
- configOptions,
191
- },
192
- });
193
- }
194
- reloadAfterRuntimeReady() {
195
- if (!this.snapshot.ready || this.runtimeReload)
196
- return;
197
- this.resetCanonicalSessionState();
198
- this.patch({ ready: false, connection: 'connecting', error: null });
199
- const reload = this.loadCanonicalSession()
200
- .catch((error) => {
201
- this.patch({
202
- ready: false,
203
- connection: 'error',
204
- error: error instanceof Error ? error : new Error(String(error)),
205
- });
206
- })
207
- .finally(() => {
208
- if (this.runtimeReload === reload)
209
- this.runtimeReload = null;
210
- });
211
- this.runtimeReload = reload;
212
- void reload;
213
- }
214
- onRuntimeReady() {
215
- this.runtimeGeneration += 1;
216
- for (const restart of this.restartWaiters)
217
- restart();
218
- this.restartWaiters.clear();
219
- this.reloadAfterRuntimeReady();
220
- }
221
- async raceWithRuntimeRestart(operation, generation) {
222
- if (generation !== this.runtimeGeneration) {
223
- void operation.catch(() => { });
224
- throw new AcpRuntimeRestartError();
225
- }
226
- let restart = () => { };
227
- const restarted = new Promise((_resolve, reject) => {
228
- restart = () => reject(new AcpRuntimeRestartError());
229
- });
230
- this.restartWaiters.add(restart);
231
- try {
232
- return await Promise.race([operation, restarted]);
233
- }
234
- finally {
235
- this.restartWaiters.delete(restart);
236
- }
237
- }
238
- send(prompt, options = {}) {
239
- let resolveRequest = () => { };
240
- let rejectRequest = () => { };
241
- const request = new Promise((resolve, reject) => {
242
- resolveRequest = resolve;
243
- rejectRequest = reject;
244
- });
245
- const queued = this.promptQueue.then(() => this.executeSend(prompt, options, {
246
- resolve: resolveRequest,
247
- reject: rejectRequest,
248
- }));
249
- this.promptQueue = queued.catch(() => { });
250
- return request;
251
- }
252
- async executeSend(prompt, options, request) {
253
- const text = prompt
254
- .filter((part) => part.type === 'text')
255
- .map((part) => part.text)
256
- .join('');
257
- this.patch({ sending: true, error: null });
258
- try {
259
- let restartRetries = 0;
260
- let generation = this.runtimeGeneration;
261
- while (true) {
262
- if (!this.snapshot.ready)
263
- await this.connect();
264
- generation = this.runtimeGeneration;
265
- try {
266
- if (options.model) {
267
- await this.raceWithRuntimeRestart(this.client.setSessionConfigOption(this.options.sessionId, 'model', options.model), generation);
268
- }
269
- if (options.agent) {
270
- await this.raceWithRuntimeRestart(this.client.setSessionConfigOption(this.options.sessionId, 'mode', options.agent), generation);
271
- }
272
- if (generation !== this.runtimeGeneration) {
273
- throw new AcpRuntimeRestartError();
274
- }
275
- break;
276
- }
277
- catch (error) {
278
- if (!(error instanceof AcpRuntimeRestartError))
279
- throw error;
280
- restartRetries += 1;
281
- if (restartRetries > MAX_CONFIG_RESTART_RETRIES) {
282
- throw new Error(`ACP runtime restarted more than ${MAX_CONFIG_RESTART_RETRIES} times while preparing the prompt`);
283
- }
284
- if (this.runtimeReload)
285
- await this.runtimeReload;
286
- }
287
- }
288
- if (text) {
289
- this.onEnvelope({
290
- jsonrpc: '2.0',
291
- method: 'session/update',
292
- params: {
293
- sessionId: this.options.sessionId,
294
- update: {
295
- sessionUpdate: 'user_message_chunk',
296
- content: { type: 'text', text },
297
- },
298
- },
299
- });
300
- }
301
- if (this.snapshot.rewind)
302
- this.patch({ rewind: null });
303
- const promptOperation = this.client.prompt(this.options.sessionId, prompt);
304
- let result;
305
- try {
306
- result = await this.raceWithRuntimeRestart(promptOperation, generation);
307
- }
308
- catch (error) {
309
- if (error instanceof AcpRuntimeRestartError) {
310
- throw new Error('ACP runtime restarted after session/prompt dispatch; the prompt result is unknown');
311
- }
312
- throw error;
313
- }
314
- this.applyPromptResult(result, false);
315
- request.resolve();
316
- await this.settlePrompt(result);
317
- }
318
- catch (error) {
319
- request.reject(error);
320
- this.discardPromptSettlement();
321
- this.patch({
322
- error: error instanceof Error ? error : new Error(String(error)),
323
- projection: {
324
- ...this.snapshot.projection,
325
- status: { type: 'idle' },
326
- },
327
- });
328
- throw error;
329
- }
330
- finally {
331
- this.patch({ sending: false });
332
- }
333
- }
334
- async cancel() {
335
- await this.client.cancel(this.options.sessionId);
336
- this.discardPromptSettlement();
337
- this.patch({
338
- projection: {
339
- ...this.snapshot.projection,
340
- status: { type: 'idle' },
341
- permissions: [],
342
- questions: [],
343
- },
344
- });
345
- }
346
- async rewind(messageId) {
347
- if (!messageId)
348
- throw new Error('ACP session rewind requires a message id');
349
- if (this.snapshot.sending)
350
- throw new Error('Cannot rewind a busy ACP session');
351
- if (!this.snapshot.ready)
352
- await this.connect();
353
- const canonicalMessageId = await this.resolveRewindMessageId(messageId);
354
- await this.client.revertSession(this.options.sessionId, canonicalMessageId);
355
- this.patch({ rewind: { messageId: canonicalMessageId } });
356
- this.resetCanonicalSessionState();
357
- await this.loadCanonicalSession();
358
- }
359
- async resolveRewindMessageId(messageId) {
360
- if (!messageId.startsWith('acp-user-'))
361
- return messageId;
362
- const optimisticUsers = this.snapshot.projection.messages.filter((message) => message.info.role === 'user');
363
- const optimisticIndex = optimisticUsers.findIndex((message) => message.info.id === messageId);
364
- const optimisticText = optimisticUsers[optimisticIndex]?.parts
365
- .filter((part) => part.type === 'text')
366
- .map((part) => part.text)
367
- .join('');
368
- if (optimisticIndex < 0 || !optimisticText) {
369
- throw new Error('ACP session rewind message is not in the current transcript');
370
- }
371
- this.resetCanonicalSessionState();
372
- await this.loadCanonicalSession();
373
- const canonicalUsers = this.snapshot.projection.messages.filter((message) => message.info.role === 'user');
374
- const ordinalMatch = canonicalUsers[optimisticIndex];
375
- const textMatch = [...canonicalUsers].reverse().find((message) => message.parts
376
- .filter((part) => part.type === 'text')
377
- .map((part) => part.text)
378
- .join('') === optimisticText);
379
- const canonical = ordinalMatch?.info.id.startsWith('acp-user-') ? textMatch : ordinalMatch;
380
- if (!canonical || canonical.info.id.startsWith('acp-user-')) {
381
- throw new Error('ACP session rewind could not resolve the canonical OpenCode message id');
382
- }
383
- return canonical.info.id;
384
- }
385
- async restoreRewind() {
386
- if (!this.snapshot.rewind)
387
- return;
388
- if (this.snapshot.sending)
389
- throw new Error('Cannot restore a busy ACP session');
390
- await this.client.unrevertSession(this.options.sessionId);
391
- this.patch({ rewind: null });
392
- this.resetCanonicalSessionState();
393
- await this.loadCanonicalSession();
394
- }
395
- async runCommand(command, args, options = {}) {
396
- const normalized = command.replace(/^\/+/, '').toLowerCase();
397
- if (normalized === 'undo' || normalized === 'redo') {
398
- throw new Error(`OpenCode ACP does not support /${normalized}`);
399
- }
400
- const text = `/${normalized}${args.trim() ? ` ${args.trim()}` : ''}`;
401
- await this.send([{ type: 'text', text }], options);
402
- }
403
- async answerPermission(requestId, reply) {
404
- const request = this.openRequests.get(requestId);
405
- const responseId = request?.id ?? requestId;
406
- const params = request?.params ?? {};
407
- const optionId = selectedPermissionOption(params, reply);
408
- if (reply === 'reject' && !optionId) {
409
- const result = { outcome: { outcome: 'cancelled' } };
410
- await this.client.respond(responseId, result);
411
- this.onEnvelope({ jsonrpc: '2.0', id: responseId, result });
412
- return;
413
- }
414
- if (!optionId) {
415
- throw new Error(`ACP permission request ${requestId} has no compatible ${reply} option`);
416
- }
417
- const result = {
418
- outcome: { outcome: 'selected', optionId },
419
- };
420
- await this.client.respond(responseId, result);
421
- this.onEnvelope({ jsonrpc: '2.0', id: responseId, result });
422
- }
423
- async answerQuestion(requestId, answers) {
424
- const request = this.openRequests.get(requestId);
425
- const responseId = request?.id ?? requestId;
426
- const params = request?.params ?? {};
427
- const result = {
428
- action: 'accept',
429
- content: questionContent(params, answers),
430
- };
431
- await this.client.respond(responseId, result);
432
- this.onEnvelope({ jsonrpc: '2.0', id: responseId, result });
433
- }
434
- async rejectQuestion(requestId) {
435
- const responseId = this.openRequests.get(requestId)?.id ?? requestId;
436
- const result = { action: 'decline' };
437
- await this.client.respond(responseId, result);
438
- this.onEnvelope({ jsonrpc: '2.0', id: responseId, result });
439
- }
440
- close() {
441
- this.discardPromptSettlement();
442
- this.stream?.close();
443
- this.stream = null;
444
- this.patch({ connection: 'closed', ready: false });
445
- }
446
- onEnvelope(envelope) {
447
- if (this.snapshot.sending && isPromptResult(envelope))
448
- return;
449
- if ('method' in envelope &&
450
- envelope.method === 'kortix/runtime_ready' &&
451
- (!isObject(envelope.params) ||
452
- envelope.params.sessionId === null ||
453
- envelope.params.sessionId === this.options.sessionId)) {
454
- this.onRuntimeReady();
455
- }
456
- if ('method' in envelope && 'id' in envelope && isObject(envelope.params)) {
457
- this.openRequests.set(String(envelope.id), {
458
- id: envelope.id,
459
- params: envelope.params,
460
- });
461
- }
462
- else if ('id' in envelope && !('method' in envelope)) {
463
- this.openRequests.delete(String(envelope.id));
464
- }
465
- const projection = applyAcpEnvelope(this.snapshot.projection, envelope);
466
- if (projection !== this.snapshot.projection)
467
- this.patch({ projection });
468
- if ('method' in envelope && envelope.method === 'session/update') {
469
- this.schedulePromptSettlement();
470
- }
471
- }
472
- settlePrompt(result) {
473
- return new Promise((resolve) => {
474
- this.promptSettlement = {
475
- result,
476
- timer: null,
477
- resolve,
478
- };
479
- this.schedulePromptSettlement();
480
- });
481
- }
482
- schedulePromptSettlement() {
483
- const settlement = this.promptSettlement;
484
- if (!settlement)
485
- return;
486
- if (settlement.timer) {
487
- clearTimeout(settlement.timer);
488
- settlement.timer = null;
489
- }
490
- if (hasProjectionBlockers(this.snapshot.projection))
491
- return;
492
- settlement.timer = setTimeout(() => {
493
- if (this.promptSettlement !== settlement || hasProjectionBlockers(this.snapshot.projection)) {
494
- this.schedulePromptSettlement();
495
- return;
496
- }
497
- this.promptSettlement = null;
498
- this.applyPromptResult(settlement.result, true);
499
- settlement.resolve();
500
- }, ACP_PROMPT_QUIET_PERIOD_MS);
501
- }
502
- applyPromptResult(result, settled) {
503
- const projection = applyAcpEnvelope(this.snapshot.projection, {
504
- jsonrpc: '2.0',
505
- id: `prompt:${Date.now()}`,
506
- result,
507
- });
508
- const next = settled ? projection : { ...projection, status: { type: 'busy' } };
509
- if (next !== this.snapshot.projection)
510
- this.patch({ projection: next });
511
- }
512
- discardPromptSettlement() {
513
- const settlement = this.promptSettlement;
514
- if (!settlement)
515
- return;
516
- this.promptSettlement = null;
517
- if (settlement.timer)
518
- clearTimeout(settlement.timer);
519
- settlement.resolve();
520
- }
521
- patch(value) {
522
- this.snapshot = { ...this.snapshot, ...value };
523
- for (const listener of this.listeners)
524
- listener();
525
- }
526
- }
527
- export function createAcpSessionController(options) {
528
- return new AcpSessionController(options);
529
- }
530
- //# sourceMappingURL=session-controller.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-controller.js","sourceRoot":"","sources":["../../../src/core/acp/session-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAkB,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAsB,MAAM,cAAc,CAAC;AAQzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MA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