@sogni-ai/sogni-intelligence-client 3.0.0-alpha.0 → 3.0.0-alpha.11

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 (452) hide show
  1. package/README.md +165 -729
  2. package/chatRun/index.d.ts +1 -0
  3. package/chatRun/index.js +2 -0
  4. package/context/index.d.ts +1 -0
  5. package/context/index.js +2 -0
  6. package/dist/agent/index.d.ts +5 -0
  7. package/dist/agent/index.d.ts.map +1 -0
  8. package/dist/agent/index.js +38 -0
  9. package/dist/agent/index.js.map +1 -0
  10. package/dist/agent/intentInput.d.ts +106 -0
  11. package/dist/agent/intentInput.d.ts.map +1 -0
  12. package/dist/agent/intentInput.js +410 -0
  13. package/dist/agent/intentInput.js.map +1 -0
  14. package/dist/agent/toolMetadata.d.ts +37 -0
  15. package/dist/agent/toolMetadata.d.ts.map +1 -0
  16. package/dist/agent/toolMetadata.js +146 -0
  17. package/dist/agent/toolMetadata.js.map +1 -0
  18. package/dist/agent/turnAnalysis.d.ts +34 -0
  19. package/dist/agent/turnAnalysis.d.ts.map +1 -0
  20. package/dist/agent/turnAnalysis.js +155 -0
  21. package/dist/agent/turnAnalysis.js.map +1 -0
  22. package/dist/agent/turnPlan.d.ts +40 -0
  23. package/dist/agent/turnPlan.d.ts.map +1 -0
  24. package/dist/agent/turnPlan.js +187 -0
  25. package/dist/agent/turnPlan.js.map +1 -0
  26. package/dist/artifacts/graph.d.ts +92 -0
  27. package/dist/artifacts/graph.d.ts.map +1 -0
  28. package/dist/artifacts/graph.js +484 -0
  29. package/dist/artifacts/graph.js.map +1 -0
  30. package/dist/artifacts/index.d.ts +3 -0
  31. package/dist/artifacts/index.d.ts.map +1 -0
  32. package/dist/artifacts/index.js +28 -0
  33. package/dist/artifacts/index.js.map +1 -0
  34. package/dist/artifacts/queries.d.ts +7 -0
  35. package/dist/artifacts/queries.d.ts.map +1 -0
  36. package/dist/artifacts/queries.js +85 -0
  37. package/dist/artifacts/queries.js.map +1 -0
  38. package/dist/billing/index.d.ts +3 -0
  39. package/dist/billing/index.d.ts.map +1 -0
  40. package/dist/billing/index.js +27 -0
  41. package/dist/billing/index.js.map +1 -0
  42. package/dist/billing/spendGate.d.ts +72 -0
  43. package/dist/billing/spendGate.d.ts.map +1 -0
  44. package/dist/billing/spendGate.js +344 -0
  45. package/dist/billing/spendGate.js.map +1 -0
  46. package/dist/billing/workflowAuthorization.d.ts +56 -0
  47. package/dist/billing/workflowAuthorization.d.ts.map +1 -0
  48. package/dist/billing/workflowAuthorization.js +270 -0
  49. package/dist/billing/workflowAuthorization.js.map +1 -0
  50. package/dist/chatRun/costApproval.d.ts +10 -0
  51. package/dist/chatRun/costApproval.d.ts.map +1 -0
  52. package/dist/chatRun/costApproval.js +70 -0
  53. package/dist/chatRun/costApproval.js.map +1 -0
  54. package/dist/chatRun/index.d.ts +223 -0
  55. package/dist/chatRun/index.d.ts.map +1 -0
  56. package/dist/chatRun/index.js +396 -0
  57. package/dist/chatRun/index.js.map +1 -0
  58. package/dist/client/SogniClientWrapper.d.ts +2 -2
  59. package/dist/client/SogniClientWrapper.d.ts.map +1 -1
  60. package/dist/client/SogniClientWrapper.js +60 -57
  61. package/dist/client/SogniClientWrapper.js.map +1 -1
  62. package/dist/context/index.d.ts +56 -0
  63. package/dist/context/index.d.ts.map +1 -0
  64. package/dist/context/index.js +460 -0
  65. package/dist/context/index.js.map +1 -0
  66. package/dist/contracts/data/gatingPolicies.d.ts +1 -1
  67. package/dist/contracts/data/gatingPolicies.d.ts.map +1 -1
  68. package/dist/contracts/data/gatingPolicies.js +5 -5
  69. package/dist/contracts/data/gatingPolicies.js.map +1 -1
  70. package/dist/contracts/data/index.d.ts +3 -3
  71. package/dist/contracts/data/index.d.ts.map +1 -1
  72. package/dist/contracts/data/index.js +4 -4
  73. package/dist/contracts/data/index.js.map +1 -1
  74. package/dist/contracts/data/promptContracts.d.ts +1 -1
  75. package/dist/contracts/data/promptContracts.d.ts.map +1 -1
  76. package/dist/contracts/data/promptContracts.js +224 -45
  77. package/dist/contracts/data/promptContracts.js.map +1 -1
  78. package/dist/contracts/data/repairRecipes.d.ts +1 -1
  79. package/dist/contracts/data/repairRecipes.d.ts.map +1 -1
  80. package/dist/contracts/data/repairRecipes.js +3 -3
  81. package/dist/contracts/data/repairRecipes.js.map +1 -1
  82. package/dist/contracts/data/toolCatalog.js +1 -1
  83. package/dist/contracts/data/toolCatalog.js.map +1 -1
  84. package/dist/contracts/data/toolPermissions.d.ts +2 -0
  85. package/dist/contracts/data/toolPermissions.d.ts.map +1 -1
  86. package/dist/contracts/data/toolPermissions.js +2 -13
  87. package/dist/contracts/data/toolPermissions.js.map +1 -1
  88. package/dist/contracts/index.d.ts +3 -3
  89. package/dist/contracts/index.d.ts.map +1 -1
  90. package/dist/contracts/index.js +8 -6
  91. package/dist/contracts/index.js.map +1 -1
  92. package/dist/contracts/storyboard.d.ts +1 -0
  93. package/dist/contracts/storyboard.d.ts.map +1 -1
  94. package/dist/contracts/storyboard.js.map +1 -1
  95. package/dist/contracts/toolGatingPolicy.d.ts.map +1 -1
  96. package/dist/contracts/toolGatingPolicy.js +6 -2
  97. package/dist/contracts/toolGatingPolicy.js.map +1 -1
  98. package/dist/contracts/toolSurface.d.ts +1 -0
  99. package/dist/contracts/toolSurface.d.ts.map +1 -1
  100. package/dist/contracts/toolSurface.js +12 -5
  101. package/dist/contracts/toolSurface.js.map +1 -1
  102. package/dist/contracts/turnPolicy.d.ts +2 -1
  103. package/dist/contracts/turnPolicy.d.ts.map +1 -1
  104. package/dist/contracts/turnPolicy.js +14 -0
  105. package/dist/contracts/turnPolicy.js.map +1 -1
  106. package/dist/events/index.d.ts +2 -0
  107. package/dist/events/index.d.ts.map +1 -0
  108. package/dist/events/index.js +12 -0
  109. package/dist/events/index.js.map +1 -0
  110. package/dist/events/runEvent.d.ts +31 -0
  111. package/dist/events/runEvent.d.ts.map +1 -0
  112. package/dist/events/runEvent.js +161 -0
  113. package/dist/events/runEvent.js.map +1 -0
  114. package/dist/index.d.ts +15 -6
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +73 -35
  117. package/dist/index.js.map +1 -1
  118. package/dist/media/generationJob.d.ts +1 -1
  119. package/dist/media/generationJob.d.ts.map +1 -1
  120. package/dist/openai-tools/_manifests.generated.d.ts +4 -0
  121. package/dist/openai-tools/_manifests.generated.d.ts.map +1 -0
  122. package/dist/openai-tools/_manifests.generated.js +1792 -0
  123. package/dist/openai-tools/_manifests.generated.js.map +1 -0
  124. package/dist/openai-tools/app-tools.json +297 -0
  125. package/dist/openai-tools/composition-tools.json +228 -0
  126. package/dist/openai-tools/generation-tools.json +1263 -0
  127. package/dist/openai-tools/index.d.ts +17 -0
  128. package/dist/openai-tools/index.d.ts.map +1 -0
  129. package/dist/openai-tools/index.js +32 -0
  130. package/dist/openai-tools/index.js.map +1 -0
  131. package/dist/public-skill-runtime/index.d.ts +3 -1
  132. package/dist/public-skill-runtime/index.d.ts.map +1 -1
  133. package/dist/public-skill-runtime/index.js +619 -156
  134. package/dist/public-skill-runtime/index.js.map +1 -1
  135. package/dist/schemas/agent/intent-input.schema.json +128 -0
  136. package/dist/schemas/agent/turn-analysis.schema.json +75 -0
  137. package/dist/schemas/artifacts/artifact-graph.schema.json +42 -0
  138. package/dist/schemas/artifacts/artifact-node.schema.json +137 -0
  139. package/dist/schemas/billing/spend-gate.schema.json +130 -0
  140. package/dist/schemas/billing/workflow-authorization.schema.json +83 -0
  141. package/dist/schemas/errors/error.schema.json +21 -0
  142. package/dist/schemas/errors/repair-control.schema.json +40 -0
  143. package/dist/schemas/events/artifact-reference.schema.json +22 -0
  144. package/dist/schemas/events/progress-event.schema.json +28 -0
  145. package/dist/schemas/events/run-event.schema.json +111 -0
  146. package/dist/schemas/events/workflow-event.schema.json +22 -0
  147. package/dist/schemas/prompt-contract.schema.json +42 -0
  148. package/dist/schemas/storyboards/storyboard-planning-contract.schema.json +108 -0
  149. package/dist/schemas/tools/add_subtitles.schema.json +77 -0
  150. package/dist/schemas/tools/animate_photo.schema.json +104 -0
  151. package/dist/schemas/tools/apply_style.schema.json +37 -0
  152. package/dist/schemas/tools/change_angle.schema.json +30 -0
  153. package/dist/schemas/tools/compose_instrumental.schema.json +24 -0
  154. package/dist/schemas/tools/compose_lyrics.schema.json +28 -0
  155. package/dist/schemas/tools/compose_script.schema.json +68 -0
  156. package/dist/schemas/tools/compose_workflow.schema.json +67 -0
  157. package/dist/schemas/tools/compose_workflow_template.schema.json +156 -0
  158. package/dist/schemas/tools/dance_montage.schema.json +47 -0
  159. package/dist/schemas/tools/edit_image.schema.json +74 -0
  160. package/dist/schemas/tools/enhance_prompt.schema.json +76 -0
  161. package/dist/schemas/tools/extend_video.schema.json +42 -0
  162. package/dist/schemas/tools/generate_image.schema.json +104 -0
  163. package/dist/schemas/tools/generate_music.schema.json +62 -0
  164. package/dist/schemas/tools/generate_video.schema.json +97 -0
  165. package/dist/schemas/tools/manage_memory.schema.json +28 -0
  166. package/dist/schemas/tools/orbit_video.schema.json +70 -0
  167. package/dist/schemas/tools/overlay_video.schema.json +126 -0
  168. package/dist/schemas/tools/refine_result.schema.json +43 -0
  169. package/dist/schemas/tools/replace_video_segment.schema.json +60 -0
  170. package/dist/schemas/tools/resolve_personas.schema.json +15 -0
  171. package/dist/schemas/tools/restore_photo.schema.json +47 -0
  172. package/dist/schemas/tools/set_content_filter.schema.json +14 -0
  173. package/dist/schemas/tools/sound_to_video.schema.json +70 -0
  174. package/dist/schemas/tools/stitch_video.schema.json +52 -0
  175. package/dist/schemas/tools/tool-metadata.schema.json +78 -0
  176. package/dist/schemas/tools/video_to_video.schema.json +77 -0
  177. package/dist/schemas/workflows/durable-workflow-run.schema.json +165 -0
  178. package/dist/schemas/workflows/durable-workflow-step.schema.json +141 -0
  179. package/dist/skill-runtime-source/crossSurfaceParity.d.ts +23 -0
  180. package/dist/skill-runtime-source/crossSurfaceParity.d.ts.map +1 -0
  181. package/dist/skill-runtime-source/crossSurfaceParity.js +472 -0
  182. package/dist/skill-runtime-source/crossSurfaceParity.js.map +1 -0
  183. package/dist/skill-runtime-source/index.d.ts +4 -0
  184. package/dist/skill-runtime-source/index.d.ts.map +1 -0
  185. package/dist/skill-runtime-source/index.js +20 -0
  186. package/dist/skill-runtime-source/index.js.map +1 -0
  187. package/dist/skill-runtime-source/seedanceAudioWindow.d.ts +8 -0
  188. package/dist/skill-runtime-source/seedanceAudioWindow.d.ts.map +1 -0
  189. package/dist/skill-runtime-source/seedanceAudioWindow.js +52 -0
  190. package/dist/skill-runtime-source/seedanceAudioWindow.js.map +1 -0
  191. package/dist/skill-runtime-source/workflowStatus.d.ts +17 -0
  192. package/dist/skill-runtime-source/workflowStatus.d.ts.map +1 -0
  193. package/dist/skill-runtime-source/workflowStatus.js +353 -0
  194. package/dist/skill-runtime-source/workflowStatus.js.map +1 -0
  195. package/dist/tools/definitions/animate-photo/definition.js +8 -8
  196. package/dist/tools/definitions/animate-photo/definition.js.map +1 -1
  197. package/dist/tools/definitions/edit-image/definition.js +3 -3
  198. package/dist/tools/definitions/edit-image/definition.js.map +1 -1
  199. package/dist/tools/definitions/generate-image/definition.js +4 -4
  200. package/dist/tools/definitions/generate-image/definition.js.map +1 -1
  201. package/dist/tools/definitions/generate-music/definition.js +2 -2
  202. package/dist/tools/definitions/generate-music/definition.js.map +1 -1
  203. package/dist/tools/definitions/generate-video/definition.js +2 -2
  204. package/dist/tools/definitions/generate-video/definition.js.map +1 -1
  205. package/dist/tools/definitions/replace-video-segment/definition.d.ts.map +1 -1
  206. package/dist/tools/definitions/replace-video-segment/definition.js +6 -5
  207. package/dist/tools/definitions/replace-video-segment/definition.js.map +1 -1
  208. package/dist/tools/definitions/sound-to-video/definition.js +2 -2
  209. package/dist/tools/definitions/sound-to-video/definition.js.map +1 -1
  210. package/dist/tools/definitions/stitch-video/definition.d.ts.map +1 -1
  211. package/dist/tools/definitions/stitch-video/definition.js +9 -22
  212. package/dist/tools/definitions/stitch-video/definition.js.map +1 -1
  213. package/dist/tools/index.d.ts +6 -1
  214. package/dist/tools/index.d.ts.map +1 -1
  215. package/dist/tools/index.js +20 -1
  216. package/dist/tools/index.js.map +1 -1
  217. package/dist/tools/normalizeArgs.d.ts +1 -0
  218. package/dist/tools/normalizeArgs.d.ts.map +1 -1
  219. package/dist/tools/normalizeArgs.js +83 -8
  220. package/dist/tools/normalizeArgs.js.map +1 -1
  221. package/dist/tools/shared/_catalogs.generated.d.ts +2 -0
  222. package/dist/tools/shared/_catalogs.generated.d.ts.map +1 -0
  223. package/dist/tools/shared/_catalogs.generated.js +13 -0
  224. package/dist/tools/shared/_catalogs.generated.js.map +1 -0
  225. package/dist/tools/shared/dynamicPromptBranches.d.ts +20 -0
  226. package/dist/tools/shared/dynamicPromptBranches.d.ts.map +1 -0
  227. package/dist/tools/shared/dynamicPromptBranches.js +193 -0
  228. package/dist/tools/shared/dynamicPromptBranches.js.map +1 -0
  229. package/dist/tools/shared/multiImageIntent.d.ts +2 -0
  230. package/dist/tools/shared/multiImageIntent.d.ts.map +1 -0
  231. package/dist/tools/shared/multiImageIntent.js +13 -0
  232. package/dist/tools/shared/multiImageIntent.js.map +1 -0
  233. package/dist/tools/shared/numberOfVariationsAlignment.d.ts +2 -0
  234. package/dist/tools/shared/numberOfVariationsAlignment.d.ts.map +1 -0
  235. package/dist/tools/shared/numberOfVariationsAlignment.js +37 -0
  236. package/dist/tools/shared/numberOfVariationsAlignment.js.map +1 -0
  237. package/dist/tools/shared/seedancePolicyErrors.d.ts +1 -0
  238. package/dist/tools/shared/seedancePolicyErrors.d.ts.map +1 -1
  239. package/dist/tools/shared/seedancePolicyErrors.js +14 -1
  240. package/dist/tools/shared/seedancePolicyErrors.js.map +1 -1
  241. package/dist/tools/shared/seedanceReferences.d.ts +22 -0
  242. package/dist/tools/shared/seedanceReferences.d.ts.map +1 -0
  243. package/dist/tools/shared/seedanceReferences.js +38 -0
  244. package/dist/tools/shared/seedanceReferences.js.map +1 -0
  245. package/dist/types/index.d.ts +2 -4
  246. package/dist/types/index.d.ts.map +1 -1
  247. package/dist/utils/errors.d.ts +1 -1
  248. package/dist/utils/errors.d.ts.map +1 -1
  249. package/dist/utils/helpers.d.ts +1 -1
  250. package/dist/utils/helpers.d.ts.map +1 -1
  251. package/dist/utils/helpers.js +62 -57
  252. package/dist/utils/helpers.js.map +1 -1
  253. package/dist/workflows/bindings.d.ts.map +1 -1
  254. package/dist/workflows/bindings.js +32 -2
  255. package/dist/workflows/bindings.js.map +1 -1
  256. package/dist/workflows/index.d.ts +5 -0
  257. package/dist/workflows/index.d.ts.map +1 -1
  258. package/dist/workflows/index.js +30 -1
  259. package/dist/workflows/index.js.map +1 -1
  260. package/dist/workflows/primitives/index.d.ts +4 -0
  261. package/dist/workflows/primitives/index.d.ts.map +1 -0
  262. package/dist/workflows/primitives/index.js +20 -0
  263. package/dist/workflows/primitives/index.js.map +1 -0
  264. package/dist/workflows/primitives/retryUntilCondition.d.ts +39 -0
  265. package/dist/workflows/primitives/retryUntilCondition.d.ts.map +1 -0
  266. package/dist/workflows/primitives/retryUntilCondition.js +102 -0
  267. package/dist/workflows/primitives/retryUntilCondition.js.map +1 -0
  268. package/dist/workflows/primitives/sanitizer.d.ts +22 -0
  269. package/dist/workflows/primitives/sanitizer.d.ts.map +1 -0
  270. package/dist/workflows/primitives/sanitizer.js +96 -0
  271. package/dist/workflows/primitives/sanitizer.js.map +1 -0
  272. package/dist/workflows/primitives/validateWithRubric.d.ts +28 -0
  273. package/dist/workflows/primitives/validateWithRubric.d.ts.map +1 -0
  274. package/dist/workflows/primitives/validateWithRubric.js +148 -0
  275. package/dist/workflows/primitives/validateWithRubric.js.map +1 -0
  276. package/dist-esm/agent/index.js +5 -0
  277. package/dist-esm/agent/index.js.map +1 -0
  278. package/dist-esm/agent/intentInput.js +397 -0
  279. package/dist-esm/agent/intentInput.js.map +1 -0
  280. package/dist-esm/agent/toolMetadata.js +136 -0
  281. package/dist-esm/agent/toolMetadata.js.map +1 -0
  282. package/dist-esm/agent/turnAnalysis.js +147 -0
  283. package/dist-esm/agent/turnAnalysis.js.map +1 -0
  284. package/dist-esm/agent/turnPlan.js +180 -0
  285. package/dist-esm/agent/turnPlan.js.map +1 -0
  286. package/dist-esm/artifacts/graph.js +465 -0
  287. package/dist-esm/artifacts/graph.js.map +1 -0
  288. package/dist-esm/artifacts/index.js +3 -0
  289. package/dist-esm/artifacts/index.js.map +1 -0
  290. package/dist-esm/artifacts/queries.js +78 -0
  291. package/dist-esm/artifacts/queries.js.map +1 -0
  292. package/dist-esm/billing/index.js +3 -0
  293. package/dist-esm/billing/index.js.map +1 -0
  294. package/dist-esm/billing/spendGate.js +329 -0
  295. package/dist-esm/billing/spendGate.js.map +1 -0
  296. package/dist-esm/billing/workflowAuthorization.js +260 -0
  297. package/dist-esm/billing/workflowAuthorization.js.map +1 -0
  298. package/dist-esm/chatRun/costApproval.js +64 -0
  299. package/dist-esm/chatRun/costApproval.js.map +1 -0
  300. package/dist-esm/chatRun/index.js +372 -0
  301. package/dist-esm/chatRun/index.js.map +1 -0
  302. package/dist-esm/client/SogniClientWrapper.js +8 -5
  303. package/dist-esm/client/SogniClientWrapper.js.map +1 -1
  304. package/dist-esm/context/index.js +453 -0
  305. package/dist-esm/context/index.js.map +1 -0
  306. package/dist-esm/contracts/data/gatingPolicies.js +4 -4
  307. package/dist-esm/contracts/data/gatingPolicies.js.map +1 -1
  308. package/dist-esm/contracts/data/index.js +3 -3
  309. package/dist-esm/contracts/data/index.js.map +1 -1
  310. package/dist-esm/contracts/data/promptContracts.js +223 -44
  311. package/dist-esm/contracts/data/promptContracts.js.map +1 -1
  312. package/dist-esm/contracts/data/repairRecipes.js +2 -2
  313. package/dist-esm/contracts/data/repairRecipes.js.map +1 -1
  314. package/dist-esm/contracts/data/toolCatalog.js +2 -2
  315. package/dist-esm/contracts/data/toolCatalog.js.map +1 -1
  316. package/dist-esm/contracts/data/toolPermissions.js +2 -13
  317. package/dist-esm/contracts/data/toolPermissions.js.map +1 -1
  318. package/dist-esm/contracts/index.js +3 -3
  319. package/dist-esm/contracts/index.js.map +1 -1
  320. package/dist-esm/contracts/storyboard.js.map +1 -1
  321. package/dist-esm/contracts/toolGatingPolicy.js +6 -2
  322. package/dist-esm/contracts/toolGatingPolicy.js.map +1 -1
  323. package/dist-esm/contracts/toolSurface.js +11 -4
  324. package/dist-esm/contracts/toolSurface.js.map +1 -1
  325. package/dist-esm/contracts/turnPolicy.js +13 -0
  326. package/dist-esm/contracts/turnPolicy.js.map +1 -1
  327. package/dist-esm/events/index.js +2 -0
  328. package/dist-esm/events/index.js.map +1 -0
  329. package/dist-esm/events/runEvent.js +152 -0
  330. package/dist-esm/events/runEvent.js.map +1 -0
  331. package/dist-esm/index.js +13 -5
  332. package/dist-esm/index.js.map +1 -1
  333. package/dist-esm/openai-tools/_manifests.generated.js +1789 -0
  334. package/dist-esm/openai-tools/_manifests.generated.js.map +1 -0
  335. package/dist-esm/openai-tools/app-tools.json +297 -0
  336. package/dist-esm/openai-tools/composition-tools.json +228 -0
  337. package/dist-esm/openai-tools/generation-tools.json +1263 -0
  338. package/dist-esm/openai-tools/index.js +27 -0
  339. package/dist-esm/openai-tools/index.js.map +1 -0
  340. package/dist-esm/public-skill-runtime/index.js +619 -156
  341. package/dist-esm/public-skill-runtime/index.js.map +1 -1
  342. package/dist-esm/schemas/agent/intent-input.schema.json +128 -0
  343. package/dist-esm/schemas/agent/turn-analysis.schema.json +75 -0
  344. package/dist-esm/schemas/artifacts/artifact-graph.schema.json +42 -0
  345. package/dist-esm/schemas/artifacts/artifact-node.schema.json +137 -0
  346. package/dist-esm/schemas/billing/spend-gate.schema.json +130 -0
  347. package/dist-esm/schemas/billing/workflow-authorization.schema.json +83 -0
  348. package/dist-esm/schemas/errors/error.schema.json +21 -0
  349. package/dist-esm/schemas/errors/repair-control.schema.json +40 -0
  350. package/dist-esm/schemas/events/artifact-reference.schema.json +22 -0
  351. package/dist-esm/schemas/events/progress-event.schema.json +28 -0
  352. package/dist-esm/schemas/events/run-event.schema.json +111 -0
  353. package/dist-esm/schemas/events/workflow-event.schema.json +22 -0
  354. package/dist-esm/schemas/prompt-contract.schema.json +42 -0
  355. package/dist-esm/schemas/storyboards/storyboard-planning-contract.schema.json +108 -0
  356. package/dist-esm/schemas/tools/add_subtitles.schema.json +77 -0
  357. package/dist-esm/schemas/tools/animate_photo.schema.json +104 -0
  358. package/dist-esm/schemas/tools/apply_style.schema.json +37 -0
  359. package/dist-esm/schemas/tools/change_angle.schema.json +30 -0
  360. package/dist-esm/schemas/tools/compose_instrumental.schema.json +24 -0
  361. package/dist-esm/schemas/tools/compose_lyrics.schema.json +28 -0
  362. package/dist-esm/schemas/tools/compose_script.schema.json +68 -0
  363. package/dist-esm/schemas/tools/compose_workflow.schema.json +67 -0
  364. package/dist-esm/schemas/tools/compose_workflow_template.schema.json +156 -0
  365. package/dist-esm/schemas/tools/dance_montage.schema.json +47 -0
  366. package/dist-esm/schemas/tools/edit_image.schema.json +74 -0
  367. package/dist-esm/schemas/tools/enhance_prompt.schema.json +76 -0
  368. package/dist-esm/schemas/tools/extend_video.schema.json +42 -0
  369. package/dist-esm/schemas/tools/generate_image.schema.json +104 -0
  370. package/dist-esm/schemas/tools/generate_music.schema.json +62 -0
  371. package/dist-esm/schemas/tools/generate_video.schema.json +97 -0
  372. package/dist-esm/schemas/tools/manage_memory.schema.json +28 -0
  373. package/dist-esm/schemas/tools/orbit_video.schema.json +70 -0
  374. package/dist-esm/schemas/tools/overlay_video.schema.json +126 -0
  375. package/dist-esm/schemas/tools/refine_result.schema.json +43 -0
  376. package/dist-esm/schemas/tools/replace_video_segment.schema.json +60 -0
  377. package/dist-esm/schemas/tools/resolve_personas.schema.json +15 -0
  378. package/dist-esm/schemas/tools/restore_photo.schema.json +47 -0
  379. package/dist-esm/schemas/tools/set_content_filter.schema.json +14 -0
  380. package/dist-esm/schemas/tools/sound_to_video.schema.json +70 -0
  381. package/dist-esm/schemas/tools/stitch_video.schema.json +52 -0
  382. package/dist-esm/schemas/tools/tool-metadata.schema.json +78 -0
  383. package/dist-esm/schemas/tools/video_to_video.schema.json +77 -0
  384. package/dist-esm/schemas/workflows/durable-workflow-run.schema.json +165 -0
  385. package/dist-esm/schemas/workflows/durable-workflow-step.schema.json +141 -0
  386. package/dist-esm/skill-runtime-source/crossSurfaceParity.js +469 -0
  387. package/dist-esm/skill-runtime-source/crossSurfaceParity.js.map +1 -0
  388. package/dist-esm/skill-runtime-source/index.js +4 -0
  389. package/dist-esm/skill-runtime-source/index.js.map +1 -0
  390. package/dist-esm/skill-runtime-source/seedanceAudioWindow.js +47 -0
  391. package/dist-esm/skill-runtime-source/seedanceAudioWindow.js.map +1 -0
  392. package/dist-esm/skill-runtime-source/workflowStatus.js +348 -0
  393. package/dist-esm/skill-runtime-source/workflowStatus.js.map +1 -0
  394. package/dist-esm/tools/definitions/animate-photo/definition.js +8 -8
  395. package/dist-esm/tools/definitions/animate-photo/definition.js.map +1 -1
  396. package/dist-esm/tools/definitions/edit-image/definition.js +3 -3
  397. package/dist-esm/tools/definitions/edit-image/definition.js.map +1 -1
  398. package/dist-esm/tools/definitions/generate-image/definition.js +4 -4
  399. package/dist-esm/tools/definitions/generate-image/definition.js.map +1 -1
  400. package/dist-esm/tools/definitions/generate-music/definition.js +2 -2
  401. package/dist-esm/tools/definitions/generate-music/definition.js.map +1 -1
  402. package/dist-esm/tools/definitions/generate-video/definition.js +2 -2
  403. package/dist-esm/tools/definitions/generate-video/definition.js.map +1 -1
  404. package/dist-esm/tools/definitions/replace-video-segment/definition.js +6 -5
  405. package/dist-esm/tools/definitions/replace-video-segment/definition.js.map +1 -1
  406. package/dist-esm/tools/definitions/sound-to-video/definition.js +2 -2
  407. package/dist-esm/tools/definitions/sound-to-video/definition.js.map +1 -1
  408. package/dist-esm/tools/definitions/stitch-video/definition.js +9 -22
  409. package/dist-esm/tools/definitions/stitch-video/definition.js.map +1 -1
  410. package/dist-esm/tools/index.js +5 -1
  411. package/dist-esm/tools/index.js.map +1 -1
  412. package/dist-esm/tools/normalizeArgs.js +82 -8
  413. package/dist-esm/tools/normalizeArgs.js.map +1 -1
  414. package/dist-esm/tools/shared/_catalogs.generated.js +10 -0
  415. package/dist-esm/tools/shared/_catalogs.generated.js.map +1 -0
  416. package/dist-esm/tools/shared/dynamicPromptBranches.js +183 -0
  417. package/dist-esm/tools/shared/dynamicPromptBranches.js.map +1 -0
  418. package/dist-esm/tools/shared/multiImageIntent.js +10 -0
  419. package/dist-esm/tools/shared/multiImageIntent.js.map +1 -0
  420. package/dist-esm/tools/shared/numberOfVariationsAlignment.js +34 -0
  421. package/dist-esm/tools/shared/numberOfVariationsAlignment.js.map +1 -0
  422. package/dist-esm/tools/shared/seedancePolicyErrors.js +13 -0
  423. package/dist-esm/tools/shared/seedancePolicyErrors.js.map +1 -1
  424. package/dist-esm/tools/shared/seedanceReferences.js +33 -0
  425. package/dist-esm/tools/shared/seedanceReferences.js.map +1 -0
  426. package/dist-esm/utils/helpers.js +8 -3
  427. package/dist-esm/utils/helpers.js.map +1 -1
  428. package/dist-esm/workflows/bindings.js +32 -2
  429. package/dist-esm/workflows/bindings.js.map +1 -1
  430. package/dist-esm/workflows/index.js +2 -0
  431. package/dist-esm/workflows/index.js.map +1 -1
  432. package/dist-esm/workflows/primitives/index.js +4 -0
  433. package/dist-esm/workflows/primitives/index.js.map +1 -0
  434. package/dist-esm/workflows/primitives/retryUntilCondition.js +95 -0
  435. package/dist-esm/workflows/primitives/retryUntilCondition.js.map +1 -0
  436. package/dist-esm/workflows/primitives/sanitizer.js +89 -0
  437. package/dist-esm/workflows/primitives/sanitizer.js.map +1 -0
  438. package/dist-esm/workflows/primitives/validateWithRubric.js +141 -0
  439. package/dist-esm/workflows/primitives/validateWithRubric.js.map +1 -0
  440. package/package.json +111 -4
  441. package/src/skill-runtime-source/crossSurfaceParity.ts +525 -0
  442. package/src/skill-runtime-source/index.ts +10 -0
  443. package/src/skill-runtime-source/seedanceAudioWindow.ts +61 -0
  444. package/src/skill-runtime-source/workflowStatus.ts +375 -0
  445. package/dist/contracts/index.mjs +0 -102
  446. package/dist/media/index.mjs +0 -116
  447. package/dist/public-skill-runtime/index.mjs +0 -141
  448. package/dist/replay/index.mjs +0 -12
  449. package/dist/runtime/index.mjs +0 -21
  450. package/dist/skills/asset_reference_management/index.mjs +0 -18
  451. package/dist/tools/index.mjs +0 -86
  452. package/dist/workflows/index.mjs +0 -22
