@wix/himalaya-cli 0.1037.0 → 0.1038.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/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/genie-chat/src/index.d.ts +119 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-genie-chat.mjs +51 -1
- package/dist/cli.mjs +864 -400
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/headless-loop.md +7 -0
- package/guides/himi-test.md +66 -1
- package/guides/sdk-reference.json +74 -2
- package/guides/trim-a-template.md +5 -0
- package/package.json +2 -2
- package/templates/beauty-salon-owner/dev/index.ts +2148 -1262
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/community-club-owner/dev/index.ts +2151 -1265
- package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/community-club-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/events-meetups-owner/dev/index.ts +2151 -1265
- package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/events-meetups-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/gym-fitness-owner/dev/index.ts +2148 -1262
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/nonprofit-cause-owner/dev/index.ts +2148 -1262
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/owner-lite/dev/index.ts +2145 -1259
- package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/owner-lite/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/podcast-creator-owner/dev/index.ts +2151 -1265
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/portfolio-creative-owner/dev/index.ts +2148 -1262
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/restaurant-owner/dev/index.ts +2148 -1262
- package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/restaurant-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/retail-store-owner/dev/index.ts +2151 -1265
- package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/retail-store-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
- package/templates/yoga-studio-owner/dev/index.ts +2148 -1262
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +338 -26
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-mentions.ts +202 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
|
@@ -55,6 +55,12 @@ export interface ConversationMessage {
|
|
|
55
55
|
attachments?: Attachment[];
|
|
56
56
|
/** Client tools this assistant turn asks the CALLER to run — see `FunctionCall`. */
|
|
57
57
|
functionCalls?: FunctionCall[];
|
|
58
|
+
/** What the owner attached to this turn — a mentioned product, contact,
|
|
59
|
+
* page — stored by the service BESIDE the text rather than inside it. The
|
|
60
|
+
* transcript echoes them back under this key (the `wix.genie.v1` message
|
|
61
|
+
* entity's `references`), which is the only way a reloaded conversation
|
|
62
|
+
* can still say what a turn was about. */
|
|
63
|
+
references?: MessageReference[];
|
|
58
64
|
}
|
|
59
65
|
/** A file on a message — the service's `Attachment` entity.
|
|
60
66
|
*
|
|
@@ -112,6 +118,40 @@ export interface FunctionCallResult {
|
|
|
112
118
|
/** A JSON-ENCODED object carrying the tool's structured answer. */
|
|
113
119
|
widgetResponse?: string;
|
|
114
120
|
}
|
|
121
|
+
/** One reference riding on a user turn (`messageReferences` on the persist
|
|
122
|
+
* call, `references` on the stored message).
|
|
123
|
+
*
|
|
124
|
+
* Field meanings are the chat-service's own, from the
|
|
125
|
+
* `@wix/ambassador-genie-chat-service-v1-no-entity` `MessageReference` type the
|
|
126
|
+
* native Aria app sends: `data` is the context handed to the model, `source`
|
|
127
|
+
* a low-cardinality feature tag, and `type` how a client renders it
|
|
128
|
+
* ("inline" | "global" | "hidden"). Build a mention's with `mentionReference`
|
|
129
|
+
* rather than by hand, so the one shape the service is known to accept is
|
|
130
|
+
* spelled in one place. */
|
|
131
|
+
export interface MessageReference {
|
|
132
|
+
id?: string;
|
|
133
|
+
/** Shown to the owner (a chip label). */
|
|
134
|
+
label?: string;
|
|
135
|
+
/** The context the assistant receives — for a mention, a JSON string
|
|
136
|
+
* `{"id":…,"type":…}` naming the item and its category. */
|
|
137
|
+
data?: string;
|
|
138
|
+
/** Feature tag, e.g. "mention". */
|
|
139
|
+
source?: string;
|
|
140
|
+
/** Render scope, e.g. "global" — a chip above the text, not a token in it. */
|
|
141
|
+
type?: string;
|
|
142
|
+
}
|
|
143
|
+
/** A mention of one item, in the exact shape the native Aria app sends: a
|
|
144
|
+
* `global` reference (a chip, not a token in the text) whose `data` names the
|
|
145
|
+
* item and the category it came from.
|
|
146
|
+
*
|
|
147
|
+
* `category` is the category's ENGLISH label ("Products", "Contacts") — it is
|
|
148
|
+
* what the model reads, so it is not localized. Newlines in the label are
|
|
149
|
+
* folded to spaces; `JSON.stringify` does the escaping the native client does
|
|
150
|
+
* by hand. */
|
|
151
|
+
export declare function mentionReference(item: {
|
|
152
|
+
id: string;
|
|
153
|
+
title: string;
|
|
154
|
+
}, category: string): MessageReference;
|
|
115
155
|
/** Which assistant the conversation talks to. The real dashboard sends a
|
|
116
156
|
* `unifiedAssistantReference`; helper `ariaAssistantConfig()` builds it. */
|
|
117
157
|
export interface AssistantConfig {
|
|
@@ -200,6 +240,10 @@ export interface SendMessageOptions {
|
|
|
200
240
|
enforceAccountScopedConversations?: boolean;
|
|
201
241
|
/** Tag the turn with the same origin the conversation was created under. */
|
|
202
242
|
origin?: string;
|
|
243
|
+
/** References stored WITH the turn (step 1 only — the trigger names a turn
|
|
244
|
+
* that already carries them). Omitted, the persist call sends `[]`, which is
|
|
245
|
+
* what it always sent. */
|
|
246
|
+
messageReferences?: MessageReference[];
|
|
203
247
|
/** Files already UPLOADED (see `createFileUpload`) to store with the turn.
|
|
204
248
|
* Rides step 1 only — the trigger names the stored turn, which carries them. */
|
|
205
249
|
attachments?: Attachment[];
|
|
@@ -294,6 +338,81 @@ export declare function genieUploadRef(id: string | undefined): string;
|
|
|
294
338
|
export declare function uploadTargetUrl(uploadUrl: string, fileName: string): string;
|
|
295
339
|
/** Fetch the messages of a conversation (poll after sendMessage). */
|
|
296
340
|
export declare function getConversationMessages(conversationId: string): Promise<GetConversationMessagesResponse>;
|
|
341
|
+
/** How a provider pages its items. Any other value, or none, means unpaged:
|
|
342
|
+
* `providersOf` reports it as "NONE" and such a provider is asked for one
|
|
343
|
+
* page with no paging block. */
|
|
344
|
+
export type ItemsPaginationMode = "CURSOR" | "OFFSET" | "UNKNOWN_PAGINATION_MODE";
|
|
345
|
+
/** An installed item provider. Only the fields a picker needs are typed. */
|
|
346
|
+
export interface ItemsSelectionProvider {
|
|
347
|
+
/** The handle `queryItems` is addressed by. */
|
|
348
|
+
key?: string;
|
|
349
|
+
appId?: string;
|
|
350
|
+
contentData?: {
|
|
351
|
+
providerName?: string;
|
|
352
|
+
iconKey?: string;
|
|
353
|
+
title?: string;
|
|
354
|
+
};
|
|
355
|
+
paginationMode?: ItemsPaginationMode | string;
|
|
356
|
+
}
|
|
357
|
+
export interface ListInstalledProvidersResponse {
|
|
358
|
+
providers?: ItemsSelectionProvider[];
|
|
359
|
+
}
|
|
360
|
+
/** One item a provider returned. */
|
|
361
|
+
export interface ItemsSelectionItem {
|
|
362
|
+
id?: string;
|
|
363
|
+
name?: string;
|
|
364
|
+
description?: string;
|
|
365
|
+
image?: {
|
|
366
|
+
url?: string;
|
|
367
|
+
};
|
|
368
|
+
/** Additional information, e.g. a price. */
|
|
369
|
+
note?: string;
|
|
370
|
+
}
|
|
371
|
+
export interface QueryItemsResponse {
|
|
372
|
+
items?: ItemsSelectionItem[];
|
|
373
|
+
pagingMetadata?: {
|
|
374
|
+
hasNext?: boolean;
|
|
375
|
+
cursors?: {
|
|
376
|
+
next?: string;
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
/** The query `queryItems` sends. Set `cursorPaging` OR `paging` to match the
|
|
381
|
+
* provider's `paginationMode`, or neither for an unpaged provider. */
|
|
382
|
+
export interface ItemsQuery {
|
|
383
|
+
search?: string;
|
|
384
|
+
paging?: {
|
|
385
|
+
limit: number;
|
|
386
|
+
offset?: number;
|
|
387
|
+
};
|
|
388
|
+
cursorPaging?: {
|
|
389
|
+
limit: number;
|
|
390
|
+
cursor?: string;
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/** The item providers installed on the CURRENT site — the categories a mention
|
|
394
|
+
* picker offers. The site is the one whose signed instance authorizes the
|
|
395
|
+
* call, so a caller that can switch business must re-list after a switch. */
|
|
396
|
+
export declare function listInstalledProviders(): Promise<ListInstalledProvidersResponse>;
|
|
397
|
+
/** Query one provider's items. `providerKey` is a provider's `key`, never its
|
|
398
|
+
* display name. */
|
|
399
|
+
export declare function queryItems(providerKey: string, query?: ItemsQuery): Promise<QueryItemsResponse>;
|
|
400
|
+
/** The provider list from a `listInstalledProviders` response, with every
|
|
401
|
+
* entry that has no key or no name dropped — neither can be offered or
|
|
402
|
+
* queried. */
|
|
403
|
+
export declare function providersOf(res: ListInstalledProvidersResponse | null | undefined): Array<{
|
|
404
|
+
key: string;
|
|
405
|
+
name: string;
|
|
406
|
+
paging: "CURSOR" | "OFFSET" | "NONE";
|
|
407
|
+
}>;
|
|
408
|
+
/** The items from a `queryItems` response, with every entry that has no id or
|
|
409
|
+
* no name dropped — an item with neither cannot be referenced or shown. */
|
|
410
|
+
export declare function itemsOf(res: QueryItemsResponse | null | undefined): Array<{
|
|
411
|
+
id: string;
|
|
412
|
+
title: string;
|
|
413
|
+
subtitle: string;
|
|
414
|
+
imageUrl: string;
|
|
415
|
+
}>;
|
|
297
416
|
/** The transcript from a getConversationMessages response, under either key. */
|
|
298
417
|
export declare function messagesOf(res: GetConversationMessagesResponse | null | undefined): ConversationMessage[];
|
|
299
418
|
/** The id of the user turn a send response stored, or "" when the service did
|
|
@@ -23,6 +23,15 @@ function wixCall(method, path, body) {
|
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
+
function mentionReference(item, category) {
|
|
27
|
+
return {
|
|
28
|
+
id: item.id,
|
|
29
|
+
label: item.title.split(/\r?\n/).join(" ").trim(),
|
|
30
|
+
data: JSON.stringify({ id: item.id, type: category }),
|
|
31
|
+
source: "mention",
|
|
32
|
+
type: "global"
|
|
33
|
+
};
|
|
34
|
+
}
|
|
26
35
|
function ariaAssistantConfig(unifiedAssistantId = ARIA_UNIFIED_ASSISTANT_ID) {
|
|
27
36
|
return { unifiedAssistantReference: { type: "unified-assistant", unifiedAssistantId } };
|
|
28
37
|
}
|
|
@@ -37,7 +46,7 @@ function conversationUserMessage(conversationId, content, opts = {}) {
|
|
|
37
46
|
if (!conversationId) throw new Error("conversationUserMessage: conversationId is required");
|
|
38
47
|
return wixCall("POST", `${BASE}/conversation-user-message`, {
|
|
39
48
|
attachments: opts.attachments ?? [],
|
|
40
|
-
messageReferences: [],
|
|
49
|
+
messageReferences: opts.messageReferences ?? [],
|
|
41
50
|
userMessageContent: content,
|
|
42
51
|
origin: opts.origin ?? ARIA_ORIGIN,
|
|
43
52
|
conversationId,
|
|
@@ -147,6 +156,42 @@ function getConversationMessages(conversationId) {
|
|
|
147
156
|
if (!conversationId) throw new Error("getConversationMessages: conversationId is required");
|
|
148
157
|
return wixCall("GET", `${BASE}/conversation-messages?conversationId=${encodeURIComponent(conversationId)}`);
|
|
149
158
|
}
|
|
159
|
+
var ITEMS_SELECTION_BASE = "https://manage.wix.com/_api/items-selection-service/v1/items-selection";
|
|
160
|
+
function listInstalledProviders() {
|
|
161
|
+
return wixCall("GET", `${ITEMS_SELECTION_BASE}/installed-providers`);
|
|
162
|
+
}
|
|
163
|
+
function queryItems(providerKey, query = {}) {
|
|
164
|
+
if (!providerKey) throw new Error("queryItems: providerKey is required");
|
|
165
|
+
return wixCall(
|
|
166
|
+
"POST",
|
|
167
|
+
`${ITEMS_SELECTION_BASE}/${encodeURIComponent(providerKey)}/items`,
|
|
168
|
+
{ providerKey, query }
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
function providersOf(res) {
|
|
172
|
+
const out = [];
|
|
173
|
+
for (const p of res?.providers ?? []) {
|
|
174
|
+
const key = typeof p?.key === "string" ? p.key.trim() : "";
|
|
175
|
+
const name = typeof p?.contentData?.providerName === "string" ? p.contentData.providerName.trim() : "";
|
|
176
|
+
if (!key || !name) continue;
|
|
177
|
+
const mode = p.paginationMode === "CURSOR" || p.paginationMode === "OFFSET" ? p.paginationMode : "NONE";
|
|
178
|
+
out.push({ key, name, paging: mode });
|
|
179
|
+
}
|
|
180
|
+
return out;
|
|
181
|
+
}
|
|
182
|
+
function itemsOf(res) {
|
|
183
|
+
const out = [];
|
|
184
|
+
for (const it of res?.items ?? []) {
|
|
185
|
+
const id = typeof it?.id === "string" ? it.id.trim() : "";
|
|
186
|
+
const title = typeof it?.name === "string" ? it.name.trim() : "";
|
|
187
|
+
if (!id || !title) continue;
|
|
188
|
+
const description = typeof it.description === "string" ? it.description.trim() : "";
|
|
189
|
+
const note = typeof it.note === "string" ? it.note.trim() : "";
|
|
190
|
+
const imageUrl = typeof it.image?.url === "string" ? it.image.url.trim() : "";
|
|
191
|
+
out.push({ id, title, subtitle: description || note, imageUrl });
|
|
192
|
+
}
|
|
193
|
+
return out;
|
|
194
|
+
}
|
|
150
195
|
function messagesOf(res) {
|
|
151
196
|
return res?.messages ?? res?.conversationMessages ?? [];
|
|
152
197
|
}
|
|
@@ -203,9 +248,14 @@ export {
|
|
|
203
248
|
getConversationMessages,
|
|
204
249
|
getConversations,
|
|
205
250
|
isGenieChatError,
|
|
251
|
+
itemsOf,
|
|
206
252
|
lastAssistantMessage,
|
|
253
|
+
listInstalledProviders,
|
|
254
|
+
mentionReference,
|
|
207
255
|
messageText,
|
|
208
256
|
messagesOf,
|
|
257
|
+
providersOf,
|
|
258
|
+
queryItems,
|
|
209
259
|
sendFunctionCallResults,
|
|
210
260
|
sendMessage,
|
|
211
261
|
triggerAssistantMessage,
|