@sogni-ai/sogni-client 4.2.0-alpha.9 → 5.0.0-alpha.2
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/{CLAUDE.md → AGENTS.md} +89 -8
- package/CHANGELOG.md +148 -0
- package/README.md +158 -66
- package/dist/Account/index.d.ts +4 -2
- package/dist/Account/index.js +27 -23
- package/dist/Account/index.js.map +1 -1
- package/dist/Account/types.d.ts +7 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js +17 -0
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js.map +1 -1
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.d.ts +4 -2
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js +41 -5
- package/dist/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js.map +1 -1
- package/dist/ApiClient/WebSocketClient/eventSubscriptions.d.ts +33 -0
- package/dist/ApiClient/WebSocketClient/eventSubscriptions.js +39 -0
- package/dist/ApiClient/WebSocketClient/eventSubscriptions.js.map +1 -0
- package/dist/ApiClient/WebSocketClient/events.d.ts +22 -7
- package/dist/ApiClient/WebSocketClient/index.d.ts +5 -1
- package/dist/ApiClient/WebSocketClient/index.js +24 -1
- package/dist/ApiClient/WebSocketClient/index.js.map +1 -1
- package/dist/ApiClient/WebSocketClient/messages.d.ts +2 -0
- package/dist/ApiClient/WebSocketClient/types.d.ts +2 -0
- package/dist/ApiClient/index.d.ts +6 -1
- package/dist/ApiClient/index.js +7 -3
- package/dist/ApiClient/index.js.map +1 -1
- package/dist/Chat/ChatTools.js +55 -16
- package/dist/Chat/ChatTools.js.map +1 -1
- package/dist/Chat/hostedToolValidation.generated.d.ts +46 -0
- package/dist/Chat/hostedToolValidation.generated.js +306 -0
- package/dist/Chat/hostedToolValidation.generated.js.map +1 -0
- package/dist/Chat/index.d.ts +46 -1
- package/dist/Chat/index.js +302 -24
- package/dist/Chat/index.js.map +1 -1
- package/dist/Chat/modelRouting.d.ts +15 -32
- package/dist/Chat/modelRouting.js +61 -147
- package/dist/Chat/modelRouting.js.map +1 -1
- package/dist/Chat/sogniHostedTools.generated.json +1622 -296
- package/dist/Chat/tools.d.ts +58 -7
- package/dist/Chat/tools.js +66 -64
- package/dist/Chat/tools.js.map +1 -1
- package/dist/Chat/types.d.ts +225 -6
- package/dist/CreativeWorkflows/Templates/index.d.ts +34 -0
- package/dist/CreativeWorkflows/Templates/index.js +198 -0
- package/dist/CreativeWorkflows/Templates/index.js.map +1 -0
- package/dist/CreativeWorkflows/Templates/types.d.ts +57 -0
- package/dist/CreativeWorkflows/Templates/types.js +11 -0
- package/dist/CreativeWorkflows/Templates/types.js.map +1 -0
- package/dist/CreativeWorkflows/index.d.ts +22 -7
- package/dist/CreativeWorkflows/index.js +140 -22
- package/dist/CreativeWorkflows/index.js.map +1 -1
- package/dist/CreativeWorkflows/types.d.ts +92 -31
- package/dist/Projects/Job.d.ts +6 -0
- package/dist/Projects/Job.js +58 -4
- package/dist/Projects/Job.js.map +1 -1
- package/dist/Projects/Project.js +15 -3
- package/dist/Projects/Project.js.map +1 -1
- package/dist/Projects/createJobRequestMessage.js +19 -4
- package/dist/Projects/createJobRequestMessage.js.map +1 -1
- package/dist/Projects/index.d.ts +58 -9
- package/dist/Projects/index.js +133 -47
- package/dist/Projects/index.js.map +1 -1
- package/dist/Projects/types/RawProject.d.ts +2 -0
- package/dist/Projects/types/events.d.ts +5 -4
- package/dist/Projects/types/index.d.ts +36 -4
- package/dist/Projects/types/index.js.map +1 -1
- package/dist/Replay/index.d.ts +39 -0
- package/dist/Replay/index.js +161 -0
- package/dist/Replay/index.js.map +1 -0
- package/dist/Replay/types.d.ts +57 -0
- package/dist/Replay/types.js +13 -0
- package/dist/Replay/types.js.map +1 -0
- package/dist/index.d.ts +54 -6
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/Cache.js +6 -1
- package/dist/lib/Cache.js.map +1 -1
- package/dist/lib/RestClient.d.ts +4 -1
- package/dist/lib/RestClient.js +17 -9
- package/dist/lib/RestClient.js.map +1 -1
- package/dist/lib/mediaValidation.d.ts +3 -0
- package/dist/lib/mediaValidation.js +154 -0
- package/dist/lib/mediaValidation.js.map +1 -1
- package/dist/lib/validation.d.ts +6 -1
- package/dist/lib/validation.js +28 -2
- package/dist/lib/validation.js.map +1 -1
- package/dist-esm/Account/CurrentAccount.js +59 -0
- package/dist-esm/Account/CurrentAccount.js.map +1 -0
- package/dist-esm/Account/index.js +543 -0
- package/dist-esm/Account/index.js.map +1 -0
- package/dist-esm/Account/types.js +2 -0
- package/dist-esm/Account/types.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js +344 -0
- package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js +234 -0
- package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/ErrorCode.js +15 -0
- package/dist-esm/ApiClient/WebSocketClient/ErrorCode.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/eventSubscriptions.js +35 -0
- package/dist-esm/ApiClient/WebSocketClient/eventSubscriptions.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/events.js +2 -0
- package/dist-esm/ApiClient/WebSocketClient/events.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/index.js +221 -0
- package/dist-esm/ApiClient/WebSocketClient/index.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/messages.js +2 -0
- package/dist-esm/ApiClient/WebSocketClient/messages.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/types.js +2 -0
- package/dist-esm/ApiClient/WebSocketClient/types.js.map +1 -0
- package/dist-esm/ApiClient/events.js +2 -0
- package/dist-esm/ApiClient/events.js.map +1 -0
- package/dist-esm/ApiClient/index.js +120 -0
- package/dist-esm/ApiClient/index.js.map +1 -0
- package/dist-esm/ApiGroup.js +10 -0
- package/dist-esm/ApiGroup.js.map +1 -0
- package/dist-esm/Chat/ChatStream.js +181 -0
- package/dist-esm/Chat/ChatStream.js.map +1 -0
- package/dist-esm/Chat/ChatTools.js +562 -0
- package/dist-esm/Chat/ChatTools.js.map +1 -0
- package/dist-esm/Chat/hostedToolValidation.generated.js +301 -0
- package/dist-esm/Chat/hostedToolValidation.generated.js.map +1 -0
- package/dist-esm/Chat/index.js +693 -0
- package/dist-esm/Chat/index.js.map +1 -0
- package/dist-esm/Chat/modelRouting.js +326 -0
- package/dist-esm/Chat/modelRouting.js.map +1 -0
- package/dist-esm/Chat/sogniHostedTools.generated.json +1821 -0
- package/dist-esm/Chat/tools.js +99 -0
- package/dist-esm/Chat/tools.js.map +1 -0
- package/dist-esm/Chat/types.js +2 -0
- package/dist-esm/Chat/types.js.map +1 -0
- package/dist-esm/CreativeWorkflows/Templates/index.js +179 -0
- package/dist-esm/CreativeWorkflows/Templates/index.js.map +1 -0
- package/dist-esm/CreativeWorkflows/Templates/types.js +10 -0
- package/dist-esm/CreativeWorkflows/Templates/types.js.map +1 -0
- package/dist-esm/CreativeWorkflows/index.js +372 -0
- package/dist-esm/CreativeWorkflows/index.js.map +1 -0
- package/dist-esm/CreativeWorkflows/types.js +2 -0
- package/dist-esm/CreativeWorkflows/types.js.map +1 -0
- package/dist-esm/Projects/Job.js +391 -0
- package/dist-esm/Projects/Job.js.map +1 -0
- package/dist-esm/Projects/Project.js +295 -0
- package/dist-esm/Projects/Project.js.map +1 -0
- package/dist-esm/Projects/createJobRequestMessage.js +528 -0
- package/dist-esm/Projects/createJobRequestMessage.js.map +1 -0
- package/dist-esm/Projects/index.js +1350 -0
- package/dist-esm/Projects/index.js.map +1 -0
- package/dist-esm/Projects/types/ComfySamplerParams.js +2 -0
- package/dist-esm/Projects/types/ComfySamplerParams.js.map +1 -0
- package/dist-esm/Projects/types/ControlNetParams.js +2 -0
- package/dist-esm/Projects/types/ControlNetParams.js.map +1 -0
- package/dist-esm/Projects/types/EstimationResponse.js +2 -0
- package/dist-esm/Projects/types/EstimationResponse.js.map +1 -0
- package/dist-esm/Projects/types/ModelOptions.js +89 -0
- package/dist-esm/Projects/types/ModelOptions.js.map +1 -0
- package/dist-esm/Projects/types/ModelTiersRaw.js +13 -0
- package/dist-esm/Projects/types/ModelTiersRaw.js.map +1 -0
- package/dist-esm/Projects/types/RawProject.js +2 -0
- package/dist-esm/Projects/types/RawProject.js.map +1 -0
- package/dist-esm/Projects/types/events.js +2 -0
- package/dist-esm/Projects/types/events.js.map +1 -0
- package/dist-esm/Projects/types/index.js +10 -0
- package/dist-esm/Projects/types/index.js.map +1 -0
- package/dist-esm/Projects/utils/index.js +229 -0
- package/dist-esm/Projects/utils/index.js.map +1 -0
- package/dist-esm/Projects/utils/samplers.js +36 -0
- package/dist-esm/Projects/utils/samplers.js.map +1 -0
- package/dist-esm/Projects/utils/scheduler.js +27 -0
- package/dist-esm/Projects/utils/scheduler.js.map +1 -0
- package/dist-esm/Replay/index.js +142 -0
- package/dist-esm/Replay/index.js.map +1 -0
- package/dist-esm/Replay/types.js +12 -0
- package/dist-esm/Replay/types.js.map +1 -0
- package/dist-esm/Stats/index.js +20 -0
- package/dist-esm/Stats/index.js.map +1 -0
- package/dist-esm/Stats/types.js +2 -0
- package/dist-esm/Stats/types.js.map +1 -0
- package/dist-esm/events.js +2 -0
- package/dist-esm/events.js.map +1 -0
- package/dist-esm/index.js +148 -0
- package/dist-esm/index.js.map +1 -0
- package/dist-esm/lib/AuthManager/ApiKeyAuthManager.js +58 -0
- package/dist-esm/lib/AuthManager/ApiKeyAuthManager.js.map +1 -0
- package/dist-esm/lib/AuthManager/AuthManagerBase.js +9 -0
- package/dist-esm/lib/AuthManager/AuthManagerBase.js.map +1 -0
- package/dist-esm/lib/AuthManager/CookieAuthManager.js +48 -0
- package/dist-esm/lib/AuthManager/CookieAuthManager.js.map +1 -0
- package/dist-esm/lib/AuthManager/TokenAuthManager.js +186 -0
- package/dist-esm/lib/AuthManager/TokenAuthManager.js.map +1 -0
- package/dist-esm/lib/AuthManager/index.js +5 -0
- package/dist-esm/lib/AuthManager/index.js.map +1 -0
- package/dist-esm/lib/Cache.js +32 -0
- package/dist-esm/lib/Cache.js.map +1 -0
- package/dist-esm/lib/DataEntity.js +30 -0
- package/dist-esm/lib/DataEntity.js.map +1 -0
- package/dist-esm/lib/DefaultLogger.js +32 -0
- package/dist-esm/lib/DefaultLogger.js.map +1 -0
- package/dist-esm/lib/EIP712Helper.js +37 -0
- package/dist-esm/lib/EIP712Helper.js.map +1 -0
- package/dist-esm/lib/RestClient.js +90 -0
- package/dist-esm/lib/RestClient.js.map +1 -0
- package/dist-esm/lib/TypedEventEmitter.js +68 -0
- package/dist-esm/lib/TypedEventEmitter.js.map +1 -0
- package/dist-esm/lib/base64.js +18 -0
- package/dist-esm/lib/base64.js.map +1 -0
- package/dist-esm/lib/getUUID.js +7 -0
- package/dist-esm/lib/getUUID.js.map +1 -0
- package/dist-esm/lib/isNodejs.js +3 -0
- package/dist-esm/lib/isNodejs.js.map +1 -0
- package/dist-esm/lib/mediaValidation.js +430 -0
- package/dist-esm/lib/mediaValidation.js.map +1 -0
- package/dist-esm/lib/utils/index.js +30 -0
- package/dist-esm/lib/utils/index.js.map +1 -0
- package/dist-esm/lib/validation.js +138 -0
- package/dist-esm/lib/validation.js.map +1 -0
- package/dist-esm/package.json +3 -0
- package/dist-esm/types/ErrorData.js +2 -0
- package/dist-esm/types/ErrorData.js.map +1 -0
- package/dist-esm/types/json.js +2 -0
- package/dist-esm/types/json.js.map +1 -0
- package/dist-esm/types/token.js +2 -0
- package/dist-esm/types/token.js.map +1 -0
- package/dist-esm/version.js +3 -0
- package/dist-esm/version.js.map +1 -0
- package/llms-full.txt +223 -81
- package/llms.txt +56 -45
- package/package.json +30 -7
- package/src/Account/index.ts +22 -2
- package/src/Account/types.ts +7 -0
- package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.ts +17 -0
- package/src/ApiClient/WebSocketClient/BrowserWebSocketClient/index.ts +62 -6
- package/src/ApiClient/WebSocketClient/eventSubscriptions.ts +92 -0
- package/src/ApiClient/WebSocketClient/events.ts +23 -7
- package/src/ApiClient/WebSocketClient/index.ts +33 -1
- package/src/ApiClient/WebSocketClient/messages.ts +2 -0
- package/src/ApiClient/WebSocketClient/types.ts +2 -0
- package/src/ApiClient/index.ts +32 -2
- package/src/Chat/ChatTools.ts +62 -16
- package/src/Chat/hostedToolValidation.generated.ts +453 -0
- package/src/Chat/index.ts +380 -35
- package/src/Chat/modelRouting.ts +84 -161
- package/src/Chat/sogniHostedTools.generated.json +1622 -296
- package/src/Chat/tools.ts +98 -92
- package/src/Chat/types.ts +246 -6
- package/src/CreativeWorkflows/Templates/index.ts +199 -0
- package/src/CreativeWorkflows/Templates/types.ts +56 -0
- package/src/CreativeWorkflows/index.ts +150 -35
- package/src/CreativeWorkflows/types.ts +142 -42
- package/src/Projects/Job.ts +75 -4
- package/src/Projects/Project.ts +13 -3
- package/src/Projects/createJobRequestMessage.ts +19 -9
- package/src/Projects/index.ts +178 -40
- package/src/Projects/types/RawProject.ts +2 -0
- package/src/Projects/types/events.ts +5 -4
- package/src/Projects/types/index.ts +45 -3
- package/src/Replay/index.ts +166 -0
- package/src/Replay/types.ts +64 -0
- package/src/index.ts +148 -14
- package/src/lib/Cache.ts +8 -1
- package/src/lib/RestClient.ts +15 -5
- package/src/lib/mediaValidation.ts +155 -0
- package/src/lib/validation.ts +38 -2
package/{CLAUDE.md → AGENTS.md}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AGENTS.md
|
|
2
2
|
|
|
3
|
-
This file provides guidance to Claude Code
|
|
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,9 +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
|
+
These are public agent-facing docs shipped with the npm package. They are kept aligned with:
|
|
17
|
+
|
|
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.
|
|
23
|
+
|
|
24
|
+
Current public API anchors:
|
|
25
|
+
|
|
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`.
|
|
32
|
+
|
|
33
|
+
## Sogni Intelligence APIs
|
|
34
|
+
|
|
35
|
+
The SDK wraps the public Sogni Intelligence endpoints used for text chat, hosted creative tools, durable chat turns, and deterministic multi-step workflows.
|
|
36
|
+
|
|
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.
|
|
49
|
+
|
|
16
50
|
## Overview
|
|
17
51
|
|
|
18
|
-
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,
|
|
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/`.
|
|
19
59
|
|
|
20
60
|
## Build & Development Commands
|
|
21
61
|
|
|
@@ -32,10 +72,26 @@ npm run prettier:fix
|
|
|
32
72
|
# Check formatting
|
|
33
73
|
npm run prettier
|
|
34
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
|
+
|
|
35
84
|
# Generate API documentation
|
|
36
85
|
npm run docs
|
|
37
86
|
```
|
|
38
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
|
+
|
|
39
95
|
## Architecture
|
|
40
96
|
|
|
41
97
|
### Entry Point & Main Classes
|
|
@@ -44,6 +100,15 @@ npm run docs
|
|
|
44
100
|
- `account: AccountApi` - Authentication, balance, rewards
|
|
45
101
|
- `projects: ProjectsApi` - Create/track AI generation jobs
|
|
46
102
|
- `stats: StatsApi` - Leaderboard data
|
|
103
|
+
- `chat: ChatApi` - Unified chat namespace:
|
|
104
|
+
- `chat.completions.create` - Socket-native synchronous chat
|
|
105
|
+
- `chat.hosted.create` - Hosted synchronous chat via `/v1/chat/completions`
|
|
106
|
+
- `chat.runs.{create, get, cancel, streamEvents}` - Durable hosted chat runs via `/v1/chat/runs` with SSE replay
|
|
107
|
+
- `chat.tools` - Tool helpers (build, parse, validate)
|
|
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`
|
|
47
112
|
- `apiClient: ApiClient` - Internal REST + WebSocket communication
|
|
48
113
|
|
|
49
114
|
### Core Entity Hierarchy
|
|
@@ -71,6 +136,9 @@ src/
|
|
|
71
136
|
│ └── utils/ # Samplers, schedulers
|
|
72
137
|
├── Account/ # User auth & balance (CurrentAccount entity)
|
|
73
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
|
|
74
142
|
├── lib/ # Shared utilities
|
|
75
143
|
│ ├── AuthManager/ # Token/Cookie auth strategies
|
|
76
144
|
│ ├── DataEntity.ts # Base reactive entity
|
|
@@ -92,6 +160,19 @@ src/
|
|
|
92
160
|
2. Server sends `jobState`, `jobProgress`, `jobResult` events → Updates Project/Job entities
|
|
93
161
|
3. Entities emit events → User code receives 'progress', 'completed', 'failed'
|
|
94
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
|
+
|
|
95
176
|
### Network Types
|
|
96
177
|
|
|
97
178
|
- `fast` - High-end GPUs, faster but more expensive. Required for video generation.
|
|
@@ -110,9 +191,9 @@ The SDK supports two families of video models with **fundamentally different FPS
|
|
|
110
191
|
- **Frame step constraint**: Frame count must follow pattern `1 + n*8` (i.e., 1, 9, 17, 25, 33, ...)
|
|
111
192
|
- Example: 5 seconds at 24fps = 121 frames (snapped to 1 + 15*8 = 121)
|
|
112
193
|
|
|
113
|
-
###
|
|
194
|
+
### WAN 2.2 Behavior
|
|
114
195
|
|
|
115
|
-
**WAN 2.2 Models (`wan_v2.2-*`)**
|
|
196
|
+
**WAN 2.2 Models (`wan_v2.2-*`)** use a fixed internal generation rate:
|
|
116
197
|
- **Always generate at 16fps internally**, regardless of the user's fps setting
|
|
117
198
|
- The `fps` parameter (16 or 32) controls **post-render frame interpolation only**
|
|
118
199
|
- `fps=16`: No interpolation, output matches generation (16fps)
|
|
@@ -222,9 +303,9 @@ const urls = await project.waitForCompletion();
|
|
|
222
303
|
|
|
223
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.
|
|
224
305
|
|
|
225
|
-
|
|
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`.
|
|
226
307
|
|
|
227
|
-
### Thinking Models (Qwen3
|
|
308
|
+
### Thinking Models (Qwen3.x) — `chat_template_kwargs`
|
|
228
309
|
|
|
229
310
|
Thinking mode is controlled via llama.cpp's `chat_template_kwargs: { enable_thinking }` per-request parameter. The SDK's `think` param maps to this:
|
|
230
311
|
- `think: false` → `chat_template_kwargs: { enable_thinking: false }` (no thinking)
|
|
@@ -233,7 +314,7 @@ Thinking mode is controlled via llama.cpp's `chat_template_kwargs: { enable_thin
|
|
|
233
314
|
|
|
234
315
|
The llama-server should run with default `--reasoning-budget -1` (unrestricted) so per-request control works.
|
|
235
316
|
|
|
236
|
-
|
|
317
|
+
`ChatCompletionChunk` exposes generated text through `content` and tool invocations through optional `tool_calls`.
|
|
237
318
|
|
|
238
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).
|
|
239
320
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,151 @@
|
|
|
1
|
+
# [5.0.0-alpha.2](https://github.com/Sogni-AI/sogni-client/compare/v5.0.0-alpha.1...v5.0.0-alpha.2) (2026-05-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* forward runtimeConfig to chat runs for cloud executor parity ([c8002df](https://github.com/Sogni-AI/sogni-client/commit/c8002df94bc4cd1e163956803a9d237b64dc9f61))
|
|
7
|
+
|
|
8
|
+
# [5.0.0-alpha.1](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.26...v5.0.0-alpha.1) (2026-05-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* feat!: align SogniTools surface to canonical 24 tools, remove buildSogniTools ([2f04de9](https://github.com/Sogni-AI/sogni-client/commit/2f04de9fdb4d4423f3c46426488d6c520522c62f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* buildSogniTools is no longer exported. Replace
|
|
17
|
+
buildSogniTools(availableModels) with SogniTools.all, or set
|
|
18
|
+
sogni_tools: 'creative-tools' on chat.hosted.create() / chat.runs.create()
|
|
19
|
+
for server-side injection.
|
|
20
|
+
|
|
21
|
+
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
22
|
+
|
|
23
|
+
# [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)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* add replay records API ([ef98975](https://github.com/Sogni-AI/sogni-client/commit/ef98975a618523e23799aa28ab292609cbe32de6))
|
|
29
|
+
|
|
30
|
+
# [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)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* **workflows:** add templates CRUD, resume, reseed, and template-id runs ([fbec2b7](https://github.com/Sogni-AI/sogni-client/commit/fbec2b756df10cac3455626cd314a0fdbbde5982))
|
|
36
|
+
|
|
37
|
+
# [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)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* **websocket:** preserve primary tab on new-tab open, fix promoted-primary rebind ([b74382a](https://github.com/Sogni-AI/sogni-client/commit/b74382a1b3bc02d61257bc3158ecbd96c10dee57))
|
|
43
|
+
|
|
44
|
+
# [4.2.0-alpha.23](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.22...v4.2.0-alpha.23) (2026-05-15)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* **chat:** validate remote media inputs ([daa078d](https://github.com/Sogni-AI/sogni-client/commit/daa078de22919698d87d1669298658a268565653))
|
|
50
|
+
|
|
51
|
+
# [4.2.0-alpha.22](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.21...v4.2.0-alpha.22) (2026-05-15)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* **sdk:** add durable chat runs, flatten creative workflows, dual ESM build ([03d37d7](https://github.com/Sogni-AI/sogni-client/commit/03d37d7e873e3e6ac8718b407fd612bab757907b))
|
|
57
|
+
|
|
58
|
+
# [4.2.0-alpha.21](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.20...v4.2.0-alpha.21) (2026-05-14)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
* **chat:** align hosted creative tool surfaces ([6e9e094](https://github.com/Sogni-AI/sogni-client/commit/6e9e094803bad7fdda994103f12bd40f726ae08e))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
* **chat:** expose hosted completions wrapper ([da3799d](https://github.com/Sogni-AI/sogni-client/commit/da3799d2e99877d4bdd1990741611bac6243cdad))
|
|
69
|
+
|
|
70
|
+
# [4.2.0-alpha.20](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.19...v4.2.0-alpha.20) (2026-05-12)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Features
|
|
74
|
+
|
|
75
|
+
* **sdk:** add socket event subscription controls ([a450acd](https://github.com/Sogni-AI/sogni-client/commit/a450acd22087a690657c82de8e20cda96cd81512))
|
|
76
|
+
|
|
77
|
+
# [4.2.0-alpha.19](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.18...v4.2.0-alpha.19) (2026-05-11)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Features
|
|
81
|
+
|
|
82
|
+
* **sdk:** re-export ChatResponseFormat type from package root ([b48849c](https://github.com/Sogni-AI/sogni-client/commit/b48849c517375d7879d55653398a65f0d93f161c))
|
|
83
|
+
|
|
84
|
+
# [4.2.0-alpha.18](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.17...v4.2.0-alpha.18) (2026-05-09)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### Bug Fixes
|
|
88
|
+
|
|
89
|
+
* **examples:** prepare sound-to-video audio uploads ([52e6cc2](https://github.com/Sogni-AI/sogni-client/commit/52e6cc210e67da49742229a9d1ff2d0edd5e14fa))
|
|
90
|
+
|
|
91
|
+
# [4.2.0-alpha.17](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.16...v4.2.0-alpha.17) (2026-05-09)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Features
|
|
95
|
+
|
|
96
|
+
* **alpha:** merge agentic harness refactor ([e4e1ddc](https://github.com/Sogni-AI/sogni-client/commit/e4e1ddcc4b1cd1272ed7ccc8c4b68ee5a9f7df8c))
|
|
97
|
+
* **chat:** plumb response_format through createCompletion ([b711a68](https://github.com/Sogni-AI/sogni-client/commit/b711a68e4dc7fc27d8d781f8cab40f74b23393eb))
|
|
98
|
+
|
|
99
|
+
# [4.2.0-alpha.16](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.15...v4.2.0-alpha.16) (2026-05-06)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
### Bug Fixes
|
|
103
|
+
|
|
104
|
+
* **client:** preserve external job progress ([6390c16](https://github.com/Sogni-AI/sogni-client/commit/6390c165b9c492b8fa0df07b331cb6193c8b3916))
|
|
105
|
+
|
|
106
|
+
# [4.2.0-alpha.15](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.14...v4.2.0-alpha.15) (2026-05-04)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Bug Fixes
|
|
110
|
+
|
|
111
|
+
* update gpt-image-2 hosted tool guidance ([e346969](https://github.com/Sogni-AI/sogni-client/commit/e346969d8898d5a78ffd026bb0f2839a68366428))
|
|
112
|
+
|
|
113
|
+
# [4.2.0-alpha.14](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.13...v4.2.0-alpha.14) (2026-05-04)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
### Features
|
|
117
|
+
|
|
118
|
+
* **chat:** update creative workflow client metadata ([bda4a28](https://github.com/Sogni-AI/sogni-client/commit/bda4a28a78dcce41c4bf0fd796767019f8d69ce8))
|
|
119
|
+
|
|
120
|
+
# [4.2.0-alpha.13](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.12...v4.2.0-alpha.13) (2026-05-04)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Features
|
|
124
|
+
|
|
125
|
+
* **client:** expose GPT Image 2 project options ([5f8ff31](https://github.com/Sogni-AI/sogni-client/commit/5f8ff31d147c6869b9d7a238a45b117fee80fea1))
|
|
126
|
+
* **client:** route GPT Image 2 aliases ([a946fe2](https://github.com/Sogni-AI/sogni-client/commit/a946fe2ae556a1d9d788d3bc0c3c7c0e223996f1))
|
|
127
|
+
|
|
128
|
+
# [4.2.0-alpha.12](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.11...v4.2.0-alpha.12) (2026-05-03)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Bug Fixes
|
|
132
|
+
|
|
133
|
+
* align Seedance routing and estimates ([93c3315](https://github.com/Sogni-AI/sogni-client/commit/93c3315352b014ce04583bbf7342691f4b88b63f))
|
|
134
|
+
|
|
135
|
+
# [4.2.0-alpha.11](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.10...v4.2.0-alpha.11) (2026-05-01)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### Bug Fixes
|
|
139
|
+
|
|
140
|
+
* document monthly free Spark credits ([9a89533](https://github.com/Sogni-AI/sogni-client/commit/9a89533d3c12d05eec8b2ddf61b654879fcef243))
|
|
141
|
+
|
|
142
|
+
# [4.2.0-alpha.10](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.9...v4.2.0-alpha.10) (2026-05-01)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### Features
|
|
146
|
+
|
|
147
|
+
* **seedance:** add guided partner video workflow ([36b8880](https://github.com/Sogni-AI/sogni-client/commit/36b8880f6fd33e3cfc7eeb0a828a2f3663c57996))
|
|
148
|
+
|
|
1
149
|
# [4.2.0-alpha.9](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.8...v4.2.0-alpha.9) (2026-04-30)
|
|
2
150
|
|
|
3
151
|
|