@sogni-ai/sogni-client 4.2.0-alpha.25 → 4.2.0-alpha.26

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.
@@ -1,6 +1,6 @@
1
- # CLAUDE.md
1
+ # AGENTS.md
2
2
 
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3
+ This file provides guidance to AI coding assistants (Claude Code, Codex, etc.) when working with code in this repository.
4
4
 
5
5
  ## LLM Documentation Resources
6
6
 
@@ -13,31 +13,49 @@ For AI coding assistants working with this SDK, the following resources are avai
13
13
 
14
14
  When helping users with Sogni SDK tasks, consult `llms-full.txt` for complete parameter references, especially for video generation where WAN 2.2 and LTX-2.3 models have different behaviors.
15
15
 
16
- ## Creative Agent Shared Contracts
16
+ These are public agent-facing docs shipped with the npm package. They are kept aligned with:
17
17
 
18
- Hosted chat tools, creative-agent workflow helpers, generated tool manifests, and SDK-facing workflow docs should stay aligned with `../sogni-creative-agent`. Do not recreate chat-only or SDK-only regex guardrails for tool argument repair, storyboard planning, or workflow routing. Add reusable JSON schemas, typed repair/control semantics, and deterministic validation to the shared package first, then regenerate or copy the public SDK artifacts as appropriate.
18
+ - `package.json` for package version, runtime engines, npm scripts, exports, and published files.
19
+ - `src/index.ts` for public SDK namespaces and root exports.
20
+ - `src/Projects/types/index.ts`, `src/Projects/utils/index.ts`, and `src/Projects/createJobRequestMessage.ts` for media-generation parameters and video frame behavior.
21
+ - `src/Chat/types.ts`, `src/Chat/index.ts`, `src/Chat/tools.ts`, and `src/Chat/hostedToolValidation.generated.ts` for chat, hosted tools, structured outputs, and durable runs.
22
+ - `src/CreativeWorkflows/` and `src/Replay/` for durable workflow and RunRecord APIs.
19
23
 
20
- Use secondary LLM calls for semantic planning, creative adaptation, and audit/repair workflows, not as a substitute for schema validation of tool arguments or structured workflow control.
24
+ Current public API anchors:
21
25
 
22
- When SDK examples or generated helpers expose hosted creative workflows, keep them generated from or aligned with shared `@sogni/creative-agent` contracts such as `compileCreativeWorkflowPlanToHostedSequence()`, `validateAndNormalizeHostedToolArguments()`, `getRepairControlDecision()`, and `summarizeGuardTelemetry()`.
26
+ - The SDK runtime requirement is **Node.js >=22** (`package.json#engines`).
27
+ - Socket-native LLM chat uses `sogni.chat.completions.create()`.
28
+ - Durable creative workflows use `sogni.workflows`.
29
+ - Project cost helpers are `sogni.projects.estimateCost()`, `estimateVideoCost()`, and `estimateAudioCost()`.
30
+ - `checkAuth()` is only for cookie-auth browser flows. API-key auth auto-authenticates during `createInstance()`, and token auth uses `login()` or `setTokens()`.
31
+ - `ChatCompletionResult` is SDK-shaped (`content`, `role`, `finishReason`, `tool_calls`, `usage`, `cost`). Streaming chunks expose `chunk.content` and optional `chunk.tool_calls`.
23
32
 
24
- ### Shared `@sogni/creative-agent` contracts
33
+ ## Sogni Intelligence APIs
25
34
 
26
- `@sogni/creative-agent` ships several surfaces SDK consumers can import directly when implementing creative workflows:
35
+ The SDK wraps the public Sogni Intelligence endpoints used for text chat, hosted creative tools, durable chat turns, and deterministic multi-step workflows.
27
36
 
28
- - **Per-turn tool gating**: the chat-side skill loader (`load_skill` / `unload_skill` / `list_active_skills`) was retired on 2026-05-10. Tool-surface composition is now owned by Structured Contracts v1 (see next bullet). SDK consumers building their own agent loop should construct a `ContractRegistry` and call `classifyTurn` / `compileToolsForTurn` / `dispatchToolCall` instead of advertising load/unload tools to the model. (The read-only `*_SKILL` manifest metadata used by the public Anthropic-style skill artifact is **not** a `@sogni/creative-agent` package export — it ships separately via `@sogni-ai/sogni-creative-agent-skill`.)
29
- - **Structured Contracts v1**: `ContractRegistry`, `ToolGatingPolicy`, `RepairRecipe`, `PromptContract`, `classifyTurn`, `compileToolsForTurn`, `dispatchToolCall`, plus the `ContractsTelemetrySink` event types. The chat product seeds a registry once per session and the three evaluators own visible-tool composition, repair-on-error, and prompt-bake.
30
- - **Asset manifest**: `createAssetManifest`, `addAsset`, `mapAssetsForModel`, `validateAssetReferences`, `formatModelRef` — three-layer asset references (`asset_id` / `user_label` / `model_ref`) so SDK consumers don't hand-format Seedance `@Image1` / GPT-Image-2 `[Image 1]` / LTX-2.3 `context_image_0` tokens.
31
- - **Storyboard adapters**: `compileForModel`, `storyboardAdapterRegistry`, `SEEDANCE_ADAPTER`, `GPT_IMAGE_2_ADAPTER`, `LTX23_ADAPTER`, `WAN_ADAPTER`. Resolution is liberal (`seedance2-fast` seedance via prefix).
32
- - **Tool envelope**: `ToolResult`, `toolOk`, `toolErr`, `isToolResultOk`, `isToolResultErr`, `mapLegacyToolErrorCategory`, plus the canonical `ToolErrorCode` taxonomy.
33
- - **Constrained decoding (`response_format`)**: llama-server natively accepts OpenAI-standard `{ type: "json_schema", json_schema: { strict, schema } }`. Plumbed through `src/Chat/index.ts` and forwarded to the worker via `sogni-socket` (commit `b711a68`); the `ChatResponseFormat` type is re-exported from the SDK root for typed consumer usage.
34
- - **Default contract data**: `populateContractsDefaults(registry)` seeds a `ContractRegistry` with the canonical Phase 3 gating policies (7), Phase 4 repair recipes (157 across 11 `(toolName, ToolErrorCode)` families), and Phase 5 per-tool prompt contracts (12). SDK consumers calling `classifyTurn` / `compileToolsForTurn` / `dispatchToolCall` should seed off this one call instead of registering policies / recipes / contracts manually.
35
- - **Per-tool cost + permission**: `getToolCostMetadata(toolName)` returns `{ costClass, riskLevel, userVisibleCost, description }`; `getToolPermission(toolName)` returns the typed `ToolPermissionDecision` (`allow` / `require_user_approval` / `require_explicit_intent`). SDK consumers can use these for client-side billing UX or for enforcing destructive-tool gates in their own agent loop (chat + hosted both enforce `require_explicit_intent` via shared `EXPLICIT_INTENT_PATTERNS`).
36
- - **Replay record schema**: `RunRecord` (schema v2; `skills_loaded` dropped after the 2026-05-10 skill-loader retirement), `redactRunRecord`, `emptyRunRecord`, plus the canonical `RunRecordToolCall` / `RunRecordToolResult` / `RunRecordRound` / `RunRecordAuditResult` shapes. SDK consumers that emit their own RunRecord (instead of relying on sogni-chat) should call `redactRunRecord` defense-in-depth before persisting / posting. The chat product writes records to sogni-api's `POST /v1/replay/records` ingest endpoint; SDK consumers can POST the same shape to the same endpoint with their api-key auth.
37
+ - `sogni.chat.completions.create()` maps to socket-native chat completions and supports text, streaming, vision input, custom function tools, Sogni tool injection, structured outputs, and `think` / `taskProfile` controls.
38
+ - `sogni.chat.hosted.create()` maps to `POST /v1/chat/completions`, the OpenAI-compatible REST chat endpoint. It can execute Sogni media-generation and composition tools server-side.
39
+ - `sogni.chat.runs` maps to `/v1/chat/runs`, a durable hosted-chat turn with persisted state, event replay, cancellation, and recovery across client disconnects.
40
+ - `sogni.workflows` maps to `/v1/creative-agent/workflows`, where callers submit exact multi-step creative plans and observe durable execution through snapshots, event logs, or SSE.
41
+ - `sogni.workflows.templates` maps to `/v1/creative-agent/workflows/templates`, the CRUD and fork API for saved, parameterized workflow recipes.
42
+ - `sogni.replay` maps to `/v1/replay/records`, the RunRecord write/list/get surface for replay viewers and audit tooling.
43
+
44
+ Public chat and workflow media rules:
45
+
46
+ - Vision chat accepts inline PNG or JPEG `data:` URIs through OpenAI-style `image_url` content parts.
47
+ - Durable chat runs and creative workflows use retrievable HTTP(S) media references, often produced by Sogni upload/download URL helpers.
48
+ - Request media references are addressable by media index in hosted tool and workflow calls, so later steps can reuse uploaded or generated images, videos, and audio without copying URLs into prompts.
37
49
 
38
50
  ## Overview
39
51
 
40
- This is the **Sogni SDK for JavaScript/Node.js** - a TypeScript client library for the Sogni Supernet, a DePIN protocol for creative AI inference. The SDK supports image generation (Stable Diffusion, Flux, etc.), video generation (WAN 2.2 and LTX-2.3 models), audio generation (ACE-Step 1.5), LLM chat with tool calling, and multimodal vision chat (Qwen3.6 35B VLM, default `qwen3.6-35b-a3b-gguf-iq4xs`) via WebSocket communication.
52
+ This is the **Sogni SDK for JavaScript/Node.js** - a TypeScript client library for the Sogni Supernet, a DePIN protocol for creative AI inference. The SDK supports image generation (Stable Diffusion, Flux, Z-Image, Qwen image-edit models, GPT Image 2), video generation (WAN 2.2, LTX-2.3, Seedance 2.0), audio generation (ACE-Step 1.5), LLM chat with tool calling, hosted creative tools, durable creative workflows, replay records, and multimodal vision chat (Qwen3.6 35B VLM, default `qwen3.6-35b-a3b-gguf-iq4xs`).
53
+
54
+ Runtime and packaging:
55
+
56
+ - Node.js `>=22` is required by `package.json`.
57
+ - CommonJS build: `dist/index.js`; ESM build: `dist-esm/index.js`; type declarations: `dist/index.d.ts`.
58
+ - Published package files include `README.md`, `AGENTS.md`, `llms.txt`, `llms-full.txt`, `dist/`, `dist-esm/`, and `src/`.
41
59
 
42
60
  ## Build & Development Commands
43
61
 
@@ -54,10 +72,26 @@ npm run prettier:fix
54
72
  # Check formatting
55
73
  npm run prettier
56
74
 
75
+ # Validate generated hosted-tool validation file is in sync
76
+ npm run check:hosted-tool-validation
77
+
78
+ # Validate generated hosted-tool manifest is in sync
79
+ npm run check:hosted-tools-manifest
80
+
81
+ # Build and run chat model-routing checks
82
+ npm run test:chat-routing
83
+
57
84
  # Generate API documentation
58
85
  npm run docs
59
86
  ```
60
87
 
88
+ Generated artifacts:
89
+
90
+ - `src/Chat/sogniHostedTools.generated.json` is regenerated with `npm run sync:hosted-tools-manifest`.
91
+ - `src/Chat/hostedToolValidation.generated.ts` is regenerated with `npm run sync:hosted-tool-validation`.
92
+ - `docs/` is generated by TypeDoc via `npm run docs`.
93
+ - `dist/` and `dist-esm/` are generated by `npm run build`.
94
+
61
95
  ## Architecture
62
96
 
63
97
  ### Entry Point & Main Classes
@@ -71,8 +105,10 @@ npm run docs
71
105
  - `chat.hosted.create` - Hosted synchronous chat via `/v1/chat/completions`
72
106
  - `chat.runs.{create, get, cancel, streamEvents}` - Durable hosted chat runs via `/v1/chat/runs` with SSE replay
73
107
  - `chat.tools` - Tool helpers (build, parse, validate)
74
- - `creativeWorkflows: CreativeWorkflowsApi` - Durable explicit creative workflows via `/v1/creative-agent/workflows`
75
- - `workflows: CreativeWorkflowsApi` - Flat alias of `creativeWorkflows` for shorter call sites
108
+ - `workflows: CreativeWorkflowsApi` - Durable explicit creative workflows via `/v1/creative-agent/workflows`
109
+ - `workflows.{start, list, get, events, streamEvents, resume, reseed, cancel}`
110
+ - `workflows.templates.{list, get, create, update, delete, fork}`
111
+ - `replay: ReplayApi` - RunRecord write/list/get via `/v1/replay/records`
76
112
  - `apiClient: ApiClient` - Internal REST + WebSocket communication
77
113
 
78
114
  ### Core Entity Hierarchy
@@ -100,6 +136,9 @@ src/
100
136
  │ └── utils/ # Samplers, schedulers
101
137
  ├── Account/ # User auth & balance (CurrentAccount entity)
102
138
  ├── Stats/ # Leaderboard API
139
+ ├── Chat/ # Socket chat, hosted REST chat, durable runs, hosted tools
140
+ ├── CreativeWorkflows/ # Durable explicit workflow API + template CRUD
141
+ ├── Replay/ # RunRecord ingest/list/get API
103
142
  ├── lib/ # Shared utilities
104
143
  │ ├── AuthManager/ # Token/Cookie auth strategies
105
144
  │ ├── DataEntity.ts # Base reactive entity
@@ -121,6 +160,19 @@ src/
121
160
  2. Server sends `jobState`, `jobProgress`, `jobResult` events → Updates Project/Job entities
122
161
  3. Entities emit events → User code receives 'progress', 'completed', 'failed'
123
162
 
163
+ LLM chat flow:
164
+
165
+ 1. User calls `sogni.chat.completions.create()` → SDK sends `llmJobRequest` via WebSocket.
166
+ 2. Server streams `jobTokens` and terminal `llmJobResult` / `llmJobError` events.
167
+ 3. Streaming callers iterate `ChatStream`; non-streaming callers receive `ChatCompletionResult`.
168
+ 4. Hosted REST chat uses `sogni.chat.hosted.create()`; durable chat runs use `sogni.chat.runs`.
169
+
170
+ Durable workflow flow:
171
+
172
+ 1. User calls `sogni.workflows.start()` with either an inline `input` plan or `workflowId` + `inputs`.
173
+ 2. REST API persists the workflow and returns a `CreativeWorkflowRecord`.
174
+ 3. Callers inspect `get()` / `events()` or consume `streamEvents()` with SSE resume support.
175
+
124
176
  ### Network Types
125
177
 
126
178
  - `fast` - High-end GPUs, faster but more expensive. Required for video generation.
@@ -139,9 +191,9 @@ The SDK supports two families of video models with **fundamentally different FPS
139
191
  - **Frame step constraint**: Frame count must follow pattern `1 + n*8` (i.e., 1, 9, 17, 25, 33, ...)
140
192
  - Example: 5 seconds at 24fps = 121 frames (snapped to 1 + 15*8 = 121)
141
193
 
142
- ### Legacy Behavior (WAN 2.2 only)
194
+ ### WAN 2.2 Behavior
143
195
 
144
- **WAN 2.2 Models (`wan_v2.2-*`)** are the outlier with legacy behavior:
196
+ **WAN 2.2 Models (`wan_v2.2-*`)** use a fixed internal generation rate:
145
197
  - **Always generate at 16fps internally**, regardless of the user's fps setting
146
198
  - The `fps` parameter (16 or 32) controls **post-render frame interpolation only**
147
199
  - `fps=16`: No interpolation, output matches generation (16fps)
@@ -251,7 +303,7 @@ const urls = await project.waitForCompletion();
251
303
 
252
304
  The SDK receives `LLMModelInfo` per model including `maxContextLength`, `maxOutputTokens` (min/max/default), and parameter constraints. Use these to configure `max_tokens` and display limits to users.
253
305
 
254
- **Caution**: `maxContextLength` from the server may not reflect the actual per-request limit on the worker (see sogni-socket and sogni-llm-nvidia CLAUDE.md for the llama-server `--parallel` slot division issue).
306
+ Use the returned model constraints as request guidance, and prefer each model's advertised `maxOutputTokens.default` when a caller has not chosen `max_tokens`.
255
307
 
256
308
  ### Thinking Models (Qwen3.x) — `chat_template_kwargs`
257
309
 
@@ -262,7 +314,7 @@ Thinking mode is controlled via llama.cpp's `chat_template_kwargs: { enable_thin
262
314
 
263
315
  The llama-server should run with default `--reasoning-budget -1` (unrestricted) so per-request control works.
264
316
 
265
- Qwen3.x models generate thinking output in a separate `reasoning_content` field (OpenAI-compatible). The LLM worker wraps this in `<think>` tags inside `content` for the SDK. The SDK's `ChatCompletionChunk` type has NO `reasoning_content` field — only `content` and `tool_calls`.
317
+ `ChatCompletionChunk` exposes generated text through `content` and tool invocations through optional `tool_calls`.
266
318
 
267
319
  **The solution for structured output**: Use **tool calling** (`tools` + `tool_choice: 'required'`). Tool call arguments are always forwarded by the worker regardless of thinking mode. The `workflow_text_chat_sogni_tools.mjs` example uses this pattern for all composition pipelines (video/image/audio prompt engineering).
268
320
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [4.2.0-alpha.26](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.25...v4.2.0-alpha.26) (2026-05-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * add replay records API ([ef98975](https://github.com/Sogni-AI/sogni-client/commit/ef98975a618523e23799aa28ab292609cbe32de6))
7
+
1
8
  # [4.2.0-alpha.25](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.24...v4.2.0-alpha.25) (2026-05-15)
2
9
 
3
10
 
package/README.md CHANGED
@@ -851,24 +851,24 @@ const response = await sogni.chat.completions.create({
851
851
 
852
852
  ### Sogni Platform Tools — Generate Media via Chat
853
853
 
854
- Combine LLM intelligence with Sogni's media generation capabilities. The SDK exposes the full canonical hosted creative-tool surface — mirrored from `@sogni/creative-agent` — through `SogniTools.all` (22 tools):
854
+ Combine LLM intelligence with Sogni's media generation capabilities. The SDK exposes the full canonical hosted creative-tool surface through `SogniTools.all` (24 tools):
855
855
 
856
856
  - **Generation** — `generate_image`, `edit_image`, `generate_video`, `sound_to_video`, `video_to_video`, `generate_music`
857
857
  - **Image adapters** — `restore_photo`, `apply_style`, `refine_result`, `change_angle`, `animate_photo` (image-to-video with multi-source fan-out)
858
858
  - **Video composition / post-production** — `stitch_video`, `orbit_video`, `dance_montage`, `extend_video`, `replace_video_segment`, `overlay_video`, `add_subtitles`
859
- - **Synchronous composition** — `enhance_prompt`, `compose_script`, `compose_lyrics`, `compose_instrumental`
859
+ - **Synchronous composition and planning** — `enhance_prompt`, `compose_script`, `compose_lyrics`, `compose_instrumental`, `compose_workflow`, `compose_workflow_template`
860
860
 
861
861
  Pass `SogniTools.all` (or individual definitions like `generateImageTool`, `animatePhotoTool`, `composeScriptTool`) to an LLM via the `tools` parameter, then route tool calls through `sogni.chat.hosted.create()` / `sogni.chat.runs.create()` for server-side execution. Generated artifacts are threaded through a per-request media context so later rounds can reference earlier outputs by index (`sourceImageIndex`, `videoIndices`, `audioIndex`, etc.).
862
862
 
863
- For direct `/v1/chat/completions` hosted-tool execution, media-bearing tool arguments are intentionally constrained to inline `data:` URIs so the chat API remains OpenAI-compatible and does not implicitly fetch arbitrary user URLs. For user-uploaded image/audio/video inputs, use the SDK video project examples or the `sogni.creativeWorkflows` wrapper for `/v1/creative-agent/workflows`; these run outside the chat tool-selection loop and can consume HTTPS artifact URLs produced by Sogni's upload endpoints. Durable workflows validate explicit steps before the workflow starts and can bind SDK request-level `mediaReferences` into tool arguments with `sourceStepId: "$input_media"`.
863
+ For direct `/v1/chat/completions` hosted-tool execution, media-bearing tool arguments use inline `data:` URIs. For user-uploaded image/audio/video inputs, use the SDK video project examples or the `sogni.workflows` wrapper for `/v1/creative-agent/workflows`; these can consume HTTPS artifact URLs produced by Sogni's upload endpoints. Durable workflows validate explicit steps before the workflow starts and can bind SDK request-level `mediaReferences` into tool arguments with `sourceStepId: "$input_media"`.
864
864
 
865
865
  The `workflow_text_chat_sogni_tools.mjs` example demonstrates the core text-to-image, text-to-video, and text-to-music composition flows. Dedicated workflow examples like `workflow_image_edit.mjs`, `workflow_sound_to_video.mjs`, and `workflow_video_to_video.mjs` cover the asset-backed workflows directly.
866
866
 
867
867
  ### Hosted Tool Surfaces — `sogni_tools` parameter
868
868
 
869
- `sogni.chat.hosted.create()` (the SDK wrapper for `/v1/chat/completions`) can inject the canonical creative-tools surface server-side via the `sogni_tools` parameter. The default `creative-tools` value injects the full media + composition + analysis surface. `sogni_tools: "creative-agent"` adds workflow control and asset-manifest tools on top.
869
+ `sogni.chat.hosted.create()` (the SDK wrapper for `/v1/chat/completions`) can inject the canonical creative-tools surface server-side via the `sogni_tools` parameter. The default `creative-tools` value injects the full media, composition, and planning surface. `sogni_tools: "creative-agent"` adds workflow control and asset-manifest tools on top.
870
870
 
871
- Use default `sogni_tools: true` or `sogni_tools: "creative-tools"` when you want the full creative media tool surface plus synchronous composition tools: `enhance_prompt`, `compose_script`, `compose_lyrics`, and `compose_instrumental`. The legacy `"rich"` alias is still accepted and maps to `"creative-tools"`.
871
+ Use default `sogni_tools: true` or `sogni_tools: "creative-tools"` when you want the full creative media tool surface plus synchronous composition tools: `enhance_prompt`, `compose_script`, `compose_lyrics`, and `compose_instrumental`.
872
872
 
873
873
  Notable creative-tools include:
874
874
 
@@ -925,17 +925,17 @@ Guided mode defaults text-to-video to `/v1/creative-agent/workflows` so the entr
925
925
 
926
926
  ### Durable Creative Workflows (server-side)
927
927
 
928
- Long-running multi-step creative workflows can be persisted on the server and observed independently of the chat completion that started them. The SDK exposes these API-key-only endpoints through `sogni.creativeWorkflows`:
928
+ Long-running multi-step creative workflows can be persisted on the server and observed independently of the chat completion that started them. The SDK exposes these authenticated endpoints through `sogni.workflows`:
929
929
 
930
- - `sogni.creativeWorkflows.start({ input, ...options })` — start a durable workflow with an inline plan
931
- - `sogni.creativeWorkflows.start({ workflowId, inputs, ...options })` — run a saved workflow template by id
932
- - `sogni.creativeWorkflows.get(workflowId)` and `.list()` — inspect snapshots
933
- - `sogni.creativeWorkflows.events(workflowId)` — poll event history
934
- - `sogni.creativeWorkflows.streamEvents(workflowId, { after, lastEventId })` — SSE event stream with resume support
935
- - `sogni.creativeWorkflows.resume(workflowId)` — resume a workflow paused in `waiting_for_user`
936
- - `sogni.creativeWorkflows.reseed(workflowId, { seedOverrides })` — clone a completed/partial run with fresh seeds
937
- - `sogni.creativeWorkflows.cancel(workflowId)` — cooperative cancellation
938
- - `sogni.creativeWorkflows.templates.{list, get, create, update, delete, fork}` — CRUD + fork for the saved workflow templates backing `start({ workflowId })`. Also available as `sogni.workflows.templates`.
930
+ - `sogni.workflows.start({ input, ...options })` — start a durable workflow with an inline plan
931
+ - `sogni.workflows.start({ workflowId, inputs, ...options })` — run a saved workflow template by id
932
+ - `sogni.workflows.get(workflowId)` and `.list()` — inspect snapshots
933
+ - `sogni.workflows.events(workflowId)` — poll event history
934
+ - `sogni.workflows.streamEvents(workflowId, { after, lastEventId })` — SSE event stream with resume support
935
+ - `sogni.workflows.resume(workflowId)` — resume a workflow paused in `waiting_for_user`
936
+ - `sogni.workflows.reseed(workflowId, { seedOverrides })` — clone a completed/partial run with fresh seeds
937
+ - `sogni.workflows.cancel(workflowId)` — cooperative cancellation
938
+ - `sogni.workflows.templates.{list, get, create, update, delete, fork}` — CRUD + fork for the saved workflow templates backing `start({ workflowId })`.
939
939
 
940
940
  `start()` accepts exact hosted-tool steps plus optional request-level `mediaReferences`. The SDK follows the platform camelCase style (`mediaReferences`, `tokenType`, `maxEstimatedCapacityUnits`, and `confirmCost`) and serializes the REST request to snake_case internally. A dependency with `sourceStepId: "$input_media"` can inject the matching uploaded image, video, or audio URL or index into a later step. The API validates step arguments before accepting the workflow and again before each execution step, so shape errors fail before billing later media work.
941
941
 
@@ -946,7 +946,7 @@ const sogni = await SogniClient.createInstance({
946
946
  disableSocket: true
947
947
  });
948
948
 
949
- const workflow = await sogni.creativeWorkflows.start({
949
+ const workflow = await sogni.workflows.start({
950
950
  tokenType: 'spark',
951
951
  input: {
952
952
  title: 'Generated keyframe to video',
@@ -980,7 +980,7 @@ const workflow = await sogni.creativeWorkflows.start({
980
980
  },
981
981
  });
982
982
 
983
- for await (const event of sogni.creativeWorkflows.streamEvents(workflow.workflowId)) {
983
+ for await (const event of sogni.workflows.streamEvents(workflow.workflowId)) {
984
984
  console.log(event.event, event.data);
985
985
  }
986
986
  ```
@@ -1064,7 +1064,7 @@ This SDK provides documentation optimized for AI coding assistants like Claude C
1064
1064
  | ---------------------------------- | ------------------------------------------------------- |
1065
1065
  | [`llms.txt`](./llms.txt) | Indexed quick reference with code examples |
1066
1066
  | [`llms-full.txt`](./llms-full.txt) | Comprehensive documentation with complete API reference |
1067
- | [`CLAUDE.md`](./CLAUDE.md) | Claude Code-specific guidance and project context |
1067
+ | [`AGENTS.md`](./AGENTS.md) | Public guidance and project context for coding agents |
1068
1068
 
1069
1069
  These files follow the [llms.txt convention](https://llmstxt.org/) for LLM-friendly documentation.
1070
1070
 
@@ -1075,7 +1075,7 @@ When helping users generate images, videos, or use LLM features with Sogni:
1075
1075
  1. **Image generation**: Use `type: 'image'` with models like `flux1-schnell-fp8`
1076
1076
  2. **Video generation**: Use `type: 'video'` with `network: 'fast'` (required)
1077
1077
  3. **Audio generation**: Use `type: 'audio'` with ACE-Step 1.5 models
1078
- 4. **LLM text chat**: Use `sogni.projects.chatCompletion()` for text generation with streaming and tool calling
1078
+ 4. **LLM text chat**: Use `sogni.chat.completions.create()` for text generation with streaming and tool calling
1079
1079
  5. **Sogni Platform Tools**: Combine LLM tool calling with Sogni media generation to create images, image edits, videos, audio-driven videos, video transforms, and music from natural language
1080
1080
  6. **Vision chat**: Use `qwen3.6-35b-a3b-gguf-iq4xs` VLM for multimodal image understanding with `image_url` content parts carrying inline base64 JPEG/PNG `data:` URIs. Vision requests allow up to 20 images, 10MB each, with longest side capped at 1024px. This 1024px dimension cap applies only to the vision `image_url` path, not to media-generation tool image inputs.
1081
1081
  7. **WAN 2.2, LTX-2.3, and Seedance**: These video families have different duration/FPS behaviors - see `llms-full.txt` for details
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Replay records (`/v1/replay/records`).
3
+ *
4
+ * Phase-4 RunRecord ingestion + read. Producers (chat sessions, harness
5
+ * runs) `write(record)` one RunRecord per turn; consumers (the replay
6
+ * viewer, audit tooling) `list()` and `get(runId)` to inspect them.
7
+ *
8
+ * Auth: piggybacks on the SDK's active AuthManager (JWT for signed-in
9
+ * accounts, api-key for programmatic callers). The api enforces
10
+ * per-owner isolation via the resolved wallet address — callers can
11
+ * only see their own records.
12
+ *
13
+ * Errors are mapped to `ApiError` with the api's `errorCode`/`message`
14
+ * when present; HTTP 4xx on read becomes a thrown error so the caller
15
+ * can branch on status without parsing strings.
16
+ */
17
+ import ApiGroup, { ApiConfig } from '../ApiGroup';
18
+ import { GetReplayRecordResult, ListReplayRecordsOptions, ListReplayRecordsResult, ReplayRequestOptions, ReplayWriteResult, RunRecord } from './types';
19
+ declare class ReplayApi extends ApiGroup {
20
+ constructor(config: ApiConfig);
21
+ /**
22
+ * POST /v1/replay/records — ingest one RunRecord. The api re-runs the
23
+ * redaction pass server-side as defense-in-depth, so the returned
24
+ * `redacted` flag reflects what was actually stored.
25
+ */
26
+ write(record: RunRecord, options?: ReplayRequestOptions): Promise<ReplayWriteResult>;
27
+ /**
28
+ * GET /v1/replay/records — paginated summary view for the caller's
29
+ * own records. `limit` caps results (api defaults apply when omitted).
30
+ */
31
+ list(options?: ListReplayRecordsOptions): Promise<ListReplayRecordsResult>;
32
+ /** GET /v1/replay/records/:id — full RunRecord for the viewer detail. */
33
+ get(runId: string, options?: ReplayRequestOptions): Promise<GetReplayRecordResult>;
34
+ private request;
35
+ private fetch;
36
+ private toApiError;
37
+ }
38
+ export default ReplayApi;
39
+ export * from './types';
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ /**
3
+ * Replay records (`/v1/replay/records`).
4
+ *
5
+ * Phase-4 RunRecord ingestion + read. Producers (chat sessions, harness
6
+ * runs) `write(record)` one RunRecord per turn; consumers (the replay
7
+ * viewer, audit tooling) `list()` and `get(runId)` to inspect them.
8
+ *
9
+ * Auth: piggybacks on the SDK's active AuthManager (JWT for signed-in
10
+ * accounts, api-key for programmatic callers). The api enforces
11
+ * per-owner isolation via the resolved wallet address — callers can
12
+ * only see their own records.
13
+ *
14
+ * Errors are mapped to `ApiError` with the api's `errorCode`/`message`
15
+ * when present; HTTP 4xx on read becomes a thrown error so the caller
16
+ * can branch on status without parsing strings.
17
+ */
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
+ };
32
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
34
+ return new (P || (P = Promise))(function (resolve, reject) {
35
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
36
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
37
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
38
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
39
+ });
40
+ };
41
+ var __importDefault = (this && this.__importDefault) || function (mod) {
42
+ return (mod && mod.__esModule) ? mod : { "default": mod };
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ const ApiGroup_1 = __importDefault(require("../ApiGroup"));
46
+ const ApiClient_1 = require("../ApiClient");
47
+ function parseJsonResponse(text) {
48
+ if (!text)
49
+ return {};
50
+ try {
51
+ return JSON.parse(text);
52
+ }
53
+ catch (_a) {
54
+ return { status: 'error', message: text, errorCode: 0 };
55
+ }
56
+ }
57
+ class ReplayApi extends ApiGroup_1.default {
58
+ constructor(config) {
59
+ super(config);
60
+ }
61
+ /**
62
+ * POST /v1/replay/records — ingest one RunRecord. The api re-runs the
63
+ * redaction pass server-side as defense-in-depth, so the returned
64
+ * `redacted` flag reflects what was actually stored.
65
+ */
66
+ write(record_1) {
67
+ return __awaiter(this, arguments, void 0, function* (record, options = {}) {
68
+ var _a;
69
+ const body = yield this.request('/v1/replay/records', {
70
+ method: 'POST',
71
+ headers: { 'Content-Type': 'application/json' },
72
+ body: JSON.stringify(record),
73
+ signal: options.signal
74
+ });
75
+ if (typeof body.runId !== 'string') {
76
+ throw new ApiClient_1.ApiError(500, {
77
+ status: 'error',
78
+ message: 'Replay write response missing runId',
79
+ errorCode: 0
80
+ });
81
+ }
82
+ return {
83
+ runId: body.runId,
84
+ schemaVersion: (_a = body.schemaVersion) !== null && _a !== void 0 ? _a : 0,
85
+ redacted: body.redacted === true,
86
+ createTime: typeof body.createTime === 'number' ? body.createTime : 0,
87
+ updateTime: typeof body.updateTime === 'number' ? body.updateTime : 0
88
+ };
89
+ });
90
+ }
91
+ /**
92
+ * GET /v1/replay/records — paginated summary view for the caller's
93
+ * own records. `limit` caps results (api defaults apply when omitted).
94
+ */
95
+ list() {
96
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
97
+ const query = new URLSearchParams();
98
+ if (typeof options.limit === 'number' && options.limit > 0) {
99
+ query.set('limit', String(Math.floor(options.limit)));
100
+ }
101
+ const path = query.toString()
102
+ ? `/v1/replay/records?${query.toString()}`
103
+ : '/v1/replay/records';
104
+ const body = yield this.request(path, {
105
+ method: 'GET',
106
+ signal: options.signal
107
+ });
108
+ const records = Array.isArray(body.records) ? body.records : [];
109
+ return { records };
110
+ });
111
+ }
112
+ /** GET /v1/replay/records/:id — full RunRecord for the viewer detail. */
113
+ get(runId_1) {
114
+ return __awaiter(this, arguments, void 0, function* (runId, options = {}) {
115
+ const body = yield this.request(`/v1/replay/records/${encodeURIComponent(runId)}`, { method: 'GET', signal: options.signal });
116
+ if (!body.record || typeof body.record !== 'object') {
117
+ throw new ApiClient_1.ApiError(500, {
118
+ status: 'error',
119
+ message: 'Replay get response missing record field',
120
+ errorCode: 0
121
+ });
122
+ }
123
+ return {
124
+ record: body.record,
125
+ createTime: typeof body.createTime === 'number' ? body.createTime : 0
126
+ };
127
+ });
128
+ }
129
+ request(path_1) {
130
+ return __awaiter(this, arguments, void 0, function* (path, options = {}) {
131
+ const response = yield this.fetch(path, options);
132
+ if (!response.ok) {
133
+ throw yield this.toApiError(response);
134
+ }
135
+ const text = yield response.text();
136
+ return parseJsonResponse(text);
137
+ });
138
+ }
139
+ fetch(path_1) {
140
+ return __awaiter(this, arguments, void 0, function* (path, options = {}) {
141
+ const url = new URL(path, this.client.rest.baseUrl).toString();
142
+ const authenticated = yield this.client.auth.authenticateRequest(options);
143
+ return fetch(url, authenticated);
144
+ });
145
+ }
146
+ toApiError(response) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ if (response.status === 401 && this.client.auth.isAuthenticated) {
149
+ this.client.auth.clear();
150
+ }
151
+ const body = parseJsonResponse(yield response.text());
152
+ const payload = body.status === 'error' ? body : body;
153
+ const message = typeof payload.message === 'string' ? payload.message : response.statusText;
154
+ const errorCode = typeof payload.errorCode === 'number' ? payload.errorCode : 0;
155
+ return new ApiClient_1.ApiError(response.status, { status: 'error', message, errorCode });
156
+ });
157
+ }
158
+ }
159
+ exports.default = ReplayApi;
160
+ __exportStar(require("./types"), exports);
161
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Replay/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2DAAkD;AAClD,4CAAwC;AA4BxC,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC;IAC5C,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IAC1D,CAAC;AACH,CAAC;AAED,MAAM,SAAU,SAAQ,kBAAQ;IAC9B,YAAY,MAAiB;QAC3B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACG,KAAK;6DACT,MAAiB,EACjB,UAAgC,EAAE;;YAElC,MAAM,IAAI,GAAG,MAAM,IAAI,CAA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CAAC,CAAC,CAAC;YAChF,OAAO,IAAI,oBAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;QAChF,CAAC;KAAA;CACF;AAED,kBAAe,SAAS,CAAC;AACzB,0CAAwB"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Replay record types — mirrors the api `/v1/replay/records` shape.
3
+ *
4
+ * `RunRecord` is the full Phase-4 RunRecord schema. Producers serialize
5
+ * one per chat turn; consumers (the replay viewer, harness fixtures)
6
+ * read them back. The SDK keeps a structural type with the well-known
7
+ * envelope fields typed and the rest as `unknown` so callers that hold
8
+ * the richer canonical type (e.g. `@sogni/creative-agent/replay`) can
9
+ * cast safely without the SDK needing that dependency.
10
+ */
11
+ /**
12
+ * RunRecord shape, kept minimal so callers that hold the richer
13
+ * canonical type (e.g. `RunRecord` from `@sogni/creative-agent`) pass
14
+ * directly without casting. No index signature — adding one would
15
+ * force callers to widen typed properties to `unknown` to match.
16
+ */
17
+ export interface RunRecord {
18
+ run_id: string;
19
+ schema_version?: number | string;
20
+ session_id?: string;
21
+ account_id?: string;
22
+ model_id?: string;
23
+ rounds?: ReadonlyArray<unknown>;
24
+ user_request?: string;
25
+ final_response?: unknown;
26
+ }
27
+ export interface ReplayWriteResult {
28
+ runId: string;
29
+ schemaVersion: number | string;
30
+ redacted: boolean;
31
+ createTime: number;
32
+ updateTime: number;
33
+ }
34
+ export interface ReplayRecordSummary {
35
+ runId: string;
36
+ schemaVersion: number | string;
37
+ createTime: number;
38
+ updateTime: number;
39
+ userRequest?: string;
40
+ finalResponse?: unknown;
41
+ modelId?: string;
42
+ rounds: number;
43
+ }
44
+ export interface ListReplayRecordsOptions {
45
+ limit?: number;
46
+ signal?: AbortSignal;
47
+ }
48
+ export interface ListReplayRecordsResult {
49
+ records: ReplayRecordSummary[];
50
+ }
51
+ export interface GetReplayRecordResult {
52
+ record: RunRecord;
53
+ createTime: number;
54
+ }
55
+ export interface ReplayRequestOptions {
56
+ signal?: AbortSignal;
57
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Replay record types — mirrors the api `/v1/replay/records` shape.
4
+ *
5
+ * `RunRecord` is the full Phase-4 RunRecord schema. Producers serialize
6
+ * one per chat turn; consumers (the replay viewer, harness fixtures)
7
+ * read them back. The SDK keeps a structural type with the well-known
8
+ * envelope fields typed and the rest as `unknown` so callers that hold
9
+ * the richer canonical type (e.g. `@sogni/creative-agent/replay`) can
10
+ * cast safely without the SDK needing that dependency.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/Replay/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
package/dist/index.d.ts CHANGED
@@ -20,11 +20,13 @@ import CreativeWorkflowTemplatesApi from './CreativeWorkflows/Templates';
20
20
  import { CreativeWorkflowArtifact, CreativeWorkflowEvent, CreativeWorkflowRecord, CreativeWorkflowSseEvent, CreativeWorkflowStatus, CreativeWorkflowHostedToolName, ListCreativeWorkflowOptions, ReseedCreativeWorkflowOptions, ReseedCreativeWorkflowParams, ReseedCreativeWorkflowResult, ResumeCreativeWorkflowOptions, ResumeCreativeWorkflowParams, ResumeCreativeWorkflowResult, StartCreativeWorkflowOptions, StartCreativeWorkflowParams, StartCreativeWorkflowDependency, StartCreativeWorkflowInput, StartCreativeWorkflowStep, StreamCreativeWorkflowEventsOptions } from './CreativeWorkflows/types';
21
21
  import { ForkWorkflowTemplateBody, ListWorkflowTemplatesOptions, ListWorkflowTemplatesResult, WorkflowTemplate, WorkflowTemplateAuthor, WorkflowTemplateRequestOptions, WorkflowTemplateStability, WorkflowTemplateVisibility, WorkflowTemplateVisibilityFilter } from './CreativeWorkflows/Templates/types';
22
22
  import StatsApi from './Stats';
23
+ import ReplayApi from './Replay';
24
+ import { GetReplayRecordResult, ListReplayRecordsOptions, ListReplayRecordsResult, ReplayRecordSummary, ReplayRequestOptions, ReplayWriteResult, RunRecord } from './Replay/types';
23
25
  import ErrorData from './types/ErrorData';
24
26
  import { TokenType } from './types/token';
25
27
  import { ApiKeyAuthManager, TokenAuthData } from './lib/AuthManager';
26
- export type { AudioFormat, AudioOutputFormat, AudioProjectParams, AvailableModel, ChatCompletionChunk, ChatCompletionParams, ChatCompletionResult, ChatJobStateEvent, ChatMessage, ChatResponseFormat, ChatRunEvent, ChatRunRecord, ChatRunStatus, ChatTokenUsage, StartChatRunParams, StreamChatRunEventsOptions, ContentPart, HostedChatCompletionChoice, HostedChatCompletionMessage, HostedChatCompletionParams, HostedChatCompletionResult, HostedCreativeWorkflowReference, CreativeWorkflowArtifact, CreativeWorkflowEvent, CreativeWorkflowRecord, CreativeWorkflowSseEvent, CreativeWorkflowStatus, ImageUrlContentPart, ListCreativeWorkflowOptions, LLMCostEstimation, LLMJobCost, LLMModelInfo, LLMParamConstraint, LLMSamplingDefaults, ControlNetMode, ControlNetName, ControlNetParams, TextContentPart, ErrorData, ImageProjectParams, ImageOutputFormat, JobStatus, Logger, LogLevel, ProjectParams, ProjectStatus, CreativeWorkflowHostedToolName, StartCreativeWorkflowOptions, StartCreativeWorkflowParams, StartCreativeWorkflowDependency, StartCreativeWorkflowInput, StartCreativeWorkflowStep, StreamCreativeWorkflowEventsOptions, ResumeCreativeWorkflowOptions, ResumeCreativeWorkflowParams, ResumeCreativeWorkflowResult, ReseedCreativeWorkflowOptions, ReseedCreativeWorkflowParams, ReseedCreativeWorkflowResult, ForkWorkflowTemplateBody, ListWorkflowTemplatesOptions, ListWorkflowTemplatesResult, WorkflowTemplate, WorkflowTemplateAuthor, WorkflowTemplateRequestOptions, WorkflowTemplateStability, WorkflowTemplateVisibility, WorkflowTemplateVisibilityFilter, SupernetType, TokenType, ToolCall, ToolCallDelta, ToolCallFunction, ToolChoice, ToolDefinition, ToolExecutionOptions, ToolExecutionProgress, ToolExecutionResult, ToolFunction, ToolHistoryEntry, SogniToolsMode, SocketEventName, SocketEventSubscriptionInput, SocketEventSubscriptionName, SocketEventSubscriptions, SocketEventSubscriptionsUpdatedData, SocketEventSubscriptionUpdate, VideoControlNetName, VideoControlNetParams, VideoFormat, VideoOutputFormat, VideoProjectParams, VideoWorkflowType };
27
- export { ApiError, ApiKeyAuthManager, ChatStream, ChatToolsApi, CreativeWorkflowsApi, CreativeWorkflowTemplatesApi, CurrentAccount, Job, Project, SogniTools, buildSogniTools, isSogniToolCall, parseCreativeWorkflowSseChunk, parseToolCallArguments };
28
+ export type { AudioFormat, AudioOutputFormat, AudioProjectParams, AvailableModel, ChatCompletionChunk, ChatCompletionParams, ChatCompletionResult, ChatJobStateEvent, ChatMessage, ChatResponseFormat, ChatRunEvent, ChatRunRecord, ChatRunStatus, ChatTokenUsage, StartChatRunParams, StreamChatRunEventsOptions, ContentPart, HostedChatCompletionChoice, HostedChatCompletionMessage, HostedChatCompletionParams, HostedChatCompletionResult, HostedCreativeWorkflowReference, CreativeWorkflowArtifact, CreativeWorkflowEvent, CreativeWorkflowRecord, CreativeWorkflowSseEvent, CreativeWorkflowStatus, ImageUrlContentPart, ListCreativeWorkflowOptions, LLMCostEstimation, LLMJobCost, LLMModelInfo, LLMParamConstraint, LLMSamplingDefaults, ControlNetMode, ControlNetName, ControlNetParams, TextContentPart, ErrorData, ImageProjectParams, ImageOutputFormat, JobStatus, Logger, LogLevel, ProjectParams, ProjectStatus, CreativeWorkflowHostedToolName, StartCreativeWorkflowOptions, StartCreativeWorkflowParams, StartCreativeWorkflowDependency, StartCreativeWorkflowInput, StartCreativeWorkflowStep, StreamCreativeWorkflowEventsOptions, ResumeCreativeWorkflowOptions, ResumeCreativeWorkflowParams, ResumeCreativeWorkflowResult, ReseedCreativeWorkflowOptions, ReseedCreativeWorkflowParams, ReseedCreativeWorkflowResult, ForkWorkflowTemplateBody, ListWorkflowTemplatesOptions, ListWorkflowTemplatesResult, WorkflowTemplate, WorkflowTemplateAuthor, WorkflowTemplateRequestOptions, WorkflowTemplateStability, WorkflowTemplateVisibility, WorkflowTemplateVisibilityFilter, RunRecord, ReplayWriteResult, ReplayRecordSummary, ReplayRequestOptions, ListReplayRecordsOptions, ListReplayRecordsResult, GetReplayRecordResult, SupernetType, TokenType, ToolCall, ToolCallDelta, ToolCallFunction, ToolChoice, ToolDefinition, ToolExecutionOptions, ToolExecutionProgress, ToolExecutionResult, ToolFunction, ToolHistoryEntry, SogniToolsMode, SocketEventName, SocketEventSubscriptionInput, SocketEventSubscriptionName, SocketEventSubscriptions, SocketEventSubscriptionsUpdatedData, SocketEventSubscriptionUpdate, VideoControlNetName, VideoControlNetParams, VideoFormat, VideoOutputFormat, VideoProjectParams, VideoWorkflowType };
29
+ export { ApiError, ApiKeyAuthManager, ChatStream, ChatToolsApi, CreativeWorkflowsApi, CreativeWorkflowTemplatesApi, ReplayApi, CurrentAccount, Job, Project, SogniTools, buildSogniTools, isSogniToolCall, parseCreativeWorkflowSseChunk, parseToolCallArguments };
28
30
  export interface SogniClientConfig {
29
31
  /**
30
32
  * The application ID string. Must be unique, multiple connections with the same ID will be rejected.
@@ -127,6 +129,13 @@ export declare class SogniClient {
127
129
  * the client connected.
128
130
  */
129
131
  workflows: CreativeWorkflowsApi;
132
+ /**
133
+ * Replay records (`/v1/replay/records`). Writes one RunRecord per
134
+ * chat / harness turn and exposes list + get for the replay viewer.
135
+ * Per-owner isolation is enforced server-side via the SDK auth
136
+ * identity.
137
+ */
138
+ replay: ReplayApi;
130
139
  apiClient: ApiClient;
131
140
  private constructor();
132
141
  get currentAccount(): CurrentAccount;