@kortix/sdk 0.14.8 → 0.14.10

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/README.md +172 -132
  2. package/dist/browser/session-sync/server-transcript-mirror.d.ts +4 -80
  3. package/dist/browser/session-sync/server-transcript-mirror.d.ts.map +1 -1
  4. package/dist/browser/session-sync/server-transcript-mirror.js +3 -128
  5. package/dist/browser/session-sync/server-transcript-mirror.js.map +1 -1
  6. package/dist/browser/session-sync/session-sync-registry.d.ts +6 -6
  7. package/dist/browser/session-sync/session-sync-registry.js +8 -8
  8. package/dist/browser/session-sync/session-sync-registry.js.map +1 -1
  9. package/dist/core/client/kortix.d.ts +140 -2
  10. package/dist/core/client/kortix.d.ts.map +1 -1
  11. package/dist/core/client/kortix.js +2 -0
  12. package/dist/core/client/kortix.js.map +1 -1
  13. package/dist/core/client/project-artifacts.d.ts +22 -0
  14. package/dist/core/client/project-artifacts.d.ts.map +1 -0
  15. package/dist/core/client/project-artifacts.js +18 -0
  16. package/dist/core/client/project-artifacts.js.map +1 -0
  17. package/dist/core/client/project-core.d.ts.map +1 -1
  18. package/dist/core/client/project-operations-admin.d.ts +52 -0
  19. package/dist/core/client/project-operations-admin.d.ts.map +1 -1
  20. package/dist/core/client/project-operations-review.d.ts +79 -0
  21. package/dist/core/client/project-operations-review.d.ts.map +1 -1
  22. package/dist/core/client/project-operations-review.js +79 -0
  23. package/dist/core/client/project-operations-review.js.map +1 -1
  24. package/dist/core/client/project-operations-workspace.d.ts +52 -0
  25. package/dist/core/client/project-operations-workspace.d.ts.map +1 -1
  26. package/dist/core/client/project-operations.d.ts +112 -4
  27. package/dist/core/client/project-operations.d.ts.map +1 -1
  28. package/dist/core/client/project-operations.js +22 -2
  29. package/dist/core/client/project-operations.js.map +1 -1
  30. package/dist/core/client/project-platform-security.d.ts +29 -0
  31. package/dist/core/client/project-platform-security.d.ts.map +1 -1
  32. package/dist/core/client/project-platform-security.js +27 -0
  33. package/dist/core/client/project-platform-security.js.map +1 -1
  34. package/dist/core/client/project-platform-settings.d.ts +2 -0
  35. package/dist/core/client/project-platform-settings.d.ts.map +1 -1
  36. package/dist/core/files/image-cache.d.ts +56 -0
  37. package/dist/core/files/image-cache.d.ts.map +1 -0
  38. package/dist/core/files/image-cache.js +130 -0
  39. package/dist/core/files/image-cache.js.map +1 -0
  40. package/dist/core/http/response-error.d.ts.map +1 -1
  41. package/dist/core/http/response-error.js +2 -0
  42. package/dist/core/http/response-error.js.map +1 -1
  43. package/dist/core/rest/platform-client/host-boundary.d.ts +21 -15
  44. package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
  45. package/dist/core/rest/platform-client/host-boundary.js +10 -4
  46. package/dist/core/rest/platform-client/host-boundary.js.map +1 -1
  47. package/dist/core/rest/projects-client/agent-config.d.ts +4 -0
  48. package/dist/core/rest/projects-client/agent-config.d.ts.map +1 -1
  49. package/dist/core/rest/projects-client/agent-config.js.map +1 -1
  50. package/dist/core/rest/projects-client/agent-scope.d.ts +8 -0
  51. package/dist/core/rest/projects-client/agent-scope.d.ts.map +1 -1
  52. package/dist/core/rest/projects-client/agent-scope.js.map +1 -1
  53. package/dist/core/rest/projects-client/apps.d.ts +1 -1
  54. package/dist/core/rest/projects-client/apps.d.ts.map +1 -1
  55. package/dist/core/rest/projects-client/artifacts.d.ts +289 -0
  56. package/dist/core/rest/projects-client/artifacts.d.ts.map +1 -0
  57. package/dist/core/rest/projects-client/artifacts.js +105 -0
  58. package/dist/core/rest/projects-client/artifacts.js.map +1 -0
  59. package/dist/core/rest/projects-client/change-request-recovery.d.ts +30 -0
  60. package/dist/core/rest/projects-client/change-request-recovery.d.ts.map +1 -0
  61. package/dist/core/rest/projects-client/change-request-recovery.js +121 -0
  62. package/dist/core/rest/projects-client/change-request-recovery.js.map +1 -0
  63. package/dist/core/rest/projects-client/change-requests.d.ts +5 -0
  64. package/dist/core/rest/projects-client/change-requests.d.ts.map +1 -1
  65. package/dist/core/rest/projects-client/change-requests.js.map +1 -1
  66. package/dist/core/rest/projects-client/channels.d.ts +212 -2
  67. package/dist/core/rest/projects-client/channels.d.ts.map +1 -1
  68. package/dist/core/rest/projects-client/channels.js +111 -8
  69. package/dist/core/rest/projects-client/channels.js.map +1 -1
  70. package/dist/core/rest/projects-client/chrome.d.ts +38 -0
  71. package/dist/core/rest/projects-client/chrome.d.ts.map +1 -0
  72. package/dist/core/rest/projects-client/chrome.js +21 -0
  73. package/dist/core/rest/projects-client/chrome.js.map +1 -0
  74. package/dist/core/rest/projects-client/connectors.d.ts +259 -7
  75. package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
  76. package/dist/core/rest/projects-client/connectors.js +84 -4
  77. package/dist/core/rest/projects-client/connectors.js.map +1 -1
  78. package/dist/core/rest/projects-client/gateway.d.ts +23 -0
  79. package/dist/core/rest/projects-client/gateway.d.ts.map +1 -1
  80. package/dist/core/rest/projects-client/gateway.js.map +1 -1
  81. package/dist/core/rest/projects-client/iam-actions.d.ts +5 -0
  82. package/dist/core/rest/projects-client/iam-actions.d.ts.map +1 -1
  83. package/dist/core/rest/projects-client/iam-actions.js +5 -0
  84. package/dist/core/rest/projects-client/iam-actions.js.map +1 -1
  85. package/dist/core/rest/projects-client/index.d.ts +6 -0
  86. package/dist/core/rest/projects-client/index.d.ts.map +1 -1
  87. package/dist/core/rest/projects-client/index.js +6 -0
  88. package/dist/core/rest/projects-client/index.js.map +1 -1
  89. package/dist/core/rest/projects-client/memory.d.ts +236 -0
  90. package/dist/core/rest/projects-client/memory.d.ts.map +1 -0
  91. package/dist/core/rest/projects-client/memory.js +92 -0
  92. package/dist/core/rest/projects-client/memory.js.map +1 -0
  93. package/dist/core/rest/projects-client/projects.d.ts +23 -6
  94. package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
  95. package/dist/core/rest/projects-client/projects.js +6 -4
  96. package/dist/core/rest/projects-client/projects.js.map +1 -1
  97. package/dist/core/rest/projects-client/review-items.d.ts.map +1 -1
  98. package/dist/core/rest/projects-client/review-items.js +40 -2
  99. package/dist/core/rest/projects-client/review-items.js.map +1 -1
  100. package/dist/core/rest/projects-client/session-groups.d.ts +48 -0
  101. package/dist/core/rest/projects-client/session-groups.d.ts.map +1 -0
  102. package/dist/core/rest/projects-client/session-groups.js +50 -0
  103. package/dist/core/rest/projects-client/session-groups.js.map +1 -0
  104. package/dist/core/rest/projects-client/sessions.d.ts +32 -0
  105. package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
  106. package/dist/core/rest/projects-client/sessions.js +10 -0
  107. package/dist/core/rest/projects-client/sessions.js.map +1 -1
  108. package/dist/core/rest/projects-client/setup-links.d.ts +5 -0
  109. package/dist/core/rest/projects-client/setup-links.d.ts.map +1 -1
  110. package/dist/core/rest/projects-client/setup-links.js.map +1 -1
  111. package/dist/core/rest/projects-client/spaces.d.ts +263 -0
  112. package/dist/core/rest/projects-client/spaces.d.ts.map +1 -0
  113. package/dist/core/rest/projects-client/spaces.js +165 -0
  114. package/dist/core/rest/projects-client/spaces.js.map +1 -0
  115. package/dist/core/rest/projects-client/triggers.d.ts +79 -32
  116. package/dist/core/rest/projects-client/triggers.d.ts.map +1 -1
  117. package/dist/core/rest/projects-client/triggers.js +1 -1
  118. package/dist/core/rest/projects-client/triggers.js.map +1 -1
  119. package/dist/core/session/open-bundle.d.ts +6 -36
  120. package/dist/core/session/open-bundle.d.ts.map +1 -1
  121. package/dist/core/session/open-bundle.js +3 -74
  122. package/dist/core/session/open-bundle.js.map +1 -1
  123. package/dist/core/session-log/source.d.ts +11 -3
  124. package/dist/core/session-log/source.d.ts.map +1 -1
  125. package/dist/core/session-log/source.js +26 -14
  126. package/dist/core/session-log/source.js.map +1 -1
  127. package/dist/core/session-log/turns/blocks.d.ts +2 -2
  128. package/dist/core/session-log/turns/blocks.d.ts.map +1 -1
  129. package/dist/core/session-log/turns/blocks.js +13 -5
  130. package/dist/core/session-log/turns/blocks.js.map +1 -1
  131. package/dist/core/session-log/turns/v1-parts.d.ts.map +1 -1
  132. package/dist/core/session-log/turns/v1-parts.js +18 -4
  133. package/dist/core/session-log/turns/v1-parts.js.map +1 -1
  134. package/dist/core/session-log/types.d.ts +13 -3
  135. package/dist/core/session-log/types.d.ts.map +1 -1
  136. package/dist/core/session-log/v1.d.ts +4 -1
  137. package/dist/core/session-log/v1.d.ts.map +1 -1
  138. package/dist/core/session-log/v1.js +2 -0
  139. package/dist/core/session-log/v1.js.map +1 -1
  140. package/dist/core/session-sync/saved-transcript.d.ts +12 -42
  141. package/dist/core/session-sync/saved-transcript.d.ts.map +1 -1
  142. package/dist/core/session-sync/saved-transcript.js +11 -74
  143. package/dist/core/session-sync/saved-transcript.js.map +1 -1
  144. package/dist/core/turns/parts.js +1 -1
  145. package/dist/core/turns/parts.js.map +1 -1
  146. package/dist/core/turns/safe-url.d.ts +3 -0
  147. package/dist/core/turns/safe-url.d.ts.map +1 -0
  148. package/dist/core/turns/safe-url.js +13 -0
  149. package/dist/core/turns/safe-url.js.map +1 -0
  150. package/dist/core/turns/segments/group-steps.d.ts.map +1 -1
  151. package/dist/core/turns/segments/group-steps.js +7 -6
  152. package/dist/core/turns/segments/group-steps.js.map +1 -1
  153. package/dist/core/turns/segments/narration.d.ts.map +1 -1
  154. package/dist/core/turns/segments/narration.js +35 -18
  155. package/dist/core/turns/segments/narration.js.map +1 -1
  156. package/dist/core/turns/segments/session-activity-groups.d.ts +14 -4
  157. package/dist/core/turns/segments/session-activity-groups.d.ts.map +1 -1
  158. package/dist/core/turns/segments/session-activity-groups.js +47 -7
  159. package/dist/core/turns/segments/session-activity-groups.js.map +1 -1
  160. package/dist/core/turns/segments/work-split.d.ts +1 -1
  161. package/dist/core/turns/segments/work-split.d.ts.map +1 -1
  162. package/dist/core/turns/segments/work-split.js +3 -6
  163. package/dist/core/turns/segments/work-split.js.map +1 -1
  164. package/dist/core/turns/tools/image-gen-view.d.ts +162 -0
  165. package/dist/core/turns/tools/image-gen-view.d.ts.map +1 -0
  166. package/dist/core/turns/tools/image-gen-view.js +402 -0
  167. package/dist/core/turns/tools/image-gen-view.js.map +1 -0
  168. package/dist/core/turns/tools/index.d.ts +2 -1
  169. package/dist/core/turns/tools/index.d.ts.map +1 -1
  170. package/dist/core/turns/tools/index.js +2 -1
  171. package/dist/core/turns/tools/index.js.map +1 -1
  172. package/dist/core/turns/tools/tool-meta.d.ts.map +1 -1
  173. package/dist/core/turns/tools/tool-meta.js +8 -0
  174. package/dist/core/turns/tools/tool-meta.js.map +1 -1
  175. package/dist/index.d.ts +1 -0
  176. package/dist/index.d.ts.map +1 -1
  177. package/dist/index.js +1 -0
  178. package/dist/index.js.map +1 -1
  179. package/dist/kortix.esm.min.js +41 -39
  180. package/dist/kortix.global.js +41 -39
  181. package/dist/react/index.d.ts +5 -0
  182. package/dist/react/index.d.ts.map +1 -1
  183. package/dist/react/index.js +6 -0
  184. package/dist/react/index.js.map +1 -1
  185. package/dist/react/query-keys.d.ts +60 -1
  186. package/dist/react/query-keys.d.ts.map +1 -1
  187. package/dist/react/query-keys.js +64 -2
  188. package/dist/react/query-keys.js.map +1 -1
  189. package/dist/react/session-cache-write.d.ts +8 -0
  190. package/dist/react/session-cache-write.d.ts.map +1 -1
  191. package/dist/react/session-cache-write.js +50 -1
  192. package/dist/react/session-cache-write.js.map +1 -1
  193. package/dist/react/use-artifacts.d.ts +257 -0
  194. package/dist/react/use-artifacts.d.ts.map +1 -0
  195. package/dist/react/use-artifacts.js +197 -0
  196. package/dist/react/use-artifacts.js.map +1 -0
  197. package/dist/react/use-chrome-connections.d.ts +15 -0
  198. package/dist/react/use-chrome-connections.d.ts.map +1 -0
  199. package/dist/react/use-chrome-connections.js +42 -0
  200. package/dist/react/use-chrome-connections.js.map +1 -0
  201. package/dist/react/use-feature-flag.d.ts +1 -1
  202. package/dist/react/use-feature-flag.d.ts.map +1 -1
  203. package/dist/react/use-feature-flag.js +4 -1
  204. package/dist/react/use-feature-flag.js.map +1 -1
  205. package/dist/react/use-project-apps.d.ts.map +1 -1
  206. package/dist/react/use-project-apps.js +8 -5
  207. package/dist/react/use-project-apps.js.map +1 -1
  208. package/dist/react/use-project-memory.d.ts +41 -0
  209. package/dist/react/use-project-memory.d.ts.map +1 -0
  210. package/dist/react/use-project-memory.js +126 -0
  211. package/dist/react/use-project-memory.js.map +1 -0
  212. package/dist/react/use-project-sessions.d.ts +26 -7
  213. package/dist/react/use-project-sessions.d.ts.map +1 -1
  214. package/dist/react/use-project-sessions.js +57 -21
  215. package/dist/react/use-project-sessions.js.map +1 -1
  216. package/dist/react/use-project-spaces.d.ts +74 -0
  217. package/dist/react/use-project-spaces.d.ts.map +1 -0
  218. package/dist/react/use-project-spaces.js +196 -0
  219. package/dist/react/use-project-spaces.js.map +1 -0
  220. package/dist/react/use-session-groups.d.ts +41 -0
  221. package/dist/react/use-session-groups.d.ts.map +1 -0
  222. package/dist/react/use-session-groups.js +140 -0
  223. package/dist/react/use-session-groups.js.map +1 -0
  224. package/dist/react/use-session-log.d.ts +12 -7
  225. package/dist/react/use-session-log.d.ts.map +1 -1
  226. package/dist/react/use-session-log.js +49 -26
  227. package/dist/react/use-session-log.js.map +1 -1
  228. package/dist/react/use-session-sync.d.ts +9 -16
  229. package/dist/react/use-session-sync.d.ts.map +1 -1
  230. package/dist/react/use-session-sync.js +17 -120
  231. package/dist/react/use-session-sync.js.map +1 -1
  232. package/dist/react/use-session.d.ts.map +1 -1
  233. package/dist/react/use-session.js +16 -25
  234. package/dist/react/use-session.js.map +1 -1
  235. package/dist/workspace-search/client.d.ts.map +1 -1
  236. package/dist/workspace-search/client.js +4 -10
  237. package/dist/workspace-search/client.js.map +1 -1
  238. package/package.json +3 -3
  239. package/dist/browser/session-sync/mirror-paging.d.ts +0 -32
  240. package/dist/browser/session-sync/mirror-paging.d.ts.map +0 -1
  241. package/dist/browser/session-sync/mirror-paging.js +0 -36
  242. package/dist/browser/session-sync/mirror-paging.js.map +0 -1
  243. package/dist/react/use-session-transcript-history.d.ts +0 -11
  244. package/dist/react/use-session-transcript-history.d.ts.map +0 -1
  245. package/dist/react/use-session-transcript-history.js +0 -35
  246. package/dist/react/use-session-transcript-history.js.map +0 -1
