@wix/himalaya-cli 0.1728.0 → 0.1729.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 (53) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/entity-extraction/src/index.d.ts +34 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +4 -1
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/text-embedding/src/index.d.ts +37 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/translation/src/index.d.ts +51 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/capabilities.generated.d.ts +6 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +1 -1
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +3 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +3 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +3 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +3 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +3 -0
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/entity-extraction.mjs +38 -0
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +3 -0
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +3 -0
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +3 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +3 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +3 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/text-embedding.mjs +76 -0
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/translation.mjs +66 -0
  20. package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +12 -0
  21. package/dist/browser-plane/assets.json +5 -5
  22. package/dist/browser-plane/preview-deferred/{ec5d778f3e7ecbc2351ab7a8f3509483b798094de9f889fe8b03447db1413cb6.bin → ad21c55bd7cec9a3951ff818f08792daab5d3698b7e54af1b1764499335604ea.bin} +1 -1
  23. package/dist/browser-plane/sw.js +7 -7
  24. package/dist/cli.mjs +205 -52
  25. package/dist/preview-assets.generated.bin +0 -0
  26. package/guides/app-config.md +1 -1
  27. package/guides/capabilities.md +3 -0
  28. package/guides/importable-sdks.md +3 -0
  29. package/guides/release-notes.md +30 -0
  30. package/guides/sdk-reference.json +238 -0
  31. package/guides/web-page-sdk-reference.md +3 -0
  32. package/package.json +2 -2
  33. package/templates/beauty-salon-owner/dev/index.ts +35 -0
  34. package/templates/branded-lite/dev/index.ts +16 -0
  35. package/templates/community-club/dev/index.ts +2 -0
  36. package/templates/community-club-owner/dev/index.ts +35 -0
  37. package/templates/conference/dev/index.ts +1 -0
  38. package/templates/events-meetups/dev/index.ts +2 -0
  39. package/templates/events-meetups-owner/dev/index.ts +31 -0
  40. package/templates/gym-fitness/dev/index.ts +1 -0
  41. package/templates/gym-fitness-owner/dev/index.ts +37 -0
  42. package/templates/nonprofit-cause/dev/index.ts +2 -0
  43. package/templates/nonprofit-cause-owner/dev/index.ts +33 -0
  44. package/templates/owner-lite/dev/index.ts +37 -0
  45. package/templates/podcast-creator/dev/index.ts +2 -0
  46. package/templates/podcast-creator-owner/dev/index.ts +35 -0
  47. package/templates/portfolio-creative/dev/index.ts +2 -0
  48. package/templates/portfolio-creative-owner/dev/index.ts +35 -0
  49. package/templates/restaurant/dev/index.ts +2 -0
  50. package/templates/restaurant-owner/dev/index.ts +37 -0
  51. package/templates/retail-store-owner/dev/index.ts +33 -0
  52. package/templates/yoga-studio/dev/index.ts +2 -0
  53. package/templates/yoga-studio-owner/dev/index.ts +33 -0
@@ -0,0 +1,34 @@
1
+ export type EntityType = "date_time" | "address" | "phone" | "email" | "url" | "money" | "flight_number" | "tracking_number" | "iban" | "payment_card" | "isbn" | "person" | "place" | "organization";
2
+ export interface EntityExtractionAvailability {
3
+ available: boolean;
4
+ /** "apple_natural_language" | "mlkit" when available. */
5
+ engine?: string;
6
+ reason?: string;
7
+ }
8
+ export interface ExtractOptions {
9
+ /** BCP-47 language of the text. Default "en". */
10
+ language?: string;
11
+ /** Only these types (default: all the engine supports). */
12
+ types?: EntityType[];
13
+ }
14
+ export interface Entity {
15
+ /** The entity as it appears in the text. */
16
+ text: string;
17
+ /** Start index into the input (inclusive). */
18
+ start: number;
19
+ /** End index into the input (exclusive). */
20
+ end: number;
21
+ type: EntityType;
22
+ /** A normalised form when the engine has one — ISO-8601 for date_time, the URL for url, … */
23
+ value?: string;
24
+ }
25
+ export interface ExtractResult {
26
+ /** In order of appearance. */
27
+ entities: Entity[];
28
+ engine: string;
29
+ }
30
+ /** Whether on-device entity extraction is available for a language (default "en"). Never rejects. */
31
+ export declare function availability(language?: string): Promise<EntityExtractionAvailability>;
32
+ /** Extract entities from text on device. Rejects when unavailable. */
33
+ export declare function extract(text: string, opts?: ExtractOptions): Promise<ExtractResult>;
34
+ export declare const version = 1;
@@ -11,6 +11,7 @@ export declare const CAPABILITY_REGISTRY: {
11
11
  readonly camera: readonly ["capture", "pickDocument", "prepareImage", "scanQR"];
12
12
  readonly clipboard: readonly ["hasImage", "hasText", "readText", "writeImage", "writeText"];
13
13
  readonly contacts: readonly ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"];
14
+ readonly entity_extraction: readonly ["availability", "extract"];
14
15
  readonly file_picker: readonly ["pick", "pickDirectoryForExport"];
15
16
  readonly files: readonly ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"];
16
17
  readonly godot: readonly ["loadPack", "release", "send"];
@@ -40,15 +41,17 @@ export declare const CAPABILITY_REGISTRY: {
40
41
  readonly speech: readonly ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"];
41
42
  readonly system_intents: readonly ["donate", "refreshShortcuts"];
42
43
  readonly tasks: readonly ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"];
44
+ readonly text_embedding: readonly ["availability", "embed"];
43
45
  readonly text_recognition: readonly ["availability", "recognize"];
44
46
  readonly theme: readonly ["applyOverlay", "clearOverlay", "surfaces"];
45
47
  readonly torch: readonly ["off", "on", "status", "toggle"];
48
+ readonly translation: readonly ["availability", "identifyLanguage", "prepare", "translate"];
46
49
  readonly ui: readonly ["alert", "snackbar"];
47
50
  readonly wix_cashier: readonly ["isAvailable", "proceedToPayment"];
48
51
  readonly wix_chat: readonly ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"];
49
52
  };
50
53
  /** A capability id backed by an @himalaya/* SDK binding. */
51
- export type SdkCapability = "app_info" | "audio_record" | "barcode_detection" | "base44" | "biometrics" | "browser_auth" | "calendar" | "calls" | "camera" | "clipboard" | "contacts" | "file_picker" | "files" | "godot" | "haptic" | "health" | "himi_apps" | "iap" | "image_labeling" | "keyboard" | "legacy_import" | "live_activity" | "local_database" | "location" | "media_playback" | "motion" | "network" | "on_device_ai" | "open_url" | "pdf" | "photos" | "presigned_upload" | "push" | "release_control" | "secure_storage" | "share" | "speaker_diarization" | "speech" | "system_intents" | "tasks" | "text_recognition" | "theme" | "torch" | "ui" | "wix_cashier" | "wix_chat";
54
+ export type SdkCapability = "app_info" | "audio_record" | "barcode_detection" | "base44" | "biometrics" | "browser_auth" | "calendar" | "calls" | "camera" | "clipboard" | "contacts" | "entity_extraction" | "file_picker" | "files" | "godot" | "haptic" | "health" | "himi_apps" | "iap" | "image_labeling" | "keyboard" | "legacy_import" | "live_activity" | "local_database" | "location" | "media_playback" | "motion" | "network" | "on_device_ai" | "open_url" | "pdf" | "photos" | "presigned_upload" | "push" | "release_control" | "secure_storage" | "share" | "speaker_diarization" | "speech" | "system_intents" | "tasks" | "text_embedding" | "text_recognition" | "theme" | "torch" | "translation" | "ui" | "wix_cashier" | "wix_chat";
52
55
  /** All `capability.<id>.<verb>` action ids, flattened (the worker-bridge wire vocabulary). */
53
56
  export declare const CAPABILITY_ACTION_IDS: readonly string[];
54
57
  /** Capability id → the @himalaya/* package(s) a worker imports to reach it — every dispatch
@@ -0,0 +1,37 @@
1
+ /** The most texts one `embed` call takes. */
2
+ export declare const MAX_TEXTS_PER_CALL = 64;
3
+ export interface TextEmbeddingAvailability {
4
+ available: boolean;
5
+ /** "apple_natural_language" | "mediapipe" when available. */
6
+ engine?: string;
7
+ /** Vector length, when known. */
8
+ dimensions?: number;
9
+ /** Why it is unavailable — on Android, also while the model is still downloading. */
10
+ reason?: string;
11
+ }
12
+ export interface EmbedResult {
13
+ /** One vector per input text, in the same order. */
14
+ vectors: number[][];
15
+ dimensions: number;
16
+ engine: string;
17
+ }
18
+ export interface RankedText {
19
+ text: string;
20
+ /** Index of the text in the input array. */
21
+ index: number;
22
+ /** Cosine similarity to the query, -1..1. */
23
+ score: number;
24
+ }
25
+ /** Whether on-device embeddings are available for a language (default "en"). Never rejects. */
26
+ export declare function availability(language?: string): Promise<TextEmbeddingAvailability>;
27
+ /** Embed up to {@link MAX_TEXTS_PER_CALL} texts on device. Rejects when unavailable. */
28
+ export declare function embed(texts: string[], opts?: {
29
+ language?: string;
30
+ }): Promise<EmbedResult>;
31
+ /** Cosine similarity of two vectors (-1..1); 0 when either is empty or zero or their lengths differ. */
32
+ export declare function cosineSimilarity(a: readonly number[], b: readonly number[]): number;
33
+ /** Rank `candidates` by semantic similarity to `query`, most similar first. Embeds in batches. */
34
+ export declare function rank(query: string, candidates: string[], opts?: {
35
+ language?: string;
36
+ }): Promise<RankedText[]>;
37
+ export declare const version = 1;
@@ -0,0 +1,51 @@
1
+ export type PairStatus = "installed" | "downloadable" | "unsupported";
2
+ export interface TranslationAvailability {
3
+ available: boolean;
4
+ /** "apple_translation" | "mlkit" | "chrome_built_in" when available. */
5
+ engine?: string;
6
+ reason?: string;
7
+ }
8
+ export interface PairAvailability extends TranslationAvailability {
9
+ status: PairStatus;
10
+ }
11
+ export interface LanguageCandidate {
12
+ language: string;
13
+ confidence: number;
14
+ }
15
+ export interface IdentifyResult {
16
+ /** The most likely language, or "und". */
17
+ language: string;
18
+ confidence: number;
19
+ /** Up to five candidates, most likely first. */
20
+ candidates: LanguageCandidate[];
21
+ engine: string;
22
+ }
23
+ export interface PrepareResult {
24
+ status: PairStatus;
25
+ engine: string;
26
+ reason?: string;
27
+ }
28
+ export interface TranslateInput {
29
+ text: string;
30
+ /** The language to translate into. */
31
+ target: string;
32
+ /** The source language; identified from the text when omitted. */
33
+ source?: string;
34
+ }
35
+ export interface TranslateResult {
36
+ text: string;
37
+ source: string;
38
+ target: string;
39
+ engine: string;
40
+ }
41
+ /** Whether on-device translation is available at all on this device / host (spec R8). Never rejects. */
42
+ export declare function availability(): Promise<TranslationAvailability>;
43
+ /** Whether a language pair is installed, downloadable or unsupported. Never rejects. */
44
+ export declare function pairAvailability(source: string, target: string): Promise<PairAvailability>;
45
+ /** Identify the language of a piece of text. Rejects when unavailable. */
46
+ export declare function identifyLanguage(text: string): Promise<IdentifyResult>;
47
+ /** Download a pair's models where the platform allows it (Android, web), and answer its status. */
48
+ export declare function prepare(source: string, target: string): Promise<PrepareResult>;
49
+ /** Translate text on device. Rejects when the pair is unavailable or the source cannot be identified. */
50
+ export declare function translate(input: TranslateInput): Promise<TranslateResult>;
51
+ export declare const version = 1;
@@ -9,6 +9,7 @@ import type * as CallsSdk from "@wix/himalaya/calls";
9
9
  import type * as CameraSdk from "@wix/himalaya/camera";
10
10
  import type * as ClipboardSdk from "@wix/himalaya/clipboard";
11
11
  import type * as ContactsSdk from "@wix/himalaya/contacts";
12
+ import type * as EntityExtractionSdk from "@wix/himalaya/entity-extraction";
12
13
  import type * as FilePickerSdk from "@wix/himalaya/file-picker";
13
14
  import type * as FilesSdk from "@wix/himalaya/files";
14
15
  import type * as GodotSdk from "@wix/himalaya/godot";
@@ -38,9 +39,11 @@ import type * as SpeakerDiarizationSdk from "@wix/himalaya/speaker-diarization";
38
39
  import type * as SpeechSdk from "@wix/himalaya/speech";
39
40
  import type * as SystemIntentsSdk from "@wix/himalaya/system-intents";
40
41
  import type * as TasksSdk from "@wix/himalaya/tasks";
42
+ import type * as TextEmbeddingSdk from "@wix/himalaya/text-embedding";
41
43
  import type * as TextRecognitionSdk from "@wix/himalaya/text-recognition";
42
44
  import type * as ThemeSdk from "@wix/himalaya/theme";
43
45
  import type * as TorchSdk from "@wix/himalaya/torch";
46
+ import type * as TranslationSdk from "@wix/himalaya/translation";
44
47
  import type * as UiSdk from "@wix/himalaya/ui";
45
48
  import type * as WixCashierSdk from "@wix/himalaya/wix-cashier";
46
49
  import type * as WixChatSdk from "@wix/himalaya/wix-chat";
@@ -67,6 +70,7 @@ export interface HimalayaPageCapabilities {
67
70
  readonly "camera": PageModule<typeof CameraSdk> & PageEvents;
68
71
  readonly "clipboard": PageModule<typeof ClipboardSdk> & PageEvents;
69
72
  readonly "contacts": PageModule<typeof ContactsSdk> & PageEvents;
73
+ readonly "entity_extraction": PageModule<typeof EntityExtractionSdk> & PageEvents;
70
74
  readonly "file_picker": PageModule<typeof FilePickerSdk> & PageEvents;
71
75
  readonly "files": PageModule<typeof FilesSdk> & PageEvents;
72
76
  readonly "godot": PageModule<typeof GodotSdk> & PageEvents;
@@ -96,9 +100,11 @@ export interface HimalayaPageCapabilities {
96
100
  readonly "speech": PageModule<typeof SpeechSdk> & PageEvents;
97
101
  readonly "system_intents": PageModule<typeof SystemIntentsSdk> & PageEvents;
98
102
  readonly "tasks": PageModule<typeof TasksSdk> & PageEvents;
103
+ readonly "text_embedding": PageModule<typeof TextEmbeddingSdk> & PageEvents;
99
104
  readonly "text_recognition": PageModule<typeof TextRecognitionSdk> & PageEvents;
100
105
  readonly "theme": PageModule<typeof ThemeSdk> & PageEvents;
101
106
  readonly "torch": PageModule<typeof TorchSdk> & PageEvents;
107
+ readonly "translation": PageModule<typeof TranslationSdk> & PageEvents;
102
108
  readonly "ui": PageModule<typeof UiSdk> & PageEvents;
103
109
  readonly "wix_cashier": PageModule<typeof WixCashierSdk> & PageEvents;
104
110
  readonly "wix_chat": PageModule<typeof WixChatSdk> & PageEvents;
@@ -883,7 +883,7 @@ export interface OrientationEnvelope {
883
883
  export declare const DEFAULT_ORIENTATION_ENVELOPE: Required<OrientationEnvelope>;
884
884
  /** Fill in the absent families. Total, so callers never branch on `undefined`. */
885
885
  export declare function resolveOrientationEnvelope(env?: OrientationEnvelope): Required<OrientationEnvelope>;
886
- export type Capability = "camera" | "barcode_scanner" | "biometrics" | "secure_storage" | "share" | "push" | "file_picker" | "files" | "open_url" | "pdf" | "clipboard" | "theme" | "l10n" | "photos" | "presigned_upload" | "ui" | "calendar" | "contacts" | "tasks" | "audio_record" | "audio_record_background" | "calls" | "location" | "location_background" | "motion" | "health" | "media_playback" | "webview" | "browser_auth" | "haptic" | "himi_apps" | "iap" | "keyboard" | "torch" | "network" | "wix_cashier" | "wix_chat" | "live_activity" | "local_database" | "speech" | "speaker_diarization" | "system_intents" | "on_device_ai" | "text_recognition" | "image_labeling" | "barcode_detection" | "app_info" | "release_control" | "legacy_import" | "godot" | "base44" | "animation" | "video_playback";
886
+ export type Capability = "camera" | "barcode_scanner" | "biometrics" | "secure_storage" | "share" | "push" | "file_picker" | "files" | "open_url" | "pdf" | "clipboard" | "theme" | "l10n" | "photos" | "presigned_upload" | "ui" | "calendar" | "contacts" | "tasks" | "audio_record" | "audio_record_background" | "calls" | "location" | "location_background" | "motion" | "health" | "media_playback" | "webview" | "browser_auth" | "haptic" | "himi_apps" | "iap" | "keyboard" | "torch" | "network" | "wix_cashier" | "wix_chat" | "live_activity" | "local_database" | "speech" | "speaker_diarization" | "system_intents" | "on_device_ai" | "text_recognition" | "translation" | "image_labeling" | "barcode_detection" | "text_embedding" | "entity_extraction" | "app_info" | "release_control" | "legacy_import" | "godot" | "base44" | "animation" | "video_playback";
887
887
  /** `defineApp({ wixIap })` — the purchases-service app a build binds this app to. */
888
888
  export interface WixIapConfig {
889
889
  /** The purchases service's app UUID, registered on the app's own auth site. Not a secret. */
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -15441,6 +15441,7 @@ var PAGE_CAPABILITY_DISPATCHES = {
15441
15441
  "camera": [],
15442
15442
  "clipboard": [],
15443
15443
  "contacts": [],
15444
+ "entity_extraction": [],
15444
15445
  "file_picker": [],
15445
15446
  "files": [],
15446
15447
  "godot": [],
@@ -15470,9 +15471,11 @@ var PAGE_CAPABILITY_DISPATCHES = {
15470
15471
  "speech": [],
15471
15472
  "system_intents": [],
15472
15473
  "tasks": [],
15474
+ "text_embedding": [],
15473
15475
  "text_recognition": [],
15474
15476
  "theme": [],
15475
15477
  "torch": [],
15478
+ "translation": [],
15476
15479
  "ui": [],
15477
15480
  "wix_cashier": [],
15478
15481
  "wix_chat": [],
@@ -0,0 +1,38 @@
1
+ // ../../core/sdk/dispatch/src/index.ts
2
+ function dispatch(handlerId, params, _options) {
3
+ const himalaya = globalThis.himalaya;
4
+ if (!himalaya) {
5
+ return Promise.reject(
6
+ new Error("@himalaya/dispatch: called outside a Himalaya runtime. This bundle must run inside a JSWorker (Tier 5).")
7
+ );
8
+ }
9
+ const stringParams = {};
10
+ if (params) {
11
+ for (const [k, v] of Object.entries(params)) stringParams[k] = String(v);
12
+ }
13
+ return himalaya.dispatch(handlerId, stringParams);
14
+ }
15
+
16
+ // ../../core/sdk/entity-extraction/src/index.ts
17
+ async function availability(language) {
18
+ const r = await dispatch("capability.entity_extraction.availability", language ? { language } : {});
19
+ return { available: r?.available === true, engine: r?.engine, reason: r?.reason };
20
+ }
21
+ async function extract(text, opts = {}) {
22
+ if (typeof text !== "string") throw new Error("entity-extraction.extract: text is required");
23
+ if (text.length === 0) return { entities: [], engine: "" };
24
+ const r = await dispatch("capability.entity_extraction.extract", {
25
+ text,
26
+ ...opts.language ? { language: opts.language } : {},
27
+ ...opts.types?.length ? { types: opts.types.join(",") } : {}
28
+ });
29
+ const entities = Array.isArray(r?.entities) ? [...r.entities].sort((a, b) => a.start - b.start) : [];
30
+ return { entities, engine: r?.engine ?? "" };
31
+ }
32
+ var version = 1;
33
+ export {
34
+ availability,
35
+ extract,
36
+ version
37
+ };
38
+ //# sourceMappingURL=entity-extraction.mjs.map
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -11,6 +11,7 @@ var CAPABILITY_REGISTRY = {
11
11
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
12
12
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
13
13
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
14
+ "entity_extraction": ["availability", "extract"],
14
15
  "file_picker": ["pick", "pickDirectoryForExport"],
15
16
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
16
17
  "godot": ["loadPack", "release", "send"],
@@ -40,9 +41,11 @@ var CAPABILITY_REGISTRY = {
40
41
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
41
42
  "system_intents": ["donate", "refreshShortcuts"],
42
43
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
44
+ "text_embedding": ["availability", "embed"],
43
45
  "text_recognition": ["availability", "recognize"],
44
46
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
45
47
  "torch": ["off", "on", "status", "toggle"],
48
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
46
49
  "ui": ["alert", "snackbar"],
47
50
  "wix_cashier": ["isAvailable", "proceedToPayment"],
48
51
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -26,6 +26,7 @@ var CAPABILITY_REGISTRY = {
26
26
  "camera": ["capture", "pickDocument", "prepareImage", "scanQR"],
27
27
  "clipboard": ["hasImage", "hasText", "readText", "writeImage", "writeText"],
28
28
  "contacts": ["add", "getPermissionStatus", "pick", "presentNewContact", "requestPermission", "search"],
29
+ "entity_extraction": ["availability", "extract"],
29
30
  "file_picker": ["pick", "pickDirectoryForExport"],
30
31
  "files": ["download", "export", "list", "readText", "remove", "stat", "storageInfo", "write"],
31
32
  "godot": ["loadPack", "release", "send"],
@@ -55,9 +56,11 @@ var CAPABILITY_REGISTRY = {
55
56
  "speech": ["availability", "recognizeOnce", "speak", "stop", "streamNext", "streamStart", "streamStop", "transcribeFile"],
56
57
  "system_intents": ["donate", "refreshShortcuts"],
57
58
  "tasks": ["backend", "create", "getPermissionStatus", "list", "remove", "requestPermission", "setCompleted"],
59
+ "text_embedding": ["availability", "embed"],
58
60
  "text_recognition": ["availability", "recognize"],
59
61
  "theme": ["applyOverlay", "clearOverlay", "surfaces"],
60
62
  "torch": ["off", "on", "status", "toggle"],
63
+ "translation": ["availability", "identifyLanguage", "prepare", "translate"],
61
64
  "ui": ["alert", "snackbar"],
62
65
  "wix_cashier": ["isAvailable", "proceedToPayment"],
63
66
  "wix_chat": ["getRealtimeStatus", "subscribeRealtime", "unsubscribeRealtime"]
@@ -0,0 +1,76 @@
1
+ // ../../core/sdk/dispatch/src/index.ts
2
+ function dispatch(handlerId, params, _options) {
3
+ const himalaya = globalThis.himalaya;
4
+ if (!himalaya) {
5
+ return Promise.reject(
6
+ new Error("@himalaya/dispatch: called outside a Himalaya runtime. This bundle must run inside a JSWorker (Tier 5).")
7
+ );
8
+ }
9
+ const stringParams = {};
10
+ if (params) {
11
+ for (const [k, v] of Object.entries(params)) stringParams[k] = String(v);
12
+ }
13
+ return himalaya.dispatch(handlerId, stringParams);
14
+ }
15
+
16
+ // ../../core/sdk/text-embedding/src/index.ts
17
+ var MAX_TEXTS_PER_CALL = 64;
18
+ async function availability(language) {
19
+ const r = await dispatch("capability.text_embedding.availability", language ? { language } : {});
20
+ return {
21
+ available: r?.available === true,
22
+ engine: r?.engine,
23
+ dimensions: typeof r?.dimensions === "number" ? r.dimensions : void 0,
24
+ reason: r?.reason
25
+ };
26
+ }
27
+ async function embed(texts, opts = {}) {
28
+ if (!Array.isArray(texts) || texts.length === 0) throw new Error("text-embedding.embed: at least one text is required");
29
+ if (texts.length > MAX_TEXTS_PER_CALL) {
30
+ throw new Error(`text-embedding.embed: at most ${MAX_TEXTS_PER_CALL} texts per call (got ${texts.length})`);
31
+ }
32
+ const r = await dispatch("capability.text_embedding.embed", {
33
+ texts: JSON.stringify(texts),
34
+ ...opts.language ? { language: opts.language } : {}
35
+ });
36
+ const vectors = Array.isArray(r?.vectors) ? r.vectors : [];
37
+ return {
38
+ vectors,
39
+ dimensions: typeof r?.dimensions === "number" ? r.dimensions : vectors[0]?.length ?? 0,
40
+ engine: r?.engine ?? ""
41
+ };
42
+ }
43
+ function cosineSimilarity(a, b) {
44
+ if (a.length === 0 || a.length !== b.length) return 0;
45
+ let dot = 0;
46
+ let na = 0;
47
+ let nb = 0;
48
+ for (let i = 0; i < a.length; i++) {
49
+ dot += a[i] * b[i];
50
+ na += a[i] * a[i];
51
+ nb += b[i] * b[i];
52
+ }
53
+ if (na === 0 || nb === 0) return 0;
54
+ return dot / Math.sqrt(na * nb);
55
+ }
56
+ async function rank(query, candidates, opts = {}) {
57
+ if (candidates.length === 0) return [];
58
+ const [q] = (await embed([query], opts)).vectors;
59
+ const scored = [];
60
+ for (let start = 0; start < candidates.length; start += MAX_TEXTS_PER_CALL) {
61
+ const batch = candidates.slice(start, start + MAX_TEXTS_PER_CALL);
62
+ const { vectors } = await embed(batch, opts);
63
+ batch.forEach((text, i) => scored.push({ text, index: start + i, score: cosineSimilarity(q ?? [], vectors[i] ?? []) }));
64
+ }
65
+ return scored.sort((x, y) => y.score - x.score);
66
+ }
67
+ var version = 1;
68
+ export {
69
+ MAX_TEXTS_PER_CALL,
70
+ availability,
71
+ cosineSimilarity,
72
+ embed,
73
+ rank,
74
+ version
75
+ };
76
+ //# sourceMappingURL=text-embedding.mjs.map
@@ -0,0 +1,66 @@
1
+ // ../../core/sdk/dispatch/src/index.ts
2
+ function dispatch(handlerId, params, _options) {
3
+ const himalaya = globalThis.himalaya;
4
+ if (!himalaya) {
5
+ return Promise.reject(
6
+ new Error("@himalaya/dispatch: called outside a Himalaya runtime. This bundle must run inside a JSWorker (Tier 5).")
7
+ );
8
+ }
9
+ const stringParams = {};
10
+ if (params) {
11
+ for (const [k, v] of Object.entries(params)) stringParams[k] = String(v);
12
+ }
13
+ return himalaya.dispatch(handlerId, stringParams);
14
+ }
15
+
16
+ // ../../core/sdk/translation/src/index.ts
17
+ function asStatus(s) {
18
+ return s === "installed" || s === "downloadable" ? s : "unsupported";
19
+ }
20
+ async function availability() {
21
+ const r = await dispatch("capability.translation.availability");
22
+ return { available: r?.available === true, engine: r?.engine, reason: r?.reason };
23
+ }
24
+ async function pairAvailability(source, target) {
25
+ const r = await dispatch("capability.translation.availability", { source, target });
26
+ return { available: r?.available === true, engine: r?.engine, reason: r?.reason, status: asStatus(r?.status) };
27
+ }
28
+ async function identifyLanguage(text) {
29
+ if (!text) throw new Error("translation.identifyLanguage: text is required");
30
+ const r = await dispatch("capability.translation.identifyLanguage", { text });
31
+ return {
32
+ language: r?.language || "und",
33
+ confidence: typeof r?.confidence === "number" ? r.confidence : 0,
34
+ candidates: Array.isArray(r?.candidates) ? r.candidates : [],
35
+ engine: r?.engine ?? ""
36
+ };
37
+ }
38
+ async function prepare(source, target) {
39
+ const r = await dispatch("capability.translation.prepare", { source, target });
40
+ return { status: asStatus(r?.status), engine: r?.engine ?? "", reason: r?.reason };
41
+ }
42
+ async function translate(input) {
43
+ if (!input.text) throw new Error("translation.translate: text is required");
44
+ if (!input.target) throw new Error("translation.translate: target is required");
45
+ const r = await dispatch("capability.translation.translate", {
46
+ text: input.text,
47
+ target: input.target,
48
+ ...input.source ? { source: input.source } : {}
49
+ });
50
+ return {
51
+ text: r?.text ?? "",
52
+ source: r?.source ?? input.source ?? "und",
53
+ target: r?.target ?? input.target,
54
+ engine: r?.engine ?? ""
55
+ };
56
+ }
57
+ var version = 1;
58
+ export {
59
+ availability,
60
+ identifyLanguage,
61
+ pairAvailability,
62
+ prepare,
63
+ translate,
64
+ version
65
+ };
66
+ //# sourceMappingURL=translation.mjs.map