@kortix/sdk 0.14.7 → 0.14.9
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 +145 -123
- package/dist/core/client/kortix.d.ts +123 -2
- package/dist/core/client/kortix.d.ts.map +1 -1
- 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/http/runtime-errors.d.ts +7 -1
- package/dist/core/http/runtime-errors.d.ts.map +1 -1
- package/dist/core/http/runtime-errors.js +2 -0
- package/dist/core/http/runtime-errors.js.map +1 -1
- package/dist/core/rest/platform-client/host-boundary.d.ts +58 -0
- package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
- package/dist/core/rest/platform-client/host-boundary.js +29 -0
- 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 +139 -0
- package/dist/core/rest/projects-client/artifacts.d.ts.map +1 -0
- package/dist/core/rest/projects-client/artifacts.js +72 -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/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/git-history.d.ts +1 -1
- package/dist/core/rest/projects-client/git-history.d.ts.map +1 -1
- package/dist/core/rest/projects-client/iam-actions.d.ts +4 -0
- package/dist/core/rest/projects-client/iam-actions.d.ts.map +1 -1
- package/dist/core/rest/projects-client/iam-actions.js +4 -0
- package/dist/core/rest/projects-client/iam-actions.js.map +1 -1
- package/dist/core/rest/projects-client/index.d.ts +5 -0
- package/dist/core/rest/projects-client/index.d.ts.map +1 -1
- package/dist/core/rest/projects-client/index.js +5 -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 +31 -10
- package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
- package/dist/core/rest/projects-client/projects.js +5 -5
- 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 +78 -2
- package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
- package/dist/core/rest/projects-client/sessions.js +34 -2
- 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/runtime/runtime-types.d.ts +11 -0
- package/dist/core/runtime/runtime-types.d.ts.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/session-sync-controller.d.ts +6 -0
- package/dist/core/session-sync/session-sync-controller.d.ts.map +1 -1
- package/dist/core/session-sync/session-sync-controller.js +29 -1
- package/dist/core/session-sync/session-sync-controller.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/shell.d.ts +5 -1
- package/dist/core/turns/shell.d.ts.map +1 -1
- package/dist/core/turns/shell.js +5 -1
- package/dist/core/turns/shell.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 +4 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +5 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/query-keys.d.ts +55 -1
- package/dist/react/query-keys.d.ts.map +1 -1
- package/dist/react/query-keys.js +62 -2
- package/dist/react/query-keys.js.map +1 -1
- package/dist/react/runtime-actions.d.ts +1 -0
- package/dist/react/runtime-actions.d.ts.map +1 -1
- package/dist/react/runtime-actions.js +1 -0
- package/dist/react/runtime-actions.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 +49 -0
- package/dist/react/use-artifacts.d.ts.map +1 -0
- package/dist/react/use-artifacts.js +120 -0
- package/dist/react/use-artifacts.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 +5 -1
- package/dist/react/use-feature-flag.js.map +1 -1
- package/dist/react/use-opencode-config.d.ts +3 -0
- package/dist/react/use-opencode-config.d.ts.map +1 -1
- package/dist/react/use-opencode-config.js +3 -0
- package/dist/react/use-opencode-config.js.map +1 -1
- package/dist/react/use-opencode-mcp.d.ts +1 -0
- package/dist/react/use-opencode-mcp.d.ts.map +1 -1
- package/dist/react/use-opencode-mcp.js.map +1 -1
- package/dist/react/use-opencode-sessions/sessions.d.ts +1 -0
- package/dist/react/use-opencode-sessions/sessions.d.ts.map +1 -1
- package/dist/react/use-opencode-sessions/sessions.js +1 -0
- package/dist/react/use-opencode-sessions/sessions.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/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/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.
|
|
@@ -486,6 +467,28 @@ most 16,384 characters of JSON. Example: `examples/12-session-labels.ts`.
|
|
|
486
467
|
`stops` maps the user message that started a turn to the member who stopped that turn.
|
|
487
468
|
In React, `useSessionMessageAuthors(projectId, sessionId, messageCount)` reads the same data.
|
|
488
469
|
|
|
470
|
+
### Share one response
|
|
471
|
+
|
|
472
|
+
The web session's **Share response** button publishes one finished response.
|
|
473
|
+
The prompt stays private unless the person selects **Prompt and response**.
|
|
474
|
+
The SDK exposes the same operations as named exports:
|
|
475
|
+
|
|
476
|
+
```ts
|
|
477
|
+
import { getTurnShare, shareTurn, unshareTurn, getPublicResponse } from '@kortix/sdk';
|
|
478
|
+
|
|
479
|
+
const { share } = await shareTurn(projectId, sessionId, turnId, { include_prompt: false });
|
|
480
|
+
const response = await getPublicResponse(share.token, { backendUrl });
|
|
481
|
+
await getTurnShare(projectId, sessionId, turnId);
|
|
482
|
+
await unshareTurn(projectId, sessionId, turnId);
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
`turnId` is the user message id that starts the turn. Publishing requires a human
|
|
486
|
+
owner or project manager who can read the session. Service accounts and agent
|
|
487
|
+
credentials cannot publish. Sessions with personal connections or person-only
|
|
488
|
+
secrets cannot publish. Repeating `shareTurn` updates the snapshot under the same
|
|
489
|
+
URL. `unshareTurn` revokes it; anonymous reads then return `410`. Snapshots exclude
|
|
490
|
+
reasoning, tool calls, and attachments. The public page disables search indexing.
|
|
491
|
+
|
|
489
492
|
### Who may stop a turn
|
|
490
493
|
|
|
491
494
|
In a shared session only the member who started the running turn, the session owner or a
|
|
@@ -509,13 +512,15 @@ A transcript message carries only the model its turn asked for. In React,
|
|
|
509
512
|
### React runtime
|
|
510
513
|
|
|
511
514
|
`useSession(projectId, sessionId)` opens the session runtime returned by
|
|
512
|
-
`POST /start`.
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
`session.
|
|
518
|
-
|
|
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.
|
|
519
524
|
|
|
520
525
|
Every session saves its transcript at the end of each turn. `useSession` reads saved
|
|
521
526
|
messages from the platform database while `/start` continues. It uses the
|
|
@@ -532,8 +537,8 @@ stays on the log and reads nothing more. Only when the log answers 404 with no `
|
|
|
532
537
|
older than the session log) does an open read the v1 saved window once: `GET …/transcript?shape=sync&history=true`.
|
|
533
538
|
The session-open snapshot (`GET …/snapshot`) asks for no v1 window (`?transcript=0`).
|
|
534
539
|
`readSavedSessionCopy` then returns it as `envelope`, and the SDK holds it for the open that
|
|
535
|
-
follows (up to 5 min). The v1 reads (`getSessionTranscriptSync`, `transcriptSync`,
|
|
536
|
-
|
|
540
|
+
follows (up to 5 min). The v1 reads (`getSessionTranscriptSync`, `transcriptSync`, …)
|
|
541
|
+
are deprecated.
|
|
537
542
|
|
|
538
543
|
`useSession().savedTranscript` says whether that saved conversation can show before the
|
|
539
544
|
computer wakes: `loading` while a saved copy may still arrive, `shown` once messages are in
|
|
@@ -554,7 +559,7 @@ A server-rendered host can seed a known runtime session pin while `/start` runs:
|
|
|
554
559
|
|
|
555
560
|
```tsx
|
|
556
561
|
useSession(projectId, sessionId, {
|
|
557
|
-
initialRuntimeSessionId: persistedSession.runtime_session_id
|
|
562
|
+
initialRuntimeSessionId: persistedSession.runtime_session_id,
|
|
558
563
|
});
|
|
559
564
|
```
|
|
560
565
|
|
|
@@ -563,8 +568,7 @@ The seed hydrates cached content. It does not choose the runtime identity.
|
|
|
563
568
|
The pin returned by `/start` always replaces a stale seed. The SDK also scopes
|
|
564
569
|
runtime query and synchronization controllers to the sandbox runtime. Two
|
|
565
570
|
sandboxes cannot share browser cache state when a snapshot exposes the same
|
|
566
|
-
runtime session id during adoption.
|
|
567
|
-
of `runtime_session_id`; read it only as the fallback above.
|
|
571
|
+
runtime session id during adoption.
|
|
568
572
|
|
|
569
573
|
After a project replaces its repository, a session created before the
|
|
570
574
|
replacement still starts. It runs the project's CURRENT config release and
|
|
@@ -594,18 +598,18 @@ exhaustive — see `API-MAP.md` for the full per-domain surface:
|
|
|
594
598
|
| namespace | what |
|
|
595
599
|
|---|---|
|
|
596
600
|
| `kortix.projects` | list · get · detail · create · provision · update · archive · llmCatalog · modelPicker · sandboxTemplates · sessions (+ more: `listForAccount`, `sandboxHealth`, `createSession`) |
|
|
597
|
-
| `kortix.accounts` | list · get · create · members · invites · `secretResources.{list,create,rotate,
|
|
601
|
+
| `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`) |
|
|
598
602
|
| `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` |
|
|
599
|
-
| `kortix.marketplace` | public marketplace catalog browse + sources (not project-scoped): `items` · `item` · `itemFile` · `marketplaces` · `featured` · `sources.{list,add,remove}`
|
|
603
|
+
| `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 }` |
|
|
600
604
|
| `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) |
|
|
601
605
|
| `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) |
|
|
602
|
-
| `kortix.notifications` |
|
|
606
|
+
| `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 |
|
|
603
607
|
| `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 |
|
|
604
608
|
| `kortix.validateToken()` | pasted-API-key validation helper — `GET /accounts/me`, never throws, resolves `{valid, identity?, error?}` |
|
|
605
609
|
| `kortix.connectors` | Connector data plane for an agent-minted session token: `catalog` · `tools` · `search` · `describe` · `call` (`{ account }`) · `accounts` · `uploadAttachment` |
|
|
606
|
-
| `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 /
|
|
607
|
-
| `kortix.session(pid, sid)` | id-bound handle: lifecycle (`get`/`update`/`delete`/`restore`/`start`/`restart`/`stop`/`reloadConfig`/`reloadConfigStream`/`setSharing`/`participants`/`
|
|
608
|
-
| `kortix.runtime()` | the runtime REST client
|
|
610
|
+
| `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`) |
|
|
611
|
+
| `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` |
|
|
612
|
+
| `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 |
|
|
609
613
|
|
|
610
614
|
Runnable, self-contained scripts for the highest-value flows live in
|
|
611
615
|
[`examples/`](./examples): list projects with a PAT, send + stream, the
|
|
@@ -701,7 +705,7 @@ handle.close();
|
|
|
701
705
|
|
|
702
706
|
`session.stream()` emits the runtime's events (`message.updated`,
|
|
703
707
|
`message.part.updated`, `session.status`, `permission.*`, `question.*`, …),
|
|
704
|
-
the same
|
|
708
|
+
the same for every session. Use `useSession()` in React.
|
|
705
709
|
|
|
706
710
|
Events arrive in batches, 16 ms apart. Consecutive `message.part.delta` events
|
|
707
711
|
for one part field in a batch arrive as one event: `properties.delta` is their
|
|
@@ -723,34 +727,34 @@ and the constants `SESSION_LOG_SCHEMA`, `SESSION_LOG_MINOR` and
|
|
|
723
727
|
`zod` dependency. The validators (`SessionLogSchema` and the rest) stay in the
|
|
724
728
|
private `@kortix/api-contract` package. The types are a copy of the api-contract
|
|
725
729
|
session-log types, and a test fails when the two differ. See the
|
|
726
|
-
[reference](https://kortix.com/docs
|
|
730
|
+
[reference](https://kortix.com/docs/#session-log-types).
|
|
727
731
|
|
|
728
732
|
`@kortix/sdk/react` adds `useSessionLog(session)` and
|
|
729
733
|
`useSessionLogThread(session, threadId?, { throttleMs? })`: the log of a session `useSession`
|
|
730
734
|
owns. `useSessionLog` marks its source: `'v2'` is the API's log, which every open reads
|
|
731
|
-
first when the API holds a log for the session
|
|
732
|
-
A session whose log answers 404 with no `code` (an API older than the log) reads v1, and the hooks return `source: 'v1'`: the
|
|
735
|
+
first when the API holds a log for the session. No project flag is read.
|
|
736
|
+
A session whose log answers 404 with no `code` (an API older than the log) reads v1, and the hooks return `source: 'v1'`: the
|
|
733
737
|
conversion of the v1 rows, with the turn that runs kept open. Pass the session's
|
|
734
738
|
`runtimeSessionId`; without it, or before the first row, they return `null`.
|
|
735
739
|
`throttleMs` paces the v1 rows as `useSessionMessages` paces them. The
|
|
736
740
|
v1 hooks (`useSessionMessages`, `useSession().messages`) return the same rows
|
|
737
741
|
either way. `useSessionLogOlder(session, threadId?)` pages one thread of a v2 session back
|
|
738
742
|
(`GET …/log?thread=&before_seq=`). See the
|
|
739
|
-
[reference](https://kortix.com/docs
|
|
743
|
+
[reference](https://kortix.com/docs/#render-blocks-from-the-session-log).
|
|
740
744
|
|
|
741
745
|
Three transitional functions bridge a host that renders blocks while its rows are
|
|
742
746
|
still v1:
|
|
743
747
|
|
|
744
748
|
- `toolCallBlock(part)`: the `ToolCallBlock` of a v1 tool part, the block
|
|
745
|
-
|
|
749
|
+
the v1 conversion builds for it. An open call stays open; a call that streams its input
|
|
746
750
|
has the text so far as its `input`. One block per part object. It goes away in
|
|
747
751
|
the SDK major that removes the v1 rows.
|
|
748
752
|
- `toolCallMetadata(call)`: the harness's display metadata of a tool call, the
|
|
749
753
|
whole `state.metadata` of the v1 part it came from (bash `command`, read
|
|
750
|
-
`loaded`, task `sessionId`, edit `filediff`); for a record
|
|
751
|
-
natively
|
|
754
|
+
`loaded`, task `sessionId`, edit `filediff`); for a record pi wrote
|
|
755
|
+
natively, its `details`. It stays until the session-log schema carries
|
|
752
756
|
display metadata of its own.
|
|
753
|
-
- `sessionLogOfV1Rows(sessionId, runtimeSessionId, rows)`: the
|
|
757
|
+
- `sessionLogOfV1Rows(sessionId, runtimeSessionId, rows)`: the v1 live view
|
|
754
758
|
of one runtime session's v1 rows, the log `useSessionLogThread` returns on v1,
|
|
755
759
|
for rows a host reads without a `useSession` (a sub-agent's chat). One message
|
|
756
760
|
per row object, kept while the row is unchanged. It goes away with the v1 rows.
|
|
@@ -759,6 +763,24 @@ A host draws a `ToolCallBlock` with `toolCallStatus(call)` (`completed`, not
|
|
|
759
763
|
`complete`), `toolCallRawOutput(call)`, `toolCallError(call)` (the semantic error,
|
|
760
764
|
else the result text) and, for a sub-agent row, `subAgentCalls(thread)`.
|
|
761
765
|
|
|
766
|
+
An `image_gen` card reads `imageGenView(call, live?)`: an `ImageGenView` with
|
|
767
|
+
`phase` (`ImageGenPhase`: `generating`, `ready`, `failed`, `stopped`), `action`,
|
|
768
|
+
`prompts`, `aspectRatio` (the requested ratio, fixed across phases), `startedAt`, `model`, `provider`, `error` (`message`, `suggestion?`,
|
|
769
|
+
`code?`, `retryAfterSeconds?`, `connectModel`) and `images`: one frame per image
|
|
770
|
+
(`prompt`, `phase`, `aspectRatio`, `imagePath`, `directUrl`, `error`), one to four
|
|
771
|
+
per call.
|
|
772
|
+
`imageGenRetryDelay(seconds)` and `formatImageGenElapsed(ms)` format its retry wait
|
|
773
|
+
and elapsed time. `imagePathsShownByImageGen(blocks)`,
|
|
774
|
+
`withoutImageGenDuplicates(items, paths, digests?)` and `showDrawnByImageGen(call, paths, digests?)` keep
|
|
775
|
+
a `show` from drawing an image the turn's `image_gen` card already drew, by path or by
|
|
776
|
+
the bytes' sha256 (`imageDigestsShownByImageGen(blocks)`, a frame's `sha256?`,
|
|
777
|
+
`showItemDigest(call, path)` for a `show` output). Consecutive `image_gen` cards of a turn
|
|
778
|
+
draw as one grid: `sessionLogImageGenRuns(segments, drawn)` finds the runs and
|
|
779
|
+
`imageGenGrid(views)` lays out their tiles and rows. `createImageCache(options)` is a
|
|
780
|
+
framework-free store of loaded images by path and sha256, for a host that shares one
|
|
781
|
+
loaded image across surfaces. See the
|
|
782
|
+
[reference](https://kortix.com/docs/sdk/reference#the-image_gen-card).
|
|
783
|
+
|
|
762
784
|
`getSessionLogPage(projectId, sessionId, query?)`, or `kortix.session(p, s).log(query?)`,
|
|
763
785
|
reads one page of the stored session log (`SessionLogPage`: the session record,
|
|
764
786
|
every thread head, a thread's newest messages by `seq`, `has_more`). `query` is
|
|
@@ -791,7 +813,8 @@ transcript renders a thread from. It replaces the v1 turn helpers over
|
|
|
791
813
|
out every message with `in_context: false` that is not streaming.
|
|
792
814
|
- `sessionLogTurnSegments(blocks, options?)`, `splitSessionLogTurnWork(segments, { working })`
|
|
793
815
|
and `sessionLogBurstSteps(blocks)` draw a turn: bursts, text and standalone calls,
|
|
794
|
-
the settled-turn fold, and the rows of a burst.
|
|
816
|
+
the settled-turn fold, and the rows of a burst. The deliverables (`show`, `show_user`,
|
|
817
|
+
`image_gen`: `NO_GROUP_ACTIVITY_TOOLS`) stand alone and are hoisted above the final text.
|
|
795
818
|
- `sessionLogCallStatus(call, live)` is the status a call renders with: an open call,
|
|
796
819
|
or one the closure rule closed, is `running` or `pending` on a live turn and
|
|
797
820
|
`interrupted` on any other. `sessionLogOpenCall(call)` is the call in that open
|
|
@@ -897,16 +920,16 @@ on `forwardKortixRequest` — see its README.
|
|
|
897
920
|
## Rendering chat (the headless chat kit)
|
|
898
921
|
|
|
899
922
|
For the Kortix chat itself, use `SessionThread` from `@kortix/ui/session` (the
|
|
900
|
-
Kortix component package
|
|
923
|
+
Kortix component package): one component renders the whole
|
|
901
924
|
session from one `useSession(projectId, sessionId)` result, the same thread
|
|
902
925
|
apps/web renders. `ToolRegistry.register(name, Row)` replaces one tool row. Docs:
|
|
903
|
-
<https://kortix.com/docs
|
|
926
|
+
<https://kortix.com/docs/#the-thread-alone>. The kit below is for a host that
|
|
904
927
|
draws every part with its own components.
|
|
905
928
|
|
|
906
929
|
Everything needed to render an agent transcript without adopting any Kortix
|
|
907
930
|
UI: `classifyPart`/`classifyTurn` (framework-free, from the root entry)
|
|
908
931
|
normalize all twelve part types of the Kortix transcript format
|
|
909
|
-
(`kortix.transcript.v1
|
|
932
|
+
(`kortix.transcript.v1`, the same for every session) (text, reasoning, tool, file,
|
|
910
933
|
subtask, patch, snapshot, agent, retry, compaction, step, + a forward-compat
|
|
911
934
|
`unknown`) into a typed `ClassifiedPart`, and normalize a failed assistant
|
|
912
935
|
turn's `info.error` into a `{ name, message }` `TurnError` — so "assistant
|
|
@@ -1046,23 +1069,29 @@ provider, resolved model, HTTP status, code, and bounded message.
|
|
|
1046
1069
|
|
|
1047
1070
|
## Entry points
|
|
1048
1071
|
|
|
1049
|
-
**There are
|
|
1050
|
-
root. `react
|
|
1051
|
-
cannot
|
|
1052
|
-
|
|
1072
|
+
**There are nine stable entries, plus one internal.** Everything framework-free
|
|
1073
|
+
lives at the root. `react`, `server` and the three `genui` entries exist because
|
|
1074
|
+
each carries a dependency the root cannot. `wire-message-id` and
|
|
1075
|
+
`capture-rules` exist so a server can load one module, not the barrel.
|
|
1076
|
+
`workspace-search` is isolated from the root on purpose. That is the whole map —
|
|
1077
|
+
learn it once.
|
|
1053
1078
|
|
|
1054
1079
|
| import | when you use it | why it is separate |
|
|
1055
1080
|
| --- | --- | --- |
|
|
1056
1081
|
| `@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 | — |
|
|
1057
|
-
| `@kortix/sdk/react` | hooks and providers: `useSession`, every `useRuntime*`
|
|
1082
|
+
| `@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 |
|
|
1058
1083
|
| `@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 |
|
|
1059
|
-
| `@kortix/sdk/
|
|
1084
|
+
| `@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 |
|
|
1085
|
+
| `@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 |
|
|
1086
|
+
| `@kortix/sdk/workspace-search` | `createWorkspaceSearchClient` and its ranking helpers | isolated from the root on purpose |
|
|
1087
|
+
| `@kortix/sdk/capture-rules` | the Kortix Capture constants (`CAPTURE_LAYERS`, `CAPTURE_DEVICE_DEFAULTS`, …) | the root exports the same names; this module loads alone |
|
|
1060
1088
|
| `@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 |
|
|
1061
1089
|
|
|
1062
1090
|
The root really is canonical, and that is a test rather than a promise:
|
|
1063
1091
|
`src/root-canonical.test.ts` asserts that every name exported by every other
|
|
1064
|
-
isomorphic subpath is also exported from `@kortix/sdk`. The only
|
|
1065
|
-
permits to be missing are
|
|
1092
|
+
isomorphic subpath is also exported from `@kortix/sdk`. The only subpaths it
|
|
1093
|
+
permits to be missing are `react`, `server`, the three `genui` entries,
|
|
1094
|
+
`workspace-search` and the browser-only stores above — `zustand` is a
|
|
1066
1095
|
forbidden import in the root's `isomorphic-core` tier, so they cannot live
|
|
1067
1096
|
there.
|
|
1068
1097
|
|
|
@@ -1073,14 +1102,14 @@ import { useSession } from '@kortix/sdk/react';
|
|
|
1073
1102
|
|
|
1074
1103
|
### Legacy aliases — do not use in new code
|
|
1075
1104
|
|
|
1076
|
-
`package.json` still declares
|
|
1077
|
-
`/session`, `/
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
`/message-queue`, and the un-prefixed store aliases.
|
|
1105
|
+
`package.json` still declares 21 more subpaths, for example `/turns`, `/files`,
|
|
1106
|
+
`/session`, `/projects-client`, `/event-stream` and the un-prefixed store
|
|
1107
|
+
aliases. The full list is in the
|
|
1108
|
+
[SDK reference](https://kortix.com/docs/#deprecated-names).
|
|
1081
1109
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1110
|
+
Twenty of them are one-line `export *` re-exports under `src/deprecated/`, and
|
|
1111
|
+
`/message-queue` is a deprecated module of its own. They stay only so an
|
|
1112
|
+
existing `npm install` does not break. **They add nothing
|
|
1084
1113
|
the root does not already export.** They are removed at the next major; new
|
|
1085
1114
|
code imports the root.
|
|
1086
1115
|
|
|
@@ -1096,6 +1125,8 @@ interface KortixPlatformConfig {
|
|
|
1096
1125
|
clientSource?: 'api' | 'cli' | 'mobile' | 'tui' | 'web';
|
|
1097
1126
|
clientVersion?: string; // '<surface>/<version>', sent as X-Kortix-Client-Version
|
|
1098
1127
|
credentialHeader?: string; // send the raw token in this header instead of Authorization
|
|
1128
|
+
fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>; // default: global fetch
|
|
1129
|
+
eventStreamTransport?: RuntimeEventTransport; // event-stream bytes when `fetch` cannot stream (React Native)
|
|
1099
1130
|
getUserId?: () => Promise<string | null>;
|
|
1100
1131
|
billingEnabled?: boolean;
|
|
1101
1132
|
sandboxId?: string | null;
|
|
@@ -1178,7 +1209,6 @@ Its only platform code for the session runtime is the event transport
|
|
|
1178
1209
|
- **No harness SDK in host code.** Import transcript and runtime types from
|
|
1179
1210
|
`@kortix/sdk`, and reach the runtime through the session verbs. `session.runtime`
|
|
1180
1211
|
(the raw REST compatibility client) is deprecated.
|
|
1181
|
-
(Holds today — no host imports `@opencode-ai/sdk`, and neither does the SDK.)
|
|
1182
1212
|
- **No raw `backendApi` / `authenticatedFetch` in host code.** Use the facade or a
|
|
1183
1213
|
subpath module. (Aspirational: apps/web still calls `backendApi` via its
|
|
1184
1214
|
`@/lib/api-client` re-export in ~30 files and keeps a parallel
|
|
@@ -1192,7 +1222,7 @@ Its only platform code for the session runtime is the event transport
|
|
|
1192
1222
|
(`kortix_pat_…`) for server-side / automation use, or an OAuth access token
|
|
1193
1223
|
(`kortix_oat_…`) minted by "Sign in with Kortix" — supplied via `getToken`.
|
|
1194
1224
|
|
|
1195
|
-
To use Kortix from an MCP client (Claude, ChatGPT, Cursor, Codex) instead of code, see the hosted MCP server: <https://kortix.com/docs
|
|
1225
|
+
To use Kortix from an MCP client (Claude, ChatGPT, Cursor, Codex) instead of code, see the hosted MCP server: <https://kortix.com/docs/#connectors>.
|
|
1196
1226
|
|
|
1197
1227
|
### Sign in with Kortix (your app, their Kortix account)
|
|
1198
1228
|
|
|
@@ -1222,7 +1252,7 @@ const client = createKortix(auth.clientConfig()); // talks to Kortix through /p
|
|
|
1222
1252
|
```
|
|
1223
1253
|
|
|
1224
1254
|
`@kortix/sdk/react` adds `useKortixViewer()` and `<SignInWithKortix />`.
|
|
1225
|
-
Full guide:
|
|
1255
|
+
Full guide: <https://kortix.com/docs/#sign-in-with-kortix>. Example: `examples/11-sign-in-with-kortix.ts`.
|
|
1226
1256
|
|
|
1227
1257
|
### A Kortix-hosted App is already signed in
|
|
1228
1258
|
|
|
@@ -1240,7 +1270,7 @@ the API refused (after an access-policy change) and replays the call once.
|
|
|
1240
1270
|
In the browser, `backendUrl` is `/_kortix/api/v1`: the gate on the App's own
|
|
1241
1271
|
origin forwards to the Kortix API as the viewer (`viewer_token_scope: 'api'`).
|
|
1242
1272
|
A direct call to `https://api.kortix.com/v1` from an App origin fails CORS.
|
|
1243
|
-
Guide:
|
|
1273
|
+
Guide: <https://kortix.com/docs/#build-on-apps-from-typescript>.
|
|
1244
1274
|
|
|
1245
1275
|
### One member on every runtime: sign-in tokens, groups, roles
|
|
1246
1276
|
|
|
@@ -1267,7 +1297,7 @@ header, sign-in token) into one `KortixMember`: `userId`, `email`, `name`,
|
|
|
1267
1297
|
`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
|
|
1268
1298
|
(`auth.jwks_uri`), and refuses every token when no audience is set (option or
|
|
1269
1299
|
`KORTIX_AUTH_AUDIENCE`): one project key signs every App's tokens, so `aud` is
|
|
1270
|
-
the only thing that keeps another App's token out. `audience: false` opts out. WebCrypto only; no dependency. Guide:
|
|
1300
|
+
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>.
|
|
1271
1301
|
|
|
1272
1302
|
### Headless sign-in (your users, straight through the API)
|
|
1273
1303
|
|
|
@@ -1280,25 +1310,26 @@ const asUser = createKortix({ backendUrl, getToken: session.getToken });
|
|
|
1280
1310
|
|
|
1281
1311
|
Also `signUp`, `sendMagicLink` + `verifyOtp`, `signInWithProvider` +
|
|
1282
1312
|
`exchangeCode` (PKCE), `resetPassword`, `updatePassword`, `user`, `signOut` —
|
|
1283
|
-
all `/v1/auth/*`, no Supabase in the client. Guide:
|
|
1313
|
+
all `/v1/auth/*`, no Supabase in the client. Guide: <https://kortix.com/docs/#sdk-authentication>.
|
|
1284
1314
|
|
|
1285
1315
|
## Tests
|
|
1286
1316
|
|
|
1287
1317
|
```sh
|
|
1288
1318
|
pnpm --filter @kortix/sdk typecheck # package + examples/ (examples/tsconfig.json)
|
|
1289
|
-
pnpm --filter @kortix/sdk test #
|
|
1319
|
+
pnpm --filter @kortix/sdk test src/root-canonical.test.ts # one test file
|
|
1320
|
+
pnpm --filter @kortix/sdk test # the whole suite (on macOS it exits 2 unless KORTIX_FULL_TEST=1)
|
|
1290
1321
|
```
|
|
1291
1322
|
|
|
1292
|
-
See **`API-MAP.md`** for the
|
|
1293
|
-
|
|
1294
|
-
per-release changes.
|
|
1323
|
+
See **`API-MAP.md`** for the endpoint catalogue. It covers the Kortix REST API
|
|
1324
|
+
and the session runtime that the session handle wraps. See **`CHANGELOG.md`**
|
|
1325
|
+
for per-release changes.
|
|
1295
1326
|
|
|
1296
1327
|
|
|
1297
1328
|
### Agent repository access
|
|
1298
1329
|
|
|
1299
1330
|
Agent configuration accepts `repository_access?: boolean`.
|
|
1300
1331
|
The API stores it in `kortix.yaml` as `agents.<name>.workspace.project_repository` and always writes the value.
|
|
1301
|
-
|
|
1332
|
+
On a `kortix_version: 3` project an omitted value is `false`. `GET` returns the resolved value.
|
|
1302
1333
|
Set `false` to run new sessions without the project repository or repository API access.
|
|
1303
1334
|
Git, secret, connector, and tool permissions remain separate. Existing sessions retain their saved policy.
|
|
1304
1335
|
`AgentConfigBlock.workspace` is deprecated. The SDK maps legacy `branch`/`runtime` to the boolean field.
|
|
@@ -1336,33 +1367,10 @@ await kortix.project(projectId).setCustomLlmProvider('my-llm', {
|
|
|
1336
1367
|
await kortix.project(projectId).deleteCustomLlmProvider('my-llm');
|
|
1337
1368
|
```
|
|
1338
1369
|
|
|
1339
|
-
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
|
|
1370
|
+
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`.
|
|
1340
1371
|
|
|
1341
1372
|
`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.
|
|
1342
1373
|
|
|
1343
|
-
### Pooled ChatGPT connections
|
|
1344
|
-
|
|
1345
|
-
With the `pooled_provider_secrets` project flag enabled, a
|
|
1346
|
-
member can create a named ChatGPT OAuth account resource:
|
|
1347
|
-
|
|
1348
|
-
```ts
|
|
1349
|
-
const challenge = await kortix.project(projectId).secrets.startProviderOAuth('openai', {
|
|
1350
|
-
resourceLabel: 'My ChatGPT account',
|
|
1351
|
-
});
|
|
1352
|
-
// Show challenge.verification_url and challenge.user_code, then poll the flow.
|
|
1353
|
-
const result = await kortix.project(projectId).secrets.pollProviderOAuth('openai', challenge.flow_id);
|
|
1354
|
-
```
|
|
1355
|
-
|
|
1356
|
-
Poll until `result.status` is `success`, `failed`, or `expired`. A successful
|
|
1357
|
-
named flow returns `credential.secret_id`. It creates a separate project-scoped
|
|
1358
|
-
account resource; reconnecting does not replace another account. Every project
|
|
1359
|
-
member can use it by default. The owner can restrict access to selected members.
|
|
1360
|
-
A session can select one or more available
|
|
1361
|
-
ChatGPT resources through its provider secret pool (`providerId: 'codex'`).
|
|
1362
|
-
Without an explicit session selection, the caller's newest personal ChatGPT
|
|
1363
|
-
resource is used. The legacy project login remains the fallback when that
|
|
1364
|
-
caller has no personal resource.
|
|
1365
|
-
|
|
1366
1374
|
### ChatGPT subscription usage
|
|
1367
1375
|
|
|
1368
1376
|
`getSessionCost` and `getTurnCost` report zero LLM cost for ChatGPT/Codex
|
|
@@ -1471,9 +1479,11 @@ Other freshness tiers keep their existing behavior.
|
|
|
1471
1479
|
|
|
1472
1480
|
## Generative UI (`@kortix/sdk/genui`)
|
|
1473
1481
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1482
|
+
Generative UI is on by default for every project (the `genui` project flag), and
|
|
1483
|
+
experimental. The agent may answer with ` ```openui ` blocks: cards, comparisons,
|
|
1484
|
+
charts, maps, tabs. Render them with the headless renderer and your own
|
|
1485
|
+
components, or with the bundled defaults
|
|
1486
|
+
([guide](https://kortix.com/docs/#generative-ui)):
|
|
1477
1487
|
|
|
1478
1488
|
```tsx
|
|
1479
1489
|
import { genuiVersionFromClassName } from '@kortix/sdk/genui';
|
|
@@ -1514,3 +1524,15 @@ sends one pseudonymous PostHog event at install time; set `OPENUI_TELEMETRY_DISA
|
|
|
1514
1524
|
`kortix.project(projectId).files.write({ path, ref: branch, content, expected_revision: revision })`.
|
|
1515
1525
|
The server requires `project.file.write` and returns `{ commit_sha }` after pushing.
|
|
1516
1526
|
A changed file returns HTTP 409 instead of overwriting another edit. Reload before retrying.
|
|
1527
|
+
|
|
1528
|
+
### Change request recovery
|
|
1529
|
+
|
|
1530
|
+
`recoverChangeRequest(projectId, target, blocker)` queues a follow-up on the
|
|
1531
|
+
visible origin session and returns its ID. It uses queue delivery, so a running
|
|
1532
|
+
turn is not interrupted. The origin prompt updates the existing change request
|
|
1533
|
+
and leaves application to the person. A visible archived origin creates a child;
|
|
1534
|
+
an unavailable origin creates a root with `metadata.origin_session_id`.
|
|
1535
|
+
`createProjectSession` accepts an optional `parent_session_id` for a visible
|
|
1536
|
+
same-project parent. This groups the new session without inheriting the parent's
|
|
1537
|
+
sharing or automation identity. A session-bound credential retains its own
|
|
1538
|
+
server-derived parent regardless of that field.
|