@wix/himalaya-cli 0.1306.0 → 0.1308.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.
Files changed (50) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/wix-gateway.rules.d.ts +5 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/genie-chat/src/index.d.ts +63 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-genie-chat.mjs +81 -0
  4. package/dist/cli.mjs +145 -5
  5. package/guides/sdk-reference.json +36 -0
  6. package/package.json +2 -2
  7. package/templates/beauty-salon-owner/dev/index.ts +15 -27
  8. package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +293 -12
  9. package/templates/beauty-salon-owner/tier5-src/_shared/aria-stream.ts +165 -0
  10. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  11. package/templates/community-club-owner/dev/index.ts +15 -27
  12. package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +293 -12
  13. package/templates/community-club-owner/tier5-src/_shared/aria-stream.ts +165 -0
  14. package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  15. package/templates/events-meetups-owner/dev/index.ts +15 -27
  16. package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +293 -12
  17. package/templates/events-meetups-owner/tier5-src/_shared/aria-stream.ts +165 -0
  18. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  19. package/templates/gym-fitness-owner/dev/index.ts +15 -27
  20. package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +293 -12
  21. package/templates/gym-fitness-owner/tier5-src/_shared/aria-stream.ts +165 -0
  22. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  23. package/templates/nonprofit-cause-owner/dev/index.ts +15 -27
  24. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +293 -12
  25. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-stream.ts +165 -0
  26. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  27. package/templates/owner-lite/dev/index.ts +15 -27
  28. package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +293 -12
  29. package/templates/owner-lite/tier5-src/_shared/aria-stream.ts +165 -0
  30. package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  31. package/templates/podcast-creator-owner/dev/index.ts +15 -27
  32. package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +293 -12
  33. package/templates/podcast-creator-owner/tier5-src/_shared/aria-stream.ts +165 -0
  34. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  35. package/templates/portfolio-creative-owner/dev/index.ts +15 -27
  36. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +293 -12
  37. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-stream.ts +165 -0
  38. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  39. package/templates/restaurant-owner/dev/index.ts +15 -27
  40. package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +293 -12
  41. package/templates/restaurant-owner/tier5-src/_shared/aria-stream.ts +165 -0
  42. package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  43. package/templates/retail-store-owner/dev/index.ts +15 -27
  44. package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +293 -12
  45. package/templates/retail-store-owner/tier5-src/_shared/aria-stream.ts +165 -0
  46. package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
  47. package/templates/yoga-studio-owner/dev/index.ts +15 -27
  48. package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +293 -12
  49. package/templates/yoga-studio-owner/tier5-src/_shared/aria-stream.ts +165 -0
  50. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +26 -2
@@ -60,6 +60,11 @@ export interface WixMockRule {
60
60
  headers?: Record<string, string>;
61
61
  delayMs?: number;
62
62
  template?: boolean;
63
+ /** For a `text/event-stream` body served to a STREAMING client (the dev
64
+ * `/v1/aria/realtime` route): write its events this many ms apart instead of
65
+ * in one burst, so a client sees them arrive one by one. Ignored by every
66
+ * path that answers a whole request at once. */
67
+ eventIntervalMs?: number;
63
68
  };
64
69
  transform?: WixResponseTransform;
65
70
  note?: string;
@@ -436,6 +436,69 @@ export declare function messageText(m: ConversationMessage | null | undefined):
436
436
  * object with a non-empty `fileName` is dropped rather than rendered as a blank
437
437
  * entry — the list is display-only, so a malformed row has nothing to show. */
438
438
  export declare function attachmentsOf(m: ConversationMessage | null | undefined): Attachment[];