package/README.md CHANGED
@@ -11,7 +11,7 @@ road.)
11
11
  > Philosophy: **one Kortix token, one client, every action a method.** Keys never
12
12
  > leave the server; mutations own their side-effects there; the host states intent.
13
13
 
14
- 📖 **Full documentation:** [kortix.com/docs/sdk](https://kortix.com/docs/sdk) —
14
+ 📖 **Full documentation:** [kortix.com/docs/#sdk](https://kortix.com/docs/#sdk) —
15
15
  getting started, the full client, sessions, React hooks, and the subpath modules.
16
16
  The REST API has an auto-generated reference at
17
17
  [api.kortix.com/v1/docs](https://api.kortix.com/v1/docs).
@@ -84,7 +84,7 @@ One connector as a handle: `run` returns the output itself and throws
84
84
  `upstreamStatus`, `retryAfterSeconds`) or `ConnectorApprovalPendingError`;
85
85
  `paginate` follows a cursor and throws `ConnectorPageLimitError` (with
86
86
  `nextArgs`) past `maxPages`; `useConnectorQuery` (`@kortix/sdk/react`) caches a
87
- read. Guide: `/docs/connect/connectors#call-connectors-from-code`; runnable: `examples/13-connectors-as-code.ts`.
87
+ read. Guide: <https://kortix.com/docs/#call-a-connector>; runnable: `examples/13-connectors-as-code.ts`.
88
88
 
89
89
  ```ts
90
90
  const linear = kortix.project(projectId).connector('linear');
@@ -154,7 +154,7 @@ The browser path needs the App's viewer scope set to `api`
154
154
  `403 insufficient_scope`. A service account answers `403` until a person
155
155
  grants it a project role (`kortix access grant --service-account <id> --role
156
156
  member --project <id>`). Never put a provider API key in an App or a Convex
157
- deployment when a connector exists. Guide: `/docs/connect/connectors#call-connectors-from-code`.
157
+ deployment when a connector exists. Guide: <https://kortix.com/docs/#call-a-connector>.
158
158
 
159
159
  ### Upload prompt attachments before Send
160
160
 
@@ -286,14 +286,19 @@ no build step required:
286
286
  ## Entry points
287
287
 
288
288
  `@kortix/sdk` is the canonical entry — everything framework-free lives there.
289
- Four others exist, each for a reason that fits in one sentence:
290
-
291
- | Entry | Why it is separate |
292
- | ----------------------------- | ---------------------------------------------------------- |
293
- | `@kortix/sdk/react` | React is a peer dependency |
294
- | `@kortix/sdk/server` | imports `node:async_hooks` |
295
- | `@kortix/sdk/wire-message-id` | the wire-id clock alone, one file with no imports (also at root) |
296
- | `@kortix/sdk/internal/*` | unsupported, outside semver |
289
+ Eight others are stable, each for a reason that fits in one sentence:
290
+
291
+ | Entry | Why it is separate |
292
+ | ------------------------------- | ---------------------------------------------------------- |
293
+ | `@kortix/sdk/react` | React is a peer dependency |
294
+ | `@kortix/sdk/server` | imports `node:async_hooks` |
295
+ | `@kortix/sdk/genui/fence` | splits `openui` blocks out of text and loads no parser |
296
+ | `@kortix/sdk/genui` | needs the optional peers `zod` and `@openuidev/lang-core` |
297
+ | `@kortix/sdk/genui/react` | React and the Generative UI peers |
298
+ | `@kortix/sdk/wire-message-id` | the message-id mint alone, one file with no imports (also at root) |
299
+ | `@kortix/sdk/workspace-search` | the workspace search client; the root does not export it |
300
+ | `@kortix/sdk/capture-rules` | the Kortix Capture constants alone |
301
+ | `@kortix/sdk/internal/*` | unsupported, outside semver |
297
302
 
298
303
  Install the optional peers before you use the React entry:
299
304
 
@@ -302,9 +307,9 @@ npm install @kortix/sdk react @tanstack/react-query
302
307
  ```
303
308
 
304
309
  Older subpaths (`@kortix/sdk/projects-client`, `/turns`, …) still work and are
305
- `@deprecated`. Import from the root instead — see **Entry points** below for
306
- the four that are real, and **API-MAP.md**'s Stability table for the full
307
- list of aliases (20 of them).
310
+ `@deprecated`. Import from the root instead — see **Entry points** below, and
311
+ the [SDK reference](https://kortix.com/docs/#deprecated-names) for the full
312
+ list of aliases (21 of them).
308
313
 
309
314
  > **React Native / Expo:** REST works. Live streaming works with a host
310
315
  > transport: pass `configureKortix({ eventStreamTransport })` (one connection's
@@ -351,22 +356,6 @@ await kortix.project(pid).secrets.upsert({
351
356
  strategy: "broker",
352
357
  consumer: "llm_gateway",
353
358
  });
354
- // When pooled_provider_secrets is enabled for the project,
355
- // a new account secret is available to this project's members by default.
356
- const shared = await kortix.accounts.secretResources.create(accountId, {
357
- project_id: pid,
358
- label: "Anthropic backup",
359
- provider_id: "anthropic",
360
- name: "ANTHROPIC_API_KEY",
361
- value: providerKey,
362
- consumer: "llm_gateway",
363
- strategy: "broker",
364
- });
365
- // Restrict it to selected members when needed. The creator keeps access.
366
- await kortix.accounts.secretResources.setAccess(accountId, shared.secret_id, "members", [memberUserId]);
367
- await kortix.session(pid, sid).providerSecretPool.set("anthropic", [shared.secret_id]);
368
- const { pools, can_edit } = await kortix.session(pid, sid).providerSecretPool.list();
369
- // Passing null to set() resets the session to the project default.
370
359
  const visibleSessions = await kortix.project(pid).sessions.list();
371
360
  const projectInventory = await kortix
372
361
  .project(pid)
@@ -376,13 +365,12 @@ const mine = await kortix.project(pid).sessions.list({ parent: "root", startedBy
376
365
  const found = await kortix.project(pid).sessions.list({ parent: "root", q: "nightly" }); // searches every visible session
377
366
  const spawned = await kortix.project(pid).sessions.list({ parent: mine[0].session_id });
378
367
  // React: useProjectSessions(pid, { parent: "root", startedBy: "me" }), useSessionChildren(pid, parentId)
379
- const warm = await kortix.project(pid).sessions.ensureWarm(); // ordinary session, pre-created
380
368
 
381
369
  // Sessions (id-bound handle)
382
370
  const s = kortix.session(pid, sid);
383
371
  const cost = await s.cost(); // reads finalized LLM + compute cost; no runtime start
384
372
  await s.send("Build me a widget"); // provisions/resumes if needed, then prompts
385
- await s.rewind(userMessageId); // stages a reversible rollback on this session
373
+ await s.rewind(userMessageId); // only when health() lists `session.rewind`; pi does not
386
374
  await s.restoreRewind(); // restores the removed path before the next prompt
387
375
  await s.previews();
388
376
  await s.participants(); // who can open the session
@@ -400,13 +388,6 @@ await s.answerQuestion(questions[0].id, [["Yes"]]); // null dismisses it
400
388
  await s.compact(); // only when health() lists `session.compact`
401
389
  ```
402
390
 
403
- React consumers use `useAccountSecretResources(accountId)` and
404
- `useSessionProviderSecretPools(projectId, sessionId)` from `@kortix/sdk/react`.
405
- The latter exposes `setPool.mutate({ providerId, secretIds })`. `null` restores
406
- inheritance; `[]` disables that provider for the session. Empty configured pools
407
- remain listed after their last resource is deleted. Successful writes refresh
408
- both the pool list and the session's provider-specific query cache.
409
-
410
391
  ### Apps
411
392
 
412
393
  `kortix.project(projectId).apps` deploys immutable App releases behind one stable URL: releases, machines per process group, persistent volumes. New Apps use `private` access. Apps is generally available: every project can create and deploy them.
@@ -531,13 +512,15 @@ A transcript message carries only the model its turn asked for. In React,
531
512
  ### React runtime
532
513
 
533
514
  `useSession(projectId, sessionId)` opens the session runtime returned by
534
- `POST /start`. The runtime is OpenCode or pi; the hook reads the same routes,
535
- transcript and events from both. The hook owns messages, rewind and restore,
536
- cancellation, commands, permissions, and questions. Hosts do not construct
537
- runtime routes. A feature one harness lacks is a capability: gate its control
538
- with `runtimeSupports(health?.capabilities, 'session.rewind')`. pi lists
539
- `session.subagents` only, so rewind, compaction, slash commands, the todo list
540
- and the runtime config document stay hidden or empty on a pi session.
515
+ `POST /start`. Every new session runs pi. The hook owns messages, rewind and
516
+ restore, cancellation, commands, permissions, and questions. Hosts do not
517
+ construct runtime routes. A feature the runtime lacks is a capability: gate its
518
+ control with `runtimeSupports(health?.capabilities, 'session.rewind')`. pi lists
519
+ `session.subagents`, `session.compact`, `session.commands`, `session.steer` and
520
+ `session.log.v2`. It does not list `session.rewind`, `session.fork`,
521
+ `session.mcp`, `session.todo`, `session.shell`, `session.attach` or
522
+ `session.config`, so rewind, fork, MCP servers, the todo list, shell turns and
523
+ the runtime config document stay hidden or empty on a pi session.
541
524
 
542
525
  Every session saves its transcript at the end of each turn. `useSession` reads saved
543
526
  messages from the platform database while `/start` continues. It uses the
@@ -545,17 +528,20 @@ server-validated runtime session id and lets the live read reconcile the saved m
545
528
  A live read that returns no messages keeps the saved messages on screen: it means the computer
546
529
  lost its state, not that the conversation is empty. The first live read with messages reconciles them.
547
530
  Missing or rejected history falls back to the existing runtime path.
548
- An open reads the session log first (`GET …/log`), on every host, with no project flag:
531
+ An open reads the session log (`GET …/log`), on every host, with no project flag:
549
532
  `useSession`, `readSavedSessionCopy` (returned as `log`), `useSessionSync` with no `mirror` or
550
- with `savedChild`, and `loadSessionExportMessages`. No `GET …/transcript` is read then. The host
551
- applies a page it reads itself to the session store and renders `useSessionLogThread`.
552
- A new session with no stored log yet answers 404 with `code: 'session_log_missing'`: the open
553
- stays on the log and reads nothing more. Only when the log answers 404 with no `code` (an API
554
- older than the session log) does an open read the v1 saved window once: `GET …/transcript?shape=sync&history=true`.
555
- The session-open snapshot (`GET …/snapshot`) asks for no v1 window (`?transcript=0`).
556
- `readSavedSessionCopy` then returns it as `envelope`, and the SDK holds it for the open that
557
- follows (up to 5 min). The v1 reads (`getSessionTranscriptSync`, `transcriptSync`,
558
- `loadSessionTranscriptMirror`, …) are deprecated.
533
+ with `savedChild`, and `loadSessionExportMessages`. The host applies a page it reads itself to
534
+ the session store and renders `useSessionLogThread`. No hook and no SDK read sends
535
+ `GET …/transcript`, whatever the log answers. A new session's 404 with
536
+ `code: 'session_log_missing'` keeps the session on the log with nothing in it: the runtime's rows
537
+ are the history. A failed read (a 5xx, the network, a 404 with no `code`, an invalid page) keeps
538
+ the copy already on screen and reads the page again after 2 s, 10 s and 30 s, or after the API's
539
+ `Retry-After` (at most 60 s). Either is read again at the next turn end and after a stream
540
+ reconnect. Without a log in the store, `useSession().loadOlder` pages the runtime. An export
541
+ with no page reads the runtime, and fails when the runtime has nothing. The session-open
542
+ snapshot (`GET …/snapshot`) asks for no v1 window (`?transcript=0`). The v1 reads
543
+ (`getSessionTranscript`, `getSessionTranscriptSync`, `transcript`, `transcriptSync`) are
544
+ deprecated.
559
545
 
560
546
  `useSession().savedTranscript` says whether that saved conversation can show before the
561
547
  computer wakes: `loading` while a saved copy may still arrive, `shown` once messages are in
@@ -576,7 +562,7 @@ A server-rendered host can seed a known runtime session pin while `/start` runs:
576
562
 
577
563
  ```tsx
578
564
  useSession(projectId, sessionId, {
579
- initialRuntimeSessionId: persistedSession.runtime_session_id ?? persistedSession.opencode_session_id,
565
+ initialRuntimeSessionId: persistedSession.runtime_session_id,
580
566
  });
581
567
  ```
582
568
 
@@ -585,8 +571,7 @@ The seed hydrates cached content. It does not choose the runtime identity.
585
571
  The pin returned by `/start` always replaces a stale seed. The SDK also scopes
586
572
  runtime query and synchronization controllers to the sandbox runtime. Two
587
573
  sandboxes cannot share browser cache state when a snapshot exposes the same
588
- runtime session id during adoption. `opencode_session_id` is the older name
589
- of `runtime_session_id`; read it only as the fallback above.
574
+ runtime session id during adoption.
590
575
 
591
576
  After a project replaces its repository, a session created before the
592
577
  replacement still starts. It runs the project's CURRENT config release and
@@ -608,6 +593,43 @@ Message retries keep the originating sandbox URL after navigation. A `404` or
608
593
  `410` message read stops automatic retries and preserves the cached transcript.
609
594
  An explicit reconciliation can recover the controller when the session returns.
610
595
 
596
+ ## Artifact comments and activity
597
+
598
+ Projects enable `artifacts` and `artifact_comments` before using comments.
599
+ `artifact_comments` defaults off. Agent tokens need `project.artifact.comment`.
600
+ Every comment identifies its author as a user or a session.
601
+
602
+ ```ts
603
+ const artifact = kortix.project(projectId).artifacts;
604
+ const thread = await artifact.comments.create(artifactId, {
605
+ anchor: { type: 'none', version: entryVersion },
606
+ body: 'Confirm the forecast.',
607
+ });
608
+ await artifact.comments.reply(artifactId, thread.thread_id, { body: 'Confirmed.' });
609
+ await artifact.comments.setStatus(artifactId, thread.thread_id, 'resolved');
610
+ const threads = await artifact.comments.list(artifactId, { status: 'all' });
611
+ const activity = await artifact.activity(artifactId, { limit: 50 });
612
+ ```
613
+
614
+ Text anchors carry `version`, `quote`, `prefix`, and `suffix`. `quote`,
615
+ `prefix`, and `suffix` each accept up to 32 UTF-16 code units. Point and region anchors carry a CSS selector,
616
+ element-relative fractions, viewport width, and scroll position.
617
+
618
+ The root exports `listArtifactComments`, `createArtifactComment`,
619
+ `replyArtifactComment`, `setArtifactCommentStatus`, `editArtifactComment`,
620
+ `deleteArtifactComment`, and `listArtifactActivity`. The write functions return
621
+ the thread or comment. `getArtifactCommentThread(projectId, threadId)` resolves
622
+ a bare thread id with the same visibility checks. Activity returns
623
+ `{ items, next_cursor, older_versions }`; pass `next_cursor` as `cursor` to
624
+ read the next page. Unknown historical save authors remain `System`.
625
+
626
+ `useArtifactComments(projectId, artifactId, { status?, enabled? })` returns the
627
+ thread query and `create`, `reply`, `setStatus`, `edit`, and `remove` writes.
628
+ Each successful write refetches mounted Comments and Activity queries.
629
+ `useArtifactActivity(projectId, artifactId, { limit?, cursor?, enabled? })`
630
+ returns one activity page. Both hooks poll every 10 seconds while mounted and
631
+ visible. A missing project or Artifact id disables reads.
632
+
611
633
  ## The facade surface
612
634
 
613
635
  `createKortix(config)` returns one client. The table below is illustrative, not
@@ -616,18 +638,18 @@ exhaustive — see `API-MAP.md` for the full per-domain surface:
616
638
  | namespace | what |
617
639
  |---|---|
618
640
  | `kortix.projects` | list · get · detail · create · provision · update · archive · llmCatalog · modelPicker · sandboxTemplates · sessions (+ more: `listForAccount`, `sandboxHealth`, `createSession`) |
619
- | `kortix.accounts` | list · get · create · members · invites · `secretResources.{list,create,rotate,delete,grant,revoke,setAccess}` · `tokens.{list,create,revoke}` (account-scoped CLI PATs, `kortix_pat_…`) · `audit.{log,export,activity,webhooks.*}` (filterable project/session reconstruction log; `activity` = who was active and how often, per UTC day) · `branding.{get,update,uploadAsset,removeAsset,reset}` (Enterprise organization branding: logo / icon / favicon, light + dark, product name) (+ more: `updateName`, `leave`, `invite`, `removeMember`, `updateMemberRole`) |
641
+ | `kortix.accounts` | list · get · create · members · invites · `secretResources.{list,create,rotate,retry,remove,grant,revoke,setAccess}` · `tokens.{list,create,revoke}` (account-scoped CLI PATs, `kortix_pat_…`) · `audit.{log,export,activity,webhooks.*}` (filterable project/session reconstruction log; `activity` = who was active and how often, per UTC day) · `branding.{get,update,uploadAsset,removeAsset,reset}` (Enterprise organization branding: logo / icon / favicon, light + dark, product name) (+ more: `updateName`, `leave`, `invite`, `removeMember`, `updateMemberRole`) |
620
642
  | `kortix.billing` | entitlement/usage reads: `accountState` · `accountStateMinimal` · `transactions` · `transactionsSummary` · `creditBreakdown` · `usageHistory` · `usageRollup` · `sessionCosts.{list,get}` · `tierConfigurations` (with `min_monthly_usd` / `max_monthly_usd`) — plus a curated mutation surface: `setPlan` (subscribe to or change the credits plan; `useSetBillingPlan()` in `@kortix/sdk/react`) · `subscription.{createPortalSession,cancel,reactivate}` · `credits.{purchase,autoTopupSettings,configureAutoTopup}`. `checkout.{createSession,confirmSession}`, `subscription.{scheduleDowngrade,cancelScheduledChange,prorationPreview}`, `createPerSeatCheckout` and `claimPerSeatBilling` are deprecated: they reject with `ENDPOINT_RETIRED` |
621
- | `kortix.marketplace` | public marketplace catalog browse + sources (not project-scoped): `items` · `item` · `itemFile` · `marketplaces` · `featured` · `sources.{list,add,remove}` — distinct from the install-scoped `project(id).marketplace` |
643
+ | `kortix.marketplace` | public marketplace catalog browse + sources (not project-scoped): `items` · `item` · `itemFile` · `marketplaces` · `featured` · `sources.{list,add,remove}`. A project installs an item through `createMarketplaceInstallSession(projectId, itemId)`, which starts a session whose agent merges the item into the project and opens a change request; it resolves `{ session_id }` |
622
644
  | `kortix.github` | account-scoped GitHub App installs and repo linking: `getInstallation` · `listInstallations` · `listLinkableInstallations` (each entry carries `linked_to_other_accounts`, a count and never a tenant name) · `listRepositories` · `listRepositoryBranches` · `linkInstallation` · `saveInstallation` · `deleteInstallation` · `linkRepository` (`source: 'managed'` imports a repository the instance backend holds — self-host operator only, and mutually exclusive with `installation_id`) · `replaceProjectRepository` (changes an existing project's repository with an expected old URL; accepts a repository-scoped PAT or a temporary GitHub user proof for a repository-scoped App grant; can atomically copy selected shared runtime secrets from another project in the same account) |
623
645
  | `kortix.gitBackend` | the instance git backend ("Kortix managed", one per deployment, never an account connection): `get()` → `{configured, kind: 'app'|'pat'|null, owner}` (any authenticated user) · `repositories({search?, limit?})` (self-host operator only; 403 otherwise) |
624
- | `kortix.notifications` | the caller's notifications, across accounts: `list({ limit?, before? })` (inbox page + `unread_count`) · `markRead({ ids } \| { all: true } \| { sessionId })` · `preferences` · `updatePreferences({ kinds })` (push and email per kind) · `webPushPublicKey` · `registerWebPushSubscription` · `unregisterWebPushSubscription` · `registerDeviceToken` · `unregisterDeviceToken` (native Expo push) · `releaseDeviceToken(token, { backendUrl?, signal? })` (**no token needed**: a signed-out app removes its device token from a backend, `POST /v1/notifications/device-token/release`; resolves `{ ok: true }`, a non-2xx answer throws `ApiError` with `status`). Muting one session is `session(pid, sid).setWatch(false)`. Hooks: `useNotificationInbox`, `useNotificationPreferences`, `useSessionWatch`. Inbox rows, Web Push, email, and session watch are served only for projects with the `notification_center` flag on, off by default; with it off, the session creator's phone still gets the push |
646
+ | `kortix.notifications` | native push for a person's devices: `registerDeviceToken` · `unregisterDeviceToken` (Expo push tokens) · `releaseDeviceToken(token, { backendUrl?, signal? })` (**no token needed**: a signed-out app removes its device token from a backend, `POST /v1/notifications/device-token/release`; resolves `{ ok: true }`, a non-2xx answer throws `ApiError` with `status`). A session push reaches the phone of the person who created the session |
625
647
  | `kortix.mobileClientPolicy()` | the operator's mobile release policy, `GET /v1/clients/mobile`, **no token needed** (read before login): resolves `{ minimum_version, store_url_ios, store_url_android }`, each a string or `null`; a non-200 answer throws `ApiError`. A mobile host compares its app version to `minimum_version` with `compareSemver(a, b)` (`-1 \| 0 \| 1`, or `null` when either side does not parse; ignores a leading `v` and `-pre`/`+build` suffixes) and fails open on `null`. Also exported standalone as `getMobileClientPolicy` and the `MobileClientPolicy` type. The operator sets `MOBILE_MIN_VERSION`, `MOBILE_STORE_URL_IOS`, `MOBILE_STORE_URL_ANDROID` on the API |
626
648
  | `kortix.validateToken()` | pasted-API-key validation helper — `GET /accounts/me`, never throws, resolves `{valid, identity?, error?}` |
627
649
  | `kortix.connectors` | Connector data plane for an agent-minted session token: `catalog` · `tools` · `search` · `describe` · `call` (`{ account }`) · `accounts` · `uploadAttachment` |
628
- | `kortix.project(id)` | id-bound handle: `.apps` (stable App URLs, access, artifacts, deployments, logs, rollback, start/stop, machines (`machines.list/start/stop/restart/destroy`, `scale`, `exec`), volumes (`volumes.list/create/update/destroy/snapshots/snapshot/restore/fork`), and `token`) · `.secrets` · `.access` · `.connectors` (data plane + configuration + Connections) · `.policies` · `.triggers` (cron / webhook / monitor / event; `.eventTypes({ connector })` lists a connector's app events; `.fire(slug, { payload, dryRun })`; run history `.runs(slug)` / `.projectRuns({ status })`; `.replay(slug, runId)`) · `.files` · `.git` · `.changeRequests` (incl. `requestChanges`) · `.sessions` · `.tokens` (project-scoped CLI PATs — the `KORTIX_TOKEN` shape) · `.marketplace` / `.registry` (install/update/remove catalog items) · `.setupLinks.{requestSecret,requestConnector}` (agent-minted secret-entry / connector links) · `.validateManifest` · `.gitToken` · `.setDefaultAgent(name)` · `.session(sid)` (+ more namespaces: `.review`, `.approvals`, `.gateway` (incl. `.routing` and `.playground`), `.channels`, `.modelDefaults`, `.sandbox`) |
629
- | `kortix.session(pid, sid)` | id-bound handle: lifecycle (`get`/`update`/`delete`/`restore`/`start`/`restart`/`stop`/`reloadConfig`/`reloadConfigStream`/`setSharing`/`participants`/`watch`/`setWatch`/`presence`/`previews`/`commit`/`publicShares`/`ensureReady`) · `providerSecretPool.{list,get,set}` · finalized `cost()` · `send`/`abort`/`rewind`/`restoreRewind`/`setModel`/`setAgent` · `transcript()` · `.files` · runtime URL helpers (`health`/`previewUrl`/`proxyUrl`) · runtime REST escape hatches: `stream()` and the deprecated `.runtime` |
630
- | `kortix.runtime()` | the runtime REST client for the active sandbox (the SDK's own `RuntimeClient`, frozen at the `@opencode-ai/sdk` 1.18.23 route shapes); use a session-scoped handle in multi-tenant code |
650
+ | `kortix.project(id)` | id-bound handle: `.apps` (stable App URLs, access, artifacts, deployments, logs, rollback, start/stop, machines (`machines.list/start/stop/restart/destroy`, `scale`, `exec`), volumes (`volumes.list/create/update/destroy/snapshots/snapshot/restore/fork`), and `token`) · `.secrets` · `.access` · `.connectors` (data plane + configuration + Connections) · `.policies` · `.triggers` (cron / webhook / app; `.fire(slug, { payload, dryRun })`; run history `.runs(slug)` / `.projectRuns({ status })`; `.replay(slug, runId)`) · `.files` · `.git` · `.changeRequests` (incl. `requestChanges`) · `.sessions` · `.tokens` (project-scoped CLI PATs — the `KORTIX_TOKEN` shape) · `.setupLinks.{requestSecret,requestConnector}` (agent-minted secret-entry / connector links) · `.validateManifest` · `.gitToken` · `.setDefaultAgent(name)` · `.session(sid)` (+ more namespaces: `.skills`, `.review`, `.approvals`, `.gateway` (incl. `.routing` and `.playground`), `.channels`, `.modelDefaults`, `.sandbox`) |
651
+ | `kortix.session(pid, sid)` | id-bound handle: lifecycle (`get`/`update`/`delete`/`restore`/`start`/`restart`/`stop`/`reloadConfig`/`reloadConfigStream`/`setSharing`/`participants`/`setPinned`/`setArchived`/`presence`/`previews`/`commit`/`publicShares`/`ensureReady`) · finalized `cost()` · `send`/`abort`/`rewind`/`restoreRewind` (needs `session.rewind`)/`setModel`/`setAgent` · `transcript()` · `.files` · runtime URL helpers (`health`/`previewUrl`/`proxyUrl`) · the session verbs (`messages`/`pending`/`answerPermission`/`answerQuestion`/`compact`) · `stream()` · the deprecated `.runtime` |
652
+ | `kortix.runtime()` | the runtime REST compatibility client of the process-wide active sandbox. It throws on a scoped client. Use the session verbs on `kortix.session(pid, sid)` instead |
631
653
 
632
654
  Runnable, self-contained scripts for the highest-value flows live in
633
655
  [`examples/`](./examples): list projects with a PAT, send + stream, the
@@ -723,7 +745,7 @@ handle.close();
723
745
 
724
746
  `session.stream()` emits the runtime's events (`message.updated`,
725
747
  `message.part.updated`, `session.status`, `permission.*`, `question.*`, …),
726
- the same from OpenCode and pi. Use `useSession()` in React.
748
+ the same for every session. Use `useSession()` in React.
727
749
 
728
750
  Events arrive in batches, 16 ms apart. Consecutive `message.part.delta` events
729
751
  for one part field in a batch arrive as one event: `properties.delta` is their
@@ -745,34 +767,34 @@ and the constants `SESSION_LOG_SCHEMA`, `SESSION_LOG_MINOR` and
745
767
  `zod` dependency. The validators (`SessionLogSchema` and the rest) stay in the
746
768
  private `@kortix/api-contract` package. The types are a copy of the api-contract
747
769
  session-log types, and a test fails when the two differ. See the
748
- [reference](https://kortix.com/docs/sdk/reference#session-log-types).
770
+ [reference](https://kortix.com/docs/#session-log-types).
749
771
 
750
772
  `@kortix/sdk/react` adds `useSessionLog(session)` and
751
773
  `useSessionLogThread(session, threadId?, { throttleMs? })`: the log of a session `useSession`
752
774
  owns. `useSessionLog` marks its source: `'v2'` is the API's log, which every open reads
753
- first when the API holds a log for the session (OpenCode or pi). No project flag is read.
754
- A session whose log answers 404 with no `code` (an API older than the log) reads v1, and the hooks return `source: 'v1'`: the `fromV1`
755
- conversion of the v1 rows, with the turn that runs kept open. Pass the session's
775
+ first when the API holds a log for the session. No project flag is read.
776
+ Until a session's log answers a page, the hooks return `source: 'v1'`: the `fromV1`
777
+ conversion of the runtime's v1 rows, with the turn that runs kept open. Pass the session's
756
778
  `runtimeSessionId`; without it, or before the first row, they return `null`.
757
779
  `throttleMs` paces the v1 rows as `useSessionMessages` paces them. The
758
780
  v1 hooks (`useSessionMessages`, `useSession().messages`) return the same rows
759
781
  either way. `useSessionLogOlder(session, threadId?)` pages one thread of a v2 session back
760
782
  (`GET …/log?thread=&before_seq=`). See the
761
- [reference](https://kortix.com/docs/sdk/react#read-the-session-log).
783
+ [reference](https://kortix.com/docs/#render-blocks-from-the-session-log).
762
784
 
763
785
  Three transitional functions bridge a host that renders blocks while its rows are
764
786
  still v1:
765
787
 
766
788
  - `toolCallBlock(part)`: the `ToolCallBlock` of a v1 tool part, the block
767
- `fromV1` builds for it. An open call stays open; a call that streams its input
789
+ the v1 conversion builds for it. An open call stays open; a call that streams its input
768
790
  has the text so far as its `input`. One block per part object. It goes away in
769
791
  the SDK major that removes the v1 rows.
770
792
  - `toolCallMetadata(call)`: the harness's display metadata of a tool call, the
771
793
  whole `state.metadata` of the v1 part it came from (bash `command`, read
772
- `loaded`, task `sessionId`, edit `filediff`); for a record a harness wrote
773
- natively (pi), its `details`. It stays until the session-log schema carries
794
+ `loaded`, task `sessionId`, edit `filediff`); for a record pi wrote
795
+ natively, its `details`. It stays until the session-log schema carries
774
796
  display metadata of its own.
775
- - `sessionLogOfV1Rows(sessionId, runtimeSessionId, rows)`: the `fromV1` live view
797
+ - `sessionLogOfV1Rows(sessionId, runtimeSessionId, rows)`: the v1 live view
776
798
  of one runtime session's v1 rows, the log `useSessionLogThread` returns on v1,
777
799
  for rows a host reads without a `useSession` (a sub-agent's chat). One message
778
800
  per row object, kept while the row is unchanged. It goes away with the v1 rows.
@@ -781,6 +803,24 @@ A host draws a `ToolCallBlock` with `toolCallStatus(call)` (`completed`, not
781
803
  `complete`), `toolCallRawOutput(call)`, `toolCallError(call)` (the semantic error,
782
804
  else the result text) and, for a sub-agent row, `subAgentCalls(thread)`.
783
805
 
806
+ An `image_gen` card reads `imageGenView(call, live?)`: an `ImageGenView` with
807
+ `phase` (`ImageGenPhase`: `generating`, `ready`, `failed`, `stopped`), `action`,
808
+ `prompts`, `aspectRatio` (the requested ratio, fixed across phases), `startedAt`, `model`, `provider`, `error` (`message`, `suggestion?`,
809
+ `code?`, `retryAfterSeconds?`, `connectModel`) and `images`: one frame per image
810
+ (`prompt`, `phase`, `aspectRatio`, `imagePath`, `directUrl`, `error`), one to four
811
+ per call.
812
+ `imageGenRetryDelay(seconds)` and `formatImageGenElapsed(ms)` format its retry wait
813
+ and elapsed time. `imagePathsShownByImageGen(blocks)`,
814
+ `withoutImageGenDuplicates(items, paths, digests?)` and `showDrawnByImageGen(call, paths, digests?)` keep
815
+ a `show` from drawing an image the turn's `image_gen` card already drew, by path or by
816
+ the bytes' sha256 (`imageDigestsShownByImageGen(blocks)`, a frame's `sha256?`,
817
+ `showItemDigest(call, path)` for a `show` output). Consecutive `image_gen` cards of a turn
818
+ draw as one grid: `sessionLogImageGenRuns(segments, drawn)` finds the runs and
819
+ `imageGenGrid(views)` lays out their tiles and rows. `createImageCache(options)` is a
820
+ framework-free store of loaded images by path and sha256, for a host that shares one
821
+ loaded image across surfaces. See the
822
+ [reference](https://kortix.com/docs/sdk/reference#the-image_gen-card).
823
+
784
824
  `getSessionLogPage(projectId, sessionId, query?)`, or `kortix.session(p, s).log(query?)`,
785
825
  reads one page of the stored session log (`SessionLogPage`: the session record,
786
826
  every thread head, a thread's newest messages by `seq`, `has_more`). `query` is
@@ -813,7 +853,8 @@ transcript renders a thread from. It replaces the v1 turn helpers over
813
853
  out every message with `in_context: false` that is not streaming.
814
854
  - `sessionLogTurnSegments(blocks, options?)`, `splitSessionLogTurnWork(segments, { working })`
815
855
  and `sessionLogBurstSteps(blocks)` draw a turn: bursts, text and standalone calls,
816
- the settled-turn fold, and the rows of a burst.
856
+ the settled-turn fold, and the rows of a burst. The deliverables (`show`, `show_user`,
857
+ `image_gen`: `NO_GROUP_ACTIVITY_TOOLS`) stand alone and are hoisted above the final text.
817
858
  - `sessionLogCallStatus(call, live)` is the status a call renders with: an open call,
818
859
  or one the closure rule closed, is `running` or `pending` on a live turn and
819
860
  `interrupted` on any other. `sessionLogOpenCall(call)` is the call in that open
@@ -919,16 +960,16 @@ on `forwardKortixRequest` — see its README.
919
960
  ## Rendering chat (the headless chat kit)
920
961
 
921
962
  For the Kortix chat itself, use `SessionThread` from `@kortix/ui/session` (the
922
- Kortix component package, not on npm yet): one component renders the whole
963
+ Kortix component package): one component renders the whole
923
964
  session from one `useSession(projectId, sessionId)` result, the same thread
924
965
  apps/web renders. `ToolRegistry.register(name, Row)` replaces one tool row. Docs:
925
- <https://kortix.com/docs/sdk/ui#the-thread-alone>. The kit below is for a host that
966
+ <https://kortix.com/docs/#the-thread-alone>. The kit below is for a host that
926
967
  draws every part with its own components.
927
968
 
928
969
  Everything needed to render an agent transcript without adopting any Kortix
929
970
  UI: `classifyPart`/`classifyTurn` (framework-free, from the root entry)
930
971
  normalize all twelve part types of the Kortix transcript format
931
- (`kortix.transcript.v1`; both harnesses emit it) (text, reasoning, tool, file,
972
+ (`kortix.transcript.v1`, the same for every session) (text, reasoning, tool, file,
932
973
  subtask, patch, snapshot, agent, retry, compaction, step, + a forward-compat
933
974
  `unknown`) into a typed `ClassifiedPart`, and normalize a failed assistant
934
975
  turn's `info.error` into a `{ name, message }` `TurnError` — so "assistant
@@ -1068,23 +1109,29 @@ provider, resolved model, HTTP status, code, and bounded message.
1068
1109
 
1069
1110
  ## Entry points
1070
1111
 
1071
- **There are four, plus one internal.** Everything framework-free lives at the
1072
- root. `react` and `server` exist because each carries a dependency the root
1073
- cannot; `wire-message-id` exists so a server can load one module, not the barrel.
1074
- That is the whole map — learn it once.
1112
+ **There are nine stable entries, plus one internal.** Everything framework-free
1113
+ lives at the root. `react`, `server` and the three `genui` entries exist because
1114
+ each carries a dependency the root cannot. `wire-message-id` and
1115
+ `capture-rules` exist so a server can load one module, not the barrel.
1116
+ `workspace-search` is isolated from the root on purpose. That is the whole map —
1117
+ learn it once.
1075
1118
 
1076
1119
  | import | when you use it | why it is separate |
1077
1120
  | --- | --- | --- |
1078
1121
  | `@kortix/sdk` | **almost always.** `createKortix`, `configureKortix`, the REST surface, `files`, session URLs + health (`runtimeSupports` reads a runtime's `capabilities`), `classifyPart`/`classifyTurn`/`toolViewModel`/`toToolView`/`toolKind`, `openEventStream`, `narrowChatEvent`, the message queue, the error classes, and every domain type | — |
1079
- | `@kortix/sdk/react` | hooks and providers: `useSession`, every `useRuntime*` (each pre-W4 `useOpenCode*` name is a deprecated alias), `useChatTurns`/`renderParts`, the domain hooks | `react` is an **optional peer dependency**. Putting these at the root would force React on a CLI, a worker, or a React Native host |
1122
+ | `@kortix/sdk/react` | hooks and providers: `useSession`, every `useRuntime*` hook, `useChatTurns`/`renderParts`, the domain hooks. Its deprecated aliases are listed in the [SDK reference](https://kortix.com/docs/#deprecated-names) | `react` is an **optional peer dependency**. Putting these at the root would force React on a CLI, a worker, or a React Native host |
1080
1123
  | `@kortix/sdk/server` | `runWithKortix`, `createScopedKortix`, `getScopedConfig` — per-request config isolation in a Node/Bun backend | imports `node:async_hooks`. Never let it into a browser bundle |
1081
- | `@kortix/sdk/wire-message-id` | `mintWireMessageId`, `mintWireMessageIdAbove`, `newestWireIdClock`, `wireIdClock`, `wireIdClockDelta`, `maxWireIdClock`, `isWireIdAheadOf` — the OpenCode wire message-id clock | not a dependency split: the root exports the same names. A server that mints ids loads this one import-free module instead of the whole barrel |
1124
+ | `@kortix/sdk/genui/fence`, `@kortix/sdk/genui`, `@kortix/sdk/genui/react` | Generative UI: split `openui` blocks out of text, parse them, render them (see **Generative UI** below) | `genui` and `genui/react` need the optional peers `zod` and `@openuidev/lang-core`; `genui/fence` loads neither |
1125
+ | `@kortix/sdk/wire-message-id` | `mintWireMessageId` and `WIRE_MESSAGE_ID`: mint and validate a Kortix message id. Its clock helpers are `@deprecated` | not a dependency split: the root exports the same names. A server that mints ids loads this one import-free module instead of the whole barrel |
1126
+ | `@kortix/sdk/workspace-search` | `createWorkspaceSearchClient` and its ranking helpers | isolated from the root on purpose |
1127
+ | `@kortix/sdk/capture-rules` | the Kortix Capture constants (`CAPTURE_LAYERS`, `CAPTURE_DEVICE_DEFAULTS`, …) | the root exports the same names; this module loads alone |
1082
1128
  | `@kortix/sdk/internal/*` | nothing, in host code | apps/web's zustand stores. Browser-only, **outside semver**, and not on the `window.Kortix` global. Implementation detail that is regrettably visible |
1083
1129
 
1084
1130
  The root really is canonical, and that is a test rather than a promise:
1085
1131
  `src/root-canonical.test.ts` asserts that every name exported by every other
1086
- isomorphic subpath is also exported from `@kortix/sdk`. The only names it
1087
- permits to be missing are the browser-only stores above — `zustand` is a
1132
+ isomorphic subpath is also exported from `@kortix/sdk`. The only subpaths it
1133
+ permits to be missing are `react`, `server`, the three `genui` entries,
1134
+ `workspace-search` and the browser-only stores above — `zustand` is a
1088
1135
  forbidden import in the root's `isomorphic-core` tier, so they cannot live
1089
1136
  there.
1090
1137
 
@@ -1095,14 +1142,14 @@ import { useSession } from '@kortix/sdk/react';
1095
1142
 
1096
1143
  ### Legacy aliases — do not use in new code
1097
1144
 
1098
- `package.json` still declares about twenty more subpaths: `/turns`, `/files`,
1099
- `/session`, `/session/url`, `/auth`, `/config`, `/api-client`,
1100
- `/projects-client`, `/platform-client`, `/opencode-client`, `/opencode-errors`,
1101
- `/event-stream`, `/feature-flags`, `/fresh-sessions`, `/instance-routes`,
1102
- `/message-queue`, and the un-prefixed store aliases.
1145
+ `package.json` still declares 21 more subpaths, for example `/turns`, `/files`,
1146
+ `/session`, `/projects-client`, `/event-stream` and the un-prefixed store
1147
+ aliases. The full list is in the
1148
+ [SDK reference](https://kortix.com/docs/#deprecated-names).
1103
1149
 
1104
- Every one of them is a one-line `export *` re-export under `src/deprecated/`,
1105
- kept alive only so an existing `npm install` does not break. **They add nothing
1150
+ Twenty of them are one-line `export *` re-exports under `src/deprecated/`, and
1151
+ `/message-queue` is a deprecated module of its own. They stay only so an
1152
+ existing `npm install` does not break. **They add nothing
1106
1153
  the root does not already export.** They are removed at the next major; new
1107
1154
  code imports the root.
1108
1155
 
@@ -1118,6 +1165,8 @@ interface KortixPlatformConfig {
1118
1165
  clientSource?: 'api' | 'cli' | 'mobile' | 'tui' | 'web';
1119
1166
  clientVersion?: string; // '<surface>/<version>', sent as X-Kortix-Client-Version
1120
1167
  credentialHeader?: string; // send the raw token in this header instead of Authorization
1168
+ fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>; // default: global fetch
1169
+ eventStreamTransport?: RuntimeEventTransport; // event-stream bytes when `fetch` cannot stream (React Native)
1121
1170
  getUserId?: () => Promise<string | null>;
1122
1171
  billingEnabled?: boolean;
1123
1172
  sandboxId?: string | null;
@@ -1200,7 +1249,6 @@ Its only platform code for the session runtime is the event transport
1200
1249
  - **No harness SDK in host code.** Import transcript and runtime types from
1201
1250
  `@kortix/sdk`, and reach the runtime through the session verbs. `session.runtime`
1202
1251
  (the raw REST compatibility client) is deprecated.
1203
- (Holds today — no host imports `@opencode-ai/sdk`, and neither does the SDK.)
1204
1252
  - **No raw `backendApi` / `authenticatedFetch` in host code.** Use the facade or a
1205
1253
  subpath module. (Aspirational: apps/web still calls `backendApi` via its
1206
1254
  `@/lib/api-client` re-export in ~30 files and keeps a parallel
@@ -1214,7 +1262,7 @@ Its only platform code for the session runtime is the event transport
1214
1262
  (`kortix_pat_…`) for server-side / automation use, or an OAuth access token
1215
1263
  (`kortix_oat_…`) minted by "Sign in with Kortix" — supplied via `getToken`.
1216
1264
 
1217
- To use Kortix from an MCP client (Claude, ChatGPT, Cursor, Codex) instead of code, see the hosted MCP server: <https://kortix.com/docs/connect/mcp>.
1265
+ To use Kortix from an MCP client (Claude, ChatGPT, Cursor, Codex) instead of code, see the hosted MCP server: <https://kortix.com/docs/#connectors>.
1218
1266
 
1219
1267
  ### Sign in with Kortix (your app, their Kortix account)
1220
1268
 
@@ -1244,7 +1292,7 @@ const client = createKortix(auth.clientConfig()); // talks to Kortix through /p
1244
1292
  ```
1245
1293
 
1246
1294
  `@kortix/sdk/react` adds `useKortixViewer()` and `<SignInWithKortix />`.
1247
- Full guide: `/docs/sdk/auth#sign-in-with-kortix`. Example: `examples/11-sign-in-with-kortix.ts`.
1295
+ Full guide: <https://kortix.com/docs/#sign-in-with-kortix>. Example: `examples/11-sign-in-with-kortix.ts`.
1248
1296
 
1249
1297
  ### A Kortix-hosted App is already signed in
1250
1298
 
@@ -1262,7 +1310,7 @@ the API refused (after an access-policy change) and replays the call once.
1262
1310
  In the browser, `backendUrl` is `/_kortix/api/v1`: the gate on the App's own
1263
1311
  origin forwards to the Kortix API as the viewer (`viewer_token_scope: 'api'`).
1264
1312
  A direct call to `https://api.kortix.com/v1` from an App origin fails CORS.
1265
- Guide: `/docs/apps#build-on-apps-from-typescript`.
1313
+ Guide: <https://kortix.com/docs/#build-on-apps-from-typescript>.
1266
1314
 
1267
1315
  ### One member on every runtime: sign-in tokens, groups, roles
1268
1316
 
@@ -1289,7 +1337,7 @@ header, sign-in token) into one `KortixMember`: `userId`, `email`, `name`,
1289
1337
  `forbidden`). In React, read the member with a `members:me` query (`readKortixMember(await ctx.auth.getUserIdentity())` in `convex/members.ts`, then `useQuery(api.members.me)`: `undefined` loading, `null` signed out). Never call `useConvexAuth()`: it throws under a plain `ConvexProvider`. Kortix injects `KORTIX_AUTH_ISSUER`, `KORTIX_AUTH_AUDIENCE` (the App's own id) and `KORTIX_AUTH_JWKS` into every server App, so do not set `KORTIX_AUTH_*` in its `env`. `verifyKortixToken` takes the key set inline or as an https URL
1290
1338
  (`auth.jwks_uri`), and refuses every token when no audience is set (option or
1291
1339
  `KORTIX_AUTH_AUDIENCE`): one project key signs every App's tokens, so `aud` is
1292
- the only thing that keeps another App's token out. `audience: false` opts out. WebCrypto only; no dependency. Guide: `/docs/apps#build-on-apps-from-typescript`.
1340
+ the only thing that keeps another App's token out. `audience: false` opts out. WebCrypto only; no dependency. Guide: <https://kortix.com/docs/#build-on-apps-from-typescript>.
1293
1341
 
1294
1342
  ### Headless sign-in (your users, straight through the API)
1295
1343
 
@@ -1302,25 +1350,26 @@ const asUser = createKortix({ backendUrl, getToken: session.getToken });
1302
1350
 
1303
1351
  Also `signUp`, `sendMagicLink` + `verifyOtp`, `signInWithProvider` +
1304
1352
  `exchangeCode` (PKCE), `resetPassword`, `updatePassword`, `user`, `signOut` —
1305
- all `/v1/auth/*`, no Supabase in the client. Guide: `/docs/sdk/auth`.
1353
+ all `/v1/auth/*`, no Supabase in the client. Guide: <https://kortix.com/docs/#sdk-authentication>.
1306
1354
 
1307
1355
  ## Tests
1308
1356
 
1309
1357
  ```sh
1310
1358
  pnpm --filter @kortix/sdk typecheck # package + examples/ (examples/tsconfig.json)
1311
- pnpm --filter @kortix/sdk test # facade, files, react hooks, turns, transcript, session url/health, projects-client domains
1359
+ pnpm --filter @kortix/sdk test src/root-canonical.test.ts # one test file
1360
+ pnpm --filter @kortix/sdk test # the whole suite (on macOS it exits 2 unless KORTIX_FULL_TEST=1)
1312
1361
  ```
1313
1362
 
1314
- See **`API-MAP.md`** for the complete endpoint catalogue. It covers the Kortix
1315
- REST API and the session runtime's REST routes. See **`CHANGELOG.md`** for
1316
- per-release changes.
1363
+ See **`API-MAP.md`** for the endpoint catalogue. It covers the Kortix REST API
1364
+ and the session runtime that the session handle wraps. See **`CHANGELOG.md`**
1365
+ for per-release changes.
1317
1366
 
1318
1367
 
1319
1368
  ### Agent repository access
1320
1369
 
1321
1370
  Agent configuration accepts `repository_access?: boolean`.
1322
1371
  The API stores it in `kortix.yaml` as `agents.<name>.workspace.project_repository` and always writes the value.
1323
- An omitted value defaults to `true` on `kortix_version` 1 and 2, and to `false` on 3. `GET` returns the resolved value.
1372
+ On a `kortix_version: 3` project an omitted value is `false`. `GET` returns the resolved value.
1324
1373
  Set `false` to run new sessions without the project repository or repository API access.
1325
1374
  Git, secret, connector, and tool permissions remain separate. Existing sessions retain their saved policy.
1326
1375
  `AgentConfigBlock.workspace` is deprecated. The SDK maps legacy `branch`/`runtime` to the boolean field.
@@ -1358,33 +1407,10 @@ await kortix.project(projectId).setCustomLlmProvider('my-llm', {
1358
1407
  await kortix.project(projectId).deleteCustomLlmProvider('my-llm');
1359
1408
  ```
1360
1409
 
1361
- The root entry exports the same calls as `listCustomLlmProviders`, `putCustomLlmProvider` and `deleteCustomLlmProvider`. A row with `configured: false` is a `CUSTOM_*_API_KEY` secret with no endpoint saved yet. A reserved id (a catalog provider, `kortix`, `codex`, `opencode`) returns `400 reserved_provider_id`.
1410
+ The root entry exports the same calls as `listCustomLlmProviders`, `putCustomLlmProvider` and `deleteCustomLlmProvider`. A row with `configured: false` is a `CUSTOM_*_API_KEY` secret with no endpoint saved yet. A reserved id (a catalog provider's id, `kortix`, `codex` or `auto`) returns `400 reserved_provider_id`.
1362
1411
 
1363
1412
  `useCustomLlmProviders(projectId)` from `@kortix/sdk/react` returns `{ providers, isLoading, error, save, remove, isSaving }`. `save` and `remove` refresh the list and both model-picker caches; `remove` also refreshes the secrets list.
1364
1413
 
1365
- ### Pooled ChatGPT connections
1366
-
1367
- With the `pooled_provider_secrets` project flag enabled, a
1368
- member can create a named ChatGPT OAuth account resource:
1369
-
1370
- ```ts
1371
- const challenge = await kortix.project(projectId).secrets.startProviderOAuth('openai', {
1372
- resourceLabel: 'My ChatGPT account',
1373
- });
1374
- // Show challenge.verification_url and challenge.user_code, then poll the flow.
1375
- const result = await kortix.project(projectId).secrets.pollProviderOAuth('openai', challenge.flow_id);
1376
- ```
1377
-
1378
- Poll until `result.status` is `success`, `failed`, or `expired`. A successful
1379
- named flow returns `credential.secret_id`. It creates a separate project-scoped
1380
- account resource; reconnecting does not replace another account. Every project
1381
- member can use it by default. The owner can restrict access to selected members.
1382
- A session can select one or more available
1383
- ChatGPT resources through its provider secret pool (`providerId: 'codex'`).
1384
- Without an explicit session selection, the caller's newest personal ChatGPT
1385
- resource is used. The legacy project login remains the fallback when that
1386
- caller has no personal resource.
1387
-
1388
1414
  ### ChatGPT subscription usage
1389
1415
 
1390
1416
  `getSessionCost` and `getTurnCost` report zero LLM cost for ChatGPT/Codex
@@ -1493,9 +1519,11 @@ Other freshness tiers keep their existing behavior.
1493
1519
 
1494
1520
  ## Generative UI (`@kortix/sdk/genui`)
1495
1521
 
1496
- When a project turns on the `genui` flag, the agent may answer with ` ```openui ` blocks:
1497
- cards, comparisons, charts, maps, tabs. Render them with the headless renderer and your own
1498
- components, or with the bundled defaults:
1522
+ Generative UI is on by default for every project (the `genui` project flag), and
1523
+ experimental. The agent may answer with ` ```openui ` blocks: cards, comparisons,
1524
+ charts, maps, tabs. Render them with the headless renderer and your own
1525
+ components, or with the bundled defaults
1526
+ ([guide](https://kortix.com/docs/#generative-ui)):
1499
1527
 
1500
1528
  ```tsx
1501
1529
  import { genuiVersionFromClassName } from '@kortix/sdk/genui';
@@ -1536,3 +1564,15 @@ sends one pseudonymous PostHog event at install time; set `OPENUI_TELEMETRY_DISA
1536
1564
  `kortix.project(projectId).files.write({ path, ref: branch, content, expected_revision: revision })`.
1537
1565
  The server requires `project.file.write` and returns `{ commit_sha }` after pushing.
1538
1566
  A changed file returns HTTP 409 instead of overwriting another edit. Reload before retrying.
1567
+
1568
+ ### Change request recovery
1569
+
1570
+ `recoverChangeRequest(projectId, target, blocker)` queues a follow-up on the
1571
+ visible origin session and returns its ID. It uses queue delivery, so a running
1572
+ turn is not interrupted. The origin prompt updates the existing change request
1573
+ and leaves application to the person. A visible archived origin creates a child;
1574
+ an unavailable origin creates a root with `metadata.origin_session_id`.
1575
+ `createProjectSession` accepts an optional `parent_session_id` for a visible
1576
+ same-project parent. This groups the new session without inheriting the parent's
1577
+ sharing or automation identity. A session-bound credential retains its own
1578
+ server-derived parent regardless of that field.