@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.
- package/README.md +172 -132
- package/dist/browser/session-sync/server-transcript-mirror.d.ts +4 -80
- package/dist/browser/session-sync/server-transcript-mirror.d.ts.map +1 -1
- package/dist/browser/session-sync/server-transcript-mirror.js +3 -128
- package/dist/browser/session-sync/server-transcript-mirror.js.map +1 -1
- package/dist/browser/session-sync/session-sync-registry.d.ts +6 -6
- package/dist/browser/session-sync/session-sync-registry.js +8 -8
- package/dist/browser/session-sync/session-sync-registry.js.map +1 -1
- package/dist/core/client/kortix.d.ts +140 -2
- package/dist/core/client/kortix.d.ts.map +1 -1
- package/dist/core/client/kortix.js +2 -0
- package/dist/core/client/kortix.js.map +1 -1
- package/dist/core/client/project-artifacts.d.ts +22 -0
- package/dist/core/client/project-artifacts.d.ts.map +1 -0
- package/dist/core/client/project-artifacts.js +18 -0
- package/dist/core/client/project-artifacts.js.map +1 -0
- package/dist/core/client/project-core.d.ts.map +1 -1
- package/dist/core/client/project-operations-admin.d.ts +52 -0
- package/dist/core/client/project-operations-admin.d.ts.map +1 -1
- package/dist/core/client/project-operations-review.d.ts +79 -0
- package/dist/core/client/project-operations-review.d.ts.map +1 -1
- package/dist/core/client/project-operations-review.js +79 -0
- package/dist/core/client/project-operations-review.js.map +1 -1
- package/dist/core/client/project-operations-workspace.d.ts +52 -0
- package/dist/core/client/project-operations-workspace.d.ts.map +1 -1
- package/dist/core/client/project-operations.d.ts +112 -4
- package/dist/core/client/project-operations.d.ts.map +1 -1
- package/dist/core/client/project-operations.js +22 -2
- package/dist/core/client/project-operations.js.map +1 -1
- package/dist/core/client/project-platform-security.d.ts +29 -0
- package/dist/core/client/project-platform-security.d.ts.map +1 -1
- package/dist/core/client/project-platform-security.js +27 -0
- package/dist/core/client/project-platform-security.js.map +1 -1
- package/dist/core/client/project-platform-settings.d.ts +2 -0
- package/dist/core/client/project-platform-settings.d.ts.map +1 -1
- package/dist/core/files/image-cache.d.ts +56 -0
- package/dist/core/files/image-cache.d.ts.map +1 -0
- package/dist/core/files/image-cache.js +130 -0
- package/dist/core/files/image-cache.js.map +1 -0
- package/dist/core/http/response-error.d.ts.map +1 -1
- package/dist/core/http/response-error.js +2 -0
- package/dist/core/http/response-error.js.map +1 -1
- package/dist/core/rest/platform-client/host-boundary.d.ts +21 -15
- package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
- package/dist/core/rest/platform-client/host-boundary.js +10 -4
- package/dist/core/rest/platform-client/host-boundary.js.map +1 -1
- package/dist/core/rest/projects-client/agent-config.d.ts +4 -0
- package/dist/core/rest/projects-client/agent-config.d.ts.map +1 -1
- package/dist/core/rest/projects-client/agent-config.js.map +1 -1
- package/dist/core/rest/projects-client/agent-scope.d.ts +8 -0
- package/dist/core/rest/projects-client/agent-scope.d.ts.map +1 -1
- package/dist/core/rest/projects-client/agent-scope.js.map +1 -1
- package/dist/core/rest/projects-client/apps.d.ts +1 -1
- package/dist/core/rest/projects-client/apps.d.ts.map +1 -1
- package/dist/core/rest/projects-client/artifacts.d.ts +289 -0
- package/dist/core/rest/projects-client/artifacts.d.ts.map +1 -0
- package/dist/core/rest/projects-client/artifacts.js +105 -0
- package/dist/core/rest/projects-client/artifacts.js.map +1 -0
- package/dist/core/rest/projects-client/change-request-recovery.d.ts +30 -0
- package/dist/core/rest/projects-client/change-request-recovery.d.ts.map +1 -0
- package/dist/core/rest/projects-client/change-request-recovery.js +121 -0
- package/dist/core/rest/projects-client/change-request-recovery.js.map +1 -0
- package/dist/core/rest/projects-client/change-requests.d.ts +5 -0
- package/dist/core/rest/projects-client/change-requests.d.ts.map +1 -1
- package/dist/core/rest/projects-client/change-requests.js.map +1 -1
- package/dist/core/rest/projects-client/channels.d.ts +212 -2
- package/dist/core/rest/projects-client/channels.d.ts.map +1 -1
- package/dist/core/rest/projects-client/channels.js +111 -8
- package/dist/core/rest/projects-client/channels.js.map +1 -1
- package/dist/core/rest/projects-client/chrome.d.ts +38 -0
- package/dist/core/rest/projects-client/chrome.d.ts.map +1 -0
- package/dist/core/rest/projects-client/chrome.js +21 -0
- package/dist/core/rest/projects-client/chrome.js.map +1 -0
- package/dist/core/rest/projects-client/connectors.d.ts +259 -7
- package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
- package/dist/core/rest/projects-client/connectors.js +84 -4
- package/dist/core/rest/projects-client/connectors.js.map +1 -1
- package/dist/core/rest/projects-client/gateway.d.ts +23 -0
- package/dist/core/rest/projects-client/gateway.d.ts.map +1 -1
- package/dist/core/rest/projects-client/gateway.js.map +1 -1
- package/dist/core/rest/projects-client/iam-actions.d.ts +5 -0
- package/dist/core/rest/projects-client/iam-actions.d.ts.map +1 -1
- package/dist/core/rest/projects-client/iam-actions.js +5 -0
- package/dist/core/rest/projects-client/iam-actions.js.map +1 -1
- package/dist/core/rest/projects-client/index.d.ts +6 -0
- package/dist/core/rest/projects-client/index.d.ts.map +1 -1
- package/dist/core/rest/projects-client/index.js +6 -0
- package/dist/core/rest/projects-client/index.js.map +1 -1
- package/dist/core/rest/projects-client/memory.d.ts +236 -0
- package/dist/core/rest/projects-client/memory.d.ts.map +1 -0
- package/dist/core/rest/projects-client/memory.js +92 -0
- package/dist/core/rest/projects-client/memory.js.map +1 -0
- package/dist/core/rest/projects-client/projects.d.ts +23 -6
- package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
- package/dist/core/rest/projects-client/projects.js +6 -4
- package/dist/core/rest/projects-client/projects.js.map +1 -1
- package/dist/core/rest/projects-client/review-items.d.ts.map +1 -1
- package/dist/core/rest/projects-client/review-items.js +40 -2
- package/dist/core/rest/projects-client/review-items.js.map +1 -1
- package/dist/core/rest/projects-client/session-groups.d.ts +48 -0
- package/dist/core/rest/projects-client/session-groups.d.ts.map +1 -0
- package/dist/core/rest/projects-client/session-groups.js +50 -0
- package/dist/core/rest/projects-client/session-groups.js.map +1 -0
- package/dist/core/rest/projects-client/sessions.d.ts +32 -0
- package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
- package/dist/core/rest/projects-client/sessions.js +10 -0
- package/dist/core/rest/projects-client/sessions.js.map +1 -1
- package/dist/core/rest/projects-client/setup-links.d.ts +5 -0
- package/dist/core/rest/projects-client/setup-links.d.ts.map +1 -1
- package/dist/core/rest/projects-client/setup-links.js.map +1 -1
- package/dist/core/rest/projects-client/spaces.d.ts +263 -0
- package/dist/core/rest/projects-client/spaces.d.ts.map +1 -0
- package/dist/core/rest/projects-client/spaces.js +165 -0
- package/dist/core/rest/projects-client/spaces.js.map +1 -0
- package/dist/core/rest/projects-client/triggers.d.ts +79 -32
- package/dist/core/rest/projects-client/triggers.d.ts.map +1 -1
- package/dist/core/rest/projects-client/triggers.js +1 -1
- package/dist/core/rest/projects-client/triggers.js.map +1 -1
- package/dist/core/session/open-bundle.d.ts +6 -36
- package/dist/core/session/open-bundle.d.ts.map +1 -1
- package/dist/core/session/open-bundle.js +3 -74
- package/dist/core/session/open-bundle.js.map +1 -1
- package/dist/core/session-log/source.d.ts +11 -3
- package/dist/core/session-log/source.d.ts.map +1 -1
- package/dist/core/session-log/source.js +26 -14
- package/dist/core/session-log/source.js.map +1 -1
- package/dist/core/session-log/turns/blocks.d.ts +2 -2
- package/dist/core/session-log/turns/blocks.d.ts.map +1 -1
- package/dist/core/session-log/turns/blocks.js +13 -5
- package/dist/core/session-log/turns/blocks.js.map +1 -1
- package/dist/core/session-log/turns/v1-parts.d.ts.map +1 -1
- package/dist/core/session-log/turns/v1-parts.js +18 -4
- package/dist/core/session-log/turns/v1-parts.js.map +1 -1
- package/dist/core/session-log/types.d.ts +13 -3
- package/dist/core/session-log/types.d.ts.map +1 -1
- package/dist/core/session-log/v1.d.ts +4 -1
- package/dist/core/session-log/v1.d.ts.map +1 -1
- package/dist/core/session-log/v1.js +2 -0
- package/dist/core/session-log/v1.js.map +1 -1
- package/dist/core/session-sync/saved-transcript.d.ts +12 -42
- package/dist/core/session-sync/saved-transcript.d.ts.map +1 -1
- package/dist/core/session-sync/saved-transcript.js +11 -74
- package/dist/core/session-sync/saved-transcript.js.map +1 -1
- package/dist/core/turns/parts.js +1 -1
- package/dist/core/turns/parts.js.map +1 -1
- package/dist/core/turns/safe-url.d.ts +3 -0
- package/dist/core/turns/safe-url.d.ts.map +1 -0
- package/dist/core/turns/safe-url.js +13 -0
- package/dist/core/turns/safe-url.js.map +1 -0
- package/dist/core/turns/segments/group-steps.d.ts.map +1 -1
- package/dist/core/turns/segments/group-steps.js +7 -6
- package/dist/core/turns/segments/group-steps.js.map +1 -1
- package/dist/core/turns/segments/narration.d.ts.map +1 -1
- package/dist/core/turns/segments/narration.js +35 -18
- package/dist/core/turns/segments/narration.js.map +1 -1
- package/dist/core/turns/segments/session-activity-groups.d.ts +14 -4
- package/dist/core/turns/segments/session-activity-groups.d.ts.map +1 -1
- package/dist/core/turns/segments/session-activity-groups.js +47 -7
- package/dist/core/turns/segments/session-activity-groups.js.map +1 -1
- package/dist/core/turns/segments/work-split.d.ts +1 -1
- package/dist/core/turns/segments/work-split.d.ts.map +1 -1
- package/dist/core/turns/segments/work-split.js +3 -6
- package/dist/core/turns/segments/work-split.js.map +1 -1
- package/dist/core/turns/tools/image-gen-view.d.ts +162 -0
- package/dist/core/turns/tools/image-gen-view.d.ts.map +1 -0
- package/dist/core/turns/tools/image-gen-view.js +402 -0
- package/dist/core/turns/tools/image-gen-view.js.map +1 -0
- package/dist/core/turns/tools/index.d.ts +2 -1
- package/dist/core/turns/tools/index.d.ts.map +1 -1
- package/dist/core/turns/tools/index.js +2 -1
- package/dist/core/turns/tools/index.js.map +1 -1
- package/dist/core/turns/tools/tool-meta.d.ts.map +1 -1
- package/dist/core/turns/tools/tool-meta.js +8 -0
- package/dist/core/turns/tools/tool-meta.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/kortix.esm.min.js +41 -39
- package/dist/kortix.global.js +41 -39
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +6 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/query-keys.d.ts +60 -1
- package/dist/react/query-keys.d.ts.map +1 -1
- package/dist/react/query-keys.js +64 -2
- package/dist/react/query-keys.js.map +1 -1
- package/dist/react/session-cache-write.d.ts +8 -0
- package/dist/react/session-cache-write.d.ts.map +1 -1
- package/dist/react/session-cache-write.js +50 -1
- package/dist/react/session-cache-write.js.map +1 -1
- package/dist/react/use-artifacts.d.ts +257 -0
- package/dist/react/use-artifacts.d.ts.map +1 -0
- package/dist/react/use-artifacts.js +197 -0
- package/dist/react/use-artifacts.js.map +1 -0
- package/dist/react/use-chrome-connections.d.ts +15 -0
- package/dist/react/use-chrome-connections.d.ts.map +1 -0
- package/dist/react/use-chrome-connections.js +42 -0
- package/dist/react/use-chrome-connections.js.map +1 -0
- package/dist/react/use-feature-flag.d.ts +1 -1
- package/dist/react/use-feature-flag.d.ts.map +1 -1
- package/dist/react/use-feature-flag.js +4 -1
- package/dist/react/use-feature-flag.js.map +1 -1
- package/dist/react/use-project-apps.d.ts.map +1 -1
- package/dist/react/use-project-apps.js +8 -5
- package/dist/react/use-project-apps.js.map +1 -1
- package/dist/react/use-project-memory.d.ts +41 -0
- package/dist/react/use-project-memory.d.ts.map +1 -0
- package/dist/react/use-project-memory.js +126 -0
- package/dist/react/use-project-memory.js.map +1 -0
- package/dist/react/use-project-sessions.d.ts +26 -7
- package/dist/react/use-project-sessions.d.ts.map +1 -1
- package/dist/react/use-project-sessions.js +57 -21
- package/dist/react/use-project-sessions.js.map +1 -1
- package/dist/react/use-project-spaces.d.ts +74 -0
- package/dist/react/use-project-spaces.d.ts.map +1 -0
- package/dist/react/use-project-spaces.js +196 -0
- package/dist/react/use-project-spaces.js.map +1 -0
- package/dist/react/use-session-groups.d.ts +41 -0
- package/dist/react/use-session-groups.d.ts.map +1 -0
- package/dist/react/use-session-groups.js +140 -0
- package/dist/react/use-session-groups.js.map +1 -0
- package/dist/react/use-session-log.d.ts +12 -7
- package/dist/react/use-session-log.d.ts.map +1 -1
- package/dist/react/use-session-log.js +49 -26
- package/dist/react/use-session-log.js.map +1 -1
- package/dist/react/use-session-sync.d.ts +9 -16
- package/dist/react/use-session-sync.d.ts.map +1 -1
- package/dist/react/use-session-sync.js +17 -120
- package/dist/react/use-session-sync.js.map +1 -1
- package/dist/react/use-session.d.ts.map +1 -1
- package/dist/react/use-session.js +16 -25
- package/dist/react/use-session.js.map +1 -1
- package/dist/workspace-search/client.d.ts.map +1 -1
- package/dist/workspace-search/client.js +4 -10
- package/dist/workspace-search/client.js.map +1 -1
- package/package.json +3 -3
- package/dist/browser/session-sync/mirror-paging.d.ts +0 -32
- package/dist/browser/session-sync/mirror-paging.d.ts.map +0 -1
- package/dist/browser/session-sync/mirror-paging.js +0 -36
- package/dist/browser/session-sync/mirror-paging.js.map +0 -1
- package/dist/react/use-session-transcript-history.d.ts +0 -11
- package/dist/react/use-session-transcript-history.d.ts.map +0 -1
- package/dist/react/use-session-transcript-history.js +0 -35
- 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
|
|
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:
|
|
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:
|
|
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
|
-
|
|
290
|
-
|
|
291
|
-
| Entry
|
|
292
|
-
|
|
|
293
|
-
| `@kortix/sdk/react`
|
|
294
|
-
| `@kortix/sdk/server`
|
|
295
|
-
| `@kortix/sdk/
|
|
296
|
-
| `@kortix/sdk/
|
|
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
|
|
306
|
-
the
|
|
307
|
-
list of aliases (
|
|
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); //
|
|
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`.
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
`session.
|
|
540
|
-
|
|
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
|
|
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`.
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
`
|
|
557
|
-
|
|
558
|
-
|
|
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
|
|
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.
|
|
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,
|
|
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}`
|
|
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` |
|
|
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 /
|
|
629
|
-
| `kortix.session(pid, sid)` | id-bound handle: lifecycle (`get`/`update`/`delete`/`restore`/`start`/`restart`/`stop`/`reloadConfig`/`reloadConfigStream`/`setSharing`/`participants`/`
|
|
630
|
-
| `kortix.runtime()` | the runtime REST client
|
|
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
|
|
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
|
|
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
|
|
754
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
773
|
-
natively
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1072
|
-
root. `react
|
|
1073
|
-
cannot
|
|
1074
|
-
|
|
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*`
|
|
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/
|
|
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
|
|
1087
|
-
permits to be missing are
|
|
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
|
|
1099
|
-
`/session`, `/
|
|
1100
|
-
|
|
1101
|
-
|
|
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
|
-
|
|
1105
|
-
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 #
|
|
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
|
|
1315
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
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.
|