439
+ /** The Wix realtime (Duplexer) app the assistant publishes its side effects
440
+ * under, and the channel / event slug a subscriber filters on. Read off the
441
+ * native Aria app, which subscribes to the BARE channel and routes by the
442
+ * `conversationId` in each payload. Exported so whatever opens the socket uses
443
+ * the same three values the native app does. */
444
+ export declare const ARIA_REALTIME_APP_DEF_ID = "68b3f052-8532-4cb1-ba55-79af4165538f";
445
+ /** The realtime channel the assistant's side effects are published on (bare — no resource id). */
446
+ export declare const ARIA_SIDE_EFFECT_CHANNEL = "@ai-assistant--side-effect";
447
+ /** The event slug a subscriber accepts on that channel. */
448
+ export declare const ARIA_SIDE_EFFECT_SLUG = "ai-assistant--side-effect";
449
+ /** One suggested reply: `label` is what a chip shows, `reply` what tapping it sends. */
450
+ export interface QuickReply {
451
+ label: string;
452
+ reply: string;
453
+ }
454
+ /** A decoded side-effect frame. `kind: "unknown"` keeps a frame this client
455
+ * does not model visible to a caller that wants to log it, instead of
456
+ * collapsing it into "nothing arrived". */
457
+ export type AriaSideEffect = {
458
+ kind: "decision";
459
+ phase: "start" | "chunk" | "completed";
460
+ conversationId: string;
461
+ decisionId: string;
462
+ /** The owner turn this decision answers. Absent on some frames. */
463
+ userMessageId?: string;
464
+ /** How a decision's text joins the others of the same turn. */
465
+ streamingMode: "append" | "override";
466
+ chunkIndex?: number;
467
+ /** The decision's whole text so far — the field a reader should render. */
468
+ accumulatedResponse?: string;
469
+ chunk?: string;
470
+ } | {
471
+ kind: "status";
472
+ conversationId: string;
473
+ userMessageId: string;
474
+ message: string;
475
+ thinkingMode: boolean;
476
+ } | {
477
+ kind: "tags";
478
+ conversationId: string;
479
+ userMessageId: string;
480
+ quickReplies: QuickReply[];
481
+ } | {
482
+ kind: "messageChanged";
483
+ conversationId?: string;
484
+ } | {
485
+ kind: "unknown";
486
+ name: string;
487
+ conversationId?: string;
488
+ };
489
+ /** Decode one frame of the side-effect channel, or `null` when it is not one.
490
+ *
491
+ * Accepts the SSE re-statement (`{type, data}`) and the raw frame
492
+ * (`{name | kind, payload, conversationId?}`), with the payload as an object or
493
+ * a JSON string. The rules are the native app's, so the two clients agree on
494
+ * which frames count:
495
+ * - a decision needs a conversation and a `decisionId`; its chunk index is the
496
+ * first of `chunkIndex` / `lastChunkIndex` / `latestChunkIndex`;
497
+ * - a status needs a non-blank message; a missing turn id reads as "unknown";
498
+ * - a tags frame needs a turn id and a `tags.quickReplies` list in which EVERY
499
+ * entry has a label and a reply — one malformed entry drops the frame rather
500
+ * than offering a chip that sends nothing. */
501
+ export declare function decodeSideEffect(raw: unknown): AriaSideEffect | null;
439
502
  /** The last ASSISTANT message in a transcript, or undefined. The "has the reply
440
503
  * landed?" predicate every poller needs. */
441
504
  export declare function lastAssistantMessage(msgs: ConversationMessage[]): ConversationMessage | undefined;
@@ -225,6 +225,83 @@ function attachmentsOf(m) {
225
225
  if (!Array.isArray(raw)) return [];
226
226
  return raw.filter((a) => !!a && typeof a === "object" && typeof a.fileName === "string" && !!a.fileName.trim());
227
227
  }
