@wix/himalaya-cli 0.1881.0 → 0.1883.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/core/sdk/app-info/src/index.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/app-info.mjs +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +1 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{c0c9168ac683637ad53e3365739c050ca372b6fd84b920b90ee3050a0cafca62.bin → 5634539b1de6317bfac96d63062a0cf58803504fbb50489c6758e427a245af27.bin} +1 -1
- package/dist/browser-plane/sw.js +1 -1
- package/dist/cli.mjs +367 -271
- package/dist/preview-assets.generated.bin +0 -0
- package/package.json +2 -2
- package/templates/beauty-salon-owner/config.ts +22 -4
- package/templates/beauty-salon-owner/dev/index.ts +2 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/community-club-owner/config.ts +22 -4
- package/templates/community-club-owner/dev/index.ts +2 -1
- package/templates/community-club-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/events-meetups-owner/config.ts +22 -4
- package/templates/events-meetups-owner/dev/index.ts +2 -1
- package/templates/events-meetups-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/gym-fitness-owner/config.ts +22 -4
- package/templates/gym-fitness-owner/dev/index.ts +2 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/nonprofit-cause-owner/config.ts +22 -4
- package/templates/nonprofit-cause-owner/dev/index.ts +2 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/owner-lite/config.ts +22 -4
- package/templates/owner-lite/dev/index.ts +2 -1
- package/templates/owner-lite/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/podcast-creator-owner/config.ts +22 -4
- package/templates/podcast-creator-owner/dev/index.ts +2 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/portfolio-creative-owner/config.ts +22 -4
- package/templates/portfolio-creative-owner/dev/index.ts +2 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/restaurant-owner/config.ts +22 -4
- package/templates/restaurant-owner/dev/index.ts +2 -1
- package/templates/restaurant-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/retail-store-owner/config.ts +22 -4
- package/templates/retail-store-owner/dev/index.ts +2 -1
- package/templates/retail-store-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
- package/templates/yoga-studio-owner/config.ts +22 -4
- package/templates/yoga-studio-owner/dev/index.ts +2 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-maestro-availability.ts +48 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-maestro/index.ts +33 -31
|
@@ -153,8 +153,8 @@ export default defineApp({
|
|
|
153
153
|
"screenId": "himi_owner_lite_maestro",
|
|
154
154
|
"isPublic": false,
|
|
155
155
|
"paramKeys": [],
|
|
156
|
-
"parentScreenId": "
|
|
157
|
-
"tabId": "
|
|
156
|
+
"parentScreenId": "",
|
|
157
|
+
"tabId": "maestro"
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
"screenId": "himi_owner_lite_brief",
|
|
@@ -566,7 +566,16 @@ export default defineApp({
|
|
|
566
566
|
"id": "aria",
|
|
567
567
|
"screenId": "himi_owner_lite_aria",
|
|
568
568
|
"label": "Aria",
|
|
569
|
-
"icon": "ai"
|
|
569
|
+
"icon": "ai",
|
|
570
|
+
"hiddenPath": "$service:ownerLiteNav.ariaTabHidden"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"id": "maestro",
|
|
574
|
+
"screenId": "himi_owner_lite_maestro",
|
|
575
|
+
"label": "Maestro",
|
|
576
|
+
"icon": "ai",
|
|
577
|
+
"hiddenPath": "$service:ownerLiteNav.maestroTabHidden",
|
|
578
|
+
"hiddenUntilResolved": true
|
|
570
579
|
},
|
|
571
580
|
{
|
|
572
581
|
"id": "manage",
|
|
@@ -596,7 +605,16 @@ export default defineApp({
|
|
|
596
605
|
"id": "aria",
|
|
597
606
|
"screenId": "himi_owner_lite_aria",
|
|
598
607
|
"label": "Aria",
|
|
599
|
-
"icon": "ai"
|
|
608
|
+
"icon": "ai",
|
|
609
|
+
"hiddenPath": "$service:ownerLiteNav.ariaTabHidden"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"id": "maestro",
|
|
613
|
+
"screenId": "himi_owner_lite_maestro",
|
|
614
|
+
"label": "Maestro",
|
|
615
|
+
"icon": "ai",
|
|
616
|
+
"hiddenPath": "$service:ownerLiteNav.maestroTabHidden",
|
|
617
|
+
"hiddenUntilResolved": true
|
|
600
618
|
},
|
|
601
619
|
{
|
|
602
620
|
"id": "manage",
|
|
@@ -64098,7 +64098,8 @@ const SCREENS = runtimeSetting({
|
|
|
64098
64098
|
"contentType": "application/javascript+ts-bundle",
|
|
64099
64099
|
"declaredCapabilities": [
|
|
64100
64100
|
"wix_api",
|
|
64101
|
-
"stream"
|
|
64101
|
+
"stream",
|
|
64102
|
+
"app_info"
|
|
64102
64103
|
],
|
|
64103
64104
|
"minBinaryVersion": "0.1.0",
|
|
64104
64105
|
"bundleVersion": "0.0.1"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Whether Maestro (Symphony's assistant) can work for one of the owner's businesses.
|
|
2
|
+
//
|
|
3
|
+
// Two things must hold: the owner has a Symphony account, and the business is the website of
|
|
4
|
+
// one of that account's Spaces. Both are asked over the owner's own Wix session; nothing here
|
|
5
|
+
// holds a credential. Shared by the Maestro screen, which needs the answer to open its chat,
|
|
6
|
+
// and __HIMI_APP_NAME__'s app-level worker, which uses it to choose the assistant tab.
|
|
7
|
+
|
|
8
|
+
export interface MaestroWixApi {
|
|
9
|
+
call: (method: string, path: string, body?: unknown, headers?: Record<string, string>) => Promise<unknown>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const NATIVE_DATA = "https://manage.wix.com/_serverless/ai-scheduling-assistant-server/native-data";
|
|
13
|
+
const SPACES = "https://manage.wix.com/_api/symphony-bff/v1/symphony/workspaces";
|
|
14
|
+
|
|
15
|
+
/** `wix-site-id` makes the host mint the credential for THAT metasite (the Symphony account),
|
|
16
|
+
* instead of the business on screen. */
|
|
17
|
+
export const forSymphonyAccount = (metaSiteId: string): Record<string, string> =>
|
|
18
|
+
({ "wix-site-id": metaSiteId, "Content-Type": "application/json" });
|
|
19
|
+
|
|
20
|
+
interface Recipient { recipient?: { metaSiteId?: string } | null }
|
|
21
|
+
interface Spaces { workspaces?: Array<{ website?: { metaSiteId?: string } | null }> }
|
|
22
|
+
|
|
23
|
+
/** The owner's Symphony metasite, or "" when they have no Symphony account. Throws when the
|
|
24
|
+
* service could not be asked. */
|
|
25
|
+
export async function symphonyAccount(api: MaestroWixApi): Promise<string> {
|
|
26
|
+
const res = (await api.call("POST", NATIVE_DATA, { action: "recipient" })) as Recipient | null;
|
|
27
|
+
const id = res?.recipient?.metaSiteId;
|
|
28
|
+
return typeof id === "string" ? id.trim() : "";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Whether `site` is the website of one of the owner's Spaces. Throws when it could not be asked. */
|
|
32
|
+
export async function isSpaceWebsite(api: MaestroWixApi, account: string, site: string): Promise<boolean> {
|
|
33
|
+
const res = (await api.call("POST", SPACES, {}, forSymphonyAccount(account))) as Spaces | null;
|
|
34
|
+
return (res?.workspaces ?? []).some((w) => w?.website?.metaSiteId === site);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type MaestroAvailability =
|
|
38
|
+
| { available: true; account: string }
|
|
39
|
+
| { available: false; why: "no_site" | "no_account" | "not_connected" };
|
|
40
|
+
|
|
41
|
+
/** The whole answer for one business. Throws when Symphony could not be asked, which is not a
|
|
42
|
+
* "no": a caller decides what an unanswered question means for it. */
|
|
43
|
+
export async function maestroAvailability(api: MaestroWixApi, site: string): Promise<MaestroAvailability> {
|
|
44
|
+
if (!site) return { available: false, why: "no_site" };
|
|
45
|
+
const account = await symphonyAccount(api);
|
|
46
|
+
if (!account) return { available: false, why: "no_account" };
|
|
47
|
+
return (await isSpaceWebsite(api, account, site)) ? { available: true, account } : { available: false, why: "not_connected" };
|
|
48
|
+
}
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
// Verified against the live service on 2026-11-24.
|
|
21
21
|
|
|
22
22
|
import { defineService } from "@himalaya/state";
|
|
23
|
+
import { get as appInfo } from "@himalaya/app-info";
|
|
23
24
|
import { deviceTimeZone } from "../_shared/engine-intl.js";
|
|
24
25
|
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
25
26
|
import { readSelectedSite } from "../_shared/owner-selected-site.js";
|
|
27
|
+
import { forSymphonyAccount, maestroAvailability } from "../_shared/owner-maestro-availability.js";
|
|
26
28
|
|
|
27
29
|
const SERVICE = "himiOwnerLiteMaestro";
|
|
28
30
|
/** The screen this worker paints: message rows are stamped `<screen>.message_<id>`. */
|
|
29
31
|
const SCREEN = "himi_owner_lite_maestro";
|
|
30
|
-
const NATIVE_DATA = "https://manage.wix.com/_serverless/ai-scheduling-assistant-server/native-data";
|
|
31
|
-
const SPACES = "https://manage.wix.com/_api/symphony-bff/v1/symphony/workspaces";
|
|
32
32
|
const CONVERSATIONS = "https://symphony.wix.com/individuals-chat/conversation/v1/conversations";
|
|
33
33
|
const SEND = "https://symphony.wix.com/_api/symphony-harness/v1/send-message-streamed-http";
|
|
34
34
|
const STREAM_ID = "maestro-turn";
|
|
@@ -49,10 +49,6 @@ function activeSiteId(): string {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
/** `wix-site-id` makes the host mint the credential for THAT metasite (the Symphony account),
|
|
53
|
-
* instead of the business on screen. */
|
|
54
|
-
const forSite = (metaSiteId: string): Record<string, string> => ({ "wix-site-id": metaSiteId, "Content-Type": "application/json" });
|
|
55
|
-
|
|
56
52
|
export interface Bubble {
|
|
57
53
|
id: string;
|
|
58
54
|
content: string;
|
|
@@ -68,7 +64,7 @@ export interface QuickReply { id: string; label: string; askId: string }
|
|
|
68
64
|
export interface Prompt { id: string; title: string; text: string }
|
|
69
65
|
|
|
70
66
|
/** Why Maestro cannot be used here. Each one sends the owner to Aria. */
|
|
71
|
-
type Unavailable = "" | "no_site" | "no_account" | "not_connected" | "unreachable";
|
|
67
|
+
type Unavailable = "" | "no_site" | "no_account" | "not_connected" | "unreachable" | "needs_update";
|
|
72
68
|
|
|
73
69
|
export interface MaestroState {
|
|
74
70
|
/** `checking` until the account and the Space are known. */
|
|
@@ -124,6 +120,12 @@ const copy = {
|
|
|
124
120
|
text: copyParam("ownerMaestro.noSite.text", "Maestro works on one business at a time. Pick one in Sites, then come back."),
|
|
125
121
|
};
|
|
126
122
|
}
|
|
123
|
+
if (why === "needs_update") {
|
|
124
|
+
return {
|
|
125
|
+
title: copyParam("ownerMaestro.needsUpdate.title", "Update the app to use Maestro"),
|
|
126
|
+
text: copyParam("ownerMaestro.needsUpdate.text", "This version of the app can't show Maestro's replies. Until you update, Aria can help."),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
127
129
|
if (why === "unreachable") {
|
|
128
130
|
return {
|
|
129
131
|
title: copyParam("ownerMaestro.unreachable.title", "Maestro can't be reached right now"),
|
|
@@ -153,6 +155,17 @@ const initial: MaestroState = {
|
|
|
153
155
|
_site: "", _account: "", _convId: "", _role: "", _openId: "", _turn: 0,
|
|
154
156
|
};
|
|
155
157
|
|
|
158
|
+
/** Whether this host can read a streamed turn. `unknown` when the host could not be asked this
|
|
159
|
+
* time: that is not a "no", and it is asked again on the next load. */
|
|
160
|
+
type ReadsTurns = "yes" | "no" | "unknown";
|
|
161
|
+
let readsTurns: "yes" | "no" | undefined;
|
|
162
|
+
async function hostReadsTurns(): Promise<ReadsTurns> {
|
|
163
|
+
if (readsTurns === undefined) {
|
|
164
|
+
try { readsTurns = (await appInfo()).ndjsonStreamAvailable === true ? "yes" : "no"; } catch { return "unknown"; }
|
|
165
|
+
}
|
|
166
|
+
return readsTurns;
|
|
167
|
+
}
|
|
168
|
+
|
|
156
169
|
function unavailable(s: MaestroState, why: Unavailable): MaestroState {
|
|
157
170
|
const text = copy.unavailable(why);
|
|
158
171
|
return {
|
|
@@ -161,27 +174,10 @@ function unavailable(s: MaestroState, why: Unavailable): MaestroState {
|
|
|
161
174
|
};
|
|
162
175
|
}
|
|
163
176
|
|
|
164
|
-
interface Recipient { recipient?: { metaSiteId?: string } | null }
|
|
165
|
-
interface Spaces { workspaces?: Array<{ website?: { metaSiteId?: string } | null }> }
|
|
166
|
-
|
|
167
|
-
/** The owner's Symphony metasite, or "" when they have no Symphony account. Throws when the
|
|
168
|
-
* service could not be asked. */
|
|
169
|
-
async function symphonyAccount(api: WixApi): Promise<string> {
|
|
170
|
-
const res = (await api.call("POST", NATIVE_DATA, { action: "recipient" })) as Recipient | null;
|
|
171
|
-
const id = res?.recipient?.metaSiteId;
|
|
172
|
-
return typeof id === "string" ? id.trim() : "";
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/** Whether `site` is the website of one of the owner's Spaces. */
|
|
176
|
-
async function isConnected(api: WixApi, account: string, site: string): Promise<boolean> {
|
|
177
|
-
const res = (await api.call("POST", SPACES, {}, forSite(account))) as Spaces | null;
|
|
178
|
-
return (res?.workspaces ?? []).some((w) => w?.website?.metaSiteId === site);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
177
|
async function createConversation(api: WixApi, account: string, site: string): Promise<string> {
|
|
182
178
|
const res = (await api.call("POST", CONVERSATIONS, {
|
|
183
179
|
conversation: { source: "SCHEDULER", communicationChannel: "APP", name: "Owner app", metadata: { wixSiteId: site } },
|
|
184
|
-
},
|
|
180
|
+
}, forSymphonyAccount(account))) as { conversation?: { id?: string } } | null;
|
|
185
181
|
const id = res?.conversation?.id;
|
|
186
182
|
return typeof id === "string" ? id : "";
|
|
187
183
|
}
|
|
@@ -195,7 +191,7 @@ function streamDirective(s: MaestroState, text: string, choice?: { askId: string
|
|
|
195
191
|
// The host authorizes the request as the Symphony metasite: no token passes through here.
|
|
196
192
|
authorize: true,
|
|
197
193
|
format: "ndjson",
|
|
198
|
-
headers: { ...
|
|
194
|
+
headers: { ...forSymphonyAccount(s._account), Accept: "application/x-ndjson", "X-Time-Budget": "300000" },
|
|
199
195
|
body: {
|
|
200
196
|
conversationId: s._convId, messageText: text, role: "USER", clientCapabilities: [],
|
|
201
197
|
deviceTimeZone: deviceTimeZone(), adoptsConversationId: true, communicationChannel: "APP",
|
|
@@ -308,19 +304,25 @@ const svc = defineService<MaestroState, {
|
|
|
308
304
|
load: async (s, arg) => {
|
|
309
305
|
stashCopy(arg);
|
|
310
306
|
const site = activeSiteId();
|
|
307
|
+
const fresh: MaestroState = { ...initial, _site: site, prompts: prompts() };
|
|
308
|
+
// A turn arrives as a stream of JSON lines. A host built before it could read one delivers
|
|
309
|
+
// nothing, so every send would end in the failure message: say so instead of offering a chat.
|
|
310
|
+
// Asked before a stored `ready` is trusted: an old host may have saved one.
|
|
311
|
+
const reads = await hostReadsTurns();
|
|
312
|
+
if (reads === "no") return unavailable(fresh, "needs_update");
|
|
311
313
|
if (s.phase === "ready" && s._site === site && site) {
|
|
312
314
|
// No turn in flight means no thinking bubble: one restored from a killed run is dropped.
|
|
313
315
|
return { ...s, prompts: prompts(), messages: s.busy ? s.messages : settled(s.messages) };
|
|
314
316
|
}
|
|
315
|
-
|
|
317
|
+
// The host could not say. A chat already open is kept (above); a new one is not opened.
|
|
318
|
+
if (reads === "unknown") return unavailable(fresh, "unreachable");
|
|
316
319
|
if (!site) return unavailable(fresh, "no_site");
|
|
317
320
|
const api = host().wixApi;
|
|
318
321
|
if (!api) return unavailable(fresh, "unreachable");
|
|
319
322
|
try {
|
|
320
|
-
const
|
|
321
|
-
if (!
|
|
322
|
-
|
|
323
|
-
return { ...fresh, phase: "ready", checkingHidden: "true", chatHidden: "false", _account: account };
|
|
323
|
+
const answer = await maestroAvailability(api, site);
|
|
324
|
+
if (!answer.available) return unavailable(fresh, answer.why);
|
|
325
|
+
return { ...fresh, phase: "ready", checkingHidden: "true", chatHidden: "false", _account: answer.account };
|
|
324
326
|
} catch {
|
|
325
327
|
return unavailable(fresh, "unreachable");
|
|
326
328
|
}
|