@sogni-ai/sogni-client 5.27.1 → 5.28.0

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/AGENTS.md CHANGED
@@ -266,6 +266,38 @@ chore: Update example scripts for video generation
266
266
 
267
267
  **Important:** Changes that only affect the `/examples` folder should typically use `chore:` since they don't affect the published SDK package.
268
268
 
269
+ ## Python Client Parity
270
+
271
+ There is a second official client, [`sogni-client-python`](https://github.com/Sogni-AI/sogni-client-python),
272
+ which is a hand-maintained port of this SDK — not a generated artifact. It does
273
+ not update itself when this package publishes.
274
+
275
+ **Whenever this package publishes a release, port the same change to the Python
276
+ client.** A release here that changes the client contract — model IDs and their
277
+ validation, request/keyframe shape, event or job fields, socket/recovery
278
+ behavior, hosted tool schemas — leaves Python callers on a stale contract until
279
+ someone does. The drift is silent: the Python client keeps working and simply
280
+ does not know about the new surface.
281
+
282
+ That has already bitten us. The Python client sat at `5.21.3` while this package
283
+ reached `5.27.1`, so it rejected the FastH3 `minimax-h3-fastvideo-int8_*_turbo`
284
+ checkpoints as non-video models after they became the default Turbo engine, and
285
+ it still failed every in-flight project on a socket drop — behavior removed here
286
+ in 5.24.0.
287
+
288
+ How to port:
289
+ 1. Read this repo's `CHANGELOG.md` between the Python client's
290
+ `pyproject.toml` version and the new one; each entry is one port.
291
+ 2. Mirror the change in `sogni-client-python`, matching validation messages and
292
+ wire field names exactly so both clients fail the same way.
293
+ 3. Sync `sogni_client/data/hosted_tools.json` from
294
+ `src/Chat/_hostedToolsManifest.generated.ts` when tool schemas moved, then
295
+ re-pin `tests/fixtures/hosted-tool-alias-parity.generated.json`.
296
+ 4. Set the Python version to match this package's version and tag `v<version>`.
297
+
298
+ Not every release needs a port — a `chore:` release or a Node-only change does
299
+ not. Judge by whether the client contract moved.
300
+
269
301
  ## Common Tasks Quick Reference
270
302
 
271
303
  ### Generate an Image
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [5.28.0](https://github.com/Sogni-AI/sogni-client/compare/v5.27.1...v5.28.0) (2026-09-04)
2
+
3
+
4
+ ### Features
5
+
6
+ * **announcements:** add the appAlert event and announcements API ([abcc1f4](https://github.com/Sogni-AI/sogni-client/commit/abcc1f4de5a384bbfffe6de0ec7b922ed59df43d))
7
+
1
8
  ## [5.27.1](https://github.com/Sogni-AI/sogni-client/compare/v5.27.0...v5.27.1) (2026-09-02)
2
9
 
3
10
 
package/README.md CHANGED
@@ -53,7 +53,7 @@ yarn add @sogni-ai/sogni-client
53
53
  ## Core concepts
54
54
 
55
55
  In order to use Sogni Supernet, you need an active Sogni account with a positive SOGNI or Spark token balance. You can authenticate using either an **API key** (recommended) or **username and password**.
56
- You can create a free account in our [Web App](https://app.sogni.ai) or [Mac App](https://www.sogni.ai/studio) which will give you tokens just for signing up and confirming your email. Each email-verified account is allowed 400 free Spark render credits per month. On the API, free credits can be used with Z-Image Turbo; paid credits can access all models and features.
56
+ You can create a free account in our [Web App](https://app.sogni.ai) or [Mac App](https://www.sogni.ai/studio) which will give you tokens just for signing up and confirming your email. Each email-verified account is allowed 400 free Spark render credits per month. On the API, free credits can be used with Krea 2 Turbo; paid credits can access all models and features.
57
57
 
58
58
  **To get your API key:** Log in to [dashboard.sogni.ai](https://dashboard.sogni.ai), click your **Username** dropdown in the top-right corner, and provision your API key.
59
59
 
@@ -0,0 +1,36 @@
1
+ import ApiGroup from '../ApiGroup.js';
2
+ import type { AppAlert } from '../ApiClient/WebSocketClient/events.js';
3
+ /**
4
+ * Admin-authored in-app announcements — pinned banners and toasts composed in
5
+ * the Sogni Admin Portal.
6
+ *
7
+ * The socket is the primary delivery path: subscribe to the `appAlert` event
8
+ * (opt in with `socketEventSubscriptions: { appAlert: true }`) and the server
9
+ * pushes announcements live AND replays any live pinned banner on connect, so a
10
+ * user who was offline when one published still receives it.
11
+ *
12
+ * This REST surface covers the two moments the socket cannot:
13
+ * - `active()` at launch, before the socket has authenticated
14
+ * - `dismiss()`, which must persist per ACCOUNT rather than per device so a
15
+ * banner dismissed on one client stays dismissed on the next
16
+ *
17
+ * Full contract: `docs/app-alert-contract.md` in sogni-socket.
18
+ */
19
+ declare class AnnouncementsApi extends ApiGroup {
20
+ /**
21
+ * Announcements currently live for the signed-in account, minus anything the
22
+ * account has already dismissed.
23
+ *
24
+ * @param platform Optional `appSource` for this client (e.g. `'sogni-mac'`).
25
+ * Platform-scoped announcements only match when it is supplied — an
26
+ * announcement narrowed to macOS is deliberately withheld from a caller
27
+ * that cannot say what it is, rather than sent to everyone.
28
+ */
29
+ active(platform?: string): Promise<AppAlert[]>;
30
+ /**
31
+ * Dismiss one announcement for the signed-in account, on every device.
32
+ * Call this when the user closes a pinned announcement.
33
+ */
34
+ dismiss(id: string): Promise<void>;
35
+ }
36
+ export default AnnouncementsApi;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const ApiGroup_js_1 = __importDefault(require("../ApiGroup.js"));
16
+ /**
17
+ * Admin-authored in-app announcements — pinned banners and toasts composed in
18
+ * the Sogni Admin Portal.
19
+ *
20
+ * The socket is the primary delivery path: subscribe to the `appAlert` event
21
+ * (opt in with `socketEventSubscriptions: { appAlert: true }`) and the server
22
+ * pushes announcements live AND replays any live pinned banner on connect, so a
23
+ * user who was offline when one published still receives it.
24
+ *
25
+ * This REST surface covers the two moments the socket cannot:
26
+ * - `active()` at launch, before the socket has authenticated
27
+ * - `dismiss()`, which must persist per ACCOUNT rather than per device so a
28
+ * banner dismissed on one client stays dismissed on the next
29
+ *
30
+ * Full contract: `docs/app-alert-contract.md` in sogni-socket.
31
+ */
32
+ class AnnouncementsApi extends ApiGroup_js_1.default {
33
+ /**
34
+ * Announcements currently live for the signed-in account, minus anything the
35
+ * account has already dismissed.
36
+ *
37
+ * @param platform Optional `appSource` for this client (e.g. `'sogni-mac'`).
38
+ * Platform-scoped announcements only match when it is supplied — an
39
+ * announcement narrowed to macOS is deliberately withheld from a caller
40
+ * that cannot say what it is, rather than sent to everyone.
41
+ */
42
+ active(platform) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const res = yield this.client.rest.get('/v1/announcements/active', platform ? { platform } : undefined);
45
+ return res.data.announcements || [];
46
+ });
47
+ }
48
+ /**
49
+ * Dismiss one announcement for the signed-in account, on every device.
50
+ * Call this when the user closes a pinned announcement.
51
+ */
52
+ dismiss(id) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ yield this.client.rest.post(`/v1/announcements/${encodeURIComponent(id)}/dismiss`);
55
+ });
56
+ }
57
+ }
58
+ exports.default = AnnouncementsApi;
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Announcements/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iEAAsC;AAItC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,gBAAiB,SAAQ,qBAAQ;IACrC;;;;;;;;OAQG;IACG,MAAM,CAAC,QAAiB;;YAC5B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CACpC,0BAA0B,EAC1B,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CACpC,CAAC;YACF,OAAO,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;QACtC,CAAC;KAAA;IAED;;;OAGG;IACG,OAAO,CAAC,EAAU;;YACtB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CACzB,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,UAAU,CACtD,CAAC;QACJ,CAAC;KAAA;CACF;AAED,kBAAe,gBAAgB,CAAC"}
@@ -261,6 +261,60 @@ export type ToastMessage = {
261
261
  autoClose: number;
262
262
  stickyID: string;
263
263
  };
264
+ /** A call to action rendered inside an announcement. Always an absolute http(s) URL. */
265
+ export type AppAlertAction = {
266
+ label: string;
267
+ href: string;
268
+ /** Open in a new tab / the system browser rather than routing in-app. */
269
+ external?: boolean;
270
+ };
271
+ /**
272
+ * An admin-authored in-app announcement, composed in the Sogni Admin Portal.
273
+ *
274
+ * OPT-IN: the server sends this only to clients that asked for it with
275
+ * `socketEventSubscriptions: { appAlert: true }`. A client that does not opt in
276
+ * keeps receiving the same announcement as a plain {@link ToastMessage}, so this
277
+ * event can be adopted at any time without coordination. A client never
278
+ * receives both renderings of one announcement.
279
+ *
280
+ * NOT at-most-once: a live pinned announcement is re-sent on every reconnect
281
+ * while its window is open, so a user who was offline when it published still
282
+ * sees it. Deduplicate on `id`.
283
+ *
284
+ * Full contract: `docs/app-alert-contract.md` in sogni-socket.
285
+ */
286
+ export type AppAlert = {
287
+ /** Stable across redeliveries; also the key for `announcements.dismiss(id)`. */
288
+ id: string;
289
+ /** `toast` is a one-shot; `banner` persists until dismissed or `endsAt`. */
290
+ kind: 'toast' | 'banner';
291
+ severity: 'info' | 'success' | 'warn' | 'danger';
292
+ /**
293
+ * Icon token, never a URL — map it to your own icon set. One of `info`,
294
+ * `success`, `warning`, `error`, `megaphone`, `wrench`, `sparkles`, `gift`,
295
+ * `rocket`, `clock`. Absent means "use the icon for `severity`".
296
+ */
297
+ icon?: string;
298
+ /** Optional `#RRGGBB` tint. Ignoring it must still render a legible alert. */
299
+ accent?: string;
300
+ title: string;
301
+ /**
302
+ * Restricted markdown: paragraphs, bold, italic, inline code, strikethrough,
303
+ * links, and line breaks. No images, no raw HTML, no headings or lists.
304
+ */
305
+ bodyMarkdown: string;
306
+ /** Do not auto-dismiss. Banners are pinned; toasts normally are not. */
307
+ pinned: boolean;
308
+ /** When false, hide the close affordance — it still clears at `endsAt`. */
309
+ dismissible: boolean;
310
+ /** Toasts only. Milliseconds. */
311
+ autoCloseMs?: number;
312
+ actions?: AppAlertAction[];
313
+ /** Epoch ms. */
314
+ startsAt: number;
315
+ /** Epoch ms. Always present for a banner. */
316
+ endsAt?: number;
317
+ };
264
318
  export type ArtistCancelConfirmation = {
265
319
  didCancel: boolean;
266
320
  error_message?: string;
@@ -397,6 +451,14 @@ export type SocketEventMap = {
397
451
  * @event WebSocketClient#toastMessage - Toast message received
398
452
  */
399
453
  toastMessage: ToastMessage;
454
+ /**
455
+ * @event WebSocketClient#appAlert - Admin announcement received (banner or toast)
456
+ *
457
+ * Opt in with `socketEventSubscriptions: { appAlert: true }`; without it the
458
+ * server sends the same announcement as `toastMessage` instead. Redelivered on
459
+ * reconnect while a pinned announcement is live — deduplicate on `id`.
460
+ */
461
+ appAlert: AppAlert;
400
462
  artistCancelConfirmation: ArtistCancelConfirmation;
401
463
  };
402
464
  export type SocketEventName = keyof SocketEventMap;
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ import type { ProjectResolution } from './Projects/index.js';
17
17
  import { PROJECT_LOST_ORIGINAL_CODE, isProjectLostError, projectParamsFromRecoveredProject } from './Projects/recovery.js';
18
18
  import type { Balances, Reward, RewardCantClaimReason, TxHistoryEntry } from './Account/types.js';
19
19
  import type { CreateSubscriptionCheckoutOptions, SubscriptionCheckoutResult, SubscriptionEntitlementSnapshot, SubscriptionFairUseState, SubscriptionPlanId, SubscriptionPlanInterval, SubscriptionPlan, SubscriptionPortalSession, SubscriptionRedirectType, SubscriptionStatus, SubscriptionTerm, SubscriptionUsage, TrialEligibility, TrialReasonCode } from './Account/subscription.types.js';
20
- import type { ToastMessage } from './ApiClient/WebSocketClient/events.js';
20
+ import type { AppAlert, AppAlertAction, ToastMessage } from './ApiClient/WebSocketClient/events.js';
21
21
  import type DataEntity from './lib/DataEntity.js';
22
22
  import { ControlNetName, ControlNetParams, ControlNetMode, VideoControlNetName, VideoControlNetParams } from './Projects/types/ControlNetParams.js';
23
23
  import ChatApi from './Chat/index.js';
@@ -32,6 +32,7 @@ import { CreativeWorkflowArtifact, CreativeWorkflowEvent, CreativeWorkflowRecord
32
32
  import { ForkWorkflowTemplateBody, ListWorkflowTemplatesOptions, ListWorkflowTemplatesResult, WorkflowTemplate, WorkflowTemplateAuthor, WorkflowTemplateRequestOptions, WorkflowTemplateStability, WorkflowTemplateVisibility, WorkflowTemplateVisibilityFilter } from './CreativeWorkflows/Templates/types.js';
33
33
  import StatsApi from './Stats/index.js';
34
34
  import ReplayApi from './Replay/index.js';
35
+ import AnnouncementsApi from './Announcements/index.js';
35
36
  import { GetReplayRecordResult, ListReplayRecordsOptions, ListReplayRecordsResult, ReplayRecordSummary, ReplayRequestOptions, ReplayWriteResult, RunRecord } from './Replay/types.js';
36
37
  import ErrorData, { SUBSCRIPTION_ERROR_CODES } from './types/ErrorData.js';
37
38
  import type { SubscriptionErrorCode } from './types/ErrorData.js';
@@ -39,7 +40,7 @@ import isSubscriptionLimitError from './lib/isSubscriptionLimitError.js';
39
40
  import { TokenType } from './types/token.js';
40
41
  import { ApiKeyAuthManager, TokenAuthData } from './lib/AuthManager/index.js';
41
42
  import type { AgentAttributionMetadata, AgentSurface, ConnectionAttribution, ExecutionMode, InteractionKind, OperationLineage, OperationScope, SogniAttributionConfig, WorkloadAttribution, WorkloadAttributionDefaults, WorkloadAttributionInput, WorkloadKind } from './types/attribution.js';
42
- export type { AudioFormat, AudioOutputFormat, AudioProjectParams, AvailableModel, BillingMode, ChatCompletionChunk, ChatCompletionParams, ChatCompletionResult, ChatJobErrorFields, ChatJobStateEvent, ChatMessage, ChatResponseFormat, ChatRunEvent, ChatRunRecord, ChatRunStatus, ChatTokenUsage, StartChatRunParams, StreamChatRunEventsOptions, ContentPart, HostedChatCompletionChoice, HostedChatCompletionMessage, HostedChatCompletionParams, HostedChatCompletionResult, HostedCreativeWorkflowReference, HostedSynchronousToolName, HostedToolExecutionParams, HostedToolExecutionResult, CreativeWorkflowArtifact, CreativeWorkflowEvent, CreativeWorkflowRecord, CreativeWorkflowSseEvent, CreativeWorkflowStatus, CreativeWorkflowWaitingReason, ImageUrlContentPart, ListCreativeWorkflowOptions, LLMCostEstimation, LLMJobCost, LLMModelInfo, LLMParamConstraint, LLMSamplingDefaults, AvailableLorasParams, LoraCatalog, LoraCatalogEntry, LoraConstraints, LoraUi, ControlNetMode, ControlNetName, ControlNetParams, TextContentPart, ErrorData, ImageProjectParams, ImageOutputFormat, JobStatus, Logger, LogLevel, ProjectParams, ProjectStatus, CreativeWorkflowHostedToolName, StartCreativeWorkflowOptions, StartCreativeWorkflowParams, StartCreativeWorkflowDependency, StartCreativeWorkflowInput, StartCreativeWorkflowStep, StreamCreativeWorkflowEventsOptions, ResumeCreativeWorkflowOptions, ResumeCreativeWorkflowParams, ResumeCreativeWorkflowResult, ReseedCreativeWorkflowOptions, ReseedCreativeWorkflowParams, ReseedCreativeWorkflowResult, ForkWorkflowTemplateBody, ListWorkflowTemplatesOptions, ListWorkflowTemplatesResult, WorkflowTemplate, WorkflowTemplateAuthor, WorkflowTemplateRequestOptions, WorkflowTemplateStability, WorkflowTemplateVisibility, WorkflowTemplateVisibilityFilter, RunRecord, ReplayWriteResult, ReplayRecordSummary, ReplayRequestOptions, ListReplayRecordsOptions, ListReplayRecordsResult, GetReplayRecordResult, SupernetType, TokenType, ToolCall, ToolCallDelta, ToolCallFunction, ToolChoice, ToolDefinition, ToolExecutionOptions, ToolExecutionProgress, ToolExecutionResult, ToolFunction, ToolHistoryEntry, SogniToolsMode, AuthenticatedData, SocketEventName, SocketEventSubscriptionInput, SocketEventSubscriptionName, SocketEventSubscriptions, SocketEventSubscriptionsUpdatedData, SocketEventSubscriptionUpdate, SocketSubscriptionEntitlementData, SocketSubscriptionFairUseState, SocketSubscriptionLimitNoticeData, VideoControlNetName, VideoControlNetParams, VideoFormat, VideoOutputFormat, VideoProjectParams, VideoWorkflowType, Balances, Reward, RewardCantClaimReason, TxHistoryEntry, CreateSubscriptionCheckoutOptions, SubscriptionCheckoutResult, SubscriptionEntitlementSnapshot, SubscriptionFairUseState, SubscriptionPlanId, SubscriptionPlanInterval, SubscriptionPlan, SubscriptionErrorCode, SubscriptionPortalSession, SubscriptionRedirectType, SubscriptionStatus, SubscriptionTerm, SubscriptionUsage, TrialEligibility, TrialReasonCode, SizePreset, EstimateRequest, CostEstimation, ProjectEvent, JobEvent, JobPreparation, RawProject, ToastMessage, DataEntity, InputMedia, AgentAttributionMetadata, AgentSurface, ConnectionAttribution, ExecutionMode, InteractionKind, OperationLineage, OperationScope, SogniAttributionConfig, WorkloadAttribution, WorkloadAttributionDefaults, WorkloadAttributionInput, WorkloadKind };
43
+ export type { AudioFormat, AudioOutputFormat, AudioProjectParams, AvailableModel, BillingMode, ChatCompletionChunk, ChatCompletionParams, ChatCompletionResult, ChatJobErrorFields, ChatJobStateEvent, ChatMessage, ChatResponseFormat, ChatRunEvent, ChatRunRecord, ChatRunStatus, ChatTokenUsage, StartChatRunParams, StreamChatRunEventsOptions, ContentPart, HostedChatCompletionChoice, HostedChatCompletionMessage, HostedChatCompletionParams, HostedChatCompletionResult, HostedCreativeWorkflowReference, HostedSynchronousToolName, HostedToolExecutionParams, HostedToolExecutionResult, CreativeWorkflowArtifact, CreativeWorkflowEvent, CreativeWorkflowRecord, CreativeWorkflowSseEvent, CreativeWorkflowStatus, CreativeWorkflowWaitingReason, ImageUrlContentPart, ListCreativeWorkflowOptions, LLMCostEstimation, LLMJobCost, LLMModelInfo, LLMParamConstraint, LLMSamplingDefaults, AvailableLorasParams, LoraCatalog, LoraCatalogEntry, LoraConstraints, LoraUi, ControlNetMode, ControlNetName, ControlNetParams, TextContentPart, ErrorData, ImageProjectParams, ImageOutputFormat, JobStatus, Logger, LogLevel, ProjectParams, ProjectStatus, CreativeWorkflowHostedToolName, StartCreativeWorkflowOptions, StartCreativeWorkflowParams, StartCreativeWorkflowDependency, StartCreativeWorkflowInput, StartCreativeWorkflowStep, StreamCreativeWorkflowEventsOptions, ResumeCreativeWorkflowOptions, ResumeCreativeWorkflowParams, ResumeCreativeWorkflowResult, ReseedCreativeWorkflowOptions, ReseedCreativeWorkflowParams, ReseedCreativeWorkflowResult, ForkWorkflowTemplateBody, ListWorkflowTemplatesOptions, ListWorkflowTemplatesResult, WorkflowTemplate, WorkflowTemplateAuthor, WorkflowTemplateRequestOptions, WorkflowTemplateStability, WorkflowTemplateVisibility, WorkflowTemplateVisibilityFilter, RunRecord, ReplayWriteResult, ReplayRecordSummary, ReplayRequestOptions, ListReplayRecordsOptions, ListReplayRecordsResult, GetReplayRecordResult, SupernetType, TokenType, ToolCall, ToolCallDelta, ToolCallFunction, ToolChoice, ToolDefinition, ToolExecutionOptions, ToolExecutionProgress, ToolExecutionResult, ToolFunction, ToolHistoryEntry, SogniToolsMode, AuthenticatedData, SocketEventName, SocketEventSubscriptionInput, SocketEventSubscriptionName, SocketEventSubscriptions, SocketEventSubscriptionsUpdatedData, SocketEventSubscriptionUpdate, SocketSubscriptionEntitlementData, SocketSubscriptionFairUseState, SocketSubscriptionLimitNoticeData, VideoControlNetName, VideoControlNetParams, VideoFormat, VideoOutputFormat, VideoProjectParams, VideoWorkflowType, Balances, Reward, RewardCantClaimReason, TxHistoryEntry, CreateSubscriptionCheckoutOptions, SubscriptionCheckoutResult, SubscriptionEntitlementSnapshot, SubscriptionFairUseState, SubscriptionPlanId, SubscriptionPlanInterval, SubscriptionPlan, SubscriptionErrorCode, SubscriptionPortalSession, SubscriptionRedirectType, SubscriptionStatus, SubscriptionTerm, SubscriptionUsage, TrialEligibility, TrialReasonCode, SizePreset, EstimateRequest, CostEstimation, ProjectEvent, JobEvent, JobPreparation, RawProject, ToastMessage, AppAlert, AppAlertAction, DataEntity, InputMedia, AgentAttributionMetadata, AgentSurface, ConnectionAttribution, ExecutionMode, InteractionKind, OperationLineage, OperationScope, SogniAttributionConfig, WorkloadAttribution, WorkloadAttributionDefaults, WorkloadAttributionInput, WorkloadKind };
43
44
  export type { CompletedRecoveredProject, ProjectRecoverySnapshot, ProjectResolution, ProjectSyncReason, ProjectSyncResult, RecoveredProject, RecoveredWorkerJob };
44
45
  export { ApiError, ApiKeyAuthManager, ChatJobError, ChatStream, ChatToolsApi, CreativeWorkflowsApi, CreativeWorkflowTemplatesApi, ReplayApi, CurrentAccount, Job, Project, PROJECT_LOST_ORIGINAL_CODE, SogniTools, SUBSCRIPTION_ERROR_CODES, isProjectLostError, isSubscriptionLimitError, isSogniToolCall, parseCreativeWorkflowSseChunk, parseToolCallArguments, projectParamsFromRecoveredProject };
45
46
  export interface SogniClientConfig {
@@ -160,6 +161,14 @@ export declare class SogniClient {
160
161
  * identity.
161
162
  */
162
163
  replay: ReplayApi;
164
+ /**
165
+ * Admin-authored in-app announcements (`/v1/announcements`). Live delivery is
166
+ * the `appAlert` socket event — opt in with
167
+ * `socketEventSubscriptions: { appAlert: true }`. This group covers the two
168
+ * moments the socket cannot: reading what is live at launch, and dismissing an
169
+ * announcement per account so it stays dismissed on every device.
170
+ */
171
+ announcements: AnnouncementsApi;
163
172
  apiClient: ApiClient;
164
173
  private constructor();
165
174
  get currentAccount(): CurrentAccount;
package/dist/index.js CHANGED
@@ -89,13 +89,14 @@ const index_js_7 = __importDefault(require("./Stats/index.js"));
89
89
  // Replay records
90
90
  const index_js_8 = __importDefault(require("./Replay/index.js"));
91
91
  exports.ReplayApi = index_js_8.default;
92
+ const index_js_9 = __importDefault(require("./Announcements/index.js"));
92
93
  // Base Types
93
94
  const ErrorData_js_1 = require("./types/ErrorData.js");
94
95
  Object.defineProperty(exports, "SUBSCRIPTION_ERROR_CODES", { enumerable: true, get: function () { return ErrorData_js_1.SUBSCRIPTION_ERROR_CODES; } });
95
96
  const isSubscriptionLimitError_js_1 = __importDefault(require("./lib/isSubscriptionLimitError.js"));
96
97
  exports.isSubscriptionLimitError = isSubscriptionLimitError_js_1.default;
97
- const index_js_9 = require("./lib/AuthManager/index.js");
98
- Object.defineProperty(exports, "ApiKeyAuthManager", { enumerable: true, get: function () { return index_js_9.ApiKeyAuthManager; } });
98
+ const index_js_10 = require("./lib/AuthManager/index.js");
99
+ Object.defineProperty(exports, "ApiKeyAuthManager", { enumerable: true, get: function () { return index_js_10.ApiKeyAuthManager; } });
99
100
  class SogniClient {
100
101
  constructor(config) {
101
102
  this.account = new index_js_1.default(config);
@@ -104,6 +105,7 @@ class SogniClient {
104
105
  this.chat = new index_js_4.default(config, this.projects);
105
106
  this.workflows = new index_js_5.default(config);
106
107
  this.replay = new index_js_8.default(config);
108
+ this.announcements = new index_js_9.default(config);
107
109
  this.apiClient = config.client;
108
110
  }
109
111
  get currentAccount() {
@@ -117,7 +119,7 @@ class SogniClient {
117
119
  setTokens(tokens) {
118
120
  return __awaiter(this, void 0, void 0, function* () {
119
121
  const auth = this.apiClient.auth;
120
- if (!(auth instanceof index_js_9.TokenAuthManager)) {
122
+ if (!(auth instanceof index_js_10.TokenAuthManager)) {
121
123
  throw new Error('setTokens can only be used with token authentication');
122
124
  }
123
125
  yield auth.authenticate(tokens);
@@ -132,7 +134,7 @@ class SogniClient {
132
134
  checkAuth() {
133
135
  return __awaiter(this, void 0, void 0, function* () {
134
136
  const auth = this.apiClient.auth;
135
- if (!(auth instanceof index_js_9.CookieAuthManager)) {
137
+ if (!(auth instanceof index_js_10.CookieAuthManager)) {
136
138
  throw Error('This method should only be called when using cookie auth');
137
139
  }
138
140
  try {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAAE,MAAM,CAAC,SAAS;gBAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,wBAAwB,EAAE,MAAM,CAAC,wBAAwB;gBACzD,WAAW,EAAE,OAAO;gBACpB,MAAM;gBACN,QAAQ;gBACR,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,aAAa,EAAE,MAAM,CAAC,aAAa;aACpC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,yBAAY,CAAC;gBAC9B,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU;gBAC9C,OAAO,EAAE,GAAG;gBACZ,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;aACtC,CAAC,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAExD,6CAA6C;YAC7C,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAyB,CAAC;gBAC9C,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzC,CAAC;YAED,OAAO,WAAW,CAAC;QACrB,CAAC;KAAA;CACF;AAxJD,kCAwJC"}
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "5.27.1";
1
+ export declare const LIB_VERSION = "5.28.0";
package/dist/version.js CHANGED
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIB_VERSION = void 0;
4
4
  // AUTO-GENERATED by scripts/generate-version.mjs — do not edit.
5
5
  // Source of truth: package.json version.
6
- exports.LIB_VERSION = '5.27.1';
6
+ exports.LIB_VERSION = '5.28.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,54 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import ApiGroup from '../ApiGroup.js';
11
+ /**
12
+ * Admin-authored in-app announcements — pinned banners and toasts composed in
13
+ * the Sogni Admin Portal.
14
+ *
15
+ * The socket is the primary delivery path: subscribe to the `appAlert` event
16
+ * (opt in with `socketEventSubscriptions: { appAlert: true }`) and the server
17
+ * pushes announcements live AND replays any live pinned banner on connect, so a
18
+ * user who was offline when one published still receives it.
19
+ *
20
+ * This REST surface covers the two moments the socket cannot:
21
+ * - `active()` at launch, before the socket has authenticated
22
+ * - `dismiss()`, which must persist per ACCOUNT rather than per device so a
23
+ * banner dismissed on one client stays dismissed on the next
24
+ *
25
+ * Full contract: `docs/app-alert-contract.md` in sogni-socket.
26
+ */
27
+ class AnnouncementsApi extends ApiGroup {
28
+ /**
29
+ * Announcements currently live for the signed-in account, minus anything the
30
+ * account has already dismissed.
31
+ *
32
+ * @param platform Optional `appSource` for this client (e.g. `'sogni-mac'`).
33
+ * Platform-scoped announcements only match when it is supplied — an
34
+ * announcement narrowed to macOS is deliberately withheld from a caller
35
+ * that cannot say what it is, rather than sent to everyone.
36
+ */
37
+ active(platform) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const res = yield this.client.rest.get('/v1/announcements/active', platform ? { platform } : undefined);
40
+ return res.data.announcements || [];
41
+ });
42
+ }
43
+ /**
44
+ * Dismiss one announcement for the signed-in account, on every device.
45
+ * Call this when the user closes a pinned announcement.
46
+ */
47
+ dismiss(id) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ yield this.client.rest.post(`/v1/announcements/${encodeURIComponent(id)}/dismiss`);
50
+ });
51
+ }
52
+ }
53
+ export default AnnouncementsApi;
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Announcements/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAItC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,gBAAiB,SAAQ,QAAQ;IACrC;;;;;;;;OAQG;IACG,MAAM,CAAC,QAAiB;;YAC5B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CACpC,0BAA0B,EAC1B,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CACpC,CAAC;YACF,OAAO,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;QACtC,CAAC;KAAA;IAED;;;OAGG;IACG,OAAO,CAAC,EAAU;;YACtB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CACzB,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,UAAU,CACtD,CAAC;QACJ,CAAC;KAAA;CACF;AAED,eAAe,gBAAgB,CAAC"}
package/dist-esm/index.js CHANGED
@@ -33,6 +33,7 @@ import CreativeWorkflowTemplatesApi from './CreativeWorkflows/Templates/index.js
33
33
  import StatsApi from './Stats/index.js';
34
34
  // Replay records
35
35
  import ReplayApi from './Replay/index.js';
36
+ import AnnouncementsApi from './Announcements/index.js';
36
37
  // Base Types
37
38
  import { SUBSCRIPTION_ERROR_CODES } from './types/ErrorData.js';
38
39
  import isSubscriptionLimitError from './lib/isSubscriptionLimitError.js';
@@ -46,6 +47,7 @@ export class SogniClient {
46
47
  this.chat = new ChatApi(config, this.projects);
47
48
  this.workflows = new CreativeWorkflowsApi(config);
48
49
  this.replay = new ReplayApi(config);
50
+ this.announcements = new AnnouncementsApi(config);
49
51
  this.apiClient = config.client;
50
52
  }
51
53
  get currentAccount() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,cAAc;AACd,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,YAAY;AACZ,OAAO,SAAS,EAAE,EAAE,QAAQ,EAAe,MAAM,sBAAsB,CAAC;AAiBxE,QAAQ;AACR,OAAO,EAAE,aAAa,EAAoB,MAAM,wBAAwB,CAAC;AACzE,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,eAAe;AACf,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAC9C,OAAO,GAAkB,MAAM,mBAAmB,CAAC;AACnD,OAAO,OAA0B,MAAM,uBAAuB,CAAC;AAyC/D,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,iCAAiC,EAClC,MAAM,wBAAwB,CAAC;AA2BhC,WAAW;AACX,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,YAAoC,MAAM,wBAAwB,CAAC;AAC1E,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,YAAY,MAAM,qBAAqB,CAAC;AA0C/C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACtF,yBAAyB;AACzB,OAAO,oBAAoB,EAAE,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,4BAA4B,MAAM,wCAAwC,CAAC;AAkClF,YAAY;AACZ,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,iBAAiB;AACjB,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAU1C,aAAa;AACb,OAAkB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,wBAAwB,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EACL,iBAAiB,EACjB,iBA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AM;aACtC,CAAC,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAExD,6CAA6C;YAC7C,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAyB,CAAC;gBAC9C,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzC,CAAC;YAED,OAAO,WAAW,CAAC;QACrB,CAAC;KAAA;CACF"}
@@ -1,4 +1,4 @@
1
1
  // AUTO-GENERATED by scripts/generate-version.mjs — do not edit.
2
2
  // Source of truth: package.json version.
3
- export const LIB_VERSION = '5.27.1';
3
+ export const LIB_VERSION = '5.28.0';
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "5.27.1",
6
+ "version": "5.28.0",
7
7
  "engines": {
8
8
  "node": ">=22"
9
9
  },
@@ -0,0 +1,50 @@
1
+ import ApiGroup from '../ApiGroup.js';
2
+ import { ApiResponse } from '../ApiClient/index.js';
3
+ import type { AppAlert } from '../ApiClient/WebSocketClient/events.js';
4
+
5
+ /**
6
+ * Admin-authored in-app announcements — pinned banners and toasts composed in
7
+ * the Sogni Admin Portal.
8
+ *
9
+ * The socket is the primary delivery path: subscribe to the `appAlert` event
10
+ * (opt in with `socketEventSubscriptions: { appAlert: true }`) and the server
11
+ * pushes announcements live AND replays any live pinned banner on connect, so a
12
+ * user who was offline when one published still receives it.
13
+ *
14
+ * This REST surface covers the two moments the socket cannot:
15
+ * - `active()` at launch, before the socket has authenticated
16
+ * - `dismiss()`, which must persist per ACCOUNT rather than per device so a
17
+ * banner dismissed on one client stays dismissed on the next
18
+ *
19
+ * Full contract: `docs/app-alert-contract.md` in sogni-socket.
20
+ */
21
+ class AnnouncementsApi extends ApiGroup {
22
+ /**
23
+ * Announcements currently live for the signed-in account, minus anything the
24
+ * account has already dismissed.
25
+ *
26
+ * @param platform Optional `appSource` for this client (e.g. `'sogni-mac'`).
27
+ * Platform-scoped announcements only match when it is supplied — an
28
+ * announcement narrowed to macOS is deliberately withheld from a caller
29
+ * that cannot say what it is, rather than sent to everyone.
30
+ */
31
+ async active(platform?: string): Promise<AppAlert[]> {
32
+ const res = await this.client.rest.get<ApiResponse<{ announcements: AppAlert[] }>>(
33
+ '/v1/announcements/active',
34
+ platform ? { platform } : undefined
35
+ );
36
+ return res.data.announcements || [];
37
+ }
38
+
39
+ /**
40
+ * Dismiss one announcement for the signed-in account, on every device.
41
+ * Call this when the user closes a pinned announcement.
42
+ */
43
+ async dismiss(id: string): Promise<void> {
44
+ await this.client.rest.post<ApiResponse<{ dismissed: boolean; id: string }>>(
45
+ `/v1/announcements/${encodeURIComponent(id)}/dismiss`
46
+ );
47
+ }
48
+ }
49
+
50
+ export default AnnouncementsApi;
@@ -280,6 +280,62 @@ export type ToastMessage = {
280
280
  stickyID: string;
281
281
  };
282
282
 
283
+ /** A call to action rendered inside an announcement. Always an absolute http(s) URL. */
284
+ export type AppAlertAction = {
285
+ label: string;
286
+ href: string;
287
+ /** Open in a new tab / the system browser rather than routing in-app. */
288
+ external?: boolean;
289
+ };
290
+
291
+ /**
292
+ * An admin-authored in-app announcement, composed in the Sogni Admin Portal.
293
+ *
294
+ * OPT-IN: the server sends this only to clients that asked for it with
295
+ * `socketEventSubscriptions: { appAlert: true }`. A client that does not opt in
296
+ * keeps receiving the same announcement as a plain {@link ToastMessage}, so this
297
+ * event can be adopted at any time without coordination. A client never
298
+ * receives both renderings of one announcement.
299
+ *
300
+ * NOT at-most-once: a live pinned announcement is re-sent on every reconnect
301
+ * while its window is open, so a user who was offline when it published still
302
+ * sees it. Deduplicate on `id`.
303
+ *
304
+ * Full contract: `docs/app-alert-contract.md` in sogni-socket.
305
+ */
306
+ export type AppAlert = {
307
+ /** Stable across redeliveries; also the key for `announcements.dismiss(id)`. */
308
+ id: string;
309
+ /** `toast` is a one-shot; `banner` persists until dismissed or `endsAt`. */
310
+ kind: 'toast' | 'banner';
311
+ severity: 'info' | 'success' | 'warn' | 'danger';
312
+ /**
313
+ * Icon token, never a URL — map it to your own icon set. One of `info`,
314
+ * `success`, `warning`, `error`, `megaphone`, `wrench`, `sparkles`, `gift`,
315
+ * `rocket`, `clock`. Absent means "use the icon for `severity`".
316
+ */
317
+ icon?: string;
318
+ /** Optional `#RRGGBB` tint. Ignoring it must still render a legible alert. */
319
+ accent?: string;
320
+ title: string;
321
+ /**
322
+ * Restricted markdown: paragraphs, bold, italic, inline code, strikethrough,
323
+ * links, and line breaks. No images, no raw HTML, no headings or lists.
324
+ */
325
+ bodyMarkdown: string;
326
+ /** Do not auto-dismiss. Banners are pinned; toasts normally are not. */
327
+ pinned: boolean;
328
+ /** When false, hide the close affordance — it still clears at `endsAt`. */
329
+ dismissible: boolean;
330
+ /** Toasts only. Milliseconds. */
331
+ autoCloseMs?: number;
332
+ actions?: AppAlertAction[];
333
+ /** Epoch ms. */
334
+ startsAt: number;
335
+ /** Epoch ms. Always present for a banner. */
336
+ endsAt?: number;
337
+ };
338
+
283
339
  export type ArtistCancelConfirmation = {
284
340
  didCancel: boolean;
285
341
  error_message?: string;
@@ -419,6 +475,14 @@ export type SocketEventMap = {
419
475
  * @event WebSocketClient#toastMessage - Toast message received
420
476
  */
421
477
  toastMessage: ToastMessage;
478
+ /**
479
+ * @event WebSocketClient#appAlert - Admin announcement received (banner or toast)
480
+ *
481
+ * Opt in with `socketEventSubscriptions: { appAlert: true }`; without it the
482
+ * server sends the same announcement as `toastMessage` instead. Redelivered on
483
+ * reconnect while a pinned announcement is live — deduplicate on `id`.
484
+ */
485
+ appAlert: AppAlert;
422
486
 
423
487
  artistCancelConfirmation: ArtistCancelConfirmation;
424
488
  };
package/src/index.ts CHANGED
@@ -88,7 +88,7 @@ import type {
88
88
  TrialEligibility,
89
89
  TrialReasonCode
90
90
  } from './Account/subscription.types.js';
91
- import type { ToastMessage } from './ApiClient/WebSocketClient/events.js';
91
+ import type { AppAlert, AppAlertAction, ToastMessage } from './ApiClient/WebSocketClient/events.js';
92
92
  import type DataEntity from './lib/DataEntity.js';
93
93
  import {
94
94
  ControlNetName,
@@ -184,6 +184,7 @@ import {
184
184
  import StatsApi from './Stats/index.js';
185
185
  // Replay records
186
186
  import ReplayApi from './Replay/index.js';
187
+ import AnnouncementsApi from './Announcements/index.js';
187
188
  import {
188
189
  GetReplayRecordResult,
189
190
  ListReplayRecordsOptions,
@@ -365,6 +366,8 @@ export type {
365
366
  JobPreparation,
366
367
  RawProject,
367
368
  ToastMessage,
369
+ AppAlert,
370
+ AppAlertAction,
368
371
  DataEntity,
369
372
  InputMedia,
370
373
  AgentAttributionMetadata,
@@ -533,6 +536,14 @@ export class SogniClient {
533
536
  * identity.
534
537
  */
535
538
  replay: ReplayApi;
539
+ /**
540
+ * Admin-authored in-app announcements (`/v1/announcements`). Live delivery is
541
+ * the `appAlert` socket event — opt in with
542
+ * `socketEventSubscriptions: { appAlert: true }`. This group covers the two
543
+ * moments the socket cannot: reading what is live at launch, and dismissing an
544
+ * announcement per account so it stays dismissed on every device.
545
+ */
546
+ announcements: AnnouncementsApi;
536
547
 
537
548
  apiClient: ApiClient;
538
549
 
@@ -543,6 +554,7 @@ export class SogniClient {
543
554
  this.chat = new ChatApi(config, this.projects);
544
555
  this.workflows = new CreativeWorkflowsApi(config);
545
556
  this.replay = new ReplayApi(config);
557
+ this.announcements = new AnnouncementsApi(config);
546
558
 
547
559
  this.apiClient = config.client;
548
560
  }
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/generate-version.mjs — do not edit.
2
2
  // Source of truth: package.json version.
3
- export const LIB_VERSION = '5.27.1';
3
+ export const LIB_VERSION = '5.28.0';