228
+ var ARIA_REALTIME_APP_DEF_ID = "68b3f052-8532-4cb1-ba55-79af4165538f";
229
+ var ARIA_SIDE_EFFECT_CHANNEL = "@ai-assistant--side-effect";
230
+ var ARIA_SIDE_EFFECT_SLUG = "ai-assistant--side-effect";
231
+ function asRecord(v) {
232
+ if (v && typeof v === "object" && !Array.isArray(v)) return v;
233
+ if (typeof v === "string") {
234
+ try {
235
+ const parsed = JSON.parse(v);
236
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
237
+ } catch {
238
+ return void 0;
239
+ }
240
+ }
241
+ return void 0;
242
+ }
243
+ var str = (v) => typeof v === "string" ? v : void 0;
244
+ var int = (v) => typeof v === "number" && Number.isFinite(v) ? Math.trunc(v) : void 0;
245
+ function decodeSideEffect(raw) {
246
+ const root = asRecord(raw);
247
+ if (!root) return null;
248
+ const name = str(root.name) ?? str(root.kind) ?? str(root.type);
249
+ if (!name) return null;
250
+ const payload = asRecord(root.payload) ?? asRecord(root.data) ?? root;
251
+ const conversationId = str(payload.conversationId) ?? str(root.conversationId);
252
+ switch (name) {
253
+ case "decisionStart":
254
+ case "decisionChunk":
255
+ case "decisionCompleted": {
256
+ const decisionId = str(payload.decisionId);
257
+ if (!conversationId || !decisionId) return null;
258
+ const chunkIndex = int(payload.chunkIndex) ?? int(payload.lastChunkIndex) ?? int(payload.latestChunkIndex);
259
+ const userMessageId = str(payload.userMessageId);
260
+ const accumulatedResponse = str(payload.accumulatedResponse);
261
+ const chunk = str(payload.chunk);
262
+ return {
263
+ kind: "decision",
264
+ phase: name === "decisionStart" ? "start" : name === "decisionChunk" ? "chunk" : "completed",
265
+ conversationId,
266
+ decisionId,
267
+ streamingMode: payload.streamingMode === "override" ? "override" : "append",
268
+ ...userMessageId ? { userMessageId } : {},
269
+ ...chunkIndex !== void 0 ? { chunkIndex } : {},
270
+ ...accumulatedResponse !== void 0 ? { accumulatedResponse } : {},
271
+ ...chunk !== void 0 ? { chunk } : {}
272
+ };
273
+ }
274
+ case "conversationStatus": {
275
+ const message = str(payload.statusMessage);
276
+ if (!conversationId || !message || !message.trim()) return null;
277
+ return {
278
+ kind: "status",
279
+ conversationId,
280
+ message,
281
+ userMessageId: str(payload.userMessageId) || "unknown",
282
+ thinkingMode: payload.thinkingMode === true
283
+ };
284
+ }
285
+ case "receivedTags": {
286
+ const userMessageId = str(payload.userMessageId);
287
+ const list = asRecord(payload.tags)?.quickReplies;
288
+ if (!conversationId || !userMessageId || !Array.isArray(list)) return null;
289
+ const quickReplies = [];
290
+ for (const item of list) {
291
+ const r = asRecord(item);
292
+ const label = str(r?.label);
293
+ const reply = str(r?.reply);
294
+ if (!label || !reply) return null;
295
+ quickReplies.push({ label, reply });
296
+ }
297
+ return { kind: "tags", conversationId, userMessageId, quickReplies };
298
+ }
299
+ case "conversationMessageChanged":
300
+ return { kind: "messageChanged", ...conversationId ? { conversationId } : {} };
301
+ default:
302
+ return { kind: "unknown", name, ...conversationId ? { conversationId } : {} };
303
+ }
304
+ }
228
305
  function lastAssistantMessage(msgs) {
229
306
  for (let i = msgs.length - 1; i >= 0; i--) {
230
307
  if (msgs[i]?.role === "ASSISTANT") return msgs[i];
@@ -233,6 +310,9 @@ function lastAssistantMessage(msgs) {
233
310
  }
234
311
  export {
235
312
  ARIA_ORIGIN,
313
+ ARIA_REALTIME_APP_DEF_ID,
314
+ ARIA_SIDE_EFFECT_CHANNEL,
315
+ ARIA_SIDE_EFFECT_SLUG,
236
316
  ARIA_UNIFIED_ASSISTANT_ID,
237
317
  GENIE_UPLOAD_SCHEME,
238
318
  abortAssistantMessageGeneration,
@@ -242,6 +322,7 @@ export {
242
322
  conversationUserMessage,
243
323
  createConversation,
244
324
  createFileUpload,
325
+ decodeSideEffect,
245
326
  functionCallsOf,
246
327
  genieChatError,
247
328
  genieUploadRef,