@kortix/sdk 0.14.8 → 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 +123 -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/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 +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/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 +21 -6
- package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
- package/dist/core/rest/projects-client/projects.js +4 -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-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/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 +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/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 +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/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.
|
|
@@ -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
|
|
@@ -554,8 +537,8 @@ stays on the log and reads nothing more. Only when the log answers 404 with no `
|
|
|
554
537
|
older than the session log) does an open read the v1 saved window once: `GET …/transcript?shape=sync&history=true`.
|
|
555
538
|
The session-open snapshot (`GET …/snapshot`) asks for no v1 window (`?transcript=0`).
|
|
556
539
|
`readSavedSessionCopy` then returns it as `envelope`, and the SDK holds it for the open that
|
|
557
|
-
follows (up to 5 min). The v1 reads (`getSessionTranscriptSync`, `transcriptSync`,
|
|
558
|
-
|
|
540
|
+
follows (up to 5 min). The v1 reads (`getSessionTranscriptSync`, `transcriptSync`, …)
|
|
541
|
+
are deprecated.
|
|
559
542
|
|
|
560
543
|
`useSession().savedTranscript` says whether that saved conversation can show before the
|
|
561
544
|
computer wakes: `loading` while a saved copy may still arrive, `shown` once messages are in
|
|
@@ -576,7 +559,7 @@ A server-rendered host can seed a known runtime session pin while `/start` runs:
|
|
|
576
559
|
|
|
577
560
|
```tsx
|
|
578
561
|
useSession(projectId, sessionId, {
|
|
579
|
-
initialRuntimeSessionId: persistedSession.runtime_session_id
|
|
562
|
+
initialRuntimeSessionId: persistedSession.runtime_session_id,
|
|
580
563
|
});
|
|
581
564
|
```
|
|
582
565
|
|
|
@@ -585,8 +568,7 @@ The seed hydrates cached content. It does not choose the runtime identity.
|
|
|
585
568
|
The pin returned by `/start` always replaces a stale seed. The SDK also scopes
|
|
586
569
|
runtime query and synchronization controllers to the sandbox runtime. Two
|
|
587
570
|
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.
|
|
571
|
+
runtime session id during adoption.
|
|
590
572
|
|
|
591
573
|
After a project replaces its repository, a session created before the
|
|
592
574
|
replacement still starts. It runs the project's CURRENT config release and
|
|
@@ -616,18 +598,18 @@ exhaustive — see `API-MAP.md` for the full per-domain surface:
|
|
|
616
598
|
| namespace | what |
|
|
617
599
|
|---|---|
|
|
618
600
|
| `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,
|
|
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`) |
|
|
620
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` |
|
|
621
|
-
| `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 }` |
|
|
622
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) |
|
|
623
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) |
|
|
624
|
-
| `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 |
|
|
625
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 |
|
|
626
608
|
| `kortix.validateToken()` | pasted-API-key validation helper — `GET /accounts/me`, never throws, resolves `{valid, identity?, error?}` |
|
|
627
609
|
| `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
|
|
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 |
|
|
631
613
|
|
|
632
614
|
Runnable, self-contained scripts for the highest-value flows live in
|
|
633
615
|
[`examples/`](./examples): list projects with a PAT, send + stream, the
|
|
@@ -723,7 +705,7 @@ handle.close();
|
|
|
723
705
|
|
|
724
706
|
`session.stream()` emits the runtime's events (`message.updated`,
|
|
725
707
|
`message.part.updated`, `session.status`, `permission.*`, `question.*`, …),
|
|
726
|
-
the same
|
|
708
|
+
the same for every session. Use `useSession()` in React.
|
|
727
709
|
|
|
728
710
|
Events arrive in batches, 16 ms apart. Consecutive `message.part.delta` events
|
|
729
711
|
for one part field in a batch arrive as one event: `properties.delta` is their
|
|
@@ -745,34 +727,34 @@ and the constants `SESSION_LOG_SCHEMA`, `SESSION_LOG_MINOR` and
|
|
|
745
727
|
`zod` dependency. The validators (`SessionLogSchema` and the rest) stay in the
|
|
746
728
|
private `@kortix/api-contract` package. The types are a copy of the api-contract
|
|
747
729
|
session-log types, and a test fails when the two differ. See the
|
|
748
|
-
[reference](https://kortix.com/docs
|
|
730
|
+
[reference](https://kortix.com/docs/#session-log-types).
|
|
749
731
|
|
|
750
732
|
`@kortix/sdk/react` adds `useSessionLog(session)` and
|
|
751
733
|
`useSessionLogThread(session, threadId?, { throttleMs? })`: the log of a session `useSession`
|
|
752
734
|
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
|
-
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
|
|
755
737
|
conversion of the v1 rows, with the turn that runs kept open. Pass the session's
|
|
756
738
|
`runtimeSessionId`; without it, or before the first row, they return `null`.
|
|
757
739
|
`throttleMs` paces the v1 rows as `useSessionMessages` paces them. The
|
|
758
740
|
v1 hooks (`useSessionMessages`, `useSession().messages`) return the same rows
|
|
759
741
|
either way. `useSessionLogOlder(session, threadId?)` pages one thread of a v2 session back
|
|
760
742
|
(`GET …/log?thread=&before_seq=`). See the
|
|
761
|
-
[reference](https://kortix.com/docs
|
|
743
|
+
[reference](https://kortix.com/docs/#render-blocks-from-the-session-log).
|
|
762
744
|
|
|
763
745
|
Three transitional functions bridge a host that renders blocks while its rows are
|
|
764
746
|
still v1:
|
|
765
747
|
|
|
766
748
|
- `toolCallBlock(part)`: the `ToolCallBlock` of a v1 tool part, the block
|
|
767
|
-
|
|
749
|
+
the v1 conversion builds for it. An open call stays open; a call that streams its input
|
|
768
750
|
has the text so far as its `input`. One block per part object. It goes away in
|
|
769
751
|
the SDK major that removes the v1 rows.
|
|
770
752
|
- `toolCallMetadata(call)`: the harness's display metadata of a tool call, the
|
|
771
753
|
whole `state.metadata` of the v1 part it came from (bash `command`, read
|
|
772
|
-
`loaded`, task `sessionId`, edit `filediff`); for a record
|
|
773
|
-
natively
|
|
754
|
+
`loaded`, task `sessionId`, edit `filediff`); for a record pi wrote
|
|
755
|
+
natively, its `details`. It stays until the session-log schema carries
|
|
774
756
|
display metadata of its own.
|
|
775
|
-
- `sessionLogOfV1Rows(sessionId, runtimeSessionId, rows)`: the
|
|
757
|
+
- `sessionLogOfV1Rows(sessionId, runtimeSessionId, rows)`: the v1 live view
|
|
776
758
|
of one runtime session's v1 rows, the log `useSessionLogThread` returns on v1,
|
|
777
759
|
for rows a host reads without a `useSession` (a sub-agent's chat). One message
|
|
778
760
|
per row object, kept while the row is unchanged. It goes away with the v1 rows.
|
|
@@ -781,6 +763,24 @@ A host draws a `ToolCallBlock` with `toolCallStatus(call)` (`completed`, not
|
|
|
781
763
|
`complete`), `toolCallRawOutput(call)`, `toolCallError(call)` (the semantic error,
|
|
782
764
|
else the result text) and, for a sub-agent row, `subAgentCalls(thread)`.
|
|
783
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
|
+
|
|
784
784
|
`getSessionLogPage(projectId, sessionId, query?)`, or `kortix.session(p, s).log(query?)`,
|
|
785
785
|
reads one page of the stored session log (`SessionLogPage`: the session record,
|
|
786
786
|
every thread head, a thread's newest messages by `seq`, `has_more`). `query` is
|
|
@@ -813,7 +813,8 @@ transcript renders a thread from. It replaces the v1 turn helpers over
|
|
|
813
813
|
out every message with `in_context: false` that is not streaming.
|
|
814
814
|
- `sessionLogTurnSegments(blocks, options?)`, `splitSessionLogTurnWork(segments, { working })`
|
|
815
815
|
and `sessionLogBurstSteps(blocks)` draw a turn: bursts, text and standalone calls,
|
|
816
|
-
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.
|
|
817
818
|
- `sessionLogCallStatus(call, live)` is the status a call renders with: an open call,
|
|
818
819
|
or one the closure rule closed, is `running` or `pending` on a live turn and
|
|
819
820
|
`interrupted` on any other. `sessionLogOpenCall(call)` is the call in that open
|
|
@@ -919,16 +920,16 @@ on `forwardKortixRequest` — see its README.
|
|
|
919
920
|
## Rendering chat (the headless chat kit)
|
|
920
921
|
|
|
921
922
|
For the Kortix chat itself, use `SessionThread` from `@kortix/ui/session` (the
|
|
922
|
-
Kortix component package
|
|
923
|
+
Kortix component package): one component renders the whole
|
|
923
924
|
session from one `useSession(projectId, sessionId)` result, the same thread
|
|
924
925
|
apps/web renders. `ToolRegistry.register(name, Row)` replaces one tool row. Docs:
|
|
925
|
-
<https://kortix.com/docs
|
|
926
|
+
<https://kortix.com/docs/#the-thread-alone>. The kit below is for a host that
|
|
926
927
|
draws every part with its own components.
|
|
927
928
|
|
|
928
929
|
Everything needed to render an agent transcript without adopting any Kortix
|
|
929
930
|
UI: `classifyPart`/`classifyTurn` (framework-free, from the root entry)
|
|
930
931
|
normalize all twelve part types of the Kortix transcript format
|
|
931
|
-
(`kortix.transcript.v1
|
|
932
|
+
(`kortix.transcript.v1`, the same for every session) (text, reasoning, tool, file,
|
|
932
933
|
subtask, patch, snapshot, agent, retry, compaction, step, + a forward-compat
|
|
933
934
|
`unknown`) into a typed `ClassifiedPart`, and normalize a failed assistant
|
|
934
935
|
turn's `info.error` into a `{ name, message }` `TurnError` — so "assistant
|
|
@@ -1068,23 +1069,29 @@ provider, resolved model, HTTP status, code, and bounded message.
|
|
|
1068
1069
|
|
|
1069
1070
|
## Entry points
|
|
1070
1071
|
|
|
1071
|
-
**There are
|
|
1072
|
-
root. `react
|
|
1073
|
-
cannot
|
|
1074
|
-
|
|
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.
|
|
1075
1078
|
|
|
1076
1079
|
| import | when you use it | why it is separate |
|
|
1077
1080
|
| --- | --- | --- |
|
|
1078
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 | — |
|
|
1079
|
-
| `@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 |
|
|
1080
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 |
|
|
1081
|
-
| `@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 |
|
|
1082
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 |
|
|
1083
1089
|
|
|
1084
1090
|
The root really is canonical, and that is a test rather than a promise:
|
|
1085
1091
|
`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
|
|
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
|
|
1088
1095
|
forbidden import in the root's `isomorphic-core` tier, so they cannot live
|
|
1089
1096
|
there.
|
|
1090
1097
|
|
|
@@ -1095,14 +1102,14 @@ import { useSession } from '@kortix/sdk/react';
|
|
|
1095
1102
|
|
|
1096
1103
|
### Legacy aliases — do not use in new code
|
|
1097
1104
|
|
|
1098
|
-
`package.json` still declares
|
|
1099
|
-
`/session`, `/
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
`/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).
|
|
1103
1109
|
|
|
1104
|
-
|
|
1105
|
-
|
|
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
|
|
1106
1113
|
the root does not already export.** They are removed at the next major; new
|
|
1107
1114
|
code imports the root.
|
|
1108
1115
|
|
|
@@ -1118,6 +1125,8 @@ interface KortixPlatformConfig {
|
|
|
1118
1125
|
clientSource?: 'api' | 'cli' | 'mobile' | 'tui' | 'web';
|
|
1119
1126
|
clientVersion?: string; // '<surface>/<version>', sent as X-Kortix-Client-Version
|
|
1120
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)
|
|
1121
1130
|
getUserId?: () => Promise<string | null>;
|
|
1122
1131
|
billingEnabled?: boolean;
|
|
1123
1132
|
sandboxId?: string | null;
|
|
@@ -1200,7 +1209,6 @@ Its only platform code for the session runtime is the event transport
|
|
|
1200
1209
|
- **No harness SDK in host code.** Import transcript and runtime types from
|
|
1201
1210
|
`@kortix/sdk`, and reach the runtime through the session verbs. `session.runtime`
|
|
1202
1211
|
(the raw REST compatibility client) is deprecated.
|
|
1203
|
-
(Holds today — no host imports `@opencode-ai/sdk`, and neither does the SDK.)
|
|
1204
1212
|
- **No raw `backendApi` / `authenticatedFetch` in host code.** Use the facade or a
|
|
1205
1213
|
subpath module. (Aspirational: apps/web still calls `backendApi` via its
|
|
1206
1214
|
`@/lib/api-client` re-export in ~30 files and keeps a parallel
|
|
@@ -1214,7 +1222,7 @@ Its only platform code for the session runtime is the event transport
|
|
|
1214
1222
|
(`kortix_pat_…`) for server-side / automation use, or an OAuth access token
|
|
1215
1223
|
(`kortix_oat_…`) minted by "Sign in with Kortix" — supplied via `getToken`.
|
|
1216
1224
|
|
|
1217
|
-
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>.
|
|
1218
1226
|
|
|
1219
1227
|
### Sign in with Kortix (your app, their Kortix account)
|
|
1220
1228
|
|
|
@@ -1244,7 +1252,7 @@ const client = createKortix(auth.clientConfig()); // talks to Kortix through /p
|
|
|
1244
1252
|
```
|
|
1245
1253
|
|
|
1246
1254
|
`@kortix/sdk/react` adds `useKortixViewer()` and `<SignInWithKortix />`.
|
|
1247
|
-
Full guide:
|
|
1255
|
+
Full guide: <https://kortix.com/docs/#sign-in-with-kortix>. Example: `examples/11-sign-in-with-kortix.ts`.
|
|
1248
1256
|
|
|
1249
1257
|
### A Kortix-hosted App is already signed in
|
|
1250
1258
|
|
|
@@ -1262,7 +1270,7 @@ the API refused (after an access-policy change) and replays the call once.
|
|
|
1262
1270
|
In the browser, `backendUrl` is `/_kortix/api/v1`: the gate on the App's own
|
|
1263
1271
|
origin forwards to the Kortix API as the viewer (`viewer_token_scope: 'api'`).
|
|
1264
1272
|
A direct call to `https://api.kortix.com/v1` from an App origin fails CORS.
|
|
1265
|
-
Guide:
|
|
1273
|
+
Guide: <https://kortix.com/docs/#build-on-apps-from-typescript>.
|
|
1266
1274
|
|
|
1267
1275
|
### One member on every runtime: sign-in tokens, groups, roles
|
|
1268
1276
|
|
|
@@ -1289,7 +1297,7 @@ header, sign-in token) into one `KortixMember`: `userId`, `email`, `name`,
|
|
|
1289
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
|
|
1290
1298
|
(`auth.jwks_uri`), and refuses every token when no audience is set (option or
|
|
1291
1299
|
`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:
|
|
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>.
|
|
1293
1301
|
|
|
1294
1302
|
### Headless sign-in (your users, straight through the API)
|
|
1295
1303
|
|
|
@@ -1302,25 +1310,26 @@ const asUser = createKortix({ backendUrl, getToken: session.getToken });
|
|
|
1302
1310
|
|
|
1303
1311
|
Also `signUp`, `sendMagicLink` + `verifyOtp`, `signInWithProvider` +
|
|
1304
1312
|
`exchangeCode` (PKCE), `resetPassword`, `updatePassword`, `user`, `signOut` —
|
|
1305
|
-
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>.
|
|
1306
1314
|
|
|
1307
1315
|
## Tests
|
|
1308
1316
|
|
|
1309
1317
|
```sh
|
|
1310
1318
|
pnpm --filter @kortix/sdk typecheck # package + examples/ (examples/tsconfig.json)
|
|
1311
|
-
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)
|
|
1312
1321
|
```
|
|
1313
1322
|
|
|
1314
|
-
See **`API-MAP.md`** for the
|
|
1315
|
-
|
|
1316
|
-
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.
|
|
1317
1326
|
|
|
1318
1327
|
|
|
1319
1328
|
### Agent repository access
|
|
1320
1329
|
|
|
1321
1330
|
Agent configuration accepts `repository_access?: boolean`.
|
|
1322
1331
|
The API stores it in `kortix.yaml` as `agents.<name>.workspace.project_repository` and always writes the value.
|
|
1323
|
-
|
|
1332
|
+
On a `kortix_version: 3` project an omitted value is `false`. `GET` returns the resolved value.
|
|
1324
1333
|
Set `false` to run new sessions without the project repository or repository API access.
|
|
1325
1334
|
Git, secret, connector, and tool permissions remain separate. Existing sessions retain their saved policy.
|
|
1326
1335
|
`AgentConfigBlock.workspace` is deprecated. The SDK maps legacy `branch`/`runtime` to the boolean field.
|
|
@@ -1358,33 +1367,10 @@ await kortix.project(projectId).setCustomLlmProvider('my-llm', {
|
|
|
1358
1367
|
await kortix.project(projectId).deleteCustomLlmProvider('my-llm');
|
|
1359
1368
|
```
|
|
1360
1369
|
|
|
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
|
|
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`.
|
|
1362
1371
|
|
|
1363
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.
|
|
1364
1373
|
|
|
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
1374
|
### ChatGPT subscription usage
|
|
1389
1375
|
|
|
1390
1376
|
`getSessionCost` and `getTurnCost` report zero LLM cost for ChatGPT/Codex
|
|
@@ -1493,9 +1479,11 @@ Other freshness tiers keep their existing behavior.
|
|
|
1493
1479
|
|
|
1494
1480
|
## Generative UI (`@kortix/sdk/genui`)
|
|
1495
1481
|
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
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)):
|
|
1499
1487
|
|
|
1500
1488
|
```tsx
|
|
1501
1489
|
import { genuiVersionFromClassName } from '@kortix/sdk/genui';
|
|
@@ -1536,3 +1524,15 @@ sends one pseudonymous PostHog event at install time; set `OPENUI_TELEMETRY_DISA
|
|
|
1536
1524
|
`kortix.project(projectId).files.write({ path, ref: branch, content, expected_revision: revision })`.
|
|
1537
1525
|
The server requires `project.file.write` and returns `{ commit_sha }` after pushing.
|
|
1538
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.
|