package/README.md CHANGED
@@ -1,28 +1,19 @@
1
- # Sogni Client Wrapper
1
+ # @sogni-ai/sogni-intelligence-client
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/@sogni-ai/sogni-intelligence-client.svg)](https://www.npmjs.com/package/@sogni-ai/sogni-intelligence-client) [![License](https://img.shields.io/npm/l/@sogni-ai/sogni-intelligence-client.svg)](https://www.npmjs.com/package/@sogni-ai/sogni-intelligence-client)
4
4
 
5
- An enhanced Node.js wrapper for the [`@sogni-ai/sogni-client`](https://sdk-docs.sogni.ai/) library, designed for robustness, ease of use, and seamless integration with platforms like [n8n](https://n8n.io/).
5
+ The public, mid‑tier Node.js client for the [Sogni Supernet](https://sogni.ai/) — Sogni's OpenAI‑compatible LLM and agent API for image, video, music, and chat generation. Bundles a hardened wrapper over the [`@sogni-ai/sogni-client`](https://sdk-docs.sogni.ai/) SDK with the public‑safe subset of Sogni's creative‑agent platform: hosted tool definitions, the contract registry, asset manifests, `RunRecord` types with redaction, skill‑runtime helpers, and JSON Schema artifacts for cross‑language codegen.
6
6
 
7
- This library simplifies interaction with the Sogni AI Supernet by providing a promise-based API, automatic connection management, enhanced error handling, and a more developer-friendly interface.
7
+ For most agent builders this is the recommended starting point. Designed for third‑party integrations, downstream SDKs, and orchestration frameworks (n8n, LangChain, Anthropic skills, custom runtimes). Drives the same contracts and tool surface that the hosted `POST https://api.sogni.ai/v1/chat/completions`, `/v1/chat/runs`, and `/v1/creative-agent/workflows` endpoints use, so a client‑side agent loop stays shape‑locked with the server.
8
8
 
9
- ## Features
9
+ ## Which package should I install?
10
10
 
11
- - **Promise-Based API**: Modern `async/await` support for all core operations.
12
- - **Connection Management**: Automatic connection and reconnection handling.
13
- - **Video Rendering Support**: Generate videos using WAN and LTX-2 models (t2v, i2v, s2v, ia2v, a2v, v2v, animate workflows).
14
- - **Audio Generation Support**: Generate music/audio tracks with audio models and estimate audio costs.
15
- - **Image Editing Support**: Edit images using Qwen models with context images for multi-reference editing.
16
- - **LLM Chat + Tool Calling Support**: Use chat completions through Sogni's LLM worker network, including streaming and function/tool calling.
17
- - **Vision Chat + Thinking Controls**: Send OpenAI-style multimodal `image_url` messages and toggle reasoning with `think`.
18
- - **Chat Tool Execution Helpers**: Execute Sogni platform tool calls manually from the wrapper, including streaming follow-up loops.
19
- - **Flexible Authentication**: Token, cookies, or API key authentication.
20
- - **Wallet + Tracking Utilities**: Query Base/Etherlink wallet balances and inspect SDK-tracked projects/current account state.
21
- - **Simplified Configuration**: Sensible defaults and clear configuration options.
22
- - **Enhanced Error Handling**: Custom error classes for better error diagnosis.
23
- - **Type-Safe**: Written entirely in TypeScript with full type definitions.
24
- - **n8n-Ready**: Built with n8n integration in mind, managing connection lifecycles effectively.
25
- - **Utility Helpers**: Includes helpers for validation, retries, and formatting.
11
+ | You're building… | Install |
12
+ |---|---|
13
+ | Custom AI agent that calls Sogni tools, validates LLM tool arguments, manages asset references | **`@sogni-ai/sogni-intelligence-client`** (recommended) |
14
+ | Thin wrapper that only generates an image/video/audio from a single direct call | [`@sogni-ai/sogni-client`](https://www.npmjs.com/package/@sogni-ai/sogni-client) (raw SDK) |
15
+ | n8n workflow node | **`@sogni-ai/sogni-intelligence-client`** (n8n compat helpers preserved) |
16
+ | Anthropic‑style Claude Skill, OpenClaw plugin, Hermes / Manus agent | [`@sogni-ai/sogni-creative-agent-skill`](https://github.com/Sogni-AI/sogni-creative-agent-skill) (consumes intelligence‑client under the hood) |
26
17
 
27
18
  ## Installation
28
19
 
@@ -30,794 +21,239 @@ This library simplifies interaction with the Sogni AI Supernet by providing a pr
30
21
  npm install @sogni-ai/sogni-intelligence-client
31
22
  ```
32
23
 
33
- Or with Yarn:
24
+ Requires Node.js ≥ 18.
34
25
 
35
- ```bash
36
- yarn add @sogni-ai/sogni-intelligence-client
37
- ```
38
-
39
- ## Quick Start
40
-
41
- ### 1. Setup Environment Variables
42
-
43
- First, create a `.env` file in your project root to securely store your credentials:
44
-
45
- ```bash
46
- # Copy the example file
47
- cp node_modules/@sogni-ai/sogni-intelligence-client/.env.example .env
48
- ```
49
-
50
- ### 2. Install Dependencies
51
-
52
- ```bash
53
- npm install dotenv
54
- ```
55
-
56
- ### 3. Create Your Script
57
-
58
- ```typescript
59
- import { config } from 'dotenv';
60
- import { SogniClientWrapper } from '@sogni-ai/sogni-intelligence-client';
61
-
62
- // Load environment variables from .env file
63
- config();
64
-
65
- async function main() {
66
- // 1. Create and connect the client with credentials from .env
67
- const client = new SogniClientWrapper({
68
- username: process.env.SOGNI_USERNAME!,
69
- password: process.env.SOGNI_PASSWORD!,
70
- });
71
-
72
- try {
73
- // The client connects automatically on the first operation
74
- console.log('Client connected!');
75
-
76
- // 2. Find the most popular model
77
- const model = await client.getMostPopularModel();
78
- console.log(`Using model: ${model.id} (${model.workerCount} workers)`);
79
-
80
- // 3. Generate an image
81
- console.log('Generating image...');
82
- const result = await client.createProject({
83
- type: 'image',
84
- modelId: model.id,
85
- positivePrompt: 'A photorealistic portrait of a majestic lion in the savanna at sunset',
86
- negativePrompt: 'blurry, cartoon, low quality',
87
- stylePrompt: 'cinematic',
88
- numberOfMedia: 1,
89
- steps: 30,
90
- guidance: 8,
91
- });
92
-
93
- if (result.completed && result.imageUrls) {
94
- console.log('Image generation successful!');
95
- console.log('Image URLs:', result.imageUrls);
96
- } else {
97
- console.error('Image generation did not complete.');
98
- }
99
-
100
- } catch (error) {
101
- console.error('An error occurred:', error);
102
- } finally {
103
- // 4. Disconnect the client
104
- await client.disconnect();
105
- console.log('Client disconnected.');
106
- }
107
- }
26
+ ## Package structure
108
27
 
109
- main();
110
- ```
111
-
112
- ### 4. Run the Script
28
+ The package exposes the following subpath entry points so consumers import only what they need:
113
29
 
114
- ```bash
115
- # If using TypeScript
116
- npx tsx your-script.ts
117
-
118
- # If using compiled JavaScript
119
- node your-script.js
120
- ```
30
+ | Subpath | Purpose |
31
+ |---|---|
32
+ | `@sogni-ai/sogni-intelligence-client` | `SogniClientWrapper` connection class + helpers + re‑exports from the underlying SDK |
33
+ | `…/contracts` | Public contracts, default policies, repair recipes, prompt contracts, schema registry |
34
+ | `…/tools` | Sogni‑hosted tool definitions and argument validators (image, video, audio, editing, analysis) |
35
+ | `…/replay` | `RunRecord` types + redaction utilities (signed URLs, JWTs, bearer tokens scrubbed) |
36
+ | `…/runtime` | Contract runtime — apply policies, recipes, and prompt contracts at call sites |
37
+ | `…/public-skill-runtime` | Skill‑side helpers: classify turns, compile tool surface, dispatch tool calls |
38
+ | `…/skills/asset_reference_management` | Asset‑reference resolution helpers for hosted media |
39
+ | `…/workflows` | Creative‑workflow type definitions, bindings with embedded‑interpolation support, and a `primitives` namespace of pure helpers for `wf:*` stage tools (LLM judge + `__PASS__`/`__FAIL__` parser, bounded retry‑until‑predicate, storyboard script expander, dialogue duration fitter, SSRF allow‑list for fetched artifact URLs) |
40
+ | `…/media` | Media reference helpers (upload / download URL flows) |
41
+ | `…/chatRun` | Durable hosted `ChatRun` contracts — state machine, events, cost‑approval types |
42
+ | `…/context` | Context‑window primitives — token accounting, message protection, summarization budgeting |
43
+ | `…/openai-tools` | OpenAI‑shaped tool manifests (`app-tools.json`, `composition-tools.json`, `generation-tools.json`) baked into TS so consumers can compile a tool surface without filesystem reads |
44
+ | `…/skill-runtime-source` | Cross‑surface parity helpers (workflow status, Seedance audio windows) shared with the private skill runtime |
45
+ | `…/schemas/*` | Raw JSON Schema artifacts for cross‑language codegen (Swift, Kotlin, Python, etc.) |
121
46
 
122
- ## Video Rendering Support
123
-
124
- The wrapper supports video generation with Sogni WAN and LTX-2 models. Generate videos from text prompts, images, audio, or other videos.
125
-
126
- ### Video Generation Example
127
-
128
- ```typescript
129
- // Text-to-Video (t2v) using speed variant for reliability
130
- const videoResult = await client.createVideoProject({
131
- modelId: 'wan_v2.2-14b-fp8_t2v_lightx2v', // Speed variant (4 steps)
132
- positivePrompt: 'A serene waterfall flowing through a lush green forest',
133
- numberOfMedia: 1,
134
- frames: 81, // Generate 81 frames (5 seconds at 16fps)
135
- fps: 16, // 16 frames per second
136
- width: 640, // 640x640 resolution
137
- height: 640,
138
- steps: 4, // Optimized for speed variant
139
- outputFormat: 'mp4',
140
- waitForCompletion: true,
141
- timeout: 300000, // 5 minute timeout for video generation
142
- });
47
+ Each subpath ships dual CJS + ESM with TypeScript declarations.
143
48
 
144
- console.log('Video URLs:', videoResult.videoUrls);
145
- ```
49
+ ## Quick start
146
50
 
147
- ### Video Cost Estimate
51
+ ### 1. Configure credentials
148
52
 
149
- ```typescript
150
- const estimate = await client.estimateVideoCost({
151
- modelId: 'wan_v2.2-14b-fp8_i2v_lightx2v',
152
- width: 512,
153
- height: 512,
154
- frames: 81,
155
- fps: 16,
156
- steps: 4,
157
- tokenType: 'spark',
158
- });
53
+ Create a `.env` in your project root:
159
54
 
160
- console.log('Estimated USD cost:', estimate.usd);
55
+ ```env
56
+ SOGNI_USERNAME=your-username
57
+ SOGNI_PASSWORD=your-password
58
+ SOGNI_APP_ID=your-app-id # optional; auto‑generated if omitted
59
+ SOGNI_NETWORK=fast # or "relaxed"
161
60
  ```
162
61
 
163
- ### Video Workflows
164
-
165
- The wrapper supports multiple video generation workflows:
166
-
167
- 1. **Text-to-Video (t2v)**: Generate videos from text prompts
168
- 2. **Image-to-Video (i2v)**: Animate static images or interpolate between two images
169
- 3. **Sound-to-Video (s2v / ia2v / a2v)**: Drive generation with audio references
170
- 4. **Video-to-Video (v2v)**: Control motion/style from a reference video
171
- 5. **Animate Workflows**: Create character animations or motion transfers
172
-
173
- ### Advanced Video Examples
62
+ ### 2. Image generation
174
63
 
175
64
  ```typescript
176
- // Image-to-Video with interpolation
177
- const i2vResult = await client.createVideoProject({
178
- modelId: 'wan_v2.2-14b-fp8_i2v_lightx2v',
179
- positivePrompt: 'Smooth camera movement',
180
- referenceImage: startImageBuffer, // Starting image
181
- referenceImageEnd: endImageBuffer, // Optional: end image for interpolation
182
- width: 512,
183
- height: 512,
184
- frames: 81,
185
- fps: 16,
186
- steps: 4,
187
- autoResizeVideoAssets: true, // Auto-resize reference images (default: true)
188
- });
189
-
190
- // Animate with motion transfer
191
- const animateResult = await client.createVideoProject({
192
- modelId: 'wan_v2.2-14b-fp8_animate',
193
- positivePrompt: 'Character animation',
194
- referenceImage: characterImage, // Character to animate
195
- referenceVideo: motionVideo, // Video with motion to transfer
196
- frames: 90,
197
- fps: 30,
198
- });
199
-
200
- // LTX image+audio-to-video (ia2v)
201
- const ia2vResult = await client.createVideoProject({
202
- modelId: 'ltx2-13b-fp8_ia2v_distilled',
203
- positivePrompt: 'A cinematic portrait delivering the spoken line naturally',
204
- referenceImage: portraitBuffer,
205
- referenceAudio: speechBuffer,
206
- audioStart: 0,
207
- audioDuration: 5,
208
- fps: 24,
209
- duration: 5,
210
- numberOfMedia: 1,
211
- });
212
-
213
- // LTX audio-to-video (a2v)
214
- const a2vResult = await client.createVideoProject({
215
- modelId: 'ltx23-22b-fp8_a2v_distilled',
216
- positivePrompt: 'Abstract visuals that pulse with the soundtrack',
217
- referenceAudio: soundtrackBuffer,
218
- audioStart: 2,
219
- audioDuration: 6,
220
- fps: 24,
221
- duration: 6,
222
- numberOfMedia: 1,
223
- });
224
- ```
225
-
226
- ### Convenience Methods
227
-
228
- For cleaner code, use the dedicated convenience methods:
65
+ import 'dotenv/config';
66
+ import { SogniClientWrapper } from '@sogni-ai/sogni-intelligence-client';
229
67
 
230
- ```typescript
231
- // For images
232
- const imageResult = await client.createImageProject({
233
- modelId: 'flux1-schnell-fp8',
234
- positivePrompt: 'A beautiful sunset',
235
- numberOfMedia: 1,
68
+ const client = new SogniClientWrapper({
69
+ username: process.env.SOGNI_USERNAME!,
70
+ password: process.env.SOGNI_PASSWORD!,
236
71
  });
237
72
 
238
- // For videos
239
- const videoResult = await client.createVideoProject({
240
- modelId: 'wan_v2.2-14b-fp8_t2v',
241
- positivePrompt: 'Ocean waves crashing on a beach',
242
- numberOfMedia: 1,
243
- frames: 60,
244
- fps: 30,
245
- });
73
+ const model = await client.getMostPopularModel();
246
74
 
247
- // For audio
248
- const audioResult = await client.createAudioProject({
249
- modelId: 'ace-step-v1',
250
- positivePrompt: 'An uplifting cinematic ambient track',
75
+ const result = await client.createProject({
76
+ type: 'image',
77
+ modelId: model.id,
78
+ positivePrompt: 'A photorealistic portrait of a majestic lion at sunset',
79
+ negativePrompt: 'blurry, cartoon, low quality',
80
+ stylePrompt: 'cinematic',
251
81
  numberOfMedia: 1,
252
- duration: 30,
253
- steps: 20,
254
- outputFormat: 'mp3',
82
+ steps: 30,
83
+ guidance: 8,
255
84
  });
256
- ```
257
85
 
258
- ## Audio Generation
86
+ console.log(result.images.map((i) => i.url));
259
87
 
260
- ```typescript
261
- const audioEstimate = await client.estimateAudioCost({
262
- modelId: 'ace-step-v1',
263
- duration: 30,
264
- steps: 20,
265
- numberOfMedia: 1,
266
- tokenType: 'spark',
267
- });
268
-
269
- console.log('Estimated audio cost (USD):', audioEstimate.usd);
88
+ await client.disconnect();
270
89
  ```
271
90
 
272
- ## Chat Completions
91
+ ### 3. Tool calling against Sogni's hosted catalog
273
92
 
274
93
  ```typescript
275
- // Non-streaming
276
- const completion = await client.createChatCompletion({
277
- model: 'qwen3-30b-a3b-gptq-int4',
278
- messages: [{ role: 'user', content: 'Write a haiku about sunsets.' }],
279
- });
280
- console.log(completion.content);
281
-
282
- // Streaming
283
- const stream = await client.createChatCompletion({
284
- model: 'qwen3-30b-a3b-gptq-int4',
285
- messages: [{ role: 'user', content: 'Explain diffusion models simply.' }],
286
- stream: true,
94
+ import {
95
+ SogniClientWrapper,
96
+ SogniTools,
97
+ isSogniToolCall,
98
+ } from '@sogni-ai/sogni-intelligence-client';
99
+
100
+ const client = new SogniClientWrapper({ /* … */ });
101
+
102
+ const chat = await client.chat.completions.create({
103
+ model: 'openai/gpt-oss-120b',
104
+ messages: [{ role: 'user', content: 'Generate a 3‑second clip of a koi pond.' }],
105
+ tools: SogniTools.all, // the full Sogni-hosted tool catalog
287
106
  });
288
- for await (const chunk of stream) {
289
- process.stdout.write(chunk.content);
290
- }
291
- ```
292
-
293
- ### Tool Calling (Function Calling)
294
-
295
- `createChatCompletion()` accepts OpenAI-style `tools` and `tool_choice` parameters.
296
107
 
297
- ```typescript
298
- import type { ChatMessage, ToolCall, ToolDefinition } from '@sogni-ai/sogni-intelligence-client';
299
-
300
- const tools: ToolDefinition[] = [
301
- {
302
- type: 'function',
303
- function: {
304
- name: 'add_numbers',
305
- description: 'Add two numbers',
306
- parameters: {
307
- type: 'object',
308
- properties: {
309
- a: { type: 'number' },
310
- b: { type: 'number' },
311
- },
312
- required: ['a', 'b'],
313
- },
314
- },
315
- },
316
- ];
317
-
318
- const messages: ChatMessage[] = [
319
- { role: 'user', content: 'Please add 17 and 25.' },
320
- ];
321
-
322
- for (let turn = 0; turn < 4; turn++) {
323
- const result = await client.createChatCompletion({
324
- model: 'qwen3-30b-a3b-gptq-int4',
325
- messages,
326
- tools,
327
- tool_choice: 'auto',
328
- tokenType: 'spark',
329
- });
330
-
331
- const toolCalls = result.tool_calls || [];
332
- if (toolCalls.length === 0) {
333
- console.log('Final answer:', result.content);
334
- break;
335
- }
336
-
337
- messages.push({
338
- role: 'assistant',
339
- content: result.content || null,
340
- tool_calls: toolCalls,
341
- });
342
-
343
- for (const toolCall of toolCalls) {
344
- const args = JSON.parse(toolCall.function.arguments || '{}');
345
- let output = { error: `Unknown tool: ${toolCall.function.name}` };
346
-
347
- if (toolCall.function.name === 'add_numbers') {
348
- const a = Number(args.a || 0);
349
- const b = Number(args.b || 0);
350
- output = { a, b, sum: a + b };
351
- }
352
-
353
- messages.push({
354
- role: 'tool',
355
- tool_call_id: toolCall.id,
356
- name: toolCall.function.name,
357
- content: JSON.stringify(output),
358
- });
359
- }
108
+ const call = chat.choices[0].message.tool_calls?.[0];
109
+ if (call && isSogniToolCall(call.function.name)) {
110
+ // Hand the tool call off to Sogni's hosted execution surface, or
111
+ // dispatch it locally via /public-skill-runtime.
360
112
  }
361
113
  ```
362
114
 
363
- ### Sogni Platform Tools (Image/Video/Audio via Chat)
364
-
365
- The wrapper re-exports the SDK helpers for Sogni platform tool calling:
366
-
367
- - `SogniTools` — the canonical 24-tool surface (use `SogniTools.all` for the full list)
368
- - `isSogniToolCall()`
369
- - `parseToolCallArguments()`
370
-
371
- ```typescript
372
- import { SogniTools } from '@sogni-ai/sogni-intelligence-client';
373
-
374
- const result = await client.createChatCompletion({
375
- model: 'qwen3-30b-a3b-gptq-int4',
376
- messages: [{ role: 'user', content: 'Create a dramatic sunset image' }],
377
- tools: SogniTools.all,
378
- tool_choice: 'auto',
379
- tokenType: 'spark',
380
- });
381
- ```
382
-
383
- ### Vision Chat and Thinking Mode
115
+ ### 4. Replay a previous run with redaction
384
116
 
385
117
  ```typescript
386
- const result = await client.createChatCompletion({
387
- model: 'qwen3.5-35b-a3b-gguf-q4km',
388
- messages: [
389
- {
390
- role: 'user',
391
- content: [
392
- { type: 'text', text: 'Describe the scene and read any visible text.' },
393
- {
394
- type: 'image_url',
395
- image_url: {
396
- url: 'https://example.com/photo.jpg',
397
- detail: 'high',
398
- },
399
- },
400
- ],
401
- },
402
- ],
403
- think: false,
404
- max_tokens: 300,
405
- tokenType: 'spark',
406
- });
407
-
408
- console.log(result.content);
118
+ import {
119
+ type RunRecord,
120
+ redactRunRecord,
121
+ redactPayload,
122
+ } from '@sogni-ai/sogni-intelligence-client/replay';
123
+
124
+ const safeRecord: RunRecord = redactRunRecord(originalRecord);
125
+ // Signed URLs, bearer tokens, JWTs, and inline secrets are scrubbed.
409
126
  ```
410
127
 
411
- ### Manual Chat Tool Execution
412
-
413
- Useful for streaming or custom multi-round tool loops where you want the wrapper to execute returned Sogni tool calls directly.
128
+ ### 5. Validate a hosted‑tool argument blob
414
129
 
415
130
  ```typescript
416
- const result = await client.createChatCompletion({
417
- model: 'qwen3-30b-a3b-gptq-int4',
418
- messages: [{ role: 'user', content: 'Generate a neon cyberpunk city image.' }],
419
- tools: SogniTools.all,
420
- tool_choice: 'auto',
421
- tokenType: 'spark',
422
- });
423
-
424
- if (result.tool_calls?.length) {
425
- const toolResults = await client.executeChatTools(result.tool_calls, {
426
- tokenType: 'spark',
427
- onToolProgress: (toolCall, progress) => {
428
- console.log(toolCall.function.name, progress.status, progress.percent);
429
- },
430
- });
431
-
432
- console.log(toolResults);
433
- }
131
+ import {
132
+ validateAndNormalizeHostedToolArguments,
133
+ } from '@sogni-ai/sogni-intelligence-client/contracts';
134
+
135
+ const { ok, value, error } = validateAndNormalizeHostedToolArguments(
136
+ 'generate_image',
137
+ { prompt: 'a serene koi pond', steps: 30 },
138
+ );
139
+ if (!ok) throw error;
140
+ // `value` is the normalized argument object ready to dispatch.
434
141
  ```
435
142
 
436
- ### Full LLM Examples
437
-
438
- Run these scripts with `npx tsx`:
439
-
440
- - `examples/llm-chat-basic.ts`
441
- - `examples/llm-chat-streaming.ts`
442
- - `examples/llm-chat-vision.ts --image ./photo.jpg`
443
- - `examples/llm-tool-calling-custom.ts`
444
- - `examples/llm-tool-calling-sogni-tools.ts` (supports `--dry-run`)
445
-
446
- ## Image Editing with Context Images
143
+ ## Authentication
447
144
 
448
- The wrapper supports image editing using Qwen models that accept context images for multi-reference editing. This allows you to transform, combine, or edit images based on reference inputs.
449
-
450
- ### Supported Models
451
-
452
- | Model ID | Type | Recommended Steps | Max Context Images |
453
- |----------|------|-------------------|-------------------|
454
- | `qwen_image_edit_2511_fp8` | Standard | 20 | 3 |
455
- | `qwen_image_edit_2511_fp8_lightning` | Fast | 4 | 3 |
456
-
457
- ### Image Edit Example
145
+ The wrapper accepts three authentication strategies through the `SogniClientConfig`:
458
146
 
459
147
  ```typescript
460
- import { readFileSync } from 'fs';
461
-
462
- // Load your reference image(s)
463
- const referenceImage = readFileSync('./my-image.png');
148
+ // Username/password
149
+ new SogniClientWrapper({ username, password });
464
150
 
465
- // Create an image edit project
466
- const result = await client.createImageEditProject({
467
- modelId: 'qwen_image_edit_2511_fp8',
468
- positivePrompt: 'Transform the cat into a majestic lion',
469
- contextImages: [referenceImage],
470
- numberOfMedia: 1,
471
- steps: 20,
472
- guidance: 4.0,
473
- });
151
+ // API key
152
+ new SogniClientWrapper({ apiKey });
474
153
 
475
- console.log('Edited image URLs:', result.imageUrls);
154
+ // Token + cookies (typical for browser/edge contexts)
155
+ new SogniClientWrapper({ token, cookies });
476
156
  ```
477
157
 
478
- ### Using Multiple Context Images
158
+ Connection management, reconnection, and credit/balance polling are handled automatically. Call `client.disconnect()` when finished.
479
159
 
480
- Qwen models support up to 3 context images for complex editing operations:
160
+ ## Generation surfaces
481
161
 
482
- ```typescript
483
- const image1 = readFileSync('./subject.png');
484
- const image2 = readFileSync('./style-reference.png');
485
- const image3 = readFileSync('./background.png');
486
-
487
- const result = await client.createImageEditProject({
488
- modelId: 'qwen_image_edit_2511_fp8_lightning', // Fast variant
489
- positivePrompt: 'Combine the subject with the style and background',
490
- contextImages: [image1, image2, image3],
491
- numberOfMedia: 1,
492
- steps: 4, // Optimized for lightning variant
493
- guidance: 1.0,
494
- });
495
- ```
496
-
497
- ### Multiple Angles LoRA (Qwen Image Edit)
498
-
499
- ```typescript
500
- import { readFileSync } from 'fs';
162
+ The root wrapper exposes type‑safe project creation across every modality Sogni supports:
501
163
 
502
- const referenceImage = readFileSync('./subject.png');
164
+ - **Image generation** — Stable Diffusion XL, Flux, full model marketplace.
165
+ - **Video generation** — WAN 2.2, LTX‑2.3, Seedance v2; workflows `t2v`, `i2v`, `s2v`, `ia2v`, `a2v`, `v2v`, `animate_move`, `animate_replace`.
166
+ - **Audio generation** — music and SFX models with cost estimation.
167
+ - **Image editing** — Qwen vision‑aware editors with multi‑reference context images.
168
+ - **Chat completions** — OpenAI‑shaped chat API against Sogni's LLM worker network. Streaming, vision (`image_url`), reasoning (`think`), and function/tool calling are first‑class.
503
169
 
504
- const result = await client.createImageEditProject({
505
- modelId: 'qwen_image_edit_2511_fp8_lightning',
506
- positivePrompt: '<sks> front view eye-level shot medium shot',
507
- contextImages: [referenceImage],
508
- numberOfMedia: 1,
509
- steps: 4,
510
- guidance: 1.0,
511
- sampler: 'euler',
512
- scheduler: 'simple',
513
- outputFormat: 'jpg',
514
- loras: ['multiple_angles'],
515
- loraStrengths: [0.9],
516
- });
170
+ See the [SDK docs](https://sdk-docs.sogni.ai/) for full parameter references on each surface.
517
171
 
518
- console.log('Generated images:', result.imageUrls);
519
- ```
172
+ ## Contracts, tools, and skills
520
173
 
521
- ### Context Image Types
174
+ Sogni's hosted tool surface — `generate_image`, `generate_video`, `analyze_video`, `replace_video_segment`, and 20+ others — is described declaratively. Consumers can:
522
175
 
523
- The `contextImages` parameter accepts an array of `InputMedia` types:
176
+ - Enumerate the catalog: `import { SogniTools } from '@sogni-ai/sogni-intelligence-client'`.
177
+ - Validate / normalize arguments before dispatch: `validateAndNormalizeHostedToolArguments` from `/contracts`.
178
+ - Apply gating policies, repair recipes, and prompt contracts at runtime: `createPublicSkillDefaultContractRuntime` from `/public-skill-runtime`.
179
+ - Generate JSON Schema clients for other languages from `/schemas/*`.
524
180
 
525
- - `Buffer` - Node.js Buffer containing image data
526
- - `Blob` - Browser Blob object
527
- - `File` - Browser File object
528
- - `true` - Boolean indicating a pre-uploaded image
181
+ For an end‑to‑end agent example, see the [Sogni Creative Agent Skill](https://github.com/Sogni-AI/sogni-creative-agent-skill) — the `sogni-agent` CLI plus a `SKILL.md` behavior file for Claude Code, OpenClaw, Hermes Agent, and Manus. It consumes only this package's public surface.
529
182
 
530
- ### Helper Functions
183
+ ## RunRecord replay & redaction
531
184
 
532
- The wrapper provides helper functions for working with context images:
185
+ `RunRecord` is the canonical JSON representation of a Sogni run: tool calls, results, costs, audit trail, and timing. Useful for replay, post‑hoc audits, and offline analysis.
533
186
 
534
187
  ```typescript
535
- import { getMaxContextImages, supportsContextImages } from '@sogni-ai/sogni-intelligence-client';
536
-
537
- // Check if a model supports context images
538
- if (supportsContextImages('qwen_image_edit_2511_fp8')) {
539
- console.log('Model supports context images!');
540
- }
541
-
542
- // Get the maximum number of context images for a model
543
- const maxImages = getMaxContextImages('qwen_image_edit_2511_fp8'); // Returns 3
544
-
545
- // Other models have different limits:
546
- getMaxContextImages('flux-1-schnell'); // Returns 6
547
- getMaxContextImages('kontext-model'); // Returns 2
548
- getMaxContextImages('sd-xl-base'); // Returns 0 (not supported)
188
+ import {
189
+ type RunRecord,
190
+ type RunRecordRound,
191
+ type RunRecordToolCall,
192
+ type RunRecordToolResult,
193
+ emptyRunRecord,
194
+ redactRunRecord,
195
+ RUN_RECORD_SCHEMA_VERSION,
196
+ } from '@sogni-ai/sogni-intelligence-client/replay';
549
197
  ```
550
198
 
551
- ## API Reference
552
-
553
- ### `new SogniClientWrapper(config)`
554
-
555
- Creates a new client instance.
199
+ `redactRunRecord` / `redactPayload` scrub signed URLs, bearer tokens, JWTs, and inline secrets — call them before persisting or logging records.
556
200
 
557
- **Configuration (`SogniClientConfig`)**
201
+ ## Error handling
558
202
 
559
- | Parameter | Type | Default | Description |
560
- |---|---|---|---|
561
- | `authType` | `'token' \| 'cookies' \| 'apiKey'` | `'token'` | Authentication mode. |
562
- | `username` | `string` | Conditionally required | Required for `token` auth; optional for `cookies`/`apiKey`. |
563
- | `password` | `string` | Conditionally required | Required for `token` auth; optional for `cookies`/`apiKey`. |
564
- | `apiKey` | `string` | Conditionally required | Required for `apiKey` auth. |
565
- | `appId` | `string` | Auto-generated UUID | Unique ID for your application. |
566
- | `network` | `'fast' \| 'relaxed'` | `'fast'` | The Sogni network to use. |
567
- | `testnet` | `boolean` | `false` | Connect to the testnet network. |
568
- | `socketEndpoint` | `string` | `undefined` | Override the default WebSocket API endpoint. |
569
- | `restEndpoint` | `string` | `undefined` | Override the default REST API endpoint. |
570
- | `disableSocket` | `boolean` | `false` | Disable WebSocket connection (advanced/testing). |
571
- | `allowInsecureTLS` | `boolean` | `false` | Allow insecure TLS (useful for testnet with self-signed certs). |
572
- | `autoConnect` | `boolean` | `true` | Connect automatically on the first operation. |
573
- | `reconnect` | `boolean` | `true` | Attempt to reconnect if the connection is lost. |
574
- | `reconnectInterval` | `number` | `5000` | Time in ms between reconnect attempts. |
575
- | `timeout` | `number` | `300000` | Default timeout in ms for operations. |
576
- | `debug` | `boolean` | `false` | Enable detailed console logging. |
577
-
578
- #### API Key Authentication Example
203
+ Errors are typed for precise dispatch:
579
204
 
580
205
  ```typescript
581
- const client = new SogniClientWrapper({
582
- authType: 'apiKey',
583
- apiKey: process.env.SOGNI_API_KEY!,
584
- network: 'fast',
585
- });
206
+ import {
207
+ SogniError,
208
+ SogniConnectionError,
209
+ SogniAuthenticationError,
210
+ SogniProjectError,
211
+ SogniTimeoutError,
212
+ SogniBalanceError,
213
+ SogniValidationError,
214
+ SogniConfigurationError,
215
+ SogniModelNotFoundError,
216
+ SogniNetworkError,
217
+ } from '@sogni-ai/sogni-intelligence-client';
586
218
  ```
587
219
 
588
- ### Core Methods
589
-
590
- - `connect(): Promise<void>`: Manually initiates the connection to Sogni.
591
- - `disconnect(): Promise<void>`: Disconnects the client.
592
- - `isConnected(): boolean`: Checks if the client is currently connected.
593
- - `getConnectionState(): ConnectionState`: Returns the current connection status.
594
-
595
- ### Main Operations
596
-
597
- - `createProject(config: ProjectConfig): Promise<ProjectResult>`: Creates a new image, video, or audio generation project.
598
- - `waitForCompletion` (default: `true`): If true, the promise resolves only when the media is ready.
599
- - For images: returns `imageUrls` in result
600
- - For videos: returns `videoUrls` in result
601
- - For audio: returns `audioUrls` in result
602
- - `createImageProject(config)`: Convenience method for image generation (automatically sets `type: 'image'`).
603
- - `createVideoProject(config)`: Convenience method for video generation (automatically sets `type: 'video'`).
604
- - `createAudioProject(config)`: Convenience method for audio generation (automatically sets `type: 'audio'`).
605
- - `createImageEditProject(config: QwenImageEditConfig)`: Convenience method for image editing with context images (validates model-specific limits).
606
- - `getAvailableModels(options?: GetModelsOptions): Promise<ModelInfo[]>`: Retrieves a list of available models.
607
- - `getModel(modelId: string): Promise<ModelInfo>`: Retrieves details for a specific model.
608
- - `getMostPopularModel(): Promise<ModelInfo>`: A helper to get the model with the most active workers.
609
- - `getBalance(): Promise<BalanceInfo>`: Fetches your current SOGNI and Spark token balances using the `account.refreshBalance()` method.
610
- - `getWalletBalance(walletAddress?, provider?): Promise<WalletBalanceInfo>`: Fetches Base or Etherlink wallet balances. When `walletAddress` is omitted, the wrapper uses the connected account wallet.
611
- - `getCurrentAccount(): CurrentAccount | null`: Returns the SDK's current account snapshot if the client has connected.
612
- - `getTrackedProjects(): Project[]`: Returns the projects currently tracked by the underlying SDK instance.
613
- - `getSizePresets(network: 'fast' \| 'relaxed', modelId: string): Promise<SizePreset[]>`: Gets available output size presets for a model.
614
- - `estimateVideoCost(params: VideoCostEstimateParams): Promise<CostEstimate>`: Estimates video generation costs (frames/duration, fps, steps, size).
615
- - `estimateAudioCost(params: AudioCostEstimateParams): Promise<CostEstimate>`: Estimates audio generation costs (duration, steps, count).
616
- - `createChatCompletion(params)`: Creates chat completions (streaming or non-streaming, including `tools` / `tool_choice` function calling).
617
- - `executeChatTool(toolCall, options?)`: Executes a single Sogni platform tool call returned by chat.
618
- - `executeChatTools(toolCalls, options?)`: Executes multiple tool calls, including mixed Sogni/custom tool flows.
619
- - `estimateChatCost(params)`: Estimates chat completion cost.
620
- - `getAvailableChatModels()`: Returns available chat/LLM models.
621
- - `waitForChatModels(timeout?)`: Waits until chat/LLM models are available.
622
- - SDK helper exports: `ChatStream`, `ChatToolsApi`, `CurrentAccount`, `SogniTools`, `isSogniToolCall`, `parseToolCallArguments`.
623
-
624
- ### Event Handling
625
-
626
- The wrapper is an `EventEmitter` and provides type-safe events.
627
-
628
- ```typescript
629
- import { ClientEvent } from '@sogni-ai/sogni-intelligence-client';
630
-
631
- client.on(ClientEvent.CONNECTED, () => {
632
- console.log('Client is connected!');
633
- });
634
-
635
- client.on(ClientEvent.PROJECT_PROGRESS, (progress) => {
636
- console.log(`Project ${progress.projectId} is ${progress.percentage}% complete.`);
637
- if (progress.estimatedTimeRemaining) {
638
- console.log(`ETA: ${Math.round(progress.estimatedTimeRemaining / 1000)}s`);
639
- }
640
- });
641
-
642
- client.on(ClientEvent.ERROR, (error) => {
643
- console.error('A client error occurred:', error.message);
644
- });
220
+ Each error carries `cause` and a typed `data` field where applicable.
645
221
 
646
- // Per-media events - Display outputs as soon as they're ready!
647
- client.on(ClientEvent.JOB_COMPLETED, (data) => {
648
- console.log(`Job ${data.jobIndex + 1}/${data.totalJobs} completed!`);
649
- console.log(`URL: ${data.imageUrl || data.videoUrl || data.audioUrl}`);
650
- // You can now handle this individual output without waiting for the entire batch
651
- });
222
+ ## TypeScript & module formats
652
223
 
653
- client.on(ClientEvent.JOB_FAILED, (data) => {
654
- console.log(`Job ${data.jobIndex + 1}/${data.totalJobs} failed:`, data.error);
655
- });
656
- ```
657
-
658
- #### Available Events
659
-
660
- | Event | Payload | Description |
661
- |---|---|---|
662
- | `connected` | `void` | Fired when the client successfully connects. |
663
- | `disconnected` | `void` | Fired when the client disconnects. |
664
- | `reconnecting` | `number` | Fired when a reconnection attempt starts. Payload is the attempt number. |
665
- | `error` | `ErrorData` | Fired when a client or connection error occurs. |
666
- | `projectProgress` | `ProjectProgress` | Fired with real-time progress updates for a project. |
667
- | `projectCompleted` | `ProjectResult` | Fired when a project successfully completes. |
668
- | `projectFailed` | `ErrorData` | Fired when a project fails. |
669
- | **`jobCompleted`** | **`JobCompletedData`** | **Fired when an individual job finishes (image/video/audio).** |
670
- | **`jobFailed`** | **`JobFailedData`** | **Fired when an individual job fails.** |
671
- | `projectEvent` | `ProjectEvent` | Raw project events from the SDK (`queued`, `completed`, `error`). |
672
- | `jobEvent` | `JobEvent` | Raw job events from the SDK (includes `jobETA`, `started`, `progress`, etc). |
673
- | `chatToken` | `ChatCompletionChunk` | Fired for each streaming chat token chunk. |
674
- | `chatCompleted` | `ChatCompletionResult` | Fired when a chat completion finishes. |
675
- | `chatError` | `ChatErrorData` | Fired when a chat completion fails. |
676
- | `chatJobState` | `ChatJobStateEvent` | Fired on chat job state transitions. |
677
- | `chatModelsUpdated` | `Record<string, LLMModelInfo>` | Fired when available chat models are updated. |
678
-
679
- #### Per-Job Event Example
680
-
681
- Perfect for displaying batch outputs immediately as they complete:
682
-
683
- ```typescript
684
- const client = new SogniClientWrapper({
685
- username: process.env.SOGNI_USERNAME!,
686
- password: process.env.SOGNI_PASSWORD!,
687
- });
224
+ - Written in TypeScript; full `.d.ts` declarations ship for every subpath.
225
+ - Dual CJS + ESM builds (`require()` and `import` both work).
226
+ - `moduleResolution: 'node'` and `'bundler'` both supported; `'node16'` / `'nodenext'` consumers should prefer the `import` condition.
688
227
 
689
- // Listen for individual image completions
690
- client.on(ClientEvent.JOB_COMPLETED, (data) => {
691
- console.log(`✓ Image ${data.jobIndex + 1} of ${data.totalJobs} ready!`);
692
- console.log(` URL: ${data.imageUrl}`);
693
- // Display the image in your UI immediately
694
- displayImage(data.imageUrl);
695
- });
228
+ ## Migrating from `@sogni-ai/sogni-client-wrapper`
696
229
 
697
- // Generate a batch of images
698
- const result = await client.createProject({
699
- type: 'image',
700
- modelId: 'flux1-schnell-fp8',
701
- positivePrompt: 'A beautiful landscape',
702
- numberOfMedia: 4, // Generate 4 images
703
- steps: 4,
704
- guidance: 3.5,
705
- });
230
+ If you previously installed `@sogni-ai/sogni-client-wrapper`, the import path is the only thing that changes:
706
231
 
707
- // All 4 images will be displayed as they complete, not all at once!
232
+ ```diff
233
+ - import { SogniClientWrapper } from '@sogni-ai/sogni-client-wrapper';
234
+ + import { SogniClientWrapper } from '@sogni-ai/sogni-intelligence-client';
708
235
  ```
709
236
 
710
- ## Error Handling
237
+ All wrapper APIs are preserved at the root export. The intelligence client adds the new subpaths above; adopt them incrementally. The old `@sogni-ai/sogni-client-wrapper` npm name is deprecated.
711
238
 
712
- The library throws custom errors that extend `SogniError`. This allows you to catch specific types of errors.
239
+ ## Related packages and docs
713
240
 
714
- - `SogniConnectionError`: Issues with connecting to the WebSocket server.
715
- - `SogniAuthenticationError`: Invalid credentials (username/password, cookie session, or API key).
716
- - `SogniProjectError`: The image generation project failed.
717
- - `SogniTimeoutError`: An operation took longer than the configured timeout.
718
- - `SogniValidationError`: Invalid configuration or parameters.
719
- - `SogniBalanceError`: Insufficient token balance.
720
-
721
- ```typescript
722
- import { SogniAuthenticationError, SogniProjectError } from '@sogni-ai/sogni-intelligence-client';
723
-
724
- try {
725
- // ... your code
726
- } catch (error) {
727
- if (error instanceof SogniAuthenticationError) {
728
- console.error('Please check your credentials.');
729
- } else if (error instanceof SogniProjectError) {
730
- console.error('The image generation failed. Please try a different prompt or model.');
731
- } else {
732
- console.error('An unknown error occurred:', error);
733
- }
734
- }
735
- ```
241
+ | | Where |
242
+ |---|---|
243
+ | **Intelligence Client docs** | https://sdk-docs.sogni.ai/our-superapps/sogni-sdk/intelligence-client/ |
244
+ | **Sogni Intelligence API** | https://sdk-docs.sogni.ai/sogni-intelligence/introduction/ |
245
+ | **`@sogni-ai/sogni-client`** (raw SDK) | [npm](https://www.npmjs.com/package/@sogni-ai/sogni-client) · [docs](https://sdk-docs.sogni.ai/) |
246
+ | **`@sogni-ai/sogni-creative-agent-skill`** (CLI + Anthropic skill) | [GitHub](https://github.com/Sogni-AI/sogni-creative-agent-skill) · [npm](https://www.npmjs.com/package/@sogni-ai/sogni-creative-agent-skill) |
247
+ | **SogniKit** (Swift, regenerated from `/schemas/*.json`) | https://github.com/Sogni-AI/SogniKit |
248
+ | `@sogni/creative-agent` (private) | Server‑side orchestration, billing enforcement, persona management. Not on npm. |
736
249
 
737
250
  ## Testing
738
251
 
739
- The library includes basic unit tests, example type-checking, and end-to-end tests.
740
-
741
- ### Running Tests
742
-
743
252
  ```bash
744
- # Run basic unit tests (no credentials required)
745
- npm test
746
-
747
- # Type-check all example scripts (including LLM/tool-calling examples)
748
- npm run test:examples
749
-
750
- # Run end-to-end tests (requires Sogni API credentials)
751
- npm run test:e2e
752
-
753
- # Run only LLM/tool-calling e2e tests
754
- npm run test:e2e:llm
755
-
756
- # Run all tests
757
- npm run test:all
253
+ npm test # unit + type checks; no credentials required
254
+ npm run test:e2e # full end-to-end, requires SOGNI_USERNAME/SOGNI_PASSWORD in .env
758
255
  ```
759
256
 
760
- ### Setting Up End-to-End Tests
761
-
762
- To run the end-to-end tests, you need to provide your Sogni API credentials via environment variables:
763
-
764
- 1. Copy the example environment file:
765
- ```bash
766
- cp .env.example .env
767
- ```
768
-
769
- 2. Edit `.env` and add your Sogni credentials:
770
- ```env
771
- SOGNI_USERNAME=your_sogni_username
772
- SOGNI_PASSWORD=your_sogni_password
773
- # Optional: force a specific chat/LLM model for e2e tests
774
- # SOGNI_LLM_MODEL=qwen3-30b-a3b-gptq-int4
775
- # Optional: fail suite if LLM tests cannot run (default: skip LLM tests if unavailable)
776
- # SOGNI_REQUIRE_LLM_E2E=true
777
- # Optional: fail suite if tool-calling tests cannot get tool_calls
778
- # SOGNI_REQUIRE_TOOL_CALL_E2E=true
779
- # Optional: run only LLM/tool-calling e2e tests
780
- # SOGNI_E2E_SCOPE=llm
781
- ```
782
-
783
- 3. Run the e2e tests:
784
- ```bash
785
- npm run test:e2e
786
- ```
787
-
788
- **Note:** The e2e tests make real API calls and may consume tokens from your Sogni account. They include image/video generation and live LLM chat calls.
789
-
790
- ## TypeScript
791
-
792
- This library is written in TypeScript and exports all necessary types for a fully-typed experience.
793
-
794
- - `SogniClientConfig`: Configuration for the client constructor.
795
- - `ProjectConfig`: Parameters for creating a project (union of `ImageProjectConfig`, `VideoProjectConfig`, and `AudioProjectConfig`).
796
- - `ImageProjectConfig`: Parameters specific to image generation.
797
- - `VideoProjectConfig`: Parameters specific to video generation.
798
- - `AudioProjectConfig`: Parameters specific to audio generation.
799
- - `QwenImageEditConfig`: Parameters for image editing with context images.
800
- - `InputMedia`: Type for media inputs (`File | Buffer | Blob | boolean`).
801
- - `ProjectResult`: The return type for a completed project.
802
- - `VideoCostEstimateParams`: Parameters for estimating video cost.
803
- - `AudioCostEstimateParams`: Parameters for estimating audio cost.
804
- - `CostEstimate`: Cost estimate response shape.
805
- - `ModelInfo`: Detailed information about an available model.
806
- - `BalanceInfo`: Your token balance.
807
- - `ErrorData`: The structure of error objects.
808
- - `VideoWorkflowType`: Video generation workflow types (`t2v`, `i2v`, `s2v`, `ia2v`, `a2v`, `v2v`, `animate-move`, `animate-replace`).
809
- - `JobCompletedData`: Data emitted when an individual job completes.
810
- - `JobFailedData`: Data emitted when an individual job fails.
811
- - `ChatCompletionParams` / `ChatCompletionResult` / `ChatCompletionChunk`: Types for chat completions.
812
- - `ContentPart` / `ImageUrlContentPart`: Types for multimodal chat content.
813
- - `ToolDefinition` / `ToolChoice` / `ToolCall` / `ToolCallDelta`: Types for LLM tool/function calling.
814
- - `ToolExecutionOptions` / `ToolExecutionProgress` / `ToolExecutionResult` / `ToolHistoryEntry`: Types for manual or automatic chat tool execution.
815
- - `LLMModelInfo` / `LLMCostEstimation`: Types for chat model metadata and cost estimates.
816
- - `WalletBalanceInfo`: Wallet balance response shape for Base/Etherlink lookups.
817
- - `SogniTools` / `isSogniToolCall` / `parseToolCallArguments`: Helper exports for platform tool calling workflows.
818
- - `ProjectEvent`: Raw project events from the SDK.
819
- - `JobEvent`: Raw job events from the SDK (includes ETA updates).
820
-
821
257
  ## License
822
258
 
823
- [MIT](LICENSE)
259
+ MIT — see [LICENSE](./LICENSE).