@sogni-ai/sogni-client 4.2.0-alpha.24 → 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.
Files changed (44) hide show
  1. package/{CLAUDE.md → AGENTS.md} +76 -24
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +19 -15
  4. package/dist/CreativeWorkflows/Templates/index.d.ts +34 -0
  5. package/dist/CreativeWorkflows/Templates/index.js +198 -0
  6. package/dist/CreativeWorkflows/Templates/index.js.map +1 -0
  7. package/dist/CreativeWorkflows/Templates/types.d.ts +57 -0
  8. package/dist/CreativeWorkflows/Templates/types.js +11 -0
  9. package/dist/CreativeWorkflows/Templates/types.js.map +1 -0
  10. package/dist/CreativeWorkflows/index.d.ts +22 -1
  11. package/dist/CreativeWorkflows/index.js +83 -4
  12. package/dist/CreativeWorkflows/index.js.map +1 -1
  13. package/dist/CreativeWorkflows/types.d.ts +67 -1
  14. package/dist/Replay/index.d.ts +39 -0
  15. package/dist/Replay/index.js +161 -0
  16. package/dist/Replay/index.js.map +1 -0
  17. package/dist/Replay/types.d.ts +57 -0
  18. package/dist/Replay/types.js +13 -0
  19. package/dist/Replay/types.js.map +1 -0
  20. package/dist/index.d.ts +14 -3
  21. package/dist/index.js +7 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist-esm/CreativeWorkflows/Templates/index.js +179 -0
  24. package/dist-esm/CreativeWorkflows/Templates/index.js.map +1 -0
  25. package/dist-esm/CreativeWorkflows/Templates/types.js +10 -0
  26. package/dist-esm/CreativeWorkflows/Templates/types.js.map +1 -0
  27. package/dist-esm/CreativeWorkflows/index.js +83 -4
  28. package/dist-esm/CreativeWorkflows/index.js.map +1 -1
  29. package/dist-esm/Replay/index.js +142 -0
  30. package/dist-esm/Replay/index.js.map +1 -0
  31. package/dist-esm/Replay/types.js +12 -0
  32. package/dist-esm/Replay/types.js.map +1 -0
  33. package/dist-esm/index.js +5 -1
  34. package/dist-esm/index.js.map +1 -1
  35. package/llms-full.txt +180 -42
  36. package/llms.txt +32 -16
  37. package/package.json +2 -2
  38. package/src/CreativeWorkflows/Templates/index.ts +199 -0
  39. package/src/CreativeWorkflows/Templates/types.ts +56 -0
  40. package/src/CreativeWorkflows/index.ts +104 -3
  41. package/src/CreativeWorkflows/types.ts +73 -1
  42. package/src/Replay/index.ts +166 -0
  43. package/src/Replay/types.ts +64 -0
  44. package/src/index.ts +61 -0
@@ -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,17 @@
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
+
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)
9
+
10
+
11
+ ### Features
12
+
13
+ * **workflows:** add templates CRUD, resume, reseed, and template-id runs ([fbec2b7](https://github.com/Sogni-AI/sogni-client/commit/fbec2b756df10cac3455626cd314a0fdbbde5982))
14
+
1
15
  # [4.2.0-alpha.24](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.23...v4.2.0-alpha.24) (2026-05-15)
2
16
 
3
17
 
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,13 +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 explicit steps
931
- - `sogni.creativeWorkflows.get(workflowId)` and `.list()` — inspect snapshots
932
- - `sogni.creativeWorkflows.events(workflowId)` — poll event history
933
- - `sogni.creativeWorkflows.streamEvents(workflowId, { after, lastEventId })` — SSE event stream with resume support
934
- - `sogni.creativeWorkflows.cancel(workflowId)` — cooperative cancellation
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 })`.
935
939
 
936
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.
937
941
 
@@ -942,7 +946,7 @@ const sogni = await SogniClient.createInstance({
942
946
  disableSocket: true
943
947
  });
944
948
 
945
- const workflow = await sogni.creativeWorkflows.start({
949
+ const workflow = await sogni.workflows.start({
946
950
  tokenType: 'spark',
947
951
  input: {
948
952
  title: 'Generated keyframe to video',
@@ -976,7 +980,7 @@ const workflow = await sogni.creativeWorkflows.start({
976
980
  },
977
981
  });
978
982
 
979
- for await (const event of sogni.creativeWorkflows.streamEvents(workflow.workflowId)) {
983
+ for await (const event of sogni.workflows.streamEvents(workflow.workflowId)) {
980
984
  console.log(event.event, event.data);
981
985
  }
982
986
  ```
@@ -1060,7 +1064,7 @@ This SDK provides documentation optimized for AI coding assistants like Claude C
1060
1064
  | ---------------------------------- | ------------------------------------------------------- |
