@sogni-ai/sogni-creative-agent-skill 3.20.0 → 3.22.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.
@@ -66,6 +66,30 @@ export async function assertSafeSogniEndpoints({ restEndpoint, socketEndpoint })
66
66
  }
67
67
  }
68
68
 
69
+ export function buildHostedClientConfig({
70
+ apiKey,
71
+ restEndpoint,
72
+ socketEndpoint,
73
+ appSource,
74
+ appId,
75
+ attribution,
76
+ }) {
77
+ return {
78
+ appId: appId ?? getOrCreateSogniAppId(),
79
+ apiKey,
80
+ appSource: appSource ?? 'sogni-creative-agent-skill',
81
+ ...(attribution ? { attribution } : {}),
82
+ logLevel: 'error',
83
+ ...(restEndpoint ? { restEndpoint } : {}),
84
+ ...(socketEndpoint ? { socketEndpoint } : {}),
85
+ // Every operation routed through this factory is REST or SSE. Avoid
86
+ // creating a short-lived WebSocket for each hosted call or upload-URL
87
+ // lookup; those connections would add noise to connection telemetry.
88
+ disableSocket: true,
89
+ socketEventSubscriptions: { modelAvailability: false }
90
+ };
91
+ }
92
+
69
93
  /**
70
94
  * Construct a managed `SogniClient` for the duration of `work`. Disposes
71
95
  * the socket connection on completion (matching the per-request shape
@@ -73,17 +97,23 @@ export async function assertSafeSogniEndpoints({ restEndpoint, socketEndpoint })
73
97
  * that pooling isn't required; the API process owns long-running pools
74
98
  * via `SogniClientSessionService`.
75
99
  */
76
- export async function withHostedClient({ apiKey, restEndpoint, socketEndpoint, appSource, appId }, work) {
100
+ export async function withHostedClient({
101
+ apiKey,
102
+ restEndpoint,
103
+ socketEndpoint,
104
+ appSource,
105
+ appId,
106
+ attribution,
107
+ }, work) {
77
108
  await assertSafeSogniEndpoints({ restEndpoint, socketEndpoint });
78
- const client = await SogniClient.createInstance({
79
- appId: appId ?? getOrCreateSogniAppId(),
109
+ const client = await SogniClient.createInstance(buildHostedClientConfig({
80
110
  apiKey,
81
- appSource: appSource ?? 'sogni-creative-agent-skill',
82
- logLevel: 'error',
83
- ...(restEndpoint ? { restEndpoint } : {}),
84
- ...(socketEndpoint ? { socketEndpoint } : {}),
85
- socketEventSubscriptions: { modelAvailability: false }
86
- });
111
+ restEndpoint,
112
+ socketEndpoint,
113
+ appSource,
114
+ appId,
115
+ attribution,
116
+ }));
87
117
  try {
88
118
  return await work(client);
89
119
  } finally {
package/version.mjs CHANGED
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '3.20.0';
1
+ export const PACKAGE_VERSION = '3.22.0';