1061
1065
  | [`llms.txt`](./llms.txt) | Indexed quick reference with code examples |
1062
1066
  | [`llms-full.txt`](./llms-full.txt) | Comprehensive documentation with complete API reference |
1063
- | [`CLAUDE.md`](./CLAUDE.md) | Claude Code-specific guidance and project context |
1067
+ | [`AGENTS.md`](./AGENTS.md) | Public guidance and project context for coding agents |
1064
1068
 
1065
1069
  These files follow the [llms.txt convention](https://llmstxt.org/) for LLM-friendly documentation.
1066
1070
 
@@ -1071,7 +1075,7 @@ When helping users generate images, videos, or use LLM features with Sogni:
1071
1075
  1. **Image generation**: Use `type: 'image'` with models like `flux1-schnell-fp8`
1072
1076
  2. **Video generation**: Use `type: 'video'` with `network: 'fast'` (required)
1073
1077
  3. **Audio generation**: Use `type: 'audio'` with ACE-Step 1.5 models
1074
- 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
1075
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
1076
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.
1077
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,34 @@
1
+ /**
2
+ * Workflow template CRUD + fork (`/v1/creative-agent/workflows/templates`).
3
+ *
4
+ * Templates are the savable, parameterized blueprints behind workflow
5
+ * runs. This sub-group reads the api the same way `CreativeWorkflowsApi`
6
+ * reads the runs side — Bearer auth via `client.auth.authenticateRequest`,
7
+ * shared error mapping. Exposed on the SDK as
8
+ * `sogniClient.workflows.templates`.
9
+ *
10
+ * Behaviour:
11
+ * - Auth: relies on the SDK's active AuthManager (JWT or API key). No
12
+ * cookie path; if you need cookie auth, attach it via your own
13
+ * `client.auth` adapter before calling.
14
+ * - Errors: wraps non-2xx responses in `ApiError` with the api's
15
+ * `errorCode` + `message` when present.
16
+ * - Pagination: `list` returns `{ templates, nextCursor }`. Cursor is
17
+ * a numeric offset the api echoes when more results are available.
18
+ */
19
+ import ApiGroup, { ApiConfig } from '../../ApiGroup';
20
+ import { ForkWorkflowTemplateBody, ListWorkflowTemplatesOptions, ListWorkflowTemplatesResult, WorkflowTemplate, WorkflowTemplateRequestOptions } from './types';
21
+ declare class CreativeWorkflowTemplatesApi extends ApiGroup {
22
+ constructor(config: ApiConfig);
23
+ list(options?: ListWorkflowTemplatesOptions): Promise<ListWorkflowTemplatesResult>;
24
+ get(id: string, options?: WorkflowTemplateRequestOptions): Promise<WorkflowTemplate>;
25
+ create(template: WorkflowTemplate, options?: WorkflowTemplateRequestOptions): Promise<WorkflowTemplate>;
26
+ update(id: string, patch: Partial<WorkflowTemplate>, options?: WorkflowTemplateRequestOptions): Promise<WorkflowTemplate>;
27
+ delete(id: string, options?: WorkflowTemplateRequestOptions): Promise<void>;
28
+ fork(id: string, body?: ForkWorkflowTemplateBody, options?: WorkflowTemplateRequestOptions): Promise<WorkflowTemplate>;
29
+ private request;
30
+ private fetch;
31
+ private toApiError;
32
+ }
33
+ export default CreativeWorkflowTemplatesApi;
34
+ export * from './types';
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ /**
3
+ * Workflow template CRUD + fork (`/v1/creative-agent/workflows/templates`).
4
+ *
5
+ * Templates are the savable, parameterized blueprints behind workflow
6
+ * runs. This sub-group reads the api the same way `CreativeWorkflowsApi`
7
+ * reads the runs side — Bearer auth via `client.auth.authenticateRequest`,
8
+ * shared error mapping. Exposed on the SDK as
9
+ * `sogniClient.workflows.templates`.
10
+ *
11
+ * Behaviour:
12
+ * - Auth: relies on the SDK's active AuthManager (JWT or API key). No
13
+ * cookie path; if you need cookie auth, attach it via your own
14
+ * `client.auth` adapter before calling.
15
+ * - Errors: wraps non-2xx responses in `ApiError` with the api's
16
+ * `errorCode` + `message` when present.
17
+ * - Pagination: `list` returns `{ templates, nextCursor }`. Cursor is
18
+ * a numeric offset the api echoes when more results are available.
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
35
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
36
+ return new (P || (P = Promise))(function (resolve, reject) {
37
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
38
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
39
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
40
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
41
+ });
42
+ };
43
+ var __importDefault = (this && this.__importDefault) || function (mod) {
44
+ return (mod && mod.__esModule) ? mod : { "default": mod };
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ const ApiGroup_1 = __importDefault(require("../../ApiGroup"));
48
+ const ApiClient_1 = require("../../ApiClient");
49
+ function parseJsonResponse(text) {
50
+ if (!text)
51
+ return {};
52
+ try {
53
+ return JSON.parse(text);
54
+ }
55
+ catch (_a) {
56
+ return { status: 'error', message: text, errorCode: 0 };
57
+ }
58
+ }
59
+ function isWorkflowTemplate(value) {
60
+ if (!value || typeof value !== 'object')
61
+ return false;
62
+ const record = value;
63
+ return typeof record.id === 'string' && typeof record.name === 'string';
64
+ }
65
+ class CreativeWorkflowTemplatesApi extends ApiGroup_1.default {
66
+ constructor(config) {
67
+ super(config);
68
+ }
69
+ list() {
70
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
71
+ const query = new URLSearchParams();
72
+ if (options.visibility)
73
+ query.set('visibility', options.visibility);
74
+ if (typeof options.offset === 'number' && options.offset >= 0) {
75
+ query.set('offset', String(Math.floor(options.offset)));
76
+ }
77
+ if (typeof options.limit === 'number' && options.limit > 0) {
78
+ query.set('limit', String(Math.min(Math.max(Math.floor(options.limit), 1), 200)));
79
+ }
80
+ const path = query.toString()
81
+ ? `/v1/creative-agent/workflows/templates?${query.toString()}`
82
+ : '/v1/creative-agent/workflows/templates';
83
+ const body = yield this.request(path, { method: 'GET', signal: options.signal });
84
+ const templates = Array.isArray(body.templates)
85
+ ? body.templates.filter(isWorkflowTemplate)
86
+ : [];
87
+ const nextCursor = typeof body.nextCursor === 'number' ? body.nextCursor : null;
88
+ return { templates, nextCursor };
89
+ });
90
+ }
91
+ get(id_1) {
92
+ return __awaiter(this, arguments, void 0, function* (id, options = {}) {
93
+ const body = yield this.request(`/v1/creative-agent/workflows/templates/${encodeURIComponent(id)}`, { method: 'GET', signal: options.signal });
94
+ if (!isWorkflowTemplate(body.template)) {
95
+ throw new ApiClient_1.ApiError(500, {
96
+ status: 'error',
97
+ message: 'Workflow template response missing template field',
98
+ errorCode: 0
99
+ });
100
+ }
101
+ return body.template;
102
+ });
103
+ }
104
+ create(template_1) {
105
+ return __awaiter(this, arguments, void 0, function* (template, options = {}) {
106
+ const body = yield this.request('/v1/creative-agent/workflows/templates', {
107
+ method: 'POST',
108
+ headers: { 'Content-Type': 'application/json' },
109
+ body: JSON.stringify(template),
110
+ signal: options.signal
111
+ });
112
+ if (!isWorkflowTemplate(body.template)) {
113
+ throw new ApiClient_1.ApiError(500, {
114
+ status: 'error',
115
+ message: 'Workflow template create response missing template field',
116
+ errorCode: 0
117
+ });
118
+ }
119
+ return body.template;
120
+ });
121
+ }
122
+ update(id_1, patch_1) {
123
+ return __awaiter(this, arguments, void 0, function* (id, patch, options = {}) {
124
+ const body = yield this.request(`/v1/creative-agent/workflows/templates/${encodeURIComponent(id)}`, {
125
+ method: 'PATCH',
126
+ headers: { 'Content-Type': 'application/json' },
127
+ body: JSON.stringify(patch),
128
+ signal: options.signal
129
+ });
130
+ if (!isWorkflowTemplate(body.template)) {
131
+ throw new ApiClient_1.ApiError(500, {
132
+ status: 'error',
133
+ message: 'Workflow template update response missing template field',
134
+ errorCode: 0
135
+ });
136
+ }
137
+ return body.template;
138
+ });
139
+ }
140
+ delete(id_1) {
141
+ return __awaiter(this, arguments, void 0, function* (id, options = {}) {
142
+ yield this.request(`/v1/creative-agent/workflows/templates/${encodeURIComponent(id)}`, {
143
+ method: 'DELETE',
144
+ signal: options.signal
145
+ });
146
+ });
147
+ }
148
+ fork(id_1) {
149
+ return __awaiter(this, arguments, void 0, function* (id, body = {}, options = {}) {
150
+ const response = yield this.request(`/v1/creative-agent/workflows/templates/${encodeURIComponent(id)}/fork`, {
151
+ method: 'POST',
152
+ headers: { 'Content-Type': 'application/json' },
153
+ body: JSON.stringify(body),
154
+ signal: options.signal
155
+ });
156
+ if (!isWorkflowTemplate(response.template)) {
157
+ throw new ApiClient_1.ApiError(500, {
158
+ status: 'error',
159
+ message: 'Workflow template fork response missing template field',
160
+ errorCode: 0
161
+ });
162
+ }
163
+ return response.template;
164
+ });
165
+ }
166
+ request(path_1) {
167
+ return __awaiter(this, arguments, void 0, function* (path, options = {}) {
168
+ const response = yield this.fetch(path, options);
169
+ if (!response.ok) {
170
+ throw yield this.toApiError(response);
171
+ }
172
+ const text = yield response.text();
173
+ return parseJsonResponse(text);
174
+ });
175
+ }
176
+ fetch(path_1) {
177
+ return __awaiter(this, arguments, void 0, function* (path, options = {}) {
178
+ const url = new URL(path, this.client.rest.baseUrl).toString();
179
+ const authenticated = yield this.client.auth.authenticateRequest(options);
180
+ return fetch(url, authenticated);
181
+ });
182
+ }
183
+ toApiError(response) {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ if (response.status === 401 && this.client.auth.isAuthenticated) {
186
+ this.client.auth.clear();
187
+ }
188
+ const body = parseJsonResponse(yield response.text());
189
+ const payload = body.status === 'error' ? body : body;
190
+ const message = typeof payload.message === 'string' ? payload.message : response.statusText;
191
+ const errorCode = typeof payload.errorCode === 'number' ? payload.errorCode : 0;
192
+ return new ApiClient_1.ApiError(response.status, { status: 'error', message, errorCode });
193
+ });
194
+ }
195
+ }
196
+ exports.default = CreativeWorkflowTemplatesApi;
197
+ __exportStar(require("./types"), exports);
198
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/CreativeWorkflows/Templates/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8DAAqD;AACrD,+CAA2C;AAmB3C,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAqB,CAAC;IAC9C,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,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,OAAO,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC1E,CAAC;AAED,MAAM,4BAA6B,SAAQ,kBAAQ;IACjD,YAAY,MAAiB;QAC3B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,C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Q,CAAC,IAAI,EAAE,CAAC,CAAC;YACtD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,IAAgC,CAAC;YACnF,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5F,MAAM,SAAS,GAAG,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,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,4BAA4B,CAAC;AAC5C,0CAAwB"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Workflow template types — mirrors the api `workflow_templates` collection.
3
+ *
4
+ * The SDK keeps a structural shape with the well-known fields typed and a
5
+ * `[key: string]: unknown` escape hatch so callers that hold a richer type
6
+ * (e.g. `@sogni/creative-agent/workflows`) can cast safely without the SDK
7
+ * needing to depend on that package.
8
+ */
9
+ export type WorkflowTemplateVisibility = 'private' | 'public' | 'team';
10
+ export type WorkflowTemplateVisibilityFilter = 'own' | 'public' | 'all';
11
+ export type WorkflowTemplateAuthor = 'system' | {
12
+ userId: string;
13
+ displayName: string;
14
+ };
15
+ export type WorkflowTemplateStability = 'experimental' | 'beta' | 'production';
16
+ export interface WorkflowTemplate {
17
+ id: string;
18
+ name: string;
19
+ version: string;
20
+ description: string;
21
+ category?: string;
22
+ stability?: WorkflowTemplateStability;
23
+ author?: WorkflowTemplateAuthor;
24
+ visibility?: WorkflowTemplateVisibility;
25
+ inputs?: unknown[];
26
+ stages?: unknown[];
27
+ exposeToLLM?: boolean;
28
+ llmPriority?: number;
29
+ estimatedCredits?: {
30
+ min: number;
31
+ max: number;
32
+ };
33
+ estimatedCapacityUnits?: {
34
+ min: number;
35
+ max: number;
36
+ };
37
+ tags?: string[];
38
+ createdAt?: number | string;
39
+ updatedAt?: number | string;
40
+ [key: string]: unknown;
41
+ }
42
+ export interface ListWorkflowTemplatesOptions {
43
+ visibility?: WorkflowTemplateVisibilityFilter;
44
+ offset?: number;
45
+ limit?: number;
46
+ signal?: AbortSignal;
47
+ }
48
+ export interface ListWorkflowTemplatesResult {
49
+ templates: WorkflowTemplate[];
50
+ nextCursor: number | null;
51
+ }
52
+ export interface WorkflowTemplateRequestOptions {
53
+ signal?: AbortSignal;
54
+ }
55
+ export interface ForkWorkflowTemplateBody {
56
+ newName?: string;
57
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Workflow template types — mirrors the api `workflow_templates` collection.
4
+ *
5
+ * The SDK keeps a structural shape with the well-known fields typed and a
6
+ * `[key: string]: unknown` escape hatch so callers that hold a richer type
7
+ * (e.g. `@sogni/creative-agent/workflows`) can cast safely without the SDK
8
+ * needing to depend on that package.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/CreativeWorkflows/Templates/